mirror of https://github.com/joan2937/pigpio
V43
This commit is contained in:
parent
0549fcc2af
commit
251ed80f5e
|
@ -98,3 +98,4 @@ pigpiod_if.o: pigpiod_if.c pigpio.h pigpiod_if.h command.h
|
||||||
pigpiod_if2.o: pigpiod_if2.c pigpio.h pigpiod_if2.h command.h
|
pigpiod_if2.o: pigpiod_if2.c pigpio.h pigpiod_if2.h command.h
|
||||||
pigs.o: pigs.c pigpio.h command.h
|
pigs.o: pigs.c pigpio.h command.h
|
||||||
|
|
||||||
|
|
||||||
|
|
1
Makefile
1
Makefile
|
@ -130,3 +130,4 @@ pigs.o: pigs.c pigpio.h command.h
|
||||||
x_pigpio.o: x_pigpio.c pigpio.h
|
x_pigpio.o: x_pigpio.c pigpio.h
|
||||||
x_pigpiod_if.o: x_pigpiod_if.c pigpiod_if.h pigpio.h
|
x_pigpiod_if.o: x_pigpiod_if.c pigpiod_if.h pigpio.h
|
||||||
x_pigpiod_if2.o: x_pigpiod_if2.c pigpiod_if2.h pigpio.h
|
x_pigpiod_if2.o: x_pigpiod_if2.c pigpiod_if2.h pigpio.h
|
||||||
|
|
||||||
|
|
52
pigpio.3
52
pigpio.3
|
@ -3409,7 +3409,7 @@ active low chip select.
|
||||||
.br
|
.br
|
||||||
|
|
||||||
.br
|
.br
|
||||||
An auxiliary SPI device is available on the A+/B+/Pi2 and may be
|
An auxiliary SPI device is available on the A+/B+/Pi2/Zero and may be
|
||||||
selected by setting the A bit in the flags. The auxiliary
|
selected by setting the A bit in the flags. The auxiliary
|
||||||
device has 3 chip selects and a selectable word size in bits.
|
device has 3 chip selects and a selectable word size in bits.
|
||||||
|
|
||||||
|
@ -3418,7 +3418,7 @@ device has 3 chip selects and a selectable word size in bits.
|
||||||
.br
|
.br
|
||||||
|
|
||||||
.EX
|
.EX
|
||||||
spiChan: 0-1 (0-2 for A+/B+/Pi2 auxiliary device)
|
spiChan: 0-1 (0-2 for A+/B+/Pi2/Zero auxiliary device)
|
||||||
.br
|
.br
|
||||||
baud: 32K-125M (values above 30M are unlikely to work)
|
baud: 32K-125M (values above 30M are unlikely to work)
|
||||||
.br
|
.br
|
||||||
|
@ -3492,7 +3492,7 @@ ux is 0 if the CEx gpio is reserved for SPI (default) and 1 otherwise.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
A is 0 for the standard SPI device, 1 for the auxiliary SPI. The
|
A is 0 for the standard SPI device, 1 for the auxiliary SPI. The
|
||||||
auxiliary device is only present on the A+/B+/Pi2.
|
auxiliary device is only present on the A+/B+/Pi2/Zero.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
|
|
||||||
|
@ -4673,11 +4673,11 @@ The gpio must be one of the following.
|
||||||
.EX
|
.EX
|
||||||
4 clock 0 All models
|
4 clock 0 All models
|
||||||
.br
|
.br
|
||||||
5 clock 1 A+/B+/Pi2 and compute module only (reserved for system use)
|
5 clock 1 A+/B+/Pi2/Zero and compute module only (reserved for system use)
|
||||||
.br
|
.br
|
||||||
6 clock 2 A+/B+/Pi2 and compute module only
|
6 clock 2 A+/B+/Pi2/Zero and compute module only
|
||||||
.br
|
.br
|
||||||
20 clock 0 A+/B+/Pi2 and compute module only
|
20 clock 0 A+/B+/Pi2/Zero and compute module only
|
||||||
.br
|
.br
|
||||||
21 clock 1 All models but Rev.2 B (reserved for system use)
|
21 clock 1 All models but Rev.2 B (reserved for system use)
|
||||||
.br
|
.br
|
||||||
|
@ -4758,13 +4758,13 @@ The gpio must be one of the following.
|
||||||
.br
|
.br
|
||||||
|
|
||||||
.EX
|
.EX
|
||||||
12 PWM channel 0 A+/B+/Pi2 and compute module only
|
12 PWM channel 0 A+/B+/Pi2/Zero and compute module only
|
||||||
.br
|
.br
|
||||||
13 PWM channel 1 A+/B+/Pi2 and compute module only
|
13 PWM channel 1 A+/B+/Pi2/Zero and compute module only
|
||||||
.br
|
.br
|
||||||
18 PWM channel 0 All models
|
18 PWM channel 0 All models
|
||||||
.br
|
.br
|
||||||
19 PWM channel 1 A+/B+/Pi2 and compute module only
|
19 PWM channel 1 A+/B+/Pi2/Zero and compute module only
|
||||||
.br
|
.br
|
||||||
|
|
||||||
.br
|
.br
|
||||||
|
@ -4781,6 +4781,25 @@ The gpio must be one of the following.
|
||||||
|
|
||||||
.EE
|
.EE
|
||||||
|
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
|
The actual number of steps beween off and fully on is the
|
||||||
|
integral part of 250 million divided by PWMfreq.
|
||||||
|
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
|
The actual frequency set is 250 million / steps.
|
||||||
|
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
|
There will only be a million steps for a PWMfreq of 250.
|
||||||
|
Lower frequencies will have more steps and higher
|
||||||
|
frequencies will have fewer steps. PWMduty is
|
||||||
|
automatically scaled to take this into account.
|
||||||
|
|
||||||
.IP "\fBint gpioTime(unsigned timetype, int *seconds, int *micros)\fP"
|
.IP "\fBint gpioTime(unsigned timetype, int *seconds, int *micros)\fP"
|
||||||
.IP "" 4
|
.IP "" 4
|
||||||
Updates the seconds and micros variables with the current time.
|
Updates the seconds and micros variables with the current time.
|
||||||
|
@ -5271,7 +5290,7 @@ Configures pigpio support of the fifo and socket interfaces.
|
||||||
.br
|
.br
|
||||||
|
|
||||||
.EX
|
.EX
|
||||||
ifFlags: 0-3
|
ifFlags: 0-7
|
||||||
.br
|
.br
|
||||||
|
|
||||||
.EE
|
.EE
|
||||||
|
@ -5285,8 +5304,19 @@ The default setting (0) is that both interfaces are enabled.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
Or in PI_DISABLE_FIFO_IF to disable the pipe interface.
|
Or in PI_DISABLE_FIFO_IF to disable the pipe interface.
|
||||||
|
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
Or in PI_DISABLE_SOCK_IF to disable the socket interface.
|
Or in PI_DISABLE_SOCK_IF to disable the socket interface.
|
||||||
|
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
|
Or in PI_LOCALHOST_SOCK_IF to disable remote socket
|
||||||
|
access (this means that the socket interface is only
|
||||||
|
usable from the local Pi).
|
||||||
|
|
||||||
.IP "\fBint gpioCfgMemAlloc(unsigned memAllocMode)\fP"
|
.IP "\fBint gpioCfgMemAlloc(unsigned memAllocMode)\fP"
|
||||||
.IP "" 4
|
.IP "" 4
|
||||||
Selects the method of DMA memory allocation.
|
Selects the method of DMA memory allocation.
|
||||||
|
@ -7963,7 +7993,7 @@ A 16-bit word value.
|
||||||
.br
|
.br
|
||||||
#define PI_BAD_POINTER -90 // bad (NULL) pointer
|
#define PI_BAD_POINTER -90 // bad (NULL) pointer
|
||||||
.br
|
.br
|
||||||
#define PI_NO_AUX_SPI -91 // need a A+/B+/Pi2 for auxiliary SPI
|
#define PI_NO_AUX_SPI -91 // need a A+/B+/Pi2/Zero for auxiliary SPI
|
||||||
.br
|
.br
|
||||||
#define PI_NOT_PWM_GPIO -92 // gpio is not in use for PWM
|
#define PI_NOT_PWM_GPIO -92 // gpio is not in use for PWM
|
||||||
.br
|
.br
|
||||||
|
|
3
pigpio.c
3
pigpio.c
|
@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE.
|
||||||
For more information, please refer to <http://unlicense.org/>
|
For more information, please refer to <http://unlicense.org/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* pigpio version 42 */
|
/* pigpio version 43 */
|
||||||
|
|
||||||
/* include ------------------------------------------------------- */
|
/* include ------------------------------------------------------- */
|
||||||
|
|
||||||
|
@ -11616,3 +11616,4 @@ int gpioCfgInternals(unsigned cfgWhat, unsigned cfgVal)
|
||||||
|
|
||||||
#include "custom.cext"
|
#include "custom.cext"
|
||||||
|
|
||||||
|
|
||||||
|
|
40
pigpio.h
40
pigpio.h
|
@ -31,7 +31,7 @@ For more information, please refer to <http://unlicense.org/>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
#define PIGPIO_VERSION 42
|
#define PIGPIO_VERSION 43
|
||||||
|
|
||||||
/*TEXT
|
/*TEXT
|
||||||
|
|
||||||
|
@ -2620,12 +2620,12 @@ Data will be transferred at baud bits per second. The flags may
|
||||||
be used to modify the default behaviour of 4-wire operation, mode 0,
|
be used to modify the default behaviour of 4-wire operation, mode 0,
|
||||||
active low chip select.
|
active low chip select.
|
||||||
|
|
||||||
An auxiliary SPI device is available on the A+/B+/Pi2 and may be
|
An auxiliary SPI device is available on the A+/B+/Pi2/Zero and may be
|
||||||
selected by setting the A bit in the flags. The auxiliary
|
selected by setting the A bit in the flags. The auxiliary
|
||||||
device has 3 chip selects and a selectable word size in bits.
|
device has 3 chip selects and a selectable word size in bits.
|
||||||
|
|
||||||
. .
|
. .
|
||||||
spiChan: 0-1 (0-2 for A+/B+/Pi2 auxiliary device)
|
spiChan: 0-1 (0-2 for A+/B+/Pi2/Zero auxiliary device)
|
||||||
baud: 32K-125M (values above 30M are unlikely to work)
|
baud: 32K-125M (values above 30M are unlikely to work)
|
||||||
spiFlags: see below
|
spiFlags: see below
|
||||||
. .
|
. .
|
||||||
|
@ -2657,7 +2657,7 @@ px is 0 if CEx is active low (default) and 1 for active high.
|
||||||
ux is 0 if the CEx gpio is reserved for SPI (default) and 1 otherwise.
|
ux is 0 if the CEx gpio is reserved for SPI (default) and 1 otherwise.
|
||||||
|
|
||||||
A is 0 for the standard SPI device, 1 for the auxiliary SPI. The
|
A is 0 for the standard SPI device, 1 for the auxiliary SPI. The
|
||||||
auxiliary device is only present on the A+/B+/Pi2.
|
auxiliary device is only present on the A+/B+/Pi2/Zero.
|
||||||
|
|
||||||
W is 0 if the device is not 3-wire, 1 if the device is 3-wire. Standard
|
W is 0 if the device is not 3-wire, 1 if the device is 3-wire. Standard
|
||||||
SPI device only.
|
SPI device only.
|
||||||
|
@ -3366,9 +3366,9 @@ The gpio must be one of the following.
|
||||||
|
|
||||||
. .
|
. .
|
||||||
4 clock 0 All models
|
4 clock 0 All models
|
||||||
5 clock 1 A+/B+/Pi2 and compute module only (reserved for system use)
|
5 clock 1 A+/B+/Pi2/Zero and compute module only (reserved for system use)
|
||||||
6 clock 2 A+/B+/Pi2 and compute module only
|
6 clock 2 A+/B+/Pi2/Zero and compute module only
|
||||||
20 clock 0 A+/B+/Pi2 and compute module only
|
20 clock 0 A+/B+/Pi2/Zero and compute module only
|
||||||
21 clock 1 All models but Rev.2 B (reserved for system use)
|
21 clock 1 All models but Rev.2 B (reserved for system use)
|
||||||
|
|
||||||
32 clock 0 Compute module only
|
32 clock 0 Compute module only
|
||||||
|
@ -3412,10 +3412,10 @@ share a PWM channel.
|
||||||
The gpio must be one of the following.
|
The gpio must be one of the following.
|
||||||
|
|
||||||
. .
|
. .
|
||||||
12 PWM channel 0 A+/B+/Pi2 and compute module only
|
12 PWM channel 0 A+/B+/Pi2/Zero and compute module only
|
||||||
13 PWM channel 1 A+/B+/Pi2 and compute module only
|
13 PWM channel 1 A+/B+/Pi2/Zero and compute module only
|
||||||
18 PWM channel 0 All models
|
18 PWM channel 0 All models
|
||||||
19 PWM channel 1 A+/B+/Pi2 and compute module only
|
19 PWM channel 1 A+/B+/Pi2/Zero and compute module only
|
||||||
|
|
||||||
40 PWM channel 0 Compute module only
|
40 PWM channel 0 Compute module only
|
||||||
41 PWM channel 1 Compute module only
|
41 PWM channel 1 Compute module only
|
||||||
|
@ -3423,6 +3423,16 @@ The gpio must be one of the following.
|
||||||
52 PWM channel 0 Compute module only
|
52 PWM channel 0 Compute module only
|
||||||
53 PWM channel 1 Compute module only
|
53 PWM channel 1 Compute module only
|
||||||
. .
|
. .
|
||||||
|
|
||||||
|
The actual number of steps beween off and fully on is the
|
||||||
|
integral part of 250 million divided by PWMfreq.
|
||||||
|
|
||||||
|
The actual frequency set is 250 million / steps.
|
||||||
|
|
||||||
|
There will only be a million steps for a PWMfreq of 250.
|
||||||
|
Lower frequencies will have more steps and higher
|
||||||
|
frequencies will have fewer steps. PWMduty is
|
||||||
|
automatically scaled to take this into account.
|
||||||
D*/
|
D*/
|
||||||
|
|
||||||
/*F*/
|
/*F*/
|
||||||
|
@ -3707,13 +3717,18 @@ int gpioCfgInterfaces(unsigned ifFlags);
|
||||||
Configures pigpio support of the fifo and socket interfaces.
|
Configures pigpio support of the fifo and socket interfaces.
|
||||||
|
|
||||||
. .
|
. .
|
||||||
ifFlags: 0-3
|
ifFlags: 0-7
|
||||||
. .
|
. .
|
||||||
|
|
||||||
The default setting (0) is that both interfaces are enabled.
|
The default setting (0) is that both interfaces are enabled.
|
||||||
|
|
||||||
Or in PI_DISABLE_FIFO_IF to disable the pipe interface.
|
Or in PI_DISABLE_FIFO_IF to disable the pipe interface.
|
||||||
|
|
||||||
Or in PI_DISABLE_SOCK_IF to disable the socket interface.
|
Or in PI_DISABLE_SOCK_IF to disable the socket interface.
|
||||||
|
|
||||||
|
Or in PI_LOCALHOST_SOCK_IF to disable remote socket
|
||||||
|
access (this means that the socket interface is only
|
||||||
|
usable from the local Pi).
|
||||||
D*/
|
D*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -5048,7 +5063,7 @@ after this command is issued.
|
||||||
#define PI_UNKNOWN_COMMAND -88 // unknown command
|
#define PI_UNKNOWN_COMMAND -88 // unknown command
|
||||||
#define PI_SPI_XFER_FAILED -89 // spi xfer/read/write failed
|
#define PI_SPI_XFER_FAILED -89 // spi xfer/read/write failed
|
||||||
#define PI_BAD_POINTER -90 // bad (NULL) pointer
|
#define PI_BAD_POINTER -90 // bad (NULL) pointer
|
||||||
#define PI_NO_AUX_SPI -91 // need a A+/B+/Pi2 for auxiliary SPI
|
#define PI_NO_AUX_SPI -91 // need a A+/B+/Pi2/Zero for auxiliary SPI
|
||||||
#define PI_NOT_PWM_GPIO -92 // gpio is not in use for PWM
|
#define PI_NOT_PWM_GPIO -92 // gpio is not in use for PWM
|
||||||
#define PI_NOT_SERVO_GPIO -93 // gpio is not in use for servo pulses
|
#define PI_NOT_SERVO_GPIO -93 // gpio is not in use for servo pulses
|
||||||
#define PI_NOT_HCLK_GPIO -94 // gpio has no hardware clock
|
#define PI_NOT_HCLK_GPIO -94 // gpio has no hardware clock
|
||||||
|
@ -5117,3 +5132,4 @@ after this command is issued.
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
48
pigpio.py
48
pigpio.py
|
@ -269,7 +269,7 @@ import threading
|
||||||
import os
|
import os
|
||||||
import atexit
|
import atexit
|
||||||
|
|
||||||
VERSION = "1.24"
|
VERSION = "1.25"
|
||||||
|
|
||||||
exceptions = True
|
exceptions = True
|
||||||
|
|
||||||
|
@ -667,7 +667,7 @@ _errors=[
|
||||||
[PI_UNKNOWN_COMMAND , "unknown command"],
|
[PI_UNKNOWN_COMMAND , "unknown command"],
|
||||||
[PI_SPI_XFER_FAILED , "SPI xfer/read/write failed"],
|
[PI_SPI_XFER_FAILED , "SPI xfer/read/write failed"],
|
||||||
[_PI_BAD_POINTER , "bad (NULL) pointer"],
|
[_PI_BAD_POINTER , "bad (NULL) pointer"],
|
||||||
[PI_NO_AUX_SPI , "need a A+/B+/Pi2 for auxiliary SPI"],
|
[PI_NO_AUX_SPI , "need a A+/B+/Pi2/Zero for auxiliary SPI"],
|
||||||
[PI_NOT_PWM_GPIO , "gpio is not in use for PWM"],
|
[PI_NOT_PWM_GPIO , "gpio is not in use for PWM"],
|
||||||
[PI_NOT_SERVO_GPIO , "gpio is not in use for servo pulses"],
|
[PI_NOT_SERVO_GPIO , "gpio is not in use for servo pulses"],
|
||||||
[PI_NOT_HCLK_GPIO , "gpio has no hardware clock"],
|
[PI_NOT_HCLK_GPIO , "gpio has no hardware clock"],
|
||||||
|
@ -1564,10 +1564,10 @@ class pi():
|
||||||
|
|
||||||
. .
|
. .
|
||||||
4 clock 0 All models
|
4 clock 0 All models
|
||||||
5 clock 1 A+/B+/Pi2 and compute module only
|
5 clock 1 A+/B+/Pi2/Zero and compute module only
|
||||||
(reserved for system use)
|
(reserved for system use)
|
||||||
6 clock 2 A+/B+/Pi2 and compute module only
|
6 clock 2 A+/B+/Pi2/Zero and compute module only
|
||||||
20 clock 0 A+/B+/Pi2 and compute module only
|
20 clock 0 A+/B+/Pi2/Zero and compute module only
|
||||||
21 clock 1 All models but Rev.2 B (reserved for system use)
|
21 clock 1 All models but Rev.2 B (reserved for system use)
|
||||||
|
|
||||||
32 clock 0 Compute module only
|
32 clock 0 Compute module only
|
||||||
|
@ -1615,10 +1615,10 @@ class pi():
|
||||||
The gpio must be one of the following.
|
The gpio must be one of the following.
|
||||||
|
|
||||||
. .
|
. .
|
||||||
12 PWM channel 0 A+/B+/Pi2 and compute module only
|
12 PWM channel 0 A+/B+/Pi2/Zero and compute module only
|
||||||
13 PWM channel 1 A+/B+/Pi2 and compute module only
|
13 PWM channel 1 A+/B+/Pi2/Zero and compute module only
|
||||||
18 PWM channel 0 All models
|
18 PWM channel 0 All models
|
||||||
19 PWM channel 1 A+/B+/Pi2 and compute module only
|
19 PWM channel 1 A+/B+/Pi2/Zero and compute module only
|
||||||
|
|
||||||
40 PWM channel 0 Compute module only
|
40 PWM channel 0 Compute module only
|
||||||
41 PWM channel 1 Compute module only
|
41 PWM channel 1 Compute module only
|
||||||
|
@ -1627,6 +1627,16 @@ class pi():
|
||||||
53 PWM channel 1 Compute module only
|
53 PWM channel 1 Compute module only
|
||||||
. .
|
. .
|
||||||
|
|
||||||
|
The actual number of steps beween off and fully on is the
|
||||||
|
integral part of 250 million divided by PWMfreq.
|
||||||
|
|
||||||
|
The actual frequency set is 250 million / steps.
|
||||||
|
|
||||||
|
There will only be a million steps for a PWMfreq of 250.
|
||||||
|
Lower frequencies will have more steps and higher
|
||||||
|
frequencies will have fewer steps. PWMduty is
|
||||||
|
automatically scaled to take this into account.
|
||||||
|
|
||||||
...
|
...
|
||||||
pi.hardware_PWM(18, 800, 250000) # 800Hz 25% dutycycle
|
pi.hardware_PWM(18, 800, 250000) # 800Hz 25% dutycycle
|
||||||
|
|
||||||
|
@ -2895,12 +2905,12 @@ class pi():
|
||||||
modify the default behaviour of 4-wire operation, mode 0,
|
modify the default behaviour of 4-wire operation, mode 0,
|
||||||
active low chip select.
|
active low chip select.
|
||||||
|
|
||||||
An auxiliary SPI device is available on the A+/B+/Pi2 and may be
|
An auxiliary SPI device is available on the A+/B+/Pi2/Zero
|
||||||
selected by setting the A bit in the flags. The auxiliary
|
and may be selected by setting the A bit in the flags.
|
||||||
device has 3 chip selects and a selectable word size in bits.
|
The auxiliary device has 3 chip selects and a selectable
|
||||||
|
word size in bits.
|
||||||
|
|
||||||
|
spi_channel:= 0-1 (0-2 for A+/B+/Pi2/Zero auxiliary device).
|
||||||
spi_channel:= 0-1 (0-2 for A+/B+/Pi2 auxiliary device).
|
|
||||||
baud:= 32K-125M (values above 30M are unlikely to work).
|
baud:= 32K-125M (values above 30M are unlikely to work).
|
||||||
spi_flags:= see below.
|
spi_flags:= see below.
|
||||||
|
|
||||||
|
@ -2935,7 +2945,7 @@ class pi():
|
||||||
and 1 otherwise.
|
and 1 otherwise.
|
||||||
|
|
||||||
A is 0 for the standard SPI device, 1 for the auxiliary SPI.
|
A is 0 for the standard SPI device, 1 for the auxiliary SPI.
|
||||||
The auxiliary device is only present on the A+/B+/Pi2.
|
The auxiliary device is only present on the A+/B+/Pi2/Zero.
|
||||||
|
|
||||||
W is 0 if the device is not 3-wire, 1 if the device is 3-wire.
|
W is 0 if the device is not 3-wire, 1 if the device is 3-wire.
|
||||||
Standard SPI device only.
|
Standard SPI device only.
|
||||||
|
@ -3631,9 +3641,13 @@ class pi():
|
||||||
FALLING_EDGE.
|
FALLING_EDGE.
|
||||||
wait_timeout:= 0.0- (default 60.0).
|
wait_timeout:= 0.0- (default 60.0).
|
||||||
|
|
||||||
The function returns as soon as the edge is detected
|
The function returns when the edge is detected or after
|
||||||
or after the number of seconds specified by timeout has
|
the number of seconds specified by timeout has expired.
|
||||||
expired.
|
|
||||||
|
Do not use this function for precise timing purposes,
|
||||||
|
the edge is only checked 20 times a second. Whenever
|
||||||
|
you need to know the accurate time of GPIO events use
|
||||||
|
a [*callback*] function.
|
||||||
|
|
||||||
The function returns True if the edge is detected,
|
The function returns True if the edge is detected,
|
||||||
otherwise False.
|
otherwise False.
|
||||||
|
|
14
pigpiod.c
14
pigpiod.c
|
@ -26,7 +26,7 @@ For more information, please refer to <http://unlicense.org/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This version is for pigpio version 38+
|
This version is for pigpio version 43+
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -97,6 +97,7 @@ void usage()
|
||||||
" -p value, socket port, 1024-32000, default 8888\n" \
|
" -p value, socket port, 1024-32000, default 8888\n" \
|
||||||
" -s value, sample rate, 1, 2, 4, 5, 8, or 10, default 5\n" \
|
" -s value, sample rate, 1, 2, 4, 5, 8, or 10, default 5\n" \
|
||||||
" -t value, clock peripheral, 0=PWM 1=PCM, default PCM\n" \
|
" -t value, clock peripheral, 0=PWM 1=PCM, default PCM\n" \
|
||||||
|
" -v, -V, display pigpio version and exit\n" \
|
||||||
" -x mask, gpios which may be updated, default board user gpios\n" \
|
" -x mask, gpios which may be updated, default board user gpios\n" \
|
||||||
"EXAMPLE\n" \
|
"EXAMPLE\n" \
|
||||||
"sudo pigpiod -s 2 -b 200 -f\n" \
|
"sudo pigpiod -s 2 -b 200 -f\n" \
|
||||||
|
@ -121,7 +122,7 @@ static void initOpts(int argc, char *argv[])
|
||||||
int opt, err, i;
|
int opt, err, i;
|
||||||
int64_t mask;
|
int64_t mask;
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "a:b:c:d:e:fklp:s:t:x:")) != -1)
|
while ((opt = getopt(argc, argv, "a:b:c:d:e:fklp:s:t:x:vV")) != -1)
|
||||||
{
|
{
|
||||||
switch (opt)
|
switch (opt)
|
||||||
{
|
{
|
||||||
|
@ -206,6 +207,12 @@ static void initOpts(int argc, char *argv[])
|
||||||
else fatal("invalid -t option (%d)", i);
|
else fatal("invalid -t option (%d)", i);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'v':
|
||||||
|
case 'V':
|
||||||
|
printf("%d\n", PIGPIO_VERSION);
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'x':
|
case 'x':
|
||||||
mask = getNum(optarg, &err);
|
mask = getNum(optarg, &err);
|
||||||
if (!err)
|
if (!err)
|
||||||
|
@ -218,7 +225,7 @@ static void initOpts(int argc, char *argv[])
|
||||||
|
|
||||||
default: /* '?' */
|
default: /* '?' */
|
||||||
usage();
|
usage();
|
||||||
exit(-1);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -347,3 +354,4 @@ int main(int argc, char **argv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1360,11 +1360,11 @@ The gpio must be one of the following.
|
||||||
.EX
|
.EX
|
||||||
4 clock 0 All models
|
4 clock 0 All models
|
||||||
.br
|
.br
|
||||||
5 clock 1 A+/B+/Pi2 and compute module only (reserved for system use)
|
5 clock 1 A+/B+/Pi2/Zero and compute module only (reserved for system use)
|
||||||
.br
|
.br
|
||||||
6 clock 2 A+/B+/Pi2 and compute module only
|
6 clock 2 A+/B+/Pi2/Zero and compute module only
|
||||||
.br
|
.br
|
||||||
20 clock 0 A+/B+/Pi2 and compute module only
|
20 clock 0 A+/B+/Pi2/Zero and compute module only
|
||||||
.br
|
.br
|
||||||
21 clock 1 All models but Rev.2 B (reserved for system use)
|
21 clock 1 All models but Rev.2 B (reserved for system use)
|
||||||
.br
|
.br
|
||||||
|
@ -1448,13 +1448,13 @@ The gpio must be one of the following.
|
||||||
.br
|
.br
|
||||||
|
|
||||||
.EX
|
.EX
|
||||||
12 PWM channel 0 A+/B+/Pi2 and compute module only
|
12 PWM channel 0 A+/B+/Pi2/Zero and compute module only
|
||||||
.br
|
.br
|
||||||
13 PWM channel 1 A+/B+/Pi2 and compute module only
|
13 PWM channel 1 A+/B+/Pi2/Zero and compute module only
|
||||||
.br
|
.br
|
||||||
18 PWM channel 0 All models
|
18 PWM channel 0 All models
|
||||||
.br
|
.br
|
||||||
19 PWM channel 1 A+/B+/Pi2 and compute module only
|
19 PWM channel 1 A+/B+/Pi2/Zero and compute module only
|
||||||
.br
|
.br
|
||||||
|
|
||||||
.br
|
.br
|
||||||
|
@ -1471,6 +1471,25 @@ The gpio must be one of the following.
|
||||||
|
|
||||||
.EE
|
.EE
|
||||||
|
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
|
The actual number of steps beween off and fully on is the
|
||||||
|
integral part of 250 million divided by PWMfreq.
|
||||||
|
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
|
The actual frequency set is 250 million / steps.
|
||||||
|
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
|
There will only be a million steps for a PWMfreq of 250.
|
||||||
|
Lower frequencies will have more steps and higher
|
||||||
|
frequencies will have fewer steps. PWMduty is
|
||||||
|
automatically scaled to take this into account.
|
||||||
|
|
||||||
.IP "\fBuint32_t get_current_tick(int pi)\fP"
|
.IP "\fBuint32_t get_current_tick(int pi)\fP"
|
||||||
.IP "" 4
|
.IP "" 4
|
||||||
Gets the current system tick.
|
Gets the current system tick.
|
||||||
|
@ -3622,7 +3641,7 @@ active low chip select.
|
||||||
.br
|
.br
|
||||||
|
|
||||||
.br
|
.br
|
||||||
An auxiliary SPI device is available on the A+/B+/Pi2 and may be
|
An auxiliary SPI device is available on the A+/B+/Pi2/Zero and may be
|
||||||
selected by setting the A bit in the flags. The auxiliary
|
selected by setting the A bit in the flags. The auxiliary
|
||||||
device has 3 chip selects and a selectable word size in bits.
|
device has 3 chip selects and a selectable word size in bits.
|
||||||
|
|
||||||
|
@ -3633,7 +3652,7 @@ device has 3 chip selects and a selectable word size in bits.
|
||||||
.EX
|
.EX
|
||||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||||
.br
|
.br
|
||||||
spi_channel: 0-1 (0-2 for A+/B+/Pi2 auxiliary device).
|
spi_channel: 0-1 (0-2 for A+/B+/Pi2/Zero auxiliary device).
|
||||||
.br
|
.br
|
||||||
baud: 32K-125M (values above 30M are unlikely to work).
|
baud: 32K-125M (values above 30M are unlikely to work).
|
||||||
.br
|
.br
|
||||||
|
@ -3707,7 +3726,7 @@ ux is 0 if the CEx gpio is reserved for SPI (default) and 1 otherwise.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
A is 0 for the standard SPI device, 1 for the auxiliary SPI. The
|
A is 0 for the standard SPI device, 1 for the auxiliary SPI. The
|
||||||
auxiliary device is only present on the A+/B+/Pi2.
|
auxiliary device is only present on the A+/B+/Pi2/Zero.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
|
|
||||||
|
@ -4214,13 +4233,21 @@ user_gpio: 0-31.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
|
|
||||||
.br
|
|
||||||
The function returns 1 if the edge occurred, otherwise 0.
|
|
||||||
|
|
||||||
.br
|
|
||||||
|
|
||||||
.br
|
.br
|
||||||
The function returns when the edge occurs or after the timeout.
|
The function returns when the edge occurs or after the timeout.
|
||||||
|
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
|
Do not use this function for precise timing purposes,
|
||||||
|
the edge is only checked 20 times a second. Whenever
|
||||||
|
you need to know the accurate time of GPIO events use
|
||||||
|
a \fBcallback\fP function.
|
||||||
|
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
|
The function returns 1 if the edge occurred, otherwise 0.
|
||||||
.SH PARAMETERS
|
.SH PARAMETERS
|
||||||
|
|
||||||
.br
|
.br
|
||||||
|
|
|
@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE.
|
||||||
For more information, please refer to <http://unlicense.org/>
|
For more information, please refer to <http://unlicense.org/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* PIGPIOD_IF2_VERSION 1 */
|
/* PIGPIOD_IF2_VERSION 2 */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -1650,7 +1650,7 @@ int wait_for_edge(int pi, unsigned user_gpio, unsigned edge, double timeout)
|
||||||
|
|
||||||
id = callback_ex(pi, user_gpio, edge, _wfe, &triggered);
|
id = callback_ex(pi, user_gpio, edge, _wfe, &triggered);
|
||||||
|
|
||||||
while (!triggered && (time_time() < due)) time_sleep(0.1);
|
while (!triggered && (time_time() < due)) time_sleep(0.05);
|
||||||
|
|
||||||
callback_cancel(id);
|
callback_cancel(id);
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ For more information, please refer to <http://unlicense.org/>
|
||||||
|
|
||||||
#include "pigpio.h"
|
#include "pigpio.h"
|
||||||
|
|
||||||
#define PIGPIOD_IF2_VERSION 1
|
#define PIGPIOD_IF2_VERSION 2
|
||||||
|
|
||||||
/*TEXT
|
/*TEXT
|
||||||
|
|
||||||
|
@ -982,9 +982,9 @@ The gpio must be one of the following.
|
||||||
|
|
||||||
. .
|
. .
|
||||||
4 clock 0 All models
|
4 clock 0 All models
|
||||||
5 clock 1 A+/B+/Pi2 and compute module only (reserved for system use)
|
5 clock 1 A+/B+/Pi2/Zero and compute module only (reserved for system use)
|
||||||
6 clock 2 A+/B+/Pi2 and compute module only
|
6 clock 2 A+/B+/Pi2/Zero and compute module only
|
||||||
20 clock 0 A+/B+/Pi2 and compute module only
|
20 clock 0 A+/B+/Pi2/Zero and compute module only
|
||||||
21 clock 1 All models but Rev.2 B (reserved for system use)
|
21 clock 1 All models but Rev.2 B (reserved for system use)
|
||||||
|
|
||||||
32 clock 0 Compute module only
|
32 clock 0 Compute module only
|
||||||
|
@ -1031,10 +1031,10 @@ share a PWM channel.
|
||||||
The gpio must be one of the following.
|
The gpio must be one of the following.
|
||||||
|
|
||||||
. .
|
. .
|
||||||
12 PWM channel 0 A+/B+/Pi2 and compute module only
|
12 PWM channel 0 A+/B+/Pi2/Zero and compute module only
|
||||||
13 PWM channel 1 A+/B+/Pi2 and compute module only
|
13 PWM channel 1 A+/B+/Pi2/Zero and compute module only
|
||||||
18 PWM channel 0 All models
|
18 PWM channel 0 All models
|
||||||
19 PWM channel 1 A+/B+/Pi2 and compute module only
|
19 PWM channel 1 A+/B+/Pi2/Zero and compute module only
|
||||||
|
|
||||||
40 PWM channel 0 Compute module only
|
40 PWM channel 0 Compute module only
|
||||||
41 PWM channel 1 Compute module only
|
41 PWM channel 1 Compute module only
|
||||||
|
@ -1042,6 +1042,16 @@ The gpio must be one of the following.
|
||||||
52 PWM channel 0 Compute module only
|
52 PWM channel 0 Compute module only
|
||||||
53 PWM channel 1 Compute module only
|
53 PWM channel 1 Compute module only
|
||||||
. .
|
. .
|
||||||
|
|
||||||
|
The actual number of steps beween off and fully on is the
|
||||||
|
integral part of 250 million divided by PWMfreq.
|
||||||
|
|
||||||
|
The actual frequency set is 250 million / steps.
|
||||||
|
|
||||||
|
There will only be a million steps for a PWMfreq of 250.
|
||||||
|
Lower frequencies will have more steps and higher
|
||||||
|
frequencies will have fewer steps. PWMduty is
|
||||||
|
automatically scaled to take this into account.
|
||||||
D*/
|
D*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -2274,13 +2284,13 @@ Data will be transferred at baud bits per second. The flags may
|
||||||
be used to modify the default behaviour of 4-wire operation, mode 0,
|
be used to modify the default behaviour of 4-wire operation, mode 0,
|
||||||
active low chip select.
|
active low chip select.
|
||||||
|
|
||||||
An auxiliary SPI device is available on the A+/B+/Pi2 and may be
|
An auxiliary SPI device is available on the A+/B+/Pi2/Zero and may be
|
||||||
selected by setting the A bit in the flags. The auxiliary
|
selected by setting the A bit in the flags. The auxiliary
|
||||||
device has 3 chip selects and a selectable word size in bits.
|
device has 3 chip selects and a selectable word size in bits.
|
||||||
|
|
||||||
. .
|
. .
|
||||||
pi: 0- (as returned by [*pigpio_start*]).
|
pi: 0- (as returned by [*pigpio_start*]).
|
||||||
spi_channel: 0-1 (0-2 for A+/B+/Pi2 auxiliary device).
|
spi_channel: 0-1 (0-2 for A+/B+/Pi2/Zero auxiliary device).
|
||||||
baud: 32K-125M (values above 30M are unlikely to work).
|
baud: 32K-125M (values above 30M are unlikely to work).
|
||||||
spi_flags: see below.
|
spi_flags: see below.
|
||||||
. .
|
. .
|
||||||
|
@ -2312,7 +2322,7 @@ px is 0 if CEx is active low (default) and 1 for active high.
|
||||||
ux is 0 if the CEx gpio is reserved for SPI (default) and 1 otherwise.
|
ux is 0 if the CEx gpio is reserved for SPI (default) and 1 otherwise.
|
||||||
|
|
||||||
A is 0 for the standard SPI device, 1 for the auxiliary SPI. The
|
A is 0 for the standard SPI device, 1 for the auxiliary SPI. The
|
||||||
auxiliary device is only present on the A+/B+/Pi2.
|
auxiliary device is only present on the A+/B+/Pi2/Zero.
|
||||||
|
|
||||||
W is 0 if the device is not 3-wire, 1 if the device is 3-wire. Standard
|
W is 0 if the device is not 3-wire, 1 if the device is 3-wire. Standard
|
||||||
SPI device only.
|
SPI device only.
|
||||||
|
@ -2624,9 +2634,14 @@ user_gpio: 0-31.
|
||||||
timeout: >=0.
|
timeout: >=0.
|
||||||
. .
|
. .
|
||||||
|
|
||||||
The function returns 1 if the edge occurred, otherwise 0.
|
|
||||||
|
|
||||||
The function returns when the edge occurs or after the timeout.
|
The function returns when the edge occurs or after the timeout.
|
||||||
|
|
||||||
|
Do not use this function for precise timing purposes,
|
||||||
|
the edge is only checked 20 times a second. Whenever
|
||||||
|
you need to know the accurate time of GPIO events use
|
||||||
|
a [*callback*] function.
|
||||||
|
|
||||||
|
The function returns 1 if the edge occurred, otherwise 0.
|
||||||
D*/
|
D*/
|
||||||
|
|
||||||
/*PARAMS
|
/*PARAMS
|
||||||
|
|
29
pigs.1
29
pigs.1
|
@ -687,9 +687,9 @@ The gpio must be one of the following.
|
||||||
|
|
||||||
.EX
|
.EX
|
||||||
4 clock 0 All models
|
4 clock 0 All models
|
||||||
5 clock 1 A+/B+/Pi2 and compute module only (reserved for system use)
|
5 clock 1 A+/B+/Pi2/Zero and compute module only (reserved for system use)
|
||||||
6 clock 2 A+/B+/Pi2 and compute module only
|
6 clock 2 A+/B+/Pi2/Zero and compute module only
|
||||||
20 clock 0 A+/B+/Pi2 and compute module only
|
20 clock 0 A+/B+/Pi2/Zero and compute module only
|
||||||
21 clock 1 All models but Type 2 (reserved for system use)
|
21 clock 1 All models but Type 2 (reserved for system use)
|
||||||
|
|
||||||
.EE
|
.EE
|
||||||
|
@ -762,10 +762,10 @@ The gpio must be one of the following.
|
||||||
.br
|
.br
|
||||||
|
|
||||||
.EX
|
.EX
|
||||||
12 PWM channel 0 A+/B+/Pi2 and compute module only
|
12 PWM channel 0 A+/B+/Pi2/Zero and compute module only
|
||||||
13 PWM channel 1 A+/B+/Pi2 and compute module only
|
13 PWM channel 1 A+/B+/Pi2/Zero and compute module only
|
||||||
18 PWM channel 0 All models
|
18 PWM channel 0 All models
|
||||||
19 PWM channel 1 A+/B+/Pi2 and compute module only
|
19 PWM channel 1 A+/B+/Pi2/Zero and compute module only
|
||||||
|
|
||||||
.EE
|
.EE
|
||||||
|
|
||||||
|
@ -780,6 +780,19 @@ The gpio must be one of the following.
|
||||||
|
|
||||||
.EE
|
.EE
|
||||||
|
|
||||||
|
.br
|
||||||
|
The actual number of steps beween off and fully on is the
|
||||||
|
integral part of 250 million divided by \fBpf\fP.
|
||||||
|
|
||||||
|
.br
|
||||||
|
The actual frequency set is 250 million / steps.
|
||||||
|
|
||||||
|
.br
|
||||||
|
There will only be a million steps for a \fBpf\fP of 250.
|
||||||
|
Lower frequencies will have more steps and higher
|
||||||
|
frequencies will have fewer steps. \fBpdc\fP is
|
||||||
|
automatically scaled to take this into account.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
|
|
||||||
.IP "\fBHWVER \fP - Get hardware version"
|
.IP "\fBHWVER \fP - Get hardware version"
|
||||||
|
@ -2736,7 +2749,7 @@ Speeds between 32kbps and 125Mbps are allowed. Speeds above 30Mbps
|
||||||
are unlikely to work.
|
are unlikely to work.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
An auxiliary SPI device is available on the A+/B+/Pi2 and may be
|
An auxiliary SPI device is available on the A+/B+/Pi2/Zero and may be
|
||||||
selected by setting the A bit in the flags. The auxiliary
|
selected by setting the A bit in the flags. The auxiliary
|
||||||
device has 3 chip selects and a selectable word size in bits.
|
device has 3 chip selects and a selectable word size in bits.
|
||||||
|
|
||||||
|
@ -2783,7 +2796,7 @@ ux is 0 if the CEx gpio is reserved for SPI (default) and 1 otherwise.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
A is 0 for the standard SPI device, 1 for the auxiliary SPI. The
|
A is 0 for the standard SPI device, 1 for the auxiliary SPI. The
|
||||||
auxiliary device is only present on the A+/B+/Pi2.
|
auxiliary device is only present on the A+/B+/Pi2/Zero.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
W is 0 if the device is not 3-wire, 1 if the device is 3-wire. Standard
|
W is 0 if the device is not 3-wire, 1 if the device is 3-wire. Standard
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -3,7 +3,7 @@
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
|
|
||||||
setup(name='pigpio',
|
setup(name='pigpio',
|
||||||
version='1.24',
|
version='1.25',
|
||||||
author='joan',
|
author='joan',
|
||||||
author_email='joan@abyz.co.uk',
|
author_email='joan@abyz.co.uk',
|
||||||
maintainer='joan',
|
maintainer='joan',
|
||||||
|
|
28
x_pigpio.c
28
x_pigpio.c
|
@ -4,9 +4,9 @@ sudo ./x_pigpio
|
||||||
|
|
||||||
*** WARNING ************************************************
|
*** WARNING ************************************************
|
||||||
* *
|
* *
|
||||||
* All the tests make extensive use of gpio 4 (pin P1-7). *
|
* All the tests make extensive use of gpio 25 (pin 22). *
|
||||||
* Ensure that either nothing or just a LED is connected to *
|
* Ensure that either nothing or just a LED is connected to *
|
||||||
* gpio 4 before running any of the tests. *
|
* gpio 25 before running any of the tests. *
|
||||||
* *
|
* *
|
||||||
* Some tests are statistical in nature and so may on *
|
* Some tests are statistical in nature and so may on *
|
||||||
* occasion fail. Repeated failures on the same test or *
|
* occasion fail. Repeated failures on the same test or *
|
||||||
|
@ -27,7 +27,7 @@ sudo ./x_pigpio
|
||||||
|
|
||||||
#define USERDATA 18249013
|
#define USERDATA 18249013
|
||||||
|
|
||||||
#define GPIO 4
|
#define GPIO 25
|
||||||
|
|
||||||
void CHECK(int t, int st, int got, int expect, int pc, char *desc)
|
void CHECK(int t, int st, int got, int expect, int pc, char *desc)
|
||||||
{
|
{
|
||||||
|
@ -273,7 +273,7 @@ void t4()
|
||||||
gpioSetPWMrange(GPIO, 100);
|
gpioSetPWMrange(GPIO, 100);
|
||||||
|
|
||||||
h = gpioNotifyOpen();
|
h = gpioNotifyOpen();
|
||||||
e = gpioNotifyBegin(h, (1<<4));
|
e = gpioNotifyBegin(h, (1<<GPIO));
|
||||||
CHECK(4, 1, e, 0, 0, "notify open/begin");
|
CHECK(4, 1, e, 0, 0, "notify open/begin");
|
||||||
|
|
||||||
time_sleep(1);
|
time_sleep(1);
|
||||||
|
@ -305,10 +305,10 @@ void t4()
|
||||||
{
|
{
|
||||||
if (s != r.seqno) seq_ok = 0;
|
if (s != r.seqno) seq_ok = 0;
|
||||||
|
|
||||||
if (n) if (l != (r.level&(1<<4))) toggle_ok = 0;
|
if (n) if (l != (r.level&(1<<GPIO))) toggle_ok = 0;
|
||||||
|
|
||||||
if (r.level&(1<<4)) l = 0;
|
if (r.level&(1<<GPIO)) l = 0;
|
||||||
else l = (1<<4);
|
else l = (1<<GPIO);
|
||||||
|
|
||||||
s++;
|
s++;
|
||||||
n++;
|
n++;
|
||||||
|
@ -522,7 +522,7 @@ void t7()
|
||||||
|
|
||||||
void t8()
|
void t8()
|
||||||
{
|
{
|
||||||
int v, t, i;
|
int v;
|
||||||
|
|
||||||
printf("Bank read/write tests.\n");
|
printf("Bank read/write tests.\n");
|
||||||
|
|
||||||
|
@ -542,13 +542,11 @@ void t8()
|
||||||
v = gpioRead(GPIO);
|
v = gpioRead(GPIO);
|
||||||
CHECK(8, 4, v, 1, 0, "set bank 1");
|
CHECK(8, 4, v, 1, 0, "set bank 1");
|
||||||
|
|
||||||
t = 0;
|
v = gpioRead_Bits_32_53();
|
||||||
v = (1<<16);
|
|
||||||
for (i=0; i<100; i++)
|
if (v) v = 0; else v = 1;
|
||||||
{
|
|
||||||
if (gpioRead_Bits_32_53() & v) t++;
|
CHECK(8, 5, v, 0, 0, "read bank 2");
|
||||||
};
|
|
||||||
CHECK(8, 5, t, 60, 75, "read bank 2");
|
|
||||||
|
|
||||||
v = gpioWrite_Bits_32_53_Clear(0);
|
v = gpioWrite_Bits_32_53_Clear(0);
|
||||||
CHECK(8, 6, v, 0, 0, "clear bank 2");
|
CHECK(8, 6, v, 0, 0, "clear bank 2");
|
||||||
|
|
26
x_pigpio.py
26
x_pigpio.py
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
#*** WARNING ************************************************
|
#*** WARNING ************************************************
|
||||||
#* *
|
#* *
|
||||||
#* All the tests make extensive use of gpio 4 (pin P1-7). *
|
#* All the tests make extensive use of gpio 25 (pin 22). *
|
||||||
#* Ensure that either nothing or just a LED is connected to *
|
#* Ensure that either nothing or just a LED is connected to *
|
||||||
#* gpio 4 before running any of the tests. *
|
#* gpio 25 before running any of the tests. *
|
||||||
#* *
|
#* *
|
||||||
#* Some tests are statistical in nature and so may on *
|
#* Some tests are statistical in nature and so may on *
|
||||||
#* occasion fail. Repeated failures on the same test or *
|
#* occasion fail. Repeated failures on the same test or *
|
||||||
|
@ -17,7 +17,7 @@ import struct
|
||||||
|
|
||||||
import pigpio
|
import pigpio
|
||||||
|
|
||||||
GPIO=4
|
GPIO=25
|
||||||
|
|
||||||
def STRCMP(r, s):
|
def STRCMP(r, s):
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ def t4():
|
||||||
pi.set_PWM_range(GPIO, 100)
|
pi.set_PWM_range(GPIO, 100)
|
||||||
|
|
||||||
h = pi.notify_open()
|
h = pi.notify_open()
|
||||||
e = pi.notify_begin(h, (1<<4))
|
e = pi.notify_begin(h, (1<<GPIO))
|
||||||
CHECK(4, 1, e, 0, 0, "notify open/begin")
|
CHECK(4, 1, e, 0, 0, "notify open/begin")
|
||||||
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
@ -281,7 +281,7 @@ def t4():
|
||||||
if s != S:
|
if s != S:
|
||||||
seq_ok = 0
|
seq_ok = 0
|
||||||
|
|
||||||
L = v & (1<<4)
|
L = v & (1<<GPIO)
|
||||||
|
|
||||||
if n:
|
if n:
|
||||||
if l != L:
|
if l != L:
|
||||||
|
@ -290,7 +290,7 @@ def t4():
|
||||||
if L:
|
if L:
|
||||||
l = 0
|
l = 0
|
||||||
else:
|
else:
|
||||||
l = (1<<4)
|
l = (1<<GPIO)
|
||||||
|
|
||||||
s += 1
|
s += 1
|
||||||
n += 1
|
n += 1
|
||||||
|
@ -549,12 +549,14 @@ def t8():
|
||||||
v = pi.read(GPIO)
|
v = pi.read(GPIO)
|
||||||
CHECK(8, 4, v, 1, 0, "set bank 1")
|
CHECK(8, 4, v, 1, 0, "set bank 1")
|
||||||
|
|
||||||
t = 0
|
v = pi.read_bank_2()
|
||||||
v = (1<<16)
|
|
||||||
for i in range(100):
|
if v:
|
||||||
if pi.read_bank_2() & v:
|
v = 0
|
||||||
t += 1
|
else:
|
||||||
CHECK(8, 5, t, 60, 75, "read bank 2")
|
v = 1
|
||||||
|
|
||||||
|
CHECK(8, 5, v, 0, 0, "read bank 2")
|
||||||
|
|
||||||
v = pi.clear_bank_2(0)
|
v = pi.clear_bank_2(0)
|
||||||
CHECK(8, 6, v, 0, 0, "clear bank 2")
|
CHECK(8, 6, v, 0, 0, "clear bank 2")
|
||||||
|
|
|
@ -4,9 +4,9 @@ gcc -o x_pigpiod_if x_pigpiod_if.c -lpigpiod_if -lrt -lpthread
|
||||||
|
|
||||||
*** WARNING ************************************************
|
*** WARNING ************************************************
|
||||||
* *
|
* *
|
||||||
* All the tests make extensive use of gpio 4 (pin P1-7). *
|
* All the tests make extensive use of gpio 25 (pin 22). *
|
||||||
* Ensure that either nothing or just a LED is connected to *
|
* Ensure that either nothing or just a LED is connected to *
|
||||||
* gpio 4 before running any of the tests. *
|
* gpio 25 before running any of the tests. *
|
||||||
* *
|
* *
|
||||||
* Some tests are statistical in nature and so may on *
|
* Some tests are statistical in nature and so may on *
|
||||||
* occasion fail. Repeated failures on the same test or *
|
* occasion fail. Repeated failures on the same test or *
|
||||||
|
@ -24,7 +24,7 @@ gcc -o x_pigpiod_if x_pigpiod_if.c -lpigpiod_if -lrt -lpthread
|
||||||
|
|
||||||
#include "pigpiod_if.h"
|
#include "pigpiod_if.h"
|
||||||
|
|
||||||
#define GPIO 4
|
#define GPIO 25
|
||||||
|
|
||||||
void CHECK(int t, int st, int got, int expect, int pc, char *desc)
|
void CHECK(int t, int st, int got, int expect, int pc, char *desc)
|
||||||
{
|
{
|
||||||
|
@ -250,7 +250,7 @@ void t4()
|
||||||
set_PWM_range(GPIO, 100);
|
set_PWM_range(GPIO, 100);
|
||||||
|
|
||||||
h = notify_open();
|
h = notify_open();
|
||||||
e = notify_begin(h, (1<<4));
|
e = notify_begin(h, (1<<GPIO));
|
||||||
CHECK(4, 1, e, 0, 0, "notify open/begin");
|
CHECK(4, 1, e, 0, 0, "notify open/begin");
|
||||||
|
|
||||||
time_sleep(1);
|
time_sleep(1);
|
||||||
|
@ -282,10 +282,10 @@ void t4()
|
||||||
{
|
{
|
||||||
if (s != r.seqno) seq_ok = 0;
|
if (s != r.seqno) seq_ok = 0;
|
||||||
|
|
||||||
if (n) if (l != (r.level&(1<<4))) toggle_ok = 0;
|
if (n) if (l != (r.level&(1<<GPIO))) toggle_ok = 0;
|
||||||
|
|
||||||
if (r.level&(1<<4)) l = 0;
|
if (r.level&(1<<GPIO)) l = 0;
|
||||||
else l = (1<<4);
|
else l = (1<<GPIO);
|
||||||
|
|
||||||
s++;
|
s++;
|
||||||
n++;
|
n++;
|
||||||
|
@ -504,7 +504,7 @@ void t7()
|
||||||
|
|
||||||
void t8()
|
void t8()
|
||||||
{
|
{
|
||||||
int v, t, i;
|
int v;
|
||||||
|
|
||||||
printf("Bank read/write tests.\n");
|
printf("Bank read/write tests.\n");
|
||||||
|
|
||||||
|
@ -524,13 +524,11 @@ void t8()
|
||||||
v = gpio_read(GPIO);
|
v = gpio_read(GPIO);
|
||||||
CHECK(8, 4, v, 1, 0, "set bank 1");
|
CHECK(8, 4, v, 1, 0, "set bank 1");
|
||||||
|
|
||||||
t = 0;
|
v = read_bank_2();
|
||||||
v = (1<<16);
|
|
||||||
for (i=0; i<100; i++)
|
if (v) v = 0; else v = 1;
|
||||||
{
|
|
||||||
if (read_bank_2() & v) t++;
|
CHECK(8, 5, v, 0, 0, "read bank 2");
|
||||||
};
|
|
||||||
CHECK(8, 5, t, 60, 75, "read bank 2");
|
|
||||||
|
|
||||||
v = clear_bank_2(0);
|
v = clear_bank_2(0);
|
||||||
CHECK(8, 6, v, 0, 0, "clear bank 2");
|
CHECK(8, 6, v, 0, 0, "clear bank 2");
|
||||||
|
|
|
@ -4,9 +4,9 @@ gcc -o x_pigpiod_if2 x_pigpiod_if2.c -lpigpiod_if2 -lpthread
|
||||||
|
|
||||||
*** WARNING ************************************************
|
*** WARNING ************************************************
|
||||||
* *
|
* *
|
||||||
* All the tests make extensive use of gpio 4 (pin P1-7). *
|
* All the tests make extensive use of gpio 25 (pin 22). *
|
||||||
* Ensure that either nothing or just a LED is connected to *
|
* Ensure that either nothing or just a LED is connected to *
|
||||||
* gpio 4 before running any of the tests. *
|
* gpio 25 before running any of the tests. *
|
||||||
* *
|
* *
|
||||||
* Some tests are statistical in nature and so may on *
|
* Some tests are statistical in nature and so may on *
|
||||||
* occasion fail. Repeated failures on the same test or *
|
* occasion fail. Repeated failures on the same test or *
|
||||||
|
@ -24,7 +24,7 @@ gcc -o x_pigpiod_if2 x_pigpiod_if2.c -lpigpiod_if2 -lpthread
|
||||||
|
|
||||||
#include "pigpiod_if2.h"
|
#include "pigpiod_if2.h"
|
||||||
|
|
||||||
#define GPIO 4
|
#define GPIO 25
|
||||||
|
|
||||||
void CHECK(int t, int st, int got, int expect, int pc, char *desc)
|
void CHECK(int t, int st, int got, int expect, int pc, char *desc)
|
||||||
{
|
{
|
||||||
|
@ -254,7 +254,7 @@ void t4(int pi)
|
||||||
set_PWM_range(pi, GPIO, 100);
|
set_PWM_range(pi, GPIO, 100);
|
||||||
|
|
||||||
h = notify_open(pi);
|
h = notify_open(pi);
|
||||||
e = notify_begin(pi, h, (1<<4));
|
e = notify_begin(pi, h, (1<<GPIO));
|
||||||
CHECK(4, 1, e, 0, 0, "notify open/begin");
|
CHECK(4, 1, e, 0, 0, "notify open/begin");
|
||||||
|
|
||||||
time_sleep(1);
|
time_sleep(1);
|
||||||
|
@ -286,10 +286,10 @@ void t4(int pi)
|
||||||
{
|
{
|
||||||
if (s != r.seqno) seq_ok = 0;
|
if (s != r.seqno) seq_ok = 0;
|
||||||
|
|
||||||
if (n) if (l != (r.level&(1<<4))) toggle_ok = 0;
|
if (n) if (l != (r.level&(1<<GPIO))) toggle_ok = 0;
|
||||||
|
|
||||||
if (r.level&(1<<4)) l = 0;
|
if (r.level&(1<<GPIO)) l = 0;
|
||||||
else l = (1<<4);
|
else l = (1<<GPIO);
|
||||||
|
|
||||||
s++;
|
s++;
|
||||||
n++;
|
n++;
|
||||||
|
@ -514,7 +514,7 @@ void t7(int pi)
|
||||||
|
|
||||||
void t8(int pi)
|
void t8(int pi)
|
||||||
{
|
{
|
||||||
int v, t, i;
|
int v;
|
||||||
|
|
||||||
printf("Bank read/write tests.\n");
|
printf("Bank read/write tests.\n");
|
||||||
|
|
||||||
|
@ -534,13 +534,11 @@ void t8(int pi)
|
||||||
v = gpio_read(pi, GPIO);
|
v = gpio_read(pi, GPIO);
|
||||||
CHECK(8, 4, v, 1, 0, "set bank 1");
|
CHECK(8, 4, v, 1, 0, "set bank 1");
|
||||||
|
|
||||||
t = 0;
|
v = read_bank_2(pi);
|
||||||
v = (1<<16);
|
|
||||||
for (i=0; i<100; i++)
|
if (v) v = 0; else v = 1;
|
||||||
{
|
|
||||||
if (read_bank_2(pi) & v) t++;
|
CHECK(8, 5, v, 0, 0, "read bank 2");
|
||||||
};
|
|
||||||
CHECK(8, 5, t, 60, 75, "read bank 2");
|
|
||||||
|
|
||||||
v = clear_bank_2(pi, 0);
|
v = clear_bank_2(pi, 0);
|
||||||
CHECK(8, 6, v, 0, 0, "clear bank 2");
|
CHECK(8, 6, v, 0, 0, "clear bank 2");
|
||||||
|
|
6
x_pigs
6
x_pigs
|
@ -1,13 +1,13 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
GPIO=4
|
GPIO=25
|
||||||
|
|
||||||
#
|
#
|
||||||
# This script serves as a confidence check that the socket interface to
|
# This script serves as a confidence check that the socket interface to
|
||||||
# the pigpio library is ok.
|
# the pigpio library is ok.
|
||||||
#
|
#
|
||||||
# The script uses gpio 4 (P1-7). Make sure that nothing (or only a LED)
|
# The script uses gpio 25 (pin 22). Make sure that nothing (or only a LED)
|
||||||
# is connected to gpio 4 before running the script.
|
# is connected to gpio 25 before running the script.
|
||||||
#
|
#
|
||||||
# To run the script
|
# To run the script
|
||||||
# sudo pigpiod # if not already running on the Pi
|
# sudo pigpiod # if not already running on the Pi
|
||||||
|
|
6
x_pipe
6
x_pipe
|
@ -1,13 +1,13 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
GPIO=4
|
GPIO=25
|
||||||
|
|
||||||
#
|
#
|
||||||
# This script serves as a confidence check that the pipe interface to
|
# This script serves as a confidence check that the pipe interface to
|
||||||
# the pigpio library is ok.
|
# the pigpio library is ok.
|
||||||
#
|
#
|
||||||
# The script uses gpio 4 (P1-7). Make sure that nothing (or only a LED)
|
# The script uses gpio 25 (pin 22). Make sure that nothing (or only a LED)
|
||||||
# is connected to gpio 4 before running the script.
|
# is connected to gpio 25 before running the script.
|
||||||
#
|
#
|
||||||
# To run the script
|
# To run the script
|
||||||
# sudo pigpiod # if not already running
|
# sudo pigpiod # if not already running
|
||||||
|
|
Loading…
Reference in New Issue