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
|
||||
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_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
|
||||
|
||||
|
|
52
pigpio.3
52
pigpio.3
|
@ -3409,7 +3409,7 @@ active low chip select.
|
|||
.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
|
||||
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
|
||||
|
||||
.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
|
||||
baud: 32K-125M (values above 30M are unlikely to work)
|
||||
.br
|
||||
|
@ -3492,7 +3492,7 @@ ux is 0 if the CEx gpio is reserved for SPI (default) and 1 otherwise.
|
|||
|
||||
.br
|
||||
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
|
||||
|
||||
|
@ -4673,11 +4673,11 @@ The gpio must be one of the following.
|
|||
.EX
|
||||
4 clock 0 All models
|
||||
.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
|
||||
6 clock 2 A+/B+/Pi2 and compute module only
|
||||
6 clock 2 A+/B+/Pi2/Zero and compute module only
|
||||
.br
|
||||
20 clock 0 A+/B+/Pi2 and compute module only
|
||||
20 clock 0 A+/B+/Pi2/Zero and compute module only
|
||||
.br
|
||||
21 clock 1 All models but Rev.2 B (reserved for system use)
|
||||
.br
|
||||
|
@ -4758,13 +4758,13 @@ The gpio must be one of the following.
|
|||
.br
|
||||
|
||||
.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
|
||||
13 PWM channel 1 A+/B+/Pi2 and compute module only
|
||||
13 PWM channel 1 A+/B+/Pi2/Zero and compute module only
|
||||
.br
|
||||
18 PWM channel 0 All models
|
||||
.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
|
||||
|
@ -4781,6 +4781,25 @@ The gpio must be one of the following.
|
|||
|
||||
.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 "" 4
|
||||
Updates the seconds and micros variables with the current time.
|
||||
|
@ -5271,7 +5290,7 @@ Configures pigpio support of the fifo and socket interfaces.
|
|||
.br
|
||||
|
||||
.EX
|
||||
ifFlags: 0-3
|
||||
ifFlags: 0-7
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -5285,8 +5304,19 @@ The default setting (0) is that both interfaces are enabled.
|
|||
|
||||
.br
|
||||
Or in PI_DISABLE_FIFO_IF to disable the pipe interface.
|
||||
|
||||
.br
|
||||
|
||||
.br
|
||||
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 "" 4
|
||||
Selects the method of DMA memory allocation.
|
||||
|
@ -7963,7 +7993,7 @@ A 16-bit word value.
|
|||
.br
|
||||
#define PI_BAD_POINTER -90 // bad (NULL) pointer
|
||||
.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
|
||||
#define PI_NOT_PWM_GPIO -92 // gpio is not in use for PWM
|
||||
.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/>
|
||||
*/
|
||||
|
||||
/* pigpio version 42 */
|
||||
/* pigpio version 43 */
|
||||
|
||||
/* include ------------------------------------------------------- */
|
||||
|
||||
|
@ -11616,3 +11616,4 @@ int gpioCfgInternals(unsigned cfgWhat, unsigned cfgVal)
|
|||
|
||||
#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 <pthread.h>
|
||||
|
||||
#define PIGPIO_VERSION 42
|
||||
#define PIGPIO_VERSION 43
|
||||
|
||||
/*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,
|
||||
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
|
||||
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)
|
||||
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.
|
||||
|
||||
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
|
||||
SPI device only.
|
||||
|
@ -3366,9 +3366,9 @@ The gpio must be one of the following.
|
|||
|
||||
. .
|
||||
4 clock 0 All models
|
||||
5 clock 1 A+/B+/Pi2 and compute module only (reserved for system use)
|
||||
6 clock 2 A+/B+/Pi2 and compute module only
|
||||
20 clock 0 A+/B+/Pi2 and compute module only
|
||||
5 clock 1 A+/B+/Pi2/Zero and compute module only (reserved for system use)
|
||||
6 clock 2 A+/B+/Pi2/Zero 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)
|
||||
|
||||
32 clock 0 Compute module only
|
||||
|
@ -3412,10 +3412,10 @@ share a PWM channel.
|
|||
The gpio must be one of the following.
|
||||
|
||||
. .
|
||||
12 PWM channel 0 A+/B+/Pi2 and compute module only
|
||||
13 PWM channel 1 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/Zero and compute module only
|
||||
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
|
||||
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
|
||||
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*/
|
||||
|
||||
/*F*/
|
||||
|
@ -3707,13 +3717,18 @@ int gpioCfgInterfaces(unsigned ifFlags);
|
|||
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.
|
||||
|
||||
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_LOCALHOST_SOCK_IF to disable remote socket
|
||||
access (this means that the socket interface is only
|
||||
usable from the local Pi).
|
||||
D*/
|
||||
|
||||
|
||||
|
@ -5048,7 +5063,7 @@ after this command is issued.
|
|||
#define PI_UNKNOWN_COMMAND -88 // unknown command
|
||||
#define PI_SPI_XFER_FAILED -89 // spi xfer/read/write failed
|
||||
#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_SERVO_GPIO -93 // gpio is not in use for servo pulses
|
||||
#define PI_NOT_HCLK_GPIO -94 // gpio has no hardware clock
|
||||
|
@ -5117,3 +5132,4 @@ after this command is issued.
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
48
pigpio.py
48
pigpio.py
|
@ -269,7 +269,7 @@ import threading
|
|||
import os
|
||||
import atexit
|
||||
|
||||
VERSION = "1.24"
|
||||
VERSION = "1.25"
|
||||
|
||||
exceptions = True
|
||||
|
||||
|
@ -667,7 +667,7 @@ _errors=[
|
|||
[PI_UNKNOWN_COMMAND , "unknown command"],
|
||||
[PI_SPI_XFER_FAILED , "SPI xfer/read/write failed"],
|
||||
[_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_SERVO_GPIO , "gpio is not in use for servo pulses"],
|
||||
[PI_NOT_HCLK_GPIO , "gpio has no hardware clock"],
|
||||
|
@ -1564,10 +1564,10 @@ class pi():
|
|||
|
||||
. .
|
||||
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)
|
||||
6 clock 2 A+/B+/Pi2 and compute module only
|
||||
20 clock 0 A+/B+/Pi2 and compute module only
|
||||
6 clock 2 A+/B+/Pi2/Zero 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)
|
||||
|
||||
32 clock 0 Compute module only
|
||||
|
@ -1615,10 +1615,10 @@ class pi():
|
|||
The gpio must be one of the following.
|
||||
|
||||
. .
|
||||
12 PWM channel 0 A+/B+/Pi2 and compute module only
|
||||
13 PWM channel 1 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/Zero and compute module only
|
||||
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
|
||||
41 PWM channel 1 Compute module only
|
||||
|
@ -1627,6 +1627,16 @@ class pi():
|
|||
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
|
||||
|
||||
|
@ -2895,12 +2905,12 @@ class pi():
|
|||
modify the default behaviour of 4-wire operation, mode 0,
|
||||
active low chip select.
|
||||
|
||||
An auxiliary SPI device is available on the A+/B+/Pi2 and may be
|
||||
selected by setting the A bit in the flags. The auxiliary
|
||||
device has 3 chip selects and a selectable word size in bits.
|
||||
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 device has 3 chip selects and a selectable
|
||||
word size in bits.
|
||||
|
||||
|
||||
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).
|
||||
spi_flags:= see below.
|
||||
|
||||
|
@ -2935,7 +2945,7 @@ class pi():
|
|||
and 1 otherwise.
|
||||
|
||||
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.
|
||||
Standard SPI device only.
|
||||
|
@ -3631,9 +3641,13 @@ class pi():
|
|||
FALLING_EDGE.
|
||||
wait_timeout:= 0.0- (default 60.0).
|
||||
|
||||
The function returns as soon as the edge is detected
|
||||
or after the number of seconds specified by timeout has
|
||||
expired.
|
||||
The function returns when the edge is detected or after
|
||||
the number of seconds specified by timeout has 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,
|
||||
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>
|
||||
|
@ -97,6 +97,7 @@ void usage()
|
|||
" -p value, socket port, 1024-32000, default 8888\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" \
|
||||
" -v, -V, display pigpio version and exit\n" \
|
||||
" -x mask, gpios which may be updated, default board user gpios\n" \
|
||||
"EXAMPLE\n" \
|
||||
"sudo pigpiod -s 2 -b 200 -f\n" \
|
||||
|
@ -121,7 +122,7 @@ static void initOpts(int argc, char *argv[])
|
|||
int opt, err, i;
|
||||
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)
|
||||
{
|
||||
|
@ -206,6 +207,12 @@ static void initOpts(int argc, char *argv[])
|
|||
else fatal("invalid -t option (%d)", i);
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
case 'V':
|
||||
printf("%d\n", PIGPIO_VERSION);
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
mask = getNum(optarg, &err);
|
||||
if (!err)
|
||||
|
@ -218,7 +225,7 @@ static void initOpts(int argc, char *argv[])
|
|||
|
||||
default: /* '?' */
|
||||
usage();
|
||||
exit(-1);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -347,3 +354,4 @@ int main(int argc, char **argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1360,11 +1360,11 @@ The gpio must be one of the following.
|
|||
.EX
|
||||
4 clock 0 All models
|
||||
.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
|
||||
6 clock 2 A+/B+/Pi2 and compute module only
|
||||
6 clock 2 A+/B+/Pi2/Zero and compute module only
|
||||
.br
|
||||
20 clock 0 A+/B+/Pi2 and compute module only
|
||||
20 clock 0 A+/B+/Pi2/Zero and compute module only
|
||||
.br
|
||||
21 clock 1 All models but Rev.2 B (reserved for system use)
|
||||
.br
|
||||
|
@ -1448,13 +1448,13 @@ The gpio must be one of the following.
|
|||
.br
|
||||
|
||||
.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
|
||||
13 PWM channel 1 A+/B+/Pi2 and compute module only
|
||||
13 PWM channel 1 A+/B+/Pi2/Zero and compute module only
|
||||
.br
|
||||
18 PWM channel 0 All models
|
||||
.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
|
||||
|
@ -1471,6 +1471,25 @@ The gpio must be one of the following.
|
|||
|
||||
.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 "" 4
|
||||
Gets the current system tick.
|
||||
|
@ -3622,7 +3641,7 @@ active low chip select.
|
|||
.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
|
||||
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
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
.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
|
||||
baud: 32K-125M (values above 30M are unlikely to work).
|
||||
.br
|
||||
|
@ -3707,7 +3726,7 @@ ux is 0 if the CEx gpio is reserved for SPI (default) and 1 otherwise.
|
|||
|
||||
.br
|
||||
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
|
||||
|
||||
|
@ -4214,13 +4233,21 @@ user_gpio: 0-31.
|
|||
|
||||
.br
|
||||
|
||||
.br
|
||||
The function returns 1 if the edge occurred, otherwise 0.
|
||||
|
||||
.br
|
||||
|
||||
.br
|
||||
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
|
||||
|
||||
.br
|
||||
|
|
|
@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE.
|
|||
For more information, please refer to <http://unlicense.org/>
|
||||
*/
|
||||
|
||||
/* PIGPIOD_IF2_VERSION 1 */
|
||||
/* PIGPIOD_IF2_VERSION 2 */
|
||||
|
||||
#include <stdio.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);
|
||||
|
||||
while (!triggered && (time_time() < due)) time_sleep(0.1);
|
||||
while (!triggered && (time_time() < due)) time_sleep(0.05);
|
||||
|
||||
callback_cancel(id);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ For more information, please refer to <http://unlicense.org/>
|
|||
|
||||
#include "pigpio.h"
|
||||
|
||||
#define PIGPIOD_IF2_VERSION 1
|
||||
#define PIGPIOD_IF2_VERSION 2
|
||||
|
||||
/*TEXT
|
||||
|
||||
|
@ -982,9 +982,9 @@ The gpio must be one of the following.
|
|||
|
||||
. .
|
||||
4 clock 0 All models
|
||||
5 clock 1 A+/B+/Pi2 and compute module only (reserved for system use)
|
||||
6 clock 2 A+/B+/Pi2 and compute module only
|
||||
20 clock 0 A+/B+/Pi2 and compute module only
|
||||
5 clock 1 A+/B+/Pi2/Zero and compute module only (reserved for system use)
|
||||
6 clock 2 A+/B+/Pi2/Zero 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)
|
||||
|
||||
32 clock 0 Compute module only
|
||||
|
@ -1031,10 +1031,10 @@ share a PWM channel.
|
|||
The gpio must be one of the following.
|
||||
|
||||
. .
|
||||
12 PWM channel 0 A+/B+/Pi2 and compute module only
|
||||
13 PWM channel 1 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/Zero and compute module only
|
||||
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
|
||||
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
|
||||
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*/
|
||||
|
||||
|
||||
|
@ -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,
|
||||
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
|
||||
device has 3 chip selects and a selectable word size in bits.
|
||||
|
||||
. .
|
||||
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).
|
||||
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.
|
||||
|
||||
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
|
||||
SPI device only.
|
||||
|
@ -2624,9 +2634,14 @@ user_gpio: 0-31.
|
|||
timeout: >=0.
|
||||
. .
|
||||
|
||||
The function returns 1 if the edge occurred, otherwise 0.
|
||||
|
||||
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*/
|
||||
|
||||
/*PARAMS
|
||||
|
|
29
pigs.1
29
pigs.1
|
@ -687,9 +687,9 @@ The gpio must be one of the following.
|
|||
|
||||
.EX
|
||||
4 clock 0 All models
|
||||
5 clock 1 A+/B+/Pi2 and compute module only (reserved for system use)
|
||||
6 clock 2 A+/B+/Pi2 and compute module only
|
||||
20 clock 0 A+/B+/Pi2 and compute module only
|
||||
5 clock 1 A+/B+/Pi2/Zero and compute module only (reserved for system use)
|
||||
6 clock 2 A+/B+/Pi2/Zero 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)
|
||||
|
||||
.EE
|
||||
|
@ -762,10 +762,10 @@ The gpio must be one of the following.
|
|||
.br
|
||||
|
||||
.EX
|
||||
12 PWM channel 0 A+/B+/Pi2 and compute module only
|
||||
13 PWM channel 1 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/Zero and compute module only
|
||||
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
|
||||
|
||||
|
@ -780,6 +780,19 @@ The gpio must be one of the following.
|
|||
|
||||
.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
|
||||
|
||||
.IP "\fBHWVER \fP - Get hardware version"
|
||||
|
@ -2736,7 +2749,7 @@ Speeds between 32kbps and 125Mbps are allowed. Speeds above 30Mbps
|
|||
are unlikely to work.
|
||||
|
||||
.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
|
||||
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
|
||||
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
|
||||
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
|
||||
|
||||
setup(name='pigpio',
|
||||
version='1.24',
|
||||
version='1.25',
|
||||
author='joan',
|
||||
author_email='joan@abyz.co.uk',
|
||||
maintainer='joan',
|
||||
|
|
28
x_pigpio.c
28
x_pigpio.c
|
@ -4,9 +4,9 @@ sudo ./x_pigpio
|
|||
|
||||
*** 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 *
|
||||
* 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 *
|
||||
* occasion fail. Repeated failures on the same test or *
|
||||
|
@ -27,7 +27,7 @@ sudo ./x_pigpio
|
|||
|
||||
#define USERDATA 18249013
|
||||
|
||||
#define GPIO 4
|
||||
#define GPIO 25
|
||||
|
||||
void CHECK(int t, int st, int got, int expect, int pc, char *desc)
|
||||
{
|
||||
|
@ -273,7 +273,7 @@ void t4()
|
|||
gpioSetPWMrange(GPIO, 100);
|
||||
|
||||
h = gpioNotifyOpen();
|
||||
e = gpioNotifyBegin(h, (1<<4));
|
||||
e = gpioNotifyBegin(h, (1<<GPIO));
|
||||
CHECK(4, 1, e, 0, 0, "notify open/begin");
|
||||
|
||||
time_sleep(1);
|
||||
|
@ -305,10 +305,10 @@ void t4()
|
|||
{
|
||||
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;
|
||||
else l = (1<<4);
|
||||
if (r.level&(1<<GPIO)) l = 0;
|
||||
else l = (1<<GPIO);
|
||||
|
||||
s++;
|
||||
n++;
|
||||
|
@ -522,7 +522,7 @@ void t7()
|
|||
|
||||
void t8()
|
||||
{
|
||||
int v, t, i;
|
||||
int v;
|
||||
|
||||
printf("Bank read/write tests.\n");
|
||||
|
||||
|
@ -542,13 +542,11 @@ void t8()
|
|||
v = gpioRead(GPIO);
|
||||
CHECK(8, 4, v, 1, 0, "set bank 1");
|
||||
|
||||
t = 0;
|
||||
v = (1<<16);
|
||||
for (i=0; i<100; i++)
|
||||
{
|
||||
if (gpioRead_Bits_32_53() & v) t++;
|
||||
};
|
||||
CHECK(8, 5, t, 60, 75, "read bank 2");
|
||||
v = gpioRead_Bits_32_53();
|
||||
|
||||
if (v) v = 0; else v = 1;
|
||||
|
||||
CHECK(8, 5, v, 0, 0, "read bank 2");
|
||||
|
||||
v = gpioWrite_Bits_32_53_Clear(0);
|
||||
CHECK(8, 6, v, 0, 0, "clear bank 2");
|
||||
|
|
26
x_pigpio.py
26
x_pigpio.py
|
@ -2,9 +2,9 @@
|
|||
|
||||
#*** 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 *
|
||||
#* 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 *
|
||||
#* occasion fail. Repeated failures on the same test or *
|
||||
|
@ -17,7 +17,7 @@ import struct
|
|||
|
||||
import pigpio
|
||||
|
||||
GPIO=4
|
||||
GPIO=25
|
||||
|
||||
def STRCMP(r, s):
|
||||
|
||||
|
@ -243,7 +243,7 @@ def t4():
|
|||
pi.set_PWM_range(GPIO, 100)
|
||||
|
||||
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")
|
||||
|
||||
time.sleep(1)
|
||||
|
@ -281,7 +281,7 @@ def t4():
|
|||
if s != S:
|
||||
seq_ok = 0
|
||||
|
||||
L = v & (1<<4)
|
||||
L = v & (1<<GPIO)
|
||||
|
||||
if n:
|
||||
if l != L:
|
||||
|
@ -290,7 +290,7 @@ def t4():
|
|||
if L:
|
||||
l = 0
|
||||
else:
|
||||
l = (1<<4)
|
||||
l = (1<<GPIO)
|
||||
|
||||
s += 1
|
||||
n += 1
|
||||
|
@ -549,12 +549,14 @@ def t8():
|
|||
v = pi.read(GPIO)
|
||||
CHECK(8, 4, v, 1, 0, "set bank 1")
|
||||
|
||||
t = 0
|
||||
v = (1<<16)
|
||||
for i in range(100):
|
||||
if pi.read_bank_2() & v:
|
||||
t += 1
|
||||
CHECK(8, 5, t, 60, 75, "read bank 2")
|
||||
v = pi.read_bank_2()
|
||||
|
||||
if v:
|
||||
v = 0
|
||||
else:
|
||||
v = 1
|
||||
|
||||
CHECK(8, 5, v, 0, 0, "read bank 2")
|
||||
|
||||
v = pi.clear_bank_2(0)
|
||||
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 ************************************************
|
||||
* *
|
||||
* 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 *
|
||||
* 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 *
|
||||
* 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"
|
||||
|
||||
#define GPIO 4
|
||||
#define GPIO 25
|
||||
|
||||
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);
|
||||
|
||||
h = notify_open();
|
||||
e = notify_begin(h, (1<<4));
|
||||
e = notify_begin(h, (1<<GPIO));
|
||||
CHECK(4, 1, e, 0, 0, "notify open/begin");
|
||||
|
||||
time_sleep(1);
|
||||
|
@ -282,10 +282,10 @@ void t4()
|
|||
{
|
||||
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;
|
||||
else l = (1<<4);
|
||||
if (r.level&(1<<GPIO)) l = 0;
|
||||
else l = (1<<GPIO);
|
||||
|
||||
s++;
|
||||
n++;
|
||||
|
@ -504,7 +504,7 @@ void t7()
|
|||
|
||||
void t8()
|
||||
{
|
||||
int v, t, i;
|
||||
int v;
|
||||
|
||||
printf("Bank read/write tests.\n");
|
||||
|
||||
|
@ -524,13 +524,11 @@ void t8()
|
|||
v = gpio_read(GPIO);
|
||||
CHECK(8, 4, v, 1, 0, "set bank 1");
|
||||
|
||||
t = 0;
|
||||
v = (1<<16);
|
||||
for (i=0; i<100; i++)
|
||||
{
|
||||
if (read_bank_2() & v) t++;
|
||||
};
|
||||
CHECK(8, 5, t, 60, 75, "read bank 2");
|
||||
v = read_bank_2();
|
||||
|
||||
if (v) v = 0; else v = 1;
|
||||
|
||||
CHECK(8, 5, v, 0, 0, "read bank 2");
|
||||
|
||||
v = clear_bank_2(0);
|
||||
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 ************************************************
|
||||
* *
|
||||
* 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 *
|
||||
* 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 *
|
||||
* 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"
|
||||
|
||||
#define GPIO 4
|
||||
#define GPIO 25
|
||||
|
||||
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);
|
||||
|
||||
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");
|
||||
|
||||
time_sleep(1);
|
||||
|
@ -286,10 +286,10 @@ void t4(int pi)
|
|||
{
|
||||
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;
|
||||
else l = (1<<4);
|
||||
if (r.level&(1<<GPIO)) l = 0;
|
||||
else l = (1<<GPIO);
|
||||
|
||||
s++;
|
||||
n++;
|
||||
|
@ -514,7 +514,7 @@ void t7(int pi)
|
|||
|
||||
void t8(int pi)
|
||||
{
|
||||
int v, t, i;
|
||||
int v;
|
||||
|
||||
printf("Bank read/write tests.\n");
|
||||
|
||||
|
@ -534,13 +534,11 @@ void t8(int pi)
|
|||
v = gpio_read(pi, GPIO);
|
||||
CHECK(8, 4, v, 1, 0, "set bank 1");
|
||||
|
||||
t = 0;
|
||||
v = (1<<16);
|
||||
for (i=0; i<100; i++)
|
||||
{
|
||||
if (read_bank_2(pi) & v) t++;
|
||||
};
|
||||
CHECK(8, 5, t, 60, 75, "read bank 2");
|
||||
v = read_bank_2(pi);
|
||||
|
||||
if (v) v = 0; else v = 1;
|
||||
|
||||
CHECK(8, 5, v, 0, 0, "read bank 2");
|
||||
|
||||
v = clear_bank_2(pi, 0);
|
||||
CHECK(8, 6, v, 0, 0, "clear bank 2");
|
||||
|
|
6
x_pigs
6
x_pigs
|
@ -1,13 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
GPIO=4
|
||||
GPIO=25
|
||||
|
||||
#
|
||||
# This script serves as a confidence check that the socket interface to
|
||||
# the pigpio library is ok.
|
||||
#
|
||||
# The script uses gpio 4 (P1-7). Make sure that nothing (or only a LED)
|
||||
# is connected to gpio 4 before running the script.
|
||||
# The script uses gpio 25 (pin 22). Make sure that nothing (or only a LED)
|
||||
# is connected to gpio 25 before running the script.
|
||||
#
|
||||
# To run the script
|
||||
# sudo pigpiod # if not already running on the Pi
|
||||
|
|
6
x_pipe
6
x_pipe
|
@ -1,13 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
GPIO=4
|
||||
GPIO=25
|
||||
|
||||
#
|
||||
# This script serves as a confidence check that the pipe interface to
|
||||
# the pigpio library is ok.
|
||||
#
|
||||
# The script uses gpio 4 (P1-7). Make sure that nothing (or only a LED)
|
||||
# is connected to gpio 4 before running the script.
|
||||
# The script uses gpio 25 (pin 22). Make sure that nothing (or only a LED)
|
||||
# is connected to gpio 25 before running the script.
|
||||
#
|
||||
# To run the script
|
||||
# sudo pigpiod # if not already running
|
||||
|
|
Loading…
Reference in New Issue