rpi_pinin 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data/lib/rpi_pinin.rb +22 -12
- data.tar.gz.sig +0 -0
- metadata +28 -24
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5e5b633cb5ef9d9a6f02bf1963a00f8301dc0d923f91413f54037b3b0ce68b2e
|
4
|
+
data.tar.gz: 056bd0ee309d1bc6b5f7985c6f38af6d223b26a65ec940210ebb2d4d4dd85fed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70f8341180907ea8c32581307d5fc28d785f3e9a646efc9111482c55aeddf02622fe2bade393cbf0ecc12561512bef269ffb900898300394f55958c47a5ac1f3
|
7
|
+
data.tar.gz: 1538381a52fcfc569a06a9811c9e6d4521a975c02dd248a39654846730be7eae509f73dc98af16fbc3d60a63e0ddb09397164b1050ddecd3b5d52105a9721a3b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/rpi_pinin.rb
CHANGED
@@ -6,21 +6,26 @@
|
|
6
6
|
|
7
7
|
class RPiPinIn
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
unexport()
|
9
|
+
include RXFHelperModule if defined?(RXFHelperModule)
|
10
|
+
|
11
|
+
def initialize(id, simulator=nil, pull: nil)
|
13
12
|
|
14
|
-
|
15
|
-
File.write "/sys/class/gpio/gpio#{id}/direction", 'in'
|
13
|
+
@id, @simulator = id, simulator
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
if not @simulator then
|
16
|
+
unexport()
|
17
|
+
|
18
|
+
File.write '/sys/class/gpio/export', id
|
19
|
+
File.write "/sys/class/gpio/gpio#{id}/direction", 'in'
|
20
|
+
|
21
|
+
case pull
|
22
|
+
when :up
|
23
|
+
File.write "/sys/class/gpio/gpio#{id}/direction", 'high'
|
24
|
+
end
|
25
|
+
|
26
|
+
at_exit { unexport() }
|
20
27
|
end
|
21
28
|
|
22
|
-
at_exit { unexport() }
|
23
|
-
|
24
29
|
end
|
25
30
|
|
26
31
|
# override this method if you wish
|
@@ -66,6 +71,8 @@ class RPiPinIn
|
|
66
71
|
end
|
67
72
|
|
68
73
|
old_value = value
|
74
|
+
|
75
|
+
sleep 0.1
|
69
76
|
end
|
70
77
|
|
71
78
|
end
|
@@ -78,7 +85,10 @@ class RPiPinIn
|
|
78
85
|
private
|
79
86
|
|
80
87
|
def read_value()
|
88
|
+
|
89
|
+
return FileX.read(@simulator) if @simulator
|
81
90
|
File.read("/sys/class/gpio/gpio#{@id}/value").chomp == '0' ? 1 : 0
|
91
|
+
|
82
92
|
end
|
83
93
|
|
84
94
|
# to avoid "Device or resource busy @ fptr_finalize - /sys/class/gpio/export"
|
@@ -90,4 +100,4 @@ class RPiPinIn
|
|
90
100
|
|
91
101
|
File.write "/sys/class/gpio/unexport", @id
|
92
102
|
end
|
93
|
-
end
|
103
|
+
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rpi_pinin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,31 +10,35 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|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1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
|
28
|
+
BgkqhkiG9w0BAQsFAAOCAYEALPxy5/Jw1T/b1eJQp8hDuANB+YvpDd6QyzFeqMwE
|
29
|
+
JVOKWJTx1F6oWjjiCxv49+C9ujh7oo3qtposUnFSImx2kzcJYGte1NI37+PMgMgT
|
30
|
+
/pHLVcet+WP7CyFYeOXefXck6f4VH1FbMSPe9KqrmdMRLnk1SBNtWVJ+EZ/SsHOe
|
31
|
+
0B8XiPFYbWHYwnHsWwZuadDuN2KAy4iZD8VJPtFaEjmMqc61lveHoWdMtm1CPcAe
|
32
|
+
G846Jo4dojhlKTC9TBnoGsXRcKtTDQorDPOaU0WqUR9xyxFhfxU3H8ztgRTibr+j
|
33
|
+
bwsZvi3P5fslnRxnBOwsX0KTmwYq8UDG4B20pmkfnrN1nWPHzkw9Zx2AHMRoOp0N
|
34
|
+
FEkJmjF9cVW/c6IOTWO+CZ/+T7MGpxivWCQW+fwMJ9XLzxjsIMAo6iekWnpAnDXC
|
35
|
+
cfdqJ5yaCbFSQKiyU9l+E518j5NOpabQXNr9adeGQCDaRZWRTSTIbX4VXr7kf5fk
|
36
|
+
da61+jftWGnR12HM6OT65L6Q
|
33
37
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
38
|
+
date: 2021-10-14 00:00:00.000000000 Z
|
35
39
|
dependencies: []
|
36
40
|
description:
|
37
|
-
email: james@
|
41
|
+
email: james@jamesrobertson.eu
|
38
42
|
executables: []
|
39
43
|
extensions: []
|
40
44
|
extra_rdoc_files: []
|
@@ -60,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
64
|
version: '0'
|
61
65
|
requirements: []
|
62
66
|
rubyforge_project:
|
63
|
-
rubygems_version: 2.
|
67
|
+
rubygems_version: 2.7.10
|
64
68
|
signing_key:
|
65
69
|
specification_version: 4
|
66
70
|
summary: Represents a Raspberry Pi GPIO pin in e.g. to read a button press.
|
metadata.gz.sig
CHANGED
Binary file
|