summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy McSwain <guy.mcswain@gmail.com>2020-06-28 10:24:11 -0500
committerGitHub <noreply@github.com>2020-06-28 10:24:11 -0500
commita2997c58a3837fc8b76df7948d0b4ce81e3bf99c (patch)
tree464575283f0ddab07fb561c3d2450cabfb0c0d51
parent30e6b3557486d323809d3783a6886afbbf701d95 (diff)
parent0c1fb8b6603040ee41c4cdde0e60f16f6f264240 (diff)
Merge pull request #365 from joan2937/v77-release
V77 release
-rw-r--r--.gitignore2
-rw-r--r--DOC/dbase/pigpio.sqlitebin1433600 -> 1433600 bytes
-rw-r--r--DOC/src/defs/examples.def7
-rw-r--r--DOC/src/defs/pigs.def29
-rw-r--r--DOC/src/html/download.html14
-rw-r--r--DOC/src/html/index.html15
-rw-r--r--pigpio.346
-rw-r--r--pigpio.c72
-rw-r--r--pigpio.h28
-rw-r--r--pigpio.py6
-rw-r--r--pigpiod_if2.32
-rw-r--r--pigpiod_if2.h2
-rw-r--r--pigs.136
-rwxr-xr-xutil/pigpiod31
14 files changed, 120 insertions, 170 deletions
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
--- a/DOC/dbase/pigpio.sqlite
+++ b/DOC/dbase/pigpio.sqlite
Binary files 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 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
-<meta name="generator" content="Bluefish 2.2.10" >
+<meta name="generator" content="Bluefish 2.2.11" >
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>download</title>
</head>
@@ -14,12 +14,14 @@ pigpiod).<br>
compilation of pigpio.c, takes 100 seconds on early model
Pis.&nbsp; Be patient.&nbsp; The overall install takes just over 3
minutes.</span><br style="font-weight: bold;">
-<h3>Download and install (V75)<br></h3>
-<code>wget https://github.com/joan2937/pigpio/archive/v75.zip<br>
-unzip v75.zip<br>
-cd pigpio-75<br>
+<h3>Download and install latest version<br></h3>
+<code>
+wget https://github.com/joan2937/pigpio/archive/master.zip<br>
+unzip master.zip<br>
+cd pigpio-master<br>
make<br>
-sudo make install<br></code><br>
+sudo make install<br>
+</code>
<br>
If the Python part of the install fails it may be because you need
the setup tools.<br>
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).&nbsp; pigpio works on all
versions of the Pi.
-<p><b>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.
-<small>sudo pigpiod -d 5 -e 8</small> to specify primary 5,
-secondary 8.</b></p>
<p><a href="download.html">Download</a><br></p>
<h3>Features<br></h3>
<ul>
@@ -627,7 +620,7 @@ links.<br></p>
Languages</h3>
<p>There are several third party projects which provide wrappers
for pigpio.<br></p>
-<p>Some I am aware of are:<br></p>
+<p>Some are listed here:<br></p>
<ul>
<li><a href="https://github.com/skvamme/pigpio">Erlang</a>
(skvamme)</li>
@@ -642,7 +635,9 @@ diozero, a high level wrapper around pigpio, Pi4J, wiringPi etc
"https://github.com/unosquare/pigpio-dotnet">.NET/mono</a>
(unosquare)</li>
<li><a href="https://github.com/fivdi/pigpio">Node.js</a>
-(fivdi)</li>
+A wrapper for the pigpio C library (fivdi)</li>
+<li><a href="https://github.com/guymcswain/pigpio-client">Node.js</a>
+A client for pigpio socket interface (guymcswain)</li>
<li><a href="https://metacpan.org/pod/RPi::PIGPIO">Perl</a> (Gligan
Calin Horea)</li>
<li><a href=
@@ -652,6 +647,8 @@ Calin Horea)</li>
"https://github.com/vasmalltalk/pigpio-vast">Smalltalk</a>(Instantiations)</li>
<li><a href=
"https://github.com/UBogun/Xojo-pigpio">Xojo</a>(UBogun)</li>
+<li><a href=
+"https://github.com/eugenedakin/pigpio-GPIO">Xojo</a>(Eugene Dakin)</li>
</ul>
<hr style="width: 100%; height: 2px;">
<p><font size="-2">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
@@ -190,6 +190,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
@@ -690,8 +712,6 @@ gpioCfgNetAddr Configure allowed network addresses
.br
.br
-gpioCfgInternals Configure misc. internals (DEPRECATED)
-.br
gpioCfgGetInternals Get internal configuration settings
.br
gpioCfgSetInternals Set internal configuration settings
@@ -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 <http://unlicense.org/>
*/
-/* 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<numWaves; i++)
{
- if (waves[i].gpioOn || waves[i].gpioOff) {numCB++; numBOOL++;}
+ if (waves[i].gpioOn) {numBOOL++;}
+ if (waves[i].gpioOff) {numBOOL++;}
+ if (waves[i].gpioOn || waves[i].gpioOff) {numCB++;}
if (waves[i].flags & WAVE_FLAG_READ) {numCB++; numTOOL++;}
if (waves[i].flags & WAVE_FLAG_TICK) {numCB++; numTOOL++;}
@@ -5683,7 +5686,7 @@ unsigned alert_delays[]=
static void alertGlitchFilter(gpioSample_t *sample, int numSamples)
{
int i, j, diff;
- uint32_t steadyUs, changedTick, RBitV, LBitV;
+ uint32_t steadyUs, changedTick, RBitV, LBitV, initialised;
uint32_t bit, bitV;
for (i=0; i<=PI_MAX_USER_GPIO; i++)
@@ -5692,6 +5695,17 @@ static void alertGlitchFilter(gpioSample_t *sample, int numSamples)
if (monitorBits & bit & gFilterBits)
{
+ initialised = gpioAlert[i].gfInitialised;
+ if (!initialised && numSamples > 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<<gpio))
- {
- gpioAlert[gpio].gfLBitV = (1<<gpio);
- gpioAlert[gpio].gfRBitV = 0 ;
- }
- else
- {
- gpioAlert[gpio].gfLBitV = 0 ;
- gpioAlert[gpio].gfRBitV = (1<<gpio);
- }
+ /* Initialise values next time we process alerts */
+ gpioAlert[gpio].gfInitialised = 0;
}
gpioAlert[gpio].gfSteadyUs = steady;
@@ -13998,44 +14002,6 @@ int gpioCfgSetInternals(uint32_t cfgVal)
return 0;
}
-int gpioCfgInternals(unsigned cfgWhat, unsigned cfgVal)
-{
- int retVal = PI_BAD_CFG_INTERNAL;
-
- DBG(DBG_USER, "cfgWhat=%u, cfgVal=%d", cfgWhat, cfgVal);
-
- switch(cfgWhat)
- {
- case 562484977:
-
- if (cfgVal) gpioCfg.internals |= PI_CFG_STATS;
- else gpioCfg.internals &= (~PI_CFG_STATS);
-
- DBG(DBG_ALWAYS, "show stats is %u", cfgVal);
-
- retVal = 0;
-
- break;
-
- case 984762879:
-
- if ((cfgVal >= 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 <http://unlicense.org/>
#include <stdint.h>
#include <pthread.h>
-#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:
@@ -4976,18 +4985,6 @@ 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
This function returns the current library internal configuration
@@ -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
-