beaglebone 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 68eaf4ade8ad13496f5398d406cb224abb91bdb8
4
- data.tar.gz: ca0aac0679b26ea1307c469d552406478754c863
3
+ metadata.gz: 55046e8cad71090664e27203de1fe74cb6111e71
4
+ data.tar.gz: f3690c4cb8d86a7c8e640a531c9cf4f501e45a8b
5
5
  SHA512:
6
- metadata.gz: 9bc2e2a6e7e4bd32084faa96dd12a4d4fa6f7f6bcaafecaa151a824c04721d9445b24f1041069da6f6807e7fa8245116578c10f56ce635673b575428104b66bc
7
- data.tar.gz: 3c1ca6528e16c2e8a771d6baa18e07be2d209b5f2b5e21a7be20793d506d5876f6c573b923191dbc941f1c94fb230c63c1937a74d72cfd768d2e8d581e768b81
6
+ metadata.gz: 61e7091c7b1cc1ff8ed255228f3813ebf9cdc8b26d25efd6bda76dafac0ab65214f54c644b876a975f68480f4558ab3b8585673daf3dd89ed2b57eff391f4768
7
+ data.tar.gz: 73c4924d8e245f5eee866b913ffae1d89d24b897d196a6534525ee99280f65748563349bf66b4a16a516e8432a2227a2fafb2ed533f7c52b97762260e70b4b0c
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'beaglebone'
3
- s.version = '1.2.2'
4
- s.date = '2014-08-01'
3
+ s.version = '1.2.3'
4
+ s.date = '2014-10-04'
5
5
  s.summary = 'Beaglebone IO Gem'
6
6
  s.description = 'A Full Featured Beaglebone IO Gem'
7
7
  s.author = 'Rob Mosher'
@@ -15,6 +15,47 @@ module Beaglebone #:nodoc:
15
15
  class << self
16
16
  attr_accessor :uartstatus, :uartmutex
17
17
 
18
+ # dts template for UART3 device
19
+ UARTTEMPLATE = []
20
+ UARTTEMPLATE[3] = '
21
+ /dts-v1/;
22
+ /plugin/;
23
+
24
+ / {
25
+ compatible = "ti,beaglebone", "ti,beaglebone-black";
26
+
27
+ /* identification */
28
+ part-number = "BB-UART3";
29
+ version = "00A0";
30
+
31
+ /* state the resources this cape uses */
32
+ exclusive-use =
33
+ /* the pin header uses */
34
+ "P9.42", /* uart3_txd */
35
+ /* the hardware ip uses */
36
+ "uart3";
37
+
38
+ fragment@0 {
39
+ target = <&am33xx_pinmux>;
40
+ __overlay__ {
41
+ bb_uart3_pins: pinmux_bb_uart3_pins {
42
+ pinctrl-single,pins = <
43
+ 0x164 0x01
44
+ >;
45
+ };
46
+ };
47
+ };
48
+
49
+ fragment@1 {
50
+ target = <&uart4>; /* really uart3 */
51
+ __overlay__ {
52
+ status = "okay";
53
+ pinctrl-names = "default";
54
+ pinctrl-0 = <&bb_uart3_pins>;
55
+ };
56
+ };
57
+ };
58
+ '
18
59
 
19
60
  # Initialize a UART device
20
61
  #
@@ -32,6 +73,9 @@ module Beaglebone #:nodoc:
32
73
 
33
74
  uartinfo = UARTS[uart]
34
75
 
76
+ #ensure we have a dtb to load
77
+ create_device_tree(uart)
78
+
35
79
  #ensure dtb is loaded
36
80
  Beaglebone::device_tree_load("#{TREES[:UART][:pin]}#{uartinfo[:id]}")
37
81
 
@@ -392,12 +436,16 @@ module Beaglebone #:nodoc:
392
436
  raise ArgumentError, "Invalid UART Specified #{uart.to_s}" unless UARTS[uart]
393
437
  uartinfo = UARTS[uart.to_sym]
394
438
 
395
- unless uartinfo[:tx] && [nil,:uart].include?(Beaglebone::get_pin_status(uartinfo[:tx], :type))
396
- raise StandardError, "TX Pin for #{uart.to_s} in use"
439
+ if uartinfo[:tx]
440
+ unless [nil,:uart].include?(Beaglebone::get_pin_status(uartinfo[:tx], :type))
441
+ raise StandardError, "TX Pin for #{uart.to_s} in use"
442
+ end
397
443
  end
398
444
 
399
- unless uartinfo[:rx] && [nil,:uart].include?(Beaglebone::get_pin_status(uartinfo[:rx], :type))
400
- raise StandardError, "RX Pin for #{uart.to_s} in use"
445
+ if uartinfo[:rx]
446
+ unless [nil,:uart].include?(Beaglebone::get_pin_status(uartinfo[:rx], :type))
447
+ raise StandardError, "RX Pin for #{uart.to_s} in use"
448
+ end
401
449
  end
402
450
 
403
451
  end
@@ -439,6 +487,33 @@ module Beaglebone #:nodoc:
439
487
 
440
488
  end
441
489
 
490
+ def create_device_tree(uart, force = false)
491
+ uartinfo = UARTS[uart]
492
+
493
+ #ensure valid uart, and a template to create this exists
494
+ return unless uartinfo
495
+
496
+ uartnum = uartinfo[:id]
497
+
498
+ return unless uartnum && UARTTEMPLATE[uartnum]
499
+
500
+ dts = UARTTEMPLATE[uartinfo[:id]].clone
501
+
502
+ filename = "/lib/firmware/#{TREES[:UART][:pin]}#{uartnum}-00A0"
503
+ dts_fn = "#{filename}.dts"
504
+ dtb_fn = "#{filename}.dtbo"
505
+
506
+ # if we've already built this file, we don't need to do it again
507
+ return if File.exists?(dtb_fn) && !force
508
+
509
+ dts_file = File.open(dts_fn, 'w')
510
+ dts_file.write(dts)
511
+ dts_file.close
512
+
513
+ system("dtc -O dtb -o #{dtb_fn} -b 0 -@ #{dts_fn}")
514
+
515
+ end
516
+
442
517
  end
443
518
  end
444
519
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaglebone
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Mosher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-01 00:00:00.000000000 Z
11
+ date: 2014-10-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Full Featured Beaglebone IO Gem
14
14
  email: nyt-rubygems@countercultured.net
@@ -39,18 +39,19 @@ require_paths:
39
39
  - lib
40
40
  required_ruby_version: !ruby/object:Gem::Requirement
41
41
  requirements:
42
- - - '>='
42
+ - - ">="
43
43
  - !ruby/object:Gem::Version
44
44
  version: '0'
45
45
  required_rubygems_version: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
50
  requirements: []
51
51
  rubyforge_project:
52
- rubygems_version: 2.0.3
52
+ rubygems_version: 2.2.2
53
53
  signing_key:
54
54
  specification_version: 4
55
55
  summary: Beaglebone IO Gem
56
56
  test_files: []
57
+ has_rdoc: