diff --git a/.gitignore b/.gitignore
index 4449b61..fcdcc13 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,8 @@ build
dist
*.egg-info
+tmp/
+
# DOC files
DOC/dbase/pigpio.sqlite.*
DOC/tmp
diff --git a/DOC/dbase/pigpio.sqlite b/DOC/dbase/pigpio.sqlite
index 531ccfd..c20cbe0 100644
Binary files a/DOC/dbase/pigpio.sqlite and b/DOC/dbase/pigpio.sqlite differ
diff --git a/DOC/src/defs/examples.def b/DOC/src/defs/examples.def
index cd793a4..5a54f92 100644
--- a/DOC/src/defs/examples.def
+++ b/DOC/src/defs/examples.def
@@ -501,6 +501,13 @@ gpioHardwareRevision
Related code.
+?4|https://pypi.org/project/nrf24/|2020-04-20|NRF24
+Python Package Index (Pypi) NRF24 module.
+pip install nrf24
+
+?4|https://github.com/bjarne-hansen/py-nrf24|2020-04-20|NRF24
+Code and example usage of the Pypi NRF24 module. Cleaned up and added support for reading from multiple pipes using open_reading_pipe(pipe, address) and open_writing_pipe(address) in order to be more "compatible" with the way NRF24 is used on Arduinos.
+
?4|https://github.com/stripcode/pigpio-stepper-motor|2016-08-12|Stepper Motor
Stepper motor code.
diff --git a/DOC/src/defs/pigs.def b/DOC/src/defs/pigs.def
index 2f6d23c..f678126 100644
--- a/DOC/src/defs/pigs.def
+++ b/DOC/src/defs/pigs.def
@@ -320,7 +320,7 @@ WVAG trips :: Add generic pulses to waveform :: gpioWaveAddGeneric
WVAS u b db sb o bvs :: Add serial data to waveform :: gpioWaveAddSerial
WVCRE :: Create a waveform :: gpioWaveCreate
-WVCAP :: Create a waveform of fixed size :: gpioWaveCreatePad
+WVCAP percent :: Create a waveform of fixed size :: gpioWaveCreatePad
WVDEL wid :: Delete selected waveform :: gpioWaveDelete
WVTX wid :: Transmits waveform once :: gpioWaveTxSend
@@ -2610,7 +2610,7 @@ $ pigs wvas 7 38400 8 2 0 0x41 0x42
WVTAT ::
This command returns the id of the waveform currently
-being transmitted.
+being transmitted. Chained waves are not supported.
Returns the waveform id or one of the following special
values:
@@ -2786,20 +2786,13 @@ ERROR: attempt to create an empty waveform
WVCAP ::
-Similar to [*WVCRE*], this command creates a waveform but pads the consumed
-resources to a fixed size, specified as a percent of total resource.
-Padded waves of equal size can be re-cycled efficiently allowing newly
-created waves to re-use the resources of deleted waves of the same dimension.
+Create a waveform of fixed size. Similar to [*WVCRE*], this command creates a waveform but pads the consumed resources to a fixed size, specified as a [*percent*] of the total resources. Padded waves of equal size can be re-cycled efficiently allowing newly created waves to re-use the resources of deleted waves of the same dimension.
-Upon success a wave id (>=0) is returned. On error a negative status
-code will be returned.
+Upon success a wave id (>=0) is returned. On error a negative status code will be returned.
-The data provided by the [*WVAG*] and [*WVAS*] commands are
-consumed by this command.
+The data provided by the [*WVAG*] and [*WVAS*] commands are consumed by this command.
-As many waveforms may be created as there is space available.
-The wave id is passed to [*WVTX*] or [*WVTXR*] to specify the
-waveform to transmit.
+As many waveforms may be created as there is space available. The wave id is passed to [*WVTX*] or [*WVTXR*] to specify the waveform to transmit.
Normal usage would be
@@ -2813,8 +2806,9 @@ Step 4. [*WVTX*] or [*WVTXR*] with the id of the waveform to transmit.
Repeat steps 2 - 4 as needed.
-Step 5. Any wave id can now be deleted and another wave of the same size
- can be created in its place.
+Step 5. Any wave id can now be deleted and another wave of the same size can be created in its place.
+
+Example
...
# Create a wave that consumes 50% of the total resource:
@@ -3200,6 +3194,11 @@ must match an entry in /opt/pigpio/access.
pdc :: hardware PWM dutycycle (0-1000000)
The command expects a dutycycle.
+percent :: percent (1-100)
+The percent of wave resources to allocate to a wave. It can be useful
+to create waves of fixed sizes to prevent wave fragmentation (where
+there are plenty of resources but not a large enough contiguous space).
+
pf :: hardware PWM frequency (1-125M, 1-187.5M for the BCM2711)
The command expects a frequency.
diff --git a/DOC/src/html/download.html b/DOC/src/html/download.html
index 8c2c7be..740a3c8 100644
--- a/DOC/src/html/download.html
+++ b/DOC/src/html/download.html
@@ -1,7 +1,7 @@
-
+
download
@@ -14,12 +14,14 @@ pigpiod).
compilation of pigpio.c, takes 100 seconds on early model
Pis. Be patient. The overall install takes just over 3
minutes.
-Download and install (V75)
-wget https://github.com/joan2937/pigpio/archive/v75.zip
-unzip v75.zip
-cd pigpio-75
+Download and install latest version
+
+wget https://github.com/joan2937/pigpio/archive/master.zip
+unzip master.zip
+cd pigpio-master
make
-sudo make install
+sudo make install
+
If the Python part of the install fails it may be because you need
the setup tools.
diff --git a/DOC/src/html/index.html b/DOC/src/html/index.html
index b34ea79..0b8e33c 100644
--- a/DOC/src/html/index.html
+++ b/DOC/src/html/index.html
@@ -10,13 +10,6 @@
pigpio is a library for the Raspberry which allows control of the
General Purpose Input Outputs (GPIO). pigpio works on all
versions of the Pi.
-At the moment pigpio on the Pi4B is experimental. I am not
-sure if the DMA channels being used are safe. The Pi4B defaults are
-primary channel 7, secondary channel 6. If these channels do not
-work you will have to experiment. You can set the channels used by
-the pigpio daemon by invoking it with the -d and -e options, e.g.
-sudo pigpiod -d 5 -e 8 to specify primary 5,
-secondary 8.
Download
Features
@@ -627,7 +620,7 @@ links.
Languages
There are several third party projects which provide wrappers
for pigpio.
-Some I am aware of are:
+Some are listed here:
The PWM and servo pulses are timed using the DMA
diff --git a/pigpio.3 b/pigpio.3
index c878cbd..675c2ec 100644
--- a/pigpio.3
+++ b/pigpio.3
@@ -189,6 +189,28 @@ error PI_INITIALISED.
.br
+.br
+If you intend to rely on signals sent to your application, you should
+turn off the internal signal handling as shown in this example:
+
+.br
+
+.br
+
+.EX
+int cfg = gpioCfgGetInternals();
+.br
+cfg |= PI_CFG_NOSIGHANDLER; // (1<<10)
+.br
+gpioCfgSetInternals(cfg);
+.br
+int status = gpioInitialise();
+.br
+
+.EE
+
+.br
+
.br
.SH OVERVIEW
@@ -689,8 +711,6 @@ gpioCfgMemAlloc Configure DMA memory allocation mode
gpioCfgNetAddr Configure allowed network addresses
.br
-.br
-gpioCfgInternals Configure misc. internals (DEPRECATED)
.br
gpioCfgGetInternals Get internal configuration settings
.br
@@ -3026,7 +3046,7 @@ int main(int argc, char *argv[])
.IP "\fBint gpioWaveTxAt(void)\fP"
.IP "" 4
This function returns the id of the waveform currently being
-transmitted.
+transmitted using \fBgpioWaveTxSend\fP. Chained waves are not supported.
.br
@@ -7896,22 +7916,6 @@ numSockAddr: 0-256 (0 means all addresses allowed)
.EE
-.IP "\fBint gpioCfgInternals(unsigned cfgWhat, unsigned cfgVal)\fP"
-.IP "" 4
-Used to tune internal settings.
-
-.br
-
-.br
-
-.EX
-cfgWhat: see source code
-.br
- cfgVal: see source code
-.br
-
-.EE
-
.IP "\fBuint32_t gpioCfgGetInternals(void)\fP"
.IP "" 4
This function returns the current library internal configuration
@@ -7932,6 +7936,10 @@ cfgVal: see source code
.EE
+.br
+
+.br
+
.IP "\fBint gpioCustom1(unsigned arg1, unsigned arg2, char *argx, unsigned argc)\fP"
.IP "" 4
This function is available for user customisation.
diff --git a/pigpio.c b/pigpio.c
index 1bdae12..491c40d 100644
--- a/pigpio.c
+++ b/pigpio.c
@@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to
*/
-/* pigpio version 76 */
+/* pigpio version 77 */
/* include ------------------------------------------------------- */
@@ -950,6 +950,7 @@ typedef struct
uint32_t nfRBitV;
uint32_t gfSteadyUs;
+ uint8_t gfInitialised;
uint32_t gfTick;
uint32_t gfLBitV;
uint32_t gfRBitV;
@@ -3000,7 +3001,9 @@ static void waveCBsOOLs(int *numCBs, int *numBOOLs, int *numTOOLs)
for (i=0; i 0)
+ {
+ /* Initialise filter with first sample */
+ bitV = sample[0].level & bit;
+ gpioAlert[i].gfRBitV = bitV;
+ gpioAlert[i].gfLBitV = bitV;
+ gpioAlert[i].gfTick = sample[0].tick;
+ gpioAlert[i].gfInitialised = 1;
+ }
+
steadyUs = gpioAlert[i].gfSteadyUs;
RBitV = gpioAlert[i].gfRBitV;
LBitV = gpioAlert[i].gfLBitV;
@@ -12333,18 +12347,8 @@ int gpioGlitchFilter(unsigned gpio, unsigned steady)
if (steady)
{
- gpioAlert[gpio].gfTick = systReg[SYST_CLO];
-
- if (gpioRead_Bits_0_31() & (1<= DBG_ALWAYS) && (cfgVal <= DBG_MAX_LEVEL))
- {
-
- gpioCfg.dbgLevel = cfgVal;
- gpioCfg.internals = (gpioCfg.internals & (~0xF)) | cfgVal;
-
- DBG(DBG_ALWAYS, "Debug level is %u", cfgVal);
-
- retVal = 0;
- }
-
- break;
- }
-
- return retVal;
-}
-
/* include any user customisations */
diff --git a/pigpio.h b/pigpio.h
index 059d751..e417b96 100644
--- a/pigpio.h
+++ b/pigpio.h
@@ -30,7 +30,7 @@ For more information, please refer to
#include
#include
-#define PIGPIO_VERSION 76
+#define PIGPIO_VERSION 77
/*TEXT
@@ -106,6 +106,16 @@ return error PI_NOT_INITIALISED.
If the library is initialised the [*gpioCfg**] functions will return
error PI_INITIALISED.
+If you intend to rely on signals sent to your application, you should
+turn off the internal signal handling as shown in this example:
+
+. .
+int cfg = gpioCfgGetInternals();
+cfg |= PI_CFG_NOSIGHANDLER; // (1<<10)
+gpioCfgSetInternals(cfg);
+int status = gpioInitialise();
+. .
+
TEXT*/
/*OVERVIEW
@@ -377,7 +387,6 @@ gpioCfgSocketPort Configure socket port
gpioCfgMemAlloc Configure DMA memory allocation mode
gpioCfgNetAddr Configure allowed network addresses
-gpioCfgInternals Configure misc. internals (DEPRECATED)
gpioCfgGetInternals Get internal configuration settings
gpioCfgSetInternals Set internal configuration settings
@@ -2181,7 +2190,7 @@ D*/
int gpioWaveTxAt(void);
/*D
This function returns the id of the waveform currently being
-transmitted.
+transmitted using [*gpioWaveTxSend*]. Chained waves are not supported.
Returns the waveform id or one of the following special values:
@@ -4975,18 +4984,6 @@ numSockAddr: 0-256 (0 means all addresses allowed)
D*/
-/*F*/
-int gpioCfgInternals(unsigned cfgWhat, unsigned cfgVal);
-/*D
-Used to tune internal settings.
-
-. .
-cfgWhat: see source code
- cfgVal: see source code
-. .
-D*/
-
-
/*F*/
uint32_t gpioCfgGetInternals(void);
/*D
@@ -5003,6 +5000,7 @@ settings.
. .
cfgVal: see source code
. .
+
D*/
diff --git a/pigpio.py b/pigpio.py
index 978aff2..7fc80a5 100644
--- a/pigpio.py
+++ b/pigpio.py
@@ -2466,7 +2466,7 @@ class pi():
def wave_tx_at(self):
"""
Returns the id of the waveform currently being
- transmitted.
+ transmitted using [*wave_send**]. Chained waves are not supported.
Returns the waveform id or one of the following special
values:
@@ -5055,7 +5055,7 @@ class pi():
by calling the tally function. The count may be reset to zero
by calling the reset_tally function.
- The callback may be cancelled by calling the event_cancel function.
+ The callback may be canceled by calling the cancel function.
An event may have multiple callbacks (although I can't think of
a reason to do so).
@@ -5072,7 +5072,7 @@ class pi():
cb2.reset_tally()
- cb1.event_cancel() # To cancel callback cb1.
+ cb1.cancel() # To cancel callback cb1.
...
"""
diff --git a/pigpiod_if2.3 b/pigpiod_if2.3
index f07de8d..e5c79e8 100644
--- a/pigpiod_if2.3
+++ b/pigpiod_if2.3
@@ -2829,7 +2829,7 @@ int main(int argc, char *argv[])
.IP "\fBint wave_tx_at(int pi)\fP"
.IP "" 4
This function returns the id of the waveform currently being
-transmitted.
+transmitted by \fBwave_send*\fP. Chained waves are not supported.
.br
diff --git a/pigpiod_if2.h b/pigpiod_if2.h
index 79d0223..9700cc0 100644
--- a/pigpiod_if2.h
+++ b/pigpiod_if2.h
@@ -1609,7 +1609,7 @@ D*/
int wave_tx_at(int pi);
/*D
This function returns the id of the waveform currently being
-transmitted.
+transmitted by [*wave_send**]. Chained waves are not supported.
. .
pi: >=0 (as returned by [*pigpio_start*]).
diff --git a/pigs.1 b/pigs.1
index 9b6192c..9b53e0e 100644
--- a/pigs.1
+++ b/pigs.1
@@ -548,8 +548,8 @@ Add serial data to waveform
.B WVCRE
Create a waveform
.P
-.B WVCAP
-Create a waveform of fixed size
+.B WVCAP percent
+Create a waveform of fixed size
.P
.B WVDEL wid
Delete selected waveform
@@ -4823,7 +4823,7 @@ $ pigs wvas 7 38400 8 2 0 0x41 0x42
.br
This command returns the id of the waveform currently
-being transmitted.
+being transmitted. Chained waves are not supported.
.br
Returns the waveform id or one of the following special
@@ -5142,27 +5142,20 @@ ERROR: attempt to create an empty waveform
.br
-.IP "\fBWVCAP \fP - Create a waveform of fixed size"
+.IP "\fBWVCAP percent\fP - Create a waveform of fixed size"
.IP "" 4
.br
-Similar to \fBWVCRE\fP, this command creates a waveform but pads the consumed
-resources to a fixed size, specified as a percent of total resource.
-Padded waves of equal size can be re-cycled efficiently allowing newly
-created waves to re-use the resources of deleted waves of the same dimension.
+Create a waveform of fixed size. Similar to \fBWVCRE\fP, this command creates a waveform but pads the consumed resources to a fixed size, specified as a \fBpercent\fP of the total resources. Padded waves of equal size can be re-cycled efficiently allowing newly created waves to re-use the resources of deleted waves of the same dimension.
.br
-Upon success a wave id (>=0) is returned. On error a negative status
-code will be returned.
+Upon success a wave id (>=0) is returned. On error a negative status code will be returned.
.br
-The data provided by the \fBWVAG\fP and \fBWVAS\fP commands are
-consumed by this command.
+The data provided by the \fBWVAG\fP and \fBWVAS\fP commands are consumed by this command.
.br
-As many waveforms may be created as there is space available.
-The wave id is passed to \fBWVTX\fP or \fBWVTXR\fP to specify the
-waveform to transmit.
+As many waveforms may be created as there is space available. The wave id is passed to \fBWVTX\fP or \fBWVTXR\fP to specify the waveform to transmit.
.br
Normal usage would be
@@ -5183,8 +5176,10 @@ Step 4. \fBWVTX\fP or \fBWVTXR\fP with the id of the waveform to transmit.
Repeat steps 2 - 4 as needed.
.br
-Step 5. Any wave id can now be deleted and another wave of the same size
- can be created in its place.
+Step 5. Any wave id can now be deleted and another wave of the same size can be created in its place.
+
+.br
+Example
.br
@@ -5881,6 +5876,13 @@ The command expects a dutycycle.
.br
+.IP "\fBpercent\fP - percent (1-100)" 0
+The percent of wave resources to allocate to a wave. It can be useful
+to create waves of fixed sizes to prevent wave fragmentation (where
+there are plenty of resources but not a large enough contiguous space).
+
+.br
+
.IP "\fBpf\fP - hardware PWM frequency (1-125M, 1-187.5M for the BCM2711)" 0
The command expects a frequency.
diff --git a/util/pigpiod b/util/pigpiod
deleted file mode 100755
index 59ba142..0000000
--- a/util/pigpiod
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-### BEGIN INIT INFO
-# Provides: pigpiod
-# Required-Start:
-# Required-Stop:
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: pigpio daemon
-# Description: pigpio daemon required to control GPIO pins via pigpio $
-### END INIT INFO
-
-# Actions
-case "$1" in
- start)
- pigpiod
- ;;
- stop)
- pkill pigpiod
- ;;
- restart)
- pkill pigpiod
- pigpiod
- ;;
- *)
- echo "Usage: $0 start" >&2
- exit 3
- ;;
-esac
-
-exit 0
-