V22
authorjoan <joan@abyz.me.uk>
Tue, 9 Sep 2014 21:58:39 +0000 (22:58 +0100)
committerjoan <joan@abyz.me.uk>
Tue, 9 Sep 2014 21:58:39 +0000 (22:58 +0100)
README
pigpio.3
pigpio.c
pigpio.h
pigpio.py
pigpiod_if.3
pigpiod_if.c
pigpiod_if.h
setup.py
x_pigs
x_pipe

diff --git a/README b/README
index e7dc4fa24d3df410404ddefaffb4a0981ffe1556..9aeb5c4f2b82ab5651c91966f65ae19207f4f960 100644 (file)
--- 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 &
index 824c3e2fcf384e11b738082cde3f897c7f376b3e..79dd07591a0df73044b258a21fa705c484518203 100644 (file)
--- 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
 
index ec1f3d61063fd589839458f903b3ffed7797b509..c3bb00ed3a918a2be21cfc84f0753ededcf9feb2 100644 (file)
--- 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 21 */
+/* pigpio version 22 */
 
 #include <stdio.h>
 #include <string.h>
@@ -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;
index 6d134618b0f561d330b2e39a6782879d6bfc94d0..fe3a5cb29ff1eb4b1687bcee2c30552518b8ec6f 100644 (file)
--- a/pigpio.h
+++ b/pigpio.h
@@ -31,7 +31,7 @@ For more information, please refer to <http://unlicense.org/>
 #include <stdint.h>
 #include <pthread.h>
 
-#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::
 
index 4fb947eef62909c67f189d080a7a6f95df513c8f..0a8e60e8960f20a636b1231cad5cc9d1916cba4b 100644 (file)
--- 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
index ea4346c13f6f5ce719f76319e3c693d6fed33e0a..f82eba51bbbacb62a5cce5afab0b4b5e8cd10e5d 100644 (file)
@@ -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
 
index 1524481f57427b8b24a00d82b0400efb1b99f1b2..553eb40e52879257590c8d5e2ce0329588f83315 100644 (file)
@@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 For more information, please refer to <http://unlicense.org/>
 */
 
-/* PIGPIOD_IF_VERSION 9 */
+/* PIGPIOD_IF_VERSION 10 */
 
 #include <stdio.h>
 #include <stdlib.h>
index 89affb44db012d153442967dd5e8dbd682059589..fbbae54f7cb36ca5ba754f3c6d5566992a54e09a 100644 (file)
@@ -30,7 +30,7 @@ For more information, please refer to <http://unlicense.org/>
 
 #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*].
index f483a931369682b9ac98c5640cfe1e062be69d1e..503b49ed252a4fc336293a23964d6cb9e7a31da0 100644 (file)
--- 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 4991cc12190b7acef6dffdf67ff946959907dcb0..2ecf3467a4d7145aa166b9a98441cef2accbf3d5 100755 (executable)
--- 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 2ae35990e82becd7de48e1274dc96b21ef3f8fc7..7967345e56ef502401c0657aeb8e3650c1b2ae0d 100755 (executable)
--- 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/pigout
-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
 
 echo "prs $GPIO 255" >/dev/pigpio
 read -t 1 s </dev/pigout