pigpio 0.1.9 → 0.1.10
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
- data/Rakefile +5 -0
- data/ext/pigpio/pigpio.c +59 -21
- data/lib/pigpio.rb +4 -0
- data/lib/pigpio/i2c.rb +60 -0
- data/lib/pigpio/version.rb +1 -1
- data/pigpio.gemspec +1 -1
- metadata +3 -12
- data/example/loopback/readme.md +0 -19
- data/example/loopback/spi.rb +0 -24
- data/example/loopback/uart.rb +0 -24
- data/example/loopback/uart.svg +0 -2690
- data/example/simple/board.svg +0 -2762
- data/example/simple/callback.rb +0 -27
- data/example/simple/led.rb +0 -18
- data/example/simple/pwm.rb +0 -22
- data/example/simple/readme.md +0 -49
- data/example/simple/wave.rb +0 -24
data/example/simple/callback.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
require "pigpio"
|
2
|
-
include Pigpio::Constant
|
3
|
-
pi=Pigpio.new()
|
4
|
-
unless pi.connect
|
5
|
-
exit -1
|
6
|
-
end
|
7
|
-
counter=0
|
8
|
-
led=pi.gpio(4)
|
9
|
-
led.mode=PI_OUTPUT
|
10
|
-
led.pud=PI_PUD_OFF
|
11
|
-
|
12
|
-
button=pi.gpio(17)
|
13
|
-
button.mode=PI_INPUT
|
14
|
-
button.pud=PI_PUD_UP
|
15
|
-
button.glitch_filter(30)
|
16
|
-
cb=button.callback(EITHER_EDGE){|tick,level|
|
17
|
-
led.write level
|
18
|
-
counter+=1
|
19
|
-
}
|
20
|
-
|
21
|
-
led.write 1
|
22
|
-
while(counter<10)do
|
23
|
-
sleep(1)
|
24
|
-
end
|
25
|
-
cb.cancel
|
26
|
-
led.write 0
|
27
|
-
pi.stop
|
data/example/simple/led.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
require "pigpio"
|
2
|
-
include Pigpio::Constant
|
3
|
-
|
4
|
-
pi=Pigpio.new
|
5
|
-
unless pi.connect
|
6
|
-
exit -1
|
7
|
-
end
|
8
|
-
|
9
|
-
led = pi.gpio(4)
|
10
|
-
led.mode = PI_OUTPUT
|
11
|
-
led.pud = PI_PUD_OFF
|
12
|
-
3.times do |i|
|
13
|
-
led.write 1
|
14
|
-
sleep 1
|
15
|
-
led.write 0
|
16
|
-
sleep 1
|
17
|
-
end
|
18
|
-
pi.stop
|
data/example/simple/pwm.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require "pigpio"
|
2
|
-
include Pigpio::Constant
|
3
|
-
pi=Pigpio.new()
|
4
|
-
unless pi.connect
|
5
|
-
exit -1
|
6
|
-
end
|
7
|
-
pin=pi.gpio(4)
|
8
|
-
pin.mode=PI_OUTPUT
|
9
|
-
pin.pud=PI_PUD_OFF
|
10
|
-
pwm=pin.pwm
|
11
|
-
|
12
|
-
button=pi.gpio(17)
|
13
|
-
button.mode=PI_INPUT
|
14
|
-
button.pud=PI_PUD_UP
|
15
|
-
|
16
|
-
i=128
|
17
|
-
while true do
|
18
|
-
i=(i+1)%256 if button.read == 0
|
19
|
-
pwm.dutycycle= i
|
20
|
-
sleep 0.01
|
21
|
-
end
|
22
|
-
pi.stop
|
data/example/simple/readme.md
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
# Simple IO sample
|
2
|
-
|
3
|
-
## Board
|
4
|
-
|
5
|
-

|
6
|
-
|
7
|
-
## GPIO sample
|
8
|
-
|
9
|
-
[Script is here.](./led.rb)
|
10
|
-
|
11
|
-
LED will light 3 times.
|
12
|
-
|
13
|
-
```sh
|
14
|
-
$ sudo pigpiod
|
15
|
-
$ ruby led.rb
|
16
|
-
```
|
17
|
-
|
18
|
-
## PWM sample
|
19
|
-
|
20
|
-
[Script is here.](./pwm.rb)
|
21
|
-
|
22
|
-
LED brightness will increase while you press the button.
|
23
|
-
|
24
|
-
```sh
|
25
|
-
$ sudo pigpiod
|
26
|
-
$ ruby pwm.rb
|
27
|
-
```
|
28
|
-
|
29
|
-
## Callback sample
|
30
|
-
|
31
|
-
[Script is here.](./callback.rb)
|
32
|
-
|
33
|
-
LED will light, while you release the button.
|
34
|
-
|
35
|
-
```sh
|
36
|
-
$ sudo pigpiod
|
37
|
-
$ ruby callback.rb
|
38
|
-
```
|
39
|
-
|
40
|
-
## WAVE sample
|
41
|
-
|
42
|
-
[Script is here.](./wave.rb)
|
43
|
-
|
44
|
-
LED will light 3 times.
|
45
|
-
|
46
|
-
```sh
|
47
|
-
$ sudo pigpiod
|
48
|
-
$ ruby wave.rb
|
49
|
-
```
|
data/example/simple/wave.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require "pigpio"
|
2
|
-
include Pigpio::Constant
|
3
|
-
pi=Pigpio.new()
|
4
|
-
unless pi.connect
|
5
|
-
exit -1
|
6
|
-
end
|
7
|
-
|
8
|
-
led=pi.gpio(4)
|
9
|
-
led.mode=PI_OUTPUT
|
10
|
-
led.pud=PI_PUD_OFF
|
11
|
-
|
12
|
-
wave=pi.wave
|
13
|
-
wave.add_new
|
14
|
-
wave.add_generic([
|
15
|
-
wave.pulse(0x10,0x00,1000000),
|
16
|
-
wave.pulse(0x00,0x10,1000000),
|
17
|
-
])
|
18
|
-
wid=wave.create
|
19
|
-
wave.chain([255,0,wid,255,1,3,0])
|
20
|
-
while wave.tx_busy
|
21
|
-
sleep 0.1
|
22
|
-
end
|
23
|
-
wave.clear
|
24
|
-
pi.stop
|