diff --git a/README b/README index e7dc4fa..9aeb5c4 100644 --- a/README +++ b/README @@ -49,7 +49,8 @@ x_pigpio.c, pig2vcd.c, and pigpiod.c show examples of interfacing with the pigpio library. pigs.c, pigpio.py, x_pigpiod_if.c, x_pigpio.py, x_pigs, and x_pipe -show examples of interfacing with the pigpio daemon. +show examples of interfacing with the pigpio daemon. x_pipe uses +the pipe interface, the others use the socket interface. DAEMON @@ -57,7 +58,7 @@ To launch the daemon do sudo pigpiod (pigpiod -? for options) -Once the daemon is launched the socket and fifo interfaces will be +Once the daemon is launched the socket and pipe interfaces will be available. When the library starts it locks @@ -70,15 +71,15 @@ SOCKET INTERFACE Use pigs for the socket interface (pigs help for help). -FIFO INTERFACE +PIPE INTERFACE -The fifo interface accepts commands written to /dev/pigpio. +The pipe interface accepts commands written to /dev/pigpio. Results are read from /dev/pigout. Errors are output on /dev/pigerr. -To test the fifo interface perhaps do +To test the pipe interface perhaps do cat /dev/pigout & cat /dev/pigerr & diff --git a/pigpio.3 b/pigpio.3 index 824c3e2..79dd075 100644 --- a/pigpio.3 +++ b/pigpio.3 @@ -2380,9 +2380,9 @@ device has 3 chip selects and a selectable word size in bits. .br .EX - spiChan: 0-1 + spiChan: 0-1 (0-2 for B+ auxiliary device) .br - spiBaud: >1 + spiBaud: 32K-125M (values above 30M are unlikely to work) .br spiFlags: see below .br @@ -4254,6 +4254,25 @@ lVal: the value to write .br Not intended for general use. +.IP "\fBrawWaveInfo_t rawWaveInfo(int wave_id)\fP" +.IP "" 4 +Gets details about the wave with id wave_id. + +.br + +.br + +.EX +wave_id: the wave of interest +.br + +.EE + +.br + +.br +Not intended for general use. + .IP "\fBint getBitInBytes(int bitPos, char *buf, int numBits)\fP" .IP "" 4 Returns the value of the bit bitPos bits from the start of buf. Returns @@ -5376,6 +5395,30 @@ typedef struct .br +.IP "\fBrawWaveInfo_t\fP" 0 + +.EX +typedef struct +.br +{ +.br + uint16_t botCB; // first CB used by wave +.br + uint16_t topCB; // last CB used by wave +.br + uint16_t botOOL; // last OOL used by wave +.br + uint16_t topOOL; // first OOL used by wave +.br +} rawWaveInfo_t; +.br + +.EE + +.br + +.br + .IP "\fB*rxBuf\fP" 0 .br @@ -5567,7 +5610,7 @@ The number of bits to transfer in a raw SPI transaction. .br .br -A SPI channel, 0 or 1. +A SPI channel, 0-2. .br diff --git a/pigpio.c b/pigpio.c index ec1f3d6..c3bb00e 100644 --- a/pigpio.c +++ b/pigpio.c @@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to */ -/* pigpio version 21 */ +/* pigpio version 22 */ #include #include @@ -925,14 +925,6 @@ typedef struct int mode; } wfRx_t; -typedef struct -{ - uint16_t botCB; /* first CB used by wave */ - uint16_t topCB; /* last CB used by wave */ - uint16_t botOOL; - uint16_t topOOL; -} waveInfo_t; - union my_smbus_data { uint8_t byte; @@ -991,7 +983,7 @@ static wfStats_t wfStats= 0, 0, (DMAO_PAGES * CBS_PER_OPAGE) }; -static waveInfo_t waveInfo[PI_MAX_WAVES]; +static rawWaveInfo_t waveInfo[PI_MAX_WAVES]; static volatile wfRx_t wfRx[PI_MAX_USER_GPIO+1]; @@ -3179,7 +3171,6 @@ static void spiGoS( unsigned cnt, cnt4w, cnt3w; uint32_t spiDefaults; unsigned mode, channel, cspol, cspols, flag3w, ren3w; - uint32_t status; channel = PI_SPI_FLAGS_GET_CHANNEL(flags); mode = PI_SPI_FLAGS_GET_MODE (flags); @@ -3221,16 +3212,14 @@ static void spiGoS( while((txCnt < cnt) || (rxCnt < cnt)) { - status = spiReg[SPI_CS]; - - while((rxCnt < cnt) && ((status & SPI_CS_RXD))) + while((rxCnt < cnt) && ((spiReg[SPI_CS] & SPI_CS_RXD))) { if (rxBuf) rxBuf[rxCnt] = spiReg[SPI_FIFO]; else spi_dummy = spiReg[SPI_FIFO]; rxCnt++; } - while((txCnt < cnt) && ((status & SPI_CS_TXD))) + while((txCnt < cnt) && ((spiReg[SPI_CS] & SPI_CS_TXD))) { if (txBuf) spiReg[SPI_FIFO] = txBuf[txCnt]; else spiReg[SPI_FIFO] = 0; @@ -3248,16 +3237,14 @@ static void spiGoS( while((txCnt < cnt) || (rxCnt < cnt)) { - status = spiReg[SPI_CS]; - - while((rxCnt < cnt) && ((status & SPI_CS_RXD))) + while((rxCnt < cnt) && ((spiReg[SPI_CS] & SPI_CS_RXD))) { if (rxBuf) rxBuf[rxCnt] = spiReg[SPI_FIFO]; else spi_dummy = spiReg[SPI_FIFO]; rxCnt++; } - while((txCnt < cnt) && ((status & SPI_CS_TXD))) + while((txCnt < cnt) && ((spiReg[SPI_CS] & SPI_CS_TXD))) { if (txBuf) spiReg[SPI_FIFO] = txBuf[txCnt]; else spiReg[SPI_FIFO] = 0; @@ -5924,7 +5911,7 @@ uint32_t rawWaveGetOut(int pos) /* ----------------------------------------------------------------------- */ -void waveSetRawOut(int pos, uint32_t value) +void rawWaveSetOut(int pos, uint32_t value) { int page, slot; @@ -5966,6 +5953,16 @@ void rawWaveSetIn(int pos, uint32_t value) /* ----------------------------------------------------------------------- */ +rawWaveInfo_t rawWaveInfo(int wave_id) +{ + rawWaveInfo_t dummy = {-1, -1, -1, -1}; + + if ((wave_id >=0) && (wave_id < PI_MAX_WAVES)) return waveInfo[wave_id]; + else return dummy; +} + +/* ----------------------------------------------------------------------- */ + double time_time(void) { struct timeval tv; diff --git a/pigpio.h b/pigpio.h index 6d13461..fe3a5cb 100644 --- a/pigpio.h +++ b/pigpio.h @@ -31,7 +31,7 @@ For more information, please refer to #include #include -#define PIGPIO_VERSION 21 +#define PIGPIO_VERSION 22 /*TEXT @@ -291,6 +291,7 @@ rawWaveGetOut Not intended for general use rawWaveSetOut Not intended for general use rawWaveGetIn Not intended for general use rawWaveSetIn Not intended for general use +rawWaveInfo Not intended for general use rawDumpWave Not intended for general use rawDumpScript Not intended for general use @@ -354,6 +355,14 @@ uint32_t usDelay; uint32_t flags; } rawWave_t; +typedef struct +{ + uint16_t botCB; /* first CB used by wave */ + uint16_t topCB; /* last CB used by wave */ + uint16_t botOOL; /* last OOL used by wave */ + uint16_t topOOL; /* first OOL used by wave */ +} rawWaveInfo_t; + typedef struct { int clk; /* gpio for clock */ @@ -1901,8 +1910,8 @@ 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 - spiBaud: >1 + spiChan: 0-1 (0-2 for B+ auxiliary device) + spiBaud: 32K-125M (values above 30M are unlikely to work) spiFlags: see below . . @@ -3017,6 +3026,18 @@ lVal: the value to write Not intended for general use. D*/ +/*F*/ +rawWaveInfo_t rawWaveInfo(int wave_id); +/*D +Gets details about the wave with id wave_id. + +. . +wave_id: the wave of interest +. . + +Not intended for general use. +D*/ + /*F*/ int getBitInBytes(int bitPos, char *buf, int numBits); /*D @@ -3510,6 +3531,17 @@ typedef struct } rawWave_t; . . +rawWaveInfo_t:: +. . +typedef struct +{ + uint16_t botCB; // first CB used by wave + uint16_t topCB; // last CB used by wave + uint16_t botOOL; // last OOL used by wave + uint16_t topOOL; // first OOL used by wave +} rawWaveInfo_t; +. . + *rxBuf:: A pointer to a buffer to receive data. @@ -3582,7 +3614,7 @@ The number of bits to transfer in a raw SPI transaction. spiChan:: -A SPI channel, 0 or 1. +A SPI channel, 0-2. spiFlags:: diff --git a/pigpio.py b/pigpio.py index 4fb947e..0a8e60e 100644 --- a/pigpio.py +++ b/pigpio.py @@ -246,7 +246,7 @@ import os import atexit import codecs -VERSION = "1.11" +VERSION = "1.12" exceptions = True @@ -2193,8 +2193,8 @@ class pi(): device has 3 chip selects and a selectable word size in bits. - spi_channel:= 0 or 1, the SPI channel. - spi_baud:= >0, the transmission rate in bits per second. + spi_channel:= 0-1 (0-2 for B+ auxiliary device). + spi_baud:= 32K-125M (values above 30M are unlikely to work). spi_flags:= see below. Normally you would only use the [*spi_**] functions if @@ -3086,10 +3086,10 @@ def xref(): spi_*: One of the spi_ functions. - spi_baud: 1- + spi_baud: 32K-125M The transmission rate in bits per second. - spi_channel: 0-1 + spi_channel: 0-2 A SPI channel. spi_flags: 32 bit diff --git a/pigpiod_if.3 b/pigpiod_if.3 index ea4346c..f82eba5 100644 --- a/pigpiod_if.3 +++ b/pigpiod_if.3 @@ -2238,9 +2238,9 @@ device has 3 chip selects and a selectable word size in bits. .br .EX -spi_channel: 0-1. +spi_channel: 0-1 (0-2 for B+ auxiliary device). .br - spi_baud: >1. + spi_baud: 32K-125M (values above 30M are unlikely to work). .br spi_flags: see below. .br @@ -3310,7 +3310,7 @@ The speed in bits per second to use for the SPI device. .br .IP "\fBspi_channel\fP" 0 -A SPI channel, 0 or 1. +A SPI channel, 0-2. .br diff --git a/pigpiod_if.c b/pigpiod_if.c index 1524481..553eb40 100644 --- a/pigpiod_if.c +++ b/pigpiod_if.c @@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to */ -/* PIGPIOD_IF_VERSION 9 */ +/* PIGPIOD_IF_VERSION 10 */ #include #include diff --git a/pigpiod_if.h b/pigpiod_if.h index 89affb4..fbbae54 100644 --- a/pigpiod_if.h +++ b/pigpiod_if.h @@ -30,7 +30,7 @@ For more information, please refer to #include "pigpio.h" -#define PIGPIOD_IF_VERSION 9 +#define PIGPIOD_IF_VERSION 10 /*TEXT @@ -1569,8 +1569,8 @@ 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. - spi_baud: >1. +spi_channel: 0-1 (0-2 for B+ auxiliary device). + spi_baud: 32K-125M (values above 30M are unlikely to work). spi_flags: see below. . . @@ -2117,7 +2117,7 @@ spi_baud:: The speed in bits per second to use for the SPI device. spi_channel:: -A SPI channel, 0 or 1. +A SPI channel, 0-2. spi_flags:: See [*spi_open*]. diff --git a/setup.py b/setup.py index f483a93..503b49e 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from distutils.core import setup setup(name='pigpio', - version='1.11', + version='1.12', author='joan', author_email='joan@abyz.co.uk', maintainer='joan', diff --git a/x_pigs b/x_pigs index 4991cc1..2ecf346 100755 --- a/x_pigs +++ b/x_pigs @@ -1,5 +1,7 @@ #!/bin/bash +VERSION=22 + GPIO=4 # @@ -86,7 +88,7 @@ s=$(pigs pfs $GPIO 800) if [[ $s = 800 ]]; then echo "PFS-b ok"; else echo "PFS-b fail ($s)"; fi s=$(pigs pigpv) -if [[ $s = 21 ]]; then echo "PIGPV ok"; else echo "PIGPV fail ($s)"; fi +if [[ $s = $VERSION ]]; then echo "PIGPV ok"; else echo "PIGPV fail ($s)"; fi s=$(pigs prs $GPIO 255) if [[ $s = 250 ]]; then echo "PRG-a ok"; else echo "PRG-a fail ($s)"; fi diff --git a/x_pipe b/x_pipe index 2ae3599..7967345 100755 --- a/x_pipe +++ b/x_pipe @@ -1,5 +1,7 @@ #!/bin/bash +VERSION=22 + GPIO=4 # @@ -119,7 +121,7 @@ if [[ $s = 800 ]]; then echo "PFS-b ok"; else echo "PFS-b fail ($s)"; fi echo "pigpv" >/dev/pigpio read -t 1 s /dev/pigpio read -t 1 s