humble_rpi-plugin-led 0.2.2 → 0.2.3
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/humble_rpi-plugin-led.rb +29 -6
- data.tar.gz.sig +0 -0
- metadata +4 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8ada755e047f52911a4d2709fe123bfdcde20c9
|
4
|
+
data.tar.gz: 6915c66dc6a0159b8d662eba3b439ebd917999ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d36181b258edd33393f66cb46043cf47f9524bb3e51112bbabc668fc05ea3911cb4b11c7b8c2c577569407b08873548029ff1f3b654c591cb63d14dcb12f04a8
|
7
|
+
data.tar.gz: 0ed31ca0e49dd09d290aec17cb109c0145e03f6657a0b0b873d5d86d37b5b81813dacc15c9b5bb7b36f6faabc863ff7e4e563d00b5ad94f741a0c1740044ac26
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -2,10 +2,8 @@
|
|
2
2
|
|
3
3
|
# file: humble_rpi-plugin-led.rb
|
4
4
|
|
5
|
-
|
6
|
-
require 'requestor'
|
5
|
+
require 'rpi_led'
|
7
6
|
|
8
|
-
eval Requestor.read('http://rorbuilder.info/r/ruby'){|x| x.require 'rpi_led'}
|
9
7
|
|
10
8
|
|
11
9
|
class HumbleRPiPluginLed
|
@@ -14,7 +12,7 @@ class HumbleRPiPluginLed
|
|
14
12
|
|
15
13
|
x = settings[:pins]
|
16
14
|
|
17
|
-
|
15
|
+
pins = case x
|
18
16
|
when Fixnum
|
19
17
|
[x]
|
20
18
|
when Integer
|
@@ -25,11 +23,36 @@ class HumbleRPiPluginLed
|
|
25
23
|
x
|
26
24
|
end
|
27
25
|
|
26
|
+
@lookup = {}
|
27
|
+
@gpio_pins = []
|
28
|
+
|
29
|
+
# each pin can contain an identifier e.g. pins = [{'4': 'record'}, 17]
|
30
|
+
# an LED can be identified by the identifier instead of the numberic index
|
31
|
+
|
32
|
+
pins.each do |x|
|
33
|
+
|
34
|
+
if x.is_a? Integer then
|
35
|
+
|
36
|
+
@lookup.merge!(x.to_s.to_sym => x )
|
37
|
+
@gpio_pins << x
|
38
|
+
|
39
|
+
elsif x.is_a? Hash
|
40
|
+
|
41
|
+
n = x.keys.first.to_s
|
42
|
+
|
43
|
+
led_name = x[n.to_sym]
|
44
|
+
@lookup.merge!(n.to_sym => n.to_i )
|
45
|
+
@lookup.merge!(led_name.to_sym => n.to_i )
|
46
|
+
@gpio_pins << n.to_i
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
28
51
|
end
|
29
52
|
|
30
53
|
def on_led_message(message)
|
31
54
|
|
32
|
-
r = message.match(/(\
|
55
|
+
r = message.match(/(\w+)\s*(on|off|blink)\s*([\d\.]+)?(?:\s*duration\s)?([\d\.]+)?/)
|
33
56
|
|
34
57
|
if r then
|
35
58
|
index, state, seconds, raw_duration = r.captures
|
@@ -48,7 +71,7 @@ class HumbleRPiPluginLed
|
|
48
71
|
[:blink, seconds, duration: duration]
|
49
72
|
end
|
50
73
|
|
51
|
-
@led[index.to_i].send(*a)
|
74
|
+
@led[@lookup[index].to_i].send(*a)
|
52
75
|
end
|
53
76
|
end
|
54
77
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: humble_rpi-plugin-led
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
kuXWaEX0BC/yqishnYeDqOuqzvI1C4/7lvY+i4RJn3y13EP8RbXUlRa2A+PcKx0e
|
32
32
|
pi5a3T8Qg0ZT5A==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
34
|
+
date: 2017-07-26 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rpi_led
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: 0.1.3
|
56
56
|
description:
|
57
|
-
email: james@
|
57
|
+
email: james@jamesrobertson.eu
|
58
58
|
executables: []
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
82
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
83
|
+
rubygems_version: 2.6.8
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: A humble_rpi plugin for LEDs
|
metadata.gz.sig
CHANGED
Binary file
|