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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7b96caa1e75f00d7da6cf17d2e032e46751bc504
4
- data.tar.gz: 13b47b39c5ef6f8bf02dd70fa90a9914f39882ee
2
+ SHA256:
3
+ metadata.gz: 5e5b633cb5ef9d9a6f02bf1963a00f8301dc0d923f91413f54037b3b0ce68b2e
4
+ data.tar.gz: 056bd0ee309d1bc6b5f7985c6f38af6d223b26a65ec940210ebb2d4d4dd85fed
5
5
  SHA512:
6
- metadata.gz: 10b31138168058a2c8e9efad77ded45c6042e5943220efeed40328d6de20c7523ec7381924e846b626417e28362d903d69951233b8f73d954d74b289746bd536
7
- data.tar.gz: be3d31aa7834dbe354d3a4108ca3b1f95e6ad375b162540b341081882de0b1dd169afd3a202951ce52d7eb3b23c33bec8ff5bf60835f1c61f3f549f897a8efb1
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
- def initialize(id, pull: nil)
10
-
11
- @id = id
12
- unexport()
9
+ include RXFHelperModule if defined?(RXFHelperModule)
10
+
11
+ def initialize(id, simulator=nil, pull: nil)
13
12
 
14
- File.write '/sys/class/gpio/export', id
15
- File.write "/sys/class/gpio/gpio#{id}/direction", 'in'
13
+ @id, @simulator = id, simulator
16
14
 
17
- case pull
18
- when :up
19
- File.write "/sys/class/gpio/gpio#{id}/direction", 'high'
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.2
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
- MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
- YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
- 8ixkARkWAmV1MB4XDTE2MDQxMTE3NTEzM1oXDTE3MDQxMTE3NTEzM1owSDESMBAG
16
- A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
- EjAQBgoJ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1F6oWjjiCxv49+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: 2016-04-11 00:00:00.000000000 Z
38
+ date: 2021-10-14 00:00:00.000000000 Z
35
39
  dependencies: []
36
40
  description:
37
- email: james@r0bertson.co.uk
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.4.8
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