apiotics_factory 1.0.10 → 1.0.11
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc34ff80e944a802640bf24550bad2c6820516fe
|
4
|
+
data.tar.gz: 54a52f64ed9f20c61a3095dacf878eb9119547c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e15192466ea9bbffde687b6962ff2b2973e29f4bca82e7732e970a83fc7ced64784062190e6a814e020cf03a53f525ad6ddffc94abc28e32133a1e4ab02b583
|
7
|
+
data.tar.gz: 1736aad7fe530139cb68dba1c93abfc193ad3cb16ad35046f23371e84e18b6bc44f56859ffb7e7a0342e45b1d6b4ae8e0387c332d7fbeb57972cbfd759c01759
|
@@ -11,11 +11,11 @@ class I2CDevice::Driver::GPIO < I2CDevice::Driver::Base
|
|
11
11
|
def self.export(pin) #:nodoc:
|
12
12
|
File.open("/sys/class/gpio/export", "w") do |f|
|
13
13
|
begin
|
14
|
-
f.flock(
|
14
|
+
f.flock(File::LOCK_EX)
|
15
15
|
f.syswrite(pin)
|
16
|
-
f.flock(
|
16
|
+
f.flock(File::LOCK_UN)
|
17
17
|
rescue
|
18
|
-
f.flock(
|
18
|
+
f.flock(File::LOCK_UN)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -23,11 +23,11 @@ class I2CDevice::Driver::GPIO < I2CDevice::Driver::Base
|
|
23
23
|
def self.unexport(pin) #:nodoc:
|
24
24
|
File.open("/sys/class/gpio/unexport", "w") do |f|
|
25
25
|
begin
|
26
|
-
f.flock(
|
26
|
+
f.flock(File::LOCK_EX)
|
27
27
|
f.syswrite(pin)
|
28
|
-
f.flock(
|
28
|
+
f.flock(File::LOCK_UN)
|
29
29
|
rescue
|
30
|
-
f.flock(
|
30
|
+
f.flock(File::LOCK_UN)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -36,11 +36,11 @@ class I2CDevice::Driver::GPIO < I2CDevice::Driver::Base
|
|
36
36
|
# [:in, :out, :high, :low].include?(direction) or raise "direction must be :in, :out, :high or :low"
|
37
37
|
File.open("/sys/class/gpio/gpio#{pin}/direction", "w") do |f|
|
38
38
|
begin
|
39
|
-
f.flock(
|
39
|
+
f.flock(File::LOCK_EX)
|
40
40
|
f.syswrite(direction)
|
41
|
-
f.flock(
|
41
|
+
f.flock(File::LOCK_UN)
|
42
42
|
rescue
|
43
|
-
f.flock(
|
43
|
+
f.flock(File::LOCK_UN)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -48,11 +48,11 @@ class I2CDevice::Driver::GPIO < I2CDevice::Driver::Base
|
|
48
48
|
def self.read(pin) #:nodoc:
|
49
49
|
File.open("/sys/class/gpio/gpio#{pin}/value", "r") do |f|
|
50
50
|
begin
|
51
|
-
f.flock(
|
51
|
+
f.flock(File::LOCK_EX)
|
52
52
|
f.sysread(1).to_i
|
53
|
-
f.flock(
|
53
|
+
f.flock(File::LOCK_UN)
|
54
54
|
rescue
|
55
|
-
f.flock(
|
55
|
+
f.flock(File::LOCK_UN)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
@@ -60,11 +60,11 @@ class I2CDevice::Driver::GPIO < I2CDevice::Driver::Base
|
|
60
60
|
def self.write(pin, val) #:nodoc:
|
61
61
|
File.open("/sys/class/gpio/gpio#{pin}/value", "w") do |f|
|
62
62
|
begin
|
63
|
-
f.flock(
|
63
|
+
f.flock(File::LOCK_EX)
|
64
64
|
f.syswrite(val ? "1" : "0")
|
65
|
-
f.flock(
|
65
|
+
f.flock(File::LOCK_UN)
|
66
66
|
rescue
|
67
|
-
f.flock(
|
67
|
+
f.flock(File::LOCK_UN)
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
@@ -40,15 +40,15 @@ class I2CDevice::Driver::I2CDev < I2CDevice::Driver::Base
|
|
40
40
|
def i2cget(address, param, length)
|
41
41
|
i2c = File.open(@path, "r+")
|
42
42
|
begin
|
43
|
-
i2c.flock(
|
43
|
+
i2c.flock(File::LOCK_EX)
|
44
44
|
i2c.ioctl(@slave_command, address)
|
45
45
|
i2c.syswrite(param.chr) unless param.nil?
|
46
46
|
ret = i2c.sysread(length)
|
47
|
-
i2c.flock(
|
47
|
+
i2c.flock(File::LOCK_UN)
|
48
48
|
i2c.close
|
49
49
|
ret
|
50
50
|
rescue
|
51
|
-
f.flock(
|
51
|
+
f.flock(File::LOCK_UN)
|
52
52
|
end
|
53
53
|
rescue Errno::EIO => e
|
54
54
|
raise I2CDevice::I2CIOError, e.message
|
@@ -58,13 +58,13 @@ class I2CDevice::Driver::I2CDev < I2CDevice::Driver::Base
|
|
58
58
|
def i2cset(address, *data)
|
59
59
|
i2c = File.open(@path, "r+")
|
60
60
|
begin
|
61
|
-
i2c.flock(
|
61
|
+
i2c.flock(File::LOCK_EX)
|
62
62
|
i2c.ioctl(@slave_command, address)
|
63
63
|
i2c.syswrite(data.pack("C*"))
|
64
|
-
i2c.flock(
|
64
|
+
i2c.flock(File::LOCK_UN)
|
65
65
|
i2c.close
|
66
66
|
rescue
|
67
|
-
i2c.flock(
|
67
|
+
i2c.flock(File::LOCK_UN)
|
68
68
|
end
|
69
69
|
rescue Errno::EIO => e
|
70
70
|
raise I2CDevice::I2CIOError, e.message
|