beaglebone 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -3
- data/beaglebone.gemspec +1 -1
- data/lib/beaglebone/beaglebone.rb +3 -3
- data/lib/beaglebone/gpio.rb +10 -0
- metadata +8 -7
- checksums.yaml +0 -7
data/README.md
CHANGED
@@ -6,6 +6,7 @@
|
|
6
6
|
- [Installing Ruby](#installing-ruby)
|
7
7
|
- [Installing Beaglebone Gem](#installing-beaglebone-gem)
|
8
8
|
- [Usage](#usage)
|
9
|
+
- [Ruby in Cloud9](#ruby-in-cloud9)
|
9
10
|
- [Pin Information](#pin-information)
|
10
11
|
- [GPIO Pins](#gpio-pins)
|
11
12
|
- [Analog Pins](#analog-pins)
|
@@ -71,14 +72,15 @@ require 'beaglebone'
|
|
71
72
|
include Beaglebone
|
72
73
|
```
|
73
74
|
|
75
|
+
### Ruby in Cloud9
|
76
|
+
Cloud9 has native Ruby support. Name your files with the extension .rb to run Ruby in Cloud9
|
77
|
+
|
74
78
|
## Pin Information
|
75
79
|
The Beaglebone has two headers of IO pins. Documentation on these pins is available [here](http://beagleboard.org/Support/bone101#headers).
|
76
80
|
|
77
81
|
### GPIO Pins
|
78
82
|
The beaglebone has a large number of GPIO pins. These pins function at 3.3v. Do not provide more than 3.3v to any GPIO pin or risk damaging the hardware.
|
79
83
|
|
80
|
-
Not all GPIO pins will be usable. Currently there is a bug affecting P9_17 and P9_18. They do not function in the latest Debian image.
|
81
|
-
|
82
84
|
There are built in _capes_ that have priority over the GPIO pins unless disabled. These are for HDMI and the onboard eMMC. It is documented [here](http://beagleboard.org/Support/bone101#headers-black). It is possible to disable these _capes_ if you are not using them.
|
83
85
|
|
84
86
|
### Analog Pins
|
@@ -710,7 +712,7 @@ spi.disable
|
|
710
712
|
```
|
711
713
|
|
712
714
|
## Examples (Procedural)
|
713
|
-
This library supports _procedural_ methods as well as
|
715
|
+
This library supports _procedural_ methods as well as _object oriented_ methods. They are virtually identical to the _object oriented_ methods, except the first argument they take is the pin. If a callback is required, it is still passed first, before the pin. The examples directory has sample code in both formats.
|
714
716
|
|
715
717
|
The procedural versions of the examples are available in the file [procedural-examples.md](procedural-examples.md).
|
716
718
|
|
data/beaglebone.gemspec
CHANGED
@@ -88,9 +88,9 @@ module Beaglebone
|
|
88
88
|
:P9_14 => { :gpio => 40, :pwm => 'pwm_1a', :pwm_id => 1, :pwm_mux => 6 },
|
89
89
|
:P9_15 => { :gpio => 48 },
|
90
90
|
:P9_16 => { :gpio => 51, :pwm => 'pwm_1b', :pwm_id => 1, :pwm_mux => 6 },
|
91
|
-
#
|
92
|
-
:P9_17 => { :gpio =>
|
93
|
-
:P9_18 => { :gpio =>
|
91
|
+
# these gpio values for P9_17 and P9_18 are swapped due to http://bugs.elinux.org/issues/81
|
92
|
+
:P9_17 => { :gpio => 5, :gpio_devicetree => 'bspm_P9_17_f', :i2c => 'i2c1_scl', :i2c_id => 1, :spi => 'spi0_cs0', :spi_id => 0 },
|
93
|
+
:P9_18 => { :gpio => 4, :gpio_devicetree => 'bspm_P9_18_f', :i2c => 'i2c1_sda', :i2c_id => 1, :spi => 'spi0_d1', :spi_id => 0 },
|
94
94
|
:P9_19 => { :i2c => 'i2c2_scl', :i2c_id => 2, :uart => 'uart1_rtsn', :uart_id => 1, :spi => 'spi1_cs1', :spi_id => 1 },
|
95
95
|
:P9_20 => { :i2c => 'i2c2_sda', :i2c_id => 2, :uart => 'uart1_ctsn', :uart_id => 1, :spi => 'spi1_cs0', :spi_id => 1 },
|
96
96
|
:P9_21 => { :gpio => 3, :pwm => 'pwm_0b', :pwm_id => 0, :pwm_mux => 3, :i2c => 'i2c2_scl', :i2c_id => 2, :uart => 'uart2_txd', :uart_id => 2, :spi => 'spi0_d0', :spi_id => 0 },
|
data/lib/beaglebone/gpio.rb
CHANGED
@@ -40,6 +40,11 @@ module Beaglebone #:nodoc:
|
|
40
40
|
Beaglebone::disable_pin(pin)
|
41
41
|
end
|
42
42
|
|
43
|
+
#check to see if we need to load a device tree for this pin
|
44
|
+
if pininfo[:gpio_devicetree]
|
45
|
+
Beaglebone::device_tree_load(pininfo[:gpio_devicetree])
|
46
|
+
end
|
47
|
+
|
43
48
|
#export pin unless its an on board LED, if it isn't already exported
|
44
49
|
if pininfo[:led]
|
45
50
|
raise StandardError, "LEDs only support OUT mode: #{pin.to_s}" unless mode == :OUT
|
@@ -356,6 +361,11 @@ module Beaglebone #:nodoc:
|
|
356
361
|
#write to unexport to disable gpio
|
357
362
|
File.open('/sys/class/gpio/unexport', 'w') { |f| f.write(pininfo[:gpio]) }
|
358
363
|
|
364
|
+
#check to see if we need to load a device tree for this pin
|
365
|
+
if pininfo[:gpio_devicetree]
|
366
|
+
Beaglebone::device_tree_unload(pininfo[:gpio_devicetree])
|
367
|
+
end
|
368
|
+
|
359
369
|
#remove status from hash so following enabled? call checks actual system
|
360
370
|
Beaglebone::delete_pin_status(pin)
|
361
371
|
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaglebone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Rob Mosher
|
@@ -32,26 +33,26 @@ files:
|
|
32
33
|
homepage: https://github.com/notnyt/beaglebone
|
33
34
|
licenses:
|
34
35
|
- GPL-3.0
|
35
|
-
metadata: {}
|
36
36
|
post_install_message:
|
37
37
|
rdoc_options: []
|
38
38
|
require_paths:
|
39
39
|
- lib
|
40
40
|
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
41
42
|
requirements:
|
42
|
-
- -
|
43
|
+
- - ! '>='
|
43
44
|
- !ruby/object:Gem::Version
|
44
45
|
version: '0'
|
45
46
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
46
48
|
requirements:
|
47
|
-
- -
|
49
|
+
- - ! '>='
|
48
50
|
- !ruby/object:Gem::Version
|
49
51
|
version: '0'
|
50
52
|
requirements: []
|
51
53
|
rubyforge_project:
|
52
|
-
rubygems_version:
|
54
|
+
rubygems_version: 1.8.23
|
53
55
|
signing_key:
|
54
|
-
specification_version:
|
56
|
+
specification_version: 3
|
55
57
|
summary: Beaglebone IO Gem
|
56
58
|
test_files: []
|
57
|
-
has_rdoc:
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 7d1fecde923209c0cabecdf1c41de3f8e99fa55a
|
4
|
-
data.tar.gz: 57d57be7fec5c58081c35c1e6c1d9480fd8925be
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: c140d7bd8140a8ef2db244f49dacd4e30b37f0b077718033079f535ea5f503b68e8352b45e56f2b0ad14e9b2beb551c5444d1e3ae9eb207770295b57f0081dd8
|
7
|
-
data.tar.gz: 9219b114d6416dc258f7be46d589efdf4b351587adc226db35fe46dae9caba9b1afce7c37b44d40d3554573efacac9a6a18857e8e22cf17dd5e8319a7515113c
|