humble_rpi 0.3.2 → 0.4.1
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.tar.gz.sig +0 -0
- data/lib/humble_rpi.rb +39 -5
- metadata +6 -5
- 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: 1ef02172efd60c32a60f3d2f25375826669caae4
|
4
|
+
data.tar.gz: f9fdd9c800d89cec60331511d5d60aabdd6af972
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 811f0df96ccf1fce3b0b0ee51c744b27f7d498afef9cc26bf332e1d2a817abac2daec21bb92f3c9fd86fae2738747e691b552685d4324dff4a09407530c8b11f
|
7
|
+
data.tar.gz: 03163f5e89f259f44b738b8caa27daeb029da16381cd2d04c8797ea2461eafe618e188048b777b8eea2fcc31974a3f2e1de99f11f844982768214806f99cdd16
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/humble_rpi.rb
CHANGED
@@ -20,7 +20,8 @@ class HumbleRPi
|
|
20
20
|
device_name: 'rpi',
|
21
21
|
lcd_pins: {},
|
22
22
|
led_pins: [],
|
23
|
-
motion_pin: nil,
|
23
|
+
motion_pin: nil,
|
24
|
+
button_pins: [],
|
24
25
|
sps_address: nil,
|
25
26
|
sps_port: '59000'
|
26
27
|
}
|
@@ -33,11 +34,17 @@ class HumbleRPi
|
|
33
34
|
@led = RPi.new(led_pins).led if led_pins.any?
|
34
35
|
@ws = nil
|
35
36
|
|
36
|
-
if @opt[:motion_pin] then
|
37
|
+
if @opt[:motion_pin] or @opt[:button_pins] then
|
38
|
+
|
37
39
|
at_exit do
|
38
|
-
|
39
|
-
|
40
|
-
|
40
|
+
|
41
|
+
[@opt[:motion_pin], @opt[:button_pins]].flatten.compact.each do |pin|
|
42
|
+
|
43
|
+
uexp = open("/sys/class/gpio/unexport", "w")
|
44
|
+
uexp.write(pin)
|
45
|
+
uexp.close
|
46
|
+
|
47
|
+
end
|
41
48
|
end
|
42
49
|
end
|
43
50
|
end
|
@@ -55,6 +62,33 @@ class HumbleRPi
|
|
55
62
|
end
|
56
63
|
|
57
64
|
protected
|
65
|
+
|
66
|
+
def button_detect()
|
67
|
+
|
68
|
+
send_message :info, 'button press detection activated'
|
69
|
+
|
70
|
+
topic = @opt[:device_name]
|
71
|
+
address, port = @opt[:sps_address], @opt[:sps_port]
|
72
|
+
|
73
|
+
hrpi = self
|
74
|
+
|
75
|
+
@opt[:button_pins].each.with_index do |button, i|
|
76
|
+
|
77
|
+
puts 'button %s on GPIO %s enabled ' % [i+1, button]
|
78
|
+
|
79
|
+
n = (i+1).to_s
|
80
|
+
|
81
|
+
PiPiper.watch :pin => button.to_i, :invert => true do |pin|
|
82
|
+
|
83
|
+
hrpi.send_message 'buttonpressed/' + n, "value %s" % [pin.value]
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
PiPiper.wait
|
90
|
+
|
91
|
+
end
|
58
92
|
|
59
93
|
def listener(&blk)
|
60
94
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: humble_rpi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
999CZL08Zqxa+1DKwhW/XqeiQ9eIZ+1fLAK+XbAKgv6ghNYEPtZLUFiD73uUbsKd
|
32
32
|
sBqeV1LF1yKYmA==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2015-
|
34
|
+
date: 2015-05-19 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rpi
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
version: '0.2'
|
123
123
|
- - ">="
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: 0.2.
|
125
|
+
version: 0.2.3
|
126
126
|
type: :runtime
|
127
127
|
prerelease: false
|
128
128
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -132,7 +132,7 @@ dependencies:
|
|
132
132
|
version: '0.2'
|
133
133
|
- - ">="
|
134
134
|
- !ruby/object:Gem::Version
|
135
|
-
version: 0.2.
|
135
|
+
version: 0.2.3
|
136
136
|
description:
|
137
137
|
email: james@r0bertson.co.uk
|
138
138
|
executables: []
|
@@ -164,5 +164,6 @@ rubygems_version: 2.4.6
|
|
164
164
|
signing_key:
|
165
165
|
specification_version: 4
|
166
166
|
summary: 'Designed for a Raspberry Pi which uses GPIOs for the following: LEDs, a
|
167
|
-
PIR sensor, a 16x2 LCD. Communicates with a SimplePubSub message
|
167
|
+
PIR sensor, a 16x2 LCD or push buttons. Communicates with a SimplePubSub message
|
168
|
+
broker'
|
168
169
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|