beaglebone 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/beaglebone.gemspec +2 -2
- data/lib/beaglebone/pwm.rb +11 -7
- metadata +8 -9
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bd4dd26d7627a126ed4a5f315942d16724136c08
|
4
|
+
data.tar.gz: 558f566a04bf66511f6db3cfdffcc4a999532223
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 39d6bfe6373fb6a1ca16dd10a644b976817d9c2d57b4563af797ee632649f7977ff5a699b5f539cd8d7e88c653562ad28b667cca47846de814051374bbf5c4b8
|
7
|
+
data.tar.gz: 68251d8e20f6de73d5224c404252697f5f76c6fcc10444c4d390a12e5401a57b72c7fcda8d3988fa526218408cebc528b8a050b1b8431007b645224ecc3ce895
|
data/beaglebone.gemspec
CHANGED
data/lib/beaglebone/pwm.rb
CHANGED
@@ -49,7 +49,6 @@ module Beaglebone #:nodoc:
|
|
49
49
|
Beaglebone::set_pin_status(pin, :fd_polarity, polarity_fd)
|
50
50
|
Beaglebone::set_pin_status(pin, :fd_run, run_fd)
|
51
51
|
|
52
|
-
|
53
52
|
read_period_value(pin)
|
54
53
|
read_duty_value(pin)
|
55
54
|
read_polarity_value(pin)
|
@@ -163,13 +162,14 @@ module Beaglebone #:nodoc:
|
|
163
162
|
|
164
163
|
period = newperiod || Beaglebone::get_pin_status(pin, :period)
|
165
164
|
|
166
|
-
value = ((duty * period) / 100).
|
165
|
+
value = ((duty * period) / 100.0).round
|
167
166
|
|
168
167
|
fd.write(value.to_s)
|
169
168
|
fd.flush
|
170
169
|
|
171
170
|
raise StandardError, "Could not set duty cycle: #{pin} (#{value})" unless read_duty_value(pin) == value
|
172
171
|
|
172
|
+
Beaglebone::set_pin_status(pin, :duty_pct, duty)
|
173
173
|
value
|
174
174
|
|
175
175
|
end
|
@@ -201,7 +201,8 @@ module Beaglebone #:nodoc:
|
|
201
201
|
fd.write(value.to_s)
|
202
202
|
fd.flush
|
203
203
|
|
204
|
-
|
204
|
+
#since we're setting the duty_ns, we want to update the duty_pct value as well here.
|
205
|
+
raise StandardError, "Could not set duty cycle: #{pin} (#{value})" unless read_duty_value(pin, true) == value
|
205
206
|
|
206
207
|
value
|
207
208
|
end
|
@@ -223,7 +224,7 @@ module Beaglebone #:nodoc:
|
|
223
224
|
duty_ns = Beaglebone::get_pin_status(pin, :duty)
|
224
225
|
duty_pct = Beaglebone::get_pin_status(pin, :duty_pct)
|
225
226
|
|
226
|
-
value = (1000000000 / frequency).
|
227
|
+
value = (1000000000 / frequency).round
|
227
228
|
|
228
229
|
#we can't set the frequency lower than the previous duty cycle
|
229
230
|
#adjust if necessary
|
@@ -348,7 +349,7 @@ module Beaglebone #:nodoc:
|
|
348
349
|
end
|
349
350
|
|
350
351
|
#read duty file
|
351
|
-
def read_duty_value(pin)
|
352
|
+
def read_duty_value(pin, setpct=false)
|
352
353
|
check_pwm_enabled(pin)
|
353
354
|
|
354
355
|
fd = Beaglebone::get_pin_status(pin, :fd_duty)
|
@@ -358,7 +359,11 @@ module Beaglebone #:nodoc:
|
|
358
359
|
value = fd.read.strip.to_i
|
359
360
|
|
360
361
|
Beaglebone::set_pin_status(pin, :duty, value)
|
361
|
-
|
362
|
+
# only set duty_pct if it is unset or if we are forcing it.
|
363
|
+
if setpct || Beaglebone::get_pin_status(pin, :duty_pct).nil?
|
364
|
+
duty_pct = ((value * 100.0) / Beaglebone::get_pin_status(pin, :period)).round
|
365
|
+
Beaglebone::set_pin_status(pin, :duty_pct, duty_pct)
|
366
|
+
end
|
362
367
|
|
363
368
|
value
|
364
369
|
end
|
@@ -374,7 +379,6 @@ module Beaglebone #:nodoc:
|
|
374
379
|
value = fd.read.strip.to_i
|
375
380
|
|
376
381
|
Beaglebone::set_pin_status(pin, :period, value)
|
377
|
-
Beaglebone::set_pin_status(pin, :duty_pct, ((Beaglebone::get_pin_status(pin, :duty).to_i * 100) / value).to_i)
|
378
382
|
|
379
383
|
value
|
380
384
|
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaglebone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Rob Mosher
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-29 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: A Full Featured Beaglebone IO Gem
|
15
14
|
email: nyt-rubygems@countercultured.net
|
@@ -33,26 +32,26 @@ files:
|
|
33
32
|
homepage: https://github.com/notnyt/beaglebone
|
34
33
|
licenses:
|
35
34
|
- 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
|
42
41
|
requirements:
|
43
|
-
- -
|
42
|
+
- - ">="
|
44
43
|
- !ruby/object:Gem::Version
|
45
44
|
version: '0'
|
46
45
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
-
none: false
|
48
46
|
requirements:
|
49
|
-
- -
|
47
|
+
- - ">="
|
50
48
|
- !ruby/object:Gem::Version
|
51
49
|
version: '0'
|
52
50
|
requirements: []
|
53
51
|
rubyforge_project:
|
54
|
-
rubygems_version:
|
52
|
+
rubygems_version: 2.2.2
|
55
53
|
signing_key:
|
56
|
-
specification_version:
|
54
|
+
specification_version: 4
|
57
55
|
summary: Beaglebone IO Gem
|
58
56
|
test_files: []
|
57
|
+
has_rdoc:
|