mirror of https://github.com/joan2937/pigpio
wave delete comments
This commit is contained in:
parent
bf390b4a2f
commit
f83c93066e
4
README
4
README
|
@ -33,7 +33,7 @@ TEST (optional)
|
|||
|
||||
*** WARNING ************************************************
|
||||
* *
|
||||
* All the tests make extensive use of gpio 4 (pin P1/J8-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. *
|
||||
* *
|
||||
|
@ -157,7 +157,7 @@ reflect the Windows/Mac socket interface.
|
|||
|
||||
DOCUMENTATION
|
||||
|
||||
The most up to date should be http://abyz.co.uk/rpi/pigpio/
|
||||
The most up to date should be http://abyz.me.uk/rpi/pigpio/
|
||||
|
||||
On the Pi try
|
||||
|
||||
|
|
18
pigpio.3
18
pigpio.3
|
@ -2130,6 +2130,24 @@ This function deletes the waveform with id wave_id.
|
|||
|
||||
.br
|
||||
|
||||
.br
|
||||
The wave is flagged for deletion. The resources used by the wave
|
||||
will only be reused when either of the following apply.
|
||||
|
||||
.br
|
||||
|
||||
.br
|
||||
- all waves with higher numbered wave ids have been deleted or have
|
||||
been flagged for deletion.
|
||||
|
||||
.br
|
||||
|
||||
.br
|
||||
- a new wave is created which uses exactly the same resources as
|
||||
the current wave (see the C source for gpioWaveCreate for details).
|
||||
|
||||
.br
|
||||
|
||||
.br
|
||||
|
||||
.EX
|
||||
|
|
11
pigpio.h
11
pigpio.h
|
@ -31,7 +31,7 @@ For more information, please refer to <http://unlicense.org/>
|
|||
#include <stdint.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#define PIGPIO_VERSION 6511
|
||||
#define PIGPIO_VERSION 6514
|
||||
|
||||
/*TEXT
|
||||
|
||||
|
@ -1956,6 +1956,15 @@ int gpioWaveDelete(unsigned wave_id);
|
|||
/*D
|
||||
This function deletes the waveform with id wave_id.
|
||||
|
||||
The wave is flagged for deletion. The resources used by the wave
|
||||
will only be reused when either of the following apply.
|
||||
|
||||
- all waves with higher numbered wave ids have been deleted or have
|
||||
been flagged for deletion.
|
||||
|
||||
- a new wave is created which uses exactly the same resources as
|
||||
the current wave (see the C source for gpioWaveCreate for details).
|
||||
|
||||
. .
|
||||
wave_id: >=0, as returned by [*gpioWaveCreate*]
|
||||
. .
|
||||
|
|
78
pigpio.py
78
pigpio.py
|
@ -860,7 +860,7 @@ class _socklock:
|
|||
"""
|
||||
def __init__(self):
|
||||
self.s = None
|
||||
self.l = threading.RLock()
|
||||
self.l = threading.Lock()
|
||||
|
||||
class error(Exception):
|
||||
"""pigpio module exception"""
|
||||
|
@ -987,6 +987,19 @@ def _pigpio_command(sl, cmd, p1, p2):
|
|||
sl.l.release()
|
||||
return res
|
||||
|
||||
def _pigpio_command_nolock(sl, cmd, p1, p2):
|
||||
"""
|
||||
Runs a pigpio socket command.
|
||||
|
||||
sl:= command socket and lock.
|
||||
cmd:= the command to be executed.
|
||||
p1:= command parameter 1 (if applicable).
|
||||
p2:= command parameter 2 (if applicable).
|
||||
"""
|
||||
sl.s.send(struct.pack('IIII', cmd, p1, p2, 0))
|
||||
dummy, res = struct.unpack('12sI', sl.s.recv(_SOCK_CMD_LEN))
|
||||
return res
|
||||
|
||||
def _pigpio_command_ext(sl, cmd, p1, p2, p3, extents):
|
||||
"""
|
||||
Runs an extended pigpio socket command.
|
||||
|
@ -1012,6 +1025,27 @@ def _pigpio_command_ext(sl, cmd, p1, p2, p3, extents):
|
|||
sl.l.release()
|
||||
return res
|
||||
|
||||
def _pigpio_command_ext_nolock(sl, cmd, p1, p2, p3, extents):
|
||||
"""
|
||||
Runs an extended pigpio socket command.
|
||||
|
||||
sl:= command socket and lock.
|
||||
cmd:= the command to be executed.
|
||||
p1:= command parameter 1 (if applicable).
|
||||
p2:= command parameter 2 (if applicable).
|
||||
p3:= total size in bytes of following extents
|
||||
extents:= additional data blocks
|
||||
"""
|
||||
ext = bytearray(struct.pack('IIII', cmd, p1, p2, p3))
|
||||
for x in extents:
|
||||
if type(x) == type(""):
|
||||
ext.extend(_b(x))
|
||||
else:
|
||||
ext.extend(x)
|
||||
sl.s.sendall(ext)
|
||||
dummy, res = struct.unpack('12sI', sl.s.recv(_SOCK_CMD_LEN))
|
||||
return res
|
||||
|
||||
class _event_ADT:
|
||||
"""
|
||||
An ADT class to hold event callback information.
|
||||
|
@ -2240,6 +2274,15 @@ class pi():
|
|||
|
||||
Wave ids are allocated in order, 0, 1, 2, etc.
|
||||
|
||||
The wave is flagged for deletion. The resources used by the wave
|
||||
will only be reused when either of the following apply.
|
||||
|
||||
- all waves with higher numbered wave ids have been deleted or have
|
||||
been flagged for deletion.
|
||||
|
||||
- a new wave is created which uses exactly the same resources as
|
||||
the current wave (see the C source for gpioWaveCreate for details).
|
||||
|
||||
...
|
||||
pi.wave_delete(6) # delete waveform with id 6
|
||||
|
||||
|
@ -2863,7 +2906,8 @@ class pi():
|
|||
"""
|
||||
self.sl.l.acquire()
|
||||
try:
|
||||
bytes = u2i(_pigpio_command(self.sl, _PI_CMD_I2CRK, handle, reg))
|
||||
bytes = u2i(_pigpio_command_nolock(
|
||||
self.sl, _PI_CMD_I2CRK, handle, reg))
|
||||
if bytes > 0:
|
||||
data = self._rxbuf(bytes)
|
||||
else:
|
||||
|
@ -2915,7 +2959,7 @@ class pi():
|
|||
|
||||
self.sl.l.acquire()
|
||||
try:
|
||||
bytes = u2i(_pigpio_command_ext(
|
||||
bytes = u2i(_pigpio_command_ext_nolock(
|
||||
self.sl, _PI_CMD_I2CPK, handle, reg, len(data), [data]))
|
||||
if bytes > 0:
|
||||
data = self._rxbuf(bytes)
|
||||
|
@ -2995,7 +3039,7 @@ class pi():
|
|||
|
||||
self.sl.l.acquire()
|
||||
try:
|
||||
bytes = u2i(_pigpio_command_ext(
|
||||
bytes = u2i(_pigpio_command_ext_nolock(
|
||||
self.sl, _PI_CMD_I2CRI, handle, reg, 4, extentse))
|
||||
if bytes > 0:
|
||||
data = self._rxbuf(bytes)
|
||||
|
@ -3029,7 +3073,7 @@ class pi():
|
|||
self.sl.l.acquire()
|
||||
try:
|
||||
bytes = u2i(
|
||||
_pigpio_command(self.sl, _PI_CMD_I2CRD, handle, count))
|
||||
_pigpio_command_nolock(self.sl, _PI_CMD_I2CRD, handle, count))
|
||||
if bytes > 0:
|
||||
data = self._rxbuf(bytes)
|
||||
else:
|
||||
|
@ -3132,7 +3176,7 @@ class pi():
|
|||
|
||||
self.sl.l.acquire()
|
||||
try:
|
||||
bytes = u2i(_pigpio_command_ext(
|
||||
bytes = u2i(_pigpio_command_ext_nolock(
|
||||
self.sl, _PI_CMD_I2CZ, handle, 0, len(data), [data]))
|
||||
if bytes > 0:
|
||||
data = self._rxbuf(bytes)
|
||||
|
@ -3303,7 +3347,7 @@ class pi():
|
|||
|
||||
self.sl.l.acquire()
|
||||
try:
|
||||
bytes = u2i(_pigpio_command_ext(
|
||||
bytes = u2i(_pigpio_command_ext_nolock(
|
||||
self.sl, _PI_CMD_BSPIX, CS, 0, len(data), [data]))
|
||||
if bytes > 0:
|
||||
data = self._rxbuf(bytes)
|
||||
|
@ -3442,7 +3486,7 @@ class pi():
|
|||
|
||||
self.sl.l.acquire()
|
||||
try:
|
||||
bytes = u2i(_pigpio_command_ext(
|
||||
bytes = u2i(_pigpio_command_ext_nolock(
|
||||
self.sl, _PI_CMD_BI2CZ, SDA, 0, len(data), [data]))
|
||||
if bytes > 0:
|
||||
data = self._rxbuf(bytes)
|
||||
|
@ -3574,7 +3618,7 @@ class pi():
|
|||
|
||||
self.sl.l.acquire()
|
||||
try:
|
||||
bytes = u2i(_pigpio_command_ext(
|
||||
bytes = u2i(_pigpio_command_ext_nolock(
|
||||
self.sl, _PI_CMD_BSCX, bsc_control, 0, len(data), [data]))
|
||||
if bytes > 0:
|
||||
rx = self._rxbuf(bytes)
|
||||
|
@ -3843,7 +3887,7 @@ class pi():
|
|||
"""
|
||||
self.sl.l.acquire()
|
||||
try:
|
||||
bytes = u2i(_pigpio_command(
|
||||
bytes = u2i(_pigpio_command_nolock(
|
||||
self.sl, _PI_CMD_SPIR, handle, count))
|
||||
if bytes > 0:
|
||||
data = self._rxbuf(bytes)
|
||||
|
@ -3909,7 +3953,7 @@ class pi():
|
|||
|
||||
self.sl.l.acquire()
|
||||
try:
|
||||
bytes = u2i(_pigpio_command_ext(
|
||||
bytes = u2i(_pigpio_command_ext_nolock(
|
||||
self.sl, _PI_CMD_SPIX, handle, 0, len(data), [data]))
|
||||
if bytes > 0:
|
||||
data = self._rxbuf(bytes)
|
||||
|
@ -4018,7 +4062,7 @@ class pi():
|
|||
self.sl.l.acquire()
|
||||
try:
|
||||
bytes = u2i(
|
||||
_pigpio_command(self.sl, _PI_CMD_SERR, handle, count))
|
||||
_pigpio_command_nolock(self.sl, _PI_CMD_SERR, handle, count))
|
||||
if bytes > 0:
|
||||
data = self._rxbuf(bytes)
|
||||
else:
|
||||
|
@ -4249,7 +4293,7 @@ class pi():
|
|||
self.sl.l.acquire()
|
||||
try:
|
||||
bytes = u2i(
|
||||
_pigpio_command(self.sl, _PI_CMD_PROCP, script_id, 0))
|
||||
_pigpio_command_nolock(self.sl, _PI_CMD_PROCP, script_id, 0))
|
||||
if bytes > 0:
|
||||
data = self._rxbuf(bytes)
|
||||
pars = struct.unpack('11i', _str(data))
|
||||
|
@ -4342,7 +4386,7 @@ class pi():
|
|||
self.sl.l.acquire()
|
||||
try:
|
||||
bytes = u2i(
|
||||
_pigpio_command(self.sl, _PI_CMD_SLR, user_gpio, 10000))
|
||||
_pigpio_command_nolock(self.sl, _PI_CMD_SLR, user_gpio, 10000))
|
||||
if bytes > 0:
|
||||
data = self._rxbuf(bytes)
|
||||
else:
|
||||
|
@ -4445,7 +4489,7 @@ class pi():
|
|||
|
||||
self.sl.l.acquire()
|
||||
try:
|
||||
bytes = u2i(_pigpio_command_ext(
|
||||
bytes = u2i(_pigpio_command_ext_nolock(
|
||||
self.sl, _PI_CMD_CF2, arg1, retMax, len(argx), [argx]))
|
||||
if bytes > 0:
|
||||
data = self._rxbuf(bytes)
|
||||
|
@ -4648,7 +4692,7 @@ class pi():
|
|||
self.sl.l.acquire()
|
||||
try:
|
||||
bytes = u2i(
|
||||
_pigpio_command(self.sl, _PI_CMD_FR, handle, count))
|
||||
_pigpio_command_nolock(self.sl, _PI_CMD_FR, handle, count))
|
||||
if bytes > 0:
|
||||
data = self._rxbuf(bytes)
|
||||
else:
|
||||
|
@ -4755,7 +4799,7 @@ class pi():
|
|||
|
||||
self.sl.l.acquire()
|
||||
try:
|
||||
bytes = u2i(_pigpio_command_ext(
|
||||
bytes = u2i(_pigpio_command_ext_nolock(
|
||||
self.sl, _PI_CMD_FL, 60000, 0, len(fpattern), [fpattern]))
|
||||
if bytes > 0:
|
||||
data = self._rxbuf(bytes)
|
||||
|
|
20
pigpiod_if.3
20
pigpiod_if.3
|
@ -1771,6 +1771,24 @@ Wave ids are allocated in order, 0, 1, 2, etc.
|
|||
|
||||
.br
|
||||
|
||||
.br
|
||||
The wave is flagged for deletion. The resources used by the wave
|
||||
will only be reused when either of the following apply.
|
||||
|
||||
.br
|
||||
|
||||
.br
|
||||
- all waves with higher numbered wave ids have been deleted or have
|
||||
been flagged for deletion.
|
||||
|
||||
.br
|
||||
|
||||
.br
|
||||
- a new wave is created which uses exactly the same resources as
|
||||
the current wave (see the C source for gpioWaveCreate for details).
|
||||
|
||||
.br
|
||||
|
||||
.br
|
||||
Returns 0 if OK, otherwise PI_BAD_WAVE_ID.
|
||||
|
||||
|
@ -2115,7 +2133,7 @@ This function stores a script for later execution.
|
|||
.br
|
||||
|
||||
.br
|
||||
See \fBhttp://abyz.co.uk/rpi/pigpio/pigs.html#Scripts\fP for details.
|
||||
See \fBhttp://abyz.me.uk/rpi/pigpio/pigs.html#Scripts\fP for details.
|
||||
|
||||
.br
|
||||
|
||||
|
|
13
pigpiod_if.h
13
pigpiod_if.h
|
@ -30,7 +30,7 @@ For more information, please refer to <http://unlicense.org/>
|
|||
|
||||
#include "pigpio.h"
|
||||
|
||||
#define PIGPIOD_IF_VERSION 27
|
||||
#define PIGPIOD_IF_VERSION 28
|
||||
|
||||
/*TEXT
|
||||
|
||||
|
@ -1223,6 +1223,15 @@ wave_id: >=0, as returned by [*wave_create*].
|
|||
|
||||
Wave ids are allocated in order, 0, 1, 2, etc.
|
||||
|
||||
The wave is flagged for deletion. The resources used by the wave
|
||||
will only be reused when either of the following apply.
|
||||
|
||||
- all waves with higher numbered wave ids have been deleted or have
|
||||
been flagged for deletion.
|
||||
|
||||
- a new wave is created which uses exactly the same resources as
|
||||
the current wave (see the C source for gpioWaveCreate for details).
|
||||
|
||||
Returns 0 if OK, otherwise PI_BAD_WAVE_ID.
|
||||
D*/
|
||||
|
||||
|
@ -1454,7 +1463,7 @@ int store_script(char *script);
|
|||
/*D
|
||||
This function stores a script for later execution.
|
||||
|
||||
See [[http://abyz.co.uk/rpi/pigpio/pigs.html#Scripts]] for details.
|
||||
See [[http://abyz.me.uk/rpi/pigpio/pigs.html#Scripts]] for details.
|
||||
|
||||
. .
|
||||
script: the text of the script.
|
||||
|
|
|
@ -1964,6 +1964,24 @@ Wave ids are allocated in order, 0, 1, 2, etc.
|
|||
|
||||
.br
|
||||
|
||||
.br
|
||||
The wave is flagged for deletion. The resources used by the wave
|
||||
will only be reused when either of the following apply.
|
||||
|
||||
.br
|
||||
|
||||
.br
|
||||
- all waves with higher numbered wave ids have been deleted or have
|
||||
been flagged for deletion.
|
||||
|
||||
.br
|
||||
|
||||
.br
|
||||
- a new wave is created which uses exactly the same resources as
|
||||
the current wave (see the C source for gpioWaveCreate for details).
|
||||
|
||||
.br
|
||||
|
||||
.br
|
||||
Returns 0 if OK, otherwise PI_BAD_WAVE_ID.
|
||||
|
||||
|
@ -2514,7 +2532,7 @@ This function stores a script for later execution.
|
|||
.br
|
||||
|
||||
.br
|
||||
See \fBhttp://abyz.co.uk/rpi/pigpio/pigs.html#Scripts\fP for details.
|
||||
See \fBhttp://abyz.me.uk/rpi/pigpio/pigs.html#Scripts\fP for details.
|
||||
|
||||
.br
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ For more information, please refer to <http://unlicense.org/>
|
|||
|
||||
#include "pigpio.h"
|
||||
|
||||
#define PIGPIOD_IF2_VERSION 11
|
||||
#define PIGPIOD_IF2_VERSION 12
|
||||
|
||||
/*TEXT
|
||||
|
||||
|
@ -1352,6 +1352,15 @@ wave_id: >=0, as returned by [*wave_create*].
|
|||
|
||||
Wave ids are allocated in order, 0, 1, 2, etc.
|
||||
|
||||
The wave is flagged for deletion. The resources used by the wave
|
||||
will only be reused when either of the following apply.
|
||||
|
||||
- all waves with higher numbered wave ids have been deleted or have
|
||||
been flagged for deletion.
|
||||
|
||||
- a new wave is created which uses exactly the same resources as
|
||||
the current wave (see the C source for gpioWaveCreate for details).
|
||||
|
||||
Returns 0 if OK, otherwise PI_BAD_WAVE_ID.
|
||||
D*/
|
||||
|
||||
|
@ -1682,7 +1691,7 @@ int store_script(int pi, char *script);
|
|||
/*D
|
||||
This function stores a script for later execution.
|
||||
|
||||
See [[http://abyz.co.uk/rpi/pigpio/pigs.html#Scripts]] for details.
|
||||
See [[http://abyz.me.uk/rpi/pigpio/pigs.html#Scripts]] for details.
|
||||
|
||||
. .
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
|
|
12
pigs.1
12
pigs.1
|
@ -4655,6 +4655,18 @@ ERROR: attempt to create an empty waveform
|
|||
.br
|
||||
This command deletes the waveform with id \fBwid\fP.
|
||||
|
||||
.br
|
||||
The wave is flagged for deletion. The resources used by the wave
|
||||
will only be reused when either of the following apply.
|
||||
|
||||
.br
|
||||
- all waves with higher numbered wave ids have been deleted or have
|
||||
been flagged for deletion.
|
||||
|
||||
.br
|
||||
- a new wave is created which uses exactly the same resources as
|
||||
the current wave (see the C source for gpioWaveCreate for details).
|
||||
|
||||
.br
|
||||
Upon success nothing is returned. On error a negative status code
|
||||
will be returned.
|
||||
|
|
10
setup.py
10
setup.py
|
@ -3,15 +3,15 @@
|
|||
from distutils.core import setup
|
||||
|
||||
setup(name='pigpio',
|
||||
version='1.38',
|
||||
version='1.39',
|
||||
author='joan',
|
||||
author_email='joan@abyz.co.uk',
|
||||
author_email='joan@abyz.me.uk',
|
||||
maintainer='joan',
|
||||
maintainer_email='joan@abyz.co.uk',
|
||||
url='http://abyz.co.uk/rpi/pigpio/python.html',
|
||||
maintainer_email='joan@abyz.me.uk',
|
||||
url='http://abyz.me.uk/rpi/pigpio/python.html',
|
||||
description='Raspberry Pi GPIO module',
|
||||
long_description='Raspberry Pi Python module to access the pigpio daemon',
|
||||
download_url='http://abyz.co.uk/rpi/pigpio/pigpio.zip',
|
||||
download_url='http://abyz.me.uk/rpi/pigpio/pigpio.zip',
|
||||
license='unlicense.org',
|
||||
py_modules=['pigpio'],
|
||||
keywords=['raspberrypi', 'gpio',],
|
||||
|
|
|
@ -3,7 +3,7 @@ Description=Pigpio daemon
|
|||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/pigpiod -g
|
||||
ExecStart=/usr/bin/pigpiod
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
@ -78,6 +78,7 @@ void t1()
|
|||
CHECK(1, 5, v, 0, 0, "read");
|
||||
|
||||
gpioWrite(GPIO, PI_HIGH);
|
||||
gpioDelay(1); /* 1 micro delay to let GPIO reach level reliably */
|
||||
v = gpioRead(GPIO);
|
||||
CHECK(1, 6, v, 1, 0, "write, read");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue