humble_rpi-plugin-button 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8709377a1a6ea45f2d2020d0952d4373d3c4c6cc
4
+ data.tar.gz: 4d3aa845297fe4ad98722c8925a8529844276a6a
5
+ SHA512:
6
+ metadata.gz: 09566ad633be79e01162351019f1a0061ebb7eabb20a69a6975ff4c2daa41f8543c7dd53baaeea05ea1e69ffe1d5ce2a1d3b7ec95cecfea52fa86bec573ae2e1
7
+ data.tar.gz: 8a29c6949f9ffc35a76d30116a84b0f5e964b268cbc0944e94d795b09000bd48148a742244e4ca535aee8488261c2426c93e8ee1025c971ccd38372cc616bfd7
@@ -0,0 +1 @@
1
+ �i�0�6@N����~�L �C�>}��+��w/b�� ��貴�a6f!?�&��GT�n��7d����v'��f��א�k��o̲H1
Binary file
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: humble_rpi-plugin-button.rb
4
+
5
+
6
+ require 'pi_piper'
7
+
8
+
9
+ class HumbleRPiPluginButton
10
+ include PiPiper
11
+
12
+ def initialize(settings: {}, variables: {})
13
+
14
+ @pins = settings[:pins]
15
+ @notifier = variables[:notifier]
16
+ @device_id = variables[:device_id] || 'pi'
17
+
18
+ at_exit do
19
+
20
+ @pins.each do |pin|
21
+
22
+ uexp = open("/sys/class/gpio/unexport", "w")
23
+ uexp.write(pin)
24
+ uexp.close
25
+
26
+ end
27
+ end
28
+
29
+
30
+ end
31
+
32
+ def start()
33
+
34
+ notifier = @notifier
35
+ device_id = @device_id
36
+
37
+ puts 'ready to detect buttons'
38
+
39
+ @pins.each.with_index do |button, i|
40
+
41
+ puts 'button %s on GPIO %s enabled ' % [i+1, button]
42
+
43
+ n = (i+1).to_s
44
+
45
+ PiPiper.watch :pin => button.to_i, :invert => true do |pin|
46
+
47
+ notifier.notice "%s/button/%s: value %s" % [device_id, i, pin.value]
48
+
49
+ end
50
+
51
+ end
52
+
53
+ PiPiper.wait
54
+
55
+
56
+ end
57
+
58
+ alias on_start start
59
+
60
+
61
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: humble_rpi-plugin-button
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTE1MDYxNDEwMDMwOVoXDTE2MDYxMzEwMDMwOVowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBANhm8Uiq4D3P0UGJeUjzVd+I8XD9VAvEfXtjlrwiQe9lV5SIrrWeWTjnoKy6
19
+ R0jg2KV+lR1g9wcXMuKKqBsSUIhUJveMXyQt2ETRhSc4gjMIN/Bn0WV/5EgBkzgS
20
+ F6j1e84fSKbhWItGWAcJv4ls7akaTJJc2+HOSwpPxAHQjaBHusTbkeBjhEe1SEkB
21
+ +mWTttJ/9T2ctvMXHCuAlYL28qv+ogi9g1rWS5sEpMkJh3z6cRI3kpcaaf2wrTRW
22
+ 2n7Zk4Jpda1uIxCGuMh3OlxIo1OellGIWt8SHOzd+RyL3BUiwAG6F2XVuGWpoAZT
23
+ gaVtf8iRZpgoEsO9U/hXCqBTQMUCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUECQZXszWc6h72Btlf7XDoYi9YYUwJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAjjY9Wv3M
27
+ fCZg0CL8u/xC9z9eAw7OeJQtpMeB6Jjw9fKELLpRSQL/a9iQZ78n5Q2+CpskTBWA
28
+ vh1ZWZ5zI8q8hy/IEfUgCBw6IqDaCNWkMHucHgGaSIXlQxe+S7JSmMJP/JeCirfO
29
+ Tp2Th3/huM1OubWC+FNwRBtfUzStlzyMjiLL2fi3S5EKUXqa4eLw6G9xKCnK2kEd
30
+ I027U4NpDP4SpfgCaDmzQAu0C7EifIWFsZJh1CiDes4SkUNEbNr4RFFqWVhGTifh
31
+ BpuaDRLyhUfMJfBG+PlWbU2XPeE6pbRnGWCbBwZtUcCzSfwfEehXiw0aZOMCG6Gu
32
+ OTO58NMjMKNbdQ==
33
+ -----END CERTIFICATE-----
34
+ date: 2015-06-14 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: pi_piper
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '1.3'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 1.3.2
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '1.3'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 1.3.2
56
+ description:
57
+ email: james@r0bertson.co.uk
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/humble_rpi-plugin-button.rb
63
+ homepage: https://github.com/jrobertson/humble_rpi-plugin-button
64
+ licenses:
65
+ - MIT
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 2.4.6
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: A humble_rpi plugin which detects a button press.
87
+ test_files: []
@@ -0,0 +1 @@
1
+ �@�@���:}͌ܵm�nM�zN����&��^L��O�{�\L����\mI��� ¼