pigpiod_if2.o: pigpiod_if2.c pigpio.h pigpiod_if2.h command.h
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
+
.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.
.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
.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
.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
.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
.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.
.br
.EX
-ifFlags: 0-3
+ifFlags: 0-7
.br
.EE
.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.
.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
For more information, please refer to <http://unlicense.org/>
*/
-/* pigpio version 42 */
+/* pigpio version 43 */
/* include ------------------------------------------------------- */
#include "custom.cext"
+
#include <stdint.h>
#include <pthread.h>
-#define PIGPIO_VERSION 42
+#define PIGPIO_VERSION 43
/*TEXT
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
. .
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.
. .
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
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
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*/
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*/
#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
#endif
+
import os
import atexit
-VERSION = "1.24"
+VERSION = "1.25"
exceptions = True
[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"],
. .
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
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
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
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.
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.
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.
*/
/*
-This version is for pigpio version 38+
+This version is for pigpio version 43+
*/
#include <sys/types.h>
" -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" \
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)
{
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)
default: /* '?' */
usage();
- exit(-1);
+ exit(EXIT_FAILURE);
}
}
}
return 0;
}
+
.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
.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
.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.
.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.
.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
.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
.br
.br
-The function returns 1 if the edge occurred, otherwise 0.
+The function returns when the edge occurs or after the timeout.
.br
.br
-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 \fBcallback\fP function.
+
+.br
+
+.br
+The function returns 1 if the edge occurred, otherwise 0.
.SH PARAMETERS
.br
For more information, please refer to <http://unlicense.org/>
*/
-/* PIGPIOD_IF2_VERSION 1 */
+/* PIGPIOD_IF2_VERSION 2 */
#include <stdio.h>
#include <stdlib.h>
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);
#include "pigpio.h"
-#define PIGPIOD_IF2_VERSION 1
+#define PIGPIOD_IF2_VERSION 2
/*TEXT
. .
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
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
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*/
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.
. .
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.
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
.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
.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
.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"
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.
.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
from distutils.core import setup
setup(name='pigpio',
- version='1.24',
+ version='1.25',
author='joan',
author_email='joan@abyz.co.uk',
maintainer='joan',
*** 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 *
#define USERDATA 18249013
-#define GPIO 4
+#define GPIO 25
void CHECK(int t, int st, int got, int expect, int pc, char *desc)
{
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);
{
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++;
void t8()
{
- int v, t, i;
+ int v;
printf("Bank read/write tests.\n");
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");
#*** 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 *
import pigpio
-GPIO=4
+GPIO=25
def STRCMP(r, s):
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)
if s != S:
seq_ok = 0
- L = v & (1<<4)
+ L = v & (1<<GPIO)
if n:
if l != L:
if L:
l = 0
else:
- l = (1<<4)
+ l = (1<<GPIO)
s += 1
n += 1
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")
*** 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 *
#include "pigpiod_if.h"
-#define GPIO 4
+#define GPIO 25
void CHECK(int t, int st, int got, int expect, int pc, char *desc)
{
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);
{
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++;
void t8()
{
- int v, t, i;
+ int v;
printf("Bank read/write tests.\n");
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");
*** 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 *
#include "pigpiod_if2.h"
-#define GPIO 4
+#define GPIO 25
void CHECK(int t, int st, int got, int expect, int pc, char *desc)
{
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);
{
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++;
void t8(int pi)
{
- int v, t, i;
+ int v;
printf("Bank read/write tests.\n");
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");
#!/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
#!/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