summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoan2937 <joan@abyz.me.uk>2020-05-07 11:53:04 +0100
committerjoan2937 <joan@abyz.me.uk>2020-05-07 11:53:04 +0100
commitc85285ee38d610fcb63a4d917c015208db713825 (patch)
treef398b177d8da6730acd820cff5d2354b1575f844
parent18e532b8407c564942185e618b3becb6b75af234 (diff)
fixed untracked files
-rw-r--r--DOC/HTML/cif.html1887
-rw-r--r--DOC/HTML/download.html121
-rw-r--r--DOC/HTML/ex_LDR.html205
-rw-r--r--DOC/HTML/ex_ir_remote.html308
-rw-r--r--DOC/HTML/ex_motor_shield.html309
-rw-r--r--DOC/HTML/ex_rotary_encoder.html240
-rw-r--r--DOC/HTML/ex_sonar_ranger.html219
-rw-r--r--DOC/HTML/examples.html558
-rw-r--r--DOC/HTML/faq.html516
-rw-r--r--DOC/HTML/index.html716
-rw-r--r--DOC/HTML/misc.html88
-rw-r--r--DOC/HTML/pdif.html1168
-rw-r--r--DOC/HTML/pdif2.html1523
-rw-r--r--DOC/HTML/pif.html85
-rw-r--r--DOC/HTML/pig2vcd.html83
-rw-r--r--DOC/HTML/pigpiod.html114
-rw-r--r--DOC/HTML/pigs.html1268
-rw-r--r--DOC/HTML/piscope.html269
-rw-r--r--DOC/HTML/python.html1294
-rw-r--r--DOC/HTML/sif.html2058
-rw-r--r--DOC/HTML/sitemap.html85
-rw-r--r--DOC/MAN/pig2vcd.1246
-rw-r--r--DOC/MAN/pigpio.311137
-rw-r--r--DOC/MAN/pigpiod.1273
-rw-r--r--DOC/MAN/pigpiod_if.35339
-rw-r--r--DOC/MAN/pigpiod_if2.38057
-rw-r--r--DOC/MAN/pigs.16331
-rw-r--r--DOC/dbase/pigpio.sqlitebin1433600 -> 1433600 bytes
-rw-r--r--DOC/dbase/pigpio.sqlite.2020-04-29-16-40-23bin1433600 -> 0 bytes
-rw-r--r--DOC/dbase/pigpio.sqlite.2020-04-29-20-52-04bin1433600 -> 0 bytes
-rw-r--r--DOC/dbase/pigpio.sqlite.2020-04-29-21-11-13bin1433600 -> 0 bytes
-rw-r--r--DOC/dbase/pigpio.sqlite.2020-04-29-22-41-24bin1433600 -> 0 bytes
-rw-r--r--DOC/dbase/pigpio.sqlite.2020-04-29-23-09-20bin1433600 -> 0 bytes
-rw-r--r--DOC/dbase/pigpio.sqlite.2020-04-29-23-19-32bin1433600 -> 0 bytes
-rw-r--r--DOC/dbase/pigpio.sqlite.2020-04-29-23-23-35bin1433600 -> 0 bytes
-rw-r--r--DOC/dbase/pigpio.sqlite.2020-04-29-23-24-27bin1433600 -> 0 bytes
-rw-r--r--DOC/dbase/pigpio.sqlite.2020-04-29-23-26-47bin1433600 -> 0 bytes
-rw-r--r--DOC/dbase/pigpio.sqlite.2020-04-29-23-29-09bin1433600 -> 0 bytes
-rw-r--r--DOC/dbase/pigpio.sqlite.2020-04-29-23-32-20bin1433600 -> 0 bytes
-rw-r--r--DOC/dbase/pigpio.sqlite.2020-04-30-08-51-48bin1433600 -> 0 bytes
-rw-r--r--DOC/dbase/pigpio.sqlite.2020-04-30-08-59-05bin1433600 -> 0 bytes
-rw-r--r--DOC/dbase/pigpio.sqlite.2020-04-30-09-37-19bin1433600 -> 0 bytes
-rw-r--r--DOC/dbase/pigpio.sqlite.2020-04-30-09-44-25bin1433600 -> 0 bytes
-rw-r--r--DOC/dbase/pigpio.sqlite.2020-04-30-09-45-49bin1433600 -> 0 bytes
-rw-r--r--DOC/dbase/pigpio.sqlite.2020-04-30-09-48-51bin1433600 -> 0 bytes
-rw-r--r--DOC/src/defs/examples.def7
-rw-r--r--DOC/tmp/body/cif.body1824
-rw-r--r--DOC/tmp/body/download.body57
-rw-r--r--DOC/tmp/body/ex_LDR.body141
-rw-r--r--DOC/tmp/body/ex_ir_remote.body244
-rw-r--r--DOC/tmp/body/ex_motor_shield.body245
-rw-r--r--DOC/tmp/body/ex_rotary_encoder.body176
-rw-r--r--DOC/tmp/body/ex_sonar_ranger.body155
-rw-r--r--DOC/tmp/body/examples.body495
-rw-r--r--DOC/tmp/body/faq.body452
-rw-r--r--DOC/tmp/body/index.body652
-rw-r--r--DOC/tmp/body/misc.body24
-rw-r--r--DOC/tmp/body/pdif.body1105
-rw-r--r--DOC/tmp/body/pdif2.body1460
-rw-r--r--DOC/tmp/body/pif.body21
-rw-r--r--DOC/tmp/body/pig2vcd.body20
-rw-r--r--DOC/tmp/body/pigpiod.body51
-rw-r--r--DOC/tmp/body/pigs.body1205
-rw-r--r--DOC/tmp/body/piscope.body205
-rw-r--r--DOC/tmp/body/python.body1231
-rw-r--r--DOC/tmp/body/sif.body1994
-rw-r--r--DOC/tmp/pydoc/pigpio.pydoc4162
-rwxr-xr-xutil/pigpiod31
68 files changed, 7 insertions, 60447 deletions
diff --git a/DOC/HTML/cif.html b/DOC/HTML/cif.html
deleted file mode 100644
index 58d6eea..0000000
--- a/DOC/HTML/cif.html
+++ /dev/null
@@ -1,1887 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta name="description" content="Raspberry Pi Reg. C GPIO library and Python GPIO module and shell command utilities to control the GPIO, including SPI, I2C, and serial links." />
- <meta name="keywords" content="raspberry, pi, C, Python, GPIO, library, shell, command, utilities, module, SPI, I2C, serial" />
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>pigpio library</title>
- <link rel="stylesheet" type="text/css" href="scripts/index.css">
- <link rel="icon" href="favicon.ico" type="image/x-icon">
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
-</head>
-<body>
-
-<table style="padding:0px; border:0px; margin:0px; width:780px; background-color:#e0e0e0;">
-<td style="background:#EAF2E6 url('images/sidebar.gif') repeat-y; width:35px; height:100%"></td>
-<td>
-<table>
-<div style="background:url('images/topbar.gif') repeat-x; height: 70px; font-size:1.5em; vertical-align: top;"><a href="index.html"><img src="images/pigpio-logo.gif" border="0" /></a>pigpio library</div>
-</table>
-<table><div>
-<td><img src="images/imu-1.jpg" width="250"></td>
-<td><img src="images/lcd.jpg" width="250"></td>
-<td><img src="images/psu.jpg" width="250"></td>
-</div></table>
-<table>
-<td style="vertical-align: top; background-color: #98bf21;"><a class="l1" href="index.html">pigpio</a>
-<a class="l1" href="cif.html">pigpio C I/F</a>
-<a class="l1" href="pigpiod.html">pigpiod</a>
-<a class="l1" href="pdif2.html">pigpiod C I/F</a>
-<a class="l1" href="python.html">Python</a>
-<a class="l1" href="pigs.html">pigs</a>
-<a class="l1" href="piscope.html">piscope</a>
-<a class="l1" href="misc.html">Misc</a>
-<a class="l1" href="examples.html">Examples</a>
-<a class="l1" href="download.html">Download</a>
-<a class="l1" href="faq.html">FAQ</a>
-<a class="l1" href="sitemap.html">Site Map</a>
-</td>
-<td><center><h2>pigpio C Interface</h2></center><br><br>pigpio is a C library for the Raspberry which allows control of the GPIO.
-<h3>Features</h3>o hardware timed PWM on any of GPIO 0-31
-<br><br>o hardware timed servo pulses on any of GPIO 0-31
-<br><br>o callbacks when any of GPIO 0-31 change state
-<br><br>o callbacks at timed intervals
-<br><br>o reading/writing all of the GPIO in a bank as one operation
-<br><br>o individually setting GPIO modes, reading and writing
-<br><br>o notifications when any of GPIO 0-31 change state
-<br><br>o the construction of output waveforms with microsecond timing
-<br><br>o rudimentary permission control over GPIO
-<br><br>o a simple interface to start and stop new threads
-<br><br>o I2C, SPI, and serial link wrappers
-<br><br>o creating and running scripts
-<h3>GPIO</h3>ALL GPIO are identified by their Broadcom number.
-<h3>Credits</h3>The PWM and servo pulses are timed using the DMA and PWM peripherals.
-<br><br>This use was inspired by Richard Hirst's servoblaster kernel module.
-<h3>Usage</h3>Include &lt;pigpio.h&gt; in your source files.
-<br><br>Assuming your source is in prog.c use the following command to build and
-run the executable.
-<br><br><code>gcc&nbsp;-Wall&nbsp;-pthread&nbsp;-o&nbsp;prog&nbsp;prog.c&nbsp;-lpigpio&nbsp;-lrt<br>sudo&nbsp;./prog<br></code><br><br>For examples of usage see the C programs within the pigpio archive file.
-<h3>Notes</h3>All the functions which return an int return &lt; 0 on error.
-<br><br><a href="#gpioInitialise">gpioInitialise</a> must be called before all other library functions
-with the following exceptions:
-<br><br><code><a href="#gpioCfg*">gpioCfg*</a><br><a href="#gpioVersion">gpioVersion</a><br><a href="#gpioHardwareRevision">gpioHardwareRevision</a><br></code><br><br>If the library is not initialised all but the <a href="#gpioCfg*">gpioCfg*</a>,
-<a href="#gpioVersion">gpioVersion</a>, and <a href="#gpioHardwareRevision">gpioHardwareRevision</a> functions will
-return error PI_NOT_INITIALISED.
-<br><br>If the library is initialised the <a href="#gpioCfg*">gpioCfg*</a> functions will return
-error PI_INITIALISED.
-<h2>OVERVIEW</h2><table border="0" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td></td></tr><tr><td><b>ESSENTIAL
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioInitialise">gpioInitialise</a></td><td> Initialise library
-</td></tr><tr><td><a href="#gpioTerminate">gpioTerminate</a></td><td> Stop library
-</td></tr><tr><td></td><td></td></tr><tr><td><b>BASIC
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSetMode">gpioSetMode</a></td><td> Set a GPIO mode
-</td></tr><tr><td><a href="#gpioGetMode">gpioGetMode</a></td><td> Get a GPIO mode
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSetPullUpDown">gpioSetPullUpDown</a></td><td> Set/clear GPIO pull up/down resistor
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioRead">gpioRead</a></td><td> Read a GPIO
-</td></tr><tr><td><a href="#gpioWrite">gpioWrite</a></td><td> Write a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>PWM (overrides servo commands on same GPIO)
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioPWM">gpioPWM</a></td><td> Start/stop PWM pulses on a GPIO
-</td></tr><tr><td><a href="#gpioSetPWMfrequency">gpioSetPWMfrequency</a></td><td> Configure PWM frequency for a GPIO
-</td></tr><tr><td><a href="#gpioSetPWMrange">gpioSetPWMrange</a></td><td> Configure PWM range for a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioGetPWMdutycycle">gpioGetPWMdutycycle</a></td><td> Get dutycycle setting on a GPIO
-</td></tr><tr><td><a href="#gpioGetPWMfrequency">gpioGetPWMfrequency</a></td><td> Get configured PWM frequency for a GPIO
-</td></tr><tr><td><a href="#gpioGetPWMrange">gpioGetPWMrange</a></td><td> Get configured PWM range for a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioGetPWMrealRange">gpioGetPWMrealRange</a></td><td> Get underlying PWM range for a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Servo (overrides PWM commands on same GPIO)
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioServo">gpioServo</a></td><td> Start/stop servo pulses on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioGetServoPulsewidth">gpioGetServoPulsewidth</a></td><td> Get pulsewidth setting on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>INTERMEDIATE
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioTrigger">gpioTrigger</a></td><td> Send a trigger pulse to a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSetWatchdog">gpioSetWatchdog</a></td><td> Set a watchdog on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioRead_Bits_0_31">gpioRead_Bits_0_31</a></td><td> Read all GPIO in bank 1
-</td></tr><tr><td><a href="#gpioRead_Bits_32_53">gpioRead_Bits_32_53</a></td><td> Read all GPIO in bank 2
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWrite_Bits_0_31_Clear">gpioWrite_Bits_0_31_Clear</a></td><td> Clear selected GPIO in bank 1
-</td></tr><tr><td><a href="#gpioWrite_Bits_32_53_Clear">gpioWrite_Bits_32_53_Clear</a></td><td>Clear selected GPIO in bank 2
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWrite_Bits_0_31_Set">gpioWrite_Bits_0_31_Set</a></td><td> Set selected GPIO in bank 1
-</td></tr><tr><td><a href="#gpioWrite_Bits_32_53_Set">gpioWrite_Bits_32_53_Set</a></td><td> Set selected GPIO in bank 2
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSetAlertFunc">gpioSetAlertFunc</a></td><td> Request a GPIO level change callback
-</td></tr><tr><td><a href="#gpioSetAlertFuncEx">gpioSetAlertFuncEx</a></td><td> Request a GPIO change callback, extended
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSetTimerFunc">gpioSetTimerFunc</a></td><td> Request a regular timed callback
-</td></tr><tr><td><a href="#gpioSetTimerFuncEx">gpioSetTimerFuncEx</a></td><td> Request a regular timed callback, extended
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioStartThread">gpioStartThread</a></td><td> Start a new thread
-</td></tr><tr><td><a href="#gpioStopThread">gpioStopThread</a></td><td> Stop a previously started thread
-</td></tr><tr><td></td><td></td></tr><tr><td><b>ADVANCED
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioNotifyOpen">gpioNotifyOpen</a></td><td> Request a notification handle
-</td></tr><tr><td><a href="#gpioNotifyClose">gpioNotifyClose</a></td><td> Close a notification
-</td></tr><tr><td><a href="#gpioNotifyOpenWithSize">gpioNotifyOpenWithSize</a></td><td> Request a notification with sized pipe
-</td></tr><tr><td><a href="#gpioNotifyBegin">gpioNotifyBegin</a></td><td> Start notifications for selected GPIO
-</td></tr><tr><td><a href="#gpioNotifyPause">gpioNotifyPause</a></td><td> Pause notifications
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioHardwareClock">gpioHardwareClock</a></td><td> Start hardware clock on supported GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioHardwarePWM">gpioHardwarePWM</a></td><td> Start hardware PWM on supported GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioGlitchFilter">gpioGlitchFilter</a></td><td> Set a glitch filter on a GPIO
-</td></tr><tr><td><a href="#gpioNoiseFilter">gpioNoiseFilter</a></td><td> Set a noise filter on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSetPad">gpioSetPad</a></td><td> Sets a pads drive strength
-</td></tr><tr><td><a href="#gpioGetPad">gpioGetPad</a></td><td> Gets a pads drive strength
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#shell">shell</a></td><td> Executes a shell command
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSetISRFunc">gpioSetISRFunc</a></td><td> Request a GPIO interrupt callback
-</td></tr><tr><td><a href="#gpioSetISRFuncEx">gpioSetISRFuncEx</a></td><td> Request a GPIO interrupt callback, extended
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSetSignalFunc">gpioSetSignalFunc</a></td><td> Request a signal callback
-</td></tr><tr><td><a href="#gpioSetSignalFuncEx">gpioSetSignalFuncEx</a></td><td> Request a signal callback, extended
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSetGetSamplesFunc">gpioSetGetSamplesFunc</a></td><td> Requests a GPIO samples callback
-</td></tr><tr><td><a href="#gpioSetGetSamplesFuncEx">gpioSetGetSamplesFuncEx</a></td><td> Requests a GPIO samples callback, extended
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Custom
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioCustom1">gpioCustom1</a></td><td> User custom function 1
-</td></tr><tr><td><a href="#gpioCustom2">gpioCustom2</a></td><td> User custom function 2
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Events
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#eventMonitor">eventMonitor</a></td><td> Sets the events to monitor
-</td></tr><tr><td><a href="#eventSetFunc">eventSetFunc</a></td><td> Request an event callback
-</td></tr><tr><td><a href="#eventSetFuncEx">eventSetFuncEx</a></td><td> Request an event callback, extended
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#eventTrigger">eventTrigger</a></td><td> Trigger an event
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Scripts
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioStoreScript">gpioStoreScript</a></td><td> Store a script
-</td></tr><tr><td><a href="#gpioRunScript">gpioRunScript</a></td><td> Run a stored script
-</td></tr><tr><td><a href="#gpioUpdateScript">gpioUpdateScript</a></td><td> Set a scripts parameters
-</td></tr><tr><td><a href="#gpioScriptStatus">gpioScriptStatus</a></td><td> Get script status and parameters
-</td></tr><tr><td><a href="#gpioStopScript">gpioStopScript</a></td><td> Stop a running script
-</td></tr><tr><td><a href="#gpioDeleteScript">gpioDeleteScript</a></td><td> Delete a stored script
-</td></tr><tr><td></td><td></td></tr><tr><td><b>I2C
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cOpen">i2cOpen</a></td><td> Opens an I2C device
-</td></tr><tr><td><a href="#i2cClose">i2cClose</a></td><td> Closes an I2C device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cWriteQuick">i2cWriteQuick</a></td><td> SMBus write quick
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cReadByte">i2cReadByte</a></td><td> SMBus read byte
-</td></tr><tr><td><a href="#i2cWriteByte">i2cWriteByte</a></td><td> SMBus write byte
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cReadByteData">i2cReadByteData</a></td><td> SMBus read byte data
-</td></tr><tr><td><a href="#i2cWriteByteData">i2cWriteByteData</a></td><td> SMBus write byte data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cReadWordData">i2cReadWordData</a></td><td> SMBus read word data
-</td></tr><tr><td><a href="#i2cWriteWordData">i2cWriteWordData</a></td><td> SMBus write word data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cReadBlockData">i2cReadBlockData</a></td><td> SMBus read block data
-</td></tr><tr><td><a href="#i2cWriteBlockData">i2cWriteBlockData</a></td><td> SMBus write block data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cReadI2CBlockData">i2cReadI2CBlockData</a></td><td> SMBus read I2C block data
-</td></tr><tr><td><a href="#i2cWriteI2CBlockData">i2cWriteI2CBlockData</a></td><td> SMBus write I2C block data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cReadDevice">i2cReadDevice</a></td><td> Reads the raw I2C device
-</td></tr><tr><td><a href="#i2cWriteDevice">i2cWriteDevice</a></td><td> Writes the raw I2C device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cProcessCall">i2cProcessCall</a></td><td> SMBus process call
-</td></tr><tr><td><a href="#i2cBlockProcessCall">i2cBlockProcessCall</a></td><td> SMBus block process call
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cSwitchCombined">i2cSwitchCombined</a></td><td> Sets or clears the combined flag
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cSegments">i2cSegments</a></td><td> Performs multiple I2C transactions
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cZip">i2cZip</a></td><td> Performs multiple I2C transactions
-</td></tr><tr><td></td><td></td></tr><tr><td><b>I2C BIT BANG
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#bbI2COpen">bbI2COpen</a></td><td> Opens GPIO for bit banging I2C
-</td></tr><tr><td><a href="#bbI2CClose">bbI2CClose</a></td><td> Closes GPIO for bit banging I2C
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#bbI2CZip">bbI2CZip</a></td><td> Performs bit banged I2C transactions
-</td></tr><tr><td></td><td></td></tr><tr><td><b>I2C/SPI SLAVE
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#bscXfer">bscXfer</a></td><td> I2C/SPI as slave transfer
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SERIAL
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#serOpen">serOpen</a></td><td> Opens a serial device
-</td></tr><tr><td><a href="#serClose">serClose</a></td><td> Closes a serial device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#serReadByte">serReadByte</a></td><td> Reads a byte from a serial device
-</td></tr><tr><td><a href="#serWriteByte">serWriteByte</a></td><td> Writes a byte to a serial device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#serRead">serRead</a></td><td> Reads bytes from a serial device
-</td></tr><tr><td><a href="#serWrite">serWrite</a></td><td> Writes bytes to a serial device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#serDataAvailable">serDataAvailable</a></td><td> Returns number of bytes ready to be read
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SERIAL BIT BANG (read only)
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSerialReadOpen">gpioSerialReadOpen</a></td><td> Opens a GPIO for bit bang serial reads
-</td></tr><tr><td><a href="#gpioSerialReadClose">gpioSerialReadClose</a></td><td> Closes a GPIO for bit bang serial reads
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSerialReadInvert">gpioSerialReadInvert</a></td><td> Configures normal/inverted for serial reads
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSerialRead">gpioSerialRead</a></td><td> Reads bit bang serial data from a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SPI
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#spiOpen">spiOpen</a></td><td> Opens a SPI device
-</td></tr><tr><td><a href="#spiClose">spiClose</a></td><td> Closes a SPI device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#spiRead">spiRead</a></td><td> Reads bytes from a SPI device
-</td></tr><tr><td><a href="#spiWrite">spiWrite</a></td><td> Writes bytes to a SPI device
-</td></tr><tr><td><a href="#spiXfer">spiXfer</a></td><td> Transfers bytes with a SPI device
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SPI BIT BANG
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#bbSPIOpen">bbSPIOpen</a></td><td> Opens GPIO for bit banging SPI
-</td></tr><tr><td><a href="#bbSPIClose">bbSPIClose</a></td><td> Closes GPIO for bit banging SPI
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#bbSPIXfer">bbSPIXfer</a></td><td> Performs bit banged SPI transactions
-</td></tr><tr><td></td><td></td></tr><tr><td><b>FILES
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#fileOpen">fileOpen</a></td><td> Opens a file
-</td></tr><tr><td><a href="#fileClose">fileClose</a></td><td> Closes a file
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#fileRead">fileRead</a></td><td> Reads bytes from a file
-</td></tr><tr><td><a href="#fileWrite">fileWrite</a></td><td> Writes bytes to a file
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#fileSeek">fileSeek</a></td><td> Seeks to a position within a file
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#fileList">fileList</a></td><td> List files which match a pattern
-</td></tr><tr><td></td><td></td></tr><tr><td><b>WAVES
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWaveClear">gpioWaveClear</a></td><td> Deletes all waveforms
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWaveAddNew">gpioWaveAddNew</a></td><td> Starts a new waveform
-</td></tr><tr><td><a href="#gpioWaveAddGeneric">gpioWaveAddGeneric</a></td><td> Adds a series of pulses to the waveform
-</td></tr><tr><td><a href="#gpioWaveAddSerial">gpioWaveAddSerial</a></td><td> Adds serial data to the waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWaveCreate">gpioWaveCreate</a></td><td> Creates a waveform from added data
-</td></tr><tr><td><a href="#gpioWaveCreatePad">gpioWaveCreatePad</a></td><td> Creates a waveform of fixed size from added data
-</td></tr><tr><td><a href="#gpioWaveDelete">gpioWaveDelete</a></td><td> Deletes a waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWaveTxSend">gpioWaveTxSend</a></td><td> Transmits a waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWaveChain">gpioWaveChain</a></td><td> Transmits a chain of waveforms
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWaveTxAt">gpioWaveTxAt</a></td><td> Returns the current transmitting waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWaveTxBusy">gpioWaveTxBusy</a></td><td> Checks to see if the waveform has ended
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWaveTxStop">gpioWaveTxStop</a></td><td> Aborts the current waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWaveGetCbs">gpioWaveGetCbs</a></td><td> Length in CBs of the current waveform
-</td></tr><tr><td><a href="#gpioWaveGetHighCbs">gpioWaveGetHighCbs</a></td><td> Length of longest waveform so far
-</td></tr><tr><td><a href="#gpioWaveGetMaxCbs">gpioWaveGetMaxCbs</a></td><td> Absolute maximum allowed CBs
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWaveGetMicros">gpioWaveGetMicros</a></td><td> Length in micros of the current waveform
-</td></tr><tr><td><a href="#gpioWaveGetHighMicros">gpioWaveGetHighMicros</a></td><td> Length of longest waveform so far
-</td></tr><tr><td><a href="#gpioWaveGetMaxMicros">gpioWaveGetMaxMicros</a></td><td> Absolute maximum allowed micros
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWaveGetPulses">gpioWaveGetPulses</a></td><td> Length in pulses of the current waveform
-</td></tr><tr><td><a href="#gpioWaveGetHighPulses">gpioWaveGetHighPulses</a></td><td> Length of longest waveform so far
-</td></tr><tr><td><a href="#gpioWaveGetMaxPulses">gpioWaveGetMaxPulses</a></td><td> Absolute maximum allowed pulses
-</td></tr><tr><td></td><td></td></tr><tr><td><b>UTILITIES
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioDelay">gpioDelay</a></td><td> Delay for a number of microseconds
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioTick">gpioTick</a></td><td> Get current tick (microseconds)
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioHardwareRevision">gpioHardwareRevision</a></td><td> Get hardware revision
-</td></tr><tr><td><a href="#gpioVersion">gpioVersion</a></td><td> Get the pigpio version
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#getBitInBytes">getBitInBytes</a></td><td> Get the value of a bit
-</td></tr><tr><td><a href="#putBitInBytes">putBitInBytes</a></td><td> Set the value of a bit
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioTime">gpioTime</a></td><td> Get current time
-</td></tr><tr><td><a href="#gpioSleep">gpioSleep</a></td><td> Sleep for specified time
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#time_sleep">time_sleep</a></td><td> Sleeps for a float number of seconds
-</td></tr><tr><td><a href="#time_time">time_time</a></td><td> Float number of seconds since the epoch
-</td></tr><tr><td></td><td></td></tr><tr><td><b>CONFIGURATION
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioCfgBufferSize">gpioCfgBufferSize</a></td><td> Configure the GPIO sample buffer size
-</td></tr><tr><td><a href="#gpioCfgClock">gpioCfgClock</a></td><td> Configure the GPIO sample rate
-</td></tr><tr><td><a href="#gpioCfgDMAchannel">gpioCfgDMAchannel</a></td><td> Configure the DMA channel (DEPRECATED)
-</td></tr><tr><td><a href="#gpioCfgDMAchannels">gpioCfgDMAchannels</a></td><td> Configure the DMA channels
-</td></tr><tr><td><a href="#gpioCfgPermissions">gpioCfgPermissions</a></td><td> Configure the GPIO access permissions
-</td></tr><tr><td><a href="#gpioCfgInterfaces">gpioCfgInterfaces</a></td><td> Configure user interfaces
-</td></tr><tr><td><a href="#gpioCfgSocketPort">gpioCfgSocketPort</a></td><td> Configure socket port
-</td></tr><tr><td><a href="#gpioCfgMemAlloc">gpioCfgMemAlloc</a></td><td> Configure DMA memory allocation mode
-</td></tr><tr><td><a href="#gpioCfgNetAddr">gpioCfgNetAddr</a></td><td> Configure allowed network addresses
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioCfgInternals">gpioCfgInternals</a></td><td> Configure misc. internals (DEPRECATED)
-</td></tr><tr><td><a href="#gpioCfgGetInternals">gpioCfgGetInternals</a></td><td> Get internal configuration settings
-</td></tr><tr><td><a href="#gpioCfgSetInternals">gpioCfgSetInternals</a></td><td> Set internal configuration settings
-</td></tr><tr><td></td><td></td></tr><tr><td><b>EXPERT
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#rawWaveAddSPI">rawWaveAddSPI</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawWaveAddGeneric">rawWaveAddGeneric</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawWaveCB">rawWaveCB</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawWaveCBAdr">rawWaveCBAdr</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawWaveGetOOL">rawWaveGetOOL</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawWaveSetOOL">rawWaveSetOOL</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawWaveGetOut">rawWaveGetOut</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawWaveSetOut">rawWaveSetOut</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawWaveGetIn">rawWaveGetIn</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawWaveSetIn">rawWaveSetIn</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawWaveInfo">rawWaveInfo</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawDumpWave">rawDumpWave</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawDumpScript">rawDumpScript</a></td><td> Not intended for general use
-</td></tr><tr><td></td><td></td></tr></tbody></table><h2>FUNCTIONS</h2><h3><a name="gpioInitialise"></a><a href="#int"><small>int</small></a> gpioInitialise<small>(void)</small></h3>
-Initialises the library.
-<br><br>Returns the pigpio version number if OK, otherwise PI_INIT_FAILED.
-<br><br>gpioInitialise must be called before using the other library functions
-with the following exceptions:
-<br><br><code><a href="#gpioCfg*">gpioCfg*</a><br><a href="#gpioVersion">gpioVersion</a><br><a href="#gpioHardwareRevision">gpioHardwareRevision</a><br></code><br><br><b><small>Example</small></b><br><br><code>if&nbsp;(gpioInitialise()&nbsp;&lt;&nbsp;0)<br>{<br>&nbsp;&nbsp;&nbsp;//&nbsp;pigpio&nbsp;initialisation&nbsp;failed.<br>}<br>else<br>{<br>&nbsp;&nbsp;&nbsp;//&nbsp;pigpio&nbsp;initialised&nbsp;okay.<br>}<br></code><h3><a name="gpioTerminate"></a><a href="#void"><small>void</small></a> gpioTerminate<small>(void)</small></h3>
-Terminates the library.
-<br><br>Returns nothing.
-<br><br>Call before program exit.
-<br><br>This function resets the used DMA channels, releases memory, and
-terminates any running threads.
-<br><br><b><small>Example</small></b><br><br><code>gpioTerminate();<br></code><h3><a name="gpioSetMode"></a><a href="#int"><small>int</small></a> gpioSetMode<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#mode">mode</a>)</small></h3>
-Sets the GPIO mode, typically input or output.
-<br><br><code>gpio:&nbsp;0-53<br>mode:&nbsp;0-7<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO or PI_BAD_MODE.
-<br><br>Arduino style: pinMode.
-<br><br><b><small>Example</small></b><br><br><code>gpioSetMode(17,&nbsp;PI_INPUT);&nbsp;&nbsp;//&nbsp;Set&nbsp;GPIO17&nbsp;as&nbsp;input.<br><br>gpioSetMode(18,&nbsp;PI_OUTPUT);&nbsp;//&nbsp;Set&nbsp;GPIO18&nbsp;as&nbsp;output.<br><br>gpioSetMode(22,PI_ALT0);&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Set&nbsp;GPIO22&nbsp;to&nbsp;alternative&nbsp;mode&nbsp;0.<br></code><br><br>See <a href="http://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2835/BCM2835-ARM-Peripherals.pdf">http://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2835/BCM2835-ARM-Peripherals.pdf</a> page 102 for an overview of the modes.
-<h3><a name="gpioGetMode"></a><a href="#int"><small>int</small></a> gpioGetMode<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>)</small></h3>
-Gets the GPIO mode.
-<br><br><code>gpio:&nbsp;0-53<br></code><br><br>Returns the GPIO mode if OK, otherwise PI_BAD_GPIO.
-<br><br><b><small>Example</small></b><br><br><code>if&nbsp;(gpioGetMode(17)&nbsp;!=&nbsp;PI_ALT0)<br>{<br>&nbsp;&nbsp;&nbsp;gpioSetMode(17,&nbsp;PI_ALT0);&nbsp;&nbsp;//&nbsp;set&nbsp;GPIO17&nbsp;to&nbsp;ALT0<br>}<br></code><h3><a name="gpioSetPullUpDown"></a><a href="#int"><small>int</small></a> gpioSetPullUpDown<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#pud">pud</a>)</small></h3>
-Sets or clears resistor pull ups or downs on the GPIO.
-<br><br><code>gpio:&nbsp;0-53<br>&nbsp;pud:&nbsp;0-2<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO or PI_BAD_PUD.
-<br><br><b><small>Example</small></b><br><br><code>gpioSetPullUpDown(17,&nbsp;PI_PUD_UP);&nbsp;&nbsp;&nbsp;//&nbsp;Sets&nbsp;a&nbsp;pull-up.<br><br>gpioSetPullUpDown(18,&nbsp;PI_PUD_DOWN);&nbsp;//&nbsp;Sets&nbsp;a&nbsp;pull-down.<br><br>gpioSetPullUpDown(23,&nbsp;PI_PUD_OFF);&nbsp;&nbsp;//&nbsp;Clear&nbsp;any&nbsp;pull-ups/downs.<br></code><h3><a name="gpioRead"></a><a href="#int"><small>int</small></a> gpioRead<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>)</small></h3>
-Reads the GPIO level, on or off.
-<br><br><code>gpio:&nbsp;0-53<br></code><br><br>Returns the GPIO level if OK, otherwise PI_BAD_GPIO.
-<br><br>Arduino style: digitalRead.
-<br><br><b><small>Example</small></b><br><br><code>printf("GPIO24&nbsp;is&nbsp;level&nbsp;%d",&nbsp;gpioRead(24));<br></code><h3><a name="gpioWrite"></a><a href="#int"><small>int</small></a> gpioWrite<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#level">level</a>)</small></h3>
-Sets the GPIO level, on or off.
-<br><br><code>&nbsp;gpio:&nbsp;0-53<br>level:&nbsp;0-1<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO or PI_BAD_LEVEL.
-<br><br>If PWM or servo pulses are active on the GPIO they are switched off.
-<br><br>Arduino style: digitalWrite
-<br><br><b><small>Example</small></b><br><br><code>gpioWrite(24,&nbsp;1);&nbsp;//&nbsp;Set&nbsp;GPIO24&nbsp;high.<br></code><h3><a name="gpioPWM"></a><a href="#int"><small>int</small></a> gpioPWM<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#dutycycle">dutycycle</a>)</small></h3>
-Starts PWM on the GPIO, dutycycle between 0 (off) and range (fully on).
-Range defaults to 255.
-<br><br><code>user_gpio:&nbsp;0-31<br>dutycycle:&nbsp;0-range<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_BAD_DUTYCYCLE.
-<br><br>Arduino style: analogWrite
-<br><br>This and the servo functionality use the DMA and PWM or PCM peripherals
-to control and schedule the pulse lengths and dutycycles.
-<br><br>The <a href="#gpioSetPWMrange">gpioSetPWMrange</a> function may be used to change the default
-range of 255.
-<br><br><b><small>Example</small></b><br><br><code>gpioPWM(17,&nbsp;255);&nbsp;//&nbsp;Sets&nbsp;GPIO17&nbsp;full&nbsp;on.<br><br>gpioPWM(18,&nbsp;128);&nbsp;//&nbsp;Sets&nbsp;GPIO18&nbsp;half&nbsp;on.<br><br>gpioPWM(23,&nbsp;0);&nbsp;&nbsp;&nbsp;//&nbsp;Sets&nbsp;GPIO23&nbsp;full&nbsp;off.<br></code><h3><a name="gpioGetPWMdutycycle"></a><a href="#int"><small>int</small></a> gpioGetPWMdutycycle<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Returns the PWM dutycycle setting for the GPIO.
-<br><br><code>user_gpio:&nbsp;0-31<br></code><br><br>Returns between 0 (off) and range (fully on) if OK, otherwise
-PI_BAD_USER_GPIO or PI_NOT_PWM_GPIO.
-<br><br>For normal PWM the dutycycle will be out of the defined range
-for the GPIO (see <a href="#gpioGetPWMrange">gpioGetPWMrange</a>).
-<br><br>If a hardware clock is active on the GPIO the reported dutycycle
-will be 500000 (500k) out of 1000000 (1M).
-<br><br>If hardware PWM is active on the GPIO the reported dutycycle
-will be out of a 1000000 (1M).
-<br><br>Normal PWM range defaults to 255.
-<h3><a name="gpioSetPWMrange"></a><a href="#int"><small>int</small></a> gpioSetPWMrange<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#range">range</a>)</small></h3>
-Selects the dutycycle range to be used for the GPIO. Subsequent calls
-to gpioPWM will use a dutycycle between 0 (off) and range (fully on).
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;range:&nbsp;25-40000<br></code><br><br>Returns the real range for the given GPIO's frequency if OK,
-otherwise PI_BAD_USER_GPIO or PI_BAD_DUTYRANGE.
-<br><br>If PWM is currently active on the GPIO its dutycycle will be scaled
-to reflect the new range.
-<br><br>The real range, the number of steps between fully off and fully
-on for each frequency, is given in the following table.
-<br><br><code>&nbsp;&nbsp;25,&nbsp;&nbsp;&nbsp;50,&nbsp;&nbsp;100,&nbsp;&nbsp;125,&nbsp;&nbsp;200,&nbsp;&nbsp;250,&nbsp;&nbsp;400,&nbsp;&nbsp;&nbsp;500,&nbsp;&nbsp;&nbsp;625,<br>&nbsp;800,&nbsp;1000,&nbsp;1250,&nbsp;2000,&nbsp;2500,&nbsp;4000,&nbsp;5000,&nbsp;10000,&nbsp;20000<br></code><br><br>The real value set by <a href="#gpioPWM">gpioPWM</a> is (dutycycle * real range) / range.
-<br><br><b><small>Example</small></b><br><br><code>gpioSetPWMrange(24,&nbsp;2000);&nbsp;//&nbsp;Now&nbsp;2000&nbsp;is&nbsp;fully&nbsp;on<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1000&nbsp;is&nbsp;half&nbsp;on<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;500&nbsp;is&nbsp;quarter&nbsp;on,&nbsp;etc.<br></code><h3><a name="gpioGetPWMrange"></a><a href="#int"><small>int</small></a> gpioGetPWMrange<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Returns the dutycycle range used for the GPIO if OK, otherwise
-PI_BAD_USER_GPIO.
-<br><br><code>user_gpio:&nbsp;0-31<br></code><br><br>If a hardware clock or hardware PWM is active on the GPIO
-the reported range will be 1000000 (1M).
-<br><br><b><small>Example</small></b><br><br><code>r&nbsp;=&nbsp;gpioGetPWMrange(23);<br></code><h3><a name="gpioGetPWMrealRange"></a><a href="#int"><small>int</small></a> gpioGetPWMrealRange<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Returns the real range used for the GPIO if OK, otherwise
-PI_BAD_USER_GPIO.
-<br><br><code>user_gpio:&nbsp;0-31<br></code><br><br>If a hardware clock is active on the GPIO the reported real
-range will be 1000000 (1M).
-<br><br>If hardware PWM is active on the GPIO the reported real range
-will be approximately 250M divided by the set PWM frequency.
-<br><br><b><small>Example</small></b><br><br><code>rr&nbsp;=&nbsp;gpioGetPWMrealRange(17);<br></code><h3><a name="gpioSetPWMfrequency"></a><a href="#int"><small>int</small></a> gpioSetPWMfrequency<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#frequency">frequency</a>)</small></h3>
-Sets the frequency in hertz to be used for the GPIO.
-<br><br><code>user_gpio:&nbsp;0-31<br>frequency:&nbsp;&gt;=0<br></code><br><br>Returns the numerically closest frequency if OK, otherwise
-PI_BAD_USER_GPIO.
-<br><br>If PWM is currently active on the GPIO it will be
-switched off and then back on at the new frequency.
-<br><br>Each GPIO can be independently set to one of 18 different PWM
-frequencies.
-<br><br>The selectable frequencies depend upon the sample rate which
-may be 1, 2, 4, 5, 8, or 10 microseconds (default 5).
-<br><br>The frequencies for each sample rate are:
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hertz<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1:&nbsp;40000&nbsp;20000&nbsp;10000&nbsp;8000&nbsp;5000&nbsp;4000&nbsp;2500&nbsp;2000&nbsp;1600<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1250&nbsp;&nbsp;1000&nbsp;&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;50<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2:&nbsp;20000&nbsp;10000&nbsp;&nbsp;5000&nbsp;4000&nbsp;2500&nbsp;2000&nbsp;1250&nbsp;1000&nbsp;&nbsp;800<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;625&nbsp;&nbsp;&nbsp;500&nbsp;&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;125&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;25<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4:&nbsp;10000&nbsp;&nbsp;5000&nbsp;&nbsp;2500&nbsp;2000&nbsp;1250&nbsp;1000&nbsp;&nbsp;625&nbsp;&nbsp;500&nbsp;&nbsp;400<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;313&nbsp;&nbsp;&nbsp;250&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;125&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;63&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;13<br>sample<br>&nbsp;rate<br>&nbsp;(us)&nbsp;&nbsp;5:&nbsp;&nbsp;8000&nbsp;&nbsp;4000&nbsp;&nbsp;2000&nbsp;1600&nbsp;1000&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;320<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;250&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;&nbsp;160&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;80&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;&nbsp;20&nbsp;&nbsp;&nbsp;10<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8:&nbsp;&nbsp;5000&nbsp;&nbsp;2500&nbsp;&nbsp;1250&nbsp;1000&nbsp;&nbsp;625&nbsp;&nbsp;500&nbsp;&nbsp;313&nbsp;&nbsp;250&nbsp;&nbsp;200<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;156&nbsp;&nbsp;&nbsp;125&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;63&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;31&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;13&nbsp;&nbsp;&nbsp;&nbsp;6<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10:&nbsp;&nbsp;4000&nbsp;&nbsp;2000&nbsp;&nbsp;1000&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;160<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;125&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;&nbsp;80&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;20&nbsp;&nbsp;&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;5<br></code><br><br><b><small>Example</small></b><br><br><code>gpioSetPWMfrequency(23,&nbsp;0);&nbsp;//&nbsp;Set&nbsp;GPIO23&nbsp;to&nbsp;lowest&nbsp;frequency.<br><br>gpioSetPWMfrequency(24,&nbsp;500);&nbsp;//&nbsp;Set&nbsp;GPIO24&nbsp;to&nbsp;500Hz.<br><br>gpioSetPWMfrequency(25,&nbsp;100000);&nbsp;//&nbsp;Set&nbsp;GPIO25&nbsp;to&nbsp;highest&nbsp;frequency.<br></code><h3><a name="gpioGetPWMfrequency"></a><a href="#int"><small>int</small></a> gpioGetPWMfrequency<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Returns the frequency (in hertz) used for the GPIO if OK, otherwise
-PI_BAD_USER_GPIO.
-<br><br><code>user_gpio:&nbsp;0-31<br></code><br><br>For normal PWM the frequency will be that defined for the GPIO by
-<a href="#gpioSetPWMfrequency">gpioSetPWMfrequency</a>.
-<br><br>If a hardware clock is active on the GPIO the reported frequency
-will be that set by <a href="#gpioHardwareClock">gpioHardwareClock</a>.
-<br><br>If hardware PWM is active on the GPIO the reported frequency
-will be that set by <a href="#gpioHardwarePWM">gpioHardwarePWM</a>.
-<br><br><b><small>Example</small></b><br><br><code>f&nbsp;=&nbsp;gpioGetPWMfrequency(23);&nbsp;//&nbsp;Get&nbsp;frequency&nbsp;used&nbsp;for&nbsp;GPIO23.<br></code><h3><a name="gpioServo"></a><a href="#int"><small>int</small></a> gpioServo<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#pulsewidth">pulsewidth</a>)</small></h3>
-Starts servo pulses on the GPIO, 0 (off), 500 (most anti-clockwise) to
-2500 (most clockwise).
-<br><br><code>&nbsp;user_gpio:&nbsp;0-31<br>pulsewidth:&nbsp;0,&nbsp;500-2500<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_BAD_PULSEWIDTH.
-<br><br>The range supported by servos varies and should probably be determined
-by experiment. A value of 1500 should always be safe and represents
-the mid-point of rotation. You can DAMAGE a servo if you command it
-to move beyond its limits.
-<br><br>The following causes an on pulse of 1500 microseconds duration to be
-transmitted on GPIO 17 at a rate of 50 times per second. This will
-command a servo connected to GPIO 17 to rotate to its mid-point.
-<br><br><b><small>Example</small></b><br><br><code>gpioServo(17,&nbsp;1000);&nbsp;//&nbsp;Move&nbsp;servo&nbsp;to&nbsp;safe&nbsp;position&nbsp;anti-clockwise.<br><br>gpioServo(23,&nbsp;1500);&nbsp;//&nbsp;Move&nbsp;servo&nbsp;to&nbsp;centre&nbsp;position.<br><br>gpioServo(25,&nbsp;2000);&nbsp;//&nbsp;Move&nbsp;servo&nbsp;to&nbsp;safe&nbsp;position&nbsp;clockwise.<br></code><br><br>OTHER UPDATE RATES:
-<br><br>This function updates servos at 50Hz. If you wish to use a different
-update frequency you will have to use the PWM functions.
-<br><br><code>PWM&nbsp;Hz&nbsp;&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;200&nbsp;&nbsp;400&nbsp;&nbsp;500<br>1E6/Hz&nbsp;20000&nbsp;10000&nbsp;5000&nbsp;2500&nbsp;2000<br></code><br><br>Firstly set the desired PWM frequency using <a href="#gpioSetPWMfrequency">gpioSetPWMfrequency</a>.
-<br><br>Then set the PWM range using <a href="#gpioSetPWMrange">gpioSetPWMrange</a> to 1E6/frequency.
-Doing this allows you to use units of microseconds when setting
-the servo pulsewidth.
-<br><br>E.g. If you want to update a servo connected to GPIO25 at 400Hz
-<br><br><code>gpioSetPWMfrequency(25,&nbsp;400);<br><br>gpioSetPWMrange(25,&nbsp;2500);<br></code><br><br>Thereafter use the PWM command to move the servo,
-e.g. gpioPWM(25, 1500) will set a 1500 us pulse.
-<h3><a name="gpioGetServoPulsewidth"></a><a href="#int"><small>int</small></a> gpioGetServoPulsewidth<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Returns the servo pulsewidth setting for the GPIO.
-<br><br><code>user_gpio:&nbsp;0-31<br></code><br><br>Returns 0 (off), 500 (most anti-clockwise) to 2500 (most clockwise)
-if OK, otherwise PI_BAD_USER_GPIO or PI_NOT_SERVO_GPIO.
-<h3><a name="gpioSetAlertFunc"></a><a href="#int"><small>int</small></a> gpioSetAlertFunc<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#gpioAlertFunc_t">gpioAlertFunc_t</a> <a href="#f">f</a>)</small></h3>
-Registers a function to be called (a callback) when the specified
-GPIO changes state.
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO.
-<br><br>One callback may be registered per GPIO.
-<br><br>The callback is passed the GPIO, the new level, and the tick.
-<br><br><code>Parameter&nbsp;&nbsp;&nbsp;Value&nbsp;&nbsp;&nbsp;&nbsp;Meaning<br><br>GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-31&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;GPIO&nbsp;which&nbsp;has&nbsp;changed&nbsp;state<br><br>level&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;=&nbsp;change&nbsp;to&nbsp;low&nbsp;(a&nbsp;falling&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&nbsp;change&nbsp;to&nbsp;high&nbsp;(a&nbsp;rising&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;=&nbsp;no&nbsp;level&nbsp;change&nbsp;(a&nbsp;watchdog&nbsp;timeout)<br><br>tick&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32&nbsp;bit&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;microseconds&nbsp;since&nbsp;boot<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WARNING:&nbsp;this&nbsp;wraps&nbsp;around&nbsp;from<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4294967295&nbsp;to&nbsp;0&nbsp;roughly&nbsp;every&nbsp;72&nbsp;minutes<br></code><br><br>The alert may be cancelled by passing NULL as the function.
-<br><br>The GPIO are sampled at a rate set when the library is started.
-<br><br>If a value isn't specifically set the default of 5 us is used.
-<br><br>The number of samples per second is given in the following table.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;samples<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;per&nbsp;sec<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;1,000,000<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;500,000<br>sample&nbsp;&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;250,000<br>rate&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;200,000<br>(us)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8&nbsp;&nbsp;&nbsp;&nbsp;125,000<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;100,000<br></code><br><br>Level changes shorter than the sample rate may be missed.
-<br><br>The thread which calls the alert functions is triggered nominally
-1000 times per second. The active alert functions will be called
-once per level change since the last time the thread was activated.
-i.e. The active alert functions will get all level changes but there
-will be a latency.
-<br><br>If you want to track the level of more than one GPIO do so by
-maintaining the state in the callback. Do not use <a href="#gpioRead">gpioRead</a>.
-Remember the event that triggered the callback may have
-happened several milliseconds before and the GPIO may have
-changed level many times since then.
-<br><br>The tick value is the time stamp of the sample in microseconds, see
-<a href="#gpioTick">gpioTick</a> for more details.
-<br><br><b><small>Example</small></b><br><br><code>void&nbsp;aFunction(int&nbsp;gpio,&nbsp;int&nbsp;level,&nbsp;uint32_t&nbsp;tick)<br>{<br>&nbsp;&nbsp;&nbsp;printf("GPIO&nbsp;%d&nbsp;became&nbsp;%d&nbsp;at&nbsp;%d",&nbsp;gpio,&nbsp;level,&nbsp;tick);<br>}<br><br>//&nbsp;call&nbsp;aFunction&nbsp;whenever&nbsp;GPIO&nbsp;4&nbsp;changes&nbsp;state<br><br>gpioSetAlertFunc(4,&nbsp;aFunction);<br></code><h3><a name="gpioSetAlertFuncEx"></a><a href="#int"><small>int</small></a> gpioSetAlertFuncEx<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#gpioAlertFuncEx_t">gpioAlertFuncEx_t</a> <a href="#f">f</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-Registers a function to be called (a callback) when the specified
-GPIO changes state.
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function<br>&nbsp;userdata:&nbsp;pointer&nbsp;to&nbsp;arbitrary&nbsp;user&nbsp;data<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO.
-<br><br>One callback may be registered per GPIO.
-<br><br>The callback is passed the GPIO, the new level, the tick, and
-the userdata pointer.
-<br><br><code>Parameter&nbsp;&nbsp;&nbsp;Value&nbsp;&nbsp;&nbsp;&nbsp;Meaning<br><br>GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-31&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;GPIO&nbsp;which&nbsp;has&nbsp;changed&nbsp;state<br><br>level&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;=&nbsp;change&nbsp;to&nbsp;low&nbsp;(a&nbsp;falling&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&nbsp;change&nbsp;to&nbsp;high&nbsp;(a&nbsp;rising&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;=&nbsp;no&nbsp;level&nbsp;change&nbsp;(a&nbsp;watchdog&nbsp;timeout)<br><br>tick&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32&nbsp;bit&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;microseconds&nbsp;since&nbsp;boot<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WARNING:&nbsp;this&nbsp;wraps&nbsp;around&nbsp;from<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4294967295&nbsp;to&nbsp;0&nbsp;roughly&nbsp;every&nbsp;72&nbsp;minutes<br><br>userdata&nbsp;&nbsp;&nbsp;&nbsp;pointer&nbsp;&nbsp;Pointer&nbsp;to&nbsp;an&nbsp;arbitrary&nbsp;object<br></code><br><br>See <a href="#gpioSetAlertFunc">gpioSetAlertFunc</a> for further details.
-<br><br>Only one of <a href="#gpioSetAlertFunc">gpioSetAlertFunc</a> or <a href="#gpioSetAlertFuncEx">gpioSetAlertFuncEx</a> can be
-registered per GPIO.
-<h3><a name="gpioSetISRFunc"></a><a href="#int"><small>int</small></a> gpioSetISRFunc<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#edge">edge</a>, <a href="#int">int</a> <a href="#timeout">timeout</a>, <a href="#gpioISRFunc_t">gpioISRFunc_t</a> <a href="#f">f</a>)</small></h3>
-Registers a function to be called (a callback) whenever the specified
-GPIO interrupt occurs.
-<br><br><code>&nbsp;&nbsp;&nbsp;gpio:&nbsp;0-53<br>&nbsp;&nbsp;&nbsp;edge:&nbsp;RISING_EDGE,&nbsp;FALLING_EDGE,&nbsp;or&nbsp;EITHER_EDGE<br>timeout:&nbsp;interrupt&nbsp;timeout&nbsp;in&nbsp;milliseconds&nbsp;(&lt;=0&nbsp;to&nbsp;cancel)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_EDGE,
-or PI_BAD_ISR_INIT.
-<br><br>One function may be registered per GPIO.
-<br><br>The function is passed the GPIO, the current level, and the
-current tick. The level will be PI_TIMEOUT if the optional
-interrupt timeout expires.
-<br><br><code>Parameter&nbsp;&nbsp;&nbsp;Value&nbsp;&nbsp;&nbsp;&nbsp;Meaning<br><br>GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-53&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;GPIO&nbsp;which&nbsp;has&nbsp;changed&nbsp;state<br><br>level&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;=&nbsp;change&nbsp;to&nbsp;low&nbsp;(a&nbsp;falling&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&nbsp;change&nbsp;to&nbsp;high&nbsp;(a&nbsp;rising&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;=&nbsp;no&nbsp;level&nbsp;change&nbsp;(interrupt&nbsp;timeout)<br><br>tick&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32&nbsp;bit&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;microseconds&nbsp;since&nbsp;boot<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WARNING:&nbsp;this&nbsp;wraps&nbsp;around&nbsp;from<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4294967295&nbsp;to&nbsp;0&nbsp;roughly&nbsp;every&nbsp;72&nbsp;minutes<br></code><br><br>The underlying Linux sysfs GPIO interface is used to provide
-the interrupt services.
-<br><br>The first time the function is called, with a non-NULL f, the
-GPIO is exported, set to be an input, and set to interrupt
-on the given edge and timeout.
-<br><br>Subsequent calls, with a non-NULL f, can vary one or more of the
-edge, timeout, or function.
-<br><br>The ISR may be cancelled by passing a NULL f, in which case the
-GPIO is unexported.
-<br><br>The tick is that read at the time the process was informed of
-the interrupt. This will be a variable number of microseconds
-after the interrupt occurred. Typically the latency will be of
-the order of 50 microseconds. The latency is not guaranteed
-and will vary with system load.
-<br><br>The level is that read at the time the process was informed of
-the interrupt, or PI_TIMEOUT if the optional interrupt timeout
-expired. It may not be the same as the expected edge as
-interrupts happening in rapid succession may be missed by the
-kernel (i.e. this mechanism can not be used to capture several
-interrupts only a few microseconds apart).
-<h3><a name="gpioSetISRFuncEx"></a><a href="#int"><small>int</small></a> gpioSetISRFuncEx<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#edge">edge</a>, <a href="#int">int</a> <a href="#timeout">timeout</a>, <a href="#gpioISRFuncEx_t">gpioISRFuncEx_t</a> <a href="#f">f</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-Registers a function to be called (a callback) whenever the specified
-GPIO interrupt occurs.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;gpio:&nbsp;0-53<br>&nbsp;&nbsp;&nbsp;&nbsp;edge:&nbsp;RISING_EDGE,&nbsp;FALLING_EDGE,&nbsp;or&nbsp;EITHER_EDGE<br>&nbsp;timeout:&nbsp;interrupt&nbsp;timeout&nbsp;in&nbsp;milliseconds&nbsp;(&lt;=0&nbsp;to&nbsp;cancel)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function<br>userdata:&nbsp;pointer&nbsp;to&nbsp;arbitrary&nbsp;user&nbsp;data<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_EDGE,
-or PI_BAD_ISR_INIT.
-<br><br>The function is passed the GPIO, the current level, the
-current tick, and the userdata pointer.
-<br><br><code>Parameter&nbsp;&nbsp;&nbsp;Value&nbsp;&nbsp;&nbsp;&nbsp;Meaning<br><br>GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-53&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;GPIO&nbsp;which&nbsp;has&nbsp;changed&nbsp;state<br><br>level&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;=&nbsp;change&nbsp;to&nbsp;low&nbsp;(a&nbsp;falling&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&nbsp;change&nbsp;to&nbsp;high&nbsp;(a&nbsp;rising&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;=&nbsp;no&nbsp;level&nbsp;change&nbsp;(interrupt&nbsp;timeout)<br><br>tick&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32&nbsp;bit&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;microseconds&nbsp;since&nbsp;boot<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WARNING:&nbsp;this&nbsp;wraps&nbsp;around&nbsp;from<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4294967295&nbsp;to&nbsp;0&nbsp;roughly&nbsp;every&nbsp;72&nbsp;minutes<br><br>userdata&nbsp;&nbsp;&nbsp;&nbsp;pointer&nbsp;&nbsp;Pointer&nbsp;to&nbsp;an&nbsp;arbitrary&nbsp;object<br></code><br><br>Only one of <a href="#gpioSetISRFunc">gpioSetISRFunc</a> or <a href="#gpioSetISRFuncEx">gpioSetISRFuncEx</a> can be
-registered per GPIO.
-<br><br>See <a href="#gpioSetISRFunc">gpioSetISRFunc</a> for further details.
-<h3><a name="gpioNotifyOpen"></a><a href="#int"><small>int</small></a> gpioNotifyOpen<small>(void)</small></h3>
-This function requests a free notification handle.
-<br><br>Returns a handle greater than or equal to zero if OK,
-otherwise PI_NO_HANDLE.
-<br><br>A notification is a method for being notified of GPIO state changes
-via a pipe or socket.
-<br><br>Pipe notifications for handle x will be available at the pipe
-named /dev/pigpiox (where x is the handle number). E.g. if the
-function returns 15 then the notifications must be read
-from /dev/pigpio15.
-<br><br>Socket notifications are returned to the socket which requested the
-handle.
-<br><br><b><small>Example</small></b><br><br><code>h&nbsp;=&nbsp;gpioNotifyOpen();<br><br>if&nbsp;(h&nbsp;&gt;=&nbsp;0)<br>{<br>&nbsp;&nbsp;&nbsp;sprintf(str,&nbsp;"/dev/pigpio%d",&nbsp;h);<br><br>&nbsp;&nbsp;&nbsp;fd&nbsp;=&nbsp;open(str,&nbsp;O_RDONLY);<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(fd&nbsp;&gt;=&nbsp;0)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Okay.<br>&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;else<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Error.<br>&nbsp;&nbsp;&nbsp;}<br>}<br>else<br>{<br>&nbsp;&nbsp;&nbsp;//&nbsp;Error.<br>}<br></code><h3><a name="gpioNotifyOpenWithSize"></a><a href="#int"><small>int</small></a> gpioNotifyOpenWithSize<small>(<a href="#int">int</a> <a href="#bufSize">bufSize</a>)</small></h3>
-This function requests a free notification handle.
-<br><br>It differs from <a href="#gpioNotifyOpen">gpioNotifyOpen</a> in that the pipe size may be
-specified, whereas <a href="#gpioNotifyOpen">gpioNotifyOpen</a> uses the default pipe size.
-<br><br>See <a href="#gpioNotifyOpen">gpioNotifyOpen</a> for further details.
-<h3><a name="gpioNotifyBegin"></a><a href="#int"><small>int</small></a> gpioNotifyBegin<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-This function starts notifications on a previously opened handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioNotifyOpen">gpioNotifyOpen</a><br>&nbsp;&nbsp;bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;indicating&nbsp;the&nbsp;GPIO&nbsp;of&nbsp;interest<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<br><br>The notification sends state changes for each GPIO whose corresponding
-bit in bits is set.
-<br><br>Each notification occupies 12 bytes in the fifo and has the
-following structure.
-<br><br><code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;seqno;<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;flags;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;tick;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;level;<br>}&nbsp;gpioReport_t;<br></code><br><br>seqno: starts at 0 each time the handle is opened and then increments
-by one for each report.
-<br><br>flags: three flags are defined, PI_NTFY_FLAGS_WDOG,
-PI_NTFY_FLAGS_ALIVE, and PI_NTFY_FLAGS_EVENT.
-<br><br>If bit 5 is set (PI_NTFY_FLAGS_WDOG) then bits 0-4 of the flags
-indicate a GPIO which has had a watchdog timeout.
-<br><br>If bit 6 is set (PI_NTFY_FLAGS_ALIVE) this indicates a keep alive
-signal on the pipe/socket and is sent once a minute in the absence
-of other notification activity.
-<br><br>If bit 7 is set (PI_NTFY_FLAGS_EVENT) then bits 0-4 of the flags
-indicate an event which has been triggered.
-<br><br>tick: the number of microseconds since system boot. It wraps around
-after 1h12m.
-<br><br>level: indicates the level of each GPIO. If bit 1&lt;&lt;x is set then
-GPIO x is high.
-<br><br><b><small>Example</small></b><br><br><code>//&nbsp;Start&nbsp;notifications&nbsp;for&nbsp;GPIO&nbsp;1,&nbsp;4,&nbsp;6,&nbsp;7,&nbsp;10.<br><br>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1<br>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;76&nbsp;4&nbsp;&nbsp;1<br>//&nbsp;(1234&nbsp;=&nbsp;0x04D2&nbsp;=&nbsp;0b0000010011010010)<br><br>gpioNotifyBegin(h,&nbsp;1234);<br></code><h3><a name="gpioNotifyPause"></a><a href="#int"><small>int</small></a> gpioNotifyPause<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This function pauses notifications on a previously opened handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioNotifyOpen">gpioNotifyOpen</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<br><br>Notifications for the handle are suspended until <a href="#gpioNotifyBegin">gpioNotifyBegin</a>
-is called again.
-<br><br><b><small>Example</small></b><br><br><code>gpioNotifyPause(h);<br></code><h3><a name="gpioNotifyClose"></a><a href="#int"><small>int</small></a> gpioNotifyClose<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This function stops notifications on a previously opened handle
-and releases the handle for reuse.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioNotifyOpen">gpioNotifyOpen</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<br><br><b><small>Example</small></b><br><br><code>gpioNotifyClose(h);<br></code><h3><a name="gpioWaveClear"></a><a href="#int"><small>int</small></a> gpioWaveClear<small>(void)</small></h3>
-This function clears all waveforms and any data added by calls to the
-<a href="#gpioWaveAdd*">gpioWaveAdd*</a> functions.
-<br><br>Returns 0 if OK.
-<br><br><b><small>Example</small></b><br><br><code>gpioWaveClear();<br></code><h3><a name="gpioWaveAddNew"></a><a href="#int"><small>int</small></a> gpioWaveAddNew<small>(void)</small></h3>
-This function starts a new empty waveform.
-<br><br>You wouldn't normally need to call this function as it is automatically
-called after a waveform is created with the <a href="#gpioWaveCreate">gpioWaveCreate</a> function.
-<br><br>Returns 0 if OK.
-<br><br><b><small>Example</small></b><br><br><code>gpioWaveAddNew();<br></code><h3><a name="gpioWaveAddGeneric"></a><a href="#int"><small>int</small></a> gpioWaveAddGeneric<small>(<a href="#unsigned">unsigned</a> <a href="#numPulses">numPulses</a>, <a href="#gpioPulse_t">gpioPulse_t</a> <a href="#*pulses">*pulses</a>)</small></h3>
-This function adds a number of pulses to the current waveform.
-<br><br><code>numPulses:&nbsp;the&nbsp;number&nbsp;of&nbsp;pulses<br>&nbsp;&nbsp;&nbsp;pulses:&nbsp;an&nbsp;array&nbsp;of&nbsp;pulses<br></code><br><br>Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_TOO_MANY_PULSES.
-<br><br>The pulses are interleaved in time order within the existing waveform
-(if any).
-<br><br>Merging allows the waveform to be built in parts, that is the settings
-for GPIO#1 can be added, and then GPIO#2 etc.
-<br><br>If the added waveform is intended to start after or within the existing
-waveform then the first pulse should consist of a delay.
-<br><br><b><small>Example</small></b><br><br><code>//&nbsp;Construct&nbsp;and&nbsp;send&nbsp;a&nbsp;30&nbsp;microsecond&nbsp;square&nbsp;wave.<br><br>gpioSetMode(gpio,&nbsp;PI_OUTPUT);<br><br>pulse[0].gpioOn&nbsp;=&nbsp;(1&lt;&lt;gpio);<br>pulse[0].gpioOff&nbsp;=&nbsp;0;<br>pulse[0].usDelay&nbsp;=&nbsp;15;<br><br>pulse[1].gpioOn&nbsp;=&nbsp;0;<br>pulse[1].gpioOff&nbsp;=&nbsp;(1&lt;&lt;gpio);<br>pulse[1].usDelay&nbsp;=&nbsp;15;<br><br>gpioWaveAddNew();<br><br>gpioWaveAddGeneric(2,&nbsp;pulse);<br><br>wave_id&nbsp;=&nbsp;gpioWaveCreate();<br><br>if&nbsp;(wave_id&nbsp;&gt;=&nbsp;0)<br>{<br>&nbsp;&nbsp;&nbsp;gpioWaveTxSend(wave_id,&nbsp;PI_WAVE_MODE_REPEAT);<br><br>&nbsp;&nbsp;&nbsp;//&nbsp;Transmit&nbsp;for&nbsp;30&nbsp;seconds.<br><br>&nbsp;&nbsp;&nbsp;sleep(30);<br><br>&nbsp;&nbsp;&nbsp;gpioWaveTxStop();<br>}<br>else<br>{<br>&nbsp;&nbsp;&nbsp;//&nbsp;Wave&nbsp;create&nbsp;failed.<br>}<br></code><h3><a name="gpioWaveAddSerial"></a><a href="#int"><small>int</small></a> gpioWaveAddSerial<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#data_bits">data_bits</a>, <a href="#unsigned">unsigned</a> <a href="#stop_bits">stop_bits</a>, <a href="#unsigned">unsigned</a> <a href="#offset">offset</a>, <a href="#unsigned">unsigned</a> <a href="#numBytes">numBytes</a>, <a href="#char">char</a> <a href="#*str">*str</a>)</small></h3>
-This function adds a waveform representing serial data to the
-existing waveform (if any). The serial data starts offset
-microseconds from the start of the waveform.
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;50-1000000<br>data_bits:&nbsp;1-32<br>stop_bits:&nbsp;2-8<br>&nbsp;&nbsp;&nbsp;offset:&nbsp;&gt;=0<br>&nbsp;numBytes:&nbsp;&gt;=1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str:&nbsp;an&nbsp;array&nbsp;of&nbsp;chars&nbsp;(which&nbsp;may&nbsp;contain&nbsp;nulls)<br></code><br><br>Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_BAD_USER_GPIO, PI_BAD_WAVE_BAUD, PI_BAD_DATABITS,
-PI_BAD_STOPBITS, PI_TOO_MANY_CHARS, PI_BAD_SER_OFFSET,
-or PI_TOO_MANY_PULSES.
-<br><br>NOTES:
-<br><br>The serial data is formatted as one start bit, data_bits data bits, and
-stop_bits/2 stop bits.
-<br><br>It is legal to add serial data streams with different baud rates to
-the same waveform.
-<br><br>numBytes is the number of bytes of data in str.
-<br><br>The bytes required for each character depend upon data_bits.
-<br><br>For data_bits 1-8 there will be one byte per character.<br>
-For data_bits 9-16 there will be two bytes per character.<br>
-For data_bits 17-32 there will be four bytes per character.
-<br><br><b><small>Example</small></b><br><br><code>#define&nbsp;MSG_LEN&nbsp;8<br><br>int&nbsp;i;<br>char&nbsp;*str;<br>char&nbsp;data[MSG_LEN];<br><br>str&nbsp;=&nbsp;"Hello&nbsp;world!";<br><br>gpioWaveAddSerial(4,&nbsp;9600,&nbsp;8,&nbsp;2,&nbsp;0,&nbsp;strlen(str),&nbsp;str);<br><br>for&nbsp;(i=0;&nbsp;i&lt;MSG_LEN;&nbsp;i++)&nbsp;data[i]&nbsp;=&nbsp;i;<br><br>//&nbsp;Data&nbsp;added&nbsp;is&nbsp;offset&nbsp;1&nbsp;second&nbsp;from&nbsp;the&nbsp;waveform&nbsp;start.<br>gpioWaveAddSerial(4,&nbsp;9600,&nbsp;8,&nbsp;2,&nbsp;1000000,&nbsp;MSG_LEN,&nbsp;data);<br></code><h3><a name="gpioWaveCreate"></a><a href="#int"><small>int</small></a> gpioWaveCreate<small>(void)</small></h3>
-This function creates a waveform from the data provided by the prior
-calls to the <a href="#gpioWaveAdd*">gpioWaveAdd*</a> functions. Upon success a wave id
-greater than or equal to 0 is returned, otherwise PI_EMPTY_WAVEFORM,
-PI_TOO_MANY_CBS, PI_TOO_MANY_OOL, or PI_NO_WAVEFORM_ID.
-<br><br>The data provided by the <a href="#gpioWaveAdd*">gpioWaveAdd*</a> functions is consumed by this
-function.
-<br><br>As many waveforms may be created as there is space available. The
-wave id is passed to <a href="#gpioWaveTxSend">gpioWaveTxSend</a> to specify the waveform to transmit.
-<br><br>Normal usage would be
-<br><br>Step 1. <a href="#gpioWaveClear">gpioWaveClear</a> to clear all waveforms and added data.
-<br><br>Step 2. <a href="#gpioWaveAdd*">gpioWaveAdd*</a> calls to supply the waveform data.
-<br><br>Step 3. <a href="#gpioWaveCreate">gpioWaveCreate</a> to create the waveform and get a unique id
-<br><br>Repeat steps 2 and 3 as needed.
-<br><br>Step 4. <a href="#gpioWaveTxSend">gpioWaveTxSend</a> with the id of the waveform to transmit.
-<br><br>A waveform comprises one of more pulses. Each pulse consists of a
-<a href="#gpioPulse_t">gpioPulse_t</a> structure.
-<br><br><code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOn;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOff;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;usDelay;<br>}&nbsp;gpioPulse_t;<br></code><br><br>The fields specify
-<br><br>1) the GPIO to be switched on at the start of the pulse.<br>
-2) the GPIO to be switched off at the start of the pulse.<br>
-3) the delay in microseconds before the next pulse.
-<br><br>Any or all the fields can be zero. It doesn't make any sense to
-set all the fields to zero (the pulse will be ignored).
-<br><br>When a waveform is started each pulse is executed in order with the
-specified delay between the pulse and the next.
-<br><br>Returns the new waveform id if OK, otherwise PI_EMPTY_WAVEFORM,
-PI_NO_WAVEFORM_ID, PI_TOO_MANY_CBS, or PI_TOO_MANY_OOL.
-<h3><a name="gpioWaveCreatePad"></a><a href="#int"><small>int</small></a> gpioWaveCreatePad<small>(<a href="#int">int</a> <a href="#pctCB">pctCB</a>, <a href="#int">int</a> <a href="#pctBOOL">pctBOOL</a>, <a href="#int">int</a> <a href="#pctTOOL">pctTOOL</a>)</small></h3>
-Similar to <a href="#gpioWaveCreate">gpioWaveCreate</a>, this function creates a waveform but pads the consumed
-resources. Padded waves of equal dimension can be re-cycled efficiently allowing
-newly created waves to re-use the resources of deleted waves of the same dimension.
-<br><br><code>pctCB:&nbsp;0-100,&nbsp;the&nbsp;percent&nbsp;of&nbsp;all&nbsp;DMA&nbsp;control&nbsp;blocks&nbsp;to&nbsp;consume.<br>pctBOOL:&nbsp;0-100,&nbsp;percent&nbsp;On-Off-Level&nbsp;(OOL)&nbsp;buffer&nbsp;to&nbsp;consume&nbsp;for&nbsp;wave&nbsp;output.<br>pctTOOL:&nbsp;0-100,&nbsp;the&nbsp;percent&nbsp;of&nbsp;OOL&nbsp;buffer&nbsp;to&nbsp;consume&nbsp;for&nbsp;wave&nbsp;input&nbsp;(flags).<br></code><br><br>Upon success a wave id greater than or equal to 0 is returned, otherwise
-PI_EMPTY_WAVEFORM, PI_TOO_MANY_CBS, PI_TOO_MANY_OOL, or PI_NO_WAVEFORM_ID.
-<br><br>Waveform data provided by <a href="#gpioWaveAdd*">gpioWaveAdd*</a> and <a href="#rawWaveAdd*">rawWaveAdd*</a> functions are
-consumed by this function.
-<br><br>A usage would be the creation of two waves where one is filled while the other
-is being transmitted. Each wave is assigned 50% of the resources.
-This buffer structure allows the transmission of infinite wave sequences.
-<br><br><b><small>Example</small></b><br><br><code>&nbsp;&nbsp;//&nbsp;get&nbsp;firstWaveChunk,&nbsp;somehow<br>&nbsp;&nbsp;gpioWaveAddGeneric(firstWaveChunk);<br>&nbsp;&nbsp;wid&nbsp;=&nbsp;gpioWaveCreatePad(50,&nbsp;50,&nbsp;0);<br>&nbsp;&nbsp;gpioWaveTxSend(wid,&nbsp;PI_WAVE_MODE_ONE_SHOT);<br>&nbsp;&nbsp;//&nbsp;get&nbsp;nextWaveChunk<br><br>&nbsp;&nbsp;while&nbsp;(nextWaveChunk)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gpioWaveAddGeneric(nextWaveChunk);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nextWid&nbsp;=&nbsp;gpioWaveCreatePad(50,&nbsp;50,&nbsp;0);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gpioWaveTxSend(nextWid,&nbsp;PI_WAVE_MODE_ONE_SHOT_SYNC);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while(gpioWaveTxAt()&nbsp;==&nbsp;wid)&nbsp;time_sleep(0.1);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gpioWaveDelete(wid);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid&nbsp;=&nbsp;nextWid;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;get&nbsp;nextWaveChunk<br>&nbsp;&nbsp;}<br></code><h3><a name="gpioWaveDelete"></a><a href="#int"><small>int</small></a> gpioWaveDelete<small>(<a href="#unsigned">unsigned</a> <a href="#wave_id">wave_id</a>)</small></h3>
-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><code>wave_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioWaveCreate">gpioWaveCreate</a><br></code><br><br>Wave ids are allocated in order, 0, 1, 2, etc.
-<br><br>Returns 0 if OK, otherwise PI_BAD_WAVE_ID.
-<h3><a name="gpioWaveTxSend"></a><a href="#int"><small>int</small></a> gpioWaveTxSend<small>(<a href="#unsigned">unsigned</a> <a href="#wave_id">wave_id</a>, <a href="#unsigned">unsigned</a> <a href="#wave_mode">wave_mode</a>)</small></h3>
-This function transmits the waveform with id wave_id. The mode
-determines whether the waveform is sent once or cycles endlessly.
-The SYNC variants wait for the current waveform to reach the
-end of a cycle or finish before starting the new waveform.
-<br><br>WARNING: bad things may happen if you delete the previous
-waveform before it has been synced to the new waveform.
-<br><br>NOTE: Any hardware PWM started by <a href="#gpioHardwarePWM">gpioHardwarePWM</a> will be cancelled.
-<br><br><code>&nbsp;&nbsp;wave_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioWaveCreate">gpioWaveCreate</a><br>wave_mode:&nbsp;PI_WAVE_MODE_ONE_SHOT,&nbsp;PI_WAVE_MODE_REPEAT,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PI_WAVE_MODE_ONE_SHOT_SYNC,&nbsp;PI_WAVE_MODE_REPEAT_SYNC<br></code><br><br>Returns the number of DMA control blocks in the waveform if OK,
-otherwise PI_BAD_WAVE_ID, or PI_BAD_WAVE_MODE.
-<h3><a name="gpioWaveChain"></a><a href="#int"><small>int</small></a> gpioWaveChain<small>(<a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#bufSize">bufSize</a>)</small></h3>
-This function transmits a chain of waveforms.
-<br><br>NOTE: Any hardware PWM started by <a href="#gpioHardwarePWM">gpioHardwarePWM</a> will be cancelled.
-<br><br>The waves to be transmitted are specified by the contents of buf
-which contains an ordered list of <a href="#wave_id">wave_id</a>s and optional command
-codes and related data.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;pointer&nbsp;to&nbsp;the&nbsp;wave_ids&nbsp;and&nbsp;optional&nbsp;command&nbsp;codes<br>bufSize:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;in&nbsp;buf<br></code><br><br>Returns 0 if OK, otherwise PI_CHAIN_NESTING, PI_CHAIN_LOOP_CNT, PI_BAD_CHAIN_LOOP, PI_BAD_CHAIN_CMD, PI_CHAIN_COUNTER,
-PI_BAD_CHAIN_DELAY, PI_CHAIN_TOO_BIG, or PI_BAD_WAVE_ID.
-<br><br>Each wave is transmitted in the order specified. A wave may
-occur multiple times per chain.
-<br><br>A blocks of waves may be transmitted multiple times by using
-the loop commands. The block is bracketed by loop start and
-end commands. Loops may be nested.
-<br><br>Delays between waves may be added with the delay command.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>Loop Start</td><td>255 0</td><td>Identify start of a wave block</td></tr><tr><td>Loop Repeat</td><td>255 1 x y</td><td>loop x + y*256 times</td></tr><tr><td>Delay</td><td>255 2 x y</td><td>delay x + y*256 microseconds</td></tr><tr><td>Loop Forever</td><td>255 3</td><td>loop forever</td></tr></tbody></table><br><br>If present Loop Forever must be the last entry in the chain.
-<br><br>The code is currently dimensioned to support a chain with roughly
-600 entries and 20 loop counters.
-<br><br><b><small>Example</small></b><br><br><code>#include&nbsp;&lt;stdio.h&gt;<br>#include&nbsp;&lt;pigpio.h&gt;<br><br>#define&nbsp;WAVES&nbsp;5<br>#define&nbsp;GPIO&nbsp;4<br><br>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;*argv[])<br>{<br>&nbsp;&nbsp;&nbsp;int&nbsp;i,&nbsp;wid[WAVES];<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(gpioInitialise()&lt;0)&nbsp;return&nbsp;-1;<br><br>&nbsp;&nbsp;&nbsp;gpioSetMode(GPIO,&nbsp;PI_OUTPUT);<br><br>&nbsp;&nbsp;&nbsp;printf("start&nbsp;piscope,&nbsp;press&nbsp;return");&nbsp;getchar();<br><br>&nbsp;&nbsp;&nbsp;for&nbsp;(i=0;&nbsp;i&lt;WAVES;&nbsp;i++)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gpioWaveAddGeneric(2,&nbsp;(gpioPulse_t[])<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{1&lt;&lt;GPIO,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;20},<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{0,&nbsp;1&lt;&lt;GPIO,&nbsp;(i+1)*200}});<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[i]&nbsp;=&nbsp;gpioWaveCreate();<br>&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;gpioWaveChain((char&nbsp;[])&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[4],&nbsp;wid[3],&nbsp;wid[2],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;4+3+2<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[0],&nbsp;wid[0],&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;0+0+0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[1],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;0+1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;2,&nbsp;0x88,&nbsp;0x13,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;delay&nbsp;5000us<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;30,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;30&nbsp;times)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[2],&nbsp;wid[3],&nbsp;wid[0],&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;2+3+0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[3],&nbsp;wid[1],&nbsp;wid[2],&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;3+1+2<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;10,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;10&nbsp;times)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;5,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;5&nbsp;times)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[4],&nbsp;wid[4],&nbsp;wid[4],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;4+4+4<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;2,&nbsp;0x20,&nbsp;0x4E,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;delay&nbsp;20000us<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[0],&nbsp;wid[0],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;0+0+0<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},&nbsp;46);<br><br>&nbsp;&nbsp;&nbsp;while&nbsp;(gpioWaveTxBusy())&nbsp;time_sleep(0.1);<br><br>&nbsp;&nbsp;&nbsp;for&nbsp;(i=0;&nbsp;i&lt;WAVES;&nbsp;i++)&nbsp;gpioWaveDelete(wid[i]);<br><br>&nbsp;&nbsp;&nbsp;printf("stop&nbsp;piscope,&nbsp;press&nbsp;return");&nbsp;getchar();<br><br>&nbsp;&nbsp;&nbsp;gpioTerminate();<br>}<br></code><h3><a name="gpioWaveTxAt"></a><a href="#int"><small>int</small></a> gpioWaveTxAt<small>(void)</small></h3>
-This function returns the id of the waveform currently being
-transmitted.
-<br><br>Returns the waveform id or one of the following special values:
-<br><br>PI_WAVE_NOT_FOUND (9998) - transmitted wave not found.<br>
-PI_NO_TX_WAVE (9999) - no wave being transmitted.
-<h3><a name="gpioWaveTxBusy"></a><a href="#int"><small>int</small></a> gpioWaveTxBusy<small>(void)</small></h3>
-This function checks to see if a waveform is currently being
-transmitted.
-<br><br>Returns 1 if a waveform is currently being transmitted, otherwise 0.
-<h3><a name="gpioWaveTxStop"></a><a href="#int"><small>int</small></a> gpioWaveTxStop<small>(void)</small></h3>
-This function aborts the transmission of the current waveform.
-<br><br>Returns 0 if OK.
-<br><br>This function is intended to stop a waveform started in repeat mode.
-<h3><a name="gpioWaveGetMicros"></a><a href="#int"><small>int</small></a> gpioWaveGetMicros<small>(void)</small></h3>
-This function returns the length in microseconds of the current
-waveform.
-<h3><a name="gpioWaveGetHighMicros"></a><a href="#int"><small>int</small></a> gpioWaveGetHighMicros<small>(void)</small></h3>
-This function returns the length in microseconds of the longest waveform
-created since <a href="#gpioInitialise">gpioInitialise</a> was called.
-<h3><a name="gpioWaveGetMaxMicros"></a><a href="#int"><small>int</small></a> gpioWaveGetMaxMicros<small>(void)</small></h3>
-This function returns the maximum possible size of a waveform in
-microseconds.
-<h3><a name="gpioWaveGetPulses"></a><a href="#int"><small>int</small></a> gpioWaveGetPulses<small>(void)</small></h3>
-This function returns the length in pulses of the current waveform.
-<h3><a name="gpioWaveGetHighPulses"></a><a href="#int"><small>int</small></a> gpioWaveGetHighPulses<small>(void)</small></h3>
-This function returns the length in pulses of the longest waveform
-created since <a href="#gpioInitialise">gpioInitialise</a> was called.
-<h3><a name="gpioWaveGetMaxPulses"></a><a href="#int"><small>int</small></a> gpioWaveGetMaxPulses<small>(void)</small></h3>
-This function returns the maximum possible size of a waveform in pulses.
-<h3><a name="gpioWaveGetCbs"></a><a href="#int"><small>int</small></a> gpioWaveGetCbs<small>(void)</small></h3>
-This function returns the length in DMA control blocks of the current
-waveform.
-<h3><a name="gpioWaveGetHighCbs"></a><a href="#int"><small>int</small></a> gpioWaveGetHighCbs<small>(void)</small></h3>
-This function returns the length in DMA control blocks of the longest
-waveform created since <a href="#gpioInitialise">gpioInitialise</a> was called.
-<h3><a name="gpioWaveGetMaxCbs"></a><a href="#int"><small>int</small></a> gpioWaveGetMaxCbs<small>(void)</small></h3>
-This function returns the maximum possible size of a waveform in DMA
-control blocks.
-<h3><a name="gpioSerialReadOpen"></a><a href="#int"><small>int</small></a> gpioSerialReadOpen<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#data_bits">data_bits</a>)</small></h3>
-This function opens a GPIO for bit bang reading of serial data.
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;50-250000<br>data_bits:&nbsp;1-32<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_WAVE_BAUD,
-PI_BAD_DATABITS, or PI_GPIO_IN_USE.
-<br><br>The serial data is returned in a cyclic buffer and is read using
-<a href="#gpioSerialRead">gpioSerialRead</a>.
-<br><br>It is the caller's responsibility to read data from the cyclic buffer
-in a timely fashion.
-<h3><a name="gpioSerialReadInvert"></a><a href="#int"><small>int</small></a> gpioSerialReadInvert<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#invert">invert</a>)</small></h3>
-This function configures the level logic for bit bang serial reads.
-<br><br>Use PI_BB_SER_INVERT to invert the serial logic and PI_BB_SER_NORMAL for
-normal logic. Default is PI_BB_SER_NORMAL.
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;invert:&nbsp;0-1<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_GPIO_IN_USE,
-PI_NOT_SERIAL_GPIO, or PI_BAD_SER_INVERT.
-<br><br>The GPIO must be opened for bit bang reading of serial data using
-<a href="#gpioSerialReadOpen">gpioSerialReadOpen</a> prior to calling this function.
-<h3><a name="gpioSerialRead"></a><a href="#int"><small>int</small></a> gpioSerialRead<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#void">void</a> <a href="#*buf">*buf</a>, <a href="#size_t">size_t</a> <a href="#bufSize">bufSize</a>)</small></h3>
-This function copies up to bufSize bytes of data read from the
-bit bang serial cyclic buffer to the buffer starting at buf.
-<br><br><code>user_gpio:&nbsp;0-31,&nbsp;previously&nbsp;opened&nbsp;with&nbsp;<a href="#gpioSerialReadOpen">gpioSerialReadOpen</a><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;bytes<br>&nbsp;&nbsp;bufSize:&nbsp;&gt;=0<br></code><br><br>Returns the number of bytes copied if OK, otherwise PI_BAD_USER_GPIO
-or PI_NOT_SERIAL_GPIO.
-<br><br>The bytes returned for each character depend upon the number of
-data bits <a href="#data_bits">data_bits</a> specified in the <a href="#gpioSerialReadOpen">gpioSerialReadOpen</a> command.
-<br><br>For <a href="#data_bits">data_bits</a> 1-8 there will be one byte per character.<br>
-For <a href="#data_bits">data_bits</a> 9-16 there will be two bytes per character.<br>
-For <a href="#data_bits">data_bits</a> 17-32 there will be four bytes per character.
-<h3><a name="gpioSerialReadClose"></a><a href="#int"><small>int</small></a> gpioSerialReadClose<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-This function closes a GPIO for bit bang reading of serial data.
-<br><br><code>user_gpio:&nbsp;0-31,&nbsp;previously&nbsp;opened&nbsp;with&nbsp;<a href="#gpioSerialReadOpen">gpioSerialReadOpen</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_SERIAL_GPIO.
-<h3><a name="i2cOpen"></a><a href="#int"><small>int</small></a> i2cOpen<small>(<a href="#unsigned">unsigned</a> <a href="#i2cBus">i2cBus</a>, <a href="#unsigned">unsigned</a> <a href="#i2cAddr">i2cAddr</a>, <a href="#unsigned">unsigned</a> <a href="#i2cFlags">i2cFlags</a>)</small></h3>
-This returns a handle for the device at the address on the I2C bus.
-<br><br><code>&nbsp;&nbsp;i2cBus:&nbsp;&gt;=0<br>&nbsp;i2cAddr:&nbsp;0-0x7F<br>i2cFlags:&nbsp;0<br></code><br><br>No flags are currently defined. This parameter should be set to zero.
-<br><br>Physically buses 0 and 1 are available on the Pi. Higher numbered buses
-will be available if a kernel supported bus multiplexor is being used.
-<br><br>The GPIO used are given in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td></tr><tr><td>I2C 0</td><td>0</td><td>1</td></tr><tr><td>I2C 1</td><td>2</td><td>3</td></tr></tbody></table><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_BAD_I2C_BUS, PI_BAD_I2C_ADDR,
-PI_BAD_FLAGS, PI_NO_HANDLE, or PI_I2C_OPEN_FAILED.
-<br><br>For the SMBus commands the low level transactions are shown at the end
-of the function description. The following abbreviations are used.
-<br><br><code>S&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Start&nbsp;bit<br>P&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Stop&nbsp;bit<br>Rd/Wr&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Read/Write&nbsp;bit.&nbsp;Rd&nbsp;equals&nbsp;1,&nbsp;Wr&nbsp;equals&nbsp;0.<br>A,&nbsp;NA&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Accept&nbsp;and&nbsp;not&nbsp;accept&nbsp;bit.<br><br>Addr&nbsp;&nbsp;&nbsp;(7&nbsp;bits):&nbsp;I2C&nbsp;7&nbsp;bit&nbsp;address.<br>i2cReg&nbsp;(8&nbsp;bits):&nbsp;Command&nbsp;byte,&nbsp;a&nbsp;byte&nbsp;which&nbsp;often&nbsp;selects&nbsp;a&nbsp;register.<br>Data&nbsp;&nbsp;&nbsp;(8&nbsp;bits):&nbsp;A&nbsp;data&nbsp;byte.<br>Count&nbsp;&nbsp;(8&nbsp;bits):&nbsp;A&nbsp;byte&nbsp;defining&nbsp;the&nbsp;length&nbsp;of&nbsp;a&nbsp;block&nbsp;operation.<br><br>[..]:&nbsp;Data&nbsp;sent&nbsp;by&nbsp;the&nbsp;device.<br></code><h3><a name="i2cClose"></a><a href="#int"><small>int</small></a> i2cClose<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This closes the I2C device associated with the handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<h3><a name="i2cWriteQuick"></a><a href="#int"><small>int</small></a> i2cWriteQuick<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#bit">bit</a>)</small></h3>
-This sends a single bit (in the Rd/Wr bit) to the device associated
-with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>&nbsp;&nbsp;&nbsp;bit:&nbsp;0-1,&nbsp;the&nbsp;value&nbsp;to&nbsp;write<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Quick command. SMBus 2.0 5.5.1
-<code>S&nbsp;Addr&nbsp;bit&nbsp;[A]&nbsp;P<br></code><h3><a name="i2cWriteByte"></a><a href="#int"><small>int</small></a> i2cWriteByte<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#bVal">bVal</a>)</small></h3>
-This sends a single byte to the device associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>&nbsp;&nbsp;bVal:&nbsp;0-0xFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Send byte. SMBus 2.0 5.5.2
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;bVal&nbsp;[A]&nbsp;P<br></code><h3><a name="i2cReadByte"></a><a href="#int"><small>int</small></a> i2cReadByte<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This reads a single byte from the device associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br></code><br><br>Returns the byte read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-or PI_I2C_READ_FAILED.
-<br><br>Receive byte. SMBus 2.0 5.5.3
-<code>S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><h3><a name="i2cWriteByteData"></a><a href="#int"><small>int</small></a> i2cWriteByteData<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2cReg">i2cReg</a>, <a href="#unsigned">unsigned</a> <a href="#bVal">bVal</a>)</small></h3>
-This writes a single byte to the specified register of the device
-associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>i2cReg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write<br>&nbsp;&nbsp;bVal:&nbsp;0-0xFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Write byte. SMBus 2.0 5.5.4
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2cReg&nbsp;[A]&nbsp;bVal&nbsp;[A]&nbsp;P<br></code><h3><a name="i2cWriteWordData"></a><a href="#int"><small>int</small></a> i2cWriteWordData<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2cReg">i2cReg</a>, <a href="#unsigned">unsigned</a> <a href="#wVal">wVal</a>)</small></h3>
-This writes a single 16 bit word to the specified register of the device
-associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>i2cReg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write<br>&nbsp;&nbsp;wVal:&nbsp;0-0xFFFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Write word. SMBus 2.0 5.5.4
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2cReg&nbsp;[A]&nbsp;wValLow&nbsp;[A]&nbsp;wValHigh&nbsp;[A]&nbsp;P<br></code><h3><a name="i2cReadByteData"></a><a href="#int"><small>int</small></a> i2cReadByteData<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2cReg">i2cReg</a>)</small></h3>
-This reads a single byte from the specified register of the device
-associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>i2cReg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read<br></code><br><br>Returns the byte read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Read byte. SMBus 2.0 5.5.5
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2cReg&nbsp;[A]&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><h3><a name="i2cReadWordData"></a><a href="#int"><small>int</small></a> i2cReadWordData<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2cReg">i2cReg</a>)</small></h3>
-This reads a single 16 bit word from the specified register of the device
-associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>i2cReg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read<br></code><br><br>Returns the word read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Read word. SMBus 2.0 5.5.5
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2cReg&nbsp;[A]&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[DataLow]&nbsp;A&nbsp;[DataHigh]&nbsp;NA&nbsp;P<br></code><h3><a name="i2cProcessCall"></a><a href="#int"><small>int</small></a> i2cProcessCall<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2cReg">i2cReg</a>, <a href="#unsigned">unsigned</a> <a href="#wVal">wVal</a>)</small></h3>
-This writes 16 bits of data to the specified register of the device
-associated with handle and reads 16 bits of data in return.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>i2cReg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write/read<br>&nbsp;&nbsp;wVal:&nbsp;0-0xFFFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write<br></code><br><br>Returns the word read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Process call. SMBus 2.0 5.5.6
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2cReg&nbsp;[A]&nbsp;wValLow&nbsp;[A]&nbsp;wValHigh&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[DataLow]&nbsp;A&nbsp;[DataHigh]&nbsp;NA&nbsp;P<br></code><h3><a name="i2cWriteBlockData"></a><a href="#int"><small>int</small></a> i2cWriteBlockData<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2cReg">i2cReg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes up to 32 bytes to the specified register of the device
-associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>i2cReg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;with&nbsp;the&nbsp;data&nbsp;to&nbsp;send<br>&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Block write. SMBus 2.0 5.5.7
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2cReg&nbsp;[A]&nbsp;count&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;buf0&nbsp;[A]&nbsp;buf1&nbsp;[A]&nbsp;...&nbsp;[A]&nbsp;bufn&nbsp;[A]&nbsp;P<br></code><h3><a name="i2cReadBlockData"></a><a href="#int"><small>int</small></a> i2cReadBlockData<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2cReg">i2cReg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>)</small></h3>
-This reads a block of up to 32 bytes from the specified register of
-the device associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>i2cReg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data<br></code><br><br>The amount of returned data is set by the device.
-<br><br>Returns the number of bytes read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Block read. SMBus 2.0 5.5.7
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2cReg&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Count]&nbsp;A&nbsp;[buf0]&nbsp;A&nbsp;[buf1]&nbsp;A&nbsp;...&nbsp;A&nbsp;[bufn]&nbsp;NA&nbsp;P<br></code><h3><a name="i2cBlockProcessCall"></a><a href="#int"><small>int</small></a> i2cBlockProcessCall<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2cReg">i2cReg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes data bytes to the specified register of the device
-associated with handle and reads a device specified number
-of bytes of data in return.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>i2cReg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write/read<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;with&nbsp;the&nbsp;data&nbsp;to&nbsp;send&nbsp;and&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data<br>&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write<br></code><br><br>Returns the number of bytes read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>The SMBus 2.0 documentation states that a minimum of 1 byte may be
-sent and a minimum of 1 byte may be received. The total number of
-bytes sent/received must be 32 or less.
-<br><br>Block write-block read. SMBus 2.0 5.5.8
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2cReg&nbsp;[A]&nbsp;count&nbsp;[A]&nbsp;buf0&nbsp;[A]&nbsp;...&nbsp;bufn&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Count]&nbsp;A&nbsp;[buf0]&nbsp;A&nbsp;...&nbsp;[bufn]&nbsp;A&nbsp;P<br></code><h3><a name="i2cReadI2CBlockData"></a><a href="#int"><small>int</small></a> i2cReadI2CBlockData<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2cReg">i2cReg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This reads count bytes from the specified register of the device
-associated with handle . The count may be 1-32.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>i2cReg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data<br>&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read<br></code><br><br>Returns the number of bytes read (&gt;0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br><code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2cReg&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[buf0]&nbsp;A&nbsp;[buf1]&nbsp;A&nbsp;...&nbsp;A&nbsp;[bufn]&nbsp;NA&nbsp;P<br></code><h3><a name="i2cWriteI2CBlockData"></a><a href="#int"><small>int</small></a> i2cWriteI2CBlockData<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2cReg">i2cReg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes 1 to 32 bytes to the specified register of the device
-associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>i2cReg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;data&nbsp;to&nbsp;write<br>&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br><code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2cReg&nbsp;[A]&nbsp;buf0&nbsp;[A]&nbsp;buf1&nbsp;[A]&nbsp;...&nbsp;[A]&nbsp;bufn&nbsp;[A]&nbsp;P<br></code><h3><a name="i2cReadDevice"></a><a href="#int"><small>int</small></a> i2cReadDevice<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This reads count bytes from the raw device into buf.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data&nbsp;bytes<br>&nbsp;count:&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read<br></code><br><br>Returns count (&gt;0) if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_READ_FAILED.
-<br><br><code>S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[buf0]&nbsp;A&nbsp;[buf1]&nbsp;A&nbsp;...&nbsp;A&nbsp;[bufn]&nbsp;NA&nbsp;P<br></code><h3><a name="i2cWriteDevice"></a><a href="#int"><small>int</small></a> i2cWriteDevice<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes count bytes from buf to the raw device.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;containing&nbsp;the&nbsp;data&nbsp;bytes&nbsp;to&nbsp;write<br>&nbsp;count:&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br><code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;buf0&nbsp;[A]&nbsp;buf1&nbsp;[A]&nbsp;...&nbsp;[A]&nbsp;bufn&nbsp;[A]&nbsp;P<br></code><h3><a name="i2cSwitchCombined"></a><a href="#void"><small>void</small></a> i2cSwitchCombined<small>(<a href="#int">int</a> <a href="#setting">setting</a>)</small></h3>
-This sets the I2C (i2c-bcm2708) module "use combined transactions"
-parameter on or off.
-<br><br><code>setting:&nbsp;0&nbsp;to&nbsp;set&nbsp;the&nbsp;parameter&nbsp;off,&nbsp;non-zero&nbsp;to&nbsp;set&nbsp;it&nbsp;on<br></code><br><br>NOTE: when the flag is on a write followed by a read to the same
-slave address will use a repeated start (rather than a stop/start).
-<h3><a name="i2cSegments"></a><a href="#int"><small>int</small></a> i2cSegments<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#pi_i2c_msg_t">pi_i2c_msg_t</a> <a href="#*segs">*segs</a>, <a href="#unsigned">unsigned</a> <a href="#numSegs">numSegs</a>)</small></h3>
-This function executes multiple I2C segments in one transaction by
-calling the I2C_RDWR ioctl.
-<br><br><code>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>&nbsp;&nbsp;&nbsp;segs:&nbsp;an&nbsp;array&nbsp;of&nbsp;I2C&nbsp;segments<br>numSegs:&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;I2C&nbsp;segments<br></code><br><br>Returns the number of segments if OK, otherwise PI_BAD_I2C_SEG.
-<h3><a name="i2cZip"></a><a href="#int"><small>int</small></a> i2cZip<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*inBuf">*inBuf</a>, <a href="#unsigned">unsigned</a> <a href="#inLen">inLen</a>, <a href="#char">char</a> <a href="#*outBuf">*outBuf</a>, <a href="#unsigned">unsigned</a> <a href="#outLen">outLen</a>)</small></h3>
-This function executes a sequence of I2C operations. The
-operations to be performed are specified by the contents of inBuf
-which contains the concatenated command codes and associated data.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>&nbsp;inBuf:&nbsp;pointer&nbsp;to&nbsp;the&nbsp;concatenated&nbsp;I2C&nbsp;commands,&nbsp;see&nbsp;below<br>&nbsp;inLen:&nbsp;size&nbsp;of&nbsp;command&nbsp;buffer<br>outBuf:&nbsp;pointer&nbsp;to&nbsp;buffer&nbsp;to&nbsp;hold&nbsp;returned&nbsp;data<br>outLen:&nbsp;size&nbsp;of&nbsp;output&nbsp;buffer<br></code><br><br>Returns &gt;= 0 if OK (the number of bytes read), otherwise
-PI_BAD_HANDLE, PI_BAD_POINTER, PI_BAD_I2C_CMD, PI_BAD_I2C_RLEN.
-PI_BAD_I2C_WLEN, or PI_BAD_I2C_SEG.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>End</td><td>0</td><td>No more commands</td></tr><tr><td>Escape</td><td>1</td><td>Next P is two bytes</td></tr><tr><td>On</td><td>2</td><td>Switch combined flag on</td></tr><tr><td>Off</td><td>3</td><td>Switch combined flag off</td></tr><tr><td>Address</td><td>4 P</td><td>Set I2C address to P</td></tr><tr><td>Flags</td><td>5 lsb msb</td><td>Set I2C flags to lsb + (msb &lt;&lt; 8)</td></tr><tr><td>Read</td><td>6 P</td><td>Read P bytes of data</td></tr><tr><td>Write</td><td>7 P ...</td><td>Write P bytes of data</td></tr></tbody></table><br><br>The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-<br><br>The address defaults to that associated with the handle.
-The flags default to 0. The address and flags maintain their
-previous value until updated.
-<br><br>The returned I2C data is stored in consecutive locations of outBuf.
-<br><br><b><small>Example</small></b><br><br><code>Set&nbsp;address&nbsp;0x53,&nbsp;write&nbsp;0x32,&nbsp;read&nbsp;6&nbsp;bytes<br>Set&nbsp;address&nbsp;0x1E,&nbsp;write&nbsp;0x03,&nbsp;read&nbsp;6&nbsp;bytes<br>Set&nbsp;address&nbsp;0x68,&nbsp;write&nbsp;0x1B,&nbsp;read&nbsp;8&nbsp;bytes<br>End<br><br>0x04&nbsp;0x53&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x32&nbsp;&nbsp;&nbsp;0x06&nbsp;0x06<br>0x04&nbsp;0x1E&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x03&nbsp;&nbsp;&nbsp;0x06&nbsp;0x06<br>0x04&nbsp;0x68&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x1B&nbsp;&nbsp;&nbsp;0x06&nbsp;0x08<br>0x00<br></code><h3><a name="bbI2COpen"></a><a href="#int"><small>int</small></a> bbI2COpen<small>(<a href="#unsigned">unsigned</a> <a href="#SDA">SDA</a>, <a href="#unsigned">unsigned</a> <a href="#SCL">SCL</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>)</small></h3>
-This function selects a pair of GPIO for bit banging I2C at a
-specified baud rate.
-<br><br>Bit banging I2C allows for certain operations which are not possible
-with the standard I2C driver.
-<br><br>o baud rates as low as 50<br>
-o repeated starts<br>
-o clock stretching<br>
-o I2C on any pair of spare GPIO
-<br><br><code>&nbsp;SDA:&nbsp;0-31<br>&nbsp;SCL:&nbsp;0-31<br>baud:&nbsp;50-500000<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_I2C_BAUD, or
-PI_GPIO_IN_USE.
-<br><br>NOTE:
-<br><br>The GPIO used for SDA and SCL must have pull-ups to 3V3 connected. As
-a guide the hardware pull-ups on pins 3 and 5 are 1k8 in value.
-<h3><a name="bbI2CClose"></a><a href="#int"><small>int</small></a> bbI2CClose<small>(<a href="#unsigned">unsigned</a> <a href="#SDA">SDA</a>)</small></h3>
-This function stops bit banging I2C on a pair of GPIO previously
-opened with <a href="#bbI2COpen">bbI2COpen</a>.
-<br><br><code>SDA:&nbsp;0-31,&nbsp;the&nbsp;SDA&nbsp;GPIO&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bbI2COpen">bbI2COpen</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_I2C_GPIO.
-<h3><a name="bbI2CZip"></a><a href="#int"><small>int</small></a> bbI2CZip<small>(<a href="#unsigned">unsigned</a> <a href="#SDA">SDA</a>, <a href="#char">char</a> <a href="#*inBuf">*inBuf</a>, <a href="#unsigned">unsigned</a> <a href="#inLen">inLen</a>, <a href="#char">char</a> <a href="#*outBuf">*outBuf</a>, <a href="#unsigned">unsigned</a> <a href="#outLen">outLen</a>)</small></h3>
-This function executes a sequence of bit banged I2C operations. The
-operations to be performed are specified by the contents of inBuf
-which contains the concatenated command codes and associated data.
-<br><br><code>&nbsp;&nbsp;&nbsp;SDA:&nbsp;0-31&nbsp;(as&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bbI2COpen">bbI2COpen</a>)<br>&nbsp;inBuf:&nbsp;pointer&nbsp;to&nbsp;the&nbsp;concatenated&nbsp;I2C&nbsp;commands,&nbsp;see&nbsp;below<br>&nbsp;inLen:&nbsp;size&nbsp;of&nbsp;command&nbsp;buffer<br>outBuf:&nbsp;pointer&nbsp;to&nbsp;buffer&nbsp;to&nbsp;hold&nbsp;returned&nbsp;data<br>outLen:&nbsp;size&nbsp;of&nbsp;output&nbsp;buffer<br></code><br><br>Returns &gt;= 0 if OK (the number of bytes read), otherwise
-PI_BAD_USER_GPIO, PI_NOT_I2C_GPIO, PI_BAD_POINTER,
-PI_BAD_I2C_CMD, PI_BAD_I2C_RLEN, PI_BAD_I2C_WLEN,
-PI_I2C_READ_FAILED, or PI_I2C_WRITE_FAILED.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>End</td><td>0</td><td>No more commands</td></tr><tr><td>Escape</td><td>1</td><td>Next P is two bytes</td></tr><tr><td>Start</td><td>2</td><td>Start condition</td></tr><tr><td>Stop</td><td>3</td><td>Stop condition</td></tr><tr><td>Address</td><td>4 P</td><td>Set I2C address to P</td></tr><tr><td>Flags</td><td>5 lsb msb</td><td>Set I2C flags to lsb + (msb &lt;&lt; 8)</td></tr><tr><td>Read</td><td>6 P</td><td>Read P bytes of data</td></tr><tr><td>Write</td><td>7 P ...</td><td>Write P bytes of data</td></tr></tbody></table><br><br>The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-<br><br>The address and flags default to 0. The address and flags maintain
-their previous value until updated.
-<br><br>No flags are currently defined.
-<br><br>The returned I2C data is stored in consecutive locations of outBuf.
-<br><br><b><small>Example</small></b><br><br><code>Set&nbsp;address&nbsp;0x53<br>start,&nbsp;write&nbsp;0x32,&nbsp;(re)start,&nbsp;read&nbsp;6&nbsp;bytes,&nbsp;stop<br>Set&nbsp;address&nbsp;0x1E<br>start,&nbsp;write&nbsp;0x03,&nbsp;(re)start,&nbsp;read&nbsp;6&nbsp;bytes,&nbsp;stop<br>Set&nbsp;address&nbsp;0x68<br>start,&nbsp;write&nbsp;0x1B,&nbsp;(re)start,&nbsp;read&nbsp;8&nbsp;bytes,&nbsp;stop<br>End<br><br>0x04&nbsp;0x53<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x32&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x06&nbsp;0x03<br><br>0x04&nbsp;0x1E<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x03&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x06&nbsp;0x03<br><br>0x04&nbsp;0x68<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x1B&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x08&nbsp;0x03<br><br>0x00<br></code><h3><a name="bscXfer"></a><a href="#int"><small>int</small></a> bscXfer<small>(<a href="#bsc_xfer_t">bsc_xfer_t</a> <a href="#*bsc_xfer">*bsc_xfer</a>)</small></h3>
-This function provides a low-level interface to the SPI/I2C Slave
-peripheral on the BCM chip.
-<br><br>This peripheral allows the Pi to act as a hardware slave device
-on an I2C or SPI bus.
-<br><br>This is not a bit bang version and as such is OS timing
-independent. The bus timing is handled directly by the chip.
-<br><br>The output process is simple. You simply append data to the FIFO
-buffer on the chip. This works like a queue, you add data to the
-queue and the master removes it.
-<br><br>I can't get SPI to work properly. I tried with a
-control word of 0x303 and swapped MISO and MOSI.
-<br><br>The function sets the BSC mode, writes any data in
-the transmit buffer to the BSC transmit FIFO, and
-copies any data in the BSC receive FIFO to the
-receive buffer.
-<br><br><code>bsc_xfer:=&nbsp;a&nbsp;structure&nbsp;defining&nbsp;the&nbsp;transfer<br><br>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;control;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Write<br>&nbsp;&nbsp;&nbsp;int&nbsp;rxCnt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Read&nbsp;only<br>&nbsp;&nbsp;&nbsp;char&nbsp;rxBuf[BSC_FIFO_SIZE];&nbsp;//&nbsp;Read&nbsp;only<br>&nbsp;&nbsp;&nbsp;int&nbsp;txCnt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Write<br>&nbsp;&nbsp;&nbsp;char&nbsp;txBuf[BSC_FIFO_SIZE];&nbsp;//&nbsp;Write<br>}&nbsp;bsc_xfer_t;<br></code><br><br>To start a transfer set control (see below), copy the bytes to
-be added to the transmit FIFO (if any) to txBuf and set txCnt to
-the number of copied bytes.
-<br><br>Upon return rxCnt will be set to the number of received bytes placed
-in rxBuf.
-<br><br>Note that the control word sets the BSC mode. The BSC will stay in
-that mode until a different control word is sent.
-<br><br>GPIO used for models other than those based on the BCM2711.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td><td>MOSI</td><td>SCLK</td><td>MISO</td><td>CE</td></tr><tr><td>I2C</td><td>18</td><td>19</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>SPI</td><td>-</td><td>-</td><td>18</td><td>19</td><td>20</td><td>21</td></tr></tbody></table><br><br>GPIO used for models based on the BCM2711 (e.g. the Pi4B).
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td><td>MOSI</td><td>SCLK</td><td>MISO</td><td>CE</td></tr><tr><td>I2C</td><td>10</td><td>11</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>SPI</td><td>-</td><td>-</td><td>10</td><td>11</td><td>9</td><td>8</td></tr></tbody></table><br><br>When a zero control word is received the used GPIO will be reset
-to INPUT mode.
-<br><br>The returned function value is the status of the transfer (see below).
-<br><br>If there was an error the status will be less than zero
-(and will contain the error code).
-<br><br>The most significant word of the returned status contains the number
-of bytes actually copied from txBuf to the BSC transmit FIFO (may be
-less than requested if the FIFO already contained untransmitted data).
-<br><br>control consists of the following bits.
-<br><br><code>22&nbsp;21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;IT&nbsp;HC&nbsp;TF&nbsp;IR&nbsp;RE&nbsp;TE&nbsp;BK&nbsp;EC&nbsp;ES&nbsp;PL&nbsp;PH&nbsp;I2&nbsp;SP&nbsp;EN<br></code><br><br>Bits 0-13 are copied unchanged to the BSC CR register. See
-pages 163-165 of the Broadcom peripherals document for full
-details.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>aaaaaaa</td><td>defines the I2C slave address (only relevant in I2C mode)</td></tr><tr><td>IT</td><td>invert transmit status flags</td></tr><tr><td>HC</td><td>enable host control</td></tr><tr><td>TF</td><td>enable test FIFO</td></tr><tr><td>IR</td><td>invert receive status flags</td></tr><tr><td>RE</td><td>enable receive</td></tr><tr><td>TE</td><td>enable transmit</td></tr><tr><td>BK</td><td>abort operation and clear FIFOs</td></tr><tr><td>EC</td><td>send control register as first I2C byte</td></tr><tr><td>ES</td><td>send status register as first I2C byte</td></tr><tr><td>PL</td><td>set SPI polarity high</td></tr><tr><td>PH</td><td>set SPI phase high</td></tr><tr><td>I2</td><td>enable I2C mode</td></tr><tr><td>SP</td><td>enable SPI mode</td></tr><tr><td>EN</td><td>enable BSC peripheral</td></tr></tbody></table><br><br>The returned status has the following format
-<br><br><code>20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;RB&nbsp;TE&nbsp;RF&nbsp;TF&nbsp;RE&nbsp;TB<br></code><br><br>Bits 0-15 are copied unchanged from the BSC FR register. See
-pages 165-166 of the Broadcom peripherals document for full
-details.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>SSSSS</td><td>number of bytes successfully copied to transmit FIFO</td></tr><tr><td>RRRRR</td><td>number of bytes in receieve FIFO</td></tr><tr><td>TTTTT</td><td>number of bytes in transmit FIFO</td></tr><tr><td>RB</td><td>receive busy</td></tr><tr><td>TE</td><td>transmit FIFO empty</td></tr><tr><td>RF</td><td>receive FIFO full</td></tr><tr><td>TF</td><td>transmit FIFO full</td></tr><tr><td>RE</td><td>receive FIFO empty</td></tr><tr><td>TB</td><td>transmit busy</td></tr></tbody></table><br><br>The following example shows how to configure the BSC peripheral as
-an I2C slave with address 0x13 and send four bytes.
-<br><br><b><small>Example</small></b><br><br><code>bsc_xfer_t&nbsp;xfer;<br><br>xfer.control&nbsp;=&nbsp;(0x13&lt;&lt;16)&nbsp;|&nbsp;0x305;<br><br>memcpy(xfer.txBuf,&nbsp;"ABCD",&nbsp;4);<br>xfer.txCnt&nbsp;=&nbsp;4;<br><br>status&nbsp;=&nbsp;bscXfer(&xfer);<br><br>if&nbsp;(status&nbsp;&gt;=&nbsp;0)<br>{<br>&nbsp;&nbsp;&nbsp;//&nbsp;process&nbsp;transfer<br>}<br></code><h3><a name="bbSPIOpen"></a><a href="#int"><small>int</small></a> bbSPIOpen<small>(<a href="#unsigned">unsigned</a> <a href="#CS">CS</a>, <a href="#unsigned">unsigned</a> <a href="#MISO">MISO</a>, <a href="#unsigned">unsigned</a> <a href="#MOSI">MOSI</a>, <a href="#unsigned">unsigned</a> <a href="#SCLK">SCLK</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#spiFlags">spiFlags</a>)</small></h3>
-This function selects a set of GPIO for bit banging SPI with
-a specified baud rate and mode.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CS:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;MISO:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;MOSI:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;SCLK:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;50-250000<br>spiFlags:&nbsp;see&nbsp;below<br></code><br><br>spiFlags consists of the least significant 22 bits.
-<br><br><code>21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;p&nbsp;&nbsp;m&nbsp;&nbsp;m<br></code><br><br>mm defines the SPI mode, defaults to 0
-<br><br><code>Mode&nbsp;CPOL&nbsp;CPHA<br>&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0<br>&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;1<br>&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;0<br>&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;1<br></code><br><br>p is 0 if CS is active low (default) and 1 for active high.
-<br><br>T is 1 if the least significant bit is transmitted on MOSI first, the
-default (0) shifts the most significant bit out first.
-<br><br>R is 1 if the least significant bit is received on MISO first, the
-default (0) receives the most significant bit first.
-<br><br>The other bits in flags should be set to zero.
-<br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_SPI_BAUD, or
-PI_GPIO_IN_USE.
-<br><br>If more than one device is connected to the SPI bus (defined by
-SCLK, MOSI, and MISO) each must have its own CS.
-<br><br><b><small>Example</small></b><br><br><code>bbSPIOpen(10,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;10000,&nbsp;0);&nbsp;//&nbsp;device&nbsp;1<br>bbSPIOpen(11,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;20000,&nbsp;3);&nbsp;//&nbsp;device&nbsp;2<br></code><h3><a name="bbSPIClose"></a><a href="#int"><small>int</small></a> bbSPIClose<small>(<a href="#unsigned">unsigned</a> <a href="#CS">CS</a>)</small></h3>
-This function stops bit banging SPI on a set of GPIO
-opened with <a href="#bbSPIOpen">bbSPIOpen</a>.
-<br><br><code>CS:&nbsp;0-31,&nbsp;the&nbsp;CS&nbsp;GPIO&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bbSPIOpen">bbSPIOpen</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_SPI_GPIO.
-<h3><a name="bbSPIXfer"></a><a href="#int"><small>int</small></a> bbSPIXfer<small>(<a href="#unsigned">unsigned</a> <a href="#CS">CS</a>, <a href="#char">char</a> <a href="#*inBuf">*inBuf</a>, <a href="#char">char</a> <a href="#*outBuf">*outBuf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function executes a bit banged SPI transfer.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;CS:&nbsp;0-31&nbsp;(as&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bbSPIOpen">bbSPIOpen</a>)<br>&nbsp;inBuf:&nbsp;pointer&nbsp;to&nbsp;buffer&nbsp;to&nbsp;hold&nbsp;data&nbsp;to&nbsp;be&nbsp;sent<br>outBuf:&nbsp;pointer&nbsp;to&nbsp;buffer&nbsp;to&nbsp;hold&nbsp;returned&nbsp;data<br>&nbsp;count:&nbsp;size&nbsp;of&nbsp;data&nbsp;transfer<br></code><br><br>Returns &gt;= 0 if OK (the number of bytes read), otherwise
-PI_BAD_USER_GPIO, PI_NOT_SPI_GPIO or PI_BAD_POINTER.
-<br><br><b><small>Example</small></b><br><br><code>//&nbsp;gcc&nbsp;-Wall&nbsp;-pthread&nbsp;-o&nbsp;bbSPIx_test&nbsp;bbSPIx_test.c&nbsp;-lpigpio<br>//&nbsp;sudo&nbsp;./bbSPIx_test<br><br>#include&nbsp;&lt;stdio.h&gt;<br><br>#include&nbsp;"pigpio.h"<br><br>#define&nbsp;CE0&nbsp;5<br>#define&nbsp;CE1&nbsp;6<br>#define&nbsp;MISO&nbsp;13<br>#define&nbsp;MOSI&nbsp;19<br>#define&nbsp;SCLK&nbsp;12<br><br>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;*argv[])<br>{<br>&nbsp;&nbsp;&nbsp;int&nbsp;i,&nbsp;count,&nbsp;set_val,&nbsp;read_val;<br>&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;inBuf[3];<br>&nbsp;&nbsp;&nbsp;char&nbsp;cmd1[]&nbsp;=&nbsp;{0,&nbsp;0};<br>&nbsp;&nbsp;&nbsp;char&nbsp;cmd2[]&nbsp;=&nbsp;{12,&nbsp;0};<br>&nbsp;&nbsp;&nbsp;char&nbsp;cmd3[]&nbsp;=&nbsp;{1,&nbsp;128,&nbsp;0};<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(gpioInitialise()&nbsp;&lt;&nbsp;0)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fprintf(stderr,&nbsp;"pigpio&nbsp;initialisation&nbsp;failed.\n");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;1;<br>&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;bbSPIOpen(CE0,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;10000,&nbsp;0);&nbsp;//&nbsp;MCP4251&nbsp;DAC<br>&nbsp;&nbsp;&nbsp;bbSPIOpen(CE1,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;20000,&nbsp;3);&nbsp;//&nbsp;MCP3008&nbsp;ADC<br><br>&nbsp;&nbsp;&nbsp;for&nbsp;(i=0;&nbsp;i&lt;256;&nbsp;i++)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cmd1[1]&nbsp;=&nbsp;i;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count&nbsp;=&nbsp;bbSPIXfer(CE0,&nbsp;cmd1,&nbsp;(char&nbsp;*)inBuf,&nbsp;2);&nbsp;//&nbsp;&gt;&nbsp;DAC<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(count&nbsp;==&nbsp;2)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count&nbsp;=&nbsp;bbSPIXfer(CE0,&nbsp;cmd2,&nbsp;(char&nbsp;*)inBuf,&nbsp;2);&nbsp;//&nbsp;&lt;&nbsp;DAC<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(count&nbsp;==&nbsp;2)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set_val&nbsp;=&nbsp;inBuf[1];<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count&nbsp;=&nbsp;bbSPIXfer(CE1,&nbsp;cmd3,&nbsp;(char&nbsp;*)inBuf,&nbsp;3);&nbsp;//&nbsp;&lt;&nbsp;ADC<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(count&nbsp;==&nbsp;3)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;read_val&nbsp;=&nbsp;((inBuf[1]&3)&lt;&lt;8)&nbsp;|&nbsp;inBuf[2];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("%d&nbsp;%d\n",&nbsp;set_val,&nbsp;read_val);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;bbSPIClose(CE0);<br>&nbsp;&nbsp;&nbsp;bbSPIClose(CE1);<br><br>&nbsp;&nbsp;&nbsp;gpioTerminate();<br><br>&nbsp;&nbsp;&nbsp;return&nbsp;0;<br>}<br></code><h3><a name="spiOpen"></a><a href="#int"><small>int</small></a> spiOpen<small>(<a href="#unsigned">unsigned</a> <a href="#spiChan">spiChan</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#spiFlags">spiFlags</a>)</small></h3>
-This function returns a handle for the SPI device on the channel.
-Data will be transferred at baud bits per second. The flags may
-be used to modify the default behaviour of 4-wire operation, mode 0,
-active low chip select.
-<br><br>The Pi has two SPI peripherals: main and auxiliary.
-<br><br>The main SPI has two chip selects (channels), the auxiliary has
-three.
-<br><br>The auxiliary SPI is available on all models but the A and B.
-<br><br>The GPIO used are given in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>MISO</td><td>MOSI</td><td>SCLK</td><td>CE0</td><td>CE1</td><td>CE2</td></tr><tr><td>Main SPI</td><td>9</td><td>10</td><td>11</td><td>8</td><td>7</td><td>-</td></tr><tr><td>Aux SPI</td><td>19</td><td>20</td><td>21</td><td>18</td><td>17</td><td>16</td></tr></tbody></table><br><br><code>&nbsp;spiChan:&nbsp;0-1&nbsp;(0-2&nbsp;for&nbsp;the&nbsp;auxiliary&nbsp;SPI)<br>&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;32K-125M&nbsp;(values&nbsp;above&nbsp;30M&nbsp;are&nbsp;unlikely&nbsp;to&nbsp;work)<br>spiFlags:&nbsp;see&nbsp;below<br></code><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_BAD_SPI_CHANNEL,
-PI_BAD_SPI_SPEED, PI_BAD_FLAGS, PI_NO_AUX_SPI, or PI_SPI_OPEN_FAILED.
-<br><br>spiFlags consists of the least significant 22 bits.
-<br><br><code>21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;W&nbsp;&nbsp;A&nbsp;u2&nbsp;u1&nbsp;u0&nbsp;p2&nbsp;p1&nbsp;p0&nbsp;&nbsp;m&nbsp;&nbsp;m<br></code><br><br>mm defines the SPI mode.
-<br><br>Warning: modes 1 and 3 do not appear to work on the auxiliary SPI.
-<br><br><code>Mode&nbsp;POL&nbsp;PHA<br>&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;0<br>&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;1<br>&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;0<br>&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;1<br></code><br><br>px is 0 if CEx is active low (default) and 1 for active high.
-<br><br>ux is 0 if the CEx GPIO is reserved for SPI (default) and 1 otherwise.
-<br><br>A is 0 for the main SPI, 1 for the auxiliary SPI.
-<br><br>W is 0 if the device is not 3-wire, 1 if the device is 3-wire. Main
-SPI only.
-<br><br>nnnn defines the number of bytes (0-15) to write before switching
-the MOSI line to MISO to read data. This field is ignored
-if W is not set. Main SPI only.
-<br><br>T is 1 if the least significant bit is transmitted on MOSI first, the
-default (0) shifts the most significant bit out first. Auxiliary SPI
-only.
-<br><br>R is 1 if the least significant bit is received on MISO first, the
-default (0) receives the most significant bit first. Auxiliary SPI
-only.
-<br><br>bbbbbb defines the word size in bits (0-32). The default (0)
-sets 8 bits per word. Auxiliary SPI only.
-<br><br>The <a href="#spiRead">spiRead</a>, <a href="#spiWrite">spiWrite</a>, and <a href="#spiXfer">spiXfer</a> functions
-transfer data packed into 1, 2, or 4 bytes according to
-the word size in bits.
-<br><br>For bits 1-8 there will be one byte per word.<br>
-For bits 9-16 there will be two bytes per word.<br>
-For bits 17-32 there will be four bytes per word.
-<br><br>Multi-byte transfers are made in least significant byte first order.
-<br><br>E.g. to transfer 32 11-bit words buf should contain 64 bytes
-and count should be 64.
-<br><br>E.g. to transfer the 14 bit value 0x1ABC send the bytes 0xBC followed
-by 0x1A.
-<br><br>The other bits in flags should be set to zero.
-<h3><a name="spiClose"></a><a href="#int"><small>int</small></a> spiClose<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This functions closes the SPI device identified by the handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spiOpen">spiOpen</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<h3><a name="spiRead"></a><a href="#int"><small>int</small></a> spiRead<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function reads count bytes of data from the SPI
-device associated with the handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spiOpen">spiOpen</a><br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data&nbsp;bytes<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read<br></code><br><br>Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-<h3><a name="spiWrite"></a><a href="#int"><small>int</small></a> spiWrite<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function writes count bytes of data from buf to the SPI
-device associated with the handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spiOpen">spiOpen</a><br>&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;data&nbsp;bytes&nbsp;to&nbsp;write<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write<br></code><br><br>Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-<h3><a name="spiXfer"></a><a href="#int"><small>int</small></a> spiXfer<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*txBuf">*txBuf</a>, <a href="#char">char</a> <a href="#*rxBuf">*rxBuf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function transfers count bytes of data from txBuf to the SPI
-device associated with the handle. Simultaneously count bytes of
-data are read from the device and placed in rxBuf.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spiOpen">spiOpen</a><br>&nbsp;txBuf:&nbsp;the&nbsp;data&nbsp;bytes&nbsp;to&nbsp;write<br>&nbsp;rxBuf:&nbsp;the&nbsp;received&nbsp;data&nbsp;bytes<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;transfer<br></code><br><br>Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-<h3><a name="serOpen"></a><a href="#int"><small>int</small></a> serOpen<small>(<a href="#char">char</a> <a href="#*sertty">*sertty</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#serFlags">serFlags</a>)</small></h3>
-This function opens a serial device at a specified baud rate
-and with specified flags. The device name must start with
-/dev/tty or /dev/serial.
-<br><br><code>&nbsp;&nbsp;sertty:&nbsp;the&nbsp;serial&nbsp;device&nbsp;to&nbsp;open<br>&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;the&nbsp;baud&nbsp;rate&nbsp;in&nbsp;bits&nbsp;per&nbsp;second,&nbsp;see&nbsp;below<br>serFlags:&nbsp;0<br></code><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_NO_HANDLE, or
-PI_SER_OPEN_FAILED.
-<br><br>The baud rate must be one of 50, 75, 110, 134, 150,
-200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
-38400, 57600, 115200, or 230400.
-<br><br>No flags are currently defined. This parameter should be set to zero.
-<h3><a name="serClose"></a><a href="#int"><small>int</small></a> serClose<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This function closes the serial device associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serOpen">serOpen</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<h3><a name="serWriteByte"></a><a href="#int"><small>int</small></a> serWriteByte<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#bVal">bVal</a>)</small></h3>
-This function writes bVal to the serial port associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serOpen">serOpen</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_SER_WRITE_FAILED.
-<h3><a name="serReadByte"></a><a href="#int"><small>int</small></a> serReadByte<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This function reads a byte from the serial port associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serOpen">serOpen</a><br></code><br><br>Returns the read byte (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_SER_READ_NO_DATA, or PI_SER_READ_FAILED.
-<br><br>If no data is ready PI_SER_READ_NO_DATA is returned.
-<h3><a name="serWrite"></a><a href="#int"><small>int</small></a> serWrite<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function writes count bytes from buf to the the serial port
-associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serOpen">serOpen</a><br>&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;array&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_SER_WRITE_FAILED.
-<h3><a name="serRead"></a><a href="#int"><small>int</small></a> serRead<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function reads up count bytes from the the serial port
-associated with handle and writes them to buf.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serOpen">serOpen</a><br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data<br>&nbsp;count:&nbsp;the&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read<br></code><br><br>Returns the number of bytes read (&gt;0=) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_SER_READ_NO_DATA.
-<br><br>If no data is ready zero is returned.
-<h3><a name="serDataAvailable"></a><a href="#int"><small>int</small></a> serDataAvailable<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This function returns the number of bytes available
-to be read from the device associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serOpen">serOpen</a><br></code><br><br>Returns the number of bytes of data available (&gt;=0) if OK,
-otherwise PI_BAD_HANDLE.
-<h3><a name="gpioTrigger"></a><a href="#int"><small>int</small></a> gpioTrigger<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#pulseLen">pulseLen</a>, <a href="#unsigned">unsigned</a> <a href="#level">level</a>)</small></h3>
-This function sends a trigger pulse to a GPIO. The GPIO is set to
-level for pulseLen microseconds and then reset to not level.
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;pulseLen:&nbsp;1-100<br>&nbsp;&nbsp;&nbsp;&nbsp;level:&nbsp;0,1<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_LEVEL,
-or PI_BAD_PULSELEN.
-<h3><a name="gpioSetWatchdog"></a><a href="#int"><small>int</small></a> gpioSetWatchdog<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#timeout">timeout</a>)</small></h3>
-Sets a watchdog for a GPIO.
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;timeout:&nbsp;0-60000<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_BAD_WDOG_TIMEOUT.
-<br><br>The watchdog is nominally in milliseconds.
-<br><br>One watchdog may be registered per GPIO.
-<br><br>The watchdog may be cancelled by setting timeout to 0.
-<br><br>Until cancelled a timeout will be reported every timeout milliseconds
-after the last GPIO activity.
-<br><br>In particular:
-<br><br>1) any registered alert function for the GPIO will be called with
- the level set to PI_TIMEOUT.
-<br><br>2) any notification for the GPIO will have a report written to the
- fifo with the flags set to indicate a watchdog timeout.
-<br><br><b><small>Example</small></b><br><br><code>void&nbsp;aFunction(int&nbsp;gpio,&nbsp;int&nbsp;level,&nbsp;uint32_t&nbsp;tick)<br>{<br>&nbsp;&nbsp;&nbsp;printf("GPIO&nbsp;%d&nbsp;became&nbsp;%d&nbsp;at&nbsp;%d",&nbsp;gpio,&nbsp;level,&nbsp;tick);<br>}<br><br>//&nbsp;call&nbsp;aFunction&nbsp;whenever&nbsp;GPIO&nbsp;4&nbsp;changes&nbsp;state<br>gpioSetAlertFunc(4,&nbsp;aFunction);<br><br>//&nbsp;&nbsp;or&nbsp;approximately&nbsp;every&nbsp;5&nbsp;millis<br>gpioSetWatchdog(4,&nbsp;5);<br></code><h3><a name="gpioNoiseFilter"></a><a href="#int"><small>int</small></a> gpioNoiseFilter<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#steady">steady</a>, <a href="#unsigned">unsigned</a> <a href="#active">active</a>)</small></h3>
-Sets a noise filter on a GPIO.
-<br><br>Level changes on the GPIO are ignored until a level which has
-been stable for <a href="#steady">steady</a> microseconds is detected. Level changes
-on the GPIO are then reported for <a href="#active">active</a> microseconds after
-which the process repeats.
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;steady:&nbsp;0-300000<br>&nbsp;&nbsp;&nbsp;active:&nbsp;0-1000000<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
-<br><br>This filter affects the GPIO samples returned to callbacks set up
-with <a href="#gpioSetAlertFunc">gpioSetAlertFunc</a>, <a href="#gpioSetAlertFuncEx">gpioSetAlertFuncEx</a>, <a href="#gpioSetGetSamplesFunc">gpioSetGetSamplesFunc</a>,
-and <a href="#gpioSetGetSamplesFuncEx">gpioSetGetSamplesFuncEx</a>.
-<br><br>It does not affect interrupts set up with <a href="#gpioSetISRFunc">gpioSetISRFunc</a>,
-<a href="#gpioSetISRFuncEx">gpioSetISRFuncEx</a>, or levels read by <a href="#gpioRead">gpioRead</a>,
-<a href="#gpioRead_Bits_0_31">gpioRead_Bits_0_31</a>, or <a href="#gpioRead_Bits_32_53">gpioRead_Bits_32_53</a>.
-<br><br>Level changes before and after the active period may
-be reported. Your software must be designed to cope with
-such reports.
-<h3><a name="gpioGlitchFilter"></a><a href="#int"><small>int</small></a> gpioGlitchFilter<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#steady">steady</a>)</small></h3>
-Sets a glitch filter on a GPIO.
-<br><br>Level changes on the GPIO are not reported unless the level
-has been stable for at least <a href="#steady">steady</a> microseconds. The
-level is then reported. Level changes of less than <a href="#steady">steady</a>
-microseconds are ignored.
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;steady:&nbsp;0-300000<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
-<br><br>This filter affects the GPIO samples returned to callbacks set up
-with <a href="#gpioSetAlertFunc">gpioSetAlertFunc</a>, <a href="#gpioSetAlertFuncEx">gpioSetAlertFuncEx</a>, <a href="#gpioSetGetSamplesFunc">gpioSetGetSamplesFunc</a>,
-and <a href="#gpioSetGetSamplesFuncEx">gpioSetGetSamplesFuncEx</a>.
-<br><br>It does not affect interrupts set up with <a href="#gpioSetISRFunc">gpioSetISRFunc</a>,
-<a href="#gpioSetISRFuncEx">gpioSetISRFuncEx</a>, or levels read by <a href="#gpioRead">gpioRead</a>,
-<a href="#gpioRead_Bits_0_31">gpioRead_Bits_0_31</a>, or <a href="#gpioRead_Bits_32_53">gpioRead_Bits_32_53</a>.
-<br><br>Each (stable) edge will be timestamped <a href="#steady">steady</a> microseconds
-after it was first detected.
-<h3><a name="gpioSetGetSamplesFunc"></a><a href="#int"><small>int</small></a> gpioSetGetSamplesFunc<small>(<a href="#gpioGetSamplesFunc_t">gpioGetSamplesFunc_t</a> <a href="#f">f</a>, <a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Registers a function to be called (a callback) every millisecond
-with the latest GPIO samples.
-<br><br><code>&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;function&nbsp;to&nbsp;call<br>bits:&nbsp;the&nbsp;GPIO&nbsp;of&nbsp;interest<br></code><br><br>Returns 0 if OK.
-<br><br>The function is passed a pointer to the samples (an array of
-<a href="#gpioSample_t">gpioSample_t</a>), and the number of samples.
-<br><br>Only one function can be registered.
-<br><br>The callback may be cancelled by passing NULL as the function.
-<br><br>The samples returned will be the union of bits, plus any active alerts,
-plus any active notifications.
-<br><br>e.g. if there are alerts for GPIO 7, 8, and 9, notifications for GPIO
-8, 10, 23, 24, and bits is (1&lt;&lt;23)|(1&lt;&lt;17) then samples for GPIO
-7, 8, 9, 10, 17, 23, and 24 will be reported.
-<h3><a name="gpioSetGetSamplesFuncEx"></a><a href="#int"><small>int</small></a> gpioSetGetSamplesFuncEx<small>(<a href="#gpioGetSamplesFuncEx_t">gpioGetSamplesFuncEx_t</a> <a href="#f">f</a>, <a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-Registers a function to be called (a callback) every millisecond
-with the latest GPIO samples.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;function&nbsp;to&nbsp;call<br>&nbsp;&nbsp;&nbsp;&nbsp;bits:&nbsp;the&nbsp;GPIO&nbsp;of&nbsp;interest<br>userdata:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;arbitrary&nbsp;user&nbsp;data<br></code><br><br>Returns 0 if OK.
-<br><br>The function is passed a pointer to the samples (an array of
-<a href="#gpioSample_t">gpioSample_t</a>), the number of samples, and the userdata pointer.
-<br><br>Only one of <a href="#gpioGetSamplesFunc">gpioGetSamplesFunc</a> or <a href="#gpioGetSamplesFuncEx">gpioGetSamplesFuncEx</a> can be
-registered.
-<br><br>See <a href="#gpioSetGetSamplesFunc">gpioSetGetSamplesFunc</a> for further details.
-<h3><a name="gpioSetTimerFunc"></a><a href="#int"><small>int</small></a> gpioSetTimerFunc<small>(<a href="#unsigned">unsigned</a> <a href="#timer">timer</a>, <a href="#unsigned">unsigned</a> <a href="#millis">millis</a>, <a href="#gpioTimerFunc_t">gpioTimerFunc_t</a> <a href="#f">f</a>)</small></h3>
-Registers a function to be called (a callback) every millis milliseconds.
-<br><br><code>&nbsp;timer:&nbsp;0-9<br>millis:&nbsp;10-60000<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;function&nbsp;to&nbsp;call<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_TIMER, PI_BAD_MS, or PI_TIMER_FAILED.
-<br><br>10 timers are supported numbered 0 to 9.
-<br><br>One function may be registered per timer.
-<br><br>The timer may be cancelled by passing NULL as the function.
-<br><br><b><small>Example</small></b><br><br><code>void&nbsp;bFunction(void)<br>{<br>&nbsp;&nbsp;&nbsp;printf("two&nbsp;seconds&nbsp;have&nbsp;elapsed");<br>}<br><br>//&nbsp;call&nbsp;bFunction&nbsp;every&nbsp;2000&nbsp;milliseconds<br>gpioSetTimerFunc(0,&nbsp;2000,&nbsp;bFunction);<br></code><h3><a name="gpioSetTimerFuncEx"></a><a href="#int"><small>int</small></a> gpioSetTimerFuncEx<small>(<a href="#unsigned">unsigned</a> <a href="#timer">timer</a>, <a href="#unsigned">unsigned</a> <a href="#millis">millis</a>, <a href="#gpioTimerFuncEx_t">gpioTimerFuncEx_t</a> <a href="#f">f</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-Registers a function to be called (a callback) every millis milliseconds.
-<br><br><code>&nbsp;&nbsp;&nbsp;timer:&nbsp;0-9.<br>&nbsp;&nbsp;millis:&nbsp;10-60000<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;function&nbsp;to&nbsp;call<br>userdata:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;arbitrary&nbsp;user&nbsp;data<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_TIMER, PI_BAD_MS, or PI_TIMER_FAILED.
-<br><br>The function is passed the userdata pointer.
-<br><br>Only one of <a href="#gpioSetTimerFunc">gpioSetTimerFunc</a> or <a href="#gpioSetTimerFuncEx">gpioSetTimerFuncEx</a> can be
-registered per timer.
-<br><br>See <a href="#gpioSetTimerFunc">gpioSetTimerFunc</a> for further details.
-<h3><a name="gpioStartThread"></a><a href="#pthread_t"><small>pthread_t</small></a> *gpioStartThread<small>(<a href="#gpioThreadFunc_t">gpioThreadFunc_t</a> <a href="#f">f</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-Starts a new thread of execution with f as the main routine.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;main&nbsp;function&nbsp;for&nbsp;the&nbsp;new&nbsp;thread<br>userdata:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;arbitrary&nbsp;user&nbsp;data<br></code><br><br>Returns a pointer to pthread_t if OK, otherwise NULL.
-<br><br>The function is passed the single argument arg.
-<br><br>The thread can be cancelled by passing the pointer to pthread_t to
-<a href="#gpioStopThread">gpioStopThread</a>.
-<br><br><b><small>Example</small></b><br><br><code>#include&nbsp;&lt;stdio.h&gt;<br>#include&nbsp;&lt;pigpio.h&gt;<br><br>void&nbsp;*myfunc(void&nbsp;*arg)<br>{<br>&nbsp;&nbsp;&nbsp;while&nbsp;(1)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("%s",&nbsp;arg);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sleep(1);<br>&nbsp;&nbsp;&nbsp;}<br>}<br><br>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;*argv[])<br>{<br>&nbsp;&nbsp;&nbsp;pthread_t&nbsp;*p1,&nbsp;*p2,&nbsp;*p3;<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(gpioInitialise()&nbsp;&lt;&nbsp;0)&nbsp;return&nbsp;1;<br><br>&nbsp;&nbsp;&nbsp;p1&nbsp;=&nbsp;gpioStartThread(myfunc,&nbsp;"thread&nbsp;1");&nbsp;sleep(3);<br><br>&nbsp;&nbsp;&nbsp;p2&nbsp;=&nbsp;gpioStartThread(myfunc,&nbsp;"thread&nbsp;2");&nbsp;sleep(3);<br><br>&nbsp;&nbsp;&nbsp;p3&nbsp;=&nbsp;gpioStartThread(myfunc,&nbsp;"thread&nbsp;3");&nbsp;sleep(3);<br><br>&nbsp;&nbsp;&nbsp;gpioStopThread(p3);&nbsp;sleep(3);<br><br>&nbsp;&nbsp;&nbsp;gpioStopThread(p2);&nbsp;sleep(3);<br><br>&nbsp;&nbsp;&nbsp;gpioStopThread(p1);&nbsp;sleep(3);<br><br>&nbsp;&nbsp;&nbsp;gpioTerminate();<br>}<br></code><h3><a name="gpioStopThread"></a><a href="#void"><small>void</small></a> gpioStopThread<small>(<a href="#pthread_t">pthread_t</a> <a href="#*pth">*pth</a>)</small></h3>
-Cancels the thread pointed at by pth.
-<br><br><code>pth:&nbsp;a&nbsp;thread&nbsp;pointer&nbsp;returned&nbsp;by&nbsp;<a href="#gpioStartThread">gpioStartThread</a><br></code><br><br>No value is returned.
-<br><br>The thread to be stopped should have been started with <a href="#gpioStartThread">gpioStartThread</a>.
-<h3><a name="gpioStoreScript"></a><a href="#int"><small>int</small></a> gpioStoreScript<small>(<a href="#char">char</a> <a href="#*script">*script</a>)</small></h3>
-This function stores a null terminated script for later execution.
-<br><br>See <a href="http://abyz.me.uk/rpi/pigpio/pigs.html#Scripts">http://abyz.me.uk/rpi/pigpio/pigs.html#Scripts</a> for details.
-<br><br><code>script:&nbsp;the&nbsp;text&nbsp;of&nbsp;the&nbsp;script<br></code><br><br>The function returns a script id if the script is valid,
-otherwise PI_BAD_SCRIPT.
-<h3><a name="gpioRunScript"></a><a href="#int"><small>int</small></a> gpioRunScript<small>(<a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>, <a href="#unsigned">unsigned</a> <a href="#numPar">numPar</a>, <a href="#uint32_t">uint32_t</a> <a href="#*param">*param</a>)</small></h3>
-This function runs a stored script.
-<br><br><code>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioStoreScript">gpioStoreScript</a><br>&nbsp;&nbsp;&nbsp;numPar:&nbsp;0-10,&nbsp;the&nbsp;number&nbsp;of&nbsp;parameters<br>&nbsp;&nbsp;&nbsp;&nbsp;param:&nbsp;an&nbsp;array&nbsp;of&nbsp;parameters<br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID, or
-PI_TOO_MANY_PARAM.
-<br><br>param is an array of up to 10 parameters which may be referenced in
-the script as p0 to p9.
-<h3><a name="gpioRunScript"></a><a href="#int"><small>int</small></a> gpioRunScript<small>(<a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>, <a href="#unsigned">unsigned</a> <a href="#numPar">numPar</a>, <a href="#uint32_t">uint32_t</a> <a href="#*param">*param</a>)</small></h3>
-This function runs a stored script.
-<br><br><code>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioStoreScript">gpioStoreScript</a><br>&nbsp;&nbsp;&nbsp;numPar:&nbsp;0-10,&nbsp;the&nbsp;number&nbsp;of&nbsp;parameters<br>&nbsp;&nbsp;&nbsp;&nbsp;param:&nbsp;an&nbsp;array&nbsp;of&nbsp;parameters<br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID, or
-PI_TOO_MANY_PARAM.
-<br><br>param is an array of up to 10 parameters which may be referenced in
-the script as p0 to p9.
-<h3><a name="gpioUpdateScript"></a><a href="#int"><small>int</small></a> gpioUpdateScript<small>(<a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>, <a href="#unsigned">unsigned</a> <a href="#numPar">numPar</a>, <a href="#uint32_t">uint32_t</a> <a href="#*param">*param</a>)</small></h3>
-This function sets the parameters of a script. The script may or
-may not be running. The first numPar parameters of the script are
-overwritten with the new values.
-<br><br><code>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioStoreScript">gpioStoreScript</a><br>&nbsp;&nbsp;&nbsp;numPar:&nbsp;0-10,&nbsp;the&nbsp;number&nbsp;of&nbsp;parameters<br>&nbsp;&nbsp;&nbsp;&nbsp;param:&nbsp;an&nbsp;array&nbsp;of&nbsp;parameters<br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID, or
-PI_TOO_MANY_PARAM.
-<br><br>param is an array of up to 10 parameters which may be referenced in
-the script as p0 to p9.
-<h3><a name="gpioScriptStatus"></a><a href="#int"><small>int</small></a> gpioScriptStatus<small>(<a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>, <a href="#uint32_t">uint32_t</a> <a href="#*param">*param</a>)</small></h3>
-This function returns the run status of a stored script as well as
-the current values of parameters 0 to 9.
-<br><br><code>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioStoreScript">gpioStoreScript</a><br>&nbsp;&nbsp;&nbsp;&nbsp;param:&nbsp;an&nbsp;array&nbsp;to&nbsp;hold&nbsp;the&nbsp;returned&nbsp;10&nbsp;parameters<br></code><br><br>The function returns greater than or equal to 0 if OK,
-otherwise PI_BAD_SCRIPT_ID.
-<br><br>The run status may be
-<br><br><code>PI_SCRIPT_INITING<br>PI_SCRIPT_HALTED<br>PI_SCRIPT_RUNNING<br>PI_SCRIPT_WAITING<br>PI_SCRIPT_FAILED<br></code><br><br>The current value of script parameters 0 to 9 are returned in param.
-<h3><a name="gpioStopScript"></a><a href="#int"><small>int</small></a> gpioStopScript<small>(<a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>)</small></h3>
-This function stops a running script.
-<br><br><code>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioStoreScript">gpioStoreScript</a><br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID.
-<h3><a name="gpioDeleteScript"></a><a href="#int"><small>int</small></a> gpioDeleteScript<small>(<a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>)</small></h3>
-This function deletes a stored script.
-<br><br><code>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioStoreScript">gpioStoreScript</a><br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID.
-<h3><a name="gpioSetSignalFunc"></a><a href="#int"><small>int</small></a> gpioSetSignalFunc<small>(<a href="#unsigned">unsigned</a> <a href="#signum">signum</a>, <a href="#gpioSignalFunc_t">gpioSignalFunc_t</a> <a href="#f">f</a>)</small></h3>
-Registers a function to be called (a callback) when a signal occurs.
-<br><br><code>signum:&nbsp;0-63<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_SIGNUM.
-<br><br>The function is passed the signal number.
-<br><br>One function may be registered per signal.
-<br><br>The callback may be cancelled by passing NULL.
-<br><br>By default all signals are treated as fatal and cause the library
-to call gpioTerminate and then exit.
-<h3><a name="gpioSetSignalFuncEx"></a><a href="#int"><small>int</small></a> gpioSetSignalFuncEx<small>(<a href="#unsigned">unsigned</a> <a href="#signum">signum</a>, <a href="#gpioSignalFuncEx_t">gpioSignalFuncEx_t</a> <a href="#f">f</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-Registers a function to be called (a callback) when a signal occurs.
-<br><br><code>&nbsp;&nbsp;signum:&nbsp;0-63<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function<br>userdata:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;arbitrary&nbsp;user&nbsp;data<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_SIGNUM.
-<br><br>The function is passed the signal number and the userdata pointer.
-<br><br>Only one of gpioSetSignalFunc or gpioSetSignalFuncEx can be
-registered per signal.
-<br><br>See gpioSetSignalFunc for further details.
-<h3><a name="gpioRead_Bits_0_31"></a><a href="#uint32_t"><small>uint32_t</small></a> gpioRead_Bits_0_31<small>(void)</small></h3>
-Returns the current level of GPIO 0-31.
-<h3><a name="gpioRead_Bits_32_53"></a><a href="#uint32_t"><small>uint32_t</small></a> gpioRead_Bits_32_53<small>(void)</small></h3>
-Returns the current level of GPIO 32-53.
-<h3><a name="gpioWrite_Bits_0_31_Clear"></a><a href="#int"><small>int</small></a> gpioWrite_Bits_0_31_Clear<small>(<a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Clears GPIO 0-31 if the corresponding bit in bits is set.
-<br><br><code>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;of&nbsp;GPIO&nbsp;to&nbsp;clear<br></code><br><br>Returns 0 if OK.
-<br><br><b><small>Example</small></b><br><br><code>//&nbsp;To&nbsp;clear&nbsp;(set&nbsp;to&nbsp;0)&nbsp;GPIO&nbsp;4,&nbsp;7,&nbsp;and&nbsp;15<br>gpioWrite_Bits_0_31_Clear(&nbsp;(1&lt;&lt;4)&nbsp;|&nbsp;(1&lt;&lt;7)&nbsp;|&nbsp;(1&lt;&lt;15)&nbsp;);<br></code><h3><a name="gpioWrite_Bits_32_53_Clear"></a><a href="#int"><small>int</small></a> gpioWrite_Bits_32_53_Clear<small>(<a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Clears GPIO 32-53 if the corresponding bit (0-21) in bits is set.
-<br><br><code>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;of&nbsp;GPIO&nbsp;to&nbsp;clear<br></code><br><br>Returns 0 if OK.
-<h3><a name="gpioWrite_Bits_0_31_Set"></a><a href="#int"><small>int</small></a> gpioWrite_Bits_0_31_Set<small>(<a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Sets GPIO 0-31 if the corresponding bit in bits is set.
-<br><br><code>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;of&nbsp;GPIO&nbsp;to&nbsp;set<br></code><br><br>Returns 0 if OK.
-<h3><a name="gpioWrite_Bits_32_53_Set"></a><a href="#int"><small>int</small></a> gpioWrite_Bits_32_53_Set<small>(<a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Sets GPIO 32-53 if the corresponding bit (0-21) in bits is set.
-<br><br><code>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;of&nbsp;GPIO&nbsp;to&nbsp;set<br></code><br><br>Returns 0 if OK.
-<br><br><b><small>Example</small></b><br><br><code>//&nbsp;To&nbsp;set&nbsp;(set&nbsp;to&nbsp;1)&nbsp;GPIO&nbsp;32,&nbsp;40,&nbsp;and&nbsp;53<br>gpioWrite_Bits_32_53_Set((1&lt;&lt;(32-32))&nbsp;|&nbsp;(1&lt;&lt;(40-32))&nbsp;|&nbsp;(1&lt;&lt;(53-32)));<br></code><h3><a name="gpioHardwareClock"></a><a href="#int"><small>int</small></a> gpioHardwareClock<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#clkfreq">clkfreq</a>)</small></h3>
-Starts a hardware clock on a GPIO at the specified frequency.
-Frequencies above 30MHz are unlikely to work.
-<br><br><code>&nbsp;&nbsp;&nbsp;gpio:&nbsp;see&nbsp;description<br>clkfreq:&nbsp;0&nbsp;(off)&nbsp;or&nbsp;4689-250M&nbsp;(13184-375M&nbsp;for&nbsp;the&nbsp;BCM2711)<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO, PI_NOT_HCLK_GPIO,
-PI_BAD_HCLK_FREQ,or PI_BAD_HCLK_PASS.
-<br><br>The same clock is available on multiple GPIO. The latest
-frequency setting will be used by all GPIO which share a clock.
-<br><br>The GPIO must be one of the following.
-<br><br><code>4&nbsp;&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;All&nbsp;models<br>5&nbsp;&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br>6&nbsp;&nbsp;&nbsp;clock&nbsp;2&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>20&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>21&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;Rev.2&nbsp;B&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br><br>32&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>34&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>42&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br>43&nbsp;&nbsp;clock&nbsp;2&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>44&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br></code><br><br>Access to clock 1 is protected by a password as its use will likely
-crash the Pi. The password is given by or'ing 0x5A000000 with the
-GPIO number.
-<h3><a name="gpioHardwarePWM"></a><a href="#int"><small>int</small></a> gpioHardwarePWM<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#PWMfreq">PWMfreq</a>, <a href="#unsigned">unsigned</a> <a href="#PWMduty">PWMduty</a>)</small></h3>
-Starts hardware PWM on a GPIO at the specified frequency and dutycycle.
-Frequencies above 30MHz are unlikely to work.
-<br><br>NOTE: Any waveform started by <a href="#gpioWaveTxSend">gpioWaveTxSend</a>, or
-<a href="#gpioWaveChain">gpioWaveChain</a> will be cancelled.
-<br><br>This function is only valid if the pigpio main clock is PCM. The
-main clock defaults to PCM but may be overridden by a call to
-<a href="#gpioCfgClock">gpioCfgClock</a>.
-<br><br><code>&nbsp;&nbsp;&nbsp;gpio:&nbsp;see&nbsp;description<br>PWMfreq:&nbsp;0&nbsp;(off)&nbsp;or&nbsp;1-125M&nbsp;(1-187.5M&nbsp;for&nbsp;the&nbsp;BCM2711)<br>PWMduty:&nbsp;0&nbsp;(off)&nbsp;to&nbsp;1000000&nbsp;(1M)(fully&nbsp;on)<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO, PI_NOT_HPWM_GPIO,
-PI_BAD_HPWM_DUTY, PI_BAD_HPWM_FREQ, or PI_HPWM_ILLEGAL.
-<br><br>The same PWM channel is available on multiple GPIO. The latest
-frequency and dutycycle setting will be used by all GPIO which
-share a PWM channel.
-<br><br>The GPIO must be one of the following.
-<br><br><code>12&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>13&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>18&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;All&nbsp;models<br>19&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br><br>40&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>41&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>45&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>52&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>53&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br></code><br><br>The actual number of steps beween off and fully on is the
-integral part of 250M/PWMfreq (375M/PWMfreq for the BCM2711).
-<br><br>The actual frequency set is 250M/steps (375M/steps for the BCM2711).
-<br><br>There will only be a million steps for a PWMfreq of 250 (375 for
-the BCM2711). Lower frequencies will have more steps and higher
-frequencies will have fewer steps. PWMduty is
-automatically scaled to take this into account.
-<h3><a name="gpioTime"></a><a href="#int"><small>int</small></a> gpioTime<small>(<a href="#unsigned">unsigned</a> <a href="#timetype">timetype</a>, <a href="#int">int</a> <a href="#*seconds">*seconds</a>, <a href="#int">int</a> <a href="#*micros">*micros</a>)</small></h3>
-Updates the seconds and micros variables with the current time.
-<br><br><code>timetype:&nbsp;0&nbsp;(relative),&nbsp;1&nbsp;(absolute)<br>&nbsp;seconds:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;an&nbsp;int&nbsp;to&nbsp;hold&nbsp;seconds<br>&nbsp;&nbsp;micros:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;an&nbsp;int&nbsp;to&nbsp;hold&nbsp;microseconds<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_TIMETYPE.
-<br><br>If timetype is PI_TIME_ABSOLUTE updates seconds and micros with the
-number of seconds and microseconds since the epoch (1st January 1970).
-<br><br>If timetype is PI_TIME_RELATIVE updates seconds and micros with the
-number of seconds and microseconds since the library was initialised.
-<br><br><b><small>Example</small></b><br><br><code>int&nbsp;secs,&nbsp;mics;<br><br>//&nbsp;print&nbsp;the&nbsp;number&nbsp;of&nbsp;seconds&nbsp;since&nbsp;the&nbsp;library&nbsp;was&nbsp;started<br>gpioTime(PI_TIME_RELATIVE,&nbsp;&secs,&nbsp;&mics);<br>printf("library&nbsp;started&nbsp;%d.%03d&nbsp;seconds&nbsp;ago",&nbsp;secs,&nbsp;mics/1000);<br></code><h3><a name="gpioSleep"></a><a href="#int"><small>int</small></a> gpioSleep<small>(<a href="#unsigned">unsigned</a> <a href="#timetype">timetype</a>, <a href="#int">int</a> <a href="#seconds">seconds</a>, <a href="#int">int</a> <a href="#micros">micros</a>)</small></h3>
-Sleeps for the number of seconds and microseconds specified by seconds
-and micros.
-<br><br><code>timetype:&nbsp;0&nbsp;(relative),&nbsp;1&nbsp;(absolute)<br>&nbsp;seconds:&nbsp;seconds&nbsp;to&nbsp;sleep<br>&nbsp;&nbsp;micros:&nbsp;microseconds&nbsp;to&nbsp;sleep<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_TIMETYPE, PI_BAD_SECONDS,
-or PI_BAD_MICROS.
-<br><br>If timetype is PI_TIME_ABSOLUTE the sleep ends when the number of seconds
-and microseconds since the epoch (1st January 1970) has elapsed. System
-clock changes are taken into account.
-<br><br>If timetype is PI_TIME_RELATIVE the sleep is for the specified number
-of seconds and microseconds. System clock changes do not effect the
-sleep length.
-<br><br>For short delays (say, 50 microseonds or less) use <a href="#gpioDelay">gpioDelay</a>.
-<br><br><b><small>Example</small></b><br><br><code>gpioSleep(PI_TIME_RELATIVE,&nbsp;2,&nbsp;500000);&nbsp;//&nbsp;sleep&nbsp;for&nbsp;2.5&nbsp;seconds<br><br>gpioSleep(PI_TIME_RELATIVE,&nbsp;0,&nbsp;100000);&nbsp;//&nbsp;sleep&nbsp;for&nbsp;0.1&nbsp;seconds<br><br>gpioSleep(PI_TIME_RELATIVE,&nbsp;60,&nbsp;0);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;sleep&nbsp;for&nbsp;one&nbsp;minute<br></code><h3><a name="gpioDelay"></a><a href="#uint32_t"><small>uint32_t</small></a> gpioDelay<small>(<a href="#uint32_t">uint32_t</a> <a href="#micros">micros</a>)</small></h3>
-Delays for at least the number of microseconds specified by micros.
-<br><br><code>micros:&nbsp;the&nbsp;number&nbsp;of&nbsp;microseconds&nbsp;to&nbsp;sleep<br></code><br><br>Returns the actual length of the delay in microseconds.
-<br><br>Delays of 100 microseconds or less use busy waits.
-<h3><a name="gpioTick"></a><a href="#uint32_t"><small>uint32_t</small></a> gpioTick<small>(void)</small></h3>
-Returns the current system tick.
-<br><br>Tick is the number of microseconds since system boot.
-<br><br>As tick is an unsigned 32 bit quantity it wraps around after
-2^32 microseconds, which is approximately 1 hour 12 minutes.
-<br><br>You don't need to worry about the wrap around as long as you
-take a tick (uint32_t) from another tick, i.e. the following
-code will always provide the correct difference.
-<br><br><b><small>Example</small></b><br><br><code>uint32_t&nbsp;startTick,&nbsp;endTick;<br>int&nbsp;diffTick;<br><br>startTick&nbsp;=&nbsp;gpioTick();<br><br>//&nbsp;do&nbsp;some&nbsp;processing<br><br>endTick&nbsp;=&nbsp;gpioTick();<br><br>diffTick&nbsp;=&nbsp;endTick&nbsp;-&nbsp;startTick;<br><br>printf("some&nbsp;processing&nbsp;took&nbsp;%d&nbsp;microseconds",&nbsp;diffTick);<br></code><h3><a name="gpioHardwareRevision"></a><a href="#unsigned"><small>unsigned</small></a> gpioHardwareRevision<small>(void)</small></h3>
-Returns the hardware revision.
-<br><br>If the hardware revision can not be found or is not a valid hexadecimal
-number the function returns 0.
-<br><br>The hardware revision is the last few characters on the Revision line of
-/proc/cpuinfo.
-<br><br>The revision number can be used to determine the assignment of GPIO
-to pins (see <a href="#gpio">gpio</a>).
-<br><br>There are at least three types of board.
-<br><br>Type 1 boards have hardware revision numbers of 2 and 3.
-<br><br>Type 2 boards have hardware revision numbers of 4, 5, 6, and 15.
-<br><br>Type 3 boards have hardware revision numbers of 16 or greater.
-<br><br>for "Revision : 0002" the function returns 2.<br>
-for "Revision : 000f" the function returns 15.<br>
-for "Revision : 000g" the function returns 0.
-<h3><a name="gpioVersion"></a><a href="#unsigned"><small>unsigned</small></a> gpioVersion<small>(void)</small></h3>
-Returns the pigpio version.
-<h3><a name="gpioGetPad"></a><a href="#int"><small>int</small></a> gpioGetPad<small>(<a href="#unsigned">unsigned</a> <a href="#pad">pad</a>)</small></h3>
-This function returns the pad drive strength in mA.
-<br><br><code>pad:&nbsp;0-2,&nbsp;the&nbsp;pad&nbsp;to&nbsp;get<br></code><br><br>Returns the pad drive strength if OK, otherwise PI_BAD_PAD.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>strength&nbsp;=&nbsp;gpioGetPad(1);&nbsp;//&nbsp;get&nbsp;pad&nbsp;1&nbsp;strength<br></code><h3><a name="gpioSetPad"></a><a href="#int"><small>int</small></a> gpioSetPad<small>(<a href="#unsigned">unsigned</a> <a href="#pad">pad</a>, <a href="#unsigned">unsigned</a> <a href="#padStrength">padStrength</a>)</small></h3>
-This function sets the pad drive strength in mA.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pad:&nbsp;0-2,&nbsp;the&nbsp;pad&nbsp;to&nbsp;set<br>padStrength:&nbsp;1-16&nbsp;mA<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_PAD, or PI_BAD_STRENGTH.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>gpioSetPad(0,&nbsp;16);&nbsp;//&nbsp;set&nbsp;pad&nbsp;0&nbsp;strength&nbsp;to&nbsp;16&nbsp;mA<br></code><h3><a name="eventMonitor"></a><a href="#int"><small>int</small></a> eventMonitor<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-This function selects the events to be reported on a previously
-opened handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioNotifyOpen">gpioNotifyOpen</a><br>&nbsp;&nbsp;bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;indicating&nbsp;the&nbsp;events&nbsp;of&nbsp;interest<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<br><br>A report is sent each time an event is triggered providing the
-corresponding bit in bits is set.
-<br><br>See <a href="#gpioNotifyBegin">gpioNotifyBegin</a> for the notification format.
-<br><br><b><small>Example</small></b><br><br><code>//&nbsp;Start&nbsp;reporting&nbsp;events&nbsp;3,&nbsp;6,&nbsp;and&nbsp;7.<br><br>//&nbsp;&nbsp;bit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;76543210<br>//&nbsp;(0xC8&nbsp;=&nbsp;0b11001000)<br><br>eventMonitor(h,&nbsp;0xC8);<br></code><h3><a name="eventSetFunc"></a><a href="#int"><small>int</small></a> eventSetFunc<small>(<a href="#unsigned">unsigned</a> <a href="#event">event</a>, <a href="#eventFunc_t">eventFunc_t</a> <a href="#f">f</a>)</small></h3>
-Registers a function to be called (a callback) when the specified
-event occurs.
-<br><br><code>event:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_EVENT_ID.
-<br><br>One function may be registered per event.
-<br><br>The function is passed the event, and the tick.
-<br><br>The callback may be cancelled by passing NULL as the function.
-<h3><a name="eventSetFuncEx"></a><a href="#int"><small>int</small></a> eventSetFuncEx<small>(<a href="#unsigned">unsigned</a> <a href="#event">event</a>, <a href="#eventFuncEx_t">eventFuncEx_t</a> <a href="#f">f</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-Registers a function to be called (a callback) when the specified
-event occurs.
-<br><br><code>&nbsp;&nbsp;&nbsp;event:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function<br>userdata:&nbsp;pointer&nbsp;to&nbsp;arbitrary&nbsp;user&nbsp;data<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_EVENT_ID.
-<br><br>One function may be registered per event.
-<br><br>The function is passed the event, the tick, and the ueserdata pointer.
-<br><br>The callback may be cancelled by passing NULL as the function.
-<br><br>Only one of <a href="#eventSetFunc">eventSetFunc</a> or <a href="#eventSetFuncEx">eventSetFuncEx</a> can be
-registered per event.
-<h3><a name="eventTrigger"></a><a href="#int"><small>int</small></a> eventTrigger<small>(<a href="#unsigned">unsigned</a> <a href="#event">event</a>)</small></h3>
-This function signals the occurrence of an event.
-<br><br><code>event:&nbsp;0-31,&nbsp;the&nbsp;event<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_EVENT_ID.
-<br><br>An event is a signal used to inform one or more consumers
-to start an action. Each consumer which has registered an interest
-in the event (e.g. by calling <a href="#eventSetFunc">eventSetFunc</a>) will be informed by
-a callback.
-<br><br>One event, PI_EVENT_BSC (31) is predefined. This event is
-auto generated on BSC slave activity.
-<br><br>The meaning of other events is arbitrary.
-<br><br>Note that other than its id and its tick there is no data associated
-with an event.
-<h3><a name="shell"></a><a href="#int"><small>int</small></a> shell<small>(<a href="#char">char</a> <a href="#*scriptName">*scriptName</a>, <a href="#char">char</a> <a href="#*scriptString">*scriptString</a>)</small></h3>
-This function uses the system call to execute a shell script
-with the given string as its parameter.
-<br><br><code>&nbsp;&nbsp;scriptName:&nbsp;the&nbsp;name&nbsp;of&nbsp;the&nbsp;script,&nbsp;only&nbsp;alphanumeric&nbsp;characters,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'-'&nbsp;and&nbsp;'_'&nbsp;are&nbsp;allowed&nbsp;in&nbsp;the&nbsp;name<br>scriptString:&nbsp;the&nbsp;string&nbsp;to&nbsp;pass&nbsp;to&nbsp;the&nbsp;script<br></code><br><br>The exit status of the system call is returned if OK, otherwise
-PI_BAD_SHELL_STATUS.
-<br><br>scriptName must exist in /opt/pigpio/cgi and must be executable.
-<br><br>The returned exit status is normally 256 times that set by the
-shell script exit function. If the script can't be found 32512 will
-be returned.
-<br><br>The following table gives some example returned statuses.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Script exit status</td><td>Returned system call status</td></tr><tr><td>1</td><td>256</td></tr><tr><td>5</td><td>1280</td></tr><tr><td>10</td><td>2560</td></tr><tr><td>200</td><td>51200</td></tr><tr><td>script not found</td><td>32512</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>//&nbsp;pass&nbsp;two&nbsp;parameters,&nbsp;hello&nbsp;and&nbsp;world<br>status&nbsp;=&nbsp;shell("scr1",&nbsp;"hello&nbsp;world");<br><br>//&nbsp;pass&nbsp;three&nbsp;parameters,&nbsp;hello,&nbsp;string&nbsp;with&nbsp;spaces,&nbsp;and&nbsp;world<br>status&nbsp;=&nbsp;shell("scr1",&nbsp;"hello&nbsp;'string&nbsp;with&nbsp;spaces'&nbsp;world");<br><br>//&nbsp;pass&nbsp;one&nbsp;parameter,&nbsp;hello&nbsp;string&nbsp;with&nbsp;spaces&nbsp;world<br>status&nbsp;=&nbsp;shell("scr1",&nbsp;"\"hello&nbsp;string&nbsp;with&nbsp;spaces&nbsp;world\"");<br></code><h3><a name="fileOpen"></a><a href="#int"><small>int</small></a> fileOpen<small>(<a href="#char">char</a> <a href="#*file">*file</a>, <a href="#unsigned">unsigned</a> <a href="#mode">mode</a>)</small></h3>
-This function returns a handle to a file opened in a specified mode.
-<br><br><code>file:&nbsp;the&nbsp;file&nbsp;to&nbsp;open<br>mode:&nbsp;the&nbsp;file&nbsp;open&nbsp;mode<br></code><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_NO_HANDLE, PI_NO_FILE_ACCESS,
-PI_BAD_FILE_MODE, PI_FILE_OPEN_FAILED, or PI_FILE_IS_A_DIR.
-<br><br>File
-<br><br>A file may only be opened if permission is granted by an entry in
-/opt/pigpio/access. This is intended to allow remote access to files
-in a more or less controlled manner.
-<br><br>Each entry in /opt/pigpio/access takes the form of a file path
-which may contain wildcards followed by a single letter permission.
-The permission may be R for read, W for write, U for read/write,
-and N for no access.
-<br><br>Where more than one entry matches a file the most specific rule
-applies. If no entry matches a file then access is denied.
-<br><br>Suppose /opt/pigpio/access contains the following entries
-<br><br><code>/home/*&nbsp;n<br>/home/pi/shared/dir_1/*&nbsp;w<br>/home/pi/shared/dir_2/*&nbsp;r<br>/home/pi/shared/dir_3/*&nbsp;u<br>/home/pi/shared/dir_1/file.txt&nbsp;n<br></code><br><br>Files may be written in directory dir_1 with the exception
-of file.txt.
-<br><br>Files may be read in directory dir_2.
-<br><br>Files may be read and written in directory dir_3.
-<br><br>If a directory allows read, write, or read/write access then files may
-be created in that directory.
-<br><br>In an attempt to prevent risky permissions the following paths are
-ignored in /opt/pigpio/access.
-<br><br><code>a&nbsp;path&nbsp;containing&nbsp;..<br>a&nbsp;path&nbsp;containing&nbsp;only&nbsp;wildcards&nbsp;(*?)<br>a&nbsp;path&nbsp;containing&nbsp;less&nbsp;than&nbsp;two&nbsp;non-wildcard&nbsp;parts<br></code><br><br>Mode
-<br><br>The mode may have the following values.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Macro</td><td>Value</td><td>Meaning</td></tr><tr><td>PI_FILE_READ</td><td>1</td><td>open file for reading</td></tr><tr><td>PI_FILE_WRITE</td><td>2</td><td>open file for writing</td></tr><tr><td>PI_FILE_RW</td><td>3</td><td>open file for reading and writing</td></tr></tbody></table><br><br>The following values may be or'd into the mode.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Macro</td><td>Value</td><td>Meaning</td></tr><tr><td>PI_FILE_APPEND</td><td>4</td><td>Writes append data to the end of the file</td></tr><tr><td>PI_FILE_CREATE</td><td>8</td><td>The file is created if it doesn't exist</td></tr><tr><td>PI_FILE_TRUNC</td><td>16</td><td>The file is truncated</td></tr></tbody></table><br><br>Newly created files are owned by root with permissions owner read and write.
-<br><br><b><small>Example</small></b><br><br><code>#include&nbsp;&lt;stdio.h&gt;<br>#include&nbsp;&lt;pigpio.h&gt;<br><br>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;*argv[])<br>{<br>&nbsp;&nbsp;&nbsp;int&nbsp;handle,&nbsp;c;<br>&nbsp;&nbsp;&nbsp;char&nbsp;buf[60000];<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(gpioInitialise()&nbsp;&lt;&nbsp;0)&nbsp;return&nbsp;1;<br><br>&nbsp;&nbsp;&nbsp;//&nbsp;assumes&nbsp;/opt/pigpio/access&nbsp;contains&nbsp;the&nbsp;following&nbsp;line<br>&nbsp;&nbsp;&nbsp;//&nbsp;/ram/*.c&nbsp;r<br><br>&nbsp;&nbsp;&nbsp;handle&nbsp;=&nbsp;fileOpen("/ram/pigpio.c",&nbsp;PI_FILE_READ);<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(handle&nbsp;&gt;=&nbsp;0)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;((c=fileRead(handle,&nbsp;buf,&nbsp;sizeof(buf)-1)))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf[c]&nbsp;=&nbsp;0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("%s",&nbsp;buf);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fileClose(handle);<br>&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;gpioTerminate();<br>}<br></code><h3><a name="fileClose"></a><a href="#int"><small>int</small></a> fileClose<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This function closes the file associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#fileOpen">fileOpen</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<br><br><b><small>Example</small></b><br><br><code>fileClose(h);<br></code><h3><a name="fileWrite"></a><a href="#int"><small>int</small></a> fileWrite<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function writes count bytes from buf to the the file
-associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#fileOpen">fileOpen</a><br>&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;array&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM,
-PI_FILE_NOT_WOPEN, or PI_BAD_FILE_WRITE.
-<br><br><b><small>Example</small></b><br><br><code>status&nbsp;=&nbsp;fileWrite(h,&nbsp;buf,&nbsp;count);<br>if&nbsp;(status&nbsp;==&nbsp;0)<br>{<br>&nbsp;&nbsp;&nbsp;//&nbsp;okay<br>}<br>else<br>{<br>&nbsp;&nbsp;&nbsp;//&nbsp;error<br>}<br></code><h3><a name="fileRead"></a><a href="#int"><small>int</small></a> fileRead<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function reads up to count bytes from the the file
-associated with handle and writes them to buf.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#fileOpen">fileOpen</a><br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data<br>&nbsp;count:&nbsp;the&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read<br></code><br><br>Returns the number of bytes read (&gt;=0) if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, PI_FILE_NOT_ROPEN, or PI_BAD_FILE_WRITE.
-<br><br><b><small>Example</small></b><br><br><code>if&nbsp;(fileRead(h,&nbsp;buf,&nbsp;sizeof(buf))&nbsp;&gt;&nbsp;0)<br>{<br>&nbsp;&nbsp;&nbsp;//&nbsp;process&nbsp;read&nbsp;data<br>}<br></code><h3><a name="fileSeek"></a><a href="#int"><small>int</small></a> fileSeek<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#int32_t">int32_t</a> <a href="#seekOffset">seekOffset</a>, <a href="#int">int</a> <a href="#seekFrom">seekFrom</a>)</small></h3>
-This function seeks to a position within the file associated
-with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#fileOpen">fileOpen</a><br>seekOffset:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;move.&nbsp;&nbsp;Positive&nbsp;offsets<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;move&nbsp;forward,&nbsp;negative&nbsp;offsets&nbsp;backwards.<br>&nbsp;&nbsp;seekFrom:&nbsp;one&nbsp;of&nbsp;PI_FROM_START&nbsp;(0),&nbsp;PI_FROM_CURRENT&nbsp;(1),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or&nbsp;PI_FROM_END&nbsp;(2)<br></code><br><br>Returns the new byte position within the file (&gt;=0) if OK, otherwise PI_BAD_HANDLE, or PI_BAD_FILE_SEEK.
-<br><br><b><small>Example</small></b><br><br><code>fileSeek(0,&nbsp;20,&nbsp;PI_FROM_START);&nbsp;//&nbsp;Seek&nbsp;to&nbsp;start&nbsp;plus&nbsp;20<br><br>size&nbsp;=&nbsp;fileSeek(0,&nbsp;0,&nbsp;PI_FROM_END);&nbsp;//&nbsp;Seek&nbsp;to&nbsp;end,&nbsp;return&nbsp;size<br><br>pos&nbsp;=&nbsp;fileSeek(0,&nbsp;0,&nbsp;PI_FROM_CURRENT);&nbsp;//&nbsp;Return&nbsp;current&nbsp;position<br></code><h3><a name="fileList"></a><a href="#int"><small>int</small></a> fileList<small>(<a href="#char">char</a> <a href="#*fpat">*fpat</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function returns a list of files which match a pattern. The
-pattern may contain wildcards.
-<br><br><code>&nbsp;fpat:&nbsp;file&nbsp;pattern&nbsp;to&nbsp;match<br>&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;matching&nbsp;file&nbsp;names<br>count:&nbsp;the&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read<br></code><br><br>Returns the number of returned bytes if OK, otherwise PI_NO_FILE_ACCESS,
-or PI_NO_FILE_MATCH.
-<br><br>The pattern must match an entry in /opt/pigpio/access. The pattern
-may contain wildcards. See <a href="#fileOpen">fileOpen</a>.
-<br><br>NOTE
-<br><br>The returned value is not the number of files, it is the number
-of bytes in the buffer. The file names are separated by newline
-characters.
-<br><br><b><small>Example</small></b><br><br><code>#include&nbsp;&lt;stdio.h&gt;<br>#include&nbsp;&lt;pigpio.h&gt;<br><br>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;*argv[])<br>{<br>&nbsp;&nbsp;&nbsp;int&nbsp;c;<br>&nbsp;&nbsp;&nbsp;char&nbsp;buf[1000];<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(gpioInitialise()&nbsp;&lt;&nbsp;0)&nbsp;return&nbsp;1;<br><br>&nbsp;&nbsp;&nbsp;//&nbsp;assumes&nbsp;/opt/pigpio/access&nbsp;contains&nbsp;the&nbsp;following&nbsp;line<br>&nbsp;&nbsp;&nbsp;//&nbsp;/ram/*.c&nbsp;r<br><br>&nbsp;&nbsp;&nbsp;c&nbsp;=&nbsp;fileList("/ram/p*.c",&nbsp;buf,&nbsp;sizeof(buf));<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(c&nbsp;&gt;=&nbsp;0)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;terminate&nbsp;string<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf[c]&nbsp;=&nbsp;0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("%s",&nbsp;buf);<br>&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;gpioTerminate();<br>}<br></code><h3><a name="gpioCfgBufferSize"></a><a href="#int"><small>int</small></a> gpioCfgBufferSize<small>(<a href="#unsigned">unsigned</a> <a href="#cfgMillis">cfgMillis</a>)</small></h3>
-Configures pigpio to buffer cfgMillis milliseconds of GPIO samples.
-<br><br>This function is only effective if called before <a href="#gpioInitialise">gpioInitialise</a>.
-<br><br><code>cfgMillis:&nbsp;100-10000<br></code><br><br>The default setting is 120 milliseconds.
-<br><br>The intention is to allow for bursts of data and protection against
-other processes hogging cpu time.
-<br><br>I haven't seen a process locked out for more than 100 milliseconds.
-<br><br>Making the buffer bigger uses a LOT of memory at the more frequent
-sampling rates as shown in the following table in MBs.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buffer&nbsp;milliseconds<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;120&nbsp;250&nbsp;500&nbsp;1sec&nbsp;2sec&nbsp;4sec&nbsp;8sec<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16&nbsp;&nbsp;31&nbsp;&nbsp;55&nbsp;&nbsp;107&nbsp;&nbsp;---&nbsp;&nbsp;---&nbsp;&nbsp;---<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10&nbsp;&nbsp;18&nbsp;&nbsp;31&nbsp;&nbsp;&nbsp;55&nbsp;&nbsp;107&nbsp;&nbsp;---&nbsp;&nbsp;---<br>sample&nbsp;&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8&nbsp;&nbsp;12&nbsp;&nbsp;18&nbsp;&nbsp;&nbsp;31&nbsp;&nbsp;&nbsp;55&nbsp;&nbsp;107&nbsp;&nbsp;---<br>&nbsp;rate&nbsp;&nbsp;&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8&nbsp;&nbsp;10&nbsp;&nbsp;14&nbsp;&nbsp;&nbsp;24&nbsp;&nbsp;&nbsp;45&nbsp;&nbsp;&nbsp;87&nbsp;&nbsp;---<br>&nbsp;(us)&nbsp;&nbsp;&nbsp;&nbsp;8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6&nbsp;&nbsp;&nbsp;8&nbsp;&nbsp;12&nbsp;&nbsp;&nbsp;18&nbsp;&nbsp;&nbsp;31&nbsp;&nbsp;&nbsp;55&nbsp;&nbsp;107<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6&nbsp;&nbsp;&nbsp;8&nbsp;&nbsp;10&nbsp;&nbsp;&nbsp;14&nbsp;&nbsp;&nbsp;24&nbsp;&nbsp;&nbsp;45&nbsp;&nbsp;&nbsp;87<br></code><h3><a name="gpioCfgClock"></a><a href="#int"><small>int</small></a> gpioCfgClock<small>(<a href="#unsigned">unsigned</a> <a href="#cfgMicros">cfgMicros</a>, <a href="#unsigned">unsigned</a> <a href="#cfgPeripheral">cfgPeripheral</a>, <a href="#unsigned">unsigned</a> <a href="#cfgSource">cfgSource</a>)</small></h3>
-Configures pigpio to use a particular sample rate timed by a specified
-peripheral.
-<br><br>This function is only effective if called before <a href="#gpioInitialise">gpioInitialise</a>.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;cfgMicros:&nbsp;1,&nbsp;2,&nbsp;4,&nbsp;5,&nbsp;8,&nbsp;10<br>cfgPeripheral:&nbsp;0&nbsp;(PWM),&nbsp;1&nbsp;(PCM)<br>&nbsp;&nbsp;&nbsp;&nbsp;cfgSource:&nbsp;deprecated,&nbsp;value&nbsp;is&nbsp;ignored<br></code><br><br>The timings are provided by the specified peripheral (PWM or PCM).
-<br><br>The default setting is 5 microseconds using the PCM peripheral.
-<br><br>The approximate CPU percentage used for each sample rate is:
-<br><br><code>sample&nbsp;&nbsp;cpu<br>&nbsp;rate&nbsp;&nbsp;&nbsp;&nbsp;%<br><br>&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;25<br>&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16<br>&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;11<br>&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10<br>&nbsp;&nbsp;8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;15<br>&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;14<br></code><br><br>A sample rate of 5 microseconds seeems to be the sweet spot.
-<h3><a name="gpioCfgDMAchannel"></a><a href="#int"><small>int</small></a> gpioCfgDMAchannel<small>(<a href="#unsigned">unsigned</a> <a href="#DMAchannel">DMAchannel</a>)</small></h3>
-Configures pigpio to use the specified DMA channel.
-<br><br>This function is only effective if called before <a href="#gpioInitialise">gpioInitialise</a>.
-<br><br><code>DMAchannel:&nbsp;0-14<br></code><br><br>The default setting is to use channel 14.
-<h3><a name="gpioCfgDMAchannels"></a><a href="#int"><small>int</small></a> gpioCfgDMAchannels<small>(<a href="#unsigned">unsigned</a> <a href="#primaryChannel">primaryChannel</a>, <a href="#unsigned">unsigned</a> <a href="#secondaryChannel">secondaryChannel</a>)</small></h3>
-Configures pigpio to use the specified DMA channels.
-<br><br>This function is only effective if called before <a href="#gpioInitialise">gpioInitialise</a>.
-<br><br><code>&nbsp;&nbsp;primaryChannel:&nbsp;0-14<br>secondaryChannel:&nbsp;0-14<br></code><br><br>The default setting depends on whether the Pi has a BCM2711 chip or
-not (currently only the Pi4B has a BCM2711).
-<br><br>The default setting for a non-BCM2711 is to use channel 14 for the
-primary channel and channel 6 for the secondary channel.
-<br><br>The default setting for a BCM2711 is to use channel 7 for the
-primary channel and channel 6 for the secondary channel.
-<br><br>The secondary channel is only used for the transmission of waves.
-<br><br>If possible use one of channels 0 to 6 for the secondary channel
-(a full channel).
-<br><br>A full channel only requires one DMA control block regardless of the
-length of a pulse delay. Channels 7 to 14 (lite channels) require
-one DMA control block for each 16383 microseconds of delay. I.e.
-a 10 second pulse delay requires one control block on a full channel
-and 611 control blocks on a lite channel.
-<h3><a name="gpioCfgPermissions"></a><a href="#int"><small>int</small></a> gpioCfgPermissions<small>(<a href="#uint64_t">uint64_t</a> <a href="#updateMask">updateMask</a>)</small></h3>
-Configures pigpio to restrict GPIO updates via the socket or pipe
-interfaces to the GPIO specified by the mask. Programs directly
-calling the pigpio library (i.e. linked with -lpigpio are not
-affected). A GPIO update is a write to a GPIO or a GPIO mode
-change or any function which would force such an action.
-<br><br>This function is only effective if called before <a href="#gpioInitialise">gpioInitialise</a>.
-<br><br><code>updateMask:&nbsp;bit&nbsp;(1&lt;&lt;n)&nbsp;is&nbsp;set&nbsp;for&nbsp;each&nbsp;GPIO&nbsp;n&nbsp;which&nbsp;may&nbsp;be&nbsp;updated<br></code><br><br>The default setting depends upon the Pi model. The user GPIO are
-added to the mask.
-<br><br>If the board revision is not recognised then GPIO 2-27 are allowed.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Unknown board</td><td>PI_DEFAULT_UPDATE_MASK_UNKNOWN</td><td>0x0FFFFFFC<br></td></tr><tr><td>Type 1 board</td><td>PI_DEFAULT_UPDATE_MASK_B1</td><td>0x03E6CF93<br></td></tr><tr><td>Type 2 board</td><td>PI_DEFAULT_UPDATE_MASK_A_B2</td><td>0xFBC6CF9C</td></tr><tr><td>Type 3 board</td><td>PI_DEFAULT_UPDATE_MASK_R3</td><td>0x0FFFFFFC</td></tr></tbody></table><h3><a name="gpioCfgSocketPort"></a><a href="#int"><small>int</small></a> gpioCfgSocketPort<small>(<a href="#unsigned">unsigned</a> <a href="#port">port</a>)</small></h3>
-Configures pigpio to use the specified socket port.
-<br><br>This function is only effective if called before <a href="#gpioInitialise">gpioInitialise</a>.
-<br><br><code>port:&nbsp;1024-32000<br></code><br><br>The default setting is to use port 8888.
-<h3><a name="gpioCfgInterfaces"></a><a href="#int"><small>int</small></a> gpioCfgInterfaces<small>(<a href="#unsigned">unsigned</a> <a href="#ifFlags">ifFlags</a>)</small></h3>
-Configures pigpio support of the fifo and socket interfaces.
-<br><br>This function is only effective if called before <a href="#gpioInitialise">gpioInitialise</a>.
-<br><br><code>ifFlags:&nbsp;0-7<br></code><br><br>The default setting (0) is that both interfaces are enabled.
-<br><br>Or in PI_DISABLE_FIFO_IF to disable the pipe interface.
-<br><br>Or in PI_DISABLE_SOCK_IF to disable the socket interface.
-<br><br>Or in PI_LOCALHOST_SOCK_IF to disable remote socket
-access (this means that the socket interface is only
-usable from the local Pi).
-<h3><a name="gpioCfgMemAlloc"></a><a href="#int"><small>int</small></a> gpioCfgMemAlloc<small>(<a href="#unsigned">unsigned</a> <a href="#memAllocMode">memAllocMode</a>)</small></h3>
-Selects the method of DMA memory allocation.
-<br><br>This function is only effective if called before <a href="#gpioInitialise">gpioInitialise</a>.
-<br><br><code>memAllocMode:&nbsp;0-2<br></code><br><br>There are two methods of DMA memory allocation. The original method
-uses the /proc/self/pagemap file to allocate bus memory. The new
-method uses the mailbox property interface to allocate bus memory.
-<br><br>Auto will use the mailbox method unless a larger than default buffer
-size is requested with <a href="#gpioCfgBufferSize">gpioCfgBufferSize</a>.
-<h3><a name="gpioCfgNetAddr"></a><a href="#int"><small>int</small></a> gpioCfgNetAddr<small>(<a href="#int">int</a> <a href="#numSockAddr">numSockAddr</a>, <a href="#uint32_t">uint32_t</a> <a href="#*sockAddr">*sockAddr</a>)</small></h3>
-Sets the network addresses which are allowed to talk over the
-socket interface.
-<br><br>This function is only effective if called before <a href="#gpioInitialise">gpioInitialise</a>.
-<br><br><code>numSockAddr:&nbsp;0-256&nbsp;(0&nbsp;means&nbsp;all&nbsp;addresses&nbsp;allowed)<br>&nbsp;&nbsp;&nbsp;sockAddr:&nbsp;an&nbsp;array&nbsp;of&nbsp;permitted&nbsp;network&nbsp;addresses.<br></code><h3><a name="gpioCfgInternals"></a><a href="#int"><small>int</small></a> gpioCfgInternals<small>(<a href="#unsigned">unsigned</a> <a href="#cfgWhat">cfgWhat</a>, <a href="#unsigned">unsigned</a> <a href="#cfgVal">cfgVal</a>)</small></h3>
-Used to tune internal settings.
-<br><br><code>cfgWhat:&nbsp;see&nbsp;source&nbsp;code<br>&nbsp;cfgVal:&nbsp;see&nbsp;source&nbsp;code<br></code><h3><a name="gpioCfgGetInternals"></a><a href="#uint32_t"><small>uint32_t</small></a> gpioCfgGetInternals<small>(void)</small></h3>
-This function returns the current library internal configuration
-settings.
-<h3><a name="gpioCfgSetInternals"></a><a href="#int"><small>int</small></a> gpioCfgSetInternals<small>(<a href="#uint32_t">uint32_t</a> <a href="#cfgVal">cfgVal</a>)</small></h3>
-This function sets the current library internal configuration
-settings.
-<br><br><code>cfgVal:&nbsp;see&nbsp;source&nbsp;code<br></code><h3><a name="gpioCustom1"></a><a href="#int"><small>int</small></a> gpioCustom1<small>(<a href="#unsigned">unsigned</a> <a href="#arg1">arg1</a>, <a href="#unsigned">unsigned</a> <a href="#arg2">arg2</a>, <a href="#char">char</a> <a href="#*argx">*argx</a>, <a href="#unsigned">unsigned</a> <a href="#argc">argc</a>)</small></h3>
-This function is available for user customisation.
-<br><br>It returns a single integer value.
-<br><br><code>arg1:&nbsp;&gt;=0<br>arg2:&nbsp;&gt;=0<br>argx:&nbsp;extra&nbsp;(byte)&nbsp;arguments<br>argc:&nbsp;number&nbsp;of&nbsp;extra&nbsp;arguments<br></code><br><br>Returns &gt;= 0 if OK, less than 0 indicates a user defined error.
-<h3><a name="gpioCustom2"></a><a href="#int"><small>int</small></a> gpioCustom2<small>(<a href="#unsigned">unsigned</a> <a href="#arg1">arg1</a>, <a href="#char">char</a> <a href="#*argx">*argx</a>, <a href="#unsigned">unsigned</a> <a href="#argc">argc</a>, <a href="#char">char</a> <a href="#*retBuf">*retBuf</a>, <a href="#unsigned">unsigned</a> <a href="#retMax">retMax</a>)</small></h3>
-This function is available for user customisation.
-<br><br>It differs from gpioCustom1 in that it returns an array of bytes
-rather than just an integer.
-<br><br>The returned value is an integer indicating the number of returned bytes.
-<code>&nbsp;&nbsp;arg1:&nbsp;&gt;=0<br>&nbsp;&nbsp;argx:&nbsp;extra&nbsp;(byte)&nbsp;arguments<br>&nbsp;&nbsp;argc:&nbsp;number&nbsp;of&nbsp;extra&nbsp;arguments<br>retBuf:&nbsp;buffer&nbsp;for&nbsp;returned&nbsp;bytes<br>retMax:&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;return<br></code><br><br>Returns &gt;= 0 if OK, less than 0 indicates a user defined error.
-<br><br>The number of returned bytes must be retMax or less.
-<h3><a name="rawWaveAddSPI"></a><a href="#int"><small>int</small></a> rawWaveAddSPI<small>(<a href="#rawSPI_t">rawSPI_t</a> <a href="#*spi">*spi</a>, <a href="#unsigned">unsigned</a> <a href="#offset">offset</a>, <a href="#unsigned">unsigned</a> <a href="#spiSS">spiSS</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#spiTxBits">spiTxBits</a>, <a href="#unsigned">unsigned</a> <a href="#spiBitFirst">spiBitFirst</a>, <a href="#unsigned">unsigned</a> <a href="#spiBitLast">spiBitLast</a>, <a href="#unsigned">unsigned</a> <a href="#spiBits">spiBits</a>)</small></h3>
-This function adds a waveform representing SPI data to the
-existing waveform (if any).
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;spi:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;a&nbsp;spi&nbsp;object<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;offset:&nbsp;microseconds&nbsp;from&nbsp;the&nbsp;start&nbsp;of&nbsp;the&nbsp;waveform<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;spiSS:&nbsp;the&nbsp;slave&nbsp;select&nbsp;GPIO<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;bits&nbsp;to&nbsp;transmit,&nbsp;most&nbsp;significant&nbsp;bit&nbsp;first<br>&nbsp;&nbsp;spiTxBits:&nbsp;the&nbsp;number&nbsp;of&nbsp;bits&nbsp;to&nbsp;write<br>spiBitFirst:&nbsp;the&nbsp;first&nbsp;bit&nbsp;to&nbsp;read<br>&nbsp;spiBitLast:&nbsp;the&nbsp;last&nbsp;bit&nbsp;to&nbsp;read<br>&nbsp;&nbsp;&nbsp;&nbsp;spiBits:&nbsp;the&nbsp;number&nbsp;of&nbsp;bits&nbsp;to&nbsp;transfer<br></code><br><br>Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_BAD_USER_GPIO, PI_BAD_SER_OFFSET, or PI_TOO_MANY_PULSES.
-<br><br>Not intended for general use.
-<h3><a name="rawWaveAddGeneric"></a><a href="#int"><small>int</small></a> rawWaveAddGeneric<small>(<a href="#unsigned">unsigned</a> <a href="#numPulses">numPulses</a>, <a href="#rawWave_t">rawWave_t</a> <a href="#*pulses">*pulses</a>)</small></h3>
-This function adds a number of pulses to the current waveform.
-<br><br><code>numPulses:&nbsp;the&nbsp;number&nbsp;of&nbsp;pulses<br>&nbsp;&nbsp;&nbsp;pulses:&nbsp;the&nbsp;array&nbsp;containing&nbsp;the&nbsp;pulses<br></code><br><br>Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_TOO_MANY_PULSES.
-<br><br>The advantage of this function over gpioWaveAddGeneric is that it
-allows the setting of the flags field.
-<br><br>The pulses are interleaved in time order within the existing waveform
-(if any).
-<br><br>Merging allows the waveform to be built in parts, that is the settings
-for GPIO#1 can be added, and then GPIO#2 etc.
-<br><br>If the added waveform is intended to start after or within the existing
-waveform then the first pulse should consist of a delay.
-<br><br>Not intended for general use.
-<h3><a name="rawWaveCB"></a><a href="#unsigned"><small>unsigned</small></a> rawWaveCB<small>(void)</small></h3>
-Returns the number of the cb being currently output.
-<br><br>Not intended for general use.
-<h3><a name="rawWaveCBAdr"></a><a href="#rawCbs_t"><small>rawCbs_t</small></a> *rawWaveCBAdr<small>(<a href="#int">int</a> <a href="#cbNum">cbNum</a>)</small></h3>
-Return the (Linux) address of contol block cbNum.
-<br><br><code>cbNum:&nbsp;the&nbsp;cb&nbsp;of&nbsp;interest<br></code><br><br>Not intended for general use.
-<h3><a name="rawWaveGetOOL"></a><a href="#uint32_t"><small>uint32_t</small></a> rawWaveGetOOL<small>(<a href="#int">int</a> <a href="#pos">pos</a>)</small></h3>
-Gets the OOL parameter stored at pos.
-<br><br><code>pos:&nbsp;the&nbsp;position&nbsp;of&nbsp;interest.<br></code><br><br>Not intended for general use.
-<h3><a name="rawWaveSetOOL"></a><a href="#void"><small>void</small></a> rawWaveSetOOL<small>(<a href="#int">int</a> <a href="#pos">pos</a>, <a href="#uint32_t">uint32_t</a> <a href="#lVal">lVal</a>)</small></h3>
-Sets the OOL parameter stored at pos to value.
-<br><br><code>&nbsp;pos:&nbsp;the&nbsp;position&nbsp;of&nbsp;interest<br>lVal:&nbsp;the&nbsp;value&nbsp;to&nbsp;write<br></code><br><br>Not intended for general use.
-<h3><a name="rawWaveGetOut"></a><a href="#uint32_t"><small>uint32_t</small></a> rawWaveGetOut<small>(<a href="#int">int</a> <a href="#pos">pos</a>)</small></h3>
-Gets the wave output parameter stored at pos.
-<br><br>DEPRECATED: use rawWaveGetOOL instead.
-<br><br><code>pos:&nbsp;the&nbsp;position&nbsp;of&nbsp;interest.<br></code><br><br>Not intended for general use.
-<h3><a name="rawWaveSetOut"></a><a href="#void"><small>void</small></a> rawWaveSetOut<small>(<a href="#int">int</a> <a href="#pos">pos</a>, <a href="#uint32_t">uint32_t</a> <a href="#lVal">lVal</a>)</small></h3>
-Sets the wave output parameter stored at pos to value.
-<br><br>DEPRECATED: use rawWaveSetOOL instead.
-<br><br><code>&nbsp;pos:&nbsp;the&nbsp;position&nbsp;of&nbsp;interest<br>lVal:&nbsp;the&nbsp;value&nbsp;to&nbsp;write<br></code><br><br>Not intended for general use.
-<h3><a name="rawWaveGetIn"></a><a href="#uint32_t"><small>uint32_t</small></a> rawWaveGetIn<small>(<a href="#int">int</a> <a href="#pos">pos</a>)</small></h3>
-Gets the wave input value parameter stored at pos.
-<br><br>DEPRECATED: use rawWaveGetOOL instead.
-<br><br><code>pos:&nbsp;the&nbsp;position&nbsp;of&nbsp;interest<br></code><br><br>Not intended for general use.
-<h3><a name="rawWaveSetIn"></a><a href="#void"><small>void</small></a> rawWaveSetIn<small>(<a href="#int">int</a> <a href="#pos">pos</a>, <a href="#uint32_t">uint32_t</a> <a href="#lVal">lVal</a>)</small></h3>
-Sets the wave input value stored at pos to value.
-<br><br>DEPRECATED: use rawWaveSetOOL instead.
-<br><br><code>&nbsp;pos:&nbsp;the&nbsp;position&nbsp;of&nbsp;interest<br>lVal:&nbsp;the&nbsp;value&nbsp;to&nbsp;write<br></code><br><br>Not intended for general use.
-<h3><a name="rawWaveInfo"></a><a href="#rawWaveInfo_t"><small>rawWaveInfo_t</small></a> rawWaveInfo<small>(<a href="#int">int</a> <a href="#wave_id">wave_id</a>)</small></h3>
-Gets details about the wave with id wave_id.
-<br><br><code>wave_id:&nbsp;the&nbsp;wave&nbsp;of&nbsp;interest<br></code><br><br>Not intended for general use.
-<h3><a name="getBitInBytes"></a><a href="#int"><small>int</small></a> getBitInBytes<small>(<a href="#int">int</a> <a href="#bitPos">bitPos</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#int">int</a> <a href="#numBits">numBits</a>)</small></h3>
-Returns the value of the bit bitPos bits from the start of buf. Returns
-0 if bitPos is greater than or equal to numBits.
-<br><br><code>&nbsp;bitPos:&nbsp;bit&nbsp;index&nbsp;from&nbsp;the&nbsp;start&nbsp;of&nbsp;buf<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;array&nbsp;of&nbsp;bits<br>numBits:&nbsp;number&nbsp;of&nbsp;valid&nbsp;bits&nbsp;in&nbsp;buf<br></code><h3><a name="putBitInBytes"></a><a href="#void"><small>void</small></a> putBitInBytes<small>(<a href="#int">int</a> <a href="#bitPos">bitPos</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#int">int</a> <a href="#bit">bit</a>)</small></h3>
-Sets the bit bitPos bits from the start of buf to bit.
-<br><br><code>bitPos:&nbsp;bit&nbsp;index&nbsp;from&nbsp;the&nbsp;start&nbsp;of&nbsp;buf<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;array&nbsp;of&nbsp;bits<br>&nbsp;&nbsp;&nbsp;bit:&nbsp;0-1,&nbsp;value&nbsp;to&nbsp;set<br></code><h3><a name="time_time"></a><a href="#double"><small>double</small></a> time_time<small>(void)</small></h3>
-Return the current time in seconds since the Epoch.
-<h3><a name="time_sleep"></a><a href="#void"><small>void</small></a> time_sleep<small>(<a href="#double">double</a> <a href="#seconds">seconds</a>)</small></h3>
-Delay execution for a given number of seconds
-<br><br><code>seconds:&nbsp;the&nbsp;number&nbsp;of&nbsp;seconds&nbsp;to&nbsp;sleep<br></code><h3><a name="rawDumpWave"></a><a href="#void"><small>void</small></a> rawDumpWave<small>(void)</small></h3>
-Used to print a readable version of the current waveform to stderr.
-<br><br>Not intended for general use.
-<h3><a name="rawDumpScript"></a><a href="#void"><small>void</small></a> rawDumpScript<small>(<a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>)</small></h3>
-Used to print a readable version of a script to stderr.
-<br><br><code>script_id:&nbsp;&gt;=0,&nbsp;a&nbsp;script_id&nbsp;returned&nbsp;by&nbsp;<a href="#gpioStoreScript">gpioStoreScript</a><br></code><br><br>Not intended for general use.
-<h2>PARAMETERS</h2><h3><a name="active">active</a>: 0-1000000</h3>
-The number of microseconds level changes are reported for once
-a noise filter has been triggered (by <a href="#steady">steady</a> microseconds of
-a stable level).
-<h3><a name="arg1">arg1</a></h3>
-An unsigned argument passed to a user customised function. Its
-meaning is defined by the customiser.
-<h3><a name="arg2">arg2</a></h3>
-An unsigned argument passed to a user customised function. Its
-meaning is defined by the customiser.
-<h3><a name="argc">argc</a></h3>
-The count of bytes passed to a user customised function.
-<h3><a name="*argx">*argx</a></h3>
-A pointer to an array of bytes passed to a user customised function.
-Its meaning and content is defined by the customiser.
-<h3><a name="baud">baud</a></h3>
-The speed of serial communication (I2C, SPI, serial link, waves) in
-bits per second.
-<h3><a name="bit">bit</a></h3>
-A value of 0 or 1.
-<h3><a name="bitPos">bitPos</a></h3>
-A bit position within a byte or word. The least significant bit is
-position 0.
-<h3><a name="bits">bits</a></h3>
-A value used to select GPIO. If bit n of bits is set then GPIO n is
-selected.
-<br><br>A convenient way to set bit n is to or in (1&lt;&lt;n).
-<br><br>e.g. to select bits 5, 9, 23 you could use (1&lt;&lt;5) | (1&lt;&lt;9) | (1&lt;&lt;23).
-<h3><a name="*bsc_xfer">*bsc_xfer</a></h3>
-A pointer to a <a href="#bsc_xfer_t">bsc_xfer_t</a> object used to control a BSC transfer.
-<h3><a name="bsc_xfer_t">bsc_xfer_t</a></h3>
-<code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;control;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Write<br>&nbsp;&nbsp;&nbsp;int&nbsp;rxCnt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Read&nbsp;only<br>&nbsp;&nbsp;&nbsp;char&nbsp;rxBuf[BSC_FIFO_SIZE];&nbsp;//&nbsp;Read&nbsp;only<br>&nbsp;&nbsp;&nbsp;int&nbsp;txCnt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Write<br>&nbsp;&nbsp;&nbsp;char&nbsp;txBuf[BSC_FIFO_SIZE];&nbsp;//&nbsp;Write<br>}&nbsp;bsc_xfer_t;<br></code><h3><a name="*buf">*buf</a></h3>
-A buffer to hold data being sent or being received.
-<h3><a name="bufSize">bufSize</a></h3>
-The size in bytes of a buffer.
-<h3><a name="bVal">bVal</a>: 0-255 (Hex 0x0-0xFF, Octal 0-0377)</h3>
-An 8-bit byte value.
-<h3><a name="cbNum">cbNum</a></h3>
-A number identifying a DMA contol block.
-<h3><a name="cfgMicros">cfgMicros</a></h3>
-The GPIO sample rate in microseconds. The default is 5us, or 200 thousand
-samples per second.
-<h3><a name="cfgMillis">cfgMillis</a>: 100-10000</h3>
-The size of the sample buffer in milliseconds. Generally this should be
-left at the default of 120ms. If you expect intense bursts of signals it
-might be necessary to increase the buffer size.
-<h3><a name="cfgPeripheral">cfgPeripheral</a></h3>
-One of the PWM or PCM peripherals used to pace DMA transfers for timing
-purposes.
-<h3><a name="cfgSource">cfgSource</a></h3>
-Deprecated.
-<h3><a name="cfgVal">cfgVal</a></h3>
-A number specifying the value of a configuration item. See <a href="#cfgWhat">cfgWhat</a>.
-<h3><a name="cfgWhat">cfgWhat</a></h3>
-A number specifying a configuration item.
-<br><br>562484977: print enhanced statistics at termination.<br>
-984762879: set the initial debug level.
-<h3><a name="char">char</a></h3>
-A single character, an 8 bit quantity able to store 0-255.
-<h3><a name="clkfreq">clkfreq</a>: 4689-250M (13184-375M for the BCM2711)</h3>
-The hardware clock frequency.
-<br><br><code>PI_HW_CLK_MIN_FREQ&nbsp;4689<br>PI_HW_CLK_MAX_FREQ&nbsp;250000000<br>PI_HW_CLK_MAX_FREQ_2711&nbsp;375000000<br></code><h3><a name="count">count</a></h3>
-The number of bytes to be transferred in an I2C, SPI, or Serial
-command.
-<h3><a name="CS">CS</a></h3>
-The GPIO used for the slave select signal when bit banging SPI.
-<h3><a name="data_bits">data_bits</a>: 1-32</h3>
-The number of data bits to be used when adding serial data to a
-waveform.
-<br><br><code>PI_MIN_WAVE_DATABITS&nbsp;1<br>PI_MAX_WAVE_DATABITS&nbsp;32<br></code><h3><a name="DMAchannel">DMAchannel</a>: 0-15</h3>
-<code>PI_MIN_DMA_CHANNEL&nbsp;0<br>PI_MAX_DMA_CHANNEL&nbsp;15<br></code><h3><a name="double">double</a></h3>
-A floating point number.
-<h3><a name="dutycycle">dutycycle</a>: 0-range</h3>
-A number representing the ratio of on time to off time for PWM.
-<br><br>The number may vary between 0 and range (default 255) where
-0 is off and range is fully on.
-<h3><a name="edge">edge</a>: 0-2</h3>
-The type of GPIO edge to generate an interrupt. See <a href="#gpioSetISRFunc">gpioSetISRFunc</a>
-and <a href="#gpioSetISRFuncEx">gpioSetISRFuncEx</a>.
-<br><br><code>RISING_EDGE&nbsp;0<br>FALLING_EDGE&nbsp;1<br>EITHER_EDGE&nbsp;2<br></code><h3><a name="event">event</a>: 0-31</h3>
-An event is a signal used to inform one or more consumers
-to start an action.
-<h3><a name="eventFunc_t">eventFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*eventFunc_t)&nbsp;(int&nbsp;event,&nbsp;uint32_t&nbsp;tick);<br></code><h3><a name="eventFuncEx_t">eventFuncEx_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*eventFuncEx_t)<br>&nbsp;&nbsp;&nbsp;(int&nbsp;event,&nbsp;uint32_t&nbsp;tick,&nbsp;void&nbsp;*userdata);<br></code><h3><a name="f">f</a></h3>
-A function.
-<h3><a name="*file">*file</a></h3>
-A full file path. To be accessible the path must match an entry in
-/opt/pigpio/access.
-<h3><a name="*fpat">*fpat</a></h3>
-A file path which may contain wildcards. To be accessible the path
-must match an entry in /opt/pigpio/access.
-<h3><a name="frequency">frequency</a>: &gt;=0</h3>
-The number of times a GPIO is swiched on and off per second. This
-can be set per GPIO and may be as little as 5Hz or as much as
-40KHz. The GPIO will be on for a proportion of the time as defined
-by its dutycycle.
-<h3><a name="gpio">gpio</a></h3>
-A Broadcom numbered GPIO, in the range 0-53.
-<br><br>There are 54 General Purpose Input Outputs (GPIO) named GPIO0 through
-GPIO53.
-<br><br>They are split into two banks. Bank 1 consists of GPIO0 through
-GPIO31. Bank 2 consists of GPIO32 through GPIO53.
-<br><br>All the GPIO which are safe for the user to read and write are in
-bank 1. Not all GPIO in bank 1 are safe though. Type 1 boards
-have 17 safe GPIO. Type 2 boards have 21. Type 3 boards have 26.
-<br><br>See <a href="#gpioHardwareRevision">gpioHardwareRevision</a>.
-<br><br>The user GPIO are marked with an X in the following table.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;1&nbsp;&nbsp;2&nbsp;&nbsp;3&nbsp;&nbsp;4&nbsp;&nbsp;5&nbsp;&nbsp;6&nbsp;&nbsp;7&nbsp;&nbsp;8&nbsp;&nbsp;9&nbsp;10&nbsp;11&nbsp;12&nbsp;13&nbsp;14&nbsp;15<br>Type&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16&nbsp;17&nbsp;18&nbsp;19&nbsp;20&nbsp;21&nbsp;22&nbsp;23&nbsp;24&nbsp;25&nbsp;26&nbsp;27&nbsp;28&nbsp;29&nbsp;30&nbsp;31<br>Type&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-<br>Type&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-<br></code><h3><a name="gpioAlertFunc_t">gpioAlertFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*gpioAlertFunc_t)&nbsp;(int&nbsp;gpio,&nbsp;int&nbsp;level,&nbsp;uint32_t&nbsp;tick);<br></code><h3><a name="gpioAlertFuncEx_t">gpioAlertFuncEx_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*eventFuncEx_t)<br>&nbsp;&nbsp;&nbsp;(int&nbsp;event,&nbsp;int&nbsp;level,&nbsp;uint32_t&nbsp;tick,&nbsp;void&nbsp;*userdata);<br></code><h3><a name="gpioCfg*">gpioCfg*</a></h3>
-These functions are only effective if called before <a href="#gpioInitialise">gpioInitialise</a>.
-<br><br><a href="#gpioCfgBufferSize">gpioCfgBufferSize</a><br>
-<a href="#gpioCfgClock">gpioCfgClock</a><br>
-<a href="#gpioCfgDMAchannel">gpioCfgDMAchannel</a><br>
-<a href="#gpioCfgDMAchannels">gpioCfgDMAchannels</a><br>
-<a href="#gpioCfgPermissions">gpioCfgPermissions</a><br>
-<a href="#gpioCfgInterfaces">gpioCfgInterfaces</a><br>
-<a href="#gpioCfgSocketPort">gpioCfgSocketPort</a><br>
-<a href="#gpioCfgMemAlloc">gpioCfgMemAlloc</a>
-<h3><a name="gpioGetSamplesFunc_t">gpioGetSamplesFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*gpioGetSamplesFunc_t)<br>&nbsp;&nbsp;&nbsp;(const&nbsp;gpioSample_t&nbsp;*samples,&nbsp;int&nbsp;numSamples);<br></code><h3><a name="gpioGetSamplesFuncEx_t">gpioGetSamplesFuncEx_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*gpioGetSamplesFuncEx_t)<br>&nbsp;&nbsp;&nbsp;(const&nbsp;gpioSample_t&nbsp;*samples,&nbsp;int&nbsp;numSamples,&nbsp;void&nbsp;*userdata);<br></code><h3><a name="gpioISRFunc_t">gpioISRFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*gpioISRFunc_t)<br>&nbsp;&nbsp;&nbsp;(int&nbsp;gpio,&nbsp;int&nbsp;level,&nbsp;uint32_t&nbsp;tick);<br></code><h3><a name="gpioISRFuncEx_t">gpioISRFuncEx_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*gpioISRFuncEx_t)<br>&nbsp;&nbsp;&nbsp;(int&nbsp;gpio,&nbsp;int&nbsp;level,&nbsp;uint32_t&nbsp;tick,&nbsp;void&nbsp;*userdata);<br></code><h3><a name="gpioPulse_t">gpioPulse_t</a></h3>
-<code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOn;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOff;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;usDelay;<br>}&nbsp;gpioPulse_t;<br></code><h3><a name="gpioSample_t">gpioSample_t</a></h3>
-<code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;tick;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;level;<br>}&nbsp;gpioSample_t;<br></code><h3><a name="gpioSignalFunc_t">gpioSignalFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*gpioSignalFunc_t)&nbsp;(int&nbsp;signum);<br></code><h3><a name="gpioSignalFuncEx_t">gpioSignalFuncEx_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*gpioSignalFuncEx_t)&nbsp;(int&nbsp;signum,&nbsp;void&nbsp;*userdata);<br></code><h3><a name="gpioThreadFunc_t">gpioThreadFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;*(gpioThreadFunc_t)&nbsp;(void&nbsp;*);<br></code><h3><a name="gpioTimerFunc_t">gpioTimerFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*gpioTimerFunc_t)&nbsp;(void);<br></code><h3><a name="gpioTimerFuncEx_t">gpioTimerFuncEx_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*gpioTimerFuncEx_t)&nbsp;(void&nbsp;*userdata);<br></code><h3><a name="gpioWaveAdd*">gpioWaveAdd*</a></h3>
-One of
-<br><br><a href="#gpioWaveAddNew">gpioWaveAddNew</a><br>
-<a href="#gpioWaveAddGeneric">gpioWaveAddGeneric</a><br>
-<a href="#gpioWaveAddSerial">gpioWaveAddSerial</a>
-<h3><a name="handle">handle</a>: &gt;=0</h3>
-A number referencing an object opened by one of
-<br><br><a href="#fileOpen">fileOpen</a><br>
-<a href="#gpioNotifyOpen">gpioNotifyOpen</a><br>
-<a href="#i2cOpen">i2cOpen</a><br>
-<a href="#serOpen">serOpen</a><br>
-<a href="#spiOpen">spiOpen</a>
-<h3><a name="i2cAddr">i2cAddr</a>: 0-0x7F</h3>
-The address of a device on the I2C bus.
-<h3><a name="i2cBus">i2cBus</a>: &gt;=0</h3>
-An I2C bus number.
-<h3><a name="i2cFlags">i2cFlags</a>: 0</h3>
-Flags which modify an I2C open command. None are currently defined.
-<h3><a name="i2cReg">i2cReg</a>: 0-255</h3>
-A register of an I2C device.
-<h3><a name="ifFlags">ifFlags</a>: 0-3</h3>
-<code>PI_DISABLE_FIFO_IF&nbsp;1<br>PI_DISABLE_SOCK_IF&nbsp;2<br></code><h3><a name="*inBuf">*inBuf</a></h3>
-A buffer used to pass data to a function.
-<h3><a name="inLen">inLen</a></h3>
-The number of bytes of data in a buffer.
-<h3><a name="int">int</a></h3>
-A whole number, negative or positive.
-<h3><a name="int32_t">int32_t</a></h3>
-A 32-bit signed value.
-<h3><a name="invert">invert</a></h3>
-A flag used to set normal or inverted bit bang serial data level logic.
-<h3><a name="level">level</a></h3>
-The level of a GPIO. Low or High.
-<br><br><code>PI_OFF&nbsp;0<br>PI_ON&nbsp;1<br><br>PI_CLEAR&nbsp;0<br>PI_SET&nbsp;1<br><br>PI_LOW&nbsp;0<br>PI_HIGH&nbsp;1<br></code><br><br>There is one exception. If a watchdog expires on a GPIO the level will be
-reported as PI_TIMEOUT. See <a href="#gpioSetWatchdog">gpioSetWatchdog</a>.
-<br><br><code>PI_TIMEOUT&nbsp;2<br></code><h3><a name="lVal">lVal</a>: 0-4294967295 (Hex 0x0-0xFFFFFFFF, Octal 0-37777777777)</h3>
-A 32-bit word value.
-<h3><a name="memAllocMode">memAllocMode</a>: 0-2</h3>
-The DMA memory allocation mode.
-<br><br><code>PI_MEM_ALLOC_AUTO&nbsp;&nbsp;&nbsp;&nbsp;0<br>PI_MEM_ALLOC_PAGEMAP&nbsp;1<br>PI_MEM_ALLOC_MAILBOX&nbsp;2<br></code><h3><a name="*micros">*micros</a></h3>
-A value representing microseconds.
-<h3><a name="micros">micros</a></h3>
-A value representing microseconds.
-<h3><a name="millis">millis</a></h3>
-A value representing milliseconds.
-<h3><a name="MISO">MISO</a></h3>
-The GPIO used for the MISO signal when bit banging SPI.
-<h3><a name="mode">mode</a></h3>
-1. The operational mode of a GPIO, normally INPUT or OUTPUT.
-<br><br><code>PI_INPUT&nbsp;0<br>PI_OUTPUT&nbsp;1<br>PI_ALT0&nbsp;4<br>PI_ALT1&nbsp;5<br>PI_ALT2&nbsp;6<br>PI_ALT3&nbsp;7<br>PI_ALT4&nbsp;3<br>PI_ALT5&nbsp;2<br></code><br><br>2. A file open mode.
-<br><br><code>PI_FILE_READ&nbsp;&nbsp;1<br>PI_FILE_WRITE&nbsp;2<br>PI_FILE_RW&nbsp;&nbsp;&nbsp;&nbsp;3<br></code><br><br>The following values can be or'd into the mode.
-<br><br><code>PI_FILE_APPEND&nbsp;4<br>PI_FILE_CREATE&nbsp;8<br>PI_FILE_TRUNC&nbsp;&nbsp;16<br></code><h3><a name="MOSI">MOSI</a></h3>
-The GPIO used for the MOSI signal when bit banging SPI.
-<h3><a name="numBits">numBits</a></h3>
-The number of bits stored in a buffer.
-<h3><a name="numBytes">numBytes</a></h3>
-The number of bytes used to store characters in a string. Depending
-on the number of bits per character there may be 1, 2, or 4 bytes
-per character.
-<h3><a name="numPar">numPar</a>: 0-10</h3>
-The number of parameters passed to a script.
-<h3><a name="numPulses">numPulses</a></h3>
-The number of pulses to be added to a waveform.
-<h3><a name="numSegs">numSegs</a></h3>
-The number of segments in a combined I2C transaction.
-<h3><a name="numSockAddr">numSockAddr</a></h3>
-The number of network addresses allowed to use the socket interface.
-<br><br>0 means all addresses allowed.
-<h3><a name="offset">offset</a></h3>
-The associated data starts this number of microseconds from the start of
-the waveform.
-<h3><a name="*outBuf">*outBuf</a></h3>
-A buffer used to return data from a function.
-<h3><a name="outLen">outLen</a></h3>
-The size in bytes of an output buffer.
-<h3><a name="pad">pad</a>: 0-2</h3>
-A set of GPIO which share common drivers.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><h3><a name="padStrength">padStrength</a>: 1-16</h3>
-The mA which may be drawn from each GPIO whilst still guaranteeing the
-high and low levels.
-<h3><a name="*param">*param</a></h3>
-An array of script parameters.
-<h3><a name="pctBOOL">pctBOOL</a>: 0-100</h3>
-percent On-Off-Level (OOL) buffer to consume for wave output.
-<h3><a name="pctCB">pctCB</a>: 0-100</h3>
-the percent of all DMA control blocks to consume.
-<h3><a name="pctTOOL">pctTOOL</a>: 0-100</h3>
-the percent of OOL buffer to consume for wave input (flags).
-<h3><a name="pi_i2c_msg_t">pi_i2c_msg_t</a></h3>
-<code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;addr;&nbsp;&nbsp;//&nbsp;slave&nbsp;address<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;flags;<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;len;&nbsp;&nbsp;&nbsp;//&nbsp;msg&nbsp;length<br>&nbsp;&nbsp;&nbsp;uint8_t&nbsp;&nbsp;*buf;&nbsp;&nbsp;//&nbsp;pointer&nbsp;to&nbsp;msg&nbsp;data<br>}&nbsp;pi_i2c_msg_t;<br></code><h3><a name="port">port</a>: 1024-32000</h3>
-The port used to bind to the pigpio socket. Defaults to 8888.
-<h3><a name="pos">pos</a></h3>
-The position of an item.
-<h3><a name="primaryChannel">primaryChannel</a>: 0-15</h3>
-The DMA channel used to time the sampling of GPIO and to time servo and
-PWM pulses.
-<h3><a name="*pth">*pth</a></h3>
-A thread identifier, returned by <a href="#gpioStartThread">gpioStartThread</a>.
-<h3><a name="pthread_t">pthread_t</a></h3>
-A thread identifier.
-<h3><a name="pud">pud</a>: 0-2</h3>
-The setting of the pull up/down resistor for a GPIO, which may be off,
-pull-up, or pull-down.
-<br><br><code>PI_PUD_OFF&nbsp;0<br>PI_PUD_DOWN&nbsp;1<br>PI_PUD_UP&nbsp;2<br></code><h3><a name="pulseLen">pulseLen</a></h3>
-1-100, the length of a trigger pulse in microseconds.
-<h3><a name="*pulses">*pulses</a></h3>
-An array of pulses to be added to a waveform.
-<h3><a name="pulsewidth">pulsewidth</a>: 0, 500-2500</h3>
-<code>PI_SERVO_OFF&nbsp;0<br>PI_MIN_SERVO_PULSEWIDTH&nbsp;500<br>PI_MAX_SERVO_PULSEWIDTH&nbsp;2500<br></code><h3><a name="PWMduty">PWMduty</a>: 0-1000000 (1M)</h3>
-The hardware PWM dutycycle.
-<br><br><code>PI_HW_PWM_RANGE&nbsp;1000000<br></code><h3><a name="PWMfreq">PWMfreq</a>: 1-125M (1-187.5M for the BCM2711)</h3>
-The hardware PWM frequency.
-<br><br><code>PI_HW_PWM_MIN_FREQ&nbsp;1<br>PI_HW_PWM_MAX_FREQ&nbsp;125000000<br>PI_HW_PWM_MAX_FREQ_2711&nbsp;187500000<br></code><h3><a name="range">range</a>: 25-40000</h3>
-<code>PI_MIN_DUTYCYCLE_RANGE&nbsp;25<br>PI_MAX_DUTYCYCLE_RANGE&nbsp;40000<br></code><h3><a name="rawCbs_t">rawCbs_t</a></h3>
-<code>typedef&nbsp;struct&nbsp;//&nbsp;linux/arch/arm/mach-bcm2708/include/mach/dma.h<br>{<br>&nbsp;&nbsp;&nbsp;unsigned&nbsp;long&nbsp;info;<br>&nbsp;&nbsp;&nbsp;unsigned&nbsp;long&nbsp;src;<br>&nbsp;&nbsp;&nbsp;unsigned&nbsp;long&nbsp;dst;<br>&nbsp;&nbsp;&nbsp;unsigned&nbsp;long&nbsp;length;<br>&nbsp;&nbsp;&nbsp;unsigned&nbsp;long&nbsp;stride;<br>&nbsp;&nbsp;&nbsp;unsigned&nbsp;long&nbsp;next;<br>&nbsp;&nbsp;&nbsp;unsigned&nbsp;long&nbsp;pad[2];<br>}&nbsp;rawCbs_t;<br></code><h3><a name="rawSPI_t">rawSPI_t</a></h3>
-<code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;int&nbsp;clk;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;GPIO&nbsp;for&nbsp;clock<br>&nbsp;&nbsp;&nbsp;int&nbsp;mosi;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;GPIO&nbsp;for&nbsp;MOSI<br>&nbsp;&nbsp;&nbsp;int&nbsp;miso;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;GPIO&nbsp;for&nbsp;MISO<br>&nbsp;&nbsp;&nbsp;int&nbsp;ss_pol;&nbsp;&nbsp;//&nbsp;slave&nbsp;select&nbsp;off&nbsp;state<br>&nbsp;&nbsp;&nbsp;int&nbsp;ss_us;&nbsp;&nbsp;&nbsp;//&nbsp;delay&nbsp;after&nbsp;slave&nbsp;select<br>&nbsp;&nbsp;&nbsp;int&nbsp;clk_pol;&nbsp;//&nbsp;clock&nbsp;off&nbsp;state<br>&nbsp;&nbsp;&nbsp;int&nbsp;clk_pha;&nbsp;//&nbsp;clock&nbsp;phase<br>&nbsp;&nbsp;&nbsp;int&nbsp;clk_us;&nbsp;&nbsp;//&nbsp;clock&nbsp;micros<br>}&nbsp;rawSPI_t;<br></code><h3><a name="rawWave_t">rawWave_t</a></h3>
-<code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOn;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOff;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;usDelay;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;flags;<br>}&nbsp;rawWave_t;<br></code><h3><a name="rawWaveInfo_t">rawWaveInfo_t</a></h3>
-<code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;botCB;&nbsp;&nbsp;//&nbsp;first&nbsp;CB&nbsp;used&nbsp;by&nbsp;wave<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;topCB;&nbsp;&nbsp;//&nbsp;last&nbsp;CB&nbsp;used&nbsp;by&nbsp;wave<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;botOOL;&nbsp;//&nbsp;last&nbsp;OOL&nbsp;used&nbsp;by&nbsp;wave<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;topOOL;&nbsp;//&nbsp;first&nbsp;OOL&nbsp;used&nbsp;by&nbsp;wave<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;deleted;<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;numCB;<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;numBOOL;<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;numTOOL;<br>}&nbsp;rawWaveInfo_t;<br></code><h3><a name="*retBuf">*retBuf</a></h3>
-A buffer to hold a number of bytes returned to a used customised function,
-<h3><a name="retMax">retMax</a></h3>
-The maximum number of bytes a user customised function should return.
-<h3><a name="*rxBuf">*rxBuf</a></h3>
-A pointer to a buffer to receive data.
-<h3><a name="SCL">SCL</a></h3>
-The user GPIO to use for the clock when bit banging I2C.
-<h3><a name="SCLK">SCLK</a></h3>
-The GPIO used for the SCLK signal when bit banging SPI.
-<h3><a name="*script">*script</a></h3>
-A pointer to the text of a script.
-<h3><a name="script_id">script_id</a></h3>
-An id of a stored script as returned by <a href="#gpioStoreScript">gpioStoreScript</a>.
-<h3><a name="*scriptName">*scriptName</a></h3>
-The name of a <a href="#shell">shell</a> script to be executed. The script must be present in
-/opt/pigpio/cgi and must have execute permission.
-<h3><a name="*scriptString">*scriptString</a></h3>
-The string to be passed to a <a href="#shell">shell</a> script to be executed.
-<h3><a name="SDA">SDA</a></h3>
-The user GPIO to use for data when bit banging I2C.
-<h3><a name="secondaryChannel">secondaryChannel</a>: 0-6</h3>
-The DMA channel used to time output waveforms.
-<h3><a name="*seconds">*seconds</a></h3>
-A pointer to a uint32_t to store the second component of
-a returned time.
-<h3><a name="seconds">seconds</a></h3>
-The number of seconds.
-<h3><a name="seekFrom">seekFrom</a></h3>
-<code>PI_FROM_START&nbsp;&nbsp;&nbsp;0<br>PI_FROM_CURRENT&nbsp;1<br>PI_FROM_END&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2<br></code><h3><a name="seekOffset">seekOffset</a></h3>
-The number of bytes to move forward (positive) or backwards (negative)
-from the seek position (start, current, or end of file).
-<h3><a name="*segs">*segs</a></h3>
-An array of segments which make up a combined I2C transaction.
-<h3><a name="serFlags">serFlags</a></h3>
-Flags which modify a serial open command. None are currently defined.
-<h3><a name="*sertty">*sertty</a></h3>
-The name of a serial tty device, e.g. /dev/ttyAMA0, /dev/ttyUSB0, /dev/tty1.
-<h3><a name="setting">setting</a></h3>
-A value used to set a flag, 0 for false, non-zero for true.
-<h3><a name="signum">signum</a>: 0-63</h3>
-<code>PI_MIN_SIGNUM&nbsp;0<br>PI_MAX_SIGNUM&nbsp;63<br></code><h3><a name="size_t">size_t</a></h3>
-A standard type used to indicate the size of an object in bytes.
-<h3><a name="*sockAddr">*sockAddr</a></h3>
-An array of network addresses allowed to use the socket interface encoded
-as 32 bit numbers.
-<br><br>E.g. address 192.168.1.66 would be encoded as 0x4201a8c0.
-<h3><a name="*spi">*spi</a></h3>
-A pointer to a <a href="#rawSPI_t">rawSPI_t</a> structure.
-<h3><a name="spiBitFirst">spiBitFirst</a></h3>
-GPIO reads are made from spiBitFirst to spiBitLast.
-<h3><a name="spiBitLast">spiBitLast</a></h3>
-GPIO reads are made from spiBitFirst to spiBitLast.
-<h3><a name="spiBits">spiBits</a></h3>
-The number of bits to transfer in a raw SPI transaction.
-<h3><a name="spiChan">spiChan</a></h3>
-A SPI channel, 0-2.
-<h3><a name="spiFlags">spiFlags</a></h3>
-See <a href="#spiOpen">spiOpen</a> and <a href="#bbSPIOpen">bbSPIOpen</a>.
-<h3><a name="spiSS">spiSS</a></h3>
-The SPI slave select GPIO in a raw SPI transaction.
-<h3><a name="spiTxBits">spiTxBits</a></h3>
-The number of bits to transfer dring a raw SPI transaction
-<h3><a name="steady">steady</a>: 0-300000</h3>
-The number of microseconds level changes must be stable for
-before reporting the level changed (<a href="#gpioGlitchFilter">gpioGlitchFilter</a>) or triggering
-the active part of a noise filter (<a href="#gpioNoiseFilter">gpioNoiseFilter</a>).
-<h3><a name="stop_bits">stop_bits</a>: 2-8</h3>
-The number of (half) stop bits to be used when adding serial data
-to a waveform.
-<br><br><code>PI_MIN_WAVE_HALFSTOPBITS&nbsp;2<br>PI_MAX_WAVE_HALFSTOPBITS&nbsp;8<br></code><h3><a name="*str">*str</a></h3>
-An array of characters.
-<h3><a name="timeout">timeout</a></h3>
-A GPIO level change timeout in milliseconds.
-<br><br><a href="#gpioSetWatchdog">gpioSetWatchdog</a>
-<code>PI_MIN_WDOG_TIMEOUT&nbsp;0<br>PI_MAX_WDOG_TIMEOUT&nbsp;60000<br></code><br><br><a href="#gpioSetISRFunc">gpioSetISRFunc</a> and <a href="#gpioSetISRFuncEx">gpioSetISRFuncEx</a>
-<code>&lt;=0&nbsp;cancel&nbsp;timeout<br>&gt;0&nbsp;timeout&nbsp;after&nbsp;specified&nbsp;milliseconds<br></code><h3><a name="timer">timer</a></h3>
-<code>PI_MIN_TIMER&nbsp;0<br>PI_MAX_TIMER&nbsp;9<br></code><h3><a name="timetype">timetype</a></h3>
-<code>PI_TIME_RELATIVE&nbsp;0<br>PI_TIME_ABSOLUTE&nbsp;1<br></code><h3><a name="*txBuf">*txBuf</a></h3>
-An array of bytes to transmit.
-<h3><a name="uint32_t">uint32_t</a>: 0-0-4,294,967,295 (Hex 0x0-0xFFFFFFFF)</h3>
-A 32-bit unsigned value.
-<h3><a name="uint64_t">uint64_t</a>: 0-(2^64)-1</h3>
-A 64-bit unsigned value.
-<h3><a name="unsigned">unsigned</a></h3>
-A whole number &gt;= 0.
-<h3><a name="updateMask">updateMask</a></h3>
-A 64 bit mask indicating which GPIO may be written to by the user.
-<br><br>If GPIO#n may be written then bit (1&lt;&lt;n) is set.
-<h3><a name="user_gpio">user_gpio</a></h3>
-0-31, a Broadcom numbered GPIO.
-<br><br>See <a href="#gpio">gpio</a>.
-<h3><a name="*userdata">*userdata</a></h3>
-A pointer to arbitrary user data. This may be used to identify the instance.
-<br><br>You must ensure that the pointer is in scope at the time it is processed. If
-it is a pointer to a global this is automatic. Do not pass the address of a
-local variable. If you want to pass a transient object then use the
-following technique.
-<br><br>In the calling function:
-<br><br><code>user_type&nbsp;*userdata;<br><br>user_type&nbsp;my_userdata;<br><br>userdata&nbsp;=&nbsp;malloc(sizeof(user_type));<br><br>*userdata&nbsp;=&nbsp;my_userdata;<br></code><br><br>In the receiving function:
-<br><br><code>user_type&nbsp;my_userdata&nbsp;=&nbsp;*(user_type*)userdata;<br><br>free(userdata);<br></code><h3><a name="void">void</a></h3>
-Denoting no parameter is required
-<h3><a name="wave_id">wave_id</a></h3>
-A number identifying a waveform created by <a href="#gpioWaveCreate">gpioWaveCreate</a>.
-<h3><a name="wave_mode">wave_mode</a></h3>
-The mode determines if the waveform is sent once or cycles
-repeatedly. The SYNC variants wait for the current waveform
-to reach the end of a cycle or finish before starting the new
-waveform.
-<br><br><code>PI_WAVE_MODE_ONE_SHOT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0<br>PI_WAVE_MODE_REPEAT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1<br>PI_WAVE_MODE_ONE_SHOT_SYNC&nbsp;2<br>PI_WAVE_MODE_REPEAT_SYNC&nbsp;&nbsp;&nbsp;3<br></code><h3><a name="wVal">wVal</a>: 0-65535 (Hex 0x0-0xFFFF, Octal 0-0177777)</h3>
-A 16-bit word value.
-<h2>Socket Command Codes</h2><code><br>#define&nbsp;PI_CMD_MODES&nbsp;&nbsp;0<br>#define&nbsp;PI_CMD_MODEG&nbsp;&nbsp;1<br>#define&nbsp;PI_CMD_PUD&nbsp;&nbsp;&nbsp;&nbsp;2<br>#define&nbsp;PI_CMD_READ&nbsp;&nbsp;&nbsp;3<br>#define&nbsp;PI_CMD_WRITE&nbsp;&nbsp;4<br>#define&nbsp;PI_CMD_PWM&nbsp;&nbsp;&nbsp;&nbsp;5<br>#define&nbsp;PI_CMD_PRS&nbsp;&nbsp;&nbsp;&nbsp;6<br>#define&nbsp;PI_CMD_PFS&nbsp;&nbsp;&nbsp;&nbsp;7<br>#define&nbsp;PI_CMD_SERVO&nbsp;&nbsp;8<br>#define&nbsp;PI_CMD_WDOG&nbsp;&nbsp;&nbsp;9<br>#define&nbsp;PI_CMD_BR1&nbsp;&nbsp;&nbsp;10<br>#define&nbsp;PI_CMD_BR2&nbsp;&nbsp;&nbsp;11<br>#define&nbsp;PI_CMD_BC1&nbsp;&nbsp;&nbsp;12<br>#define&nbsp;PI_CMD_BC2&nbsp;&nbsp;&nbsp;13<br>#define&nbsp;PI_CMD_BS1&nbsp;&nbsp;&nbsp;14<br>#define&nbsp;PI_CMD_BS2&nbsp;&nbsp;&nbsp;15<br>#define&nbsp;PI_CMD_TICK&nbsp;&nbsp;16<br>#define&nbsp;PI_CMD_HWVER&nbsp;17<br>#define&nbsp;PI_CMD_NO&nbsp;&nbsp;&nbsp;&nbsp;18<br>#define&nbsp;PI_CMD_NB&nbsp;&nbsp;&nbsp;&nbsp;19<br>#define&nbsp;PI_CMD_NP&nbsp;&nbsp;&nbsp;&nbsp;20<br>#define&nbsp;PI_CMD_NC&nbsp;&nbsp;&nbsp;&nbsp;21<br>#define&nbsp;PI_CMD_PRG&nbsp;&nbsp;&nbsp;22<br>#define&nbsp;PI_CMD_PFG&nbsp;&nbsp;&nbsp;23<br>#define&nbsp;PI_CMD_PRRG&nbsp;&nbsp;24<br>#define&nbsp;PI_CMD_HELP&nbsp;&nbsp;25<br>#define&nbsp;PI_CMD_PIGPV&nbsp;26<br>#define&nbsp;PI_CMD_WVCLR&nbsp;27<br>#define&nbsp;PI_CMD_WVAG&nbsp;&nbsp;28<br>#define&nbsp;PI_CMD_WVAS&nbsp;&nbsp;29<br>#define&nbsp;PI_CMD_WVGO&nbsp;&nbsp;30<br>#define&nbsp;PI_CMD_WVGOR&nbsp;31<br>#define&nbsp;PI_CMD_WVBSY&nbsp;32<br>#define&nbsp;PI_CMD_WVHLT&nbsp;33<br>#define&nbsp;PI_CMD_WVSM&nbsp;&nbsp;34<br>#define&nbsp;PI_CMD_WVSP&nbsp;&nbsp;35<br>#define&nbsp;PI_CMD_WVSC&nbsp;&nbsp;36<br>#define&nbsp;PI_CMD_TRIG&nbsp;&nbsp;37<br>#define&nbsp;PI_CMD_PROC&nbsp;&nbsp;38<br>#define&nbsp;PI_CMD_PROCD&nbsp;39<br>#define&nbsp;PI_CMD_PROCR&nbsp;40<br>#define&nbsp;PI_CMD_PROCS&nbsp;41<br>#define&nbsp;PI_CMD_SLRO&nbsp;&nbsp;42<br>#define&nbsp;PI_CMD_SLR&nbsp;&nbsp;&nbsp;43<br>#define&nbsp;PI_CMD_SLRC&nbsp;&nbsp;44<br>#define&nbsp;PI_CMD_PROCP&nbsp;45<br>#define&nbsp;PI_CMD_MICS&nbsp;&nbsp;46<br>#define&nbsp;PI_CMD_MILS&nbsp;&nbsp;47<br>#define&nbsp;PI_CMD_PARSE&nbsp;48<br>#define&nbsp;PI_CMD_WVCRE&nbsp;49<br>#define&nbsp;PI_CMD_WVDEL&nbsp;50<br>#define&nbsp;PI_CMD_WVTX&nbsp;&nbsp;51<br>#define&nbsp;PI_CMD_WVTXR&nbsp;52<br>#define&nbsp;PI_CMD_WVNEW&nbsp;53<br><br>#define&nbsp;PI_CMD_I2CO&nbsp;&nbsp;54<br>#define&nbsp;PI_CMD_I2CC&nbsp;&nbsp;55<br>#define&nbsp;PI_CMD_I2CRD&nbsp;56<br>#define&nbsp;PI_CMD_I2CWD&nbsp;57<br>#define&nbsp;PI_CMD_I2CWQ&nbsp;58<br>#define&nbsp;PI_CMD_I2CRS&nbsp;59<br>#define&nbsp;PI_CMD_I2CWS&nbsp;60<br>#define&nbsp;PI_CMD_I2CRB&nbsp;61<br>#define&nbsp;PI_CMD_I2CWB&nbsp;62<br>#define&nbsp;PI_CMD_I2CRW&nbsp;63<br>#define&nbsp;PI_CMD_I2CWW&nbsp;64<br>#define&nbsp;PI_CMD_I2CRK&nbsp;65<br>#define&nbsp;PI_CMD_I2CWK&nbsp;66<br>#define&nbsp;PI_CMD_I2CRI&nbsp;67<br>#define&nbsp;PI_CMD_I2CWI&nbsp;68<br>#define&nbsp;PI_CMD_I2CPC&nbsp;69<br>#define&nbsp;PI_CMD_I2CPK&nbsp;70<br><br>#define&nbsp;PI_CMD_SPIO&nbsp;&nbsp;71<br>#define&nbsp;PI_CMD_SPIC&nbsp;&nbsp;72<br>#define&nbsp;PI_CMD_SPIR&nbsp;&nbsp;73<br>#define&nbsp;PI_CMD_SPIW&nbsp;&nbsp;74<br>#define&nbsp;PI_CMD_SPIX&nbsp;&nbsp;75<br><br>#define&nbsp;PI_CMD_SERO&nbsp;&nbsp;76<br>#define&nbsp;PI_CMD_SERC&nbsp;&nbsp;77<br>#define&nbsp;PI_CMD_SERRB&nbsp;78<br>#define&nbsp;PI_CMD_SERWB&nbsp;79<br>#define&nbsp;PI_CMD_SERR&nbsp;&nbsp;80<br>#define&nbsp;PI_CMD_SERW&nbsp;&nbsp;81<br>#define&nbsp;PI_CMD_SERDA&nbsp;82<br><br>#define&nbsp;PI_CMD_GDC&nbsp;&nbsp;&nbsp;83<br>#define&nbsp;PI_CMD_GPW&nbsp;&nbsp;&nbsp;84<br><br>#define&nbsp;PI_CMD_HC&nbsp;&nbsp;&nbsp;&nbsp;85<br>#define&nbsp;PI_CMD_HP&nbsp;&nbsp;&nbsp;&nbsp;86<br><br>#define&nbsp;PI_CMD_CF1&nbsp;&nbsp;&nbsp;87<br>#define&nbsp;PI_CMD_CF2&nbsp;&nbsp;&nbsp;88<br><br>#define&nbsp;PI_CMD_BI2CC&nbsp;89<br>#define&nbsp;PI_CMD_BI2CO&nbsp;90<br>#define&nbsp;PI_CMD_BI2CZ&nbsp;91<br><br>#define&nbsp;PI_CMD_I2CZ&nbsp;&nbsp;92<br><br>#define&nbsp;PI_CMD_WVCHA&nbsp;93<br><br>#define&nbsp;PI_CMD_SLRI&nbsp;&nbsp;94<br><br>#define&nbsp;PI_CMD_CGI&nbsp;&nbsp;&nbsp;95<br>#define&nbsp;PI_CMD_CSI&nbsp;&nbsp;&nbsp;96<br><br>#define&nbsp;PI_CMD_FG&nbsp;&nbsp;&nbsp;&nbsp;97<br>#define&nbsp;PI_CMD_FN&nbsp;&nbsp;&nbsp;&nbsp;98<br><br>#define&nbsp;PI_CMD_NOIB&nbsp;&nbsp;99<br><br>#define&nbsp;PI_CMD_WVTXM&nbsp;100<br>#define&nbsp;PI_CMD_WVTAT&nbsp;101<br><br>#define&nbsp;PI_CMD_PADS&nbsp;&nbsp;102<br>#define&nbsp;PI_CMD_PADG&nbsp;&nbsp;103<br><br>#define&nbsp;PI_CMD_FO&nbsp;&nbsp;&nbsp;&nbsp;104<br>#define&nbsp;PI_CMD_FC&nbsp;&nbsp;&nbsp;&nbsp;105<br>#define&nbsp;PI_CMD_FR&nbsp;&nbsp;&nbsp;&nbsp;106<br>#define&nbsp;PI_CMD_FW&nbsp;&nbsp;&nbsp;&nbsp;107<br>#define&nbsp;PI_CMD_FS&nbsp;&nbsp;&nbsp;&nbsp;108<br>#define&nbsp;PI_CMD_FL&nbsp;&nbsp;&nbsp;&nbsp;109<br><br>#define&nbsp;PI_CMD_SHELL&nbsp;110<br><br>#define&nbsp;PI_CMD_BSPIC&nbsp;111<br>#define&nbsp;PI_CMD_BSPIO&nbsp;112<br>#define&nbsp;PI_CMD_BSPIX&nbsp;113<br><br>#define&nbsp;PI_CMD_BSCX&nbsp;&nbsp;114<br><br>#define&nbsp;PI_CMD_EVM&nbsp;&nbsp;&nbsp;115<br>#define&nbsp;PI_CMD_EVT&nbsp;&nbsp;&nbsp;116<br><br>#define&nbsp;PI_CMD_PROCU&nbsp;117<br>#define&nbsp;PI_CMD_WVCAP&nbsp;118<br><br></code><h2>Error Codes</h2><code><br>#define&nbsp;PI_INIT_FAILED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-1&nbsp;//&nbsp;gpioInitialise&nbsp;failed<br>#define&nbsp;PI_BAD_USER_GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-2&nbsp;//&nbsp;GPIO&nbsp;not&nbsp;0-31<br>#define&nbsp;PI_BAD_GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-3&nbsp;//&nbsp;GPIO&nbsp;not&nbsp;0-53<br>#define&nbsp;PI_BAD_MODE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-4&nbsp;//&nbsp;mode&nbsp;not&nbsp;0-7<br>#define&nbsp;PI_BAD_LEVEL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-5&nbsp;//&nbsp;level&nbsp;not&nbsp;0-1<br>#define&nbsp;PI_BAD_PUD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-6&nbsp;//&nbsp;pud&nbsp;not&nbsp;0-2<br>#define&nbsp;PI_BAD_PULSEWIDTH&nbsp;&nbsp;&nbsp;&nbsp;-7&nbsp;//&nbsp;pulsewidth&nbsp;not&nbsp;0&nbsp;or&nbsp;500-2500<br>#define&nbsp;PI_BAD_DUTYCYCLE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-8&nbsp;//&nbsp;dutycycle&nbsp;outside&nbsp;set&nbsp;range<br>#define&nbsp;PI_BAD_TIMER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-9&nbsp;//&nbsp;timer&nbsp;not&nbsp;0-9<br>#define&nbsp;PI_BAD_MS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-10&nbsp;//&nbsp;ms&nbsp;not&nbsp;10-60000<br>#define&nbsp;PI_BAD_TIMETYPE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-11&nbsp;//&nbsp;timetype&nbsp;not&nbsp;0-1<br>#define&nbsp;PI_BAD_SECONDS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-12&nbsp;//&nbsp;seconds&nbsp;&lt;&nbsp;0<br>#define&nbsp;PI_BAD_MICROS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-13&nbsp;//&nbsp;micros&nbsp;not&nbsp;0-999999<br>#define&nbsp;PI_TIMER_FAILED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-14&nbsp;//&nbsp;gpioSetTimerFunc&nbsp;failed<br>#define&nbsp;PI_BAD_WDOG_TIMEOUT&nbsp;-15&nbsp;//&nbsp;timeout&nbsp;not&nbsp;0-60000<br>#define&nbsp;PI_NO_ALERT_FUNC&nbsp;&nbsp;&nbsp;&nbsp;-16&nbsp;//&nbsp;DEPRECATED<br>#define&nbsp;PI_BAD_CLK_PERIPH&nbsp;&nbsp;&nbsp;-17&nbsp;//&nbsp;clock&nbsp;peripheral&nbsp;not&nbsp;0-1<br>#define&nbsp;PI_BAD_CLK_SOURCE&nbsp;&nbsp;&nbsp;-18&nbsp;//&nbsp;DEPRECATED<br>#define&nbsp;PI_BAD_CLK_MICROS&nbsp;&nbsp;&nbsp;-19&nbsp;//&nbsp;clock&nbsp;micros&nbsp;not&nbsp;1,&nbsp;2,&nbsp;4,&nbsp;5,&nbsp;8,&nbsp;or&nbsp;10<br>#define&nbsp;PI_BAD_BUF_MILLIS&nbsp;&nbsp;&nbsp;-20&nbsp;//&nbsp;buf&nbsp;millis&nbsp;not&nbsp;100-10000<br>#define&nbsp;PI_BAD_DUTYRANGE&nbsp;&nbsp;&nbsp;&nbsp;-21&nbsp;//&nbsp;dutycycle&nbsp;range&nbsp;not&nbsp;25-40000<br>#define&nbsp;PI_BAD_DUTY_RANGE&nbsp;&nbsp;&nbsp;-21&nbsp;//&nbsp;DEPRECATED&nbsp;(use&nbsp;PI_BAD_DUTYRANGE)<br>#define&nbsp;PI_BAD_SIGNUM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-22&nbsp;//&nbsp;signum&nbsp;not&nbsp;0-63<br>#define&nbsp;PI_BAD_PATHNAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-23&nbsp;//&nbsp;can't&nbsp;open&nbsp;pathname<br>#define&nbsp;PI_NO_HANDLE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-24&nbsp;//&nbsp;no&nbsp;handle&nbsp;available<br>#define&nbsp;PI_BAD_HANDLE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-25&nbsp;//&nbsp;unknown&nbsp;handle<br>#define&nbsp;PI_BAD_IF_FLAGS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-26&nbsp;//&nbsp;ifFlags&nbsp;&gt;&nbsp;4<br>#define&nbsp;PI_BAD_CHANNEL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-27&nbsp;//&nbsp;DMA&nbsp;channel&nbsp;not&nbsp;0-15<br>#define&nbsp;PI_BAD_PRIM_CHANNEL&nbsp;-27&nbsp;//&nbsp;DMA&nbsp;primary&nbsp;channel&nbsp;not&nbsp;0-15<br>#define&nbsp;PI_BAD_SOCKET_PORT&nbsp;&nbsp;-28&nbsp;//&nbsp;socket&nbsp;port&nbsp;not&nbsp;1024-32000<br>#define&nbsp;PI_BAD_FIFO_COMMAND&nbsp;-29&nbsp;//&nbsp;unrecognized&nbsp;fifo&nbsp;command<br>#define&nbsp;PI_BAD_SECO_CHANNEL&nbsp;-30&nbsp;//&nbsp;DMA&nbsp;secondary&nbsp;channel&nbsp;not&nbsp;0-15<br>#define&nbsp;PI_NOT_INITIALISED&nbsp;&nbsp;-31&nbsp;//&nbsp;function&nbsp;called&nbsp;before&nbsp;gpioInitialise<br>#define&nbsp;PI_INITIALISED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-32&nbsp;//&nbsp;function&nbsp;called&nbsp;after&nbsp;gpioInitialise<br>#define&nbsp;PI_BAD_WAVE_MODE&nbsp;&nbsp;&nbsp;&nbsp;-33&nbsp;//&nbsp;waveform&nbsp;mode&nbsp;not&nbsp;0-3<br>#define&nbsp;PI_BAD_CFG_INTERNAL&nbsp;-34&nbsp;//&nbsp;bad&nbsp;parameter&nbsp;in&nbsp;gpioCfgInternals&nbsp;call<br>#define&nbsp;PI_BAD_WAVE_BAUD&nbsp;&nbsp;&nbsp;&nbsp;-35&nbsp;//&nbsp;baud&nbsp;rate&nbsp;not&nbsp;50-250K(RX)/50-1M(TX)<br>#define&nbsp;PI_TOO_MANY_PULSES&nbsp;&nbsp;-36&nbsp;//&nbsp;waveform&nbsp;has&nbsp;too&nbsp;many&nbsp;pulses<br>#define&nbsp;PI_TOO_MANY_CHARS&nbsp;&nbsp;&nbsp;-37&nbsp;//&nbsp;waveform&nbsp;has&nbsp;too&nbsp;many&nbsp;chars<br>#define&nbsp;PI_NOT_SERIAL_GPIO&nbsp;&nbsp;-38&nbsp;//&nbsp;no&nbsp;bit&nbsp;bang&nbsp;serial&nbsp;read&nbsp;on&nbsp;GPIO<br>#define&nbsp;PI_BAD_SERIAL_STRUC&nbsp;-39&nbsp;//&nbsp;bad&nbsp;(null)&nbsp;serial&nbsp;structure&nbsp;parameter<br>#define&nbsp;PI_BAD_SERIAL_BUF&nbsp;&nbsp;&nbsp;-40&nbsp;//&nbsp;bad&nbsp;(null)&nbsp;serial&nbsp;buf&nbsp;parameter<br>#define&nbsp;PI_NOT_PERMITTED&nbsp;&nbsp;&nbsp;&nbsp;-41&nbsp;//&nbsp;GPIO&nbsp;operation&nbsp;not&nbsp;permitted<br>#define&nbsp;PI_SOME_PERMITTED&nbsp;&nbsp;&nbsp;-42&nbsp;//&nbsp;one&nbsp;or&nbsp;more&nbsp;GPIO&nbsp;not&nbsp;permitted<br>#define&nbsp;PI_BAD_WVSC_COMMND&nbsp;&nbsp;-43&nbsp;//&nbsp;bad&nbsp;WVSC&nbsp;subcommand<br>#define&nbsp;PI_BAD_WVSM_COMMND&nbsp;&nbsp;-44&nbsp;//&nbsp;bad&nbsp;WVSM&nbsp;subcommand<br>#define&nbsp;PI_BAD_WVSP_COMMND&nbsp;&nbsp;-45&nbsp;//&nbsp;bad&nbsp;WVSP&nbsp;subcommand<br>#define&nbsp;PI_BAD_PULSELEN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-46&nbsp;//&nbsp;trigger&nbsp;pulse&nbsp;length&nbsp;not&nbsp;1-100<br>#define&nbsp;PI_BAD_SCRIPT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-47&nbsp;//&nbsp;invalid&nbsp;script<br>#define&nbsp;PI_BAD_SCRIPT_ID&nbsp;&nbsp;&nbsp;&nbsp;-48&nbsp;//&nbsp;unknown&nbsp;script&nbsp;id<br>#define&nbsp;PI_BAD_SER_OFFSET&nbsp;&nbsp;&nbsp;-49&nbsp;//&nbsp;add&nbsp;serial&nbsp;data&nbsp;offset&nbsp;&gt;&nbsp;30&nbsp;minutes<br>#define&nbsp;PI_GPIO_IN_USE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-50&nbsp;//&nbsp;GPIO&nbsp;already&nbsp;in&nbsp;use<br>#define&nbsp;PI_BAD_SERIAL_COUNT&nbsp;-51&nbsp;//&nbsp;must&nbsp;read&nbsp;at&nbsp;least&nbsp;a&nbsp;byte&nbsp;at&nbsp;a&nbsp;time<br>#define&nbsp;PI_BAD_PARAM_NUM&nbsp;&nbsp;&nbsp;&nbsp;-52&nbsp;//&nbsp;script&nbsp;parameter&nbsp;id&nbsp;not&nbsp;0-9<br>#define&nbsp;PI_DUP_TAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-53&nbsp;//&nbsp;script&nbsp;has&nbsp;duplicate&nbsp;tag<br>#define&nbsp;PI_TOO_MANY_TAGS&nbsp;&nbsp;&nbsp;&nbsp;-54&nbsp;//&nbsp;script&nbsp;has&nbsp;too&nbsp;many&nbsp;tags<br>#define&nbsp;PI_BAD_SCRIPT_CMD&nbsp;&nbsp;&nbsp;-55&nbsp;//&nbsp;illegal&nbsp;script&nbsp;command<br>#define&nbsp;PI_BAD_VAR_NUM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-56&nbsp;//&nbsp;script&nbsp;variable&nbsp;id&nbsp;not&nbsp;0-149<br>#define&nbsp;PI_NO_SCRIPT_ROOM&nbsp;&nbsp;&nbsp;-57&nbsp;//&nbsp;no&nbsp;more&nbsp;room&nbsp;for&nbsp;scripts<br>#define&nbsp;PI_NO_MEMORY&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-58&nbsp;//&nbsp;can't&nbsp;allocate&nbsp;temporary&nbsp;memory<br>#define&nbsp;PI_SOCK_READ_FAILED&nbsp;-59&nbsp;//&nbsp;socket&nbsp;read&nbsp;failed<br>#define&nbsp;PI_SOCK_WRIT_FAILED&nbsp;-60&nbsp;//&nbsp;socket&nbsp;write&nbsp;failed<br>#define&nbsp;PI_TOO_MANY_PARAM&nbsp;&nbsp;&nbsp;-61&nbsp;//&nbsp;too&nbsp;many&nbsp;script&nbsp;parameters&nbsp;(&gt;&nbsp;10)<br>#define&nbsp;PI_NOT_HALTED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-62&nbsp;//&nbsp;DEPRECATED<br>#define&nbsp;PI_SCRIPT_NOT_READY&nbsp;-62&nbsp;//&nbsp;script&nbsp;initialising<br>#define&nbsp;PI_BAD_TAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-63&nbsp;//&nbsp;script&nbsp;has&nbsp;unresolved&nbsp;tag<br>#define&nbsp;PI_BAD_MICS_DELAY&nbsp;&nbsp;&nbsp;-64&nbsp;//&nbsp;bad&nbsp;MICS&nbsp;delay&nbsp;(too&nbsp;large)<br>#define&nbsp;PI_BAD_MILS_DELAY&nbsp;&nbsp;&nbsp;-65&nbsp;//&nbsp;bad&nbsp;MILS&nbsp;delay&nbsp;(too&nbsp;large)<br>#define&nbsp;PI_BAD_WAVE_ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-66&nbsp;//&nbsp;non&nbsp;existent&nbsp;wave&nbsp;id<br>#define&nbsp;PI_TOO_MANY_CBS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-67&nbsp;//&nbsp;No&nbsp;more&nbsp;CBs&nbsp;for&nbsp;waveform<br>#define&nbsp;PI_TOO_MANY_OOL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-68&nbsp;//&nbsp;No&nbsp;more&nbsp;OOL&nbsp;for&nbsp;waveform<br>#define&nbsp;PI_EMPTY_WAVEFORM&nbsp;&nbsp;&nbsp;-69&nbsp;//&nbsp;attempt&nbsp;to&nbsp;create&nbsp;an&nbsp;empty&nbsp;waveform<br>#define&nbsp;PI_NO_WAVEFORM_ID&nbsp;&nbsp;&nbsp;-70&nbsp;//&nbsp;no&nbsp;more&nbsp;waveforms<br>#define&nbsp;PI_I2C_OPEN_FAILED&nbsp;&nbsp;-71&nbsp;//&nbsp;can't&nbsp;open&nbsp;I2C&nbsp;device<br>#define&nbsp;PI_SER_OPEN_FAILED&nbsp;&nbsp;-72&nbsp;//&nbsp;can't&nbsp;open&nbsp;serial&nbsp;device<br>#define&nbsp;PI_SPI_OPEN_FAILED&nbsp;&nbsp;-73&nbsp;//&nbsp;can't&nbsp;open&nbsp;SPI&nbsp;device<br>#define&nbsp;PI_BAD_I2C_BUS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-74&nbsp;//&nbsp;bad&nbsp;I2C&nbsp;bus<br>#define&nbsp;PI_BAD_I2C_ADDR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-75&nbsp;//&nbsp;bad&nbsp;I2C&nbsp;address<br>#define&nbsp;PI_BAD_SPI_CHANNEL&nbsp;&nbsp;-76&nbsp;//&nbsp;bad&nbsp;SPI&nbsp;channel<br>#define&nbsp;PI_BAD_FLAGS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-77&nbsp;//&nbsp;bad&nbsp;i2c/spi/ser&nbsp;open&nbsp;flags<br>#define&nbsp;PI_BAD_SPI_SPEED&nbsp;&nbsp;&nbsp;&nbsp;-78&nbsp;//&nbsp;bad&nbsp;SPI&nbsp;speed<br>#define&nbsp;PI_BAD_SER_DEVICE&nbsp;&nbsp;&nbsp;-79&nbsp;//&nbsp;bad&nbsp;serial&nbsp;device&nbsp;name<br>#define&nbsp;PI_BAD_SER_SPEED&nbsp;&nbsp;&nbsp;&nbsp;-80&nbsp;//&nbsp;bad&nbsp;serial&nbsp;baud&nbsp;rate<br>#define&nbsp;PI_BAD_PARAM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-81&nbsp;//&nbsp;bad&nbsp;i2c/spi/ser&nbsp;parameter<br>#define&nbsp;PI_I2C_WRITE_FAILED&nbsp;-82&nbsp;//&nbsp;i2c&nbsp;write&nbsp;failed<br>#define&nbsp;PI_I2C_READ_FAILED&nbsp;&nbsp;-83&nbsp;//&nbsp;i2c&nbsp;read&nbsp;failed<br>#define&nbsp;PI_BAD_SPI_COUNT&nbsp;&nbsp;&nbsp;&nbsp;-84&nbsp;//&nbsp;bad&nbsp;SPI&nbsp;count<br>#define&nbsp;PI_SER_WRITE_FAILED&nbsp;-85&nbsp;//&nbsp;ser&nbsp;write&nbsp;failed<br>#define&nbsp;PI_SER_READ_FAILED&nbsp;&nbsp;-86&nbsp;//&nbsp;ser&nbsp;read&nbsp;failed<br>#define&nbsp;PI_SER_READ_NO_DATA&nbsp;-87&nbsp;//&nbsp;ser&nbsp;read&nbsp;no&nbsp;data&nbsp;available<br>#define&nbsp;PI_UNKNOWN_COMMAND&nbsp;&nbsp;-88&nbsp;//&nbsp;unknown&nbsp;command<br>#define&nbsp;PI_SPI_XFER_FAILED&nbsp;&nbsp;-89&nbsp;//&nbsp;spi&nbsp;xfer/read/write&nbsp;failed<br>#define&nbsp;PI_BAD_POINTER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-90&nbsp;//&nbsp;bad&nbsp;(NULL)&nbsp;pointer<br>#define&nbsp;PI_NO_AUX_SPI&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-91&nbsp;//&nbsp;no&nbsp;auxiliary&nbsp;SPI&nbsp;on&nbsp;Pi&nbsp;A&nbsp;or&nbsp;B<br>#define&nbsp;PI_NOT_PWM_GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-92&nbsp;//&nbsp;GPIO&nbsp;is&nbsp;not&nbsp;in&nbsp;use&nbsp;for&nbsp;PWM<br>#define&nbsp;PI_NOT_SERVO_GPIO&nbsp;&nbsp;&nbsp;-93&nbsp;//&nbsp;GPIO&nbsp;is&nbsp;not&nbsp;in&nbsp;use&nbsp;for&nbsp;servo&nbsp;pulses<br>#define&nbsp;PI_NOT_HCLK_GPIO&nbsp;&nbsp;&nbsp;&nbsp;-94&nbsp;//&nbsp;GPIO&nbsp;has&nbsp;no&nbsp;hardware&nbsp;clock<br>#define&nbsp;PI_NOT_HPWM_GPIO&nbsp;&nbsp;&nbsp;&nbsp;-95&nbsp;//&nbsp;GPIO&nbsp;has&nbsp;no&nbsp;hardware&nbsp;PWM<br>#define&nbsp;PI_BAD_HPWM_FREQ&nbsp;&nbsp;&nbsp;&nbsp;-96&nbsp;//&nbsp;invalid&nbsp;hardware&nbsp;PWM&nbsp;frequency<br>#define&nbsp;PI_BAD_HPWM_DUTY&nbsp;&nbsp;&nbsp;&nbsp;-97&nbsp;//&nbsp;hardware&nbsp;PWM&nbsp;dutycycle&nbsp;not&nbsp;0-1M<br>#define&nbsp;PI_BAD_HCLK_FREQ&nbsp;&nbsp;&nbsp;&nbsp;-98&nbsp;//&nbsp;invalid&nbsp;hardware&nbsp;clock&nbsp;frequency<br>#define&nbsp;PI_BAD_HCLK_PASS&nbsp;&nbsp;&nbsp;&nbsp;-99&nbsp;//&nbsp;need&nbsp;password&nbsp;to&nbsp;use&nbsp;hardware&nbsp;clock&nbsp;1<br>#define&nbsp;PI_HPWM_ILLEGAL&nbsp;&nbsp;&nbsp;&nbsp;-100&nbsp;//&nbsp;illegal,&nbsp;PWM&nbsp;in&nbsp;use&nbsp;for&nbsp;main&nbsp;clock<br>#define&nbsp;PI_BAD_DATABITS&nbsp;&nbsp;&nbsp;&nbsp;-101&nbsp;//&nbsp;serial&nbsp;data&nbsp;bits&nbsp;not&nbsp;1-32<br>#define&nbsp;PI_BAD_STOPBITS&nbsp;&nbsp;&nbsp;&nbsp;-102&nbsp;//&nbsp;serial&nbsp;(half)&nbsp;stop&nbsp;bits&nbsp;not&nbsp;2-8<br>#define&nbsp;PI_MSG_TOOBIG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-103&nbsp;//&nbsp;socket/pipe&nbsp;message&nbsp;too&nbsp;big<br>#define&nbsp;PI_BAD_MALLOC_MODE&nbsp;-104&nbsp;//&nbsp;bad&nbsp;memory&nbsp;allocation&nbsp;mode<br>#define&nbsp;PI_TOO_MANY_SEGS&nbsp;&nbsp;&nbsp;-105&nbsp;//&nbsp;too&nbsp;many&nbsp;I2C&nbsp;transaction&nbsp;segments<br>#define&nbsp;PI_BAD_I2C_SEG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-106&nbsp;//&nbsp;an&nbsp;I2C&nbsp;transaction&nbsp;segment&nbsp;failed<br>#define&nbsp;PI_BAD_SMBUS_CMD&nbsp;&nbsp;&nbsp;-107&nbsp;//&nbsp;SMBus&nbsp;command&nbsp;not&nbsp;supported&nbsp;by&nbsp;driver<br>#define&nbsp;PI_NOT_I2C_GPIO&nbsp;&nbsp;&nbsp;&nbsp;-108&nbsp;//&nbsp;no&nbsp;bit&nbsp;bang&nbsp;I2C&nbsp;in&nbsp;progress&nbsp;on&nbsp;GPIO<br>#define&nbsp;PI_BAD_I2C_WLEN&nbsp;&nbsp;&nbsp;&nbsp;-109&nbsp;//&nbsp;bad&nbsp;I2C&nbsp;write&nbsp;length<br>#define&nbsp;PI_BAD_I2C_RLEN&nbsp;&nbsp;&nbsp;&nbsp;-110&nbsp;//&nbsp;bad&nbsp;I2C&nbsp;read&nbsp;length<br>#define&nbsp;PI_BAD_I2C_CMD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-111&nbsp;//&nbsp;bad&nbsp;I2C&nbsp;command<br>#define&nbsp;PI_BAD_I2C_BAUD&nbsp;&nbsp;&nbsp;&nbsp;-112&nbsp;//&nbsp;bad&nbsp;I2C&nbsp;baud&nbsp;rate,&nbsp;not&nbsp;50-500k<br>#define&nbsp;PI_CHAIN_LOOP_CNT&nbsp;&nbsp;-113&nbsp;//&nbsp;bad&nbsp;chain&nbsp;loop&nbsp;count<br>#define&nbsp;PI_BAD_CHAIN_LOOP&nbsp;&nbsp;-114&nbsp;//&nbsp;empty&nbsp;chain&nbsp;loop<br>#define&nbsp;PI_CHAIN_COUNTER&nbsp;&nbsp;&nbsp;-115&nbsp;//&nbsp;too&nbsp;many&nbsp;chain&nbsp;counters<br>#define&nbsp;PI_BAD_CHAIN_CMD&nbsp;&nbsp;&nbsp;-116&nbsp;//&nbsp;bad&nbsp;chain&nbsp;command<br>#define&nbsp;PI_BAD_CHAIN_DELAY&nbsp;-117&nbsp;//&nbsp;bad&nbsp;chain&nbsp;delay&nbsp;micros<br>#define&nbsp;PI_CHAIN_NESTING&nbsp;&nbsp;&nbsp;-118&nbsp;//&nbsp;chain&nbsp;counters&nbsp;nested&nbsp;too&nbsp;deeply<br>#define&nbsp;PI_CHAIN_TOO_BIG&nbsp;&nbsp;&nbsp;-119&nbsp;//&nbsp;chain&nbsp;is&nbsp;too&nbsp;long<br>#define&nbsp;PI_DEPRECATED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-120&nbsp;//&nbsp;deprecated&nbsp;function&nbsp;removed<br>#define&nbsp;PI_BAD_SER_INVERT&nbsp;&nbsp;-121&nbsp;//&nbsp;bit&nbsp;bang&nbsp;serial&nbsp;invert&nbsp;not&nbsp;0&nbsp;or&nbsp;1<br>#define&nbsp;PI_BAD_EDGE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-122&nbsp;//&nbsp;bad&nbsp;ISR&nbsp;edge&nbsp;value,&nbsp;not&nbsp;0-2<br>#define&nbsp;PI_BAD_ISR_INIT&nbsp;&nbsp;&nbsp;&nbsp;-123&nbsp;//&nbsp;bad&nbsp;ISR&nbsp;initialisation<br>#define&nbsp;PI_BAD_FOREVER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-124&nbsp;//&nbsp;loop&nbsp;forever&nbsp;must&nbsp;be&nbsp;last&nbsp;command<br>#define&nbsp;PI_BAD_FILTER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-125&nbsp;//&nbsp;bad&nbsp;filter&nbsp;parameter<br>#define&nbsp;PI_BAD_PAD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-126&nbsp;//&nbsp;bad&nbsp;pad&nbsp;number<br>#define&nbsp;PI_BAD_STRENGTH&nbsp;&nbsp;&nbsp;&nbsp;-127&nbsp;//&nbsp;bad&nbsp;pad&nbsp;drive&nbsp;strength<br>#define&nbsp;PI_FIL_OPEN_FAILED&nbsp;-128&nbsp;//&nbsp;file&nbsp;open&nbsp;failed<br>#define&nbsp;PI_BAD_FILE_MODE&nbsp;&nbsp;&nbsp;-129&nbsp;//&nbsp;bad&nbsp;file&nbsp;mode<br>#define&nbsp;PI_BAD_FILE_FLAG&nbsp;&nbsp;&nbsp;-130&nbsp;//&nbsp;bad&nbsp;file&nbsp;flag<br>#define&nbsp;PI_BAD_FILE_READ&nbsp;&nbsp;&nbsp;-131&nbsp;//&nbsp;bad&nbsp;file&nbsp;read<br>#define&nbsp;PI_BAD_FILE_WRITE&nbsp;&nbsp;-132&nbsp;//&nbsp;bad&nbsp;file&nbsp;write<br>#define&nbsp;PI_FILE_NOT_ROPEN&nbsp;&nbsp;-133&nbsp;//&nbsp;file&nbsp;not&nbsp;open&nbsp;for&nbsp;read<br>#define&nbsp;PI_FILE_NOT_WOPEN&nbsp;&nbsp;-134&nbsp;//&nbsp;file&nbsp;not&nbsp;open&nbsp;for&nbsp;write<br>#define&nbsp;PI_BAD_FILE_SEEK&nbsp;&nbsp;&nbsp;-135&nbsp;//&nbsp;bad&nbsp;file&nbsp;seek<br>#define&nbsp;PI_NO_FILE_MATCH&nbsp;&nbsp;&nbsp;-136&nbsp;//&nbsp;no&nbsp;files&nbsp;match&nbsp;pattern<br>#define&nbsp;PI_NO_FILE_ACCESS&nbsp;&nbsp;-137&nbsp;//&nbsp;no&nbsp;permission&nbsp;to&nbsp;access&nbsp;file<br>#define&nbsp;PI_FILE_IS_A_DIR&nbsp;&nbsp;&nbsp;-138&nbsp;//&nbsp;file&nbsp;is&nbsp;a&nbsp;directory<br>#define&nbsp;PI_BAD_SHELL_STATUS&nbsp;-139&nbsp;//&nbsp;bad&nbsp;shell&nbsp;return&nbsp;status<br>#define&nbsp;PI_BAD_SCRIPT_NAME&nbsp;-140&nbsp;//&nbsp;bad&nbsp;script&nbsp;name<br>#define&nbsp;PI_BAD_SPI_BAUD&nbsp;&nbsp;&nbsp;&nbsp;-141&nbsp;//&nbsp;bad&nbsp;SPI&nbsp;baud&nbsp;rate,&nbsp;not&nbsp;50-500k<br>#define&nbsp;PI_NOT_SPI_GPIO&nbsp;&nbsp;&nbsp;&nbsp;-142&nbsp;//&nbsp;no&nbsp;bit&nbsp;bang&nbsp;SPI&nbsp;in&nbsp;progress&nbsp;on&nbsp;GPIO<br>#define&nbsp;PI_BAD_EVENT_ID&nbsp;&nbsp;&nbsp;&nbsp;-143&nbsp;//&nbsp;bad&nbsp;event&nbsp;id<br>#define&nbsp;PI_CMD_INTERRUPTED&nbsp;-144&nbsp;//&nbsp;Used&nbsp;by&nbsp;Python<br>#define&nbsp;PI_NOT_ON_BCM2711&nbsp;&nbsp;-145&nbsp;//&nbsp;not&nbsp;available&nbsp;on&nbsp;BCM2711<br>#define&nbsp;PI_ONLY_ON_BCM2711&nbsp;-146&nbsp;//&nbsp;only&nbsp;available&nbsp;on&nbsp;BCM2711<br><br>#define&nbsp;PI_PIGIF_ERR_0&nbsp;&nbsp;&nbsp;&nbsp;-2000<br>#define&nbsp;PI_PIGIF_ERR_99&nbsp;&nbsp;&nbsp;-2099<br><br>#define&nbsp;PI_CUSTOM_ERR_0&nbsp;&nbsp;&nbsp;-3000<br>#define&nbsp;PI_CUSTOM_ERR_999&nbsp;-3999<br><br></code><h2>Defaults</h2><code><br>#define&nbsp;PI_DEFAULT_BUFFER_MILLIS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;120<br>#define&nbsp;PI_DEFAULT_CLK_MICROS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5<br>#define&nbsp;PI_DEFAULT_CLK_PERIPHERAL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PI_CLOCK_PCM<br>#define&nbsp;PI_DEFAULT_IF_FLAGS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0<br>#define&nbsp;PI_DEFAULT_FOREGROUND&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0<br>#define&nbsp;PI_DEFAULT_DMA_CHANNEL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;14<br>#define&nbsp;PI_DEFAULT_DMA_PRIMARY_CHANNEL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;14<br>#define&nbsp;PI_DEFAULT_DMA_SECONDARY_CHANNEL&nbsp;&nbsp;&nbsp;6<br>#define&nbsp;PI_DEFAULT_DMA_PRIMARY_CH_2711&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;7<br>#define&nbsp;PI_DEFAULT_DMA_SECONDARY_CH_2711&nbsp;&nbsp;&nbsp;6<br>#define&nbsp;PI_DEFAULT_DMA_NOT_SET&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;15<br>#define&nbsp;PI_DEFAULT_SOCKET_PORT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8888<br>#define&nbsp;PI_DEFAULT_SOCKET_PORT_STR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"8888"<br>#define&nbsp;PI_DEFAULT_SOCKET_ADDR_STR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"localhost"<br>#define&nbsp;PI_DEFAULT_UPDATE_MASK_UNKNOWN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0x0000000FFFFFFCLL<br>#define&nbsp;PI_DEFAULT_UPDATE_MASK_B1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0x03E7CF93<br>#define&nbsp;PI_DEFAULT_UPDATE_MASK_A_B2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0xFBC7CF9C<br>#define&nbsp;PI_DEFAULT_UPDATE_MASK_APLUS_BPLUS&nbsp;0x0080480FFFFFFCLL<br>#define&nbsp;PI_DEFAULT_UPDATE_MASK_ZERO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0x0080000FFFFFFCLL<br>#define&nbsp;PI_DEFAULT_UPDATE_MASK_PI2B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0x0080480FFFFFFCLL<br>#define&nbsp;PI_DEFAULT_UPDATE_MASK_PI3B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0x0000000FFFFFFCLL<br>#define&nbsp;PI_DEFAULT_UPDATE_MASK_PI4B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0x0000000FFFFFFCLL<br>#define&nbsp;PI_DEFAULT_UPDATE_MASK_COMPUTE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0x00FFFFFFFFFFFFLL<br>#define&nbsp;PI_DEFAULT_MEM_ALLOC_MODE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PI_MEM_ALLOC_AUTO<br><br>#define&nbsp;PI_DEFAULT_CFG_INTERNALS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0<br><br></code></td>
-</table>
-<div style="vertical-align: center; text-align: center; background-color:#98bf21; font-size:0.8em; height:30px"><a class="l2" href="index.html">[pigpio]</a>
-<a class="l2" href="cif.html">[pigpio C I/F]</a>
-<a class="l2" href="pigpiod.html">[pigpiod]</a>
-<a class="l2" href="pdif2.html">[pigpiod C I/F]</a>
-<a class="l2" href="python.html">[Python]</a>
-<a class="l2" href="pigs.html">[pigs]</a>
-<a class="l2" href="piscope.html">[piscope]</a>
-<a class="l2" href="misc.html">[Misc]</a>
-<a class="l2" href="examples.html">[Examples]</a>
-<a class="l2" href="download.html">[Download]</a>
-<a class="l2" href="faq.html">[FAQ]</a>
-<a class="l2" href="sitemap.html">[Site Map]</a>
-</div>
-<table><tr>
-<td style="width: 200px"><div style="text-align: left;"><small>&copy; 2012-2020</small></div></td>
-<td style="width: 350px"><div style="text-align: center;">e-mail: pigpio @ abyz.me.uk</div></td>
-<td style="width: 200px"><div style="text-align: right;"><small>Updated: 30/04/2020</small></div></td>
-</tr></table>
-</td>
-</table>
-</body>
-</html>
diff --git a/DOC/HTML/download.html b/DOC/HTML/download.html
deleted file mode 100644
index 84ec4da..0000000
--- a/DOC/HTML/download.html
+++ /dev/null
@@ -1,121 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta name="description" content="Raspberry Pi Reg. C GPIO library and Python GPIO module and shell command utilities to control the GPIO, including SPI, I2C, and serial links." />
- <meta name="keywords" content="raspberry, pi, C, Python, GPIO, library, shell, command, utilities, module, SPI, I2C, serial" />
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>pigpio library</title>
- <link rel="stylesheet" type="text/css" href="scripts/index.css">
- <link rel="icon" href="favicon.ico" type="image/x-icon">
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
-</head>
-<body>
-
-<table style="padding:0px; border:0px; margin:0px; width:780px; background-color:#e0e0e0;">
-<td style="background:#EAF2E6 url('images/sidebar.gif') repeat-y; width:35px; height:100%"></td>
-<td>
-<table>
-<div style="background:url('images/topbar.gif') repeat-x; height: 70px; font-size:1.5em; vertical-align: top;"><a href="index.html"><img src="images/pigpio-logo.gif" border="0" /></a>pigpio library</div>
-</table>
-<table><div>
-<td><img src="images/rf-tx.jpg" width="250"></td>
-<td><img src="images/rpi.jpg" width="250"></td>
-<td><img src="images/speaker.jpg" width="250"></td>
-</div></table>
-<table>
-<td style="vertical-align: top; background-color: #98bf21;"><a class="l1" href="index.html">pigpio</a>
-<a class="l1" href="cif.html">pigpio C I/F</a>
-<a class="l1" href="pigpiod.html">pigpiod</a>
-<a class="l1" href="pdif2.html">pigpiod C I/F</a>
-<a class="l1" href="python.html">Python</a>
-<a class="l1" href="pigs.html">pigs</a>
-<a class="l1" href="piscope.html">piscope</a>
-<a class="l1" href="misc.html">Misc</a>
-<a class="l1" href="examples.html">Examples</a>
-<a class="l1" href="download.html">Download</a>
-<a class="l1" href="faq.html">FAQ</a>
-<a class="l1" href="sitemap.html">Site Map</a>
-</td>
-<td><center><h2>Download & Install</h2></center>
-If the pigpio daemon is running it should be killed (sudo killall
-pigpiod) before make install and restarted afterwards (sudo
-pigpiod).<br>
-<br>
-<span style="font-weight: bold;">The initial part of the make, the
-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>
-make<br>
-sudo make install<br></code><br>
-<br>
-If the Python part of the install fails it may be because you need
-the setup tools.<br>
-<br>
-<code>sudo apt install python-setuptools
-python3-setuptools<br></code><br>
-<br>
-<h3>To check the library</h3>
-These tests make extensive use of GPIO 25 (pin 22).&nbsp; Make sure
-nothing, or only a LED, is connected to the GPIO before running the
-tests.&nbsp; Most tests are statistical in nature and so may on
-occasion fail.&nbsp; Repeated failures on the same test or many
-failures in a group of tests indicate a problem.<br>
-<code><br>
-sudo ./x_pigpio # check C I/F<br>
-<br>
-sudo pigpiod&nbsp;&nbsp;&nbsp; # start daemon<br>
-<br>
-./x_pigpiod_if2 # check C&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I/F to
-daemon<br>
-./x_pigpio.py&nbsp;&nbsp; # check Python I/F to daemon<br>
-./x_pigs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # check
-pigs&nbsp;&nbsp; I/F to daemon<br>
-./x_pipe&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # check
-pipe&nbsp;&nbsp; I/F to daemon<br>
-<br>
-<br></code>
-<h3>To compile, link, and run a C program</h3>
-<code>gcc -Wall -pthread -o foobar foobar.c -lpigpio -lrt<br>
-sudo ./foobar</code><code><br></code><br>
-<h3>To start the pigpio daemon<br></h3>
-<code>sudo pigpiod<br></code>
-<h3>To stop the pigpio daemon<br></h3>
-<code>sudo killall pigpiod<br></code><br>
-<h3>github</h3>
-<code>git clone https://github.com/joan2937/pigpio</code><br>
-<h3>Raspbian (raspberrypi.org image)</h3>
-<p>This may not be the most recent version.&nbsp; You can check the
-version with the command pigpiod -v.<br></p>
-<code>sudo apt-get update<br>
-sudo apt-get install pigpio python-pigpio python3-pigpio</code><br>
-<br>
-</td>
-</table>
-<div style="vertical-align: center; text-align: center; background-color:#98bf21; font-size:0.8em; height:30px"><a class="l2" href="index.html">[pigpio]</a>
-<a class="l2" href="cif.html">[pigpio C I/F]</a>
-<a class="l2" href="pigpiod.html">[pigpiod]</a>
-<a class="l2" href="pdif2.html">[pigpiod C I/F]</a>
-<a class="l2" href="python.html">[Python]</a>
-<a class="l2" href="pigs.html">[pigs]</a>
-<a class="l2" href="piscope.html">[piscope]</a>
-<a class="l2" href="misc.html">[Misc]</a>
-<a class="l2" href="examples.html">[Examples]</a>
-<a class="l2" href="download.html">[Download]</a>
-<a class="l2" href="faq.html">[FAQ]</a>
-<a class="l2" href="sitemap.html">[Site Map]</a>
-</div>
-<table><tr>
-<td style="width: 200px"><div style="text-align: left;"><small>&copy; 2012-2020</small></div></td>
-<td style="width: 350px"><div style="text-align: center;">e-mail: pigpio @ abyz.me.uk</div></td>
-<td style="width: 200px"><div style="text-align: right;"><small>Updated: 30/04/2020</small></div></td>
-</tr></table>
-</td>
-</table>
-</body>
-</html>
diff --git a/DOC/HTML/ex_LDR.html b/DOC/HTML/ex_LDR.html
deleted file mode 100644
index 6b1cf23..0000000
--- a/DOC/HTML/ex_LDR.html
+++ /dev/null
@@ -1,205 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta name="description" content="Raspberry Pi Reg. C GPIO library and Python GPIO module and shell command utilities to control the GPIO, including SPI, I2C, and serial links." />
- <meta name="keywords" content="raspberry, pi, C, Python, GPIO, library, shell, command, utilities, module, SPI, I2C, serial" />
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>pigpio library</title>
- <link rel="stylesheet" type="text/css" href="scripts/index.css">
- <link rel="icon" href="favicon.ico" type="image/x-icon">
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
-</head>
-<body>
-
-<table style="padding:0px; border:0px; margin:0px; width:780px; background-color:#e0e0e0;">
-<td style="background:#EAF2E6 url('images/sidebar.gif') repeat-y; width:35px; height:100%"></td>
-<td>
-<table>
-<div style="background:url('images/topbar.gif') repeat-x; height: 70px; font-size:1.5em; vertical-align: top;"><a href="index.html"><img src="images/pigpio-logo.gif" border="0" /></a>pigpio library</div>
-</table>
-<table><div>
-<td><img src="images/keypad.jpg" width="250"></td>
-<td><img src="images/ldr-cap.jpg" width="250"></td>
-<td><img src="images/meter.jpg" width="250"></td>
-</div></table>
-<table>
-<td style="vertical-align: top; background-color: #98bf21;"><a class="l1" href="index.html">pigpio</a>
-<a class="l1" href="cif.html">pigpio C I/F</a>
-<a class="l1" href="pigpiod.html">pigpiod</a>
-<a class="l1" href="pdif2.html">pigpiod C I/F</a>
-<a class="l1" href="python.html">Python</a>
-<a class="l1" href="pigs.html">pigs</a>
-<a class="l1" href="piscope.html">piscope</a>
-<a class="l1" href="misc.html">Misc</a>
-<a class="l1" href="examples.html">Examples</a>
-<a class="l1" href="download.html">Download</a>
-<a class="l1" href="faq.html">FAQ</a>
-<a class="l1" href="sitemap.html">Site Map</a>
-</td>
-<td><center><h2>LDR Example</h2></center>
-<p>The following code shows a method of reading analogue sensors on
-the digital input only Pi.&nbsp; A Light Dependent Resistor (LDR)
-varies its resistance according to the incident light
-intensisty.</p>
-<h3>SETUP</h3>
-<img src="images/LDR-fritz.png" alt="fritzing diagram" style=
-"width: 200px; height: 300px;" align="left" hspace="10">The LDR
-used is a Cadmium Sulphide device with a 1MOhm dark resistance and
-2-4KOhm at 100 lux.&nbsp; The capacitor is a 104
-ceramic.<span itemprop="name"><br>
-<br>
-One end of the capacitor is connected to Pi ground.<br>
-<br>
-One end of the LDR is connected to Pi 3V3.<br>
-<br>
-The other ends of the capacitor and LDR are connected to a spare
-gpio.</span><br>
-<p>Here P1-1 is used for 3V3, P1-20 is used for ground, and gpio 18
-(P1-12) is used for the gpio.<br clear="all"></p>
-<p><img src="images/LDR-photo.jpg" style=
-"width: 500px; height: 667px;" alt="photo of set-up"></p>
-<h3>CODE</h3>
-<code>#include &lt;stdio.h&gt;<br>
-<br>
-#include &lt;pigpio.h&gt;<br>
-<br>
-/*
------------------------------------------------------------------------<br>
-
-<br>
-&nbsp;&nbsp; 3V3 ----- Light Dependent Resistor --+-- Capacitor
------ Ground<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-+-- gpio<br>
-<br>
-<br>
-&nbsp; cc -o LDR LDR.c -lpigpio -lpthread -lrt<br>
-&nbsp; sudo ./LDR<br>
-<br>
-*/<br>
-<br>
-#define LDR 18<br>
-<br>
-/* forward declaration */<br>
-<br>
-void alert(int pin, int level, uint32_t tick);<br>
-<br>
-int main (int argc, char *argv[])<br>
-{<br>
-&nbsp;&nbsp; if (gpioInitialise()&lt;0) return 1;<br>
-<br>
-&nbsp;&nbsp; gpioSetAlertFunc(LDR, alert); /* call alert when LDR
-changes state */<br>
-&nbsp;&nbsp;&nbsp;&nbsp;<br>
-&nbsp;&nbsp; while (1)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioSetMode(LDR, PI_OUTPUT); /*
-drain capacitor */<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioWrite(LDR, PI_OFF);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioDelay(200); /* 50 micros is
-enough, 200 is overkill */<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioSetMode(LDR, PI_INPUT); /* start
-capacitor recharge */<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioDelay(10000); /* nominal 100
-readings per second */<br>
-&nbsp;&nbsp; }<br>
-<br>
-&nbsp;&nbsp; gpioTerminate();<br>
-}<br>
-<br>
-void alert(int pin, int level, uint32_t tick)<br>
-{<br>
-&nbsp;&nbsp; static uint32_t inited = 0;<br>
-&nbsp;&nbsp; static uint32_t lastTick, firstTick;<br>
-<br>
-&nbsp;&nbsp; uint32_t diffTick;<br>
-<br>
-&nbsp;&nbsp; if (inited)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; diffTick = tick - lastTick;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lastTick = tick;<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (level == 1) printf("%u %d\ ",
-tick-firstTick, diffTick);<br>
-&nbsp;&nbsp; }<br>
-&nbsp;&nbsp; else<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inited = 1;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; firstTick = tick;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lastTick = firstTick;<br>
-&nbsp;&nbsp; }<br>
-}<br></code>
-<h3>BUILD</h3>
-<code>cc -o LDR LDR.c -lpigpio -lrt -lpthread<br></code>
-<h3>RUN</h3>
-<code>sudo ./LDR &gt;LDR.dat &amp;</code><br>
-<br>
-While the program is running you can capture the waveform using the
-notification feature built in to pigpio.&nbsp; Issue the following
-commands on the Pi.<br>
-<br>
-<code>pigs no<br>
-pig2vcd&nbsp; &lt;/dev/pigpio0 &gt;LDR.vcd &amp;<br>
-pigs nb 0 0x40000 # set bit for gpio 18<br></code>
-<p>Change the light falling on the LDR for a few seconds (e.g.
-shine a torch on it or shade it with your hands).<br></p>
-<code>pigs nc 0</code><br>
-<p>The file LDR.vcd will contain the captured waveform, which can
-be viewed using GTKWave.</p>
-<p>Overview</p>
-<img src="images/LDR-wave-1.png" style=
-"width: 600px; height: 100px;" alt="LDR waveform 1"><br>
-<p>Reading circa every 10ms<br></p>
-<img src="images/LDR-wave-2.png" style=
-"width: 600px; height: 100px;" alt="LDR waveform 2"><br>
-<p>One reading, circa 400us<br></p>
-<img src="images/LDR-wave-3.png" style=
-"width: 600px; height: 100px;" alt="LDR waveform 3"><br>
-<p>The file LDR.dat will contain pairs of timestamps and recharge
-time (in us).&nbsp; The following&nbsp; script will convert the
-timestamps into seconds.<span style=
-"font-style: italic;"><br></span></p>
-<p><code>awk '{print $1/1000000, $2}' LDR.dat
-&gt;LDR-secs.dat</code></p>
-<p>Gnuplot is a useful tool to graph data.<br></p>
-plot [14:24] 'LDR-secs.dat' with lines title 'LDR'
-<p>Gnuplot readings 14-24 seconds<br></p>
-<p><img src="images/LDR-gnup-1.png" style=
-"width: 600px; height: 321px;" alt="gnuplot 1"></p>
-plot [18:21] 'LDR-secs.dat' with lines title 'LDR'<br>
-<br>
-Gnuplot readings 18-21 seconds
-<p><img src="images/LDR-gnup-2.png" style=
-"width: 600px; height: 321px;" alt="Gnuplot 2"></p>
-</td>
-</table>
-<div style="vertical-align: center; text-align: center; background-color:#98bf21; font-size:0.8em; height:30px"><a class="l2" href="index.html">[pigpio]</a>
-<a class="l2" href="cif.html">[pigpio C I/F]</a>
-<a class="l2" href="pigpiod.html">[pigpiod]</a>
-<a class="l2" href="pdif2.html">[pigpiod C I/F]</a>
-<a class="l2" href="python.html">[Python]</a>
-<a class="l2" href="pigs.html">[pigs]</a>
-<a class="l2" href="piscope.html">[piscope]</a>
-<a class="l2" href="misc.html">[Misc]</a>
-<a class="l2" href="examples.html">[Examples]</a>
-<a class="l2" href="download.html">[Download]</a>
-<a class="l2" href="faq.html">[FAQ]</a>
-<a class="l2" href="sitemap.html">[Site Map]</a>
-</div>
-<table><tr>
-<td style="width: 200px"><div style="text-align: left;"><small>&copy; 2012-2020</small></div></td>
-<td style="width: 350px"><div style="text-align: center;">e-mail: pigpio @ abyz.me.uk</div></td>
-<td style="width: 200px"><div style="text-align: right;"><small>Updated: 30/04/2020</small></div></td>
-</tr></table>
-</td>
-</table>
-</body>
-</html>
diff --git a/DOC/HTML/ex_ir_remote.html b/DOC/HTML/ex_ir_remote.html
deleted file mode 100644
index 5f548cb..0000000
--- a/DOC/HTML/ex_ir_remote.html
+++ /dev/null
@@ -1,308 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta name="description" content="Raspberry Pi Reg. C GPIO library and Python GPIO module and shell command utilities to control the GPIO, including SPI, I2C, and serial links." />
- <meta name="keywords" content="raspberry, pi, C, Python, GPIO, library, shell, command, utilities, module, SPI, I2C, serial" />
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>pigpio library</title>
- <link rel="stylesheet" type="text/css" href="scripts/index.css">
- <link rel="icon" href="favicon.ico" type="image/x-icon">
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
-</head>
-<body>
-
-<table style="padding:0px; border:0px; margin:0px; width:780px; background-color:#e0e0e0;">
-<td style="background:#EAF2E6 url('images/sidebar.gif') repeat-y; width:35px; height:100%"></td>
-<td>
-<table>
-<div style="background:url('images/topbar.gif') repeat-x; height: 70px; font-size:1.5em; vertical-align: top;"><a href="index.html"><img src="images/pigpio-logo.gif" border="0" /></a>pigpio library</div>
-</table>
-<table><div>
-<td><img src="images/driver.jpg" width="250"></td>
-<td><img src="images/imu-3.jpg" width="250"></td>
-<td><img src="images/ir-motion.jpg" width="250"></td>
-</div></table>
-<table>
-<td style="vertical-align: top; background-color: #98bf21;"><a class="l1" href="index.html">pigpio</a>
-<a class="l1" href="cif.html">pigpio C I/F</a>
-<a class="l1" href="pigpiod.html">pigpiod</a>
-<a class="l1" href="pdif2.html">pigpiod C I/F</a>
-<a class="l1" href="python.html">Python</a>
-<a class="l1" href="pigs.html">pigs</a>
-<a class="l1" href="piscope.html">piscope</a>
-<a class="l1" href="misc.html">Misc</a>
-<a class="l1" href="examples.html">Examples</a>
-<a class="l1" href="download.html">Download</a>
-<a class="l1" href="faq.html">FAQ</a>
-<a class="l1" href="sitemap.html">Site Map</a>
-</td>
-<td><center><h2>IR Remote Example</h2></center>
-<p>The following code shows one way to read an infrared remote
-control device (the sort used in TVs and stereo systems).</p>
-<h3>SETUP</h3>
-<img alt="fritzing diagram" style="width: 200px; height: 317px;"
-src="images/ir-fritz.png" align="left" hspace="10">The device used
-is a <span itemprop="name">SFH5110 (IR Receiver for remote control,
-carrier 38 kHz).<br>
-<br></span> Pin 1 (left from front) may be connected to any spare
-gpio.&nbsp; Here it's connected via a 4K7 current limiting
-resistor.&nbsp; This isn't really needed as the device has an
-internal 23K resistor in-line.&nbsp; It does no harm though.<br>
-<br>
-Pin 2 should be connected to a Pi ground pin.<br>
-<br>
-Pin 3 should be connected to a Pi 5V pin.<br>
-<p>Here pin 1 to gpio7 (P1-26) via a 4K7 resistor, pin 2 to ground
-(P1-14), and pin 3 to 5V (P1-2).<br clear="all"></p>
-<p><img src="images/ir-photo.jpg" style=
-"width: 500px; height: 500px;" alt="photo of set-up"></p>
-<h3>CODE</h3>
-<code>#include &lt;stdio.h&gt;<br>
-<br>
-#include &lt;pigpio.h&gt;<br>
-<br>
-#define IR_PIN 7<br>
-<br>
-#define OUTSIDE_CODE 0<br>
-#define INSIDE_CODE&nbsp; 1<br>
-<br>
-#define MIN_MESSAGE_GAP 3000<br>
-#define MAX_MESSAGE_END 3000<br>
-<br>
-#define MAX_TRANSITIONS 500<br>
-<br>
-/*<br>
-&nbsp;&nbsp; using the FNV-1a
-hash&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
-
-&nbsp;&nbsp; from
-http://isthe.com/chongo/tech/comp/fnv/#FNV-param<br>
-*/<br>
-<br>
-#define FNV_PRIME_32 16777619<br>
-#define FNV_BASIS_32 2166136261U<br>
-<br>
-static volatile uint32_t ir_hash = 0;<br>
-<br>
-typedef struct<br>
-{<br>
-&nbsp;&nbsp; int state;<br>
-&nbsp;&nbsp; int count;<br>
-&nbsp;&nbsp; int level;<br>
-&nbsp;&nbsp; uint16_t micros[MAX_TRANSITIONS];<br>
-} decode_t;<br>
-<br>
-/* forward declarations */<br>
-<br>
-void&nbsp;&nbsp;&nbsp;&nbsp; alert(int gpio, int level, uint32_t
-tick);<br>
-uint32_t getHash(decode_t * decode);<br>
-void&nbsp;&nbsp;&nbsp;&nbsp; updateState(decode_t * decode, int
-level, uint32_t micros);<br>
-<br>
-int main(int argc, char * argv[])<br>
-{<br>
-&nbsp;&nbsp; if (gpioInitialise()&lt;0)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 1 ;<br>
-&nbsp;&nbsp; }<br>
-<br>
-&nbsp;&nbsp; /* IR pin as input */<br>
-<br>
-&nbsp;&nbsp; gpioSetMode(IR_PIN, PI_INPUT);<br>
-<br>
-&nbsp;&nbsp; /* 5ms max gap after last pulse */<br>
-<br>
-&nbsp;&nbsp; gpioSetWatchdog(IR_PIN, 5);<br>
-<br>
-&nbsp;&nbsp; /* monitor IR level changes */<br>
-<br>
-&nbsp;&nbsp; gpioSetAlertFunc(IR_PIN, alert);<br>
-<br>
-&nbsp;&nbsp; while (1)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (ir_hash)<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* non-zero means
-new decode */<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("ir code is
-%u\ ", ir_hash);<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ir_hash = 0;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioDelay(100000); /* check remote
-10 times per second */<br>
-&nbsp;&nbsp; }<br>
-<br>
-&nbsp;&nbsp; gpioTerminate();<br>
-}<br>
-<br>
-void alert(int gpio, int level, uint32_t tick)<br>
-{<br>
-&nbsp;&nbsp; static int inited = 0;<br>
-<br>
-&nbsp;&nbsp; static decode_t activeHigh, activeLow;<br>
-<br>
-&nbsp;&nbsp; static uint32_t lastTick;<br>
-<br>
-&nbsp;&nbsp; uint32_t diffTick;<br>
-<br>
-&nbsp;&nbsp; if (!inited)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inited = 1;<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activeHigh.state = OUTSIDE_CODE;
-activeHigh.level = PI_LOW;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activeLow.state&nbsp; =
-OUTSIDE_CODE; activeLow.level&nbsp; = PI_HIGH;<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lastTick = tick;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<br>
-&nbsp;&nbsp; }<br>
-<br>
-&nbsp;&nbsp; diffTick = tick - lastTick;<br>
-<br>
-&nbsp;&nbsp; if (level != PI_TIMEOUT) lastTick = tick;<br>
-<br>
-&nbsp;&nbsp; updateState(&amp;activeHigh, level, diffTick);<br>
-&nbsp;&nbsp; updateState(&amp;activeLow, level, diffTick);<br>
-}<br>
-<br>
-void updateState(decode_t * decode, int level, uint32_t micros)<br>
-{<br>
-&nbsp;&nbsp; /*<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; We are dealing with active high as
-well as active low<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; remotes.&nbsp; Abstract the common
-functionality.<br>
-&nbsp;&nbsp; */<br>
-<br>
-&nbsp;&nbsp; if (decode-&gt;state == OUTSIDE_CODE)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (level == decode-&gt;level)<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (micros &gt;
-MIN_MESSAGE_GAP)<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-decode-&gt;state = INSIDE_CODE;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-decode-&gt;count = 0;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
-&nbsp;&nbsp; }<br>
-&nbsp;&nbsp; else<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (micros &gt; MAX_MESSAGE_END)<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* end of message
-*/<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* ignore if last
-code not consumed */<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!ir_hash)
-ir_hash = getHash(decode);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; decode-&gt;state =
-OUTSIDE_CODE;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if
-(decode-&gt;count &lt; (MAX_TRANSITIONS-1))<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-if (level != PI_TIMEOUT)<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-decode-&gt;micros[decode-&gt;count++] = micros;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
-&nbsp;&nbsp; }<br>
-}<br>
-<br>
-int compare(unsigned int oldval, unsigned int newval)<br>
-{<br>
-&nbsp;&nbsp; if&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (newval &lt; (oldval
-* 0.75)) {return 1;}<br>
-&nbsp;&nbsp; else if (oldval &lt; (newval * 0.75)) {return 2;}<br>
-&nbsp;&nbsp;
-else&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-{return 4;}<br>
-}<br>
-<br>
-uint32_t getHash(decode_t * decode)<br>
-{<br>
-&nbsp;&nbsp; /* use FNV-1a */<br>
-<br>
-&nbsp;&nbsp; uint32_t hash;<br>
-&nbsp;&nbsp; int i, value;<br>
-<br>
-&nbsp;&nbsp; if (decode-&gt;count &lt; 6) {return 0;}<br>
-<br>
-&nbsp;&nbsp; hash = FNV_BASIS_32;<br>
-<br>
-&nbsp;&nbsp; for (i=0; i&lt;(decode-&gt;count-2); i++)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value =
-compare(decode-&gt;micros[i], decode-&gt;micros[i+2]);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hash = hash ^ value;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hash = (hash * FNV_PRIME_32);<br>
-&nbsp;&nbsp; }<br>
-<br>
-&nbsp;&nbsp; return hash;<br>
-}<br></code>
-<h3>BUILD</h3>
-<code>cc -o ir_remote ir_remote.c -lpigpio -lrt
--lpthread<br></code>
-<h3>RUN</h3>
-<code>sudo ./ir_remote</code><br>
-<p>A hash code is formed from the level transitions detected during
-a remote key press.&nbsp; This is likely to be unique over multiple
-remotes and keys.</p>
-<p>While the program is running you can capture the waveform using
-the notification feature built in to pigpio.&nbsp; Issue the
-following commands on the Pi.</p>
-<code>pigs no<br>
-pig2vcd&nbsp; &lt;/dev/pigpio0 &gt;ir.vcd &amp;<br>
-pigs nb 0 0x80 # set bits for gpios 7 (0x80)<br></code>
-<p>Press a few different remotes and keys.&nbsp; Then enter<br></p>
-<code>pigs nc 0</code><br>
-<p>The file ir.vcd will contain the captured waveform, which can be
-viewed using GTKWave.</p>
-<p>Overview</p>
-<img src="images/ir-wave-1.png" style=
-"width: 600px; height: 100px;" alt="ir remote waveform 1"><br>
-<p>Remote A typical waveform</p>
-<img src="images/ir-wave-2.png" style=
-"width: 600px; height: 100px;" alt="ir remote waveform 2"><br>
-<p>Remote B typical waveform</p>
-<img style="width: 600px; height: 100px;" alt=
-"ir remote waveform 3" src="images/ir-wave-3.png">
-</td>
-</table>
-<div style="vertical-align: center; text-align: center; background-color:#98bf21; font-size:0.8em; height:30px"><a class="l2" href="index.html">[pigpio]</a>
-<a class="l2" href="cif.html">[pigpio C I/F]</a>
-<a class="l2" href="pigpiod.html">[pigpiod]</a>
-<a class="l2" href="pdif2.html">[pigpiod C I/F]</a>
-<a class="l2" href="python.html">[Python]</a>
-<a class="l2" href="pigs.html">[pigs]</a>
-<a class="l2" href="piscope.html">[piscope]</a>
-<a class="l2" href="misc.html">[Misc]</a>
-<a class="l2" href="examples.html">[Examples]</a>
-<a class="l2" href="download.html">[Download]</a>
-<a class="l2" href="faq.html">[FAQ]</a>
-<a class="l2" href="sitemap.html">[Site Map]</a>
-</div>
-<table><tr>
-<td style="width: 200px"><div style="text-align: left;"><small>&copy; 2012-2020</small></div></td>
-<td style="width: 350px"><div style="text-align: center;">e-mail: pigpio @ abyz.me.uk</div></td>
-<td style="width: 200px"><div style="text-align: right;"><small>Updated: 30/04/2020</small></div></td>
-</tr></table>
-</td>
-</table>
-</body>
-</html>
diff --git a/DOC/HTML/ex_motor_shield.html b/DOC/HTML/ex_motor_shield.html
deleted file mode 100644
index e5d28f0..0000000
--- a/DOC/HTML/ex_motor_shield.html
+++ /dev/null
@@ -1,309 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta name="description" content="Raspberry Pi Reg. C GPIO library and Python GPIO module and shell command utilities to control the GPIO, including SPI, I2C, and serial links." />
- <meta name="keywords" content="raspberry, pi, C, Python, GPIO, library, shell, command, utilities, module, SPI, I2C, serial" />
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>pigpio library</title>
- <link rel="stylesheet" type="text/css" href="scripts/index.css">
- <link rel="icon" href="favicon.ico" type="image/x-icon">
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
-</head>
-<body>
-
-<table style="padding:0px; border:0px; margin:0px; width:780px; background-color:#e0e0e0;">
-<td style="background:#EAF2E6 url('images/sidebar.gif') repeat-y; width:35px; height:100%"></td>
-<td>
-<table>
-<div style="background:url('images/topbar.gif') repeat-x; height: 70px; font-size:1.5em; vertical-align: top;"><a href="index.html"><img src="images/pigpio-logo.gif" border="0" /></a>pigpio library</div>
-</table>
-<table><div>
-<td><img src="images/stepper.jpg" width="250"></td>
-<td><img src="images/transistors.jpg" width="250"></td>
-<td><img src="images/wires.jpg" width="250"></td>
-</div></table>
-<table>
-<td style="vertical-align: top; background-color: #98bf21;"><a class="l1" href="index.html">pigpio</a>
-<a class="l1" href="cif.html">pigpio C I/F</a>
-<a class="l1" href="pigpiod.html">pigpiod</a>
-<a class="l1" href="pdif2.html">pigpiod C I/F</a>
-<a class="l1" href="python.html">Python</a>
-<a class="l1" href="pigs.html">pigs</a>
-<a class="l1" href="piscope.html">piscope</a>
-<a class="l1" href="misc.html">Misc</a>
-<a class="l1" href="examples.html">Examples</a>
-<a class="l1" href="download.html">Download</a>
-<a class="l1" href="faq.html">FAQ</a>
-<a class="l1" href="sitemap.html">Site Map</a>
-</td>
-<td><center><h2>Arduino Motor Shield</h2></center>
-The following example demonstrates the use of an Arduino shield
-from the Rasperry Pi.<br>
-<br>
-The shield used is a clone of the Adafruit motor shield.&nbsp; See
-<a href="http://shieldlist.org/adafruit/motor">shieldlist.org</a>
-for details.<br>
-<br>
-For the demonstration DC motors 3 and 4 are being driven forwards
-and backwards with changing speeds (speeds are controlled via
-PWM).<br>
-<br>
-Seven connections are made between the Pi and the shield.&nbsp;
-Four to latch the motor states (latch, enable, data, clock); Two to
-control motor speed (PWM 3 and 4); and ground.<br>
-<br>
-The code used was ported from the Adafruit Arduino code and
-converted to use the pigpio library.&nbsp; Only the DC motor code
-was ported.<br>
-<br>
-A video of the shield in use is available at <a href=
-"http://youtu.be/Z_l3C246oVI">youtube.com</a><br>
-<code><br>
-#include &lt;stdio.h&gt;</code> <code><br>
-<br>
-#include &lt;pigpio.h&gt;<br>
-<br>
-/*<br>
-&nbsp;&nbsp; This code may be used to drive the Adafruit (or
-clones) Motor Shield.<br>
-<br>
-&nbsp;&nbsp; The code as written only supports DC motors.<br>
-<br>
-&nbsp;&nbsp; http://shieldlist.org/adafruit/motor<br>
-<br>
-&nbsp;&nbsp; The shield pinouts are<br>
-<br>
-&nbsp;&nbsp; D12 MOTORLATCH<br>
-&nbsp;&nbsp; D11 PMW motor 1<br>
-&nbsp;&nbsp; D10 Servo 1<br>
-&nbsp;&nbsp; D9&nbsp; Servo 2<br>
-&nbsp;&nbsp; D8&nbsp; MOTORDATA<br>
-<br>
-&nbsp;&nbsp; D7&nbsp; MOTORENABLE<br>
-&nbsp;&nbsp; D6&nbsp; PWM motor 4<br>
-&nbsp;&nbsp; D5&nbsp; PWM motor 3<br>
-&nbsp;&nbsp; D4&nbsp; MOTORCLK<br>
-&nbsp;&nbsp; D3&nbsp; PWM motor 2<br>
-<br>
-&nbsp;&nbsp; The motor states (forward, backward, brake, release)
-are encoded using the<br>
-&nbsp;&nbsp; MOTOR_ latch pins.&nbsp; This saves four gpios.<br>
-*/<br>
-<br>
-typedef unsigned char uint8_t;<br>
-<br>
-#define BIT(bit) (1 &lt;&lt; (bit))<br>
-<br>
-/* assign gpios to drive the shield pins */<br>
-<br>
-/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-Shield&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Pi */<br>
-<br>
-#define MOTORLATCH&nbsp; 14<br>
-#define MOTORCLK&nbsp;&nbsp;&nbsp; 24<br>
-#define MOTORENABLE 25<br>
-#define MOTORDATA&nbsp;&nbsp; 15<br>
-<br>
-#define MOTOR_3_PWM&nbsp; 7<br>
-#define MOTOR_4_PWM&nbsp; 8<br>
-<br>
-/*<br>
-&nbsp;&nbsp; The only other connection needed between the Pi and
-the shield<br>
-&nbsp;&nbsp; is ground to ground. I used Pi P1-6 to shield gnd
-(next to D13).<br>
-*/<br>
-<br>
-/* assignment of motor states to latch */<br>
-<br>
-#define MOTOR1_A 2<br>
-#define MOTOR1_B 3<br>
-#define MOTOR2_A 1<br>
-#define MOTOR2_B 4<br>
-#define MOTOR4_A 0<br>
-#define MOTOR4_B 6<br>
-#define MOTOR3_A 5<br>
-#define MOTOR3_B 7<br>
-<br>
-#define FORWARD&nbsp; 1<br>
-#define BACKWARD 2<br>
-#define BRAKE&nbsp;&nbsp;&nbsp; 3<br>
-#define RELEASE&nbsp; 4<br>
-<br>
-static uint8_t latch_state;<br>
-<br>
-void latch_tx(void)<br>
-{<br>
-&nbsp;&nbsp; unsigned char i;<br>
-<br>
-&nbsp;&nbsp; gpioWrite(MOTORLATCH, PI_LOW);<br>
-<br>
-&nbsp;&nbsp; gpioWrite(MOTORDATA, PI_LOW);<br>
-<br>
-&nbsp;&nbsp; for (i=0; i&lt;8; i++)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioDelay(10);&nbsp; // 10 micros
-delay<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioWrite(MOTORCLK, PI_LOW);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (latch_state &amp; BIT(7-i))
-gpioWrite(MOTORDATA, PI_HIGH);<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-else&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-gpioWrite(MOTORDATA, PI_LOW);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioDelay(10);&nbsp; // 10 micros
-delay<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioWrite(MOTORCLK, PI_HIGH);<br>
-&nbsp;&nbsp; }<br>
-<br>
-&nbsp;&nbsp; gpioWrite(MOTORLATCH, PI_HIGH);<br>
-}<br>
-<br>
-void init(void)<br>
-{<br>
-&nbsp;&nbsp; latch_state = 0;<br>
-<br>
-&nbsp;&nbsp; latch_tx();<br>
-<br>
-&nbsp;&nbsp; gpioWrite(MOTORENABLE, PI_LOW);<br>
-}<br>
-<br>
-void DCMotorInit(uint8_t num)<br>
-{<br>
-&nbsp;&nbsp; switch (num)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 1: latch_state &amp;=
-~BIT(MOTOR1_A) &amp; ~BIT(MOTOR1_B); break;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 2: latch_state &amp;=
-~BIT(MOTOR2_A) &amp; ~BIT(MOTOR2_B); break;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 3: latch_state &amp;=
-~BIT(MOTOR3_A) &amp; ~BIT(MOTOR3_B); break;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 4: latch_state &amp;=
-~BIT(MOTOR4_A) &amp; ~BIT(MOTOR4_B); break;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; default: return;<br>
-&nbsp;&nbsp; }<br>
-<br>
-&nbsp;&nbsp; latch_tx();<br>
-<br>
-&nbsp;&nbsp; printf("Latch=%08X\ ", latch_state);<br>
-}<br>
-<br>
-void DCMotorRun(uint8_t motornum, uint8_t cmd)<br>
-{<br>
-&nbsp;&nbsp; uint8_t a, b;<br>
-<br>
-&nbsp;&nbsp; switch (motornum)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 1: a = MOTOR1_A; b = MOTOR1_B;
-break;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 2: a = MOTOR2_A; b = MOTOR2_B;
-break;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 3: a = MOTOR3_A; b = MOTOR3_B;
-break;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 4: a = MOTOR4_A; b = MOTOR4_B;
-break;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; default: return;<br>
-&nbsp;&nbsp; }<br>
-&nbsp;<br>
-&nbsp;&nbsp; switch (cmd)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case FORWARD:&nbsp; latch_state
-|=&nbsp; BIT(a); latch_state &amp;= ~BIT(b); break;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case BACKWARD: latch_state &amp;=
-~BIT(a); latch_state |=&nbsp; BIT(b); break;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case RELEASE:&nbsp; latch_state
-&amp;= ~BIT(a); latch_state &amp;= ~BIT(b); break;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; default: return;<br>
-&nbsp;&nbsp; }<br>
-<br>
-&nbsp;&nbsp; latch_tx();<br>
-<br>
-&nbsp;&nbsp; printf("Latch=%08X\ ", latch_state);<br>
-}<br>
-<br>
-int main (int argc, char *argv[])<br>
-{<br>
-&nbsp;&nbsp; int i;<br>
-<br>
-&nbsp;&nbsp; if (gpioInitialise()&lt;0) return 1;<br>
-<br>
-&nbsp;&nbsp; gpioSetMode(MOTORLATCH,&nbsp; PI_OUTPUT);<br>
-&nbsp;&nbsp; gpioSetMode(MOTORENABLE, PI_OUTPUT);<br>
-&nbsp;&nbsp; gpioSetMode(MOTORDATA,&nbsp;&nbsp; PI_OUTPUT);<br>
-&nbsp;&nbsp; gpioSetMode(MOTORCLK,&nbsp;&nbsp;&nbsp;
-PI_OUTPUT);<br>
-<br>
-&nbsp;&nbsp; gpioSetMode(MOTOR_3_PWM, PI_OUTPUT);<br>
-&nbsp;&nbsp; gpioSetMode(MOTOR_4_PWM, PI_OUTPUT);<br>
-<br>
-&nbsp;&nbsp; gpioPWM(MOTOR_3_PWM, 0);<br>
-&nbsp;&nbsp; gpioPWM(MOTOR_4_PWM, 0);<br>
-<br>
-&nbsp;&nbsp; init();<br>
-<br>
-&nbsp;&nbsp; for (i=60; i&lt;160; i+=20)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioPWM(MOTOR_3_PWM, i);<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioPWM(MOTOR_4_PWM, 220-i);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DCMotorRun(3, FORWARD);<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DCMotorRun(4, BACKWARD);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep(2);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DCMotorRun(3, RELEASE);<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DCMotorRun(4, RELEASE);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep(2);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioPWM(MOTOR_4_PWM, i);<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioPWM(MOTOR_3_PWM, 220-i);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DCMotorRun(3, BACKWARD);<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DCMotorRun(4, FORWARD);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep(2);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DCMotorRun(3, RELEASE);<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DCMotorRun(4, RELEASE);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep(2);<br>
-&nbsp;&nbsp; }<br>
-<br>
-&nbsp;&nbsp; gpioPWM(MOTOR_4_PWM, 0);<br>
-&nbsp;&nbsp; gpioPWM(MOTOR_3_PWM, 0);<br>
-<br>
-&nbsp;&nbsp; DCMotorRun(3, RELEASE);<br>
-&nbsp;&nbsp; DCMotorRun(4, RELEASE);<br>
-<br>
-&nbsp;&nbsp; gpioTerminate();<br>
-}<br></code>
-</td>
-</table>
-<div style="vertical-align: center; text-align: center; background-color:#98bf21; font-size:0.8em; height:30px"><a class="l2" href="index.html">[pigpio]</a>
-<a class="l2" href="cif.html">[pigpio C I/F]</a>
-<a class="l2" href="pigpiod.html">[pigpiod]</a>
-<a class="l2" href="pdif2.html">[pigpiod C I/F]</a>
-<a class="l2" href="python.html">[Python]</a>
-<a class="l2" href="pigs.html">[pigs]</a>
-<a class="l2" href="piscope.html">[piscope]</a>
-<a class="l2" href="misc.html">[Misc]</a>
-<a class="l2" href="examples.html">[Examples]</a>
-<a class="l2" href="download.html">[Download]</a>
-<a class="l2" href="faq.html">[FAQ]</a>
-<a class="l2" href="sitemap.html">[Site Map]</a>
-</div>
-<table><tr>
-<td style="width: 200px"><div style="text-align: left;"><small>&copy; 2012-2020</small></div></td>
-<td style="width: 350px"><div style="text-align: center;">e-mail: pigpio @ abyz.me.uk</div></td>
-<td style="width: 200px"><div style="text-align: right;"><small>Updated: 30/04/2020</small></div></td>
-</tr></table>
-</td>
-</table>
-</body>
-</html>
diff --git a/DOC/HTML/ex_rotary_encoder.html b/DOC/HTML/ex_rotary_encoder.html
deleted file mode 100644
index b15b354..0000000
--- a/DOC/HTML/ex_rotary_encoder.html
+++ /dev/null
@@ -1,240 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta name="description" content="Raspberry Pi Reg. C GPIO library and Python GPIO module and shell command utilities to control the GPIO, including SPI, I2C, and serial links." />
- <meta name="keywords" content="raspberry, pi, C, Python, GPIO, library, shell, command, utilities, module, SPI, I2C, serial" />
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>pigpio library</title>
- <link rel="stylesheet" type="text/css" href="scripts/index.css">
- <link rel="icon" href="favicon.ico" type="image/x-icon">
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
-</head>
-<body>
-
-<table style="padding:0px; border:0px; margin:0px; width:780px; background-color:#e0e0e0;">
-<td style="background:#EAF2E6 url('images/sidebar.gif') repeat-y; width:35px; height:100%"></td>
-<td>
-<table>
-<div style="background:url('images/topbar.gif') repeat-x; height: 70px; font-size:1.5em; vertical-align: top;"><a href="index.html"><img src="images/pigpio-logo.gif" border="0" /></a>pigpio library</div>
-</table>
-<table><div>
-<td><img src="images/msp430.jpg" width="250"></td>
-<td><img src="images/leds.jpg" width="250"></td>
-<td><img src="images/ldr.jpg" width="250"></td>
-</div></table>
-<table>
-<td style="vertical-align: top; background-color: #98bf21;"><a class="l1" href="index.html">pigpio</a>
-<a class="l1" href="cif.html">pigpio C I/F</a>
-<a class="l1" href="pigpiod.html">pigpiod</a>
-<a class="l1" href="pdif2.html">pigpiod C I/F</a>
-<a class="l1" href="python.html">Python</a>
-<a class="l1" href="pigs.html">pigs</a>
-<a class="l1" href="piscope.html">piscope</a>
-<a class="l1" href="misc.html">Misc</a>
-<a class="l1" href="examples.html">Examples</a>
-<a class="l1" href="download.html">Download</a>
-<a class="l1" href="faq.html">FAQ</a>
-<a class="l1" href="sitemap.html">Site Map</a>
-</td>
-<td><center><h2>Rotary Encoder Example</h2></center>
-<p>The following code shows one way to read an incremental
-mechanical rotary enoder (the sort used for volume control in audio
-systems).&nbsp; These rotary encoders have two switches A and B
-which return a quadrature output, i.e. they are 90 degrees out of
-phase.</p>
-<h3>SETUP</h3>
-<img alt="fritzing diagram" style="width: 200px; height: 300px;"
-src="images/re-fritz.png" align="left" hspace="10">The common
-(centre) terminal should be connected to a Pi ground.
-<p>The A and B terminals may be connected to any spare gpios.</p>
-<p>Here A to gpio18 (P1-12), common to ground (P1-20), B to gpio7
-(P1-26).<br clear="all"></p>
-<p><img src="images/re-photo.jpg" style=
-"width: 400px; height: 300px;" alt="photo of set-up"></p>
-<h3>CODE</h3>
-<code>#include &lt;stdio.h&gt;<br>
-<br>
-#include &lt;pigpio.h&gt;<br>
-<br>
-/*<br>
-&nbsp;&nbsp; Rotary encoder connections:<br>
-<br>
-&nbsp;&nbsp; Encoder A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - gpio
-18&nbsp;&nbsp; (pin P1-12)<br>
-&nbsp;&nbsp; Encoder B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - gpio
-7&nbsp;&nbsp;&nbsp; (pin P1-26)<br>
-&nbsp;&nbsp; Encoder Common - Pi ground (pin P1-20)<br>
-*/<br>
-<br>
-#define ENCODER_A 18<br>
-#define ENCODER_B&nbsp; 7<br>
-<br>
-static volatile int encoderPos;<br>
-<br>
-/* forward declaration */<br>
-<br>
-void encoderPulse(int gpio, int lev, uint32_t tick);<br>
-<br>
-int main(int argc, char * argv[])<br>
-{<br>
-&nbsp;&nbsp; int pos=0;<br>
-<br>
-&nbsp;&nbsp; if (gpioInitialise()&lt;0) return 1;<br>
-<br>
-&nbsp;&nbsp; gpioSetMode(ENCODER_A, PI_INPUT);<br>
-&nbsp;&nbsp; gpioSetMode(ENCODER_B, PI_INPUT);<br>
-<br>
-&nbsp;&nbsp; /* pull up is needed as encoder common is grounded
-*/<br>
-<br>
-&nbsp;&nbsp; gpioSetPullUpDown(ENCODER_A, PI_PUD_UP);<br>
-&nbsp;&nbsp; gpioSetPullUpDown(ENCODER_B, PI_PUD_UP);<br>
-<br>
-&nbsp;&nbsp; encoderPos = pos;<br>
-<br>
-&nbsp;&nbsp; /* monitor encoder level changes */<br>
-<br>
-&nbsp;&nbsp; gpioSetAlertFunc(ENCODER_A, encoderPulse);<br>
-&nbsp;&nbsp; gpioSetAlertFunc(ENCODER_B, encoderPulse);<br>
-<br>
-&nbsp;&nbsp; while (1)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (pos != encoderPos)<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pos =
-encoderPos;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("pos=%d\ ",
-pos);<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioDelay(20000); /* check pos 50
-times per second */<br>
-&nbsp;&nbsp; }<br>
-<br>
-&nbsp;&nbsp; gpioTerminate();<br>
-}<br>
-<br>
-void encoderPulse(int gpio, int level, uint32_t tick)<br>
-{<br>
-&nbsp;&nbsp; /*<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-+---------+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-+---------+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>
-&nbsp;&nbsp; A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>
-&nbsp;&nbsp;
-+---------+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-+---------+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +-----
-1<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-+---------+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-+---------+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-0<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>
-&nbsp;&nbsp; B&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>
-&nbsp;&nbsp; ----+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-+---------+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-+---------+&nbsp; 1<br>
-<br>
-&nbsp;&nbsp; */<br>
-<br>
-&nbsp;&nbsp; static int levA=0, levB=0, lastGpio = -1;<br>
-<br>
-&nbsp;&nbsp; if (gpio == ENCODER_A) levA = level; else levB =
-level;<br>
-<br>
-&nbsp;&nbsp; if (gpio != lastGpio) /* debounce */<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lastGpio = gpio;<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ((gpio == ENCODER_A) &amp;&amp;
-(level == 0))<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!levB)
-++encoderPos;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if ((gpio == ENCODER_B)
-&amp;&amp; (level == 1))<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (levA)
---encoderPos;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
-&nbsp;&nbsp; }<br>
-}<br></code>
-<h3>BUILD</h3>
-<code>cc -o rotary_encoder rotary_encoder.c -lpigpio -lrt
--lpthread<br></code>
-<h3>RUN</h3>
-<code>sudo ./rotary_encoder</code><br>
-<p>While the program is running you can capture the waveform using
-the notification feature built in to pigpio.&nbsp; Issue the
-following commands on the Pi.</p>
-<code>pigs no<br>
-pig2vcd&nbsp; &lt;/dev/pigpio0 &gt;re.vcd &amp;<br>
-pigs nb 0 0x40080 # set bits for gpios 7 (0x80) and 18
-(0x40000)<br></code>
-<p>Twiddle the rotary encoder forwards and backwards for a few
-seconds.&nbsp; Then enter<br></p>
-<code>pigs nc 0</code><br>
-<p>The file re.vcd will contain the captured waveform, which can be
-viewed using GTKWave.</p>
-<br>
-Overview<br>
-<br>
-<img src="images/re-wave-1.png" style=
-"width: 600px; height: 100px;" alt=
-"rotary encoder waveform overview"><br>
-<br>
-Detail of switch bounce.&nbsp; Contact A bounces for circa 700 us
-before completing the level transition<br>
-<br>
-<img src="images/re-wave-2.png" style=
-"width: 600px; height: 100px;" alt=
-"rotary encoder waveform detail"><br>
-</td>
-</table>
-<div style="vertical-align: center; text-align: center; background-color:#98bf21; font-size:0.8em; height:30px"><a class="l2" href="index.html">[pigpio]</a>
-<a class="l2" href="cif.html">[pigpio C I/F]</a>
-<a class="l2" href="pigpiod.html">[pigpiod]</a>
-<a class="l2" href="pdif2.html">[pigpiod C I/F]</a>
-<a class="l2" href="python.html">[Python]</a>
-<a class="l2" href="pigs.html">[pigs]</a>
-<a class="l2" href="piscope.html">[piscope]</a>
-<a class="l2" href="misc.html">[Misc]</a>
-<a class="l2" href="examples.html">[Examples]</a>
-<a class="l2" href="download.html">[Download]</a>
-<a class="l2" href="faq.html">[FAQ]</a>
-<a class="l2" href="sitemap.html">[Site Map]</a>
-</div>
-<table><tr>
-<td style="width: 200px"><div style="text-align: left;"><small>&copy; 2012-2020</small></div></td>
-<td style="width: 350px"><div style="text-align: center;">e-mail: pigpio @ abyz.me.uk</div></td>
-<td style="width: 200px"><div style="text-align: right;"><small>Updated: 30/04/2020</small></div></td>
-</tr></table>
-</td>
-</table>
-</body>
-</html>
diff --git a/DOC/HTML/ex_sonar_ranger.html b/DOC/HTML/ex_sonar_ranger.html
deleted file mode 100644
index 1db8410..0000000
--- a/DOC/HTML/ex_sonar_ranger.html
+++ /dev/null
@@ -1,219 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta name="description" content="Raspberry Pi Reg. C GPIO library and Python GPIO module and shell command utilities to control the GPIO, including SPI, I2C, and serial links." />
- <meta name="keywords" content="raspberry, pi, C, Python, GPIO, library, shell, command, utilities, module, SPI, I2C, serial" />
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>pigpio library</title>
- <link rel="stylesheet" type="text/css" href="scripts/index.css">
- <link rel="icon" href="favicon.ico" type="image/x-icon">
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
-</head>
-<body>
-
-<table style="padding:0px; border:0px; margin:0px; width:780px; background-color:#e0e0e0;">
-<td style="background:#EAF2E6 url('images/sidebar.gif') repeat-y; width:35px; height:100%"></td>
-<td>
-<table>
-<div style="background:url('images/topbar.gif') repeat-x; height: 70px; font-size:1.5em; vertical-align: top;"><a href="index.html"><img src="images/pigpio-logo.gif" border="0" /></a>pigpio library</div>
-</table>
-<table><div>
-<td><img src="images/nano.jpg" width="250"></td>
-<td><img src="images/pot.jpg" width="250"></td>
-<td><img src="images/remote-1.jpg" width="250"></td>
-</div></table>
-<table>
-<td style="vertical-align: top; background-color: #98bf21;"><a class="l1" href="index.html">pigpio</a>
-<a class="l1" href="cif.html">pigpio C I/F</a>
-<a class="l1" href="pigpiod.html">pigpiod</a>
-<a class="l1" href="pdif2.html">pigpiod C I/F</a>
-<a class="l1" href="python.html">Python</a>
-<a class="l1" href="pigs.html">pigs</a>
-<a class="l1" href="piscope.html">piscope</a>
-<a class="l1" href="misc.html">Misc</a>
-<a class="l1" href="examples.html">Examples</a>
-<a class="l1" href="download.html">Download</a>
-<a class="l1" href="faq.html">FAQ</a>
-<a class="l1" href="sitemap.html">Site Map</a>
-</td>
-<td><center><h2>Sonar Ranger Example</h2></center>
-<p>The following code shows a method of reading a class of sonar
-rangers.&nbsp; These rangers requires a trigger pulse.&nbsp;
-Shortly after receiving a trigger they transmit a noise pulse and
-set the echo line high.&nbsp; When the echo is received the echo
-line is set low.<br></p>
-<h3>SETUP</h3>
-<img src="images/son-fritz.png" alt="fritzing diagram" style=
-"width: 200px; height: 600px;" align="left" hspace="10"><br>
-<br>
-<br>
-<br>
-<br>
-The ranger used is a SRF05 (check the pinouts, there are many
-variants).<br>
-<br>
-The fritzing diagram shows the back of the ranger, i.e. pin 1 is
-the rightmost.<br>
-<br>
-Pin 1 is 5V.<br>
-Pin 2 is the trigger line.<br>
-Pin 3 is the echo line.<br>
-Pin 4 is out (unused).<br>
-Pin 5 is ground.<br>
-<br clear="all">
-<p><img src="images/son-photo.jpg" style=
-"width: 500px; height: 376px;" alt="photo of set-up"></p>
-<h3>CODE</h3>
-<code>#include &lt;stdio.h&gt;<br>
-<br>
-#include &lt;pigpio.h&gt;<br>
-<br>
-/*<br>
-<br>
-P1&nbsp; Name&nbsp; gpio&nbsp;&nbsp;&nbsp; used for<br>
-<br>
-&nbsp;2&nbsp; 5V&nbsp;&nbsp;&nbsp; ---&nbsp;&nbsp;&nbsp;&nbsp;
-5V<br>
-&nbsp;6&nbsp; GND&nbsp;&nbsp; ---&nbsp;&nbsp;&nbsp;&nbsp;
-Ground<br>
-24&nbsp; CE0&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-Sonar echo<br>
-26&nbsp; CE1&nbsp;&nbsp; 7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-Sonar trigger<br>
-<br>
-*/<br>
-<br>
-#define SONAR_TRIGGER 7<br>
-#define SONAR_ECHO&nbsp;&nbsp;&nbsp; 8<br>
-<br>
-/* forward prototypes */<br>
-<br>
-void sonarTrigger(void);<br>
-<br>
-void sonarEcho(int gpio, int level, uint32_t tick);<br>
-<br>
-int main(int argc, char *argv[])<br>
-{<br>
-&nbsp;&nbsp; if (gpioInitialise()&lt;0) return 1;<br>
-<br>
-&nbsp;&nbsp; gpioSetMode(SONAR_TRIGGER, PI_OUTPUT);<br>
-&nbsp;&nbsp; gpioWrite&nbsp; (SONAR_TRIGGER, PI_OFF);<br>
-<br>
-&nbsp;&nbsp; gpioSetMode(SONAR_ECHO,&nbsp;&nbsp;&nbsp;
-PI_INPUT);<br>
-<br>
-&nbsp;&nbsp; /* update sonar 20 times a second, timer #0 */<br>
-<br>
-&nbsp;&nbsp; gpioSetTimerFunc(0, 50, sonarTrigger); /* every 50ms
-*/<br>
-<br>
-&nbsp;&nbsp; /* monitor sonar echos */<br>
-<br>
-&nbsp;&nbsp; gpioSetAlertFunc(SONAR_ECHO, sonarEcho);<br>
-<br>
-&nbsp;&nbsp; while (1) sleep(1);<br>
-<br>
-&nbsp;&nbsp; gpioTerminate();<br>
-<br>
-&nbsp;&nbsp; return 0;<br>
-}<br>
-<br>
-void sonarTrigger(void)<br>
-{<br>
-&nbsp;&nbsp; /* trigger a sonar reading */<br>
-<br>
-&nbsp;&nbsp; gpioWrite(SONAR_TRIGGER, PI_ON);<br>
-<br>
-&nbsp;&nbsp; gpioDelay(10); /* 10us trigger pulse */<br>
-<br>
-&nbsp;&nbsp; gpioWrite(SONAR_TRIGGER, PI_OFF);<br>
-}<br>
-<br>
-void sonarEcho(int gpio, int level, uint32_t tick)<br>
-{<br>
-&nbsp;&nbsp; static uint32_t startTick, firstTick=0;<br>
-<br>
-&nbsp;&nbsp; int diffTick;<br>
-<br>
-&nbsp;&nbsp; if (!firstTick) firstTick = tick;<br>
-<br>
-&nbsp;&nbsp; if (level == PI_ON)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; startTick = tick;<br>
-&nbsp;&nbsp; }<br>
-&nbsp;&nbsp; else if (level == PI_OFF)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; diffTick = tick - startTick;<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("%u %u\ ", tick-firstTick,
-diffTick);<br>
-&nbsp;&nbsp; }<br>
-}<br></code>
-<h3>BUILD</h3>
-<code>cc -o sonar sonar.c -lpigpio -lrt -lpthread<br></code>
-<h3>RUN</h3>
-<code>sudo ./sonar &gt;sonar.dat &amp;</code><br>
-<br>
-While the program is running you can capture the waveform using the
-notification feature built in to pigpio.&nbsp; Issue the following
-commands on the Pi.<br>
-<br>
-<code>pigs no<br>
-pig2vcd&nbsp; &lt;/dev/pigpio0 &gt;sonar.vcd &amp;<br>
-pigs nb 0 0x180 # set bits for gpios 7 and 8<br></code>
-<p>Move an object in front of the sonar ranger for a few
-seconds.<br></p>
-<code>pigs nc 0</code><br>
-<p>The file sonar.vcd will contain the captured waveform, which can
-be viewed using GTKWave.</p>
-<p>Overview</p>
-<img src="images/son-wave-1.png" style=
-"width: 600px; height: 100px;" alt="LDR waveform 1"><br>
-<p>Reading circa every 10ms<br></p>
-<img src="images/son-wave-2.png" style=
-"width: 600px; height: 100px;" alt="Sonar waveform 2"><br>
-<p>One reading, circa 400us<br></p>
-<img src="images/son-wave-3.png" style=
-"width: 600px; height: 100px;" alt="Sonar waveform 3"><br>
-<p>another</p>
-<img style="width: 600px; height: 100px;" alt="Sonar waveform 4"
-src="images/son-wave-4.png"><br>
-<p>The file sonar.dat will contain pairs of timestamps and echo
-length (in us).&nbsp; The following&nbsp; script will convert the
-timestamps into seconds.<span style=
-"font-style: italic;"><br></span></p>
-<p><code>awk '{print $1/1000000, $2}' sonar.dat
-&gt;sonar-secs.dat</code></p>
-<p>Gnuplot is a useful tool to graph data.<br></p>
-plot 'sonar-secs.dat' title 'Sonar'<br>
-<p><img src="images/son-gnup-1.png" style=
-"width: 600px; height: 321px;" alt="gnuplot 1"><br>
-&nbsp;plot [10:25] 'sonar-secs.dat' title 'Sonar'<br></p>
-<p><img src="images/son-gnup-2.png" style=
-"width: 600px; height: 321px;" alt="gnuplot 1"></p>
-</td>
-</table>
-<div style="vertical-align: center; text-align: center; background-color:#98bf21; font-size:0.8em; height:30px"><a class="l2" href="index.html">[pigpio]</a>
-<a class="l2" href="cif.html">[pigpio C I/F]</a>
-<a class="l2" href="pigpiod.html">[pigpiod]</a>
-<a class="l2" href="pdif2.html">[pigpiod C I/F]</a>
-<a class="l2" href="python.html">[Python]</a>
-<a class="l2" href="pigs.html">[pigs]</a>
-<a class="l2" href="piscope.html">[piscope]</a>
-<a class="l2" href="misc.html">[Misc]</a>
-<a class="l2" href="examples.html">[Examples]</a>
-<a class="l2" href="download.html">[Download]</a>
-<a class="l2" href="faq.html">[FAQ]</a>
-<a class="l2" href="sitemap.html">[Site Map]</a>
-</div>
-<table><tr>
-<td style="width: 200px"><div style="text-align: left;"><small>&copy; 2012-2020</small></div></td>
-<td style="width: 350px"><div style="text-align: center;">e-mail: pigpio @ abyz.me.uk</div></td>
-<td style="width: 200px"><div style="text-align: right;"><small>Updated: 30/04/2020</small></div></td>
-</tr></table>
-</td>
-</table>
-</body>
-</html>
diff --git a/DOC/HTML/examples.html b/DOC/HTML/examples.html
deleted file mode 100644
index 3d82fca..0000000
--- a/DOC/HTML/examples.html
+++ /dev/null
@@ -1,558 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta name="description" content="Raspberry Pi Reg. C GPIO library and Python GPIO module and shell command utilities to control the GPIO, including SPI, I2C, and serial links." />
- <meta name="keywords" content="raspberry, pi, C, Python, GPIO, library, shell, command, utilities, module, SPI, I2C, serial" />
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>pigpio library</title>
- <link rel="stylesheet" type="text/css" href="scripts/index.css">
- <link rel="icon" href="favicon.ico" type="image/x-icon">
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
-</head>
-<body>
-
-<table style="padding:0px; border:0px; margin:0px; width:780px; background-color:#e0e0e0;">
-<td style="background:#EAF2E6 url('images/sidebar.gif') repeat-y; width:35px; height:100%"></td>
-<td>
-<table>
-<div style="background:url('images/topbar.gif') repeat-x; height: 70px; font-size:1.5em; vertical-align: top;"><a href="index.html"><img src="images/pigpio-logo.gif" border="0" /></a>pigpio library</div>
-</table>
-<table><div>
-<td><img src="images/rotary.jpg" width="250"></td>
-<td><img src="images/rf-rx.jpg" width="250"></td>
-<td><img src="images/pins.jpg" width="250"></td>
-</div></table>
-<table>
-<td style="vertical-align: top; background-color: #98bf21;"><a class="l1" href="index.html">pigpio</a>
-<a class="l1" href="cif.html">pigpio C I/F</a>
-<a class="l1" href="pigpiod.html">pigpiod</a>
-<a class="l1" href="pdif2.html">pigpiod C I/F</a>
-<a class="l1" href="python.html">Python</a>
-<a class="l1" href="pigs.html">pigs</a>
-<a class="l1" href="piscope.html">piscope</a>
-<a class="l1" href="misc.html">Misc</a>
-<a class="l1" href="examples.html">Examples</a>
-<a class="l1" href="download.html">Download</a>
-<a class="l1" href="faq.html">FAQ</a>
-<a class="l1" href="sitemap.html">Site Map</a>
-</td>
-<td><center><h2>Examples</h2></center>The following examples show various ways pigpio may be used to communicate with sensors via the GPIO.<br>
-<br>
-Although many are complete programs they are intended to be a starting point in producing your own code, not an end point.<br>
-<br>
-<a href="#Index">Index</a><br><br>
-<a href="#Hardware">Hardware</a><br><br>
-<a href="#Shell code">Shell code</a><br><br>
-<a href="#C code">C code</a><br><br>
-<a href="#C++ code">C++ code</a><br><br>
-<a href="#pigpiod_if2 code">pigpiod_if2 code</a><br><br>
-<a href="#Python code">Python code</a><br><br>
-<a href="#Miscellaneous related code">Miscellaneous related code</a><br><br>
-<a href="#External links">External links</a><br><br>
-<h3><span id="Hardware">Hardware</span></h3>
-A few practical examples of using pigpio with hardware.<br>
-<br>
-<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Hardware_ex_ir_remote"><a href="ex_ir_remote.html">IR Receiver</a><br>2013-06-09</span></td><td>Reading an infrared remote receiver.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Hardware_ex_LDR"><a href="ex_LDR.html">Light Dependent Resistor</a><br>2013-06-09</span></td><td>Measuring brightness with a light dependent resistor (LDR). Improved methods of timing the start of the capacitor recharge are given for <a href="#C_pot_cap_charge_c">C</a> and <a href="#Python_pot_cap_py">Python</a>.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Hardware_ex_motor_shield"><a href="ex_motor_shield.html">Motor Shield</a><br>2013-12-15</span></td><td>Using an Arduino motor shield.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Hardware_ex_rotary_encoder"><a href="ex_rotary_encoder.html">Rotary Encoder</a><br>2013-06-09</span></td><td>Reading a rotary encoder.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Hardware_ex_sonar_ranger"><a href="ex_sonar_ranger.html">Sonar Ranger</a><br>2013-06-10</span></td><td>Measuring range with a sonar ranger.<br>
-<br>
-</td></tr></tbody></table><h3><span id="Shell code">Shell code</span></h3>
-Examples of using pigpio with shell code.<br>
-<br>
-<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Shell_gpiotest"><a href="code/gpiotest.zip">GPIO test</a><br>2014-08-11</span></td><td>This bash script tests the user GPIO. <a href="http://youtu.be/sCJFLKWaxHo">Video</a><br>
-<br>
-</td></tr></tbody></table><h3><span id="C code">C code</span></h3>
-Examples of C pigpio programs.<br>
-<br>
-If your program is called foobar.c then build with<br>
-<br>
-gcc -Wall -pthread -o foobar foobar.c -lpigpio -lrt<br>
-<br>
-<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_freq_count_1"><a href="code/freq_count_1.zip">Frequency Counter 1</a><br>2014-08-20</span></td><td>A program showing how to use the <a href="cif.html#gpioSetAlertFunc">gpioSetAlertFunc</a> function to set a callback for GPIO state changes. A frequency count is generated for each monitored GPIO (frequencies up to 500kHz with a sample rate of 1&mu;s).<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_freq_count_2"><a href="code/freq_count_2.zip">Frequency Counter 2</a><br>2014-08-20</span></td><td>A program showing how to use the <a href="cif.html#gpioSetGetSamplesFunc">gpioSetGetSamplesFunc</a> function to set a callback for accumulated GPIO state changes over the last millisecond. A frequency count is generated for each monitored GPIO (frequencies up to 500kHz with a sample rate of 1&mu;s). Generally the method used is more complicated but more efficient than frequency counter 1.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_hall"><a href="code/hall.zip">Hall Effect Sensor</a><br>2014-06-13</span></td><td>Program to show status changes for a Hall effect sensor.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_I2C_sniffer"><a href="code/I2C_sniffer.zip">I2C Sniffer</a><br>2014-06-15</span></td><td>A program to passively sniff I2C transactions (100kHz bus maximum) and display the results. This C program uses pigpio notifications.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_ir_hasher_c"><a href="code/ir_hasher_c.zip">IR Receiver</a><br>2015-02-25</span></td><td>Function to hash a code from an IR receiver (reading an IR remote control).<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_PCF8591"><a href="code/PCF8591.zip">PCF8591 YL-40</a><br>2014-08-26</span></td><td>A program to display readings from the (I2C) PCF8591.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_pot_cap_charge_c"><a href="code/pot_cap_charge_c.zip">Pot + Capacitor Recharge Timing</a><br>2014-03-14</span></td><td>Function to time capacitor charging (through a resistance). The time can be used to estimate the resistance.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_rotary_encoder_c"><a href="code/rotary_encoder_c.zip">Rotary Encoder</a><br>2015-10-03</span></td><td>Function to decode a mechanical rotary encoder.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_rawMCP3008_c"><a href="code/rawMCP3008_c.zip">SPI bit bang MCP3008</a><br>2016-03-20</span></td><td>This program shows how to read multiple MCP3008 ADC simultaneously with accurately timed intervals. One 10-bit channel of each ADC may be sampled at up to 25k samples per second.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_rawMCP3202_c"><a href="code/rawMCP3202_c.zip">SPI bit bang MCP3202</a><br>2016-03-20</span></td><td>This program shows how to read multiple MCP3202 ADC simultaneously with accurately timed intervals. One 12-bit channel of each ADC may be sampled at up to 25k samples per second.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_rawMCP3XXX_c"><a href="code/rawMCP3XXX_c.zip">SPI bit bang MCP3008 and MCP3202</a><br>2016-03-20</span></td><td>This program shows how to read multiple MCP3008 and MCP3202 ADC simultaneously with accurately timed intervals. One channel of each ADC may be sampled at up to 25k samples per second. The 10-bit MCP3008 readings are multiplied by 4 so they have the same range (0-4095) as the 12-bit MCP3202.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_servo_demo"><a href="code/servo_demo.zip">Servo Pulse Generator</a><br>2016-10-08</span></td><td>This program generates servo pulses on one or more GPIO. Each connected servo is swept between 1000µs and 2000µs at a different speed.<br>
-<br>
-sudo ./servo_demo # Generate pulses on GPIO 4.<br>
-<br>
-sudo ./servo_demo 5 9 20 # Generate pulses on GPIO 5, 9, and 20.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_code/spi-pigpio-speed.c"><a href="code/spi-pigpio-speed.c">SPI pigpio driver speed test</a><br>2016-11-06</span></td><td>This C code is used to benchmark the pigpio SPI driver on the Pi. The code executes a given number of loops at a given baud rate and bytes per transfer.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_wiegand_c"><a href="code/wiegand_c.zip">Wiegand Reader</a><br>2013-12-30</span></td><td>Function to read a Wiegand Reader.<br>
-<br>
-</td></tr></tbody></table><h3><span id="C++ code">C++ code</span></h3>
-Examples of C++ pigpio programs.<br>
-<br>
-If your program is called foobar.cpp then build with<br>
-<br>
-g++ -Wall -pthread -o foobar foobar.cpp -lpigpio -lrt<br>
-<br>
-<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C++_ir_hasher_cpp"><a href="code/ir_hasher_cpp.zip">IR Receiver</a><br>2015-02-22</span></td><td>Class to hash a code from an IR receiver (reading an IR remote control).<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C++_rotary_encoder_cpp"><a href="code/rotary_encoder_cpp.zip">Rotary Encoder</a><br>2013-12-30</span></td><td>Class to decode a mechanical rotary encoder.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C++_wiegand_cpp"><a href="code/wiegand_cpp.zip">Wiegand Reader</a><br>2013-12-30</span></td><td>Class to read a Wiegand Reader.<br>
-<br>
-</td></tr></tbody></table><h3><span id="pigpiod_if2 code">pigpiod_if2 code</span></h3>The pigpiod_if2 code examples are linked with libpigpiod_if2 and are written in C.<br>
-<br>
-The pigpiod_if2 library may be compiled and run on any Linux machine and allows control of the GPIO on one or more networked Pis.<br>
-<br>
-It should be possible to adapt the library to run on Macs and PCs.<br>
-<br>
-Each Pi needs the pigpio daemon to be running. The pigpio daemon may be started with the command sudo pigpiod.<br>
-<br>
-<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2__433D"><a href="code/_433D.zip">433MHz Keyfob RX/TX</a><br>2015-11-17</span></td><td>Code to read and transmit 313 and 434 MHz key fob codes. The codes to be read must use Manchester encoding. The transmitted codes use Manchester encoding.<br>
-<br>
-./_433D -r10 # Print fob keycodes received on GPIO 10.<br>
-<br>
-./_433D -t5 8246184 # Transmit code on GPIO 5.<br>
-<br>
-./_433D -r10 -t5 8246184 # Transmit code on GPIO 5 then listen for codes<br>
-<br>
-./_433D -? for options.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2_DHTXXD"><a href="code/DHTXXD.zip">DHT11/21/22/33/44 Sensor</a><br>2016-02-16</span></td><td>Code to read the DHT temperature and humidity sensors. The sensor may be auto detected. A DHT11 sensor may be read once per second. The other sensors should not be read more often than once every three seconds.<br>
-<br>
-The code auto detects the DHT model and generally only the GPIO needs to be specified.<br>
-<br>
-./DHTXXD -g17 # Read a DHT connected to GPIO 17.<br>
-<br>
-./DHTXXD -g5 -i3 # Read a DHT connected to GPIO 5 every three seconds.<br>
-<br>
-./DHTXXD -? # for options.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2_RED"><a href="code/RED.zip">Rotary Encoder</a><br>2015-11-18</span></td><td>Code to monitor a rotary encoder and show the position changes. By default the detent changes are shown. There is an option to show the four steps per detent instead.<br>
-<br>
-./RED -a7 -b8 -s30 # Show encoder on 7/8 detent changes for 30 seconds.<br>
-<br>
-./RED -a5 -b6 -m1 # Show encoder on 5/6 step changes forever.<br>
-<br>
-./RED -? # for options.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2_servo_demo_D"><a href="code/servo_demo_D.zip">Servo Pulse Generator</a><br>2016-10-08</span></td><td>This program generates servo pulses on one or more GPIO. Each connected servo is swept between 1000µs and 2000µs at a different speed.<br>
-<br>
-./servo_demo_D # Generate pulses on GPIO 4.<br>
-<br>
-./servo_demo_D 5 9 20 # Generate pulses on GPIO 5, 9, and 20.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2_SRTED"><a href="code/SRTED.zip">Sonar Ranger</a><br>2015-11-16</span></td><td>Code to read the SRF-04 and SRF-05 type of sonar rangers which use the trigger echo method of operation. A 10 &mu;s trigger pulse initiates a series of high frequency sonar chirps. The echo line then goes high and stays high until an echo from an object is received. The echo high time is used to calculate the distance of the object.<br>
-<br>
-For a one-off reading only the trigger and echo GPIO need to be specified.<br>
-<br>
-./SRTED -t5 -e6 # Read a sonar ranger connected to GPIO 5/6.<br>
-<br>
-./SRTED -t11 -e5 -i0.1 # Read a sonar ranger connected to GPIO 11/5 every 0.1 seconds.<br>
-<br>
-./SRTED -? # for options.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2_tx_RED"><a href="code/tx_RED.zip">Transmit Rotary Encoder Test Signals</a><br>2015-11-25</span></td><td>Code to transmit quadrature signals to test rotary encoder software.<br>
-<br>
-tx_RED -aGPIO -bGPIO [options]<br>
-<br>
-tx_RED -? for options<br>
-<br>
-E.g.<br>
-<br>
-tx_RED -a5 -b6 -s20 -r-100<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2_tx_WD"><a href="code/tx_WD.zip">Transmit Wiegand Test Signals</a><br>2015-11-25</span></td><td>Code to transmit Wiegand codes to test Wiegand decoder software.<br>
-<br>
-tx_WD -gGPIO -wGPIO [options] {code}+<br>
-<br>
-tx_WD -? for options<br>
-<br>
-E.g.<br>
-<br>
-tx_WD -g5 -w6 -s37 12345 67890 123 899999<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2_WD"><a href="code/WD.zip">Wiegand Reader</a><br>2015-11-25</span></td><td>Code to read a Wiegand Reader.<br>
-<br>
-./WD -g7 -w8 -s30 # Read Wiegand codes from GPIO 7/8 for 30 seconds.<br>
-<br>
-./WD -g5 -w6 # Read Wiegand codes from GPIO 5/6 forever.<br>
-<br>
-./WD -? # for options.<br>
-<br>
-</td></tr></tbody></table><h3><span id="Python code">Python code</span></h3>The Python code may be run on any Python machine and allows control of the GPIO on one or more networked Pis.<br>
-<br>
-The Python machine need not be a Pi, it may run Windows, Mac, Linux, anything as long as it supports Python.<br>
-<br>
-Each Pi needs the pigpio daemon to be running. The pigpio daemon may be started with the command sudo pigpiod.<br>
-<br>
-<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python__433_py"><a href="code/_433_py.zip">433MHz Keyfob RX/TX</a><br>2015-10-30</span></td><td>Classes to send and receive 433MHz wireless keyfob codes. These keyfobs are widely used for remote control of devices.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python__7_segment"><a href="code/_7_segment.zip">7-Segment LED Display Multiplexing</a><br>2016-12-12</span></td><td>Script to multiplex several 7-segment LED displays. Each display has the segments a-g and the decimal point connected in parallel but has an individual enable GPIO (connected to the common anode or cathode).<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_test-APA102_py"><a href="code/test-APA102_py.zip">APA102 LED strip driver</a><br>2017-03-28</span></td><td>Script to drive an APA102 LED strip. Three different methods are demonstrated - using spidev SPI (only works on the local Pi), pigpio SPI, and pigpio waves. The SPI solutions only work with the dedicated SPI GPIO. Waves may use any spare GPIO. Four different examples are given including a LED strip clock.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_BME280_py"><a href="code/BME280_py.zip">BME280 Sensor</a><br>2016-08-05</span></td><td>Class to read the relative humidity, temperature, and pressure from a BME280 sensor. The sensor has both an I2C and a SPI interface which are both<br>
-supported by the class.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_code/DHT.py"><a href="code/DHT.py">DHT11/21/22/33/44 Sensor</a><br>2019-11-07</span></td><td>Class to read the relative humidity and temperature from a DHT sensor. It can automatically recognize the sensor type.<br>
-<br>
-The default script prints the reading from the specified DHT every 2 seconds. E.g. ./DHT.py 22 27 displays the data for DHT connected to GPIO 22 and 27.<br>
-<br>
-The following data is printed for each DHT: timestamp, GPIO, status, temperature, and humidity.<br>
-<br>
-The timestamp is the number of seconds since the epoch (start of 1970).<br>
-<br>
-The status will be one of: 0 - a good reading, 1 - checksum failure, 2 - data had one or more invalid values, 3 - no response from sensor.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_DHT22_py"><a href="code/DHT22_py.zip">DHT22 AM2302 Sensor</a><br>2014-07-11</span></td><td>Class to read the relative humidity and temperature from a DHT22/AM2302 sensor.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_DS18B20-1_py"><a href="code/DS18B20-1_py.zip">DS18B20 Temperature Sensor</a><br>2016-06-29</span></td><td>Script to read the temperature from any DS18B20 sensors connected to the 1-wire bus.<br>
-<br>
-To enable the 1-wire bus add the following line to /boot/config.txt and reboot.<br>
-<br>
-dtoverlay=w1-gpio<br>
-<br>
-By default you should connect the DS18B20 data line to GPIO 4 (pin 7).<br>
-<br>
-Connect 3V3 or 5V for power, ground to ground, 4k7 pull-up on data line to 3V3, and data line to GPIO 4.<br>
-<br>
-This script uses the file features of pigpio to access the remote file system.<br>
-<br>
-The following entry must be in /opt/pigpio/access.<br>
-<br>
-/sys/bus/w1/devices/28*/w1_slave r<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_PPD42NS_py"><a href="code/PPD42NS_py.zip">Dust Sensor</a><br>2015-11-22</span></td><td>Class to read a Shinyei PPD42NS Dust Sensor, e.g. as used in the Grove dust sensor.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_gpio_status_py"><a href="code/gpio_status_py.zip">GPIO Status</a><br>2014-06-12</span></td><td>Script to display the status of GPIO 0-31.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_hall"><a href="code/hall.zip">Hall Effect Sensor</a><br>2014-06-13</span></td><td>Program to show status changes for a Hall effect sensor.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_HX711_py"><a href="code/HX711_py.zip">HX711 24-bit ADC</a><br>2018-03-05</span></td><td>Class to read the channels of a HX711 24-bit ADC.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_i2c_ADXL345_py"><a href="code/i2c_ADXL345_py.zip">I2C ADXL345 Accelerometer</a><br>2015-04-01</span></td><td>Script to display the X, Y, and Z values read from an ADXL345 accelerometer.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_i2c_HMC5883L_py"><a href="code/i2c_HMC5883L_py.zip">I2C HMC5883L Magnetometer</a><br>2015-04-01</span></td><td>Script to display the X, Y, and Z values read from a HMC5883L Magnetometer (compass).<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_i2c_ITG3205_py"><a href="code/i2c_ITG3205_py.zip">I2C ITG3205 Gyroscope</a><br>2015-04-01</span></td><td>Script to display the X, Y, Z, and temperature values read from an ITG3205 gyroscope.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_i2c_lcd_py"><a href="code/i2c_lcd_py.zip">I2C LCD Display</a><br>2016-04-20</span></td><td>Class to display text on a LCD character display. The class supports the PCF8574T 8-bit I2C port expander connected to a HD44780 based LCD display. These displays are commonly available in 16x2 and 20x4 character formats.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_bsc_arduino_py"><a href="code/bsc_arduino_py.zip">I2C slave device</a><br>2016-10-31</span></td><td>This script demonstrates how to transfer messages from an Arduino acting as the I2C bus master to the Pi acting as an I2C slave device.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_I2C_sniffer"><a href="code/I2C_sniffer.zip">I2C Sniffer</a><br>2015-06-15</span></td><td>A program to passively sniff I2C transactions (100kHz bus maximum) and display the results.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_i2c_sonar_py"><a href="code/i2c_sonar_py.zip">I2C Sonar</a><br>2016-03-24</span></td><td>A class to read up to 8 HC-SR04 sonar rangers connected to an MCP23017 port expander.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_ir_hasher_py"><a href="code/ir_hasher_py.zip">IR Receiver</a><br>2014-06-12</span></td><td>Class to hash a code from an IR receiver (reading an IR remote control).<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_irrp_py"><a href="code/irrp_py.zip">IR Record and Playback</a><br>2015-12-21</span></td><td>This script may be used to record and play back arbitrary IR codes.<br>
-<br>
-To record the GPIO connected to the IR receiver, a file for the recorded codes, and the codes to be recorded are given.<br>
-<br>
-E.g. ./irrp.py -r -g4 -fir-codes vol+ vol- 1 2 3 4 5 6 7 8 9 0<br>
-<br>
-To playback the GPIO connected to the IR transmitter, the file containing the recorded codes, and the codes to be played back are given.<br>
-<br>
-E.g. ./irrp.py -p -g18 -fir-codes 2 3 4<br>
-<br>
-./irrp.py -h # for options<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_kivy_GPIO_py"><a href="code/kivy_GPIO_py.zip">Kivy GPIO control</a><br>2016-12-11</span></td><td>This example shows how to use Kivy to control a Pi's GPIO. The GPIO may be configured as inputs, outputs, or to generate Servo or PWM pulses. Kivy is an Open source Python library for rapid development of applications.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_MAX6675_py"><a href="code/MAX6675_py.zip">MAX6675 SPI Temperature Sensor</a><br>2016-05-02</span></td><td>A script to read the temperature from a MAX6675 connected to a K-type thermocouple. The MAX6675 supports readings in the range 0 - 1023.75 C. Up to 4 readings may be made per second.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_monitor_py"><a href="code/monitor_py.zip">Monitor GPIO</a><br>2016-09-17</span></td><td>Script to monitor GPIO for level changes. By default all GPIO are monitored. At a level change the GPIO, new level, and microseconds since the last change is printed.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_morse_code_py"><a href="code/morse_code_py.zip">Morse Code</a><br>2015-06-17</span></td><td>Script to transmit the morse code corresponding to a text string.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_code/NRF24.py"><a href="code/NRF24.py">NRF24 radio transceiver</a><br>2018-01-06</span></td><td>Script to transmit and receive messages using the nRF24L01 radio transceiver.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_PCA9685_py"><a href="code/PCA9685_py.zip">PCA9685 16 Channel PWM</a><br>2016-01-31</span></td><td>Class to control the 16 PWM channels of the I2C PCA9685. All channels use the same frequency. The duty cycle or pulse width may be set independently for each channel.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_PCF8591"><a href="code/PCF8591.zip">PCF8591 YL-40</a><br>2014-08-26</span></td><td>Script to display readings from the (I2C) PCF8591.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_code/PPM.py"><a href="code/PPM.py">PPM (Pulse Position Modulation) generation</a><br>2016-02-19</span></td><td>Script to generate PPM signals on a chosen GPIO.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_code/PPM_to_servo.py"><a href="code/PPM_to_servo.py">PPM (Pulse Position Modulation) to servo pulses</a><br>2019-10-09</span></td><td>Script to read a PPM signal on a GPIO and generate the corresponding servo signals on chosen GPIO.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_bench_1_py"><a href="code/bench_1_py.zip">pigpio Benchmark</a><br>2014-06-12</span></td><td>Script to benchmark the pigpio Python module's performance.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_pigpio_cgi_py"><a href="code/pigpio_cgi_py.zip">pigpio CGI</a><br>2015-05-04</span></td><td>Script demonstrating how to access the pigpio daemon using CGI from a browser. Instructions on how to use with Apache2 on the Pi are given in the comments.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_playback_py"><a href="code/playback_py.zip">Playback piscope recordings</a><br>2016-12-23</span></td><td>Script to playback GPIO data recorded in piscope format.<br>
-<br>
-To playback GPIO 4 to GPIO 4 from file data.piscope<br>
-./playback.py data.piscope 4<br>
-<br>
-To playback GPIO 4 to GPIO 7 from file rec.txt<br>
-./playback.py rec.txt 7=4<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_pot_cap_py"><a href="code/pot_cap_py.zip">Pot + Capacitor Recharge Timing</a><br>2016-09-26</span></td><td>Class to time capacitor charging (through a resistance). The time can be used to estimate the resistance.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_read_PWM_py"><a href="code/read_PWM_py.zip">PWM Monitor</a><br>2015-12-08</span></td><td>Class to monitor a PWM signal and calculate the frequency, pulse width, and duty cycle.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_rotary_encoder_py"><a href="code/rotary_encoder_py.zip">Rotary Encoder</a><br>2014-06-12</span></td><td>Class to decode a mechanical rotary encoder.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_read_RPM_py"><a href="code/read_RPM_py.zip">RPM Monitor</a><br>2016-01-20</span></td><td>Class to monitor speedometer pulses and calculate the RPM (Revolutions Per Minute).<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_Si7021_py"><a href="code/Si7021_py.zip">Si7021 I2C Temperature and Humidity Sensor</a><br>2016-05-07</span></td><td>Class to read the temperature and relative humidity from a Si7021.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_SPI_mon_py"><a href="code/SPI_mon_py.zip">SPI Monitor</a><br>2016-09-21</span></td><td>A program to passively sniff SPI transactions and display the results. The SPI rate should be limited to about 70kbps if using the default pigpio 5µs sampling rate.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_servo_demo_py"><a href="code/servo_demo_py.zip">Servo Pulse Generator</a><br>2016-10-07</span></td><td>This script generates servo pulses on one or more GPIO. Each connected servo is swept between 1000µs and 2000µs at a different speed.<br>
-<br>
-./servo_demo.py # Generate pulses on GPIO 4.<br>
-<br>
-./servo_demo.py 5 9 20 # Generate pulses on GPIO 5, 9, and 20.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_sonar_trigger_echo_py"><a href="code/sonar_trigger_echo_py.zip">Sonar Ranger</a><br>2014-06-12</span></td><td>Class to read sonar rangers with separate trigger and echo pins.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_TCS3200_py"><a href="code/TCS3200_py.zip">TCS3200 Colour Sensor</a><br>2015-07-03</span></td><td>Class to read the TCS3200 colour sensor<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_vw"><a href="code/vw.zip">Virtual Wire</a><br>2015-10-31</span></td><td>Class to send and receive radio messages compatible with the Virtual Wire library for Arduinos. This library is commonly used with 313MHz and 434MHz radio tranceivers.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_code/create_wave.py"><a href="code/create_wave.py">Wave create</a><br>2019-11-18</span></td><td>Script to generate waves from a template defined in a text file.<br>
-<br>
-You can also specify one of py, c, or pdif - the script output will then be a complete program to generate the wave (py for Python script, c for a C program, pdif for a C program using the pigpio daemon I/F).<br>
-<br>
-If none of py, c, or pdif are chosen the waveform will be generated for 30 seconds.<br>
-<br>
-Example text file<br>
-<br>
-# GPIO levels<br>
-23 11000001<br>
-11 01110000<br>
-12 00011100<br>
-4 00000111<br>
-<br>
-To generate a pdif program with a bit time of 100 microseconds<br>
-./create_wave.py wave_file 100 pdif >wave_pdif.c<br>
-<br>
-To just transmit the wave with a bit time of 50 microseconds<br>
-./create_wave.py wave_file 50<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_wave_PWM_py"><a href="code/wave_PWM_py.zip">Wave PWM 1</a><br>2016-03-19</span></td><td>Script to show how waves may be used to generate PWM at (one) arbitrary frequency on multiple GPIO. For instance PWM at 10kHz may be generated with 100 steps between off and fully on.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_wavePWM_py"><a href="code/wavePWM_py.zip">Wave PWM 2</a><br>2016-10-06</span></td><td>Class to generate PWM on multiple GPIO. It is more flexible than the Wave PWM 1 example in that the start of the pulse within each cycle may be specified as well as the duty cycle. The start and length of each pulse may be specified on a GPIO by GPIO basis in microseconds or as a fraction of the cycle time. The class includes a __main__ to demostrate its ability to send servo pulses.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_wiegand_py"><a href="code/wiegand_py.zip">Wiegand Reader</a><br>2014-06-12</span></td><td>Class to read a Wiegand reader.<br>
-<br>
-</td></tr></tbody></table><h3><span id="Miscellaneous related code">Miscellaneous related code</span></h3>
-The following code examples do not use pigpio.<br>
-<br>
-<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_adxl345_c"><a href="code/adxl345_c.zip">ADXL345</a><br>2014-03-12</span></td><td>This C program reads x, y, and z accelerations from the ADXL345 via I2C address 0x53.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_DS18B20_py"><a href="code/DS18B20_py.zip">DS18B20 Temperature Sensor</a><br>2016-04-25</span></td><td>This Python script reads the temperature from any DS18B20 sensors connected to the 1-wire bus.<br>
-<br>
-To enable the 1-wire bus add the following line to /boot/config.txt and reboot.<br>
-<br>
-dtoverlay=w1-gpio<br>
-<br>
-By default you should connect the DS18B20 data line to GPIO 4 (pin 7).<br>
-<br>
-Connect 3V3 or 5V for power, ground to ground, 4k7 pull-up on data line to 3V3, and data line to GPIO 4.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_EasyAsPiServer"><a href="code/EasyAsPiServer.zip">Easy as Pi Server</a><br>2014-09-15</span></td><td>This Python class implements a simple server which allows broswer commands to be executed on the Pi.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_minimal_clk"><a href="code/minimal_clk.zip">Minimal Clock Access</a><br>2015-05-20</span></td><td>This C code sets GPIO 4 to a specified clock frequency. The frequency can be set between 4.6875 kHz and 500 MHz (untested). The clock can be preferentially set from one of the sources OSC (19.2MHz), HDMI (216MHz), PLLD (500MHz), or PLLC (1000MHz). MASH can be set between 0 and 3. MASH may not work properly for clock dividers less than 5.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_minimal_gpio"><a href="code/minimal_gpio.zip">Minimal GPIO Access</a><br>2019-07-03</span></td><td>This C code has a minimal set of functions needed to control the GPIO and other Broadcom peripherals. The program requires root privileges to run. See Tiny GPIO access for an alternative which controls the GPIO (but not the other peripherals) and does not require root access.<br>
-<br>
-The code has been updated for the BCM2711 (Pi4B).<br>
-<br>
-The following functions are provided.<br>
-<br>
-gpioInitialise<br>
-gpioSetMode<br>
-gpioGetMode<br>
-gpioSetPullUpDown<br>
-gpioRead<br>
-gpioWrite<br>
-gpioTrigger<br>
-gpioReadBank1<br>
-gpioReadBank2<br>
-gpioClearBank1<br>
-gpioClearBank2<br>
-gpioSetBank1<br>
-gpioSetBank2<br>
-gpioHardwareRevision<br>
-gpioTick<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_nanopulse_c"><a href="code/nanopulse_c.zip">Nanosecond Pulse Generation</a><br>2014-01-29</span></td><td>This C program uses the PWM peripheral to generate precisely timed pulses of very short duration. Pulses as short as 4 nano seconds can be generated.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_PCF8591-x"><a href="code/PCF8591-x.zip">PCF8591 YL-40</a><br>2014-08-26</span></td><td>C and Python code to read the (I2C) PCF8591.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_code/spi-driver-speed.c"><a href="code/spi-driver-speed.c">SPI Linux driver speed test</a><br>2016-11-06</span></td><td>This C code is used to benchmark the Linux SPI driver on the Pi. The code executes a given number of loops at a given baud rate and bytes per transfer.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_tiny_gpio"><a href="code/tiny_gpio.zip">Tiny GPIO Access</a><br>2016-04-30</span></td><td>This C code has a minimal set of functions needed to control the GPIO without needing root privileges (it uses /dev/gpiomem to access the GPIO).<br>
-<br>
-You may need to change the permissions and ownership of /dev/gpiomem if they have not been correctly set up.<br>
-<br>
-sudo chown root:gpio /dev/gpiomem<br>
-sudo chmod g+rw /dev/gpiomem<br>
-<br>
-The user (default pi) needs to be in the gpio group.<br>
-<br>
-sudo adduser pi gpio<br>
-<br>
-The following functions are provided.<br>
-<br>
-gpioInitialise<br>
-gpioSetMode<br>
-gpioGetMode<br>
-gpioSetPullUpDown<br>
-gpioRead<br>
-gpioWrite<br>
-gpioTrigger<br>
-gpioReadBank1<br>
-gpioReadBank2<br>
-gpioClearBank1<br>
-gpioClearBank2<br>
-gpioSetBank1<br>
-gpioSetBank2<br>
-gpioHardwareRevision<br>
-<br>
-</td></tr></tbody></table><h3><span id="External links">External links</span></h3>
-Related code.<br>
-<br>
-<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="External_https://github.com/stripcode/pigpio-stepper-motor"><a href="https://github.com/stripcode/pigpio-stepper-motor">Stepper Motor</a><br>2016-08-12</span></td><td>Stepper motor code.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="External_https://github.com/choeffer/360pibot"><a href="https://github.com/choeffer/360pibot">Parallax ActivityBot 360</a><br>2018-11-03</span></td><td>Python 3 implementation for programming a Parallax ActivityBot 360 Robot Kit with a Raspberry Pi.<br>
-<br>
-</td></tr></tbody></table><h3><span id="Index">Index</span></h3>
-<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody>
-<tr><td><span id="index_433mhz_keyfob_rx/tx"></span>433MHz Keyfob RX/TX</td><td> <a href="#pdif2__433D">pdif2</a>
- <a href="#Python__433_py">Python</a>
-</td></tr><tr><td><span id="index_7-segment_led_display_multiplexing"></span>7-Segment LED Display Multiplexing</td><td> <a href="#Python__7_segment">Python</a>
-</td></tr><tr><td><span id="index_adxl345"></span>ADXL345</td><td> <a href="#Misc_adxl345_c">Misc</a>
-</td></tr><tr><td><span id="index_apa102_led_strip_driver"></span>APA102 LED strip driver</td><td> <a href="#Python_test-APA102_py">Python</a>
-</td></tr><tr><td><span id="index_bme280_sensor"></span>BME280 Sensor</td><td> <a href="#Python_BME280_py">Python</a>
-</td></tr><tr><td><span id="index_dht11/21/22/33/44_sensor"></span>DHT11/21/22/33/44 Sensor</td><td> <a href="#pdif2_DHTXXD">pdif2</a>
- <a href="#Python_code/DHT.py">Python</a>
-</td></tr><tr><td><span id="index_dht22_am2302_sensor"></span>DHT22 AM2302 Sensor</td><td> <a href="#Python_DHT22_py">Python</a>
-</td></tr><tr><td><span id="index_ds18b20_temperature_sensor"></span>DS18B20 Temperature Sensor</td><td> <a href="#Python_DS18B20-1_py">Python</a>
- <a href="#Misc_DS18B20_py">Misc</a>
-</td></tr><tr><td><span id="index_dust_sensor"></span>Dust Sensor</td><td> <a href="#Python_PPD42NS_py">Python</a>
-</td></tr><tr><td><span id="index_easy_as_pi_server"></span>Easy as Pi Server</td><td> <a href="#Misc_EasyAsPiServer">Misc</a>
-</td></tr><tr><td><span id="index_frequency_counter_1"></span>Frequency Counter 1</td><td> <a href="#C_freq_count_1">C</a>
-</td></tr><tr><td><span id="index_frequency_counter_2"></span>Frequency Counter 2</td><td> <a href="#C_freq_count_2">C</a>
-</td></tr><tr><td><span id="index_gpio_status"></span>GPIO Status</td><td> <a href="#Python_gpio_status_py">Python</a>
-</td></tr><tr><td><span id="index_gpio_test"></span>GPIO test</td><td> <a href="#Shell_gpiotest">Shell</a>
-</td></tr><tr><td><span id="index_hall_effect_sensor"></span>Hall Effect Sensor</td><td> <a href="#C_hall">C</a>
- <a href="#Python_hall">Python</a>
-</td></tr><tr><td><span id="index_hx711_24-bit_adc"></span>HX711 24-bit ADC</td><td> <a href="#Python_HX711_py">Python</a>
-</td></tr><tr><td><span id="index_i2c_adxl345_accelerometer"></span>I2C ADXL345 Accelerometer</td><td> <a href="#Python_i2c_ADXL345_py">Python</a>
-</td></tr><tr><td><span id="index_i2c_hmc5883l_magnetometer"></span>I2C HMC5883L Magnetometer</td><td> <a href="#Python_i2c_HMC5883L_py">Python</a>
-</td></tr><tr><td><span id="index_i2c_itg3205_gyroscope"></span>I2C ITG3205 Gyroscope</td><td> <a href="#Python_i2c_ITG3205_py">Python</a>
-</td></tr><tr><td><span id="index_i2c_lcd_display"></span>I2C LCD Display</td><td> <a href="#Python_i2c_lcd_py">Python</a>
-</td></tr><tr><td><span id="index_i2c_slave_device"></span>I2C slave device</td><td> <a href="#Python_bsc_arduino_py">Python</a>
-</td></tr><tr><td><span id="index_i2c_sniffer"></span>I2C Sniffer</td><td> <a href="#C_I2C_sniffer">C</a>
- <a href="#Python_I2C_sniffer">Python</a>
-</td></tr><tr><td><span id="index_i2c_sonar"></span>I2C Sonar</td><td> <a href="#Python_i2c_sonar_py">Python</a>
-</td></tr><tr><td><span id="index_ir_receiver"></span>IR Receiver</td><td> <a href="#Hardware_ex_ir_remote">Hardware</a>
- <a href="#C_ir_hasher_c">C</a>
- <a href="#C++_ir_hasher_cpp">C++</a>
- <a href="#Python_ir_hasher_py">Python</a>
-</td></tr><tr><td><span id="index_ir_record_and_playback"></span>IR Record and Playback</td><td> <a href="#Python_irrp_py">Python</a>
-</td></tr><tr><td><span id="index_kivy_gpio_control"></span>Kivy GPIO control</td><td> <a href="#Python_kivy_GPIO_py">Python</a>
-</td></tr><tr><td><span id="index_light_dependent_resistor"></span>Light Dependent Resistor</td><td> <a href="#Hardware_ex_LDR">Hardware</a>
-</td></tr><tr><td><span id="index_max6675_spi_temperature_sensor"></span>MAX6675 SPI Temperature Sensor</td><td> <a href="#Python_MAX6675_py">Python</a>
-</td></tr><tr><td><span id="index_minimal_clock_access"></span>Minimal Clock Access</td><td> <a href="#Misc_minimal_clk">Misc</a>
-</td></tr><tr><td><span id="index_minimal_gpio_access"></span>Minimal GPIO Access</td><td> <a href="#Misc_minimal_gpio">Misc</a>
-</td></tr><tr><td><span id="index_monitor_gpio"></span>Monitor GPIO</td><td> <a href="#Python_monitor_py">Python</a>
-</td></tr><tr><td><span id="index_morse_code"></span>Morse Code</td><td> <a href="#Python_morse_code_py">Python</a>
-</td></tr><tr><td><span id="index_motor_shield"></span>Motor Shield</td><td> <a href="#Hardware_ex_motor_shield">Hardware</a>
-</td></tr><tr><td><span id="index_nanosecond_pulse_generation"></span>Nanosecond Pulse Generation</td><td> <a href="#Misc_nanopulse_c">Misc</a>
-</td></tr><tr><td><span id="index_nrf24_radio_transceiver"></span>NRF24 radio transceiver</td><td> <a href="#Python_code/NRF24.py">Python</a>
-</td></tr><tr><td><span id="index_parallax_activitybot_360"></span>Parallax ActivityBot 360</td><td> <a href="#External_https://github.com/choeffer/360pibot">External</a>
-</td></tr><tr><td><span id="index_pca9685_16_channel_pwm"></span>PCA9685 16 Channel PWM</td><td> <a href="#Python_PCA9685_py">Python</a>
-</td></tr><tr><td><span id="index_pcf8591_yl-40"></span>PCF8591 YL-40</td><td> <a href="#C_PCF8591">C</a>
- <a href="#Python_PCF8591">Python</a>
- <a href="#Misc_PCF8591-x">Misc</a>
-</td></tr><tr><td><span id="index_pigpio_benchmark"></span>pigpio Benchmark</td><td> <a href="#Python_bench_1_py">Python</a>
-</td></tr><tr><td><span id="index_pigpio_cgi"></span>pigpio CGI</td><td> <a href="#Python_pigpio_cgi_py">Python</a>
-</td></tr><tr><td><span id="index_playback_piscope_recordings"></span>Playback piscope recordings</td><td> <a href="#Python_playback_py">Python</a>
-</td></tr><tr><td><span id="index_pot_+_capacitor_recharge_timing"></span>Pot + Capacitor Recharge Timing</td><td> <a href="#C_pot_cap_charge_c">C</a>
- <a href="#Python_pot_cap_py">Python</a>
-</td></tr><tr><td><span id="index_ppm_(pulse_position_modulation)_generation"></span>PPM (Pulse Position Modulation) generation</td><td> <a href="#Python_code/PPM.py">Python</a>
-</td></tr><tr><td><span id="index_ppm_(pulse_position_modulation)_to_servo_pulses"></span>PPM (Pulse Position Modulation) to servo pulses</td><td> <a href="#Python_code/PPM_to_servo.py">Python</a>
-</td></tr><tr><td><span id="index_pwm_monitor"></span>PWM Monitor</td><td> <a href="#Python_read_PWM_py">Python</a>
-</td></tr><tr><td><span id="index_rotary_encoder"></span>Rotary Encoder</td><td> <a href="#Hardware_ex_rotary_encoder">Hardware</a>
- <a href="#C_rotary_encoder_c">C</a>
- <a href="#C++_rotary_encoder_cpp">C++</a>
- <a href="#pdif2_RED">pdif2</a>
- <a href="#Python_rotary_encoder_py">Python</a>
-</td></tr><tr><td><span id="index_rpm_monitor"></span>RPM Monitor</td><td> <a href="#Python_read_RPM_py">Python</a>
-</td></tr><tr><td><span id="index_servo_pulse_generator"></span>Servo Pulse Generator</td><td> <a href="#C_servo_demo">C</a>
- <a href="#pdif2_servo_demo_D">pdif2</a>
- <a href="#Python_servo_demo_py">Python</a>
-</td></tr><tr><td><span id="index_si7021_i2c_temperature_and_humidity_sensor"></span>Si7021 I2C Temperature and Humidity Sensor</td><td> <a href="#Python_Si7021_py">Python</a>
-</td></tr><tr><td><span id="index_sonar_ranger"></span>Sonar Ranger</td><td> <a href="#Hardware_ex_sonar_ranger">Hardware</a>
- <a href="#pdif2_SRTED">pdif2</a>
- <a href="#Python_sonar_trigger_echo_py">Python</a>
-</td></tr><tr><td><span id="index_spi_bit_bang_mcp3008"></span>SPI bit bang MCP3008</td><td> <a href="#C_rawMCP3008_c">C</a>
-</td></tr><tr><td><span id="index_spi_bit_bang_mcp3008_and_mcp3202"></span>SPI bit bang MCP3008 and MCP3202</td><td> <a href="#C_rawMCP3XXX_c">C</a>
-</td></tr><tr><td><span id="index_spi_bit_bang_mcp3202"></span>SPI bit bang MCP3202</td><td> <a href="#C_rawMCP3202_c">C</a>
-</td></tr><tr><td><span id="index_spi_linux_driver_speed_test"></span>SPI Linux driver speed test</td><td> <a href="#Misc_code/spi-driver-speed.c">Misc</a>
-</td></tr><tr><td><span id="index_spi_monitor"></span>SPI Monitor</td><td> <a href="#Python_SPI_mon_py">Python</a>
-</td></tr><tr><td><span id="index_spi_pigpio_driver_speed_test"></span>SPI pigpio driver speed test</td><td> <a href="#C_code/spi-pigpio-speed.c">C</a>
-</td></tr><tr><td><span id="index_stepper_motor"></span>Stepper Motor</td><td> <a href="#External_https://github.com/stripcode/pigpio-stepper-motor">External</a>
-</td></tr><tr><td><span id="index_tcs3200_colour_sensor"></span>TCS3200 Colour Sensor</td><td> <a href="#Python_TCS3200_py">Python</a>
-</td></tr><tr><td><span id="index_tiny_gpio_access"></span>Tiny GPIO Access</td><td> <a href="#Misc_tiny_gpio">Misc</a>
-</td></tr><tr><td><span id="index_transmit_rotary_encoder_test_signals"></span>Transmit Rotary Encoder Test Signals</td><td> <a href="#pdif2_tx_RED">pdif2</a>
-</td></tr><tr><td><span id="index_transmit_wiegand_test_signals"></span>Transmit Wiegand Test Signals</td><td> <a href="#pdif2_tx_WD">pdif2</a>
-</td></tr><tr><td><span id="index_virtual_wire"></span>Virtual Wire</td><td> <a href="#Python_vw">Python</a>
-</td></tr><tr><td><span id="index_wave_create"></span>Wave create</td><td> <a href="#Python_code/create_wave.py">Python</a>
-</td></tr><tr><td><span id="index_wave_pwm_1"></span>Wave PWM 1</td><td> <a href="#Python_wave_PWM_py">Python</a>
-</td></tr><tr><td><span id="index_wave_pwm_2"></span>Wave PWM 2</td><td> <a href="#Python_wavePWM_py">Python</a>
-</td></tr><tr><td><span id="index_wiegand_reader"></span>Wiegand Reader</td><td> <a href="#C_wiegand_c">C</a>
- <a href="#C++_wiegand_cpp">C++</a>
- <a href="#pdif2_WD">pdif2</a>
- <a href="#Python_wiegand_py">Python</a>
-</td></tr></tbody></table></td>
-</table>
-<div style="vertical-align: center; text-align: center; background-color:#98bf21; font-size:0.8em; height:30px"><a class="l2" href="index.html">[pigpio]</a>
-<a class="l2" href="cif.html">[pigpio C I/F]</a>
-<a class="l2" href="pigpiod.html">[pigpiod]</a>
-<a class="l2" href="pdif2.html">[pigpiod C I/F]</a>
-<a class="l2" href="python.html">[Python]</a>
-<a class="l2" href="pigs.html">[pigs]</a>
-<a class="l2" href="piscope.html">[piscope]</a>
-<a class="l2" href="misc.html">[Misc]</a>
-<a class="l2" href="examples.html">[Examples]</a>
-<a class="l2" href="download.html">[Download]</a>
-<a class="l2" href="faq.html">[FAQ]</a>
-<a class="l2" href="sitemap.html">[Site Map]</a>
-</div>
-<table><tr>
-<td style="width: 200px"><div style="text-align: left;"><small>&copy; 2012-2020</small></div></td>
-<td style="width: 350px"><div style="text-align: center;">e-mail: pigpio @ abyz.me.uk</div></td>
-<td style="width: 200px"><div style="text-align: right;"><small>Updated: 30/04/2020</small></div></td>
-</tr></table>
-</td>
-</table>
-</body>
-</html>
diff --git a/DOC/HTML/faq.html b/DOC/HTML/faq.html
deleted file mode 100644
index 4d06c5e..0000000
--- a/DOC/HTML/faq.html
+++ /dev/null
@@ -1,516 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta name="description" content="Raspberry Pi Reg. C GPIO library and Python GPIO module and shell command utilities to control the GPIO, including SPI, I2C, and serial links." />
- <meta name="keywords" content="raspberry, pi, C, Python, GPIO, library, shell, command, utilities, module, SPI, I2C, serial" />
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>pigpio library</title>
- <link rel="stylesheet" type="text/css" href="scripts/index.css">
- <link rel="icon" href="favicon.ico" type="image/x-icon">
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
-</head>
-<body>
-
-<table style="padding:0px; border:0px; margin:0px; width:780px; background-color:#e0e0e0;">
-<td style="background:#EAF2E6 url('images/sidebar.gif') repeat-y; width:35px; height:100%"></td>
-<td>
-<table>
-<div style="background:url('images/topbar.gif') repeat-x; height: 70px; font-size:1.5em; vertical-align: top;"><a href="index.html"><img src="images/pigpio-logo.gif" border="0" /></a>pigpio library</div>
-</table>
-<table><div>
-<td><img src="images/faq1.jpg" width="250"></td>
-<td><img src="images/faq2.jpg" width="250"></td>
-<td><img src="images/faq3.jpg" width="250"></td>
-</div></table>
-<table>
-<td style="vertical-align: top; background-color: #98bf21;"><a class="l1" href="index.html">pigpio</a>
-<a class="l1" href="cif.html">pigpio C I/F</a>
-<a class="l1" href="pigpiod.html">pigpiod</a>
-<a class="l1" href="pdif2.html">pigpiod C I/F</a>
-<a class="l1" href="python.html">Python</a>
-<a class="l1" href="pigs.html">pigs</a>
-<a class="l1" href="piscope.html">piscope</a>
-<a class="l1" href="misc.html">Misc</a>
-<a class="l1" href="examples.html">Examples</a>
-<a class="l1" href="download.html">Download</a>
-<a class="l1" href="faq.html">FAQ</a>
-<a class="l1" href="sitemap.html">Site Map</a>
-</td>
-<td><center><h2>Frequently Asked Questions</h2></center>
-<a href="#Are_my_GPIO_broken">Are my GPIO broken?</a><br>
-<br>
-<a href="#Audio_is_broken">Audio is broken</a><br>
-<br>
-<a href="#Cant_initialise_pigpio_library">Can´t initialise pigpio
-library</a><br>
-<br>
-<a href="#Cant_lock_varrunpigpio.pid">Can´t lock
-var/run/pigpio.pid</a><br>
-<br>
-<a href="#Hello_World">Hello World!</a><br>
-<br>
-<a href="#make_fails">Clock skew, make fails</a><br>
-<br>
-<a href="#Have_I_fried_my_GPIO">Have I fried my GPIO?</a><br>
-<br>
-<a href="#How_do_I_debounce_inputs">How do I debounce
-inputs?</a><br>
-<br>
-<a href="#How_fast_is_SPI">How fast is SPI?</a><br>
-<br>
-<a href="#Library_update_fails">Library update didn't work</a><br>
-<br>
-<a href="#make_fails">make fails with clock skew</a><br>
-<br>
-<a href="#Porting_pigpio">Porting pigpio to another CPU/SoC</a><br>
-<br>
-<a href="#Sound_isnt_working">Sound isn't working</a><br>
-<br>
-<a href="#Library_update_fails">Symbol not found</a><br>
-<br>
-<a href="#What_is_I2C">What is I2C?</a><br>
-<br>
-<a href="#What_is_Serial">What is Serial?</a><br>
-<br>
-<a href="#What_is_SPI">What is SPI?</a><br>
-<br>
-<a href="#Which_library">Which library should I use?</a><br>
-<br>
-<h3><a name="Are_my_GPIO_broken" id="Are_my_GPIO_broken"></a>Are my
-GPIO broken?</h3>
-<p>See <a href="#Have_I_fried_my_GPIO">Have I fried my
-GPIO?</a><br></p>
-<h3><a name="Audio_is_broken" id="Audio_is_broken"></a>Audio is
-broken</h3>
-<p>See <a href="#Sound_isnt_working">Sound isn't
-working</a><br></p>
-<h3><a name="Cant_lock_varrunpigpio.pid" id=
-"Cant_lock_varrunpigpio.pid"></a>Can´t lock
-/var/run/pigpio.pid</h3>
-<p>See <a href=
-"#Cant_initialise_pigpio_library">Can´t_initialise_pigpio_library</a><br>
-</p>
-<h3><a name="Cant_initialise_pigpio_library" id=
-"Cant_initialise_pigpio_library"></a>Can´t initialise pigpio
-library</h3>
-<p>This message means the pigpio daemon is already running.<br></p>
-<p>The default daemon is called pigpiod and may be removed as
-follows.<br></p>
-Check that it is running with the command
-<p><code>ps aux | grep pigpiod</code></p>
-<p>Kill the daemon with<br></p>
-<p><code>sudo killall pigpiod</code></p>
-<p>If your own program is acting as the daemon it may be removed as
-follows.</p>
-<p>Find its process id (<span style=
-"font-style: italic;">pid</span>).<br></p>
-<p><code>cat /var/run/pigpio.pid</code><br></p>
-<p>Kill the program with<br></p>
-<p><code>sudo kill -9 <span style=
-"font-style: italic;">pid</span></code><br></p>
-If the above doesn't work do the following and try starting the
-daemon again
-<p><code>sudo rm /var/run/pigpio.pid<br></code></p>
-<p>To start the daemon do</p>
-<p><code>sudo pigpiod</code></p>
-<h3><a name="Have_I_fried_my_GPIO" id=
-"Have_I_fried_my_GPIO"></a>Have I fried my GPIO?</h3>
-<p>If you think you have damaged one or more GPIO you can carry out
-a diagnostic test.</p>
-<p>The test is a command line script called <a rel="nofollow"
-class="external text" href=
-"http://abyz.me.uk/rpi/pigpio/code/gpiotest.zip">gpiotest</a></p>
-For the duration of the test nothing must be connected to the GPIO
-(no LEDs, wires, ribbon cables etc.).
-<p>The test checks that each GPIO may be read and written and that
-the internal resistor pull-ups and pull-downs are functional.</p>
-<p>A <a rel="nofollow" class="external text" href=
-"https://www.youtube.com/watch?v=sCJFLKWaxHo&amp;feature=youtu.be">video</a>
-showing what happens to the GPIO during a test.</p>
-<p>A test with all GPIO okay.</p>
-<pre>This program checks the Pi's (user) gpios.
-
-The program reads and writes all the gpios. Make sure NOTHING
-is connected to the gpios during this test.
-
-The program uses the pigpio daemon which must be running.
-
-To start the daemon use the command sudo pigpiod.
-
-Press the ENTER key to continue or ctrl-C to abort...
-
-Testing...
-Skipped non-user gpios: 0 1 28 29 30 31
-Tested user gpios: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18<br> 19 20 21 22 23 24 25 26 27
-Failed user gpios: None
-</pre>
-<p>A test showing failed GPIO.</p>
-<pre>This program checks the Pi's (user) gpios.
-
-The program reads and writes all the gpios. Make sure NOTHING
-is connected to the gpios during this test.
-
-The program uses the pigpio daemon which must be running.
-
-To start the daemon use the command sudo pigpiod.
-
-Press the ENTER key to continue or ctrl-C to abort...
-
-Testing...
-Write 1 to gpio 17 failed.
-Pull up on gpio 17 failed.
-Write 1 to gpio 18 failed.
-Pull up on gpio 18 failed.
-Write 0 to gpio 23 failed.
-Pull down on gpio 23 failed.
-Write 0 to gpio 24 failed.
-Pull down on gpio 24 failed.
-Write 1 to gpio 27 failed.
-Pull up on gpio 27 failed.
-Skipped non-user gpios: 0 1 28 29 30 31
-Tested user gpios: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18<br> 19 20 21 22 23 24 25 26 27
-Failed user gpios: 17 18 23 24 27
-</pre>
-<h3><a name="How_do_I_debounce_inputs" id=
-"How_do_I_debounce_inputs"></a>How do I debounce inputs?</h3>
-<p>Some devices like mechanical switches can generate multiple
-interrupts as they bounce between on and off.&nbsp; It is possible
-to debounce the inputs in hardware by the correct use of resistors
-and capacitors.<br></p>
-<p>In software use the glitch filter which ignores all events
-shorter than a set number of microseconds.&nbsp; C <a href=
-"cif.html#gpioGlitchFilter">gpioGlitchFilter</a>, Python <a href=
-"python.html#set_glitch_filter">set_glitch_filter</a>.<br></p>
-<h3><a name="How_fast_is_SPI" id="How_fast_is_SPI"></a>How fast is
-SPI?</h3>
-The SPI throughput in samples per second depends on a number of
-factors.<br>
-<br>
-<ul>
-<li>The SPI bit rate (transfer rate in bits per second)</li>
-</ul>
-<ul>
-<li>The number of bytes transferred per sample (a 12 bit ADC sample
-may require 3 bytes to transfer)</li>
-</ul>
-<ul>
-<li>The driver used</li>
-</ul>
-<p>Two of those factors are fixed, the variable is the driver
-used.</p>
-<p>The pigpio driver is considerably faster than the Linux SPI
-driver as is demonstrated by the following graphs.<br></p>
-<p>Each graph shows the SPI bit rate in bits per second along the
-horizontal axis.&nbsp; The samples per second achieved is shown on
-the vertical axis.&nbsp; Each graph contains plots assuming 1 to 5
-bytes per transfer.<br></p>
-<p>The source code used for the tests is <a href=
-"code/spi-driver-speed.c">spi-driver-speed.c</a> and <a href=
-"code/spi-pigpio-speed.c">spi-pigpio-speed.c</a><br></p>
-<p><img alt="spi-lnx-pibr1.png" src="images/spi-lnx-pibr1.png"></p>
-<hr>
-<p><img alt="spi-pig-pibr1.png" src="images/spi-pig-pibr1.png"></p>
-<hr>
-<p><img alt="spi-lnx-pi3b.png" src="images/spi-lnx-pi3b.png"></p>
-<hr>
-<p><img alt="spi-pig-pi3b.png" src="images/spi-pig-pi3b.png"></p>
-<h3><a name="Library_update_fails" id=
-"Library_update_fails"></a>Library update didn't work</h3>
-<p>pigpio places files in the following locations<br></p>
-<p>/usr/local/include (pigpio.h, pigpiod_if.h, pigpiod_if2.h)<br>
-/usr/local/lib (libpigpio.so, libpigpiod_if.so,
-libpigpiod_if2.so)<br>
-/usr/local/bin (pig2vcd, pigpiod, pigs)<br>
-/usr/local/man (man pages)<br></p>
-The raspberrypi.org image containing pigpio uses different
-locations.<br>
-<p>/usr/include (pigpio.h, pigpiod_if.h, pigpiod_if2.h)<br>
-/usr/lib (libpigpio.so, libpigpiod_if.so, libpigpiod_if2.so)<br>
-/usr/bin (pig2vcd, pigpiod, pigs)<br>
-/usr/man (man pages)<br></p>
-<p>Mostly this doesn't matter as the /usr/local directories will
-generally be earlier in the search path.&nbsp; The pigpio built
-includes, binaries, and manuals are normally found first.<br></p>
-<p>However the wrong libraries may be linked during the
-compilation.&nbsp; If this is the case remove the /usr/lib entries
-for libpigpio.so , libpigpiod_if.so, and libpigpiod_if2.so</p>
-<h3><a name="Hello_World" id="Hello_World"></a>Hello World!</h3>
-<p>The following examples show how to use the various components of
-the pigpio library.</p>
-<p>Each example shows how to read the level of a GPIO.</p>
-<h4>C</h4>
-read_cif.c
-<pre>
-#include &lt;stdio.h&gt;
-#include &lt;pigpio.h&gt;
-
-int main(int argc, char *argv[])
-{
- int GPIO=4;
- int level;
-
- if (gpioInitialise() &lt; 0) return 1;
-
- level = gpioRead(GPIO);
-
- printf("GPIO %d is %d\n", GPIO, level);
-
- gpioTerminate();
-}
- </pre>
-<p>Build</p>
-<code>gcc -pthread -o read_cif read_cif.c -lpigpio</code>
-<p>Run</p>
-<code>sudo ./read_cif</code>
-<h4>C via pigpio daemon</h4>
-read_pdif.c
-<pre>
-#include &lt;stdio.h&gt;
-#include &lt;pigpiod_if2.h&gt;
-
-int main(int argc, char *argv[])
-{
- int pi;
- int GPIO=4;
- int level;
-
- pi = pigpio_start(0, 0); /* Connect to local Pi. */
-
- if (pi &lt; 0)
- {
- printf("Can't connect to pigpio daemon\n");
- return 1;
- }
-
- level = gpio_read(pi, GPIO);
-
- printf("GPIO %d is %d\n", GPIO, level);
-
- pigpio_stop(pi); /* Disconnect from local Pi. */
-
- return 0;
-}
-</pre>
-<p>Build</p>
-<code>gcc -pthread -o read_pdif read_pdif.c -lpigpiod_if2</code>
-<p>Run</p>
-<code>./read_pdif</code>
-<h4>Python</h4>
-read_gpio.py
-<pre>
-#!/usr/bin/env python
-
-import pigpio
-
-GPIO=4
-
-pi = pigpio.pi()
-if not pi.connected:
- exit()
-
-level = pi.read(GPIO)
-
-print("GPIO {} is {}".format(GPIO, level))
-
-pi.stop()
- </pre>
-<p>Run</p>
-<code>python read_gpio.py</code>
-<h4>pigs</h4>
-<pre>
-pigs r 4
- </pre>
-<h4>pipe I/F</h4>
-<pre>
-echo "r 4" &gt;/dev/pigpio
-cat /dev/pigout
- </pre>
-<h3><a name="make_fails" id="make_fails"></a>make fails with clock
-skew</h3>
-<p>If make fails with one of the following messages it is probably
-because the Pi's clock is wrong.<br></p>
-<p><code>make: Warning: File 'xxx' has modification time x s in the
-future<br>
-make: warning: Clock skew detected. Your build may be
-incomplete.</code></p>
-<p>make uses the current time to work out which files need to be
-rebuilt (a file is rebuilt if it depends on other files which have
-a later time-stamp).<br></p>
-<p>The solution is to make sure the system clock is correct.&nbsp;
-If the Pi is networked this will not normally be a problem.<br></p>
-<p>To set the date and time use the date command as in the
-following example.</p>
-<p><code>sudo date -d "2017-03-01 18:47:00"</code></p>
-<h3><a name="Porting_pigpio" id="Porting_pigpio"></a>Porting pigpio
-to another CPU/SoC</h3>
-<h3><a name="Sound_isnt_working" id="Sound_isnt_working"></a>Sound
-isn't working</h3>
-<p>The Pi contains two pieces of hardware, a PWM peripheral and a
-PCM peripheral, to generate sound.&nbsp; The PWM peripheral is
-normally used and generates medium quality audio out of the
-headphone jack.&nbsp; The PCM peripheral may be used by add-ons
-such as HATs and generates high quality audio.<br></p>
-<p>pigpio uses at least one of these peripherals during normal
-operation (for timing DMA transfers).&nbsp; pigpio will use both
-peripherals if waves or the hardware PWM function is used.<br></p>
-<p>By default pigpio uses the PCM peripheral leaving the PWM
-peripheral free for medium quality audio.<br></p>
-<p>You can change the default with a configuration option.&nbsp;
-For C use <a href="cif.html#gpioCfgClock">gpioCfgClock</a>, for the
-<a href="pigpiod.html">pigpio daemon</a> use the -t option.</p>
-<h3><a name="What_is_I2C" id="What_is_I2C"></a>What is I2C?</h3>
-<p>I2C is a data link between the Pi (master) and one or more
-slaves.</p>
-<p>Data may be sent and received but the Pi initiates all
-transfers.<br></p>
-<p>I2C is a medium speed link.&nbsp; On the Pi the default speed is
-100 kbps, but 400 kbps also works.<br></p>
-<p>I2C is implemented as a bus with two lines called<br></p>
-<ul>
-<li>SDA - for data</li>
-<li>SCL - for a clock</li>
-</ul>
-On the Pi bus 1 is used which uses GPIO 2 (pin 3) for SDA and GPIO
-3 (pin 5) for SCL.<br>
-<br>
-Only one slave device may be communicated with at a time.&nbsp;
-Each message from the Pi includes the slave to be addressed and
-whether a read or write is to be performed.<br>
-<br>
-When the Pi (master) wishes to talk to a slave it begins by issuing
-a start sequence on the I2C bus. A start sequence is one of two
-special sequences defined for the I2C bus, the other being the stop
-sequence. The start sequence and stop sequence are special in that
-these are the only places where the SDA (data line) is allowed to
-change while the SCL (clock line) is high. When data is being
-transferred, SDA must remain stable and not change whilst SCL is
-high. The start and stop sequences mark the beginning and end of a
-transaction with the slave device.<br>
-<br>
-<img style="width: 600px;" alt="I2C start and stop sequences" src=
-"images/faq-i2c-ss.png"><br>
-<br>
-Data is transferred in 8-bit bytes. The bytes are placed on the SDA
-line starting with the most significant bit. The SCL line is then
-pulsed high, then low. For every byte transferred, the device
-receiving the data sends back an acknowledge bit, so there are
-actually 9 SCL clock pulses to transfer each 8-bit byte of data. If
-the receiving device sends back a low ACK bit, then it has received
-the data and is ready to accept another byte. If it sends back a
-high then it is indicating it cannot accept any further data and
-the master should terminate the transfer by sending a stop
-sequence.<br>
-<br>
-<p><img style="width: 600px;" alt="I2C waveform" src=
-"images/faq-i2c.jpg"><br></p>
-<h3><a name="What_is_Serial" id="What_is_Serial"></a>What is
-Serial?</h3>
-<p>Serial is a data link between the Pi and one other
-device.<br></p>
-<p>Data may be sent and received.&nbsp; Either the Pi or the device
-can initiate a transfer.<br></p>
-<p>Serial is a low to medium speed link.&nbsp; On the Pi speeds of
-50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600,
-19200, 38400, 57600, 115200, and 230400 bps may be used.<br></p>
-<p>Serial is implemented with one line for transmit called TXD and
-one line for receive called RXD.<br></p>
-<p>If only receive or transmit are required the other line need not
-be connected.<br></p>
-<p>The Pi uses GPIO 14 (pin 8) for TXD and GPIO 15 (pin 10) for
-RXD.<br></p>
-<p>Data is normally transmitted in 8-bit bytes with a start bit,
-eight data bits, no parity, and one stop bit.&nbsp; This is
-represented as 8N1.&nbsp; The number of transmitted bits per second
-(bps) is called the baud rate.&nbsp;&nbsp; The time for each bit,
-<span style="font-style: italic;">1 / baud rate</span> seconds, is
-referred to as the bit period.<br></p>
-<p>The lines are in the high state when no data is being
-transmitted.&nbsp; The start of a byte is signalled by the line
-going low for one bit period (the start bit).&nbsp; The data bits
-are then sent least significant bit firsts (low if the bit is 0,
-high if the bit is 1).&nbsp; The data bits are followed by the
-optional parity bit.&nbsp; Finally the line is set high for at
-least the number of stop bit periods.&nbsp; The line will stay high
-if there are no more bytes to be transmitted.<br></p>
-<p><img style="width: 600px;" alt="Serial waveform" src=
-"images/faq-serial.jpg"><br></p>
-<h3><a name="What_is_SPI" id="What_is_SPI"></a>What is SPI?</h3>
-<p>SPI is a data link between the Pi (master) and one or more
-slaves.</p>
-<p>Data may be sent and received but the Pi initiates all
-transfers.<br></p>
-<p>SPI is a medium to high speed link.&nbsp; On the Pi speeds of 32
-kbps to 8 Mbps may be used.<br></p>
-<p>SPI is implemented as a bus with three lines called<br></p>
-<ul>
-<li>MOSI - for data from the Pi to the slave</li>
-<li>MISO - for data from the slave to the Pi</li>
-<li>SCLK - for a clock</li>
-</ul>
-Only one slave device may be communicated with at a time.&nbsp; An
-additional line per slave called slave select is used to identify
-the slave to be addressed.
-<p>The Pi has two SPI buses<br></p>
-<ol>
-<li>the main SPI bus
-<ul>
-<li>MOSI GPIO 10 (pin 19)</li>
-<li>MISO GPIO 9 (pin 21)</li>
-<li>SCLK GPIO 11 (pin 23)</li>
-<li>Slave selects</li>
-<li style="list-style: none; display: inline">
-<ul>
-<li>CE0 GPIO 8 (pin 24)</li>
-<li>CE1 GPIO 7 (pin 26)</li>
-</ul>
-</li>
-</ul>
-</li>
-<li>the auxiliary SPI bus
-<ul>
-<li>MOSI GPIO 20 (pin 38)</li>
-<li>MISO GPIO 19 (pin 35)</li>
-<li>SCLK GPIO 21 (pin 40)</li>
-<li>Slave selects</li>
-<li style="list-style: none; display: inline">
-<ul>
-<li>CE0 GPIO 18 (pin 12)</li>
-<li>CE1 GPIO 17 (pin 11)</li>
-<li>CE2 GPIO 16 (pin 36)<br></li>
-</ul>
-</li>
-</ul>
-</li>
-</ol>
-<p><img style="width: 600px;" alt="SPI waveform" src=
-"images/faq-spi.jpg"><br></p>
-<p><br></p>
-<h3><a name="Which_library" id="Which_library"></a>Which library
-should I use?</h3>
-<p><br></p>
-</td>
-</table>
-<div style="vertical-align: center; text-align: center; background-color:#98bf21; font-size:0.8em; height:30px"><a class="l2" href="index.html">[pigpio]</a>
-<a class="l2" href="cif.html">[pigpio C I/F]</a>
-<a class="l2" href="pigpiod.html">[pigpiod]</a>
-<a class="l2" href="pdif2.html">[pigpiod C I/F]</a>
-<a class="l2" href="python.html">[Python]</a>
-<a class="l2" href="pigs.html">[pigs]</a>
-<a class="l2" href="piscope.html">[piscope]</a>
-<a class="l2" href="misc.html">[Misc]</a>
-<a class="l2" href="examples.html">[Examples]</a>
-<a class="l2" href="download.html">[Download]</a>
-<a class="l2" href="faq.html">[FAQ]</a>
-<a class="l2" href="sitemap.html">[Site Map]</a>
-</div>
-<table><tr>
-<td style="width: 200px"><div style="text-align: left;"><small>&copy; 2012-2020</small></div></td>
-<td style="width: 350px"><div style="text-align: center;">e-mail: pigpio @ abyz.me.uk</div></td>
-<td style="width: 200px"><div style="text-align: right;"><small>Updated: 30/04/2020</small></div></td>
-</tr></table>
-</td>
-</table>
-</body>
-</html>
diff --git a/DOC/HTML/index.html b/DOC/HTML/index.html
deleted file mode 100644
index fdaeaa6..0000000
--- a/DOC/HTML/index.html
+++ /dev/null
@@ -1,716 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta name="description" content="Raspberry Pi Reg. C GPIO library and Python GPIO module and shell command utilities to control the GPIO, including SPI, I2C, and serial links." />
- <meta name="keywords" content="raspberry, pi, C, Python, GPIO, library, shell, command, utilities, module, SPI, I2C, serial" />
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>pigpio library</title>
- <link rel="stylesheet" type="text/css" href="scripts/index.css">
- <link rel="icon" href="favicon.ico" type="image/x-icon">
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
-</head>
-<body>
-
-<table style="padding:0px; border:0px; margin:0px; width:780px; background-color:#e0e0e0;">
-<td style="background:#EAF2E6 url('images/sidebar.gif') repeat-y; width:35px; height:100%"></td>
-<td>
-<table>
-<div style="background:url('images/topbar.gif') repeat-x; height: 70px; font-size:1.5em; vertical-align: top;"><a href="index.html"><img src="images/pigpio-logo.gif" border="0" /></a>pigpio library</div>
-</table>
-<table><div>
-<td><img src="images/rpi.jpg" width="250"></td>
-<td><img src="images/servo.jpg" width="250"></td>
-<td><img src="images/motor.jpg" width="250"></td>
-</div></table>
-<table>
-<td style="vertical-align: top; background-color: #98bf21;"><a class="l1" href="index.html">pigpio</a>
-<a class="l1" href="cif.html">pigpio C I/F</a>
-<a class="l1" href="pigpiod.html">pigpiod</a>
-<a class="l1" href="pdif2.html">pigpiod C I/F</a>
-<a class="l1" href="python.html">Python</a>
-<a class="l1" href="pigs.html">pigs</a>
-<a class="l1" href="piscope.html">piscope</a>
-<a class="l1" href="misc.html">Misc</a>
-<a class="l1" href="examples.html">Examples</a>
-<a class="l1" href="download.html">Download</a>
-<a class="l1" href="faq.html">FAQ</a>
-<a class="l1" href="sitemap.html">Site Map</a>
-</td>
-<td><center><h2>The pigpio library</h2></center>
-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>
-<li>
-<p>hardware timed sampling and time-stamping of GPIO 0-31 every 5
-us<br></p>
-</li>
-<li>
-<p>hardware timed PWM on all of GPIO 0-31<br></p>
-</li>
-<li>
-<p>hardware timed servo pulses on all of GPIO 0-31</p>
-</li>
-<li>
-<p>callbacks on GPIO 0-31 level change (time accurate to a few
-us)</p>
-</li>
-<li>
-<p>notifications via pipe on GPIO 0-31 level change<br></p>
-</li>
-<li>
-<p>callbacks at timed intervals</p>
-</li>
-<li>
-<p>reading/writing all of the GPIO in a bank (0-31, 32-53) as a
-single operation</p>
-</li>
-<li>
-<p>GPIO reading, writing, modes, and internal pulls<br></p>
-</li>
-<li>
-<p>socket and pipe interfaces for the bulk of the functionality</p>
-</li>
-<li>
-<p>waveforms to generate GPIO level changes (time accurate to a few
-us)</p>
-</li>
-<li>
-<p>software serial links using any user GPIO</p>
-</li>
-<li>
-<p>rudimentary permission control through the socket and pipe
-interfaces<br></p>
-</li>
-<li>creating and running scripts on the pigpio daemon</li>
-</ul>
-<h3>General</h3>
-The pigpio <a href="cif.html">library</a> is written in the C
-programming language.<br>
-<br>
-The <a href="pigpiod.html">pigpio daemon</a> offers a <a href=
-"sif.html">socket</a> and <a href="pif.html">pipe</a> interface to
-the underlying C library.<br>
-<br>
-A <a href="pdif2.html">C library</a> and a <a href=
-"python.html">Python module</a> allow control of the GPIO via the
-pigpio daemon.<br>
-<br>
-There is third party support for a number of <a href=
-"index.html#Other_Languages">other languages</a>.&nbsp;
-<h3>piscope</h3>
-<p><a href="piscope.html">piscope</a> is a logic analyser (digital
-waveform viewer).<br></p>
-piscope is a GTK+3 application and uses pigpio to provide raw GPIO
-level data.&nbsp; piscope may be run on a Pi or on any machine
-capable of compiling a GTK+3 application.
-<h3><a name="GPIO" id="GPIO"></a>GPIO</h3>
-<p><span style="font-weight: bold;">ALL GPIO</span> are identified
-by their <span style="font-weight: bold;">Broadcom
-number</span>.&nbsp; See <a href=
-"http://elinux.org/RPi_Low-level_peripherals#General_Purpose_Input.2FOutput_.28GPIO.29">
-elinux.org</a><br></p>
-There are 54 GPIO in total, arranged in two banks.<br>
-<p>Bank 1 contains GPIO 0-31.&nbsp; Bank 2 contains GPIO
-32-53.<br></p>
-For all types of Pi it is safe to read all the GPIO. If you try to
-write a system GPIO or change its mode you can crash the Pi or
-corrupt the data on the SD card.<br>
-<br>
-There are several types of board, each with different expansion
-headers, giving physical access to different GPIO.&nbsp;
-<ul>
-<li><a href="#Type_1">Type 1</a> - Model B (original model)</li>
-<li><a href="#Type_2">Type 2</a> - Model A, B (revision 2)</li>
-<li><a href="#Type_3">Type 3</a> - Model A+, B+, Pi Zero, Pi2B,
-Pi3B</li>
-<li><a href="#CM">Compute Module</a> - Compute Module</li>
-</ul>
-<h4><a name="Type_1" id="Type_1"></a>Type 1 - Model B (original
-model)</h4>
-<ul>
-<li>26 pin header (P1).</li>
-</ul>
-<ul>
-<li>Hardware revision numbers of 2 and 3.</li>
-</ul>
-<ul>
-<li>User GPIO 0-1, 4, 7-11, 14-15, 17-18, 21-25.</li>
-</ul>
-<table summary="" style="width: 60%; text-align: left;"
-cellspacing="0" cellpadding="0" border="0">
-<tbody>
-<tr>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-<br></td>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-GPIO</td>
-<td style="font-weight: bold; text-align: center;">pin</td>
-<td style="font-weight: bold; text-align: center;">pin</td>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-GPIO</td>
-<td style="font-weight: bold; text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">3V3</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">1</td>
-<td style="text-align: center;">2</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">5V</td>
-</tr>
-<tr>
-<td style="text-align: center;">SDA</td>
-<td style="text-align: center;">0<br></td>
-<td style="text-align: center;">3</td>
-<td style="text-align: center;">4</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">5V</td>
-</tr>
-<tr>
-<td style="text-align: center;">SCL</td>
-<td style="text-align: center;">1<br></td>
-<td style="text-align: center;">5</td>
-<td style="text-align: center;">6</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">Ground</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">4</td>
-<td style="text-align: center;">7</td>
-<td style="text-align: center;">8</td>
-<td style="text-align: center;">14</td>
-<td style="text-align: center;">TXD</td>
-</tr>
-<tr>
-<td style="text-align: center;">Ground</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">9</td>
-<td style="text-align: center;">10</td>
-<td style="text-align: center;">15</td>
-<td style="text-align: center;">RXD</td>
-</tr>
-<tr>
-<td style="text-align: center;">ce1</td>
-<td style="text-align: center;">17</td>
-<td style="text-align: center;">11</td>
-<td style="text-align: center;">12</td>
-<td style="text-align: center;">18</td>
-<td style="text-align: center;">ce0</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">21</td>
-<td style="text-align: center;">13</td>
-<td style="text-align: center;">14</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">Ground</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">22</td>
-<td style="text-align: center;">15</td>
-<td style="text-align: center;">16</td>
-<td style="text-align: center;">23</td>
-<td style="text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">3V3</td>
-<td style="text-align: center;">-<br></td>
-<td style="text-align: center;">17</td>
-<td style="text-align: center;">18</td>
-<td style="text-align: center;">24</td>
-<td style="text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">MOSI</td>
-<td style="text-align: center;">10</td>
-<td style="text-align: center;">19</td>
-<td style="text-align: center;">20</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">Ground</td>
-</tr>
-<tr>
-<td style="text-align: center;">MISO</td>
-<td style="text-align: center;">9</td>
-<td style="text-align: center;">21</td>
-<td style="text-align: center;">22</td>
-<td style="text-align: center;">25</td>
-<td style="text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">SCLK</td>
-<td style="text-align: center;">11</td>
-<td style="text-align: center;">23</td>
-<td style="text-align: center;">24</td>
-<td style="text-align: center;">8</td>
-<td style="text-align: center;">CE0</td>
-</tr>
-<tr>
-<td style="text-align: center;">Ground</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">25</td>
-<td style="text-align: center;">26</td>
-<td style="text-align: center;">7</td>
-<td style="text-align: center;">CE1</td>
-</tr>
-</tbody>
-</table>
-<br>
-<h4><a name="Type_2" id="Type_2"></a>Type 2 - Model A, B (revision
-2)</h4>
-26 pin header (P1) and an additional 8 pin header (P5).
-<ul>
-<li>Hardware revision numbers of 4, 5, 6 (B), 7, 8, 9 (A), and 13,
-14, 15 (B).</li>
-</ul>
-<ul>
-<li>User GPIO 2-4, 7-11, 14-15, 17-18, 22-25, 27-31.<br></li>
-</ul>
-<table summary="" style="width: 60%; text-align: left;"
-cellspacing="0" cellpadding="0" border="0">
-<tbody>
-<tr>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-<br></td>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-GPIO</td>
-<td style="font-weight: bold; text-align: center;">pin</td>
-<td style="font-weight: bold; text-align: center;">pin</td>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-GPIO</td>
-<td style="font-weight: bold; text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">3V3</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">1</td>
-<td style="text-align: center;">2</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">5V</td>
-</tr>
-<tr>
-<td style="text-align: center;">SDA</td>
-<td style="text-align: center;">2</td>
-<td style="text-align: center;">3</td>
-<td style="text-align: center;">4</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">5V</td>
-</tr>
-<tr>
-<td style="text-align: center;">SCL</td>
-<td style="text-align: center;">3</td>
-<td style="text-align: center;">5</td>
-<td style="text-align: center;">6</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">Ground</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">4</td>
-<td style="text-align: center;">7</td>
-<td style="text-align: center;">8</td>
-<td style="text-align: center;">14</td>
-<td style="text-align: center;">TXD</td>
-</tr>
-<tr>
-<td style="text-align: center;">Ground</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">9</td>
-<td style="text-align: center;">10</td>
-<td style="text-align: center;">15</td>
-<td style="text-align: center;">RXD</td>
-</tr>
-<tr>
-<td style="text-align: center;">ce1</td>
-<td style="text-align: center;">17</td>
-<td style="text-align: center;">11</td>
-<td style="text-align: center;">12</td>
-<td style="text-align: center;">18</td>
-<td style="text-align: center;">ce0</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">27</td>
-<td style="text-align: center;">13</td>
-<td style="text-align: center;">14</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">Ground</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">22</td>
-<td style="text-align: center;">15</td>
-<td style="text-align: center;">16</td>
-<td style="text-align: center;">23</td>
-<td style="text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">3V3</td>
-<td style="text-align: center;">-<br></td>
-<td style="text-align: center;">17</td>
-<td style="text-align: center;">18</td>
-<td style="text-align: center;">24</td>
-<td style="text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">MOSI</td>
-<td style="text-align: center;">10</td>
-<td style="text-align: center;">19</td>
-<td style="text-align: center;">20</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">Ground</td>
-</tr>
-<tr>
-<td style="text-align: center;">MISO</td>
-<td style="text-align: center;">9</td>
-<td style="text-align: center;">21</td>
-<td style="text-align: center;">22</td>
-<td style="text-align: center;">25</td>
-<td style="text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">SCLK</td>
-<td style="text-align: center;">11</td>
-<td style="text-align: center;">23</td>
-<td style="text-align: center;">24</td>
-<td style="text-align: center;">8</td>
-<td style="text-align: center;">CE0</td>
-</tr>
-<tr>
-<td style="text-align: center;">Ground</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">25</td>
-<td style="text-align: center;">26</td>
-<td style="text-align: center;">7</td>
-<td style="text-align: center;">CE1</td>
-</tr>
-</tbody>
-</table>
-<br>
-<table summary="" style="width: 60%; text-align: left;"
-cellspacing="0" cellpadding="0" border="0">
-<tbody>
-<tr>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-<br></td>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-GPIO</td>
-<td style="font-weight: bold; text-align: center;">pin</td>
-<td style="font-weight: bold; text-align: center;">pin</td>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-GPIO</td>
-<td style="font-weight: bold; text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">5V<br></td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">1</td>
-<td style="text-align: center;">2</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">3V3</td>
-</tr>
-<tr>
-<td style="text-align: center;">SDA<br></td>
-<td style="text-align: center;">28</td>
-<td style="text-align: center;">3</td>
-<td style="text-align: center;">4</td>
-<td style="text-align: center;">29</td>
-<td style="text-align: center;">SCL</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">30</td>
-<td style="text-align: center;">5</td>
-<td style="text-align: center;">6</td>
-<td style="text-align: center;">31</td>
-<td style="text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">Ground<br></td>
-<td style="text-align: center;">-<br></td>
-<td style="text-align: center;">7</td>
-<td style="text-align: center;">8</td>
-<td style="text-align: center;">-<br></td>
-<td style="text-align: center;">Ground</td>
-</tr>
-</tbody>
-</table>
-<br>
-<h4><a name="Type_3" id="Type_3"></a>Type 3 - Model A+, B+, Pi
-Zero, Pi Zero W, Pi2B, Pi3B, Pi4B<br></h4>
-<ul>
-<li>40 pin expansion header (J8).</li>
-</ul>
-<ul>
-<li>Hardware revision numbers of 16 or greater.</li>
-</ul>
-<ul>
-<li>User GPIO 2-27 (0 and 1 are reserved).<br></li>
-</ul>
-<table summary="" style="width: 60%; text-align: left;"
-cellspacing="0" cellpadding="0" border="0">
-<tbody>
-<tr>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-<br></td>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-GPIO</td>
-<td style="font-weight: bold; text-align: center;">pin</td>
-<td style="font-weight: bold; text-align: center;">pin</td>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-GPIO</td>
-<td style="font-weight: bold; text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">3V3</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">1</td>
-<td style="text-align: center;">2</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">5V</td>
-</tr>
-<tr>
-<td style="text-align: center;">SDA</td>
-<td style="text-align: center;">2</td>
-<td style="text-align: center;">3</td>
-<td style="text-align: center;">4</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">5V</td>
-</tr>
-<tr>
-<td style="text-align: center;">SCL</td>
-<td style="text-align: center;">3</td>
-<td style="text-align: center;">5</td>
-<td style="text-align: center;">6</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">Ground</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">4</td>
-<td style="text-align: center;">7</td>
-<td style="text-align: center;">8</td>
-<td style="text-align: center;">14</td>
-<td style="text-align: center;">TXD</td>
-</tr>
-<tr>
-<td style="text-align: center;">Ground</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">9</td>
-<td style="text-align: center;">10</td>
-<td style="text-align: center;">15</td>
-<td style="text-align: center;">RXD</td>
-</tr>
-<tr>
-<td style="text-align: center;">ce1</td>
-<td style="text-align: center;">17</td>
-<td style="text-align: center;">11</td>
-<td style="text-align: center;">12</td>
-<td style="text-align: center;">18</td>
-<td style="text-align: center;">ce0</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">27</td>
-<td style="text-align: center;">13</td>
-<td style="text-align: center;">14</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">Ground</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">22</td>
-<td style="text-align: center;">15</td>
-<td style="text-align: center;">16</td>
-<td style="text-align: center;">23</td>
-<td style="text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">3V3</td>
-<td style="text-align: center;">-<br></td>
-<td style="text-align: center;">17</td>
-<td style="text-align: center;">18</td>
-<td style="text-align: center;">24</td>
-<td style="text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">MOSI</td>
-<td style="text-align: center;">10</td>
-<td style="text-align: center;">19</td>
-<td style="text-align: center;">20</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">Ground</td>
-</tr>
-<tr>
-<td style="text-align: center;">MISO</td>
-<td style="text-align: center;">9</td>
-<td style="text-align: center;">21</td>
-<td style="text-align: center;">22</td>
-<td style="text-align: center;">25</td>
-<td style="text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">SCLK</td>
-<td style="text-align: center;">11</td>
-<td style="text-align: center;">23</td>
-<td style="text-align: center;">24</td>
-<td style="text-align: center;">8</td>
-<td style="text-align: center;">CE0</td>
-</tr>
-<tr>
-<td style="text-align: center;">Ground</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">25</td>
-<td style="text-align: center;">26</td>
-<td style="text-align: center;">7</td>
-<td style="text-align: center;">CE1</td>
-</tr>
-<tr>
-<td style="text-align: center;">ID_SD</td>
-<td style="text-align: center;">0</td>
-<td style="text-align: center;">27</td>
-<td style="text-align: center;">28</td>
-<td style="text-align: center;">1</td>
-<td style="text-align: center;">ID_SC</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">5</td>
-<td style="text-align: center;">29</td>
-<td style="text-align: center;">30</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">Ground</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">6</td>
-<td style="text-align: center;">31</td>
-<td style="text-align: center;">32</td>
-<td style="text-align: center;">12</td>
-<td style="text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">13</td>
-<td style="text-align: center;">33</td>
-<td style="text-align: center;">34</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">Ground</td>
-</tr>
-<tr>
-<td style="text-align: center;">miso</td>
-<td style="text-align: center;">19</td>
-<td style="text-align: center;">35</td>
-<td style="text-align: center;">36</td>
-<td style="text-align: center;">16</td>
-<td style="text-align: center;">ce2</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">26</td>
-<td style="text-align: center;">37</td>
-<td style="text-align: center;">38</td>
-<td style="text-align: center;">20</td>
-<td style="text-align: center;">mosi</td>
-</tr>
-<tr>
-<td style="text-align: center;">Ground</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">39</td>
-<td style="text-align: center;">40</td>
-<td style="text-align: center;">21</td>
-<td style="text-align: center;">sclk</td>
-</tr>
-</tbody>
-</table>
-<br>
-<h4><a name="CM" id="CM"></a>Compute Module</h4>
-<p>All 54 GPIO may be physically accessed.&nbsp; Some are reserved
-for system use - refer to the Compute Module documentation.<br></p>
-<p>Only GPIO 0-31 are supported for hardware timed sampling, PWM,
-servo pulses, alert callbacks, waves, and software serial
-links.<br></p>
-<h3><a name="Other_Languages" id="Other_Languages"></a>Other
-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>
-<ul>
-<li><a href="https://github.com/skvamme/pigpio">Erlang</a>
-(skvamme)</li>
-<li><a href="https://github.com/mattjlewis/pigpioj">Java</a> JNI
-wrapper around the pigpio C library (mattlewis)</li>
-<li><a href="https://github.com/mattjlewis/diozero">Java</a> via
-diozero, a high level wrapper around pigpio, Pi4J, wiringPi etc
-(mattlewis)</li>
-<li><a href="https://github.com/nkolban/jpigpio">Java</a>
-(nkolban)</li>
-<li><a href=
-"https://github.com/unosquare/pigpio-dotnet">.NET/mono</a>
-(unosquare)</li>
-<li><a href="https://github.com/fivdi/pigpio">Node.js</a>
-(fivdi)</li>
-<li><a href="https://metacpan.org/pod/RPi::PIGPIO">Perl</a> (Gligan
-Calin Horea)</li>
-<li><a href=
-"https://github.com/nak1114/ruby-extension-pigpio">Ruby</a>
-(Nak)</li>
-<li><a href=
-"https://github.com/vasmalltalk/pigpio-vast">Smalltalk</a>(Instantiations)</li>
-<li><a href=
-"https://github.com/UBogun/Xojo-pigpio">Xojo</a>(UBogun)</li>
-</ul>
-<hr style="width: 100%; height: 2px;">
-<p><font size="-2">The PWM and servo pulses are timed using the DMA
-and PWM/PCM peripherals.&nbsp; This use was inspired by Richard
-Hirst's <a href="https://github.com/richardghirst/PiBits" target=
-"_blank">servoblaster</a> kernel module.</font></p>
-</td>
-</table>
-<div style="vertical-align: center; text-align: center; background-color:#98bf21; font-size:0.8em; height:30px"><a class="l2" href="index.html">[pigpio]</a>
-<a class="l2" href="cif.html">[pigpio C I/F]</a>
-<a class="l2" href="pigpiod.html">[pigpiod]</a>
-<a class="l2" href="pdif2.html">[pigpiod C I/F]</a>
-<a class="l2" href="python.html">[Python]</a>
-<a class="l2" href="pigs.html">[pigs]</a>
-<a class="l2" href="piscope.html">[piscope]</a>
-<a class="l2" href="misc.html">[Misc]</a>
-<a class="l2" href="examples.html">[Examples]</a>
-<a class="l2" href="download.html">[Download]</a>
-<a class="l2" href="faq.html">[FAQ]</a>
-<a class="l2" href="sitemap.html">[Site Map]</a>
-</div>
-<table><tr>
-<td style="width: 200px"><div style="text-align: left;"><small>&copy; 2012-2020</small></div></td>
-<td style="width: 350px"><div style="text-align: center;">e-mail: pigpio @ abyz.me.uk</div></td>
-<td style="width: 200px"><div style="text-align: right;"><small>Updated: 30/04/2020</small></div></td>
-</tr></table>
-</td>
-</table>
-</body>
-</html>
diff --git a/DOC/HTML/misc.html b/DOC/HTML/misc.html
deleted file mode 100644
index e4db51a..0000000
--- a/DOC/HTML/misc.html
+++ /dev/null
@@ -1,88 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta name="description" content="Raspberry Pi Reg. C GPIO library and Python GPIO module and shell command utilities to control the GPIO, including SPI, I2C, and serial links." />
- <meta name="keywords" content="raspberry, pi, C, Python, GPIO, library, shell, command, utilities, module, SPI, I2C, serial" />
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>pigpio library</title>
- <link rel="stylesheet" type="text/css" href="scripts/index.css">
- <link rel="icon" href="favicon.ico" type="image/x-icon">
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
-</head>
-<body>
-
-<table style="padding:0px; border:0px; margin:0px; width:780px; background-color:#e0e0e0;">
-<td style="background:#EAF2E6 url('images/sidebar.gif') repeat-y; width:35px; height:100%"></td>
-<td>
-<table>
-<div style="background:url('images/topbar.gif') repeat-x; height: 70px; font-size:1.5em; vertical-align: top;"><a href="index.html"><img src="images/pigpio-logo.gif" border="0" /></a>pigpio library</div>
-</table>
-<table><div>
-<td><img src="images/msp430.jpg" width="250"></td>
-<td><img src="images/motor.jpg" width="250"></td>
-<td><img src="images/leds.jpg" width="250"></td>
-</div></table>
-<table>
-<td style="vertical-align: top; background-color: #98bf21;"><a class="l1" href="index.html">pigpio</a>
-<a class="l1" href="cif.html">pigpio C I/F</a>
-<a class="l1" href="pigpiod.html">pigpiod</a>
-<a class="l1" href="pdif2.html">pigpiod C I/F</a>
-<a class="l1" href="python.html">Python</a>
-<a class="l1" href="pigs.html">pigs</a>
-<a class="l1" href="piscope.html">piscope</a>
-<a class="l1" href="misc.html">Misc</a>
-<a class="l1" href="examples.html">Examples</a>
-<a class="l1" href="download.html">Download</a>
-<a class="l1" href="faq.html">FAQ</a>
-<a class="l1" href="sitemap.html">Site Map</a>
-</td>
-<td><center><h2>Miscellaneous</h2></center>
-There are two C libraries which provide a socket interface to the
-pigpio daemon.&nbsp; They provide an interface very similar to the
-pigpio Python module.<br>
-<ul>
-<li>The original <a href="./pdif.html">pigpiod_if</a> library is
-now deprecated and will no longer be updated.&nbsp; This library is
-limited to controlling one Pi at a time.</li>
-</ul>
-<ul>
-<li>The new <a href="./pdif2.html">pigpiod_if2</a> library which
-should be used for new code.&nbsp; This library allows multiple Pis
-to be controlled at one time.</li>
-</ul>
-Additional details of the pigpio <a href="./sif.html">socket</a>
-interface.<br>
-<br>
-Additional details of the pigpio <a href="./pif.html">pipe</a>
-interface.<br>
-<br>
-<a href="pig2vcd.html">pig2vcd</a> is a utility which converts
-pigpio notifications into the VCD (Value Change Dump) format.&nbsp;
-VCD can be read by many programs, in particular <a href=
-"http://gtkwave.sourceforge.net/">GTKWave</a>.
-</td>
-</table>
-<div style="vertical-align: center; text-align: center; background-color:#98bf21; font-size:0.8em; height:30px"><a class="l2" href="index.html">[pigpio]</a>
-<a class="l2" href="cif.html">[pigpio C I/F]</a>
-<a class="l2" href="pigpiod.html">[pigpiod]</a>
-<a class="l2" href="pdif2.html">[pigpiod C I/F]</a>
-<a class="l2" href="python.html">[Python]</a>
-<a class="l2" href="pigs.html">[pigs]</a>
-<a class="l2" href="piscope.html">[piscope]</a>
-<a class="l2" href="misc.html">[Misc]</a>
-<a class="l2" href="examples.html">[Examples]</a>
-<a class="l2" href="download.html">[Download]</a>
-<a class="l2" href="faq.html">[FAQ]</a>
-<a class="l2" href="sitemap.html">[Site Map]</a>
-</div>
-<table><tr>
-<td style="width: 200px"><div style="text-align: left;"><small>&copy; 2012-2020</small></div></td>
-<td style="width: 350px"><div style="text-align: center;">e-mail: pigpio @ abyz.me.uk</div></td>
-<td style="width: 200px"><div style="text-align: right;"><small>Updated: 30/04/2020</small></div></td>
-</tr></table>
-</td>
-</table>
-</body>
-</html>
diff --git a/DOC/HTML/pdif.html b/DOC/HTML/pdif.html
deleted file mode 100644
index 2256f61..0000000
--- a/DOC/HTML/pdif.html
+++ /dev/null
@@ -1,1168 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta name="description" content="Raspberry Pi Reg. C GPIO library and Python GPIO module and shell command utilities to control the GPIO, including SPI, I2C, and serial links." />
- <meta name="keywords" content="raspberry, pi, C, Python, GPIO, library, shell, command, utilities, module, SPI, I2C, serial" />
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>pigpio library</title>
- <link rel="stylesheet" type="text/css" href="scripts/index.css">
- <link rel="icon" href="favicon.ico" type="image/x-icon">
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
-</head>
-<body>
-
-<table style="padding:0px; border:0px; margin:0px; width:780px; background-color:#e0e0e0;">
-<td style="background:#EAF2E6 url('images/sidebar.gif') repeat-y; width:35px; height:100%"></td>
-<td>
-<table>
-<div style="background:url('images/topbar.gif') repeat-x; height: 70px; font-size:1.5em; vertical-align: top;"><a href="index.html"><img src="images/pigpio-logo.gif" border="0" /></a>pigpio library</div>
-</table>
-<table><div>
-<td><img src="images/pot.jpg" width="250"></td>
-<td><img src="images/rotary.jpg" width="250"></td>
-<td><img src="images/psu.jpg" width="250"></td>
-</div></table>
-<table>
-<td style="vertical-align: top; background-color: #98bf21;"><a class="l1" href="index.html">pigpio</a>
-<a class="l1" href="cif.html">pigpio C I/F</a>
-<a class="l1" href="pigpiod.html">pigpiod</a>
-<a class="l1" href="pdif2.html">pigpiod C I/F</a>
-<a class="l1" href="python.html">Python</a>
-<a class="l1" href="pigs.html">pigs</a>
-<a class="l1" href="piscope.html">piscope</a>
-<a class="l1" href="misc.html">Misc</a>
-<a class="l1" href="examples.html">Examples</a>
-<a class="l1" href="download.html">Download</a>
-<a class="l1" href="faq.html">FAQ</a>
-<a class="l1" href="sitemap.html">Site Map</a>
-</td>
-<td><center><h2>pigpiod_if</h2></center><br><br>THIS LIBRARY IS DEPRECATED. NEW CODE SHOULD BE WRITTEN TO
-USE THE MORE VERSATILE pigpiod_if2 LIBRARY.
-<br><br>pigpiod_if is a C library for the Raspberry which allows control
-of the GPIO via the socket interface to the pigpio daemon.<br>
-<h3>Features</h3>o hardware timed PWM on any of GPIO 0-31
-<br><br>o hardware timed servo pulses on any of GPIO 0-31
-<br><br>o callbacks when any of GPIO 0-31 change state
-<br><br>o callbacks at timed intervals
-<br><br>o reading/writing all of the GPIO in a bank as one operation
-<br><br>o individually setting GPIO modes, reading and writing
-<br><br>o notifications when any of GPIO 0-31 change state
-<br><br>o the construction of output waveforms with microsecond timing
-<br><br>o rudimentary permission control over GPIO
-<br><br>o a simple interface to start and stop new threads
-<br><br>o I2C, SPI, and serial link wrappers
-<br><br>o creating and running scripts on the pigpio daemon
-<h3>GPIO</h3>ALL GPIO are identified by their Broadcom number.
-<h3>Notes</h3>The PWM and servo pulses are timed using the DMA and PWM/PCM peripherals.
-<h3>Usage</h3>Include &lt;pigpiod_if.h&gt; in your source files.
-<br><br>Assuming your source is in prog.c use the following command to build
-<br><br><code>gcc&nbsp;-Wall&nbsp;-pthread&nbsp;-o&nbsp;prog&nbsp;prog.c&nbsp;-lpigpiod_if&nbsp;-lrt<br></code><br><br>to run make sure the pigpio daemon is running
-<br><br><code>sudo&nbsp;pigpiod<br><br>&nbsp;./prog&nbsp;#&nbsp;sudo&nbsp;is&nbsp;not&nbsp;required&nbsp;to&nbsp;run&nbsp;programs&nbsp;linked&nbsp;to&nbsp;pigpiod_if<br></code><br><br>For examples see x_pigpiod_if.c within the pigpio archive file.
-<h3>Notes</h3>All the functions which return an int return &lt; 0 on error
-<h2>OVERVIEW</h2><table border="0" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td></td></tr><tr><td><b>ESSENTIAL
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#pigpio_start">pigpio_start</a></td><td> Connects to the pigpio daemon
-</td></tr><tr><td><a href="#pigpio_stop">pigpio_stop</a></td><td> Disconnects from the pigpio daemon
-</td></tr><tr><td></td><td></td></tr><tr><td><b>BEGINNER
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_mode">set_mode</a></td><td> Set a GPIO mode
-</td></tr><tr><td><a href="#get_mode">get_mode</a></td><td> Get a GPIO mode
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_pull_up_down">set_pull_up_down</a></td><td> Set/clear GPIO pull up/down resistor
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpio_read">gpio_read</a></td><td> Read a GPIO
-</td></tr><tr><td><a href="#gpio_write">gpio_write</a></td><td> Write a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_PWM_dutycycle">set_PWM_dutycycle</a></td><td> Start/stop PWM pulses on a GPIO
-</td></tr><tr><td><a href="#get_PWM_dutycycle">get_PWM_dutycycle</a></td><td> Get the PWM dutycycle in use on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_servo_pulsewidth">set_servo_pulsewidth</a></td><td> Start/stop servo pulses on a GPIO
-</td></tr><tr><td><a href="#get_servo_pulsewidth">get_servo_pulsewidth</a></td><td> Get the servo pulsewidth in use on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#callback">callback</a></td><td> Create GPIO level change callback
-</td></tr><tr><td><a href="#callback_ex">callback_ex</a></td><td> Create GPIO level change callback
-</td></tr><tr><td><a href="#callback_cancel">callback_cancel</a></td><td> Cancel a callback
-</td></tr><tr><td><a href="#wait_for_edge">wait_for_edge</a></td><td> Wait for GPIO level change
-</td></tr><tr><td></td><td></td></tr><tr><td><b>INTERMEDIATE
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpio_trigger">gpio_trigger</a></td><td> Send a trigger pulse to a GPIO.
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_watchdog">set_watchdog</a></td><td> Set a watchdog on a GPIO.
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_PWM_range">set_PWM_range</a></td><td> Configure PWM range for a GPIO
-</td></tr><tr><td><a href="#get_PWM_range">get_PWM_range</a></td><td> Get configured PWM range for a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_PWM_frequency">set_PWM_frequency</a></td><td> Configure PWM frequency for a GPIO
-</td></tr><tr><td><a href="#get_PWM_frequency">get_PWM_frequency</a></td><td> Get configured PWM frequency for a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#read_bank_1">read_bank_1</a></td><td> Read all GPIO in bank 1
-</td></tr><tr><td><a href="#read_bank_2">read_bank_2</a></td><td> Read all GPIO in bank 2
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#clear_bank_1">clear_bank_1</a></td><td> Clear selected GPIO in bank 1
-</td></tr><tr><td><a href="#clear_bank_2">clear_bank_2</a></td><td> Clear selected GPIO in bank 2
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_bank_1">set_bank_1</a></td><td> Set selected GPIO in bank 1
-</td></tr><tr><td><a href="#set_bank_2">set_bank_2</a></td><td> Set selected GPIO in bank 2
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#start_thread">start_thread</a></td><td> Start a new thread
-</td></tr><tr><td><a href="#stop_thread">stop_thread</a></td><td> Stop a previously started thread
-</td></tr><tr><td></td><td></td></tr><tr><td><b>ADVANCED
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_PWM_real_range">get_PWM_real_range</a></td><td> Get underlying PWM range for a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#notify_open">notify_open</a></td><td> Request a notification handle
-</td></tr><tr><td><a href="#notify_begin">notify_begin</a></td><td> Start notifications for selected GPIO
-</td></tr><tr><td><a href="#notify_pause">notify_pause</a></td><td> Pause notifications
-</td></tr><tr><td><a href="#notify_close">notify_close</a></td><td> Close a notification
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_serial_read_open">bb_serial_read_open</a></td><td> Opens a GPIO for bit bang serial reads
-</td></tr><tr><td><a href="#bb_serial_read">bb_serial_read</a></td><td> Reads bit bang serial data from a GPIO
-</td></tr><tr><td><a href="#bb_serial_read_close">bb_serial_read_close</a></td><td> Closes a GPIO for bit bang serial reads
-</td></tr><tr><td><a href="#bb_serial_invert">bb_serial_invert</a></td><td> Invert serial logic (1 invert, 0 normal)
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#hardware_clock">hardware_clock</a></td><td> Start hardware clock on supported GPIO
-</td></tr><tr><td><a href="#hardware_PWM">hardware_PWM</a></td><td> Start hardware PWM on supported GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_glitch_filter">set_glitch_filter</a></td><td> Set a glitch filter on a GPIO
-</td></tr><tr><td><a href="#set_noise_filter">set_noise_filter</a></td><td> Set a noise filter on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SCRIPTS
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#store_script">store_script</a></td><td> Store a script
-</td></tr><tr><td><a href="#run_script">run_script</a></td><td> Run a stored script
-</td></tr><tr><td><a href="#script_status">script_status</a></td><td> Get script status and parameters
-</td></tr><tr><td><a href="#stop_script">stop_script</a></td><td> Stop a running script
-</td></tr><tr><td><a href="#delete_script">delete_script</a></td><td> Delete a stored script
-</td></tr><tr><td></td><td></td></tr><tr><td><b>WAVES
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_clear">wave_clear</a></td><td> Deletes all waveforms
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_add_new">wave_add_new</a></td><td> Starts a new waveform
-</td></tr><tr><td><a href="#wave_add_generic">wave_add_generic</a></td><td> Adds a series of pulses to the waveform
-</td></tr><tr><td><a href="#wave_add_serial">wave_add_serial</a></td><td> Adds serial data to the waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_create">wave_create</a></td><td> Creates a waveform from added data
-</td></tr><tr><td><a href="#wave_delete">wave_delete</a></td><td> Deletes one or more waveforms
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_send_once">wave_send_once</a></td><td> Transmits a waveform once
-</td></tr><tr><td><a href="#wave_send_repeat">wave_send_repeat</a></td><td> Transmits a waveform repeatedly
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_chain">wave_chain</a></td><td> Transmits a chain of waveforms
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_tx_busy">wave_tx_busy</a></td><td> Checks to see if the waveform has ended
-</td></tr><tr><td><a href="#wave_tx_stop">wave_tx_stop</a></td><td> Aborts the current waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_get_micros">wave_get_micros</a></td><td> Length in microseconds of the current waveform
-</td></tr><tr><td><a href="#wave_get_high_micros">wave_get_high_micros</a></td><td> Length of longest waveform so far
-</td></tr><tr><td><a href="#wave_get_max_micros">wave_get_max_micros</a></td><td> Absolute maximum allowed micros
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_get_pulses">wave_get_pulses</a></td><td> Length in pulses of the current waveform
-</td></tr><tr><td><a href="#wave_get_high_pulses">wave_get_high_pulses</a></td><td> Length of longest waveform so far
-</td></tr><tr><td><a href="#wave_get_max_pulses">wave_get_max_pulses</a></td><td> Absolute maximum allowed pulses
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_get_cbs">wave_get_cbs</a></td><td> Length in cbs of the current waveform
-</td></tr><tr><td><a href="#wave_get_high_cbs">wave_get_high_cbs</a></td><td> Length of longest waveform so far
-</td></tr><tr><td><a href="#wave_get_max_cbs">wave_get_max_cbs</a></td><td> Absolute maximum allowed cbs
-</td></tr><tr><td></td><td></td></tr><tr><td><b>I2C
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_open">i2c_open</a></td><td> Opens an I2C device
-</td></tr><tr><td><a href="#i2c_close">i2c_close</a></td><td> Closes an I2C device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_write_quick">i2c_write_quick</a></td><td> smbus write quick
-</td></tr><tr><td><a href="#i2c_write_byte">i2c_write_byte</a></td><td> smbus write byte
-</td></tr><tr><td><a href="#i2c_read_byte">i2c_read_byte</a></td><td> smbus read byte
-</td></tr><tr><td><a href="#i2c_write_byte_data">i2c_write_byte_data</a></td><td> smbus write byte data
-</td></tr><tr><td><a href="#i2c_write_word_data">i2c_write_word_data</a></td><td> smbus write word data
-</td></tr><tr><td><a href="#i2c_read_byte_data">i2c_read_byte_data</a></td><td> smbus read byte data
-</td></tr><tr><td><a href="#i2c_read_word_data">i2c_read_word_data</a></td><td> smbus read word data
-</td></tr><tr><td><a href="#i2c_process_call">i2c_process_call</a></td><td> smbus process call
-</td></tr><tr><td><a href="#i2c_write_block_data">i2c_write_block_data</a></td><td> smbus write block data
-</td></tr><tr><td><a href="#i2c_read_block_data">i2c_read_block_data</a></td><td> smbus read block data
-</td></tr><tr><td><a href="#i2c_block_process_call">i2c_block_process_call</a></td><td> smbus block process call
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_write_i2c_block_data">i2c_write_i2c_block_data</a></td><td> smbus write I2C block data
-</td></tr><tr><td><a href="#i2c_read_i2c_block_data">i2c_read_i2c_block_data</a></td><td> smbus read I2C block data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_device">i2c_read_device</a></td><td> Reads the raw I2C device
-</td></tr><tr><td><a href="#i2c_write_device">i2c_write_device</a></td><td> Writes the raw I2C device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_zip">i2c_zip</a></td><td> Performs multiple I2C transactions
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_i2c_open">bb_i2c_open</a></td><td> Opens GPIO for bit banging I2C
-</td></tr><tr><td><a href="#bb_i2c_close">bb_i2c_close</a></td><td> Closes GPIO for bit banging I2C
-</td></tr><tr><td><a href="#bb_i2c_zip">bb_i2c_zip</a></td><td> Performs multiple bit banged I2C transactions
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SPI
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#spi_open">spi_open</a></td><td> Opens a SPI device
-</td></tr><tr><td><a href="#spi_close">spi_close</a></td><td> Closes a SPI device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#spi_read">spi_read</a></td><td> Reads bytes from a SPI device
-</td></tr><tr><td><a href="#spi_write">spi_write</a></td><td> Writes bytes to a SPI device
-</td></tr><tr><td><a href="#spi_xfer">spi_xfer</a></td><td> Transfers bytes with a SPI device
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SERIAL
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#serial_open">serial_open</a></td><td> Opens a serial device
-</td></tr><tr><td><a href="#serial_close">serial_close</a></td><td> Closes a serial device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#serial_write_byte">serial_write_byte</a></td><td> Writes a byte to a serial device
-</td></tr><tr><td><a href="#serial_read_byte">serial_read_byte</a></td><td> Reads a byte from a serial device
-</td></tr><tr><td><a href="#serial_write">serial_write</a></td><td> Writes bytes to a serial device
-</td></tr><tr><td><a href="#serial_read">serial_read</a></td><td> Reads bytes from a serial device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#serial_data_available">serial_data_available</a></td><td> Returns number of bytes ready to be read
-</td></tr><tr><td></td><td></td></tr><tr><td><b>CUSTOM
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#custom_1">custom_1</a></td><td> User custom function 1
-</td></tr><tr><td><a href="#custom_2">custom_2</a></td><td> User custom function 2
-</td></tr><tr><td></td><td></td></tr><tr><td><b>UTILITIES
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_current_tick">get_current_tick</a></td><td> Get current tick (microseconds)
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_hardware_revision">get_hardware_revision</a></td><td> Get hardware revision
-</td></tr><tr><td><a href="#get_pigpio_version">get_pigpio_version</a></td><td> Get the pigpio version
-</td></tr><tr><td><a href="#pigpiod_if_version">pigpiod_if_version</a></td><td> Get the pigpiod_if version
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#pigpio_error">pigpio_error</a></td><td> Get a text description of an error code.
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#time_sleep">time_sleep</a></td><td> Sleeps for a float number of seconds
-</td></tr><tr><td><a href="#time_time">time_time</a></td><td> Float number of seconds since the epoch
-</td></tr><tr><td></td><td></td></tr></tbody></table><h2>FUNCTIONS</h2><h3><a name="time_time"></a><a href="#double"><small>double</small></a> time_time<small>(void)</small></h3>
-Return the current time in seconds since the Epoch.
-<h3><a name="time_sleep"></a><a href="#void"><small>void</small></a> time_sleep<small>(<a href="#double">double</a> <a href="#seconds">seconds</a>)</small></h3>
-Delay execution for a given number of seconds.
-<br><br><code>seconds:&nbsp;the&nbsp;number&nbsp;of&nbsp;seconds&nbsp;to&nbsp;delay.<br></code><h3><a name="pigpio_error"></a><a href="#char"><small>char</small></a> *pigpio_error<small>(<a href="#int">int</a> <a href="#errnum">errnum</a>)</small></h3>
-Return a text description for an error code.
-<br><br><code>errnum:&nbsp;the&nbsp;error&nbsp;code.<br></code><h3><a name="pigpiod_if_version"></a><a href="#unsigned"><small>unsigned</small></a> pigpiod_if_version<small>(void)</small></h3>
-Return the pigpiod_if version.
-<h3><a name="start_thread"></a><a href="#pthread_t"><small>pthread_t</small></a> *start_thread<small>(<a href="#gpioThreadFunc_t">gpioThreadFunc_t</a> <a href="#thread_func">thread_func</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-Starts a new thread of execution with thread_func as the main routine.
-<br><br><code>thread_func:&nbsp;the&nbsp;main&nbsp;function&nbsp;for&nbsp;the&nbsp;new&nbsp;thread.<br>&nbsp;&nbsp;&nbsp;userdata:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;an&nbsp;arbitrary&nbsp;argument.<br></code><br><br>Returns a pointer to pthread_t if OK, otherwise NULL.
-<br><br>The function is passed the single argument userdata.
-<br><br>The thread can be cancelled by passing the pointer to pthread_t to
-<a href="#stop_thread">stop_thread</a>.
-<h3><a name="stop_thread"></a><a href="#void"><small>void</small></a> stop_thread<small>(<a href="#pthread_t">pthread_t</a> <a href="#*pth">*pth</a>)</small></h3>
-Cancels the thread pointed at by pth.
-<br><br><code>pth:&nbsp;the&nbsp;thread&nbsp;to&nbsp;be&nbsp;stopped.<br></code><br><br>No value is returned.
-<br><br>The thread to be stopped should have been started with <a href="#start_thread">start_thread</a>.
-<h3><a name="pigpio_start"></a><a href="#int"><small>int</small></a> pigpio_start<small>(<a href="#char">char</a> <a href="#*addrStr">*addrStr</a>, <a href="#char">char</a> <a href="#*portStr">*portStr</a>)</small></h3>
-Connect to the pigpio daemon. Reserving command and
-notification streams.
-<br><br><code>addrStr:&nbsp;specifies&nbsp;the&nbsp;host&nbsp;or&nbsp;IP&nbsp;address&nbsp;of&nbsp;the&nbsp;Pi&nbsp;running&nbsp;the<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pigpio&nbsp;daemon.&nbsp;&nbsp;It&nbsp;may&nbsp;be&nbsp;NULL&nbsp;in&nbsp;which&nbsp;case&nbsp;localhost<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is&nbsp;used&nbsp;unless&nbsp;overridden&nbsp;by&nbsp;the&nbsp;PIGPIO_ADDR&nbsp;environment<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;variable.<br><br>portStr:&nbsp;specifies&nbsp;the&nbsp;port&nbsp;address&nbsp;used&nbsp;by&nbsp;the&nbsp;Pi&nbsp;running&nbsp;the<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pigpio&nbsp;daemon.&nbsp;&nbsp;It&nbsp;may&nbsp;be&nbsp;NULL&nbsp;in&nbsp;which&nbsp;case&nbsp;"8888"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is&nbsp;used&nbsp;unless&nbsp;overridden&nbsp;by&nbsp;the&nbsp;PIGPIO_PORT&nbsp;environment<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;variable.<br></code><h3><a name="pigpio_stop"></a><a href="#void"><small>void</small></a> pigpio_stop<small>(void)</small></h3>
-Terminates the connection to the pigpio daemon and releases
-resources used by the library.
-<h3><a name="set_mode"></a><a href="#int"><small>int</small></a> set_mode<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#mode">mode</a>)</small></h3>
-Set the GPIO mode.
-<br><br><code>gpio:&nbsp;0-53.<br>mode:&nbsp;PI_INPUT,&nbsp;PI_OUTPUT,&nbsp;PI_ALT0,&nbsp;PI_ALT1,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PI_ALT2,&nbsp;PI_ALT3,&nbsp;PI_ALT4,&nbsp;PI_ALT5.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_MODE,
-or PI_NOT_PERMITTED.
-<h3><a name="get_mode"></a><a href="#int"><small>int</small></a> get_mode<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>)</small></h3>
-Get the GPIO mode.
-<br><br><code>gpio:&nbsp;0-53.<br></code><br><br>Returns the GPIO mode if OK, otherwise PI_BAD_GPIO.
-<h3><a name="set_pull_up_down"></a><a href="#int"><small>int</small></a> set_pull_up_down<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#pud">pud</a>)</small></h3>
-Set or clear the GPIO pull-up/down resistor.
-<br><br><code>gpio:&nbsp;0-53.<br>&nbsp;pud:&nbsp;PI_PUD_UP,&nbsp;PI_PUD_DOWN,&nbsp;PI_PUD_OFF.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_PUD,
-or PI_NOT_PERMITTED.
-<h3><a name="gpio_read"></a><a href="#int"><small>int</small></a> gpio_read<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>)</small></h3>
-Read the GPIO level.
-<br><br><code>gpio:0-53.<br></code><br><br>Returns the GPIO level if OK, otherwise PI_BAD_GPIO.
-<h3><a name="gpio_write"></a><a href="#int"><small>int</small></a> gpio_write<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#level">level</a>)</small></h3>
-Write the GPIO level.
-<br><br><code>&nbsp;gpio:&nbsp;0-53.<br>level:&nbsp;0,&nbsp;1.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_LEVEL,
-or PI_NOT_PERMITTED.
-<br><br>Notes
-<br><br>If PWM or servo pulses are active on the GPIO they are switched off.
-<h3><a name="set_PWM_dutycycle"></a><a href="#int"><small>int</small></a> set_PWM_dutycycle<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#dutycycle">dutycycle</a>)</small></h3>
-Start (non-zero dutycycle) or stop (0) PWM pulses on the GPIO.
-<br><br><code>user_gpio:&nbsp;0-31.<br>dutycycle:&nbsp;0-range&nbsp;(range&nbsp;defaults&nbsp;to&nbsp;255).<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_DUTYCYCLE,
-or PI_NOT_PERMITTED.
-Notes
-<br><br>The <a href="#set_PWM_range">set_PWM_range</a> function may be used to change the
-default range of 255.
-<h3><a name="get_PWM_dutycycle"></a><a href="#int"><small>int</small></a> get_PWM_dutycycle<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Return the PWM dutycycle in use on a GPIO.
-<br><br><code>user_gpio:&nbsp;0-31.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_NOT_PWM_GPIO.
-<br><br>For normal PWM the dutycycle will be out of the defined range
-for the GPIO (see <a href="#get_PWM_range">get_PWM_range</a>).
-<br><br>If a hardware clock is active on the GPIO the reported dutycycle
-will be 500000 (500k) out of 1000000 (1M).
-<br><br>If hardware PWM is active on the GPIO the reported dutycycle
-will be out of a 1000000 (1M).
-<h3><a name="set_PWM_range"></a><a href="#int"><small>int</small></a> set_PWM_range<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#range">range</a>)</small></h3>
-Set the range of PWM values to be used on the GPIO.
-<br><br><code>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;range:&nbsp;25-40000.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_DUTYRANGE,
-or PI_NOT_PERMITTED.
-<br><br>Notes
-<br><br>If PWM is currently active on the GPIO its dutycycle will be
-scaled to reflect the new range.
-<br><br>The real range, the number of steps between fully off and fully on
-for each of the 18 available GPIO frequencies is
-<br><br><code>&nbsp;&nbsp;25(#1),&nbsp;&nbsp;&nbsp;&nbsp;50(#2),&nbsp;&nbsp;&nbsp;100(#3),&nbsp;&nbsp;&nbsp;125(#4),&nbsp;&nbsp;&nbsp;&nbsp;200(#5),&nbsp;&nbsp;&nbsp;&nbsp;250(#6),<br>&nbsp;400(#7),&nbsp;&nbsp;&nbsp;500(#8),&nbsp;&nbsp;&nbsp;625(#9),&nbsp;&nbsp;&nbsp;800(#10),&nbsp;&nbsp;1000(#11),&nbsp;&nbsp;1250(#12),<br>2000(#13),&nbsp;2500(#14),&nbsp;4000(#15),&nbsp;5000(#16),&nbsp;10000(#17),&nbsp;20000(#18)<br></code><br><br>The real value set by set_PWM_range is (dutycycle * real range) / range.
-<h3><a name="get_PWM_range"></a><a href="#int"><small>int</small></a> get_PWM_range<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Get the range of PWM values being used on the GPIO.
-<br><br><code>user_gpio:&nbsp;0-31.<br></code><br><br>Returns the dutycycle range used for the GPIO if OK,
-otherwise PI_BAD_USER_GPIO.
-<br><br>If a hardware clock or hardware PWM is active on the GPIO the
-reported range will be 1000000 (1M).
-<h3><a name="get_PWM_real_range"></a><a href="#int"><small>int</small></a> get_PWM_real_range<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Get the real underlying range of PWM values being used on the GPIO.
-<br><br><code>user_gpio:&nbsp;0-31.<br></code><br><br>Returns the real range used for the GPIO if OK,
-otherwise PI_BAD_USER_GPIO.
-<br><br>If a hardware clock is active on the GPIO the reported
-real range will be 1000000 (1M).
-<br><br>If hardware PWM is active on the GPIO the reported real range
-will be approximately 250M divided by the set PWM frequency.
-<h3><a name="set_PWM_frequency"></a><a href="#int"><small>int</small></a> set_PWM_frequency<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#frequency">frequency</a>)</small></h3>
-Set the frequency (in Hz) of the PWM to be used on the GPIO.
-<br><br><code>user_gpio:&nbsp;0-31.<br>frequency:&nbsp;&gt;=0&nbsp;(Hz).<br></code><br><br>Returns the numerically closest frequency if OK, otherwise
-PI_BAD_USER_GPIO or PI_NOT_PERMITTED.
-<br><br>If PWM is currently active on the GPIO it will be switched
-off and then back on at the new frequency.
-<br><br>Each GPIO can be independently set to one of 18 different
-PWM frequencies.
-<br><br>The selectable frequencies depend upon the sample rate which
-may be 1, 2, 4, 5, 8, or 10 microseconds (default 5). The
-sample rate is set when the pigpio daemon is started.
-<br><br>The frequencies for each sample rate are:
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hertz<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1:&nbsp;40000&nbsp;20000&nbsp;10000&nbsp;8000&nbsp;5000&nbsp;4000&nbsp;2500&nbsp;2000&nbsp;1600<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1250&nbsp;&nbsp;1000&nbsp;&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;50<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2:&nbsp;20000&nbsp;10000&nbsp;&nbsp;5000&nbsp;4000&nbsp;2500&nbsp;2000&nbsp;1250&nbsp;1000&nbsp;&nbsp;800<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;625&nbsp;&nbsp;&nbsp;500&nbsp;&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;125&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;25<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4:&nbsp;10000&nbsp;&nbsp;5000&nbsp;&nbsp;2500&nbsp;2000&nbsp;1250&nbsp;1000&nbsp;&nbsp;625&nbsp;&nbsp;500&nbsp;&nbsp;400<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;313&nbsp;&nbsp;&nbsp;250&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;125&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;63&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;13<br>sample<br>&nbsp;rate<br>&nbsp;(us)&nbsp;&nbsp;5:&nbsp;&nbsp;8000&nbsp;&nbsp;4000&nbsp;&nbsp;2000&nbsp;1600&nbsp;1000&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;320<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;250&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;&nbsp;160&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;80&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;&nbsp;20&nbsp;&nbsp;&nbsp;10<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8:&nbsp;&nbsp;5000&nbsp;&nbsp;2500&nbsp;&nbsp;1250&nbsp;1000&nbsp;&nbsp;625&nbsp;&nbsp;500&nbsp;&nbsp;313&nbsp;&nbsp;250&nbsp;&nbsp;200<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;156&nbsp;&nbsp;&nbsp;125&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;63&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;31&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;13&nbsp;&nbsp;&nbsp;&nbsp;6<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10:&nbsp;&nbsp;4000&nbsp;&nbsp;2000&nbsp;&nbsp;1000&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;160<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;125&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;&nbsp;80&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;20&nbsp;&nbsp;&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;5<br></code><h3><a name="get_PWM_frequency"></a><a href="#int"><small>int</small></a> get_PWM_frequency<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Get the frequency of PWM being used on the GPIO.
-<br><br><code>user_gpio:&nbsp;0-31.<br></code><br><br>For normal PWM the frequency will be that defined for the GPIO by
-<a href="#set_PWM_frequency">set_PWM_frequency</a>.
-<br><br>If a hardware clock is active on the GPIO the reported frequency
-will be that set by <a href="#hardware_clock">hardware_clock</a>.
-<br><br>If hardware PWM is active on the GPIO the reported frequency
-will be that set by <a href="#hardware_PWM">hardware_PWM</a>.
-<br><br>Returns the frequency (in hertz) used for the GPIO if OK,
-otherwise PI_BAD_USER_GPIO.
-<h3><a name="set_servo_pulsewidth"></a><a href="#int"><small>int</small></a> set_servo_pulsewidth<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#pulsewidth">pulsewidth</a>)</small></h3>
-Start (500-2500) or stop (0) servo pulses on the GPIO.
-<br><br><code>&nbsp;user_gpio:&nbsp;0-31.<br>pulsewidth:&nbsp;0&nbsp;(off),&nbsp;500&nbsp;(anti-clockwise)&nbsp;-&nbsp;2500&nbsp;(clockwise).<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_PULSEWIDTH or
-PI_NOT_PERMITTED.
-<br><br>The selected pulsewidth will continue to be transmitted until
-changed by a subsequent call to set_servo_pulsewidth.
-<br><br>The pulsewidths supported by servos varies and should probably be
-determined by experiment. A value of 1500 should always be safe and
-represents the mid-point of rotation.
-<br><br>You can DAMAGE a servo if you command it to move beyond its limits.
-<br><br>OTHER UPDATE RATES:
-<br><br>This function updates servos at 50Hz. If you wish to use a different
-update frequency you will have to use the PWM functions.
-<br><br><code>Update&nbsp;Rate&nbsp;(Hz)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;200&nbsp;&nbsp;400&nbsp;&nbsp;500<br>1E6/Hz&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;20000&nbsp;10000&nbsp;5000&nbsp;2500&nbsp;2000<br></code><br><br>Firstly set the desired PWM frequency using <a href="#set_PWM_frequency">set_PWM_frequency</a>.
-<br><br>Then set the PWM range using <a href="#set_PWM_range">set_PWM_range</a> to 1E6/Hz.
-Doing this allows you to use units of microseconds when setting
-the servo pulsewidth.
-<br><br>E.g. If you want to update a servo connected to GPIO 25 at 400Hz
-<br><br><code>set_PWM_frequency(25,&nbsp;400);<br>set_PWM_range(25,&nbsp;2500);<br></code><br><br>Thereafter use the <a href="#set_PWM_dutycycle">set_PWM_dutycycle</a> function to move the servo,
-e.g. set_PWM_dutycycle(25, 1500) will set a 1500 us pulse.<br>
-<h3><a name="get_servo_pulsewidth"></a><a href="#int"><small>int</small></a> get_servo_pulsewidth<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Return the servo pulsewidth in use on a GPIO.
-<br><br><code>user_gpio:&nbsp;0-31.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_NOT_SERVO_GPIO.
-<h3><a name="notify_open"></a><a href="#int"><small>int</small></a> notify_open<small>(void)</small></h3>
-Get a free notification handle.
-<br><br>Returns a handle greater than or equal to zero if OK,
-otherwise PI_NO_HANDLE.
-<br><br>A notification is a method for being notified of GPIO state
-changes via a pipe.
-<br><br>Pipes are only accessible from the local machine so this function
-serves no purpose if you are using the library from a remote machine.
-The in-built (socket) notifications provided by <a href="#callback">callback</a>
-should be used instead.
-<br><br>Notifications for handle x will be available at the pipe
-named /dev/pigpiox (where x is the handle number).
-E.g. if the function returns 15 then the notifications must be
-read from /dev/pigpio15.
-<h3><a name="notify_begin"></a><a href="#int"><small>int</small></a> notify_begin<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Start notifications on a previously opened handle.
-<br><br><code>handle:&nbsp;0-31&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#notify_open">notify_open</a>)<br>&nbsp;&nbsp;bits:&nbsp;a&nbsp;mask&nbsp;indicating&nbsp;the&nbsp;GPIO&nbsp;to&nbsp;be&nbsp;notified.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<br><br>The notification sends state changes for each GPIO whose
-corresponding bit in bits is set.
-<br><br>Each notification occupies 12 bytes in the fifo as follows:
-<br><br><code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;seqno;<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;flags;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;tick;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;level;<br>}&nbsp;gpioReport_t;<br></code><br><br>seqno: starts at 0 each time the handle is opened and then increments
-by one for each report.
-<br><br>flags: two flags are defined, PI_NTFY_FLAGS_WDOG and PI_NTFY_FLAGS_ALIVE.
-<br><br>PI_NTFY_FLAGS_WDOG, if bit 5 is set then bits 0-4 of the flags
-indicate a GPIO which has had a watchdog timeout.
-<br><br>PI_NTFY_FLAGS_ALIVE, if bit 6 is set this indicates a keep alive
-signal on the pipe/socket and is sent once a minute in the absence
-of other notification activity.
-<br><br>tick: the number of microseconds since system boot. It wraps around
-after 1h12m.
-<br><br>level: indicates the level of each GPIO. If bit 1&lt;&lt;x is set then
-GPIO x is high.
-<h3><a name="notify_pause"></a><a href="#int"><small>int</small></a> notify_pause<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-Pause notifications on a previously opened handle.
-<br><br><code>handle:&nbsp;0-31&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#notify_open">notify_open</a>)<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<br><br>Notifications for the handle are suspended until
-<a href="#notify_begin">notify_begin</a> is called again.
-<h3><a name="notify_close"></a><a href="#int"><small>int</small></a> notify_close<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-Stop notifications on a previously opened handle and
-release the handle for reuse.
-<br><br><code>handle:&nbsp;0-31&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#notify_open">notify_open</a>)<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<h3><a name="set_watchdog"></a><a href="#int"><small>int</small></a> set_watchdog<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#timeout">timeout</a>)</small></h3>
-Sets a watchdog for a GPIO.
-<br><br><code>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;timeout:&nbsp;0-60000.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO
-or PI_BAD_WDOG_TIMEOUT.
-<br><br>The watchdog is nominally in milliseconds.
-<br><br>Only one watchdog may be registered per GPIO.
-<br><br>The watchdog may be cancelled by setting timeout to 0.
-<br><br>Once a watchdog has been started callbacks for the GPIO will be
-triggered every timeout interval after the last GPIO activity.
-<br><br>The callback will receive the special level PI_TIMEOUT.
-<h3><a name="set_glitch_filter"></a><a href="#int"><small>int</small></a> set_glitch_filter<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#steady">steady</a>)</small></h3>
-Sets a glitch filter on a GPIO.
-<br><br>Level changes on the GPIO are not reported unless the level
-has been stable for at least <a href="#steady">steady</a> microseconds. The
-level is then reported. Level changes of less than <a href="#steady">steady</a>
-microseconds are ignored.
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;steady:&nbsp;0-300000<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
-<br><br>This filter affects the GPIO samples returned to callbacks set up
-with <a href="#callback">callback</a>, <a href="#callback_ex">callback_ex</a> and <a href="#wait_for_edge">wait_for_edge</a>.
-<br><br>It does not affect levels read by <a href="#gpio_read">gpio_read</a>,
-<a href="#read_bank_1">read_bank_1</a>, or <a href="#read_bank_2">read_bank_2</a>.
-Each (stable) edge will be timestamped <a href="#steady">steady</a> microseconds
-after it was first detected.
-<h3><a name="set_noise_filter"></a><a href="#int"><small>int</small></a> set_noise_filter<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#steady">steady</a>, <a href="#unsigned">unsigned</a> <a href="#active">active</a>)</small></h3>
-Sets a noise filter on a GPIO.
-<br><br>Level changes on the GPIO are ignored until a level which has
-been stable for <a href="#steady">steady</a> microseconds is detected. Level changes
-on the GPIO are then reported for <a href="#active">active</a> microseconds after
-which the process repeats.
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;steady:&nbsp;0-300000<br>&nbsp;&nbsp;&nbsp;active:&nbsp;0-1000000<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
-<br><br>This filter affects the GPIO samples returned to callbacks set up
-with <a href="#callback">callback</a>, <a href="#callback_ex">callback_ex</a> and <a href="#wait_for_edge">wait_for_edge</a>.
-<br><br>It does not affect levels read by <a href="#gpio_read">gpio_read</a>,
-<a href="#read_bank_1">read_bank_1</a>, or <a href="#read_bank_2">read_bank_2</a>.
-<br><br>Level changes before and after the active period may
-be reported. Your software must be designed to cope with
-such reports.
-<h3><a name="read_bank_1"></a><a href="#uint32_t"><small>uint32_t</small></a> read_bank_1<small>(void)</small></h3>
-Read the levels of the bank 1 GPIO (GPIO 0-31).
-<br><br>The returned 32 bit integer has a bit set if the corresponding
-GPIO is logic 1. GPIO n has bit value (1&lt;&lt;n).
-<h3><a name="read_bank_2"></a><a href="#uint32_t"><small>uint32_t</small></a> read_bank_2<small>(void)</small></h3>
-Read the levels of the bank 2 GPIO (GPIO 32-53).
-<br><br>The returned 32 bit integer has a bit set if the corresponding
-GPIO is logic 1. GPIO n has bit value (1&lt;&lt;(n-32)).
-<h3><a name="clear_bank_1"></a><a href="#int"><small>int</small></a> clear_bank_1<small>(<a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Clears GPIO 0-31 if the corresponding bit in bits is set.
-<br><br><code>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;cleared.<br></code><br><br>Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-<br><br>A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-<h3><a name="clear_bank_2"></a><a href="#int"><small>int</small></a> clear_bank_2<small>(<a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Clears GPIO 32-53 if the corresponding bit (0-21) in bits is set.
-<br><br><code>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;cleared.<br></code><br><br>Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-<br><br>A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-<h3><a name="set_bank_1"></a><a href="#int"><small>int</small></a> set_bank_1<small>(<a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Sets GPIO 0-31 if the corresponding bit in bits is set.
-<br><br><code>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;set.<br></code><br><br>Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-<br><br>A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-<h3><a name="set_bank_2"></a><a href="#int"><small>int</small></a> set_bank_2<small>(<a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Sets GPIO 32-53 if the corresponding bit (0-21) in bits is set.
-<br><br><code>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;set.<br></code><br><br>Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-<br><br>A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-<h3><a name="hardware_clock"></a><a href="#int"><small>int</small></a> hardware_clock<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#clkfreq">clkfreq</a>)</small></h3>
-Starts a hardware clock on a GPIO at the specified frequency.
-Frequencies above 30MHz are unlikely to work.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gpio:&nbsp;see&nbsp;description<br>frequency:&nbsp;0&nbsp;(off)&nbsp;or&nbsp;4689-250000000&nbsp;(250M)<br></code><br><br>Returns 0 if OK, otherwise PI_NOT_PERMITTED, PI_BAD_GPIO,
-PI_NOT_HCLK_GPIO, PI_BAD_HCLK_FREQ,or PI_BAD_HCLK_PASS.
-<br><br>The same clock is available on multiple GPIO. The latest
-frequency setting will be used by all GPIO which share a clock.
-<br><br>The GPIO must be one of the following.
-<br><br><code>4&nbsp;&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;All&nbsp;models<br>5&nbsp;&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br>6&nbsp;&nbsp;&nbsp;clock&nbsp;2&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>20&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>21&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;Rev.2&nbsp;B&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br><br>32&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>34&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>42&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br>43&nbsp;&nbsp;clock&nbsp;2&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>44&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br></code><br><br>Access to clock 1 is protected by a password as its use will likely
-crash the Pi. The password is given by or'ing 0x5A000000 with the
-GPIO number.
-<h3><a name="hardware_PWM"></a><a href="#int"><small>int</small></a> hardware_PWM<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#PWMfreq">PWMfreq</a>, <a href="#uint32_t">uint32_t</a> <a href="#PWMduty">PWMduty</a>)</small></h3>
-Starts hardware PWM on a GPIO at the specified frequency and dutycycle.
-Frequencies above 30MHz are unlikely to work.
-<br><br>NOTE: Any waveform started by <a href="#wave_send_once">wave_send_once</a>, <a href="#wave_send_repeat">wave_send_repeat</a>,
-or <a href="#wave_chain">wave_chain</a> will be cancelled.
-<br><br>This function is only valid if the pigpio main clock is PCM. The
-main clock defaults to PCM but may be overridden when the pigpio
-daemon is started (option -t).
-<br><br><code>&nbsp;&nbsp;&nbsp;gpio:&nbsp;see&nbsp;descripton<br>PWMfreq:&nbsp;0&nbsp;(off)&nbsp;or&nbsp;1-125000000&nbsp;(125M)<br>PWMduty:&nbsp;0&nbsp;(off)&nbsp;to&nbsp;1000000&nbsp;(1M)(fully&nbsp;on)<br></code><br><br>Returns 0 if OK, otherwise PI_NOT_PERMITTED, PI_BAD_GPIO,
-PI_NOT_HPWM_GPIO, PI_BAD_HPWM_DUTY, PI_BAD_HPWM_FREQ,
-or PI_HPWM_ILLEGAL.
-<br><br>The same PWM channel is available on multiple GPIO. The latest
-frequency and dutycycle setting will be used by all GPIO which
-share a PWM channel.
-<br><br>The GPIO must be one of the following.
-<br><br><code>12&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>13&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>18&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;All&nbsp;models<br>19&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br><br>40&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>41&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>45&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>52&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>53&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br></code><h3><a name="get_current_tick"></a><a href="#uint32_t"><small>uint32_t</small></a> get_current_tick<small>(void)</small></h3>
-Gets the current system tick.
-<br><br>Tick is the number of microseconds since system boot.
-<br><br>As tick is an unsigned 32 bit quantity it wraps around after
-2**32 microseconds, which is approximately 1 hour 12 minutes.
-<h3><a name="get_hardware_revision"></a><a href="#uint32_t"><small>uint32_t</small></a> get_hardware_revision<small>(void)</small></h3>
-Get the Pi's hardware revision number.
-<br><br>The hardware revision is the last few characters on the Revision line
-of /proc/cpuinfo.
-<br><br>If the hardware revision can not be found or is not a valid
-hexadecimal number the function returns 0.
-<br><br>The revision number can be used to determine the assignment of GPIO
-to pins (see <a href="#gpio">gpio</a>).
-<br><br>There are at least three types of board.
-<br><br>Type 1 boards have hardware revision numbers of 2 and 3.
-<br><br>Type 2 boards have hardware revision numbers of 4, 5, 6, and 15.
-<br><br>Type 3 boards have hardware revision numbers of 16 or greater.
-<h3><a name="get_pigpio_version"></a><a href="#uint32_t"><small>uint32_t</small></a> get_pigpio_version<small>(void)</small></h3>
-Returns the pigpio version.
-<h3><a name="wave_clear"></a><a href="#int"><small>int</small></a> wave_clear<small>(void)</small></h3>
-This function clears all waveforms and any data added by calls to the
-<a href="#wave_add_*">wave_add_*</a> functions.
-<br><br>Returns 0 if OK.
-<h3><a name="wave_add_new"></a><a href="#int"><small>int</small></a> wave_add_new<small>(void)</small></h3>
-This function starts a new empty waveform. You wouldn't normally need
-to call this function as it is automatically called after a waveform is
-created with the <a href="#wave_create">wave_create</a> function.
-<br><br>Returns 0 if OK.
-<h3><a name="wave_add_generic"></a><a href="#int"><small>int</small></a> wave_add_generic<small>(<a href="#unsigned">unsigned</a> <a href="#numPulses">numPulses</a>, <a href="#gpioPulse_t">gpioPulse_t</a> <a href="#*pulses">*pulses</a>)</small></h3>
-This function adds a number of pulses to the current waveform.
-<br><br><code>numPulses:&nbsp;the&nbsp;number&nbsp;of&nbsp;pulses.<br>&nbsp;&nbsp;&nbsp;pulses:&nbsp;an&nbsp;array&nbsp;of&nbsp;pulses.<br></code><br><br>Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_TOO_MANY_PULSES.
-<br><br>The pulses are interleaved in time order within the existing waveform
-(if any).
-<br><br>Merging allows the waveform to be built in parts, that is the settings
-for GPIO#1 can be added, and then GPIO#2 etc.
-<br><br>If the added waveform is intended to start after or within the existing
-waveform then the first pulse should consist solely of a delay.
-<h3><a name="wave_add_serial"></a><a href="#int"><small>int</small></a> wave_add_serial<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#data_bits">data_bits</a>, <a href="#unsigned">unsigned</a> <a href="#stop_bits">stop_bits</a>, <a href="#unsigned">unsigned</a> <a href="#offset">offset</a>, <a href="#unsigned">unsigned</a> <a href="#numBytes">numBytes</a>, <a href="#char">char</a> <a href="#*str">*str</a>)</small></h3>
-This function adds a waveform representing serial data to the
-existing waveform (if any). The serial data starts offset
-microseconds from the start of the waveform.
-<br><br><code>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;50-1000000<br>data_bits:&nbsp;number&nbsp;of&nbsp;data&nbsp;bits&nbsp;(1-32)<br>stop_bits:&nbsp;number&nbsp;of&nbsp;stop&nbsp;half&nbsp;bits&nbsp;(2-8)<br>&nbsp;&nbsp;&nbsp;offset:&nbsp;&gt;=0<br>&nbsp;numBytes:&nbsp;&gt;=1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str:&nbsp;an&nbsp;array&nbsp;of&nbsp;chars.<br></code><br><br>Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_BAD_USER_GPIO, PI_BAD_WAVE_BAUD, PI_BAD_DATABITS,
-PI_BAD_STOP_BITS, PI_TOO_MANY_CHARS, PI_BAD_SER_OFFSET,
-or PI_TOO_MANY_PULSES.
-<br><br>NOTES:
-<br><br>The serial data is formatted as one start bit, <a href="#data_bits">data_bits</a> data bits,
-and <a href="#stop_bits">stop_bits</a>/2 stop bits.
-<br><br>It is legal to add serial data streams with different baud rates to
-the same waveform.
-<br><br><a href="#numBytes">numBytes</a> is the number of bytes of data in str.
-<br><br>The bytes required for each character depend upon <a href="#data_bits">data_bits</a>.
-<br><br>For <a href="#data_bits">data_bits</a> 1-8 there will be one byte per character.<br>
-For <a href="#data_bits">data_bits</a> 9-16 there will be two bytes per character.<br>
-For <a href="#data_bits">data_bits</a> 17-32 there will be four bytes per character.
-<h3><a name="wave_create"></a><a href="#int"><small>int</small></a> wave_create<small>(void)</small></h3>
-This function creates a waveform from the data provided by the prior
-calls to the <a href="#wave_add_*">wave_add_*</a> functions. Upon success a wave id
-greater than or equal to 0 is returned, otherwise PI_EMPTY_WAVEFORM,
-PI_TOO_MANY_CBS, PI_TOO_MANY_OOL, or PI_NO_WAVEFORM_ID.
-<br><br>The data provided by the <a href="#wave_add_*">wave_add_*</a> functions is consumed by this
-function.
-<br><br>As many waveforms may be created as there is space available. The
-wave id is passed to <a href="#wave_send_*">wave_send_*</a> to specify the waveform to transmit.
-<br><br>Normal usage would be
-<br><br>Step 1. <a href="#wave_clear">wave_clear</a> to clear all waveforms and added data.
-<br><br>Step 2. <a href="#wave_add_*">wave_add_*</a> calls to supply the waveform data.
-<br><br>Step 3. <a href="#wave_create">wave_create</a> to create the waveform and get a unique id
-<br><br>Repeat steps 2 and 3 as needed.
-<br><br>Step 4. <a href="#wave_send_*">wave_send_*</a> with the id of the waveform to transmit.
-<br><br>A waveform comprises one or more pulses. Each pulse consists of a
-<a href="#gpioPulse_t">gpioPulse_t</a> structure.
-<br><br><code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOn;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOff;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;usDelay;<br>}&nbsp;gpioPulse_t;<br></code><br><br>The fields specify
-<br><br>1) the GPIO to be switched on at the start of the pulse.<br>
-2) the GPIO to be switched off at the start of the pulse.<br>
-3) the delay in microseconds before the next pulse.<br>
-<br><br>Any or all the fields can be zero. It doesn't make any sense to
-set all the fields to zero (the pulse will be ignored).
-<br><br>When a waveform is started each pulse is executed in order with the
-specified delay between the pulse and the next.
-<br><br>Returns the new waveform id if OK, otherwise PI_EMPTY_WAVEFORM,
-PI_NO_WAVEFORM_ID, PI_TOO_MANY_CBS, or PI_TOO_MANY_OOL.
-<h3><a name="wave_delete"></a><a href="#int"><small>int</small></a> wave_delete<small>(<a href="#unsigned">unsigned</a> <a href="#wave_id">wave_id</a>)</small></h3>
-This function deletes the waveform with id wave_id.
-<br><br><code>wave_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#wave_create">wave_create</a>.<br></code><br><br>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.
-<h3><a name="wave_send_once"></a><a href="#int"><small>int</small></a> wave_send_once<small>(<a href="#unsigned">unsigned</a> <a href="#wave_id">wave_id</a>)</small></h3>
-This function transmits the waveform with id wave_id. The waveform
-is sent once.
-<br><br>NOTE: Any hardware PWM started by <a href="#hardware_PWM">hardware_PWM</a> will be cancelled.
-<br><br><code>wave_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#wave_create">wave_create</a>.<br></code><br><br>Returns the number of DMA control blocks in the waveform if OK,
-otherwise PI_BAD_WAVE_ID, or PI_BAD_WAVE_MODE.
-<h3><a name="wave_send_repeat"></a><a href="#int"><small>int</small></a> wave_send_repeat<small>(<a href="#unsigned">unsigned</a> <a href="#wave_id">wave_id</a>)</small></h3>
-This function transmits the waveform with id wave_id. The waveform
-cycles until cancelled (either by the sending of a new waveform or
-by <a href="#wave_tx_stop">wave_tx_stop</a>).
-<br><br>NOTE: Any hardware PWM started by <a href="#hardware_PWM">hardware_PWM</a> will be cancelled.
-<br><br><code>wave_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#wave_create">wave_create</a>.<br></code><br><br>Returns the number of DMA control blocks in the waveform if OK,
-otherwise PI_BAD_WAVE_ID, or PI_BAD_WAVE_MODE.
-<h3><a name="wave_chain"></a><a href="#int"><small>int</small></a> wave_chain<small>(<a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#bufSize">bufSize</a>)</small></h3>
-This function transmits a chain of waveforms.
-<br><br>NOTE: Any hardware PWM started by <a href="#hardware_PWM">hardware_PWM</a> will be cancelled.
-<br><br>The waves to be transmitted are specified by the contents of buf
-which contains an ordered list of <a href="#wave_id">wave_id</a>s and optional command
-codes and related data.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;pointer&nbsp;to&nbsp;the&nbsp;wave_ids&nbsp;and&nbsp;optional&nbsp;command&nbsp;codes<br>bufSize:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;in&nbsp;buf<br></code><br><br>Returns 0 if OK, otherwise PI_CHAIN_NESTING, PI_CHAIN_LOOP_CNT, PI_BAD_CHAIN_LOOP, PI_BAD_CHAIN_CMD, PI_CHAIN_COUNTER,
-PI_BAD_CHAIN_DELAY, PI_CHAIN_TOO_BIG, or PI_BAD_WAVE_ID.
-<br><br>Each wave is transmitted in the order specified. A wave may
-occur multiple times per chain.
-<br><br>A blocks of waves may be transmitted multiple times by using
-the loop commands. The block is bracketed by loop start and
-end commands. Loops may be nested.
-<br><br>Delays between waves may be added with the delay command.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>Loop Start</td><td>255 0</td><td>Identify start of a wave block</td></tr><tr><td>Loop Repeat</td><td>255 1 x y</td><td>loop x + y*256 times</td></tr><tr><td>Delay</td><td>255 2 x y</td><td>delay x + y*256 microseconds</td></tr><tr><td>Loop Forever</td><td>255 3</td><td>loop forever</td></tr></tbody></table><br><br>If present Loop Forever must be the last entry in the chain.
-<br><br>The code is currently dimensioned to support a chain with roughly
-600 entries and 20 loop counters.
-<br><br><b><small>Example</small></b><br><br><code>#include&nbsp;&lt;stdio.h&gt;<br>#include&nbsp;&lt;pigpiod_if.h&gt;<br><br>#define&nbsp;WAVES&nbsp;5<br>#define&nbsp;GPIO&nbsp;4<br><br>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;*argv[])<br>{<br>&nbsp;&nbsp;&nbsp;int&nbsp;i,&nbsp;wid[WAVES];<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(pigpio_start(0,&nbsp;0)&lt;0)&nbsp;return&nbsp;-1;<br><br>&nbsp;&nbsp;&nbsp;set_mode(GPIO,&nbsp;PI_OUTPUT);<br><br>&nbsp;&nbsp;&nbsp;for&nbsp;(i=0;&nbsp;i&lt;WAVES;&nbsp;i++)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wave_add_generic(2,&nbsp;(gpioPulse_t[])<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{1&lt;&lt;GPIO,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;20},<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{0,&nbsp;1&lt;&lt;GPIO,&nbsp;(i+1)*200}});<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[i]&nbsp;=&nbsp;wave_create();<br>&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;wave_chain((char&nbsp;[])&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[4],&nbsp;wid[3],&nbsp;wid[2],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;4+3+2<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[0],&nbsp;wid[0],&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;0+0+0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[1],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;0+1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;2,&nbsp;0x88,&nbsp;0x13,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;delay&nbsp;5000us<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;30,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;30&nbsp;times)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[2],&nbsp;wid[3],&nbsp;wid[0],&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;2+3+0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[3],&nbsp;wid[1],&nbsp;wid[2],&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;3+1+2<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;10,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;10&nbsp;times)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;5,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;5&nbsp;times)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[4],&nbsp;wid[4],&nbsp;wid[4],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;4+4+4<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;2,&nbsp;0x20,&nbsp;0x4E,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;delay&nbsp;20000us<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[0],&nbsp;wid[0],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;0+0+0<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},&nbsp;46);<br><br>&nbsp;&nbsp;&nbsp;while&nbsp;(wave_tx_busy())&nbsp;time_sleep(0.1);<br><br>&nbsp;&nbsp;&nbsp;for&nbsp;(i=0;&nbsp;i&lt;WAVES;&nbsp;i++)&nbsp;wave_delete(wid[i]);<br><br>&nbsp;&nbsp;&nbsp;pigpio_stop();<br>}<br></code><h3><a name="wave_tx_busy"></a><a href="#int"><small>int</small></a> wave_tx_busy<small>(void)</small></h3>
-This function checks to see if a waveform is currently being
-transmitted.
-<br><br>Returns 1 if a waveform is currently being transmitted, otherwise 0.
-<h3><a name="wave_tx_stop"></a><a href="#int"><small>int</small></a> wave_tx_stop<small>(void)</small></h3>
-This function stops the transmission of the current waveform.
-<br><br>Returns 0 if OK.
-<br><br>This function is intended to stop a waveform started with the repeat mode.
-<h3><a name="wave_get_micros"></a><a href="#int"><small>int</small></a> wave_get_micros<small>(void)</small></h3>
-This function returns the length in microseconds of the current
-waveform.
-<h3><a name="wave_get_high_micros"></a><a href="#int"><small>int</small></a> wave_get_high_micros<small>(void)</small></h3>
-This function returns the length in microseconds of the longest waveform
-created since the pigpio daemon was started.
-<h3><a name="wave_get_max_micros"></a><a href="#int"><small>int</small></a> wave_get_max_micros<small>(void)</small></h3>
-This function returns the maximum possible size of a waveform in<br>
-microseconds.
-<h3><a name="wave_get_pulses"></a><a href="#int"><small>int</small></a> wave_get_pulses<small>(void)</small></h3>
-This function returns the length in pulses of the current waveform.
-<h3><a name="wave_get_high_pulses"></a><a href="#int"><small>int</small></a> wave_get_high_pulses<small>(void)</small></h3>
-This function returns the length in pulses of the longest waveform
-created since the pigpio daemon was started.
-<h3><a name="wave_get_max_pulses"></a><a href="#int"><small>int</small></a> wave_get_max_pulses<small>(void)</small></h3>
-This function returns the maximum possible size of a waveform in pulses.
-<h3><a name="wave_get_cbs"></a><a href="#int"><small>int</small></a> wave_get_cbs<small>(void)</small></h3>
-This function returns the length in DMA control blocks of the current
-waveform.
-<h3><a name="wave_get_high_cbs"></a><a href="#int"><small>int</small></a> wave_get_high_cbs<small>(void)</small></h3>
-This function returns the length in DMA control blocks of the longest
-waveform created since the pigpio daemon was started.
-<h3><a name="wave_get_max_cbs"></a><a href="#int"><small>int</small></a> wave_get_max_cbs<small>(void)</small></h3>
-This function returns the maximum possible size of a waveform in DMA
-control blocks.
-<h3><a name="gpio_trigger"></a><a href="#int"><small>int</small></a> gpio_trigger<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#pulseLen">pulseLen</a>, <a href="#unsigned">unsigned</a> <a href="#level">level</a>)</small></h3>
-This function sends a trigger pulse to a GPIO. The GPIO is set to
-level for pulseLen microseconds and then reset to not level.
-<br><br><code>user_gpio:&nbsp;0-31.<br>&nbsp;pulseLen:&nbsp;1-100.<br>&nbsp;&nbsp;&nbsp;&nbsp;level:&nbsp;0,1.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_LEVEL,
-PI_BAD_PULSELEN, or PI_NOT_PERMITTED.
-<h3><a name="store_script"></a><a href="#int"><small>int</small></a> store_script<small>(<a href="#char">char</a> <a href="#*script">*script</a>)</small></h3>
-This function stores a script for later execution.
-<br><br>See <a href="http://abyz.me.uk/rpi/pigpio/pigs.html#Scripts">http://abyz.me.uk/rpi/pigpio/pigs.html#Scripts</a> for details.
-<br><br><code>script:&nbsp;the&nbsp;text&nbsp;of&nbsp;the&nbsp;script.<br></code><br><br>The function returns a script id if the script is valid,
-otherwise PI_BAD_SCRIPT.
-<h3><a name="run_script"></a><a href="#int"><small>int</small></a> run_script<small>(<a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>, <a href="#unsigned">unsigned</a> <a href="#numPar">numPar</a>, <a href="#uint32_t">uint32_t</a> <a href="#*param">*param</a>)</small></h3>
-This function runs a stored script.
-<br><br><code>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#store_script">store_script</a>.<br>&nbsp;&nbsp;&nbsp;numPar:&nbsp;0-10,&nbsp;the&nbsp;number&nbsp;of&nbsp;parameters.<br>&nbsp;&nbsp;&nbsp;&nbsp;param:&nbsp;an&nbsp;array&nbsp;of&nbsp;parameters.<br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID, or
-PI_TOO_MANY_PARAM
-<br><br>param is an array of up to 10 parameters which may be referenced in
-the script as p0 to p9.
-<h3><a name="script_status"></a><a href="#int"><small>int</small></a> script_status<small>(<a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>, <a href="#uint32_t">uint32_t</a> <a href="#*param">*param</a>)</small></h3>
-This function returns the run status of a stored script as well
-as the current values of parameters 0 to 9.
-<br><br><code>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#store_script">store_script</a>.<br>&nbsp;&nbsp;&nbsp;&nbsp;param:&nbsp;an&nbsp;array&nbsp;to&nbsp;hold&nbsp;the&nbsp;returned&nbsp;10&nbsp;parameters.<br></code><br><br>The function returns greater than or equal to 0 if OK,
-otherwise PI_BAD_SCRIPT_ID.
-<br><br>The run status may be
-<br><br><code>PI_SCRIPT_INITING<br>PI_SCRIPT_HALTED<br>PI_SCRIPT_RUNNING<br>PI_SCRIPT_WAITING<br>PI_SCRIPT_FAILED<br></code><br><br>The current value of script parameters 0 to 9 are returned in param.
-<h3><a name="stop_script"></a><a href="#int"><small>int</small></a> stop_script<small>(<a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>)</small></h3>
-This function stops a running script.
-<br><br><code>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#store_script">store_script</a>.<br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID.
-<h3><a name="delete_script"></a><a href="#int"><small>int</small></a> delete_script<small>(<a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>)</small></h3>
-This function deletes a stored script.
-<br><br><code>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#store_script">store_script</a>.<br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID.
-<h3><a name="bb_serial_read_open"></a><a href="#int"><small>int</small></a> bb_serial_read_open<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#data_bits">data_bits</a>)</small></h3>
-This function opens a GPIO for bit bang reading of serial data.
-<br><br><code>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;50-250000<br>data_bits:&nbsp;1-32<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_WAVE_BAUD,
-or PI_GPIO_IN_USE.
-<br><br>The serial data is returned in a cyclic buffer and is read using
-bb_serial_read.
-<br><br>It is the caller's responsibility to read data from the cyclic buffer
-in a timely fashion.
-<h3><a name="bb_serial_read"></a><a href="#int"><small>int</small></a> bb_serial_read<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#void">void</a> <a href="#*buf">*buf</a>, <a href="#size_t">size_t</a> <a href="#bufSize">bufSize</a>)</small></h3>
-This function copies up to bufSize bytes of data read from the
-bit bang serial cyclic buffer to the buffer starting at buf.
-<br><br><code>user_gpio:&nbsp;0-31,&nbsp;previously&nbsp;opened&nbsp;with&nbsp;<a href="#bb_serial_read_open">bb_serial_read_open</a>.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;bytes.<br>&nbsp;&nbsp;bufSize:&nbsp;&gt;=0<br></code><br><br>Returns the number of bytes copied if OK, otherwise PI_BAD_USER_GPIO
-or PI_NOT_SERIAL_GPIO.
-<br><br>The bytes returned for each character depend upon the number of
-data bits <a href="#data_bits">data_bits</a> specified in the <a href="#bb_serial_read_open">bb_serial_read_open</a> command.
-<br><br>For <a href="#data_bits">data_bits</a> 1-8 there will be one byte per character.<br>
-For <a href="#data_bits">data_bits</a> 9-16 there will be two bytes per character.<br>
-For <a href="#data_bits">data_bits</a> 17-32 there will be four bytes per character.
-<h3><a name="bb_serial_read_close"></a><a href="#int"><small>int</small></a> bb_serial_read_close<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-This function closes a GPIO for bit bang reading of serial data.
-<br><br><code>user_gpio:&nbsp;0-31,&nbsp;previously&nbsp;opened&nbsp;with&nbsp;<a href="#bb_serial_read_open">bb_serial_read_open</a>.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_SERIAL_GPIO.
-<h3><a name="bb_serial_invert"></a><a href="#int"><small>int</small></a> bb_serial_invert<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#invert">invert</a>)</small></h3>
-This function inverts serial logic for big bang serial reads.
-<br><br><code>user_gpio:&nbsp;0-31,&nbsp;previously&nbsp;opened&nbsp;with&nbsp;<a href="#bb_serial_read_open">bb_serial_read_open</a>.<br>&nbsp;&nbsp;&nbsp;invert:&nbsp;0-1,&nbsp;1&nbsp;invert,&nbsp;0&nbsp;normal.<br></code><br><br>Returns 0 if OK, otherwise PI_NOT_SERIAL_GPIO or PI_BAD_SER_INVERT.
-<h3><a name="i2c_open"></a><a href="#int"><small>int</small></a> i2c_open<small>(<a href="#unsigned">unsigned</a> <a href="#i2c_bus">i2c_bus</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_addr">i2c_addr</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_flags">i2c_flags</a>)</small></h3>
-This returns a handle for the device at address i2c_addr on bus i2c_bus.
-<br><br><code>&nbsp;&nbsp;i2c_bus:&nbsp;&gt;=0.<br>&nbsp;i2c_addr:&nbsp;0-0x7F.<br>i2c_flags:&nbsp;0.<br></code><br><br>No flags are currently defined. This parameter should be set to zero.
-<br><br>Physically buses 0 and 1 are available on the Pi. Higher numbered buses
-will be available if a kernel supported bus multiplexor is being used.
-<br><br>The GPIO used are given in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td></tr><tr><td>I2C 0</td><td>0</td><td>1</td></tr><tr><td>I2C 1</td><td>2</td><td>3</td></tr></tbody></table><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_BAD_I2C_BUS, PI_BAD_I2C_ADDR,
-PI_BAD_FLAGS, PI_NO_HANDLE, or PI_I2C_OPEN_FAILED.
-<br><br>For the SMBus commands the low level transactions are shown at the end
-of the function description. The following abbreviations are used.
-<br><br><code>S&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Start&nbsp;bit<br>P&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Stop&nbsp;bit<br>Rd/Wr&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Read/Write&nbsp;bit.&nbsp;Rd&nbsp;equals&nbsp;1,&nbsp;Wr&nbsp;equals&nbsp;0.<br>A,&nbsp;NA&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Accept&nbsp;and&nbsp;not&nbsp;accept&nbsp;bit.<br><br>Addr&nbsp;&nbsp;(7&nbsp;bits):&nbsp;I2C&nbsp;7&nbsp;bit&nbsp;address.<br>Comm&nbsp;&nbsp;(8&nbsp;bits):&nbsp;Command&nbsp;byte,&nbsp;a&nbsp;data&nbsp;byte&nbsp;which&nbsp;often&nbsp;selects&nbsp;a&nbsp;register.<br>Data&nbsp;&nbsp;(8&nbsp;bits):&nbsp;A&nbsp;data&nbsp;byte.<br>Count&nbsp;(8&nbsp;bits):&nbsp;A&nbsp;data&nbsp;byte&nbsp;containing&nbsp;the&nbsp;length&nbsp;of&nbsp;a&nbsp;block&nbsp;operation.<br><br>[..]:&nbsp;Data&nbsp;sent&nbsp;by&nbsp;the&nbsp;device.<br></code><h3><a name="i2c_close"></a><a href="#int"><small>int</small></a> i2c_close<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This closes the I2C device associated with the handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<h3><a name="i2c_write_quick"></a><a href="#int"><small>int</small></a> i2c_write_quick<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#bit">bit</a>)</small></h3>
-This sends a single bit (in the Rd/Wr bit) to the device associated
-with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>&nbsp;&nbsp;&nbsp;bit:&nbsp;0-1,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Quick command. SMBus 2.0 5.5.1
-<code>S&nbsp;Addr&nbsp;Rd/Wr&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_write_byte"></a><a href="#int"><small>int</small></a> i2c_write_byte<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#bVal">bVal</a>)</small></h3>
-This sends a single byte to the device associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>&nbsp;&nbsp;bVal:&nbsp;0-0xFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Send byte. SMBus 2.0 5.5.2
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;Data&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_read_byte"></a><a href="#int"><small>int</small></a> i2c_read_byte<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This reads a single byte from the device associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br></code><br><br>Returns the byte read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-or PI_I2C_READ_FAILED.
-<br><br>Receive byte. SMBus 2.0 5.5.3
-<code>S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_write_byte_data"></a><a href="#int"><small>int</small></a> i2c_write_byte_data<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#unsigned">unsigned</a> <a href="#bVal">bVal</a>)</small></h3>
-This writes a single byte to the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write.<br>&nbsp;&nbsp;&nbsp;bVal:&nbsp;0-0xFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Write byte. SMBus 2.0 5.5.4
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;Comm&nbsp;[A]&nbsp;Data&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_write_word_data"></a><a href="#int"><small>int</small></a> i2c_write_word_data<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#unsigned">unsigned</a> <a href="#wVal">wVal</a>)</small></h3>
-This writes a single 16 bit word to the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write.<br>&nbsp;&nbsp;&nbsp;wVal:&nbsp;0-0xFFFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Write word. SMBus 2.0 5.5.4
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;Comm&nbsp;[A]&nbsp;DataLow&nbsp;[A]&nbsp;DataHigh&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_read_byte_data"></a><a href="#int"><small>int</small></a> i2c_read_byte_data<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>)</small></h3>
-This reads a single byte from the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read.<br></code><br><br>Returns the byte read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Read byte. SMBus 2.0 5.5.5
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;Comm&nbsp;[A]&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_read_word_data"></a><a href="#int"><small>int</small></a> i2c_read_word_data<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>)</small></h3>
-This reads a single 16 bit word from the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read.<br></code><br><br>Returns the word read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Read word. SMBus 2.0 5.5.5
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;Comm&nbsp;[A]&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[DataLow]&nbsp;A&nbsp;[DataHigh]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_process_call"></a><a href="#int"><small>int</small></a> i2c_process_call<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#unsigned">unsigned</a> <a href="#wVal">wVal</a>)</small></h3>
-This writes 16 bits of data to the specified register of the device
-associated with handle and and reads 16 bits of data in return.
-<br><br><code>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write/read.<br>&nbsp;&nbsp;&nbsp;wVal:&nbsp;0-0xFFFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></code><br><br>Returns the word read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Process call. SMBus 2.0 5.5.6
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;Comm&nbsp;[A]&nbsp;DataLow&nbsp;[A]&nbsp;DataHigh&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[DataLow]&nbsp;A&nbsp;[DataHigh]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_write_block_data"></a><a href="#int"><small>int</small></a> i2c_write_block_data<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes up to 32 bytes to the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write.<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;with&nbsp;the&nbsp;data&nbsp;to&nbsp;send.<br>&nbsp;&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Block write. SMBus 2.0 5.5.7
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;Comm&nbsp;[A]&nbsp;Count&nbsp;[A]&nbsp;Data&nbsp;[A]&nbsp;Data&nbsp;[A]&nbsp;...&nbsp;[A]&nbsp;Data&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_read_block_data"></a><a href="#int"><small>int</small></a> i2c_read_block_data<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>)</small></h3>
-This reads a block of up to 32 bytes from the specified register of
-the device associated with handle.
-<br><br><code>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read.<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data.<br></code><br><br>The amount of returned data is set by the device.
-<br><br>Returns the number of bytes read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Block read. SMBus 2.0 5.5.7
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;Comm&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Count]&nbsp;A&nbsp;[Data]&nbsp;A&nbsp;[Data]&nbsp;A&nbsp;...&nbsp;A&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_block_process_call"></a><a href="#int"><small>int</small></a> i2c_block_process_call<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes data bytes to the specified register of the device
-associated with handle and reads a device specified number
-of bytes of data in return.
-<br><br><code>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write/read.<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;with&nbsp;the&nbsp;data&nbsp;to&nbsp;send&nbsp;and&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data.<br>&nbsp;&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns the number of bytes read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>The smbus 2.0 documentation states that a minimum of 1 byte may be
-sent and a minimum of 1 byte may be received. The total number of
-bytes sent/received must be 32 or less.
-<br><br>Block write-block read. SMBus 2.0 5.5.8
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;Comm&nbsp;[A]&nbsp;Count&nbsp;[A]&nbsp;Data&nbsp;[A]&nbsp;...<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Count]&nbsp;A&nbsp;[Data]&nbsp;...&nbsp;A&nbsp;P<br></code><h3><a name="i2c_read_i2c_block_data"></a><a href="#int"><small>int</small></a> i2c_read_i2c_block_data<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This reads count bytes from the specified register of the device
-associated with handle . The count may be 1-32.
-<br><br><code>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read.<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data.<br>&nbsp;&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></code><br><br>Returns the number of bytes read (&gt;0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br><code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;Comm&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Data]&nbsp;A&nbsp;[Data]&nbsp;A&nbsp;...&nbsp;A&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_write_i2c_block_data"></a><a href="#int"><small>int</small></a> i2c_write_i2c_block_data<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes 1 to 32 bytes to the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write.<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;data&nbsp;to&nbsp;write.<br>&nbsp;&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br><code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;Comm&nbsp;[A]&nbsp;Data&nbsp;[A]&nbsp;Data&nbsp;[A]&nbsp;...&nbsp;[A]&nbsp;Data&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_read_device"></a><a href="#int"><small>int</small></a> i2c_read_device<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This reads count bytes from the raw device into buf.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data&nbsp;bytes.<br>&nbsp;count:&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></code><br><br>Returns count (&gt;0) if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_READ_FAILED.
-<h3><a name="i2c_write_device"></a><a href="#int"><small>int</small></a> i2c_write_device<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes count bytes from buf to the raw device.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;containing&nbsp;the&nbsp;data&nbsp;bytes&nbsp;to&nbsp;write.<br>&nbsp;count:&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<h3><a name="i2c_zip"></a><a href="#int"><small>int</small></a> i2c_zip<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*inBuf">*inBuf</a>, <a href="#unsigned">unsigned</a> <a href="#inLen">inLen</a>, <a href="#char">char</a> <a href="#*outBuf">*outBuf</a>, <a href="#unsigned">unsigned</a> <a href="#outLen">outLen</a>)</small></h3>
-This function executes a sequence of I2C operations. The
-operations to be performed are specified by the contents of inBuf
-which contains the concatenated command codes and associated data.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>&nbsp;inBuf:&nbsp;pointer&nbsp;to&nbsp;the&nbsp;concatenated&nbsp;I2C&nbsp;commands,&nbsp;see&nbsp;below<br>&nbsp;inLen:&nbsp;size&nbsp;of&nbsp;command&nbsp;buffer<br>outBuf:&nbsp;pointer&nbsp;to&nbsp;buffer&nbsp;to&nbsp;hold&nbsp;returned&nbsp;data<br>outLen:&nbsp;size&nbsp;of&nbsp;output&nbsp;buffer<br></code><br><br>Returns &gt;= 0 if OK (the number of bytes read), otherwise
-PI_BAD_HANDLE, PI_BAD_POINTER, PI_BAD_I2C_CMD, PI_BAD_I2C_RLEN.
-PI_BAD_I2C_WLEN, or PI_BAD_I2C_SEG.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>End</td><td>0</td><td>No more commands</td></tr><tr><td>Escape</td><td>1</td><td>Next P is two bytes</td></tr><tr><td>On</td><td>2</td><td>Switch combined flag on</td></tr><tr><td>Off</td><td>3</td><td>Switch combined flag off</td></tr><tr><td>Address</td><td>4 P</td><td>Set I2C address to P</td></tr><tr><td>Flags</td><td>5 lsb msb</td><td>Set I2C flags to lsb + (msb &lt;&lt; 8)</td></tr><tr><td>Read</td><td>6 P</td><td>Read P bytes of data</td></tr><tr><td>Write</td><td>7 P ...</td><td>Write P bytes of data</td></tr></tbody></table><br><br>The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-<br><br>The address defaults to that associated with the handle.
-The flags default to 0. The address and flags maintain their
-previous value until updated.
-<br><br>The returned I2C data is stored in consecutive locations of outBuf.
-<br><br><b><small>Example</small></b><br><br><code>Set&nbsp;address&nbsp;0x53,&nbsp;write&nbsp;0x32,&nbsp;read&nbsp;6&nbsp;bytes<br>Set&nbsp;address&nbsp;0x1E,&nbsp;write&nbsp;0x03,&nbsp;read&nbsp;6&nbsp;bytes<br>Set&nbsp;address&nbsp;0x68,&nbsp;write&nbsp;0x1B,&nbsp;read&nbsp;8&nbsp;bytes<br>End<br><br>0x04&nbsp;0x53&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x32&nbsp;&nbsp;&nbsp;0x06&nbsp;0x06<br>0x04&nbsp;0x1E&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x03&nbsp;&nbsp;&nbsp;0x06&nbsp;0x06<br>0x04&nbsp;0x68&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x1B&nbsp;&nbsp;&nbsp;0x06&nbsp;0x08<br>0x00<br></code><h3><a name="bb_i2c_open"></a><a href="#int"><small>int</small></a> bb_i2c_open<small>(<a href="#unsigned">unsigned</a> <a href="#SDA">SDA</a>, <a href="#unsigned">unsigned</a> <a href="#SCL">SCL</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>)</small></h3>
-This function selects a pair of GPIO for bit banging I2C at a
-specified baud rate.
-<br><br>Bit banging I2C allows for certain operations which are not possible
-with the standard I2C driver.
-<br><br>o baud rates as low as 50<br>
-o repeated starts<br>
-o clock stretching<br>
-o I2C on any pair of spare GPIO
-<br><br><code>&nbsp;SDA:&nbsp;0-31<br>&nbsp;SCL:&nbsp;0-31<br>baud:&nbsp;50-500000<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_I2C_BAUD, or
-PI_GPIO_IN_USE.
-<br><br>NOTE:
-<br><br>The GPIO used for SDA and SCL must have pull-ups to 3V3 connected. As
-a guide the hardware pull-ups on pins 3 and 5 are 1k8 in value.
-<h3><a name="bb_i2c_close"></a><a href="#int"><small>int</small></a> bb_i2c_close<small>(<a href="#unsigned">unsigned</a> <a href="#SDA">SDA</a>)</small></h3>
-This function stops bit banging I2C on a pair of GPIO previously
-opened with <a href="#bb_i2c_open">bb_i2c_open</a>.
-<br><br><code>SDA:&nbsp;0-31,&nbsp;the&nbsp;SDA&nbsp;GPIO&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_i2c_open">bb_i2c_open</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_I2C_GPIO.
-<h3><a name="bb_i2c_zip"></a><a href="#int"><small>int</small></a> bb_i2c_zip<small>(<a href="#unsigned">unsigned</a> <a href="#SDA">SDA</a>, <a href="#char">char</a> <a href="#*inBuf">*inBuf</a>, <a href="#unsigned">unsigned</a> <a href="#inLen">inLen</a>, <a href="#char">char</a> <a href="#*outBuf">*outBuf</a>, <a href="#unsigned">unsigned</a> <a href="#outLen">outLen</a>)</small></h3>
-This function executes a sequence of bit banged I2C operations. The
-operations to be performed are specified by the contents of inBuf
-which contains the concatenated command codes and associated data.
-<br><br><code>&nbsp;&nbsp;&nbsp;SDA:&nbsp;0-31&nbsp;(as&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_i2c_open">bb_i2c_open</a>)<br>&nbsp;inBuf:&nbsp;pointer&nbsp;to&nbsp;the&nbsp;concatenated&nbsp;I2C&nbsp;commands,&nbsp;see&nbsp;below<br>&nbsp;inLen:&nbsp;size&nbsp;of&nbsp;command&nbsp;buffer<br>outBuf:&nbsp;pointer&nbsp;to&nbsp;buffer&nbsp;to&nbsp;hold&nbsp;returned&nbsp;data<br>outLen:&nbsp;size&nbsp;of&nbsp;output&nbsp;buffer<br></code><br><br>Returns &gt;= 0 if OK (the number of bytes read), otherwise
-PI_BAD_USER_GPIO, PI_NOT_I2C_GPIO, PI_BAD_POINTER,
-PI_BAD_I2C_CMD, PI_BAD_I2C_RLEN, PI_BAD_I2C_WLEN,
-PI_I2C_READ_FAILED, or PI_I2C_WRITE_FAILED.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>End</td><td>0</td><td>No more commands</td></tr><tr><td>Escape</td><td>1</td><td>Next P is two bytes</td></tr><tr><td>Start</td><td>2</td><td>Start condition</td></tr><tr><td>Stop</td><td>3</td><td>Stop condition</td></tr><tr><td>Address</td><td>4 P</td><td>Set I2C address to P</td></tr><tr><td>Flags</td><td>5 lsb msb</td><td>Set I2C flags to lsb + (msb &lt;&lt; 8)</td></tr><tr><td>Read</td><td>6 P</td><td>Read P bytes of data</td></tr><tr><td>Write</td><td>7 P ...</td><td>Write P bytes of data</td></tr></tbody></table><br><br>The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-<br><br>The address and flags default to 0. The address and flags maintain
-their previous value until updated.
-<br><br>No flags are currently defined.
-<br><br>The returned I2C data is stored in consecutive locations of outBuf.
-<br><br><b><small>Example</small></b><br><br><code>Set&nbsp;address&nbsp;0x53<br>start,&nbsp;write&nbsp;0x32,&nbsp;(re)start,&nbsp;read&nbsp;6&nbsp;bytes,&nbsp;stop<br>Set&nbsp;address&nbsp;0x1E<br>start,&nbsp;write&nbsp;0x03,&nbsp;(re)start,&nbsp;read&nbsp;6&nbsp;bytes,&nbsp;stop<br>Set&nbsp;address&nbsp;0x68<br>start,&nbsp;write&nbsp;0x1B,&nbsp;(re)start,&nbsp;read&nbsp;8&nbsp;bytes,&nbsp;stop<br>End<br><br>0x04&nbsp;0x53<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x32&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x06&nbsp;0x03<br><br>0x04&nbsp;0x1E<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x03&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x06&nbsp;0x03<br><br>0x04&nbsp;0x68<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x1B&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x08&nbsp;0x03<br><br>0x00<br></code><h3><a name="spi_open"></a><a href="#int"><small>int</small></a> spi_open<small>(<a href="#unsigned">unsigned</a> <a href="#spi_channel">spi_channel</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#spi_flags">spi_flags</a>)</small></h3>
-This function returns a handle for the SPI device on the channel.
-Data will be transferred at baud bits per second. The flags may
-be used to modify the default behaviour of 4-wire operation, mode 0,
-active low chip select.
-<br><br>The Pi has two SPI peripherals: main and auxiliary.
-<br><br>The main SPI has two chip selects (channels), the auxiliary has
-three.
-<br><br>The auxiliary SPI is available on all models but the A and B.
-<br><br>The GPIO used are given in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>MISO</td><td>MOSI</td><td>SCLK</td><td>CE0</td><td>CE1</td><td>CE2</td></tr><tr><td>Main SPI</td><td>9</td><td>10</td><td>11</td><td>8</td><td>7</td><td>-</td></tr><tr><td>Aux SPI</td><td>19</td><td>20</td><td>21</td><td>18</td><td>17</td><td>16</td></tr></tbody></table><br><br><code>spi_channel:&nbsp;0-1&nbsp;(0-2&nbsp;for&nbsp;the&nbsp;auxiliary&nbsp;SPI).<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;32K-125M&nbsp;(values&nbsp;above&nbsp;30M&nbsp;are&nbsp;unlikely&nbsp;to&nbsp;work).<br>&nbsp;&nbsp;spi_flags:&nbsp;see&nbsp;below.<br></code><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_BAD_SPI_CHANNEL,
-PI_BAD_SPI_SPEED, PI_BAD_FLAGS, PI_NO_AUX_SPI, or PI_SPI_OPEN_FAILED.
-<br><br>spi_flags consists of the least significant 22 bits.
-<br><br><code>21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;W&nbsp;&nbsp;A&nbsp;u2&nbsp;u1&nbsp;u0&nbsp;p2&nbsp;p1&nbsp;p0&nbsp;&nbsp;m&nbsp;&nbsp;m<br></code><br><br>mm defines the SPI mode.
-<br><br>Warning: modes 1 and 3 do not appear to work on the auxiliary SPI.
-<br><br><code>Mode&nbsp;POL&nbsp;PHA<br>&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;0<br>&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;1<br>&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;0<br>&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;1<br></code><br><br>px is 0 if CEx is active low (default) and 1 for active high.
-<br><br>ux is 0 if the CEx GPIO is reserved for SPI (default) and 1 otherwise.
-<br><br>A is 0 for the main SPI, 1 for the auxiliary SPI.
-<br><br>W is 0 if the device is not 3-wire, 1 if the device is 3-wire. Main
-SPI only.
-<br><br>nnnn defines the number of bytes (0-15) to write before switching
-the MOSI line to MISO to read data. This field is ignored
-if W is not set. Main SPI only.
-<br><br>T is 1 if the least significant bit is transmitted on MOSI first, the
-default (0) shifts the most significant bit out first. Auxiliary SPI
-only.
-<br><br>R is 1 if the least significant bit is received on MISO first, the
-default (0) receives the most significant bit first. Auxiliary SPI
-only.
-<br><br>bbbbbb defines the word size in bits (0-32). The default (0)
-sets 8 bits per word. Auxiliary SPI only.
-<br><br>The <a href="#spi_read">spi_read</a>, <a href="#spi_write">spi_write</a>, and <a href="#spi_xfer">spi_xfer</a> functions
-transfer data packed into 1, 2, or 4 bytes according to
-the word size in bits.
-<br><br>For bits 1-8 there will be one byte per word.<br>
-For bits 9-16 there will be two bytes per word.<br>
-For bits 17-32 there will be four bytes per word.
-<br><br>Multi-byte transfers are made in least significant byte first order.
-<br><br>E.g. to transfer 32 11-bit words buf should contain 64 bytes
-and count should be 64.
-<br><br>E.g. to transfer the 14 bit value 0x1ABC send the bytes 0xBC followed
-by 0x1A.
-<br><br>The other bits in flags should be set to zero.
-<h3><a name="spi_close"></a><a href="#int"><small>int</small></a> spi_close<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This functions closes the SPI device identified by the handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<h3><a name="spi_read"></a><a href="#int"><small>int</small></a> spi_read<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function reads count bytes of data from the SPI
-device associated with the handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data&nbsp;bytes.<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></code><br><br>Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-<h3><a name="spi_write"></a><a href="#int"><small>int</small></a> spi_write<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function writes count bytes of data from buf to the SPI
-device associated with the handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;data&nbsp;bytes&nbsp;to&nbsp;write.<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-<h3><a name="spi_xfer"></a><a href="#int"><small>int</small></a> spi_xfer<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*txBuf">*txBuf</a>, <a href="#char">char</a> <a href="#*rxBuf">*rxBuf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function transfers count bytes of data from txBuf to the SPI
-device associated with the handle. Simultaneously count bytes of
-data are read from the device and placed in rxBuf.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>.<br>&nbsp;txBuf:&nbsp;the&nbsp;data&nbsp;bytes&nbsp;to&nbsp;write.<br>&nbsp;rxBuf:&nbsp;the&nbsp;received&nbsp;data&nbsp;bytes.<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;transfer.<br></code><br><br>Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-<h3><a name="serial_open"></a><a href="#int"><small>int</small></a> serial_open<small>(<a href="#char">char</a> <a href="#*ser_tty">*ser_tty</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#ser_flags">ser_flags</a>)</small></h3>
-This function opens a serial device at a specified baud rate
-with specified flags. The device name must start with
-/dev/tty or /dev/serial.
-<br><br><code>&nbsp;&nbsp;ser_tty:&nbsp;the&nbsp;serial&nbsp;device&nbsp;to&nbsp;open.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;the&nbsp;baud&nbsp;rate&nbsp;in&nbsp;bits&nbsp;per&nbsp;second,&nbsp;see&nbsp;below.<br>ser_flags:&nbsp;0.<br></code><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_NO_HANDLE, or
-PI_SER_OPEN_FAILED.
-<br><br>The baud rate must be one of 50, 75, 110, 134, 150,
-200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
-38400, 57600, 115200, or 230400.
-<br><br>No flags are currently defined. This parameter should be set to zero.
-<h3><a name="serial_close"></a><a href="#int"><small>int</small></a> serial_close<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This function closes the serial device associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<h3><a name="serial_write_byte"></a><a href="#int"><small>int</small></a> serial_write_byte<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#bVal">bVal</a>)</small></h3>
-This function writes bVal to the serial port associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_SER_WRITE_FAILED.
-<h3><a name="serial_read_byte"></a><a href="#int"><small>int</small></a> serial_read_byte<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This function reads a byte from the serial port associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br></code><br><br>Returns the read byte (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_SER_READ_NO_DATA, or PI_SER_READ_FAILED.
-<br><br>If no data is ready PI_SER_READ_NO_DATA is returned.
-<h3><a name="serial_write"></a><a href="#int"><small>int</small></a> serial_write<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function writes count bytes from buf to the the serial port
-associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;array&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_SER_WRITE_FAILED.
-<h3><a name="serial_read"></a><a href="#int"><small>int</small></a> serial_read<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function reads up to count bytes from the the serial port
-associated with handle and writes them to buf.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data.<br>&nbsp;count:&nbsp;the&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></code><br><br>Returns the number of bytes read (&gt;0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, PI_SER_READ_NO_DATA, or PI_SER_WRITE_FAILED.
-<br><br>If no data is ready zero is returned.
-<h3><a name="serial_data_available"></a><a href="#int"><small>int</small></a> serial_data_available<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-Returns the number of bytes available to be read from the
-device associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br></code><br><br>Returns the number of bytes of data available (&gt;=0) if OK,
-otherwise PI_BAD_HANDLE.
-<h3><a name="custom_1"></a><a href="#int"><small>int</small></a> custom_1<small>(<a href="#unsigned">unsigned</a> <a href="#arg1">arg1</a>, <a href="#unsigned">unsigned</a> <a href="#arg2">arg2</a>, <a href="#char">char</a> <a href="#*argx">*argx</a>, <a href="#unsigned">unsigned</a> <a href="#argc">argc</a>)</small></h3>
-This function is available for user customisation.
-<br><br>It returns a single integer value.
-<br><br><code>arg1:&nbsp;&gt;=0<br>arg2:&nbsp;&gt;=0<br>argx:&nbsp;extra&nbsp;(byte)&nbsp;arguments<br>argc:&nbsp;number&nbsp;of&nbsp;extra&nbsp;arguments<br></code><br><br>Returns &gt;= 0 if OK, less than 0 indicates a user defined error.
-<h3><a name="custom_2"></a><a href="#int"><small>int</small></a> custom_2<small>(<a href="#unsigned">unsigned</a> <a href="#arg1">arg1</a>, <a href="#char">char</a> <a href="#*argx">*argx</a>, <a href="#unsigned">unsigned</a> <a href="#argc">argc</a>, <a href="#char">char</a> <a href="#*retBuf">*retBuf</a>, <a href="#unsigned">unsigned</a> <a href="#retMax">retMax</a>)</small></h3>
-This function is available for user customisation.
-<br><br>It differs from custom_1 in that it returns an array of bytes
-rather than just an integer.
-<br><br>The return value is an integer indicating the number of returned bytes.
-<code>&nbsp;&nbsp;arg1:&nbsp;&gt;=0<br>&nbsp;&nbsp;argc:&nbsp;extra&nbsp;(byte)&nbsp;arguments<br>&nbsp;count:&nbsp;number&nbsp;of&nbsp;extra&nbsp;arguments<br>retBuf:&nbsp;buffer&nbsp;for&nbsp;returned&nbsp;data<br>retMax:&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;return<br></code><br><br>Returns &gt;= 0 if OK, less than 0 indicates a user defined error.
-<br><br>Note, the number of returned bytes will be retMax or less.
-<h3><a name="callback"></a><a href="#int"><small>int</small></a> callback<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#edge">edge</a>, <a href="#CBFunc_t">CBFunc_t</a> <a href="#f">f</a>)</small></h3>
-This function initialises a new callback.
-<br><br><code>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edge:&nbsp;RISING_EDGE,&nbsp;FALLING_EDGE,&nbsp;or&nbsp;EITHER_EDGE.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function.<br></code><br><br>The function returns a callback id if OK, otherwise pigif_bad_malloc,
-pigif_duplicate_callback, or pigif_bad_callback.
-<br><br>The callback is called with the GPIO, edge, and tick, whenever the
-GPIO has the identified edge.
-<br><br><code>Parameter&nbsp;&nbsp;&nbsp;Value&nbsp;&nbsp;&nbsp;&nbsp;Meaning<br><br>GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-31&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;GPIO&nbsp;which&nbsp;has&nbsp;changed&nbsp;state<br><br>edge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;=&nbsp;change&nbsp;to&nbsp;low&nbsp;(a&nbsp;falling&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&nbsp;change&nbsp;to&nbsp;high&nbsp;(a&nbsp;rising&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;=&nbsp;no&nbsp;level&nbsp;change&nbsp;(a&nbsp;watchdog&nbsp;timeout)<br><br>tick&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32&nbsp;bit&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;microseconds&nbsp;since&nbsp;boot<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WARNING:&nbsp;this&nbsp;wraps&nbsp;around&nbsp;from<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4294967295&nbsp;to&nbsp;0&nbsp;roughly&nbsp;every&nbsp;72&nbsp;minutes<br></code><h3><a name="callback_ex"></a><a href="#int"><small>int</small></a> callback_ex<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#edge">edge</a>, <a href="#CBFuncEx_t">CBFuncEx_t</a> <a href="#f">f</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-This function initialises a new callback.
-<br><br><code>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edge:&nbsp;RISING_EDGE,&nbsp;FALLING_EDGE,&nbsp;or&nbsp;EITHER_EDGE.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function.<br>&nbsp;userdata:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;arbitrary&nbsp;user&nbsp;data.<br></code><br><br>The function returns a callback id if OK, otherwise pigif_bad_malloc,
-pigif_duplicate_callback, or pigif_bad_callback.
-<br><br>The callback is called with the GPIO, edge, tick, and user, whenever
-the GPIO has the identified edge.
-<br><br><code>Parameter&nbsp;&nbsp;&nbsp;Value&nbsp;&nbsp;&nbsp;&nbsp;Meaning<br><br>GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-31&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;GPIO&nbsp;which&nbsp;has&nbsp;changed&nbsp;state<br><br>edge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;=&nbsp;change&nbsp;to&nbsp;low&nbsp;(a&nbsp;falling&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&nbsp;change&nbsp;to&nbsp;high&nbsp;(a&nbsp;rising&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;=&nbsp;no&nbsp;level&nbsp;change&nbsp;(a&nbsp;watchdog&nbsp;timeout)<br><br>tick&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32&nbsp;bit&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;microseconds&nbsp;since&nbsp;boot<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WARNING:&nbsp;this&nbsp;wraps&nbsp;around&nbsp;from<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4294967295&nbsp;to&nbsp;0&nbsp;roughly&nbsp;every&nbsp;72&nbsp;minutes<br><br>userdata&nbsp;&nbsp;&nbsp;&nbsp;pointer&nbsp;&nbsp;Pointer&nbsp;to&nbsp;an&nbsp;arbitrary&nbsp;object<br></code><h3><a name="callback_cancel"></a><a href="#int"><small>int</small></a> callback_cancel<small>(<a href="#unsigned">unsigned</a> <a href="#callback_id">callback_id</a>)</small></h3>
-This function cancels a callback identified by its id.
-<br><br><code>callback_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#callback">callback</a>&nbsp;or&nbsp;<a href="#callback_ex">callback_ex</a>.<br></code><br><br>The function returns 0 if OK, otherwise pigif_callback_not_found.
-<h3><a name="wait_for_edge"></a><a href="#int"><small>int</small></a> wait_for_edge<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#edge">edge</a>, <a href="#double">double</a> <a href="#timeout">timeout</a>)</small></h3>
-This function waits for edge on the GPIO for up to timeout
-seconds.
-<br><br><code>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edge:&nbsp;RISING_EDGE,&nbsp;FALLING_EDGE,&nbsp;or&nbsp;EITHER_EDGE.<br>&nbsp;&nbsp;timeout:&nbsp;&gt;=0.<br></code><br><br>The function returns 1 if the edge occurred, otherwise 0.
-<br><br>The function returns when the edge occurs or after the timeout.
-<h2>PARAMETERS</h2><h3><a name="active">active</a>: 0-1000000</h3>
-The number of microseconds level changes are reported for once
-a noise filter has been triggered (by <a href="#steady">steady</a> microseconds of
-a stable level).
-<h3><a name="*addrStr">*addrStr</a></h3>
-A string specifying the host or IP address of the Pi running
-the pigpio daemon. It may be NULL in which case localhost
-is used unless overridden by the PIGPIO_ADDR environment
-variable.
-<h3><a name="arg1">arg1</a></h3>
-An unsigned argument passed to a user customised function. Its
-meaning is defined by the customiser.
-<h3><a name="arg2">arg2</a></h3>
-An unsigned argument passed to a user customised function. Its
-meaning is defined by the customiser.
-<h3><a name="argc">argc</a></h3>
-The count of bytes passed to a user customised function.
-<h3><a name="*argx">*argx</a></h3>
-A pointer to an array of bytes passed to a user customised function.
-Its meaning and content is defined by the customiser.
-<h3><a name="baud">baud</a></h3>
-The speed of serial communication (I2C, SPI, serial link, waves) in
-bits per second.
-<h3><a name="bit">bit</a></h3>
-A value of 0 or 1.
-<h3><a name="bits">bits</a></h3>
-A value used to select GPIO. If bit n of bits is set then GPIO n is
-selected.
-<br><br>A convenient way to set bit n is to or in (1&lt;&lt;n).
-<br><br>e.g. to select bits 5, 9, 23 you could use (1&lt;&lt;5) | (1&lt;&lt;9) | (1&lt;&lt;23).
-<h3><a name="*buf">*buf</a></h3>
-A buffer to hold data being sent or being received.
-<h3><a name="bufSize">bufSize</a></h3>
-The size in bytes of a buffer.
-<h3><a name="bVal">bVal</a>: 0-255 (Hex 0x0-0xFF, Octal 0-0377)</h3>
-An 8-bit byte value.
-<h3><a name="callback_id">callback_id</a></h3>
-A &gt;=0, as returned by a call to <a href="#callback">callback</a> or <a href="#callback_ex">callback_ex</a>. This is
-passed to <a href="#callback_cancel">callback_cancel</a> to cancel the callback.
-<h3><a name="CBFunc_t">CBFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*CBFunc_t)<br>&nbsp;&nbsp;&nbsp;(unsigned&nbsp;user_gpio,&nbsp;unsigned&nbsp;level,&nbsp;uint32_t&nbsp;tick);<br></code><h3><a name="CBFuncEx_t">CBFuncEx_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*CBFuncEx_t)<br>&nbsp;&nbsp;&nbsp;(unsigned&nbsp;user_gpio,&nbsp;unsigned&nbsp;level,&nbsp;uint32_t&nbsp;tick,&nbsp;void&nbsp;*&nbsp;user);<br></code><h3><a name="char">char</a></h3>
-A single character, an 8 bit quantity able to store 0-255.
-<h3><a name="clkfreq">clkfreq</a>: 4689-250000000 (250M)</h3>
-The hardware clock frequency.
-<h3><a name="count">count</a></h3>
-The number of bytes to be transferred in an I2C, SPI, or Serial
-command.
-<h3><a name="data_bits">data_bits</a>: 1-32</h3>
-The number of data bits in each character of serial data.
-<br><br><code>#define&nbsp;PI_MIN_WAVE_DATABITS&nbsp;1<br>#define&nbsp;PI_MAX_WAVE_DATABITS&nbsp;32<br></code><h3><a name="double">double</a></h3>
-A floating point number.
-<h3><a name="dutycycle">dutycycle</a>: 0-range</h3>
-A number representing the ratio of on time to off time for PWM.
-<br><br>The number may vary between 0 and range (default 255) where
-0 is off and range is fully on.
-<h3><a name="edge">edge</a></h3>
-Used to identify a GPIO level transition of interest. A rising edge is
-a level change from 0 to 1. A falling edge is a level change from 1 to 0.
-<br><br><code>RISING_EDGE&nbsp;&nbsp;0<br>FALLING_EDGE&nbsp;1<br>EITHER_EDGE.&nbsp;2<br></code><h3><a name="errnum">errnum</a></h3>
-A negative number indicating a function call failed and the nature
-of the error.
-<h3><a name="f">f</a></h3>
-A function.
-<h3><a name="frequency">frequency</a>: &gt;=0</h3>
-The number of times a GPIO is swiched on and off per second. This
-can be set per GPIO and may be as little as 5Hz or as much as
-40KHz. The GPIO will be on for a proportion of the time as defined
-by its dutycycle.
-<h3><a name="gpio">gpio</a></h3>
-A Broadcom numbered GPIO, in the range 0-53.
-<br><br>There are 54 General Purpose Input Outputs (GPIO) named gpio0 through
-gpio53.
-<br><br>They are split into two banks. Bank 1 consists of gpio0 through
-gpio31. Bank 2 consists of gpio32 through gpio53.
-<br><br>All the GPIO which are safe for the user to read and write are in
-bank 1. Not all GPIO in bank 1 are safe though. Type 1 boards
-have 17 safe GPIO. Type 2 boards have 21. Type 3 boards have 26.
-<br><br>See <a href="#get_hardware_revision">get_hardware_revision</a>.
-<br><br>The user GPIO are marked with an X in the following table.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;1&nbsp;&nbsp;2&nbsp;&nbsp;3&nbsp;&nbsp;4&nbsp;&nbsp;5&nbsp;&nbsp;6&nbsp;&nbsp;7&nbsp;&nbsp;8&nbsp;&nbsp;9&nbsp;10&nbsp;11&nbsp;12&nbsp;13&nbsp;14&nbsp;15<br>Type&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16&nbsp;17&nbsp;18&nbsp;19&nbsp;20&nbsp;21&nbsp;22&nbsp;23&nbsp;24&nbsp;25&nbsp;26&nbsp;27&nbsp;28&nbsp;29&nbsp;30&nbsp;31<br>Type&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-<br>Type&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-<br></code><h3><a name="gpioPulse_t">gpioPulse_t</a></h3>
-<code>typedef&nbsp;struct<br>{<br>uint32_t&nbsp;gpioOn;<br>uint32_t&nbsp;gpioOff;<br>uint32_t&nbsp;usDelay;<br>}&nbsp;gpioPulse_t;<br></code><h3><a name="gpioThreadFunc_t">gpioThreadFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;*(gpioThreadFunc_t)&nbsp;(void&nbsp;*);<br></code><h3><a name="handle">handle</a>: &gt;=0</h3>
-A number referencing an object opened by one of <a href="#i2c_open">i2c_open</a>, <a href="#notify_open">notify_open</a>,
-<a href="#serial_open">serial_open</a>, and <a href="#spi_open">spi_open</a>.
-<h3><a name="i2c_addr">i2c_addr</a>: 0-0x7F</h3>
-The address of a device on the I2C bus.
-<h3><a name="i2c_bus">i2c_bus</a>: &gt;=0</h3>
-An I2C bus number.
-<h3><a name="i2c_flags">i2c_flags</a>: 0</h3>
-Flags which modify an I2C open command. None are currently defined.
-<h3><a name="i2c_reg">i2c_reg</a>: 0-255</h3>
-A register of an I2C device.
-<h3><a name="*inBuf">*inBuf</a></h3>
-A buffer used to pass data to a function.
-<h3><a name="inLen">inLen</a></h3>
-The number of bytes of data in a buffer.
-<h3><a name="int">int</a></h3>
-A whole number, negative or positive.
-<h3><a name="invert">invert</a></h3>
-A flag used to set normal or inverted bit bang serial data level logic.
-<h3><a name="level">level</a></h3>
-The level of a GPIO. Low or High.
-<br><br><code>PI_OFF&nbsp;0<br>PI_ON&nbsp;1<br><br>PI_CLEAR&nbsp;0<br>PI_SET&nbsp;1<br><br>PI_LOW&nbsp;0<br>PI_HIGH&nbsp;1<br></code><br><br>There is one exception. If a watchdog expires on a GPIO the level will be
-reported as PI_TIMEOUT. See <a href="#set_watchdog">set_watchdog</a>.
-<br><br><code>PI_TIMEOUT&nbsp;2<br></code><h3><a name="mode">mode</a>: 0-7</h3>
-The operational mode of a GPIO, normally INPUT or OUTPUT.
-<br><br><code>PI_INPUT&nbsp;0<br>PI_OUTPUT&nbsp;1<br>PI_ALT0&nbsp;4<br>PI_ALT1&nbsp;5<br>PI_ALT2&nbsp;6<br>PI_ALT3&nbsp;7<br>PI_ALT4&nbsp;3<br>PI_ALT5&nbsp;2<br></code><h3><a name="numBytes">numBytes</a></h3>
-The number of bytes used to store characters in a string. Depending
-on the number of bits per character there may be 1, 2, or 4 bytes
-per character.
-<h3><a name="numPar">numPar</a>: 0-10</h3>
-The number of parameters passed to a script.
-<h3><a name="numPulses">numPulses</a></h3>
-The number of pulses to be added to a waveform.
-<h3><a name="offset">offset</a></h3>
-The associated data starts this number of microseconds from the start of
-the waveform.
-<h3><a name="*outBuf">*outBuf</a></h3>
-A buffer used to return data from a function.
-<h3><a name="outLen">outLen</a></h3>
-The size in bytes of an output buffer.
-<h3><a name="*param">*param</a></h3>
-An array of script parameters.
-<h3><a name="*portStr">*portStr</a></h3>
-A string specifying the port address used by the Pi running
-the pigpio daemon. It may be NULL in which case "8888"
-is used unless overridden by the PIGPIO_PORT environment
-variable.
-<h3><a name="*pth">*pth</a></h3>
-A thread identifier, returned by <a href="#start_thread">start_thread</a>.
-<h3><a name="pthread_t">pthread_t</a></h3>
-A thread identifier.
-<h3><a name="pud">pud</a>: 0-2</h3>
-The setting of the pull up/down resistor for a GPIO, which may be off,
-pull-up, or pull-down.
-<code>PI_PUD_OFF&nbsp;0<br>PI_PUD_DOWN&nbsp;1<br>PI_PUD_UP&nbsp;2<br></code><h3><a name="pulseLen">pulseLen</a></h3>
-1-100, the length of a trigger pulse in microseconds.
-<h3><a name="*pulses">*pulses</a></h3>
-An array of pulses to be added to a waveform.
-<h3><a name="pulsewidth">pulsewidth</a>: 0, 500-2500</h3>
-<code>PI_SERVO_OFF&nbsp;0<br>PI_MIN_SERVO_PULSEWIDTH&nbsp;500<br>PI_MAX_SERVO_PULSEWIDTH&nbsp;2500<br></code><h3><a name="PWMduty">PWMduty</a>: 0-1000000 (1M)</h3>
-The hardware PWM dutycycle.
-<br><br><code>#define&nbsp;PI_HW_PWM_RANGE&nbsp;1000000<br></code><h3><a name="PWMfreq">PWMfreq</a>: 1-125000000 (125M)</h3>
-The hardware PWM frequency.
-<br><br><code>#define&nbsp;PI_HW_PWM_MIN_FREQ&nbsp;1<br>#define&nbsp;PI_HW_PWM_MAX_FREQ&nbsp;125000000<br></code><h3><a name="range">range</a>: 25-40000</h3>
-The permissible dutycycle values are 0-range.
-<code>PI_MIN_DUTYCYCLE_RANGE&nbsp;25<br>PI_MAX_DUTYCYCLE_RANGE&nbsp;40000<br></code><h3><a name="*retBuf">*retBuf</a></h3>
-A buffer to hold a number of bytes returned to a used customised function,
-<h3><a name="retMax">retMax</a></h3>
-The maximum number of bytes a user customised function should return.
-<h3><a name="*rxBuf">*rxBuf</a></h3>
-A pointer to a buffer to receive data.
-<h3><a name="SCL">SCL</a></h3>
-The user GPIO to use for the clock when bit banging I2C.
-<h3><a name="*script">*script</a></h3>
-A pointer to the text of a script.
-<h3><a name="script_id">script_id</a></h3>
-An id of a stored script as returned by <a href="#store_script">store_script</a>.
-<h3><a name="SDA">SDA</a></h3>
-The user GPIO to use for data when bit banging I2C.
-<h3><a name="seconds">seconds</a></h3>
-The number of seconds.
-<h3><a name="ser_flags">ser_flags</a></h3>
-Flags which modify a serial open command. None are currently defined.
-<h3><a name="*ser_tty">*ser_tty</a></h3>
-The name of a serial tty device, e.g. /dev/ttyAMA0, /dev/ttyUSB0, /dev/tty1.
-<h3><a name="size_t">size_t</a></h3>
-A standard type used to indicate the size of an object in bytes.
-<h3><a name="spi_channel">spi_channel</a></h3>
-A SPI channel, 0-2.
-<h3><a name="spi_flags">spi_flags</a></h3>
-See <a href="#spi_open">spi_open</a>.
-<h3><a name="steady">steady</a>: 0-300000</h3>
-The number of microseconds level changes must be stable for
-before reporting the level changed (<a href="#set_glitch_filter">set_glitch_filter</a>) or triggering
-the active part of a noise filter (<a href="#set_noise_filter">set_noise_filter</a>).
-<h3><a name="stop_bits">stop_bits</a>: 2-8</h3>
-The number of (half) stop bits to be used when adding serial data
-to a waveform.
-<br><br><code>#define&nbsp;PI_MIN_WAVE_HALFSTOPBITS&nbsp;2<br>#define&nbsp;PI_MAX_WAVE_HALFSTOPBITS&nbsp;8<br></code><h3><a name="*str">*str</a></h3>
- An array of characters.
-<h3><a name="thread_func">thread_func</a></h3>
-A function of type gpioThreadFunc_t used as the main function of a
-thread.
-<h3><a name="timeout">timeout</a></h3>
-A GPIO watchdog timeout in milliseconds.
-<code>PI_MIN_WDOG_TIMEOUT&nbsp;0<br>PI_MAX_WDOG_TIMEOUT&nbsp;60000<br></code><h3><a name="*txBuf">*txBuf</a></h3>
-An array of bytes to transmit.
-<h3><a name="uint32_t">uint32_t</a>: 0-0-4,294,967,295 (Hex 0x0-0xFFFFFFFF)</h3>
-A 32-bit unsigned value.
-<h3><a name="unsigned">unsigned</a></h3>
-A whole number &gt;= 0.
-<h3><a name="user_gpio">user_gpio</a></h3>
-0-31, a Broadcom numbered GPIO.
-<br><br>See <a href="#gpio">gpio</a>.
-<h3><a name="*userdata">*userdata</a></h3>
-A pointer to arbitrary user data. This may be used to identify the instance.
-<h3><a name="void">void</a></h3>
-Denoting no parameter is required
-<h3><a name="wave_add_*">wave_add_*</a></h3>
-One of <a href="#wave_add_new">wave_add_new</a>, <a href="#wave_add_generic">wave_add_generic</a>, <a href="#wave_add_serial">wave_add_serial</a>.
-<h3><a name="wave_id">wave_id</a></h3>
-A number representing a waveform created by <a href="#wave_create">wave_create</a>.
-<h3><a name="wave_send_*">wave_send_*</a></h3>
-One of <a href="#wave_send_once">wave_send_once</a>, <a href="#wave_send_repeat">wave_send_repeat</a>.
-<h3><a name="wVal">wVal</a>: 0-65535 (Hex 0x0-0xFFFF, Octal 0-0177777)</h3>
-A 16-bit word value.
-<h2>pigpiod_if Error Codes</h2><code><br>typedef&nbsp;enum<br>{<br>&nbsp;&nbsp;&nbsp;pigif_bad_send&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2000,<br>&nbsp;&nbsp;&nbsp;pigif_bad_recv&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2001,<br>&nbsp;&nbsp;&nbsp;pigif_bad_getaddrinfo&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2002,<br>&nbsp;&nbsp;&nbsp;pigif_bad_connect&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2003,<br>&nbsp;&nbsp;&nbsp;pigif_bad_socket&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2004,<br>&nbsp;&nbsp;&nbsp;pigif_bad_noib&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2005,<br>&nbsp;&nbsp;&nbsp;pigif_duplicate_callback&nbsp;=&nbsp;-2006,<br>&nbsp;&nbsp;&nbsp;pigif_bad_malloc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2007,<br>&nbsp;&nbsp;&nbsp;pigif_bad_callback&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2008,<br>&nbsp;&nbsp;&nbsp;pigif_notify_failed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2009,<br>&nbsp;&nbsp;&nbsp;pigif_callback_not_found&nbsp;=&nbsp;-2010,<br>}&nbsp;pigifError_t;<br><br></code></td>
-</table>
-<div style="vertical-align: center; text-align: center; background-color:#98bf21; font-size:0.8em; height:30px"><a class="l2" href="index.html">[pigpio]</a>
-<a class="l2" href="cif.html">[pigpio C I/F]</a>
-<a class="l2" href="pigpiod.html">[pigpiod]</a>
-<a class="l2" href="pdif2.html">[pigpiod C I/F]</a>
-<a class="l2" href="python.html">[Python]</a>
-<a class="l2" href="pigs.html">[pigs]</a>
-<a class="l2" href="piscope.html">[piscope]</a>
-<a class="l2" href="misc.html">[Misc]</a>
-<a class="l2" href="examples.html">[Examples]</a>
-<a class="l2" href="download.html">[Download]</a>
-<a class="l2" href="faq.html">[FAQ]</a>
-<a class="l2" href="sitemap.html">[Site Map]</a>
-</div>
-<table><tr>
-<td style="width: 200px"><div style="text-align: left;"><small>&copy; 2012-2020</small></div></td>
-<td style="width: 350px"><div style="text-align: center;">e-mail: pigpio @ abyz.me.uk</div></td>
-<td style="width: 200px"><div style="text-align: right;"><small>Updated: 30/04/2020</small></div></td>
-</tr></table>
-</td>
-</table>
-</body>
-</html>
diff --git a/DOC/HTML/pdif2.html b/DOC/HTML/pdif2.html
deleted file mode 100644
index db30a8c..0000000
--- a/DOC/HTML/pdif2.html
+++ /dev/null
@@ -1,1523 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta name="description" content="Raspberry Pi Reg. C GPIO library and Python GPIO module and shell command utilities to control the GPIO, including SPI, I2C, and serial links." />
- <meta name="keywords" content="raspberry, pi, C, Python, GPIO, library, shell, command, utilities, module, SPI, I2C, serial" />
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>pigpio library</title>
- <link rel="stylesheet" type="text/css" href="scripts/index.css">
- <link rel="icon" href="favicon.ico" type="image/x-icon">
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
-</head>
-<body>
-
-<table style="padding:0px; border:0px; margin:0px; width:780px; background-color:#e0e0e0;">
-<td style="background:#EAF2E6 url('images/sidebar.gif') repeat-y; width:35px; height:100%"></td>
-<td>
-<table>
-<div style="background:url('images/topbar.gif') repeat-x; height: 70px; font-size:1.5em; vertical-align: top;"><a href="index.html"><img src="images/pigpio-logo.gif" border="0" /></a>pigpio library</div>
-</table>
-<table><div>
-<td><img src="images/rf-rx.jpg" width="250"></td>
-<td><img src="images/stepper.jpg" width="250"></td>
-<td><img src="images/keypad.jpg" width="250"></td>
-</div></table>
-<table>
-<td style="vertical-align: top; background-color: #98bf21;"><a class="l1" href="index.html">pigpio</a>
-<a class="l1" href="cif.html">pigpio C I/F</a>
-<a class="l1" href="pigpiod.html">pigpiod</a>
-<a class="l1" href="pdif2.html">pigpiod C I/F</a>
-<a class="l1" href="python.html">Python</a>
-<a class="l1" href="pigs.html">pigs</a>
-<a class="l1" href="piscope.html">piscope</a>
-<a class="l1" href="misc.html">Misc</a>
-<a class="l1" href="examples.html">Examples</a>
-<a class="l1" href="download.html">Download</a>
-<a class="l1" href="faq.html">FAQ</a>
-<a class="l1" href="sitemap.html">Site Map</a>
-</td>
-<td><center><h2>pigpiod C Interface</h2></center><br><br>pigpiod_if2 is a C library for the Raspberry which allows control
-of the GPIO via the socket interface to the pigpio daemon.<br>
-<h3>Features</h3>o hardware timed PWM on any of GPIO 0-31
-<br><br>o hardware timed servo pulses on any of GPIO 0-31
-<br><br>o callbacks when any of GPIO 0-31 change state
-<br><br>o callbacks at timed intervals
-<br><br>o reading/writing all of the GPIO in a bank as one operation
-<br><br>o individually setting GPIO modes, reading and writing
-<br><br>o notifications when any of GPIO 0-31 change state
-<br><br>o the construction of output waveforms with microsecond timing
-<br><br>o rudimentary permission control over GPIO
-<br><br>o a simple interface to start and stop new threads
-<br><br>o I2C, SPI, and serial link wrappers
-<br><br>o creating and running scripts on the pigpio daemon
-<h3>GPIO</h3>ALL GPIO are identified by their Broadcom number.
-<h3>Notes</h3>The PWM and servo pulses are timed using the DMA and PWM/PCM peripherals.
-<h3>Usage</h3>Include &lt;pigpiod_if2.h&gt; in your source files.
-<br><br>Assuming your source is in prog.c use the following command to build
-<br><br><code>gcc&nbsp;-Wall&nbsp;-pthread&nbsp;-o&nbsp;prog&nbsp;prog.c&nbsp;-lpigpiod_if2&nbsp;-lrt<br></code><br><br>to run make sure the pigpio daemon is running
-<br><br><code>sudo&nbsp;pigpiod<br><br>&nbsp;./prog&nbsp;#&nbsp;sudo&nbsp;is&nbsp;not&nbsp;required&nbsp;to&nbsp;run&nbsp;programs&nbsp;linked&nbsp;to&nbsp;pigpiod_if2<br></code><br><br>For examples see x_pigpiod_if2.c within the pigpio archive file.
-<h3>Notes</h3>All the functions which return an int return &lt; 0 on error
-<h2>OVERVIEW</h2><table border="0" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td></td></tr><tr><td><b>ESSENTIAL
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#pigpio_start">pigpio_start</a></td><td> Connects to a pigpio daemon
-</td></tr><tr><td><a href="#pigpio_stop">pigpio_stop</a></td><td> Disconnects from a pigpio daemon
-</td></tr><tr><td></td><td></td></tr><tr><td><b>BASIC
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_mode">set_mode</a></td><td> Set a GPIO mode
-</td></tr><tr><td><a href="#get_mode">get_mode</a></td><td> Get a GPIO mode
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_pull_up_down">set_pull_up_down</a></td><td> Set/clear GPIO pull up/down resistor
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpio_read">gpio_read</a></td><td> Read a GPIO
-</td></tr><tr><td><a href="#gpio_write">gpio_write</a></td><td> Write a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>PWM (overrides servo commands on same GPIO)
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_PWM_dutycycle">set_PWM_dutycycle</a></td><td> Start/stop PWM pulses on a GPIO
-</td></tr><tr><td><a href="#set_PWM_frequency">set_PWM_frequency</a></td><td> Configure PWM frequency for a GPIO
-</td></tr><tr><td><a href="#set_PWM_range">set_PWM_range</a></td><td> Configure PWM range for a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_PWM_dutycycle">get_PWM_dutycycle</a></td><td> Get the PWM dutycycle in use on a GPIO
-</td></tr><tr><td><a href="#get_PWM_frequency">get_PWM_frequency</a></td><td> Get configured PWM frequency for a GPIO
-</td></tr><tr><td><a href="#get_PWM_range">get_PWM_range</a></td><td> Get configured PWM range for a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_PWM_real_range">get_PWM_real_range</a></td><td> Get underlying PWM range for a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Servo (overrides PWM commands on same GPIO)
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_servo_pulsewidth">set_servo_pulsewidth</a></td><td> Start/stop servo pulses on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_servo_pulsewidth">get_servo_pulsewidth</a></td><td> Get the servo pulsewidth in use on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>INTERMEDIATE
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpio_trigger">gpio_trigger</a></td><td> Send a trigger pulse to a GPIO.
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_watchdog">set_watchdog</a></td><td> Set a watchdog on a GPIO.
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#read_bank_1">read_bank_1</a></td><td> Read all GPIO in bank 1
-</td></tr><tr><td><a href="#read_bank_2">read_bank_2</a></td><td> Read all GPIO in bank 2
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#clear_bank_1">clear_bank_1</a></td><td> Clear selected GPIO in bank 1
-</td></tr><tr><td><a href="#clear_bank_2">clear_bank_2</a></td><td> Clear selected GPIO in bank 2
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_bank_1">set_bank_1</a></td><td> Set selected GPIO in bank 1
-</td></tr><tr><td><a href="#set_bank_2">set_bank_2</a></td><td> Set selected GPIO in bank 2
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#callback">callback</a></td><td> Create GPIO level change callback
-</td></tr><tr><td><a href="#callback_ex">callback_ex</a></td><td> Create GPIO level change callback, extended
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#callback_cancel">callback_cancel</a></td><td> Cancel a callback
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wait_for_edge">wait_for_edge</a></td><td> Wait for GPIO level change
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#start_thread">start_thread</a></td><td> Start a new thread
-</td></tr><tr><td><a href="#stop_thread">stop_thread</a></td><td> Stop a previously started thread
-</td></tr><tr><td></td><td></td></tr><tr><td><b>ADVANCED
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#notify_open">notify_open</a></td><td> Request a notification handle
-</td></tr><tr><td><a href="#notify_begin">notify_begin</a></td><td> Start notifications for selected GPIO
-</td></tr><tr><td><a href="#notify_pause">notify_pause</a></td><td> Pause notifications
-</td></tr><tr><td><a href="#notify_close">notify_close</a></td><td> Close a notification
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#hardware_clock">hardware_clock</a></td><td> Start hardware clock on supported GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#hardware_PWM">hardware_PWM</a></td><td> Start hardware PWM on supported GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_glitch_filter">set_glitch_filter</a></td><td> Set a glitch filter on a GPIO
-</td></tr><tr><td><a href="#set_noise_filter">set_noise_filter</a></td><td> Set a noise filter on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_pad_strength">set_pad_strength</a></td><td> Sets a pads drive strength
-</td></tr><tr><td><a href="#get_pad_strength">get_pad_strength</a></td><td> Gets a pads drive strength
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#shell_">shell_</a></td><td> Executes a shell command
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Custom
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#custom_1">custom_1</a></td><td> User custom function 1
-</td></tr><tr><td><a href="#custom_2">custom_2</a></td><td> User custom function 2
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Events
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#event_callback">event_callback</a></td><td> Sets a callback for an event
-</td></tr><tr><td><a href="#event_callback_ex">event_callback_ex</a></td><td> Sets a callback for an event, extended
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#event_callback_cancel">event_callback_cancel</a></td><td> Cancel an event callback
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#event_trigger">event_trigger</a></td><td> Triggers an event
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wait_for_event">wait_for_event</a></td><td> Wait for an event
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Scripts
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#store_script">store_script</a></td><td> Store a script
-</td></tr><tr><td><a href="#run_script">run_script</a></td><td> Run a stored script
-</td></tr><tr><td><a href="#update_script">update_script</a></td><td> Set a scripts parameters
-</td></tr><tr><td><a href="#script_status">script_status</a></td><td> Get script status and parameters
-</td></tr><tr><td><a href="#stop_script">stop_script</a></td><td> Stop a running script
-</td></tr><tr><td><a href="#delete_script">delete_script</a></td><td> Delete a stored script
-</td></tr><tr><td></td><td></td></tr><tr><td><b>I2C
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_open">i2c_open</a></td><td> Opens an I2C device
-</td></tr><tr><td><a href="#i2c_close">i2c_close</a></td><td> Closes an I2C device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_write_quick">i2c_write_quick</a></td><td> smbus write quick
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_byte">i2c_read_byte</a></td><td> smbus read byte
-</td></tr><tr><td><a href="#i2c_write_byte">i2c_write_byte</a></td><td> smbus write byte
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_byte_data">i2c_read_byte_data</a></td><td> smbus read byte data
-</td></tr><tr><td><a href="#i2c_write_byte_data">i2c_write_byte_data</a></td><td> smbus write byte data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_word_data">i2c_read_word_data</a></td><td> smbus read word data
-</td></tr><tr><td><a href="#i2c_write_word_data">i2c_write_word_data</a></td><td> smbus write word data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_block_data">i2c_read_block_data</a></td><td> smbus read block data
-</td></tr><tr><td><a href="#i2c_write_block_data">i2c_write_block_data</a></td><td> smbus write block data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_i2c_block_data">i2c_read_i2c_block_data</a></td><td> smbus read I2C block data
-</td></tr><tr><td><a href="#i2c_write_i2c_block_data">i2c_write_i2c_block_data</a></td><td> smbus write I2C block data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_device">i2c_read_device</a></td><td> Reads the raw I2C device
-</td></tr><tr><td><a href="#i2c_write_device">i2c_write_device</a></td><td> Writes the raw I2C device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_process_call">i2c_process_call</a></td><td> smbus process call
-</td></tr><tr><td><a href="#i2c_block_process_call">i2c_block_process_call</a></td><td> smbus block process call
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_zip">i2c_zip</a></td><td> Performs multiple I2C transactions
-</td></tr><tr><td></td><td></td></tr><tr><td><b>I2C BIT BANG
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_i2c_open">bb_i2c_open</a></td><td> Opens GPIO for bit banging I2C
-</td></tr><tr><td><a href="#bb_i2c_close">bb_i2c_close</a></td><td> Closes GPIO for bit banging I2C
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_i2c_zip">bb_i2c_zip</a></td><td> Performs bit banged I2C transactions
-</td></tr><tr><td></td><td></td></tr><tr><td><b>I2C/SPI SLAVE
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#bsc_xfer">bsc_xfer</a></td><td> I2C/SPI as slave transfer
-</td></tr><tr><td><a href="#bsc_i2c">bsc_i2c</a></td><td> I2C as slave transfer
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SERIAL
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#serial_open">serial_open</a></td><td> Opens a serial device
-</td></tr><tr><td><a href="#serial_close">serial_close</a></td><td> Closes a serial device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#serial_read_byte">serial_read_byte</a></td><td> Reads a byte from a serial device
-</td></tr><tr><td><a href="#serial_write_byte">serial_write_byte</a></td><td> Writes a byte to a serial device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#serial_read">serial_read</a></td><td> Reads bytes from a serial device
-</td></tr><tr><td><a href="#serial_write">serial_write</a></td><td> Writes bytes to a serial device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#serial_data_available">serial_data_available</a></td><td> Returns number of bytes ready to be read
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SERIAL BIT BANG (read only)
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_serial_read_open">bb_serial_read_open</a></td><td> Opens a GPIO for bit bang serial reads
-</td></tr><tr><td><a href="#bb_serial_read_close">bb_serial_read_close</a></td><td> Closes a GPIO for bit bang serial reads
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_serial_invert">bb_serial_invert</a></td><td> Invert serial logic (1 invert, 0 normal)
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_serial_read">bb_serial_read</a></td><td> Reads bit bang serial data from a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SPI
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#spi_open">spi_open</a></td><td> Opens a SPI device
-</td></tr><tr><td><a href="#spi_close">spi_close</a></td><td> Closes a SPI device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#spi_read">spi_read</a></td><td> Reads bytes from a SPI device
-</td></tr><tr><td><a href="#spi_write">spi_write</a></td><td> Writes bytes to a SPI device
-</td></tr><tr><td><a href="#spi_xfer">spi_xfer</a></td><td> Transfers bytes with a SPI device
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SPI BIT BANG
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_spi_open">bb_spi_open</a></td><td> Opens GPIO for bit banging SPI
-</td></tr><tr><td><a href="#bb_spi_close">bb_spi_close</a></td><td> Closes GPIO for bit banging SPI
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_spi_xfer">bb_spi_xfer</a></td><td> Transfers bytes with bit banging SPI
-</td></tr><tr><td></td><td></td></tr><tr><td><b>FILES
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#file_open">file_open</a></td><td> Opens a file
-</td></tr><tr><td><a href="#file_close">file_close</a></td><td> Closes a file
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#file_read">file_read</a></td><td> Reads bytes from a file
-</td></tr><tr><td><a href="#file_write">file_write</a></td><td> Writes bytes to a file
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#file_seek">file_seek</a></td><td> Seeks to a position within a file
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#file_list">file_list</a></td><td> List files which match a pattern
-</td></tr><tr><td></td><td></td></tr><tr><td><b>WAVES
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_clear">wave_clear</a></td><td> Deletes all waveforms
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_add_new">wave_add_new</a></td><td> Starts a new waveform
-</td></tr><tr><td><a href="#wave_add_generic">wave_add_generic</a></td><td> Adds a series of pulses to the waveform
-</td></tr><tr><td><a href="#wave_add_serial">wave_add_serial</a></td><td> Adds serial data to the waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_create">wave_create</a></td><td> Creates a waveform from added data
-</td></tr><tr><td><a href="#wave_create_and_pad">wave_create_and_pad</a></td><td> Creates a waveform of fixed size from added data
-</td></tr><tr><td><a href="#wave_delete">wave_delete</a></td><td> Deletes one or more waveforms
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_send_once">wave_send_once</a></td><td> Transmits a waveform once
-</td></tr><tr><td><a href="#wave_send_repeat">wave_send_repeat</a></td><td> Transmits a waveform repeatedly
-</td></tr><tr><td><a href="#wave_send_using_mode">wave_send_using_mode</a></td><td> Transmits a waveform in the chosen mode
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_chain">wave_chain</a></td><td> Transmits a chain of waveforms
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_tx_at">wave_tx_at</a></td><td> Returns the current transmitting waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_tx_busy">wave_tx_busy</a></td><td> Checks to see if the waveform has ended
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_tx_stop">wave_tx_stop</a></td><td> Aborts the current waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_get_cbs">wave_get_cbs</a></td><td> Length in cbs of the current waveform
-</td></tr><tr><td><a href="#wave_get_high_cbs">wave_get_high_cbs</a></td><td> Length of longest waveform so far
-</td></tr><tr><td><a href="#wave_get_max_cbs">wave_get_max_cbs</a></td><td> Absolute maximum allowed cbs
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_get_micros">wave_get_micros</a></td><td> Length in micros of the current waveform
-</td></tr><tr><td><a href="#wave_get_high_micros">wave_get_high_micros</a></td><td> Length of longest waveform so far
-</td></tr><tr><td><a href="#wave_get_max_micros">wave_get_max_micros</a></td><td> Absolute maximum allowed micros
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_get_pulses">wave_get_pulses</a></td><td> Length in pulses of the current waveform
-</td></tr><tr><td><a href="#wave_get_high_pulses">wave_get_high_pulses</a></td><td> Length of longest waveform so far
-</td></tr><tr><td><a href="#wave_get_max_pulses">wave_get_max_pulses</a></td><td> Absolute maximum allowed pulses
-</td></tr><tr><td></td><td></td></tr><tr><td><b>UTILITIES
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_current_tick">get_current_tick</a></td><td> Get current tick (microseconds)
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_hardware_revision">get_hardware_revision</a></td><td> Get hardware revision
-</td></tr><tr><td><a href="#get_pigpio_version">get_pigpio_version</a></td><td> Get the pigpio version
-</td></tr><tr><td><a href="#pigpiod_if_version">pigpiod_if_version</a></td><td> Get the pigpiod_if2 version
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#pigpio_error">pigpio_error</a></td><td> Get a text description of an error code.
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#time_sleep">time_sleep</a></td><td> Sleeps for a float number of seconds
-</td></tr><tr><td><a href="#time_time">time_time</a></td><td> Float number of seconds since the epoch
-</td></tr><tr><td></td><td></td></tr></tbody></table><h2>FUNCTIONS</h2><h3><a name="time_time"></a><a href="#double"><small>double</small></a> time_time<small>(void)</small></h3>
-Return the current time in seconds since the Epoch.
-<h3><a name="time_sleep"></a><a href="#void"><small>void</small></a> time_sleep<small>(<a href="#double">double</a> <a href="#seconds">seconds</a>)</small></h3>
-Delay execution for a given number of seconds.
-<br><br><code>seconds:&nbsp;the&nbsp;number&nbsp;of&nbsp;seconds&nbsp;to&nbsp;delay.<br></code><h3><a name="pigpio_error"></a><a href="#char"><small>char</small></a> *pigpio_error<small>(<a href="#int">int</a> <a href="#errnum">errnum</a>)</small></h3>
-Return a text description for an error code.
-<br><br><code>errnum:&nbsp;the&nbsp;error&nbsp;code.<br></code><h3><a name="pigpiod_if_version"></a><a href="#unsigned"><small>unsigned</small></a> pigpiod_if_version<small>(void)</small></h3>
-Return the pigpiod_if2 version.
-<h3><a name="start_thread"></a><a href="#pthread_t"><small>pthread_t</small></a> *start_thread<small>(<a href="#gpioThreadFunc_t">gpioThreadFunc_t</a> <a href="#thread_func">thread_func</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-Starts a new thread of execution with thread_func as the main routine.
-<br><br><code>thread_func:&nbsp;the&nbsp;main&nbsp;function&nbsp;for&nbsp;the&nbsp;new&nbsp;thread.<br>&nbsp;&nbsp;&nbsp;userdata:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;an&nbsp;arbitrary&nbsp;argument.<br></code><br><br>Returns a pointer to pthread_t if OK, otherwise NULL.
-<br><br>The function is passed the single argument userdata.
-<br><br>The thread can be cancelled by passing the pointer to pthread_t to
-<a href="#stop_thread">stop_thread</a>.
-<h3><a name="stop_thread"></a><a href="#void"><small>void</small></a> stop_thread<small>(<a href="#pthread_t">pthread_t</a> <a href="#*pth">*pth</a>)</small></h3>
-Cancels the thread pointed at by pth.
-<br><br><code>pth:&nbsp;the&nbsp;thread&nbsp;to&nbsp;be&nbsp;stopped.<br></code><br><br>No value is returned.
-<br><br>The thread to be stopped should have been started with <a href="#start_thread">start_thread</a>.
-<h3><a name="pigpio_start"></a><a href="#int"><small>int</small></a> pigpio_start<small>(<a href="#char">char</a> <a href="#*addrStr">*addrStr</a>, <a href="#char">char</a> <a href="#*portStr">*portStr</a>)</small></h3>
-Connect to the pigpio daemon. Reserving command and
-notification streams.
-<br><br><code>addrStr:&nbsp;specifies&nbsp;the&nbsp;host&nbsp;or&nbsp;IP&nbsp;address&nbsp;of&nbsp;the&nbsp;Pi&nbsp;running&nbsp;the<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pigpio&nbsp;daemon.&nbsp;&nbsp;It&nbsp;may&nbsp;be&nbsp;NULL&nbsp;in&nbsp;which&nbsp;case&nbsp;localhost<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is&nbsp;used&nbsp;unless&nbsp;overridden&nbsp;by&nbsp;the&nbsp;PIGPIO_ADDR&nbsp;environment<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;variable.<br><br>portStr:&nbsp;specifies&nbsp;the&nbsp;port&nbsp;address&nbsp;used&nbsp;by&nbsp;the&nbsp;Pi&nbsp;running&nbsp;the<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pigpio&nbsp;daemon.&nbsp;&nbsp;It&nbsp;may&nbsp;be&nbsp;NULL&nbsp;in&nbsp;which&nbsp;case&nbsp;"8888"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is&nbsp;used&nbsp;unless&nbsp;overridden&nbsp;by&nbsp;the&nbsp;PIGPIO_PORT&nbsp;environment<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;variable.<br></code><br><br>Returns an integer value greater than or equal to zero if OK.
-<br><br>This value is passed to the GPIO routines to specify the Pi
-to be operated on.
-<h3><a name="pigpio_stop"></a><a href="#void"><small>void</small></a> pigpio_stop<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-Terminates the connection to a pigpio daemon and releases
-resources used by the library.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><h3><a name="set_mode"></a><a href="#int"><small>int</small></a> set_mode<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#mode">mode</a>)</small></h3>
-Set the GPIO mode.
-<br><br><code>&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>gpio:&nbsp;0-53.<br>mode:&nbsp;PI_INPUT,&nbsp;PI_OUTPUT,&nbsp;PI_ALT0,&nbsp;PI_ALT1,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PI_ALT2,&nbsp;PI_ALT3,&nbsp;PI_ALT4,&nbsp;PI_ALT5.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_MODE,
-or PI_NOT_PERMITTED.
-<h3><a name="get_mode"></a><a href="#int"><small>int</small></a> get_mode<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>)</small></h3>
-Get the GPIO mode.
-<br><br><code>&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>gpio:&nbsp;0-53.<br></code><br><br>Returns the GPIO mode if OK, otherwise PI_BAD_GPIO.
-<h3><a name="set_pull_up_down"></a><a href="#int"><small>int</small></a> set_pull_up_down<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#pud">pud</a>)</small></h3>
-Set or clear the GPIO pull-up/down resistor.
-<br><br><code>&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>gpio:&nbsp;0-53.<br>&nbsp;pud:&nbsp;PI_PUD_UP,&nbsp;PI_PUD_DOWN,&nbsp;PI_PUD_OFF.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_PUD,
-or PI_NOT_PERMITTED.
-<h3><a name="gpio_read"></a><a href="#int"><small>int</small></a> gpio_read<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>)</small></h3>
-Read the GPIO level.
-<br><br><code>&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>gpio:0-53.<br></code><br><br>Returns the GPIO level if OK, otherwise PI_BAD_GPIO.
-<h3><a name="gpio_write"></a><a href="#int"><small>int</small></a> gpio_write<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#level">level</a>)</small></h3>
-Write the GPIO level.
-<br><br><code>&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;gpio:&nbsp;0-53.<br>level:&nbsp;0,&nbsp;1.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_LEVEL,
-or PI_NOT_PERMITTED.
-<br><br>Notes
-<br><br>If PWM or servo pulses are active on the GPIO they are switched off.
-<h3><a name="set_PWM_dutycycle"></a><a href="#int"><small>int</small></a> set_PWM_dutycycle<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#dutycycle">dutycycle</a>)</small></h3>
-Start (non-zero dutycycle) or stop (0) PWM pulses on the GPIO.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br>dutycycle:&nbsp;0-range&nbsp;(range&nbsp;defaults&nbsp;to&nbsp;255).<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_DUTYCYCLE,
-or PI_NOT_PERMITTED.
-Notes
-<br><br>The <a href="#set_PWM_range">set_PWM_range</a> function may be used to change the
-default range of 255.
-<h3><a name="get_PWM_dutycycle"></a><a href="#int"><small>int</small></a> get_PWM_dutycycle<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Return the PWM dutycycle in use on a GPIO.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_NOT_PWM_GPIO.
-<br><br>For normal PWM the dutycycle will be out of the defined range
-for the GPIO (see <a href="#get_PWM_range">get_PWM_range</a>).
-<br><br>If a hardware clock is active on the GPIO the reported dutycycle
-will be 500000 (500k) out of 1000000 (1M).
-<br><br>If hardware PWM is active on the GPIO the reported dutycycle
-will be out of a 1000000 (1M).
-<h3><a name="set_PWM_range"></a><a href="#int"><small>int</small></a> set_PWM_range<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#range">range</a>)</small></h3>
-Set the range of PWM values to be used on the GPIO.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;range:&nbsp;25-40000.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_DUTYRANGE,
-or PI_NOT_PERMITTED.
-<br><br>Notes
-<br><br>If PWM is currently active on the GPIO its dutycycle will be
-scaled to reflect the new range.
-<br><br>The real range, the number of steps between fully off and fully on
-for each of the 18 available GPIO frequencies is
-<br><br><code>&nbsp;&nbsp;25(#1),&nbsp;&nbsp;&nbsp;&nbsp;50(#2),&nbsp;&nbsp;&nbsp;100(#3),&nbsp;&nbsp;&nbsp;125(#4),&nbsp;&nbsp;&nbsp;&nbsp;200(#5),&nbsp;&nbsp;&nbsp;&nbsp;250(#6),<br>&nbsp;400(#7),&nbsp;&nbsp;&nbsp;500(#8),&nbsp;&nbsp;&nbsp;625(#9),&nbsp;&nbsp;&nbsp;800(#10),&nbsp;&nbsp;1000(#11),&nbsp;&nbsp;1250(#12),<br>2000(#13),&nbsp;2500(#14),&nbsp;4000(#15),&nbsp;5000(#16),&nbsp;10000(#17),&nbsp;20000(#18)<br></code><br><br>The real value set by set_PWM_range is (dutycycle * real range) / range.
-<h3><a name="get_PWM_range"></a><a href="#int"><small>int</small></a> get_PWM_range<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Get the range of PWM values being used on the GPIO.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br></code><br><br>Returns the dutycycle range used for the GPIO if OK,
-otherwise PI_BAD_USER_GPIO.
-<br><br>If a hardware clock or hardware PWM is active on the GPIO the
-reported range will be 1000000 (1M).
-<h3><a name="get_PWM_real_range"></a><a href="#int"><small>int</small></a> get_PWM_real_range<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Get the real underlying range of PWM values being used on the GPIO.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br></code><br><br>Returns the real range used for the GPIO if OK,
-otherwise PI_BAD_USER_GPIO.
-<br><br>If a hardware clock is active on the GPIO the reported
-real range will be 1000000 (1M).
-<br><br>If hardware PWM is active on the GPIO the reported real range
-will be approximately 250M divided by the set PWM frequency.
-<h3><a name="set_PWM_frequency"></a><a href="#int"><small>int</small></a> set_PWM_frequency<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#frequency">frequency</a>)</small></h3>
-Set the frequency (in Hz) of the PWM to be used on the GPIO.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br>frequency:&nbsp;&gt;=0&nbsp;(Hz).<br></code><br><br>Returns the numerically closest frequency if OK, otherwise
-PI_BAD_USER_GPIO or PI_NOT_PERMITTED.
-<br><br>If PWM is currently active on the GPIO it will be switched
-off and then back on at the new frequency.
-<br><br>Each GPIO can be independently set to one of 18 different
-PWM frequencies.
-<br><br>The selectable frequencies depend upon the sample rate which
-may be 1, 2, 4, 5, 8, or 10 microseconds (default 5). The
-sample rate is set when the pigpio daemon is started.
-<br><br>The frequencies for each sample rate are:
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hertz<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1:&nbsp;40000&nbsp;20000&nbsp;10000&nbsp;8000&nbsp;5000&nbsp;4000&nbsp;2500&nbsp;2000&nbsp;1600<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1250&nbsp;&nbsp;1000&nbsp;&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;50<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2:&nbsp;20000&nbsp;10000&nbsp;&nbsp;5000&nbsp;4000&nbsp;2500&nbsp;2000&nbsp;1250&nbsp;1000&nbsp;&nbsp;800<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;625&nbsp;&nbsp;&nbsp;500&nbsp;&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;125&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;25<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4:&nbsp;10000&nbsp;&nbsp;5000&nbsp;&nbsp;2500&nbsp;2000&nbsp;1250&nbsp;1000&nbsp;&nbsp;625&nbsp;&nbsp;500&nbsp;&nbsp;400<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;313&nbsp;&nbsp;&nbsp;250&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;125&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;63&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;13<br>sample<br>&nbsp;rate<br>&nbsp;(us)&nbsp;&nbsp;5:&nbsp;&nbsp;8000&nbsp;&nbsp;4000&nbsp;&nbsp;2000&nbsp;1600&nbsp;1000&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;320<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;250&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;&nbsp;160&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;80&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;&nbsp;20&nbsp;&nbsp;&nbsp;10<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8:&nbsp;&nbsp;5000&nbsp;&nbsp;2500&nbsp;&nbsp;1250&nbsp;1000&nbsp;&nbsp;625&nbsp;&nbsp;500&nbsp;&nbsp;313&nbsp;&nbsp;250&nbsp;&nbsp;200<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;156&nbsp;&nbsp;&nbsp;125&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;63&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;31&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;13&nbsp;&nbsp;&nbsp;&nbsp;6<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10:&nbsp;&nbsp;4000&nbsp;&nbsp;2000&nbsp;&nbsp;1000&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;160<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;125&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;&nbsp;80&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;20&nbsp;&nbsp;&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;5<br></code><h3><a name="get_PWM_frequency"></a><a href="#int"><small>int</small></a> get_PWM_frequency<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Get the frequency of PWM being used on the GPIO.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br></code><br><br>For normal PWM the frequency will be that defined for the GPIO by
-<a href="#set_PWM_frequency">set_PWM_frequency</a>.
-<br><br>If a hardware clock is active on the GPIO the reported frequency
-will be that set by <a href="#hardware_clock">hardware_clock</a>.
-<br><br>If hardware PWM is active on the GPIO the reported frequency
-will be that set by <a href="#hardware_PWM">hardware_PWM</a>.
-<br><br>Returns the frequency (in hertz) used for the GPIO if OK,
-otherwise PI_BAD_USER_GPIO.
-<h3><a name="set_servo_pulsewidth"></a><a href="#int"><small>int</small></a> set_servo_pulsewidth<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#pulsewidth">pulsewidth</a>)</small></h3>
-Start (500-2500) or stop (0) servo pulses on the GPIO.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;user_gpio:&nbsp;0-31.<br>pulsewidth:&nbsp;0&nbsp;(off),&nbsp;500&nbsp;(anti-clockwise)&nbsp;-&nbsp;2500&nbsp;(clockwise).<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_PULSEWIDTH or
-PI_NOT_PERMITTED.
-<br><br>The selected pulsewidth will continue to be transmitted until
-changed by a subsequent call to set_servo_pulsewidth.
-<br><br>The pulsewidths supported by servos varies and should probably be
-determined by experiment. A value of 1500 should always be safe and
-represents the mid-point of rotation.
-<br><br>You can DAMAGE a servo if you command it to move beyond its limits.
-<br><br>OTHER UPDATE RATES:
-<br><br>This function updates servos at 50Hz. If you wish to use a different
-update frequency you will have to use the PWM functions.
-<br><br><code>Update&nbsp;Rate&nbsp;(Hz)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;200&nbsp;&nbsp;400&nbsp;&nbsp;500<br>1E6/Hz&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;20000&nbsp;10000&nbsp;5000&nbsp;2500&nbsp;2000<br></code><br><br>Firstly set the desired PWM frequency using <a href="#set_PWM_frequency">set_PWM_frequency</a>.
-<br><br>Then set the PWM range using <a href="#set_PWM_range">set_PWM_range</a> to 1E6/Hz.
-Doing this allows you to use units of microseconds when setting
-the servo pulsewidth.
-<br><br>E.g. If you want to update a servo connected to GPIO 25 at 400Hz
-<br><br><code>set_PWM_frequency(25,&nbsp;400);<br>set_PWM_range(25,&nbsp;2500);<br></code><br><br>Thereafter use the <a href="#set_PWM_dutycycle">set_PWM_dutycycle</a> function to move the servo,
-e.g. set_PWM_dutycycle(25, 1500) will set a 1500 us pulse.<br>
-<h3><a name="get_servo_pulsewidth"></a><a href="#int"><small>int</small></a> get_servo_pulsewidth<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Return the servo pulsewidth in use on a GPIO.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_NOT_SERVO_GPIO.
-<h3><a name="notify_open"></a><a href="#int"><small>int</small></a> notify_open<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-Get a free notification handle.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><br><br>Returns a handle greater than or equal to zero if OK,
-otherwise PI_NO_HANDLE.
-<br><br>A notification is a method for being notified of GPIO state
-changes via a pipe.
-<br><br>Pipes are only accessible from the local machine so this function
-serves no purpose if you are using the library from a remote machine.
-The in-built (socket) notifications provided by <a href="#callback">callback</a>
-should be used instead.
-<br><br>Notifications for handle x will be available at the pipe
-named /dev/pigpiox (where x is the handle number).
-E.g. if the function returns 15 then the notifications must be
-read from /dev/pigpio15.
-<h3><a name="notify_begin"></a><a href="#int"><small>int</small></a> notify_begin<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Start notifications on a previously opened handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;0-31&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#notify_open">notify_open</a>)<br>&nbsp;&nbsp;bits:&nbsp;a&nbsp;mask&nbsp;indicating&nbsp;the&nbsp;GPIO&nbsp;to&nbsp;be&nbsp;notified.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<br><br>The notification sends state changes for each GPIO whose
-corresponding bit in bits is set.
-<br><br>Each notification occupies 12 bytes in the fifo as follows:
-<br><br><code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;seqno;<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;flags;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;tick;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;level;<br>}&nbsp;gpioReport_t;<br></code><br><br>seqno: starts at 0 each time the handle is opened and then increments
-by one for each report.
-<br><br>flags: three flags are defined, PI_NTFY_FLAGS_WDOG,
-PI_NTFY_FLAGS_ALIVE, and PI_NTFY_FLAGS_EVENT.
-<br><br>If bit 5 is set (PI_NTFY_FLAGS_WDOG) then bits 0-4 of the flags
-indicate a GPIO which has had a watchdog timeout.
-<br><br>If bit 6 is set (PI_NTFY_FLAGS_ALIVE) this indicates a keep alive
-signal on the pipe/socket and is sent once a minute in the absence
-of other notification activity.
-<br><br>If bit 7 is set (PI_NTFY_FLAGS_EVENT) then bits 0-4 of the flags
-indicate an event which has been triggered.
-<br><br>tick: the number of microseconds since system boot. It wraps around
-after 1h12m.
-<br><br>level: indicates the level of each GPIO. If bit 1&lt;&lt;x is set then
-GPIO x is high.
-<h3><a name="notify_pause"></a><a href="#int"><small>int</small></a> notify_pause<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-Pause notifications on a previously opened handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;0-31&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#notify_open">notify_open</a>)<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<br><br>Notifications for the handle are suspended until
-<a href="#notify_begin">notify_begin</a> is called again.
-<h3><a name="notify_close"></a><a href="#int"><small>int</small></a> notify_close<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-Stop notifications on a previously opened handle and
-release the handle for reuse.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;0-31&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#notify_open">notify_open</a>)<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<h3><a name="set_watchdog"></a><a href="#int"><small>int</small></a> set_watchdog<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#timeout">timeout</a>)</small></h3>
-Sets a watchdog for a GPIO.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;timeout:&nbsp;0-60000.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO
-or PI_BAD_WDOG_TIMEOUT.
-<br><br>The watchdog is nominally in milliseconds.
-<br><br>Only one watchdog may be registered per GPIO.
-<br><br>The watchdog may be cancelled by setting timeout to 0.
-<br><br>Once a watchdog has been started callbacks for the GPIO will be
-triggered every timeout interval after the last GPIO activity.
-<br><br>The callback will receive the special level PI_TIMEOUT.
-<h3><a name="set_glitch_filter"></a><a href="#int"><small>int</small></a> set_glitch_filter<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#steady">steady</a>)</small></h3>
-Sets a glitch filter on a GPIO.
-<br><br>Level changes on the GPIO are not reported unless the level
-has been stable for at least <a href="#steady">steady</a> microseconds. The
-level is then reported. Level changes of less than
-<a href="#steady">steady</a> microseconds are ignored.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;steady:&nbsp;0-300000<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
-<br><br>This filter affects the GPIO samples returned to callbacks set up
-with <a href="#callback">callback</a>, <a href="#callback_ex">callback_ex</a> and <a href="#wait_for_edge">wait_for_edge</a>.
-<br><br>It does not affect levels read by <a href="#gpio_read">gpio_read</a>,
-<a href="#read_bank_1">read_bank_1</a>, or <a href="#read_bank_2">read_bank_2</a>.
-<br><br>Each (stable) edge will be timestamped <a href="#steady">steady</a> microseconds
-after it was first detected.
-<h3><a name="set_noise_filter"></a><a href="#int"><small>int</small></a> set_noise_filter<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#steady">steady</a>, <a href="#unsigned">unsigned</a> <a href="#active">active</a>)</small></h3>
-Sets a noise filter on a GPIO.
-<br><br>Level changes on the GPIO are ignored until a level which has
-been stable for <a href="#steady">steady</a> microseconds is detected. Level changes
-on the GPIO are then reported for <a href="#active">active</a> microseconds after
-which the process repeats.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;steady:&nbsp;0-300000<br>&nbsp;&nbsp;&nbsp;active:&nbsp;0-1000000<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
-<br><br>This filter affects the GPIO samples returned to callbacks set up
-with <a href="#callback">callback</a>, <a href="#callback_ex">callback_ex</a> and <a href="#wait_for_edge">wait_for_edge</a>.
-<br><br>It does not affect levels read by <a href="#gpio_read">gpio_read</a>,
-<a href="#read_bank_1">read_bank_1</a>, or <a href="#read_bank_2">read_bank_2</a>.
-<br><br>Level changes before and after the active period may
-be reported. Your software must be designed to cope with
-such reports.
-<h3><a name="read_bank_1"></a><a href="#uint32_t"><small>uint32_t</small></a> read_bank_1<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-Read the levels of the bank 1 GPIO (GPIO 0-31).
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><br><br>The returned 32 bit integer has a bit set if the corresponding
-GPIO is logic 1. GPIO n has bit value (1&lt;&lt;n).
-<h3><a name="read_bank_2"></a><a href="#uint32_t"><small>uint32_t</small></a> read_bank_2<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-Read the levels of the bank 2 GPIO (GPIO 32-53).
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><br><br>The returned 32 bit integer has a bit set if the corresponding
-GPIO is logic 1. GPIO n has bit value (1&lt;&lt;(n-32)).
-<h3><a name="clear_bank_1"></a><a href="#int"><small>int</small></a> clear_bank_1<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Clears GPIO 0-31 if the corresponding bit in bits is set.
-<br><br><code>&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;cleared.<br></code><br><br>Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-<br><br>A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-<h3><a name="clear_bank_2"></a><a href="#int"><small>int</small></a> clear_bank_2<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Clears GPIO 32-53 if the corresponding bit (0-21) in bits is set.
-<br><br><code>&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;cleared.<br></code><br><br>Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-<br><br>A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-<h3><a name="set_bank_1"></a><a href="#int"><small>int</small></a> set_bank_1<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Sets GPIO 0-31 if the corresponding bit in bits is set.
-<br><br><code>&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;set.<br></code><br><br>Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-<br><br>A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-<h3><a name="set_bank_2"></a><a href="#int"><small>int</small></a> set_bank_2<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Sets GPIO 32-53 if the corresponding bit (0-21) in bits is set.
-<br><br><code>&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;set.<br></code><br><br>Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-<br><br>A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-<h3><a name="hardware_clock"></a><a href="#int"><small>int</small></a> hardware_clock<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#clkfreq">clkfreq</a>)</small></h3>
-Starts a hardware clock on a GPIO at the specified frequency.
-Frequencies above 30MHz are unlikely to work.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gpio:&nbsp;see&nbsp;description<br>frequency:&nbsp;0&nbsp;(off)&nbsp;or&nbsp;4689-250M&nbsp;(13184-375M&nbsp;for&nbsp;the&nbsp;BCM2711)<br></code><br><br>Returns 0 if OK, otherwise PI_NOT_PERMITTED, PI_BAD_GPIO,
-PI_NOT_HCLK_GPIO, PI_BAD_HCLK_FREQ,or PI_BAD_HCLK_PASS.
-<br><br>The same clock is available on multiple GPIO. The latest
-frequency setting will be used by all GPIO which share a clock.
-<br><br>The GPIO must be one of the following.
-<br><br><code>4&nbsp;&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;All&nbsp;models<br>5&nbsp;&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br>6&nbsp;&nbsp;&nbsp;clock&nbsp;2&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>20&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>21&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;Rev.2&nbsp;B&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br><br>32&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>34&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>42&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br>43&nbsp;&nbsp;clock&nbsp;2&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>44&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br></code><br><br>Access to clock 1 is protected by a password as its use will likely
-crash the Pi. The password is given by or'ing 0x5A000000 with the
-GPIO number.
-<h3><a name="hardware_PWM"></a><a href="#int"><small>int</small></a> hardware_PWM<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#PWMfreq">PWMfreq</a>, <a href="#uint32_t">uint32_t</a> <a href="#PWMduty">PWMduty</a>)</small></h3>
-Starts hardware PWM on a GPIO at the specified frequency and dutycycle.
-Frequencies above 30MHz are unlikely to work.
-<br><br>NOTE: Any waveform started by <a href="#wave_send_*">wave_send_*</a> or <a href="#wave_chain">wave_chain</a>
-will be cancelled.
-<br><br>This function is only valid if the pigpio main clock is PCM. The
-main clock defaults to PCM but may be overridden when the pigpio
-daemon is started (option -t).
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;&nbsp;gpio:&nbsp;see&nbsp;descripton<br>PWMfreq:&nbsp;0&nbsp;(off)&nbsp;or&nbsp;1-125M&nbsp;(1-187.5M&nbsp;for&nbsp;the&nbsp;BCM2711)<br>PWMduty:&nbsp;0&nbsp;(off)&nbsp;to&nbsp;1000000&nbsp;(1M)(fully&nbsp;on)<br></code><br><br>Returns 0 if OK, otherwise PI_NOT_PERMITTED, PI_BAD_GPIO,
-PI_NOT_HPWM_GPIO, PI_BAD_HPWM_DUTY, PI_BAD_HPWM_FREQ,
-or PI_HPWM_ILLEGAL.
-<br><br>The same PWM channel is available on multiple GPIO. The latest
-frequency and dutycycle setting will be used by all GPIO which
-share a PWM channel.
-<br><br>The GPIO must be one of the following.
-<br><br><code>12&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>13&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>18&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;All&nbsp;models<br>19&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br><br>40&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>41&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>45&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>52&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>53&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br></code><br><br>The actual number of steps beween off and fully on is the
-integral part of 250M/PWMfreq (375M/PWMfreq for the BCM2711).
-<br><br>The actual frequency set is 250M/steps (375M/steps for the BCM2711).
-<br><br>There will only be a million steps for a PWMfreq of 250 (375 for
-the BCM2711). Lower frequencies will have more steps and higher
-frequencies will have fewer steps. PWMduty is
-automatically scaled to take this into account.
-<h3><a name="get_current_tick"></a><a href="#uint32_t"><small>uint32_t</small></a> get_current_tick<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-Gets the current system tick.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><br><br>Tick is the number of microseconds since system boot.
-<br><br>As tick is an unsigned 32 bit quantity it wraps around after
-2**32 microseconds, which is approximately 1 hour 12 minutes.
-<h3><a name="get_hardware_revision"></a><a href="#uint32_t"><small>uint32_t</small></a> get_hardware_revision<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-Get the Pi's hardware revision number.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><br><br>The hardware revision is the last few characters on the Revision line
-of /proc/cpuinfo.
-<br><br>If the hardware revision can not be found or is not a valid
-hexadecimal number the function returns 0.
-<br><br>The revision number can be used to determine the assignment of GPIO
-to pins (see <a href="#gpio">gpio</a>).
-<br><br>There are at least three types of board.
-<br><br>Type 1 boards have hardware revision numbers of 2 and 3.
-<br><br>Type 2 boards have hardware revision numbers of 4, 5, 6, and 15.
-<br><br>Type 3 boards have hardware revision numbers of 16 or greater.
-<h3><a name="get_pigpio_version"></a><a href="#uint32_t"><small>uint32_t</small></a> get_pigpio_version<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-Returns the pigpio version.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><h3><a name="wave_clear"></a><a href="#int"><small>int</small></a> wave_clear<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function clears all waveforms and any data added by calls to the
-<a href="#wave_add_*">wave_add_*</a> functions.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><br><br>Returns 0 if OK.
-<h3><a name="wave_add_new"></a><a href="#int"><small>int</small></a> wave_add_new<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function starts a new empty waveform. You wouldn't normally need
-to call this function as it is automatically called after a waveform is
-created with the <a href="#wave_create">wave_create</a> function.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><br><br>Returns 0 if OK.
-<h3><a name="wave_add_generic"></a><a href="#int"><small>int</small></a> wave_add_generic<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#numPulses">numPulses</a>, <a href="#gpioPulse_t">gpioPulse_t</a> <a href="#*pulses">*pulses</a>)</small></h3>
-This function adds a number of pulses to the current waveform.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>numPulses:&nbsp;the&nbsp;number&nbsp;of&nbsp;pulses.<br>&nbsp;&nbsp;&nbsp;pulses:&nbsp;an&nbsp;array&nbsp;of&nbsp;pulses.<br></code><br><br>Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_TOO_MANY_PULSES.
-<br><br>The pulses are interleaved in time order within the existing waveform
-(if any).
-<br><br>Merging allows the waveform to be built in parts, that is the settings
-for GPIO#1 can be added, and then GPIO#2 etc.
-<br><br>If the added waveform is intended to start after or within the existing
-waveform then the first pulse should consist solely of a delay.
-<h3><a name="wave_add_serial"></a><a href="#int"><small>int</small></a> wave_add_serial<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#data_bits">data_bits</a>, <a href="#unsigned">unsigned</a> <a href="#stop_bits">stop_bits</a>, <a href="#unsigned">unsigned</a> <a href="#offset">offset</a>, <a href="#unsigned">unsigned</a> <a href="#numBytes">numBytes</a>, <a href="#char">char</a> <a href="#*str">*str</a>)</small></h3>
-This function adds a waveform representing serial data to the
-existing waveform (if any). The serial data starts offset
-microseconds from the start of the waveform.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;50-1000000<br>data_bits:&nbsp;number&nbsp;of&nbsp;data&nbsp;bits&nbsp;(1-32)<br>stop_bits:&nbsp;number&nbsp;of&nbsp;stop&nbsp;half&nbsp;bits&nbsp;(2-8)<br>&nbsp;&nbsp;&nbsp;offset:&nbsp;&gt;=0<br>&nbsp;numBytes:&nbsp;&gt;=1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str:&nbsp;an&nbsp;array&nbsp;of&nbsp;chars.<br></code><br><br>Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_BAD_USER_GPIO, PI_BAD_WAVE_BAUD, PI_BAD_DATABITS,
-PI_BAD_STOP_BITS, PI_TOO_MANY_CHARS, PI_BAD_SER_OFFSET,
-or PI_TOO_MANY_PULSES.
-<br><br>NOTES:
-<br><br>The serial data is formatted as one start bit, <a href="#data_bits">data_bits</a> data bits,
-and <a href="#stop_bits">stop_bits</a>/2 stop bits.
-<br><br>It is legal to add serial data streams with different baud rates to
-the same waveform.
-<br><br><a href="#numBytes">numBytes</a> is the number of bytes of data in str.
-<br><br>The bytes required for each character depend upon <a href="#data_bits">data_bits</a>.
-<br><br>For <a href="#data_bits">data_bits</a> 1-8 there will be one byte per character.<br>
-For <a href="#data_bits">data_bits</a> 9-16 there will be two bytes per character.<br>
-For <a href="#data_bits">data_bits</a> 17-32 there will be four bytes per character.
-<h3><a name="wave_create"></a><a href="#int"><small>int</small></a> wave_create<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function creates a waveform from the data provided by the prior
-calls to the <a href="#wave_add_*">wave_add_*</a> functions. Upon success a wave id
-greater than or equal to 0 is returned, otherwise PI_EMPTY_WAVEFORM,
-PI_TOO_MANY_CBS, PI_TOO_MANY_OOL, or PI_NO_WAVEFORM_ID.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><br><br>The data provided by the <a href="#wave_add_*">wave_add_*</a> functions is consumed by this
-function.
-<br><br>As many waveforms may be created as there is space available. The
-wave id is passed to <a href="#wave_send_*">wave_send_*</a> to specify the waveform to transmit.
-<br><br>Normal usage would be
-<br><br>Step 1. <a href="#wave_clear">wave_clear</a> to clear all waveforms and added data.
-<br><br>Step 2. <a href="#wave_add_*">wave_add_*</a> calls to supply the waveform data.
-<br><br>Step 3. <a href="#wave_create">wave_create</a> to create the waveform and get a unique id
-<br><br>Repeat steps 2 and 3 as needed.
-<br><br>Step 4. <a href="#wave_send_*">wave_send_*</a> with the id of the waveform to transmit.
-<br><br>A waveform comprises one or more pulses. Each pulse consists of a
-<a href="#gpioPulse_t">gpioPulse_t</a> structure.
-<br><br><code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOn;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOff;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;usDelay;<br>}&nbsp;gpioPulse_t;<br></code><br><br>The fields specify
-<br><br>1) the GPIO to be switched on at the start of the pulse.<br>
-2) the GPIO to be switched off at the start of the pulse.<br>
-3) the delay in microseconds before the next pulse.<br>
-<br><br>Any or all the fields can be zero. It doesn't make any sense to
-set all the fields to zero (the pulse will be ignored).
-<br><br>When a waveform is started each pulse is executed in order with the
-specified delay between the pulse and the next.
-<br><br>Returns the new waveform id if OK, otherwise PI_EMPTY_WAVEFORM,
-PI_NO_WAVEFORM_ID, PI_TOO_MANY_CBS, or PI_TOO_MANY_OOL.
-<h3><a name="wave_create_and_pad"></a><a href="#int"><small>int</small></a> wave_create_and_pad<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#int">int</a> <a href="#percent">percent</a>)</small></h3>
-This function creates a waveform like <a href="#wave_create">wave_create</a> but pads the consumed
-resources. Where percent gives the percentage of the resources to use (in terms
-of the theoretical maximum, not the current amount free). This allows the reuse<br>
-of deleted waves while a transmission is active.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>percent:&nbsp;0-100,&nbsp;size&nbsp;of&nbsp;waveform&nbsp;as&nbsp;percentage&nbsp;of&nbsp;maximum&nbsp;available.<br></code><br><br>The data provided by the <a href="#wave_add_*">wave_add_*</a> functions are consumed by this
-function.
-<br><br>As many waveforms may be created as there is space available. The
-wave id is passed to <a href="#wave_send_*">wave_send_*</a> to specify the waveform to transmit.
-<br><br>A usage would be the creation of two waves where one is filled while the other
-is being transmitted. Each wave is assigned 50% of the resources.
-This buffer structure allows the transmission of infinite wave sequences.
-<br><br>Normal usage:
-<br><br>Step 1. <a href="#wave_clear">wave_clear</a> to clear all waveforms and added data.
-<br><br>Step 2. <a href="#wave_add_*">wave_add_*</a> calls to supply the waveform data.
-<br><br>Step 3. <a href="#wave_create_and_pad">wave_create_and_pad</a> to create a waveform of uniform size.
-<br><br>Step 4. <a href="#wave_send_*">wave_send_*</a> with the id of the waveform to transmit.
-<br><br>Repeat steps 2-4 as needed.
-<br><br>Step 5. Any wave id can now be deleted and another wave of the same size
- can be created in its place.
-<br><br>Returns the new waveform id if OK, otherwise PI_EMPTY_WAVEFORM,
-PI_NO_WAVEFORM_ID, PI_TOO_MANY_CBS, or PI_TOO_MANY_OOL.
-<h3><a name="wave_delete"></a><a href="#int"><small>int</small></a> wave_delete<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#wave_id">wave_id</a>)</small></h3>
-This function deletes the waveform with id wave_id.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>wave_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#wave_create">wave_create</a>.<br></code><br><br>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.
-<h3><a name="wave_send_once"></a><a href="#int"><small>int</small></a> wave_send_once<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#wave_id">wave_id</a>)</small></h3>
-This function transmits the waveform with id wave_id. The waveform
-is sent once.
-<br><br>NOTE: Any hardware PWM started by <a href="#hardware_PWM">hardware_PWM</a> will be cancelled.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>wave_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#wave_create">wave_create</a>.<br></code><br><br>Returns the number of DMA control blocks in the waveform if OK,
-otherwise PI_BAD_WAVE_ID, or PI_BAD_WAVE_MODE.
-<h3><a name="wave_send_repeat"></a><a href="#int"><small>int</small></a> wave_send_repeat<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#wave_id">wave_id</a>)</small></h3>
-This function transmits the waveform with id wave_id. The waveform
-cycles until cancelled (either by the sending of a new waveform or
-by <a href="#wave_tx_stop">wave_tx_stop</a>).
-<br><br>NOTE: Any hardware PWM started by <a href="#hardware_PWM">hardware_PWM</a> will be cancelled.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>wave_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#wave_create">wave_create</a>.<br></code><br><br>Returns the number of DMA control blocks in the waveform if OK,
-otherwise PI_BAD_WAVE_ID, or PI_BAD_WAVE_MODE.
-<h3><a name="wave_send_using_mode"></a><a href="#int"><small>int</small></a> wave_send_using_mode<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#wave_id">wave_id</a>, <a href="#unsigned">unsigned</a> <a href="#mode">mode</a>)</small></h3>
-Transmits the waveform with id wave_id using mode mode.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>wave_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#wave_create">wave_create</a>.<br>&nbsp;&nbsp;&nbsp;mode:&nbsp;PI_WAVE_MODE_ONE_SHOT,&nbsp;PI_WAVE_MODE_REPEAT,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PI_WAVE_MODE_ONE_SHOT_SYNC,&nbsp;or&nbsp;PI_WAVE_MODE_REPEAT_SYNC.<br></code><br><br>PI_WAVE_MODE_ONE_SHOT: same as <a href="#wave_send_once">wave_send_once</a>.
-<br><br>PI_WAVE_MODE_REPEAT same as <a href="#wave_send_repeat">wave_send_repeat</a>.
-<br><br>PI_WAVE_MODE_ONE_SHOT_SYNC same as <a href="#wave_send_once">wave_send_once</a> but tries
-to sync with the previous waveform.
-<br><br>PI_WAVE_MODE_REPEAT_SYNC same as <a href="#wave_send_repeat">wave_send_repeat</a> but tries
-to sync with the previous waveform.
-<br><br>WARNING: bad things may happen if you delete the previous
-waveform before it has been synced to the new waveform.
-<br><br>NOTE: Any hardware PWM started by <a href="#hardware_PWM">hardware_PWM</a> will be cancelled.
-<br><br>Returns the number of DMA control blocks in the waveform if OK,
-otherwise PI_BAD_WAVE_ID, or PI_BAD_WAVE_MODE.
-<h3><a name="wave_chain"></a><a href="#int"><small>int</small></a> wave_chain<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#bufSize">bufSize</a>)</small></h3>
-This function transmits a chain of waveforms.
-<br><br>NOTE: Any hardware PWM started by <a href="#hardware_PWM">hardware_PWM</a> will be cancelled.
-<br><br>The waves to be transmitted are specified by the contents of buf
-which contains an ordered list of <a href="#wave_id">wave_id</a>s and optional command
-codes and related data.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;pointer&nbsp;to&nbsp;the&nbsp;wave_ids&nbsp;and&nbsp;optional&nbsp;command&nbsp;codes<br>bufSize:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;in&nbsp;buf<br></code><br><br>Returns 0 if OK, otherwise PI_CHAIN_NESTING, PI_CHAIN_LOOP_CNT, PI_BAD_CHAIN_LOOP, PI_BAD_CHAIN_CMD, PI_CHAIN_COUNTER,
-PI_BAD_CHAIN_DELAY, PI_CHAIN_TOO_BIG, or PI_BAD_WAVE_ID.
-<br><br>Each wave is transmitted in the order specified. A wave may
-occur multiple times per chain.
-<br><br>A blocks of waves may be transmitted multiple times by using
-the loop commands. The block is bracketed by loop start and
-end commands. Loops may be nested.
-<br><br>Delays between waves may be added with the delay command.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>Loop Start</td><td>255 0</td><td>Identify start of a wave block</td></tr><tr><td>Loop Repeat</td><td>255 1 x y</td><td>loop x + y*256 times</td></tr><tr><td>Delay</td><td>255 2 x y</td><td>delay x + y*256 microseconds</td></tr><tr><td>Loop Forever</td><td>255 3</td><td>loop forever</td></tr></tbody></table><br><br>If present Loop Forever must be the last entry in the chain.
-<br><br>The code is currently dimensioned to support a chain with roughly
-600 entries and 20 loop counters.
-<br><br><b><small>Example</small></b><br><br><code>#include&nbsp;&lt;stdio.h&gt;<br>#include&nbsp;&lt;pigpiod_if2.h&gt;<br><br>#define&nbsp;WAVES&nbsp;5<br>#define&nbsp;GPIO&nbsp;4<br><br>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;*argv[])<br>{<br>&nbsp;&nbsp;&nbsp;int&nbsp;i,&nbsp;pi,&nbsp;wid[WAVES];<br><br>&nbsp;&nbsp;&nbsp;pi&nbsp;=&nbsp;pigpio_start(0,&nbsp;0);<br>&nbsp;&nbsp;&nbsp;if&nbsp;(pi&lt;0)&nbsp;return&nbsp;-1;<br><br>&nbsp;&nbsp;&nbsp;set_mode(pi,&nbsp;GPIO,&nbsp;PI_OUTPUT);<br><br>&nbsp;&nbsp;&nbsp;for&nbsp;(i=0;&nbsp;i&lt;WAVES;&nbsp;i++)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wave_add_generic(pi,&nbsp;2,&nbsp;(gpioPulse_t[])<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{1&lt;&lt;GPIO,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;20},<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{0,&nbsp;1&lt;&lt;GPIO,&nbsp;(i+1)*200}});<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[i]&nbsp;=&nbsp;wave_create(pi);<br>&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;wave_chain(pi,&nbsp;(char&nbsp;[])&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[4],&nbsp;wid[3],&nbsp;wid[2],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;4+3+2<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[0],&nbsp;wid[0],&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;0+0+0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[1],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;0+1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;2,&nbsp;0x88,&nbsp;0x13,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;delay&nbsp;5000us<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;30,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;30&nbsp;times)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[2],&nbsp;wid[3],&nbsp;wid[0],&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;2+3+0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[3],&nbsp;wid[1],&nbsp;wid[2],&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;3+1+2<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;10,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;10&nbsp;times)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;5,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;5&nbsp;times)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[4],&nbsp;wid[4],&nbsp;wid[4],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;4+4+4<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;2,&nbsp;0x20,&nbsp;0x4E,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;delay&nbsp;20000us<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[0],&nbsp;wid[0],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;0+0+0<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},&nbsp;46);<br><br>&nbsp;&nbsp;&nbsp;while&nbsp;(wave_tx_busy(pi))&nbsp;time_sleep(0.1);<br><br>&nbsp;&nbsp;&nbsp;for&nbsp;(i=0;&nbsp;i&lt;WAVES;&nbsp;i++)&nbsp;wave_delete(pi,&nbsp;wid[i]);<br><br>&nbsp;&nbsp;&nbsp;pigpio_stop(pi);<br>}<br></code><h3><a name="wave_tx_at"></a><a href="#int"><small>int</small></a> wave_tx_at<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function returns the id of the waveform currently being
-transmitted.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><br><br>Returns the waveform id or one of the following special values:
-<br><br>PI_WAVE_NOT_FOUND (9998) - transmitted wave not found.<br>
-PI_NO_TX_WAVE (9999) - no wave being transmitted.
-<h3><a name="wave_tx_busy"></a><a href="#int"><small>int</small></a> wave_tx_busy<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function checks to see if a waveform is currently being
-transmitted.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><br><br>Returns 1 if a waveform is currently being transmitted, otherwise 0.
-<h3><a name="wave_tx_stop"></a><a href="#int"><small>int</small></a> wave_tx_stop<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function stops the transmission of the current waveform.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><br><br>Returns 0 if OK.
-<br><br>This function is intended to stop a waveform started with the repeat mode.
-<h3><a name="wave_get_micros"></a><a href="#int"><small>int</small></a> wave_get_micros<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function returns the length in microseconds of the current
-waveform.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><h3><a name="wave_get_high_micros"></a><a href="#int"><small>int</small></a> wave_get_high_micros<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function returns the length in microseconds of the longest waveform
-created since the pigpio daemon was started.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><h3><a name="wave_get_max_micros"></a><a href="#int"><small>int</small></a> wave_get_max_micros<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function returns the maximum possible size of a waveform in<br>
-microseconds.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><h3><a name="wave_get_pulses"></a><a href="#int"><small>int</small></a> wave_get_pulses<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function returns the length in pulses of the current waveform.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><h3><a name="wave_get_high_pulses"></a><a href="#int"><small>int</small></a> wave_get_high_pulses<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function returns the length in pulses of the longest waveform
-created since the pigpio daemon was started.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><h3><a name="wave_get_max_pulses"></a><a href="#int"><small>int</small></a> wave_get_max_pulses<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function returns the maximum possible size of a waveform in pulses.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><h3><a name="wave_get_cbs"></a><a href="#int"><small>int</small></a> wave_get_cbs<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function returns the length in DMA control blocks of the current
-waveform.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><h3><a name="wave_get_high_cbs"></a><a href="#int"><small>int</small></a> wave_get_high_cbs<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function returns the length in DMA control blocks of the longest
-waveform created since the pigpio daemon was started.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><h3><a name="wave_get_max_cbs"></a><a href="#int"><small>int</small></a> wave_get_max_cbs<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function returns the maximum possible size of a waveform in DMA
-control blocks.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><h3><a name="gpio_trigger"></a><a href="#int"><small>int</small></a> gpio_trigger<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#pulseLen">pulseLen</a>, <a href="#unsigned">unsigned</a> <a href="#level">level</a>)</small></h3>
-This function sends a trigger pulse to a GPIO. The GPIO is set to
-level for pulseLen microseconds and then reset to not level.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br>&nbsp;pulseLen:&nbsp;1-100.<br>&nbsp;&nbsp;&nbsp;&nbsp;level:&nbsp;0,1.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_LEVEL,
-PI_BAD_PULSELEN, or PI_NOT_PERMITTED.
-<h3><a name="store_script"></a><a href="#int"><small>int</small></a> store_script<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#char">char</a> <a href="#*script">*script</a>)</small></h3>
-This function stores a script for later execution.
-<br><br>See <a href="http://abyz.me.uk/rpi/pigpio/pigs.html#Scripts">http://abyz.me.uk/rpi/pigpio/pigs.html#Scripts</a> for details.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>script:&nbsp;the&nbsp;text&nbsp;of&nbsp;the&nbsp;script.<br></code><br><br>The function returns a script id if the script is valid,
-otherwise PI_BAD_SCRIPT.
-<h3><a name="run_script"></a><a href="#int"><small>int</small></a> run_script<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>, <a href="#unsigned">unsigned</a> <a href="#numPar">numPar</a>, <a href="#uint32_t">uint32_t</a> <a href="#*param">*param</a>)</small></h3>
-This function runs a stored script.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#store_script">store_script</a>.<br>&nbsp;&nbsp;&nbsp;numPar:&nbsp;0-10,&nbsp;the&nbsp;number&nbsp;of&nbsp;parameters.<br>&nbsp;&nbsp;&nbsp;&nbsp;param:&nbsp;an&nbsp;array&nbsp;of&nbsp;parameters.<br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID, or
-PI_TOO_MANY_PARAM
-<br><br>param is an array of up to 10 parameters which may be referenced in
-the script as p0 to p9.
-<h3><a name="update_script"></a><a href="#int"><small>int</small></a> update_script<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>, <a href="#unsigned">unsigned</a> <a href="#numPar">numPar</a>, <a href="#uint32_t">uint32_t</a> <a href="#*param">*param</a>)</small></h3>
-This function sets the parameters of a script. The script may or
-may not be running. The first numPar parameters of the script are
-overwritten with the new values.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#store_script">store_script</a>.<br>&nbsp;&nbsp;&nbsp;numPar:&nbsp;0-10,&nbsp;the&nbsp;number&nbsp;of&nbsp;parameters.<br>&nbsp;&nbsp;&nbsp;&nbsp;param:&nbsp;an&nbsp;array&nbsp;of&nbsp;parameters.<br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID, or
-PI_TOO_MANY_PARAM.
-<br><br>param is an array of up to 10 parameters which may be referenced in
-the script as p0 to p9.
-<h3><a name="script_status"></a><a href="#int"><small>int</small></a> script_status<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>, <a href="#uint32_t">uint32_t</a> <a href="#*param">*param</a>)</small></h3>
-This function returns the run status of a stored script as well
-as the current values of parameters 0 to 9.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#store_script">store_script</a>.<br>&nbsp;&nbsp;&nbsp;&nbsp;param:&nbsp;an&nbsp;array&nbsp;to&nbsp;hold&nbsp;the&nbsp;returned&nbsp;10&nbsp;parameters.<br></code><br><br>The function returns greater than or equal to 0 if OK,
-otherwise PI_BAD_SCRIPT_ID.
-<br><br>The run status may be
-<br><br><code>PI_SCRIPT_INITING<br>PI_SCRIPT_HALTED<br>PI_SCRIPT_RUNNING<br>PI_SCRIPT_WAITING<br>PI_SCRIPT_FAILED<br></code><br><br>The current value of script parameters 0 to 9 are returned in param.
-<h3><a name="stop_script"></a><a href="#int"><small>int</small></a> stop_script<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>)</small></h3>
-This function stops a running script.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#store_script">store_script</a>.<br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID.
-<h3><a name="delete_script"></a><a href="#int"><small>int</small></a> delete_script<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>)</small></h3>
-This function deletes a stored script.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#store_script">store_script</a>.<br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID.
-<h3><a name="bb_serial_read_open"></a><a href="#int"><small>int</small></a> bb_serial_read_open<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#data_bits">data_bits</a>)</small></h3>
-This function opens a GPIO for bit bang reading of serial data.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;50-250000<br>data_bits:&nbsp;1-32<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_WAVE_BAUD,
-or PI_GPIO_IN_USE.
-<br><br>The serial data is returned in a cyclic buffer and is read using
-bb_serial_read.
-<br><br>It is the caller's responsibility to read data from the cyclic buffer
-in a timely fashion.
-<h3><a name="bb_serial_read"></a><a href="#int"><small>int</small></a> bb_serial_read<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#void">void</a> <a href="#*buf">*buf</a>, <a href="#size_t">size_t</a> <a href="#bufSize">bufSize</a>)</small></h3>
-This function copies up to bufSize bytes of data read from the
-bit bang serial cyclic buffer to the buffer starting at buf.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31,&nbsp;previously&nbsp;opened&nbsp;with&nbsp;<a href="#bb_serial_read_open">bb_serial_read_open</a>.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;bytes.<br>&nbsp;&nbsp;bufSize:&nbsp;&gt;=0<br></code><br><br>Returns the number of bytes copied if OK, otherwise PI_BAD_USER_GPIO
-or PI_NOT_SERIAL_GPIO.
-<br><br>The bytes returned for each character depend upon the number of
-data bits <a href="#data_bits">data_bits</a> specified in the <a href="#bb_serial_read_open">bb_serial_read_open</a> command.
-<br><br>For <a href="#data_bits">data_bits</a> 1-8 there will be one byte per character.<br>
-For <a href="#data_bits">data_bits</a> 9-16 there will be two bytes per character.<br>
-For <a href="#data_bits">data_bits</a> 17-32 there will be four bytes per character.
-<h3><a name="bb_serial_read_close"></a><a href="#int"><small>int</small></a> bb_serial_read_close<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-This function closes a GPIO for bit bang reading of serial data.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31,&nbsp;previously&nbsp;opened&nbsp;with&nbsp;<a href="#bb_serial_read_open">bb_serial_read_open</a>.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_SERIAL_GPIO.
-<h3><a name="bb_serial_invert"></a><a href="#int"><small>int</small></a> bb_serial_invert<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#invert">invert</a>)</small></h3>
-This function inverts serial logic for big bang serial reads.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31,&nbsp;previously&nbsp;opened&nbsp;with&nbsp;<a href="#bb_serial_read_open">bb_serial_read_open</a>.<br>&nbsp;&nbsp;&nbsp;invert:&nbsp;0-1,&nbsp;1&nbsp;invert,&nbsp;0&nbsp;normal.<br></code><br><br>Returns 0 if OK, otherwise PI_NOT_SERIAL_GPIO or PI_BAD_SER_INVERT.
-<h3><a name="i2c_open"></a><a href="#int"><small>int</small></a> i2c_open<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_bus">i2c_bus</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_addr">i2c_addr</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_flags">i2c_flags</a>)</small></h3>
-This returns a handle for the device at address i2c_addr on bus i2c_bus.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;i2c_bus:&nbsp;&gt;=0.<br>&nbsp;i2c_addr:&nbsp;0-0x7F.<br>i2c_flags:&nbsp;0.<br></code><br><br>No flags are currently defined. This parameter should be set to zero.
-<br><br>Physically buses 0 and 1 are available on the Pi. Higher numbered buses
-will be available if a kernel supported bus multiplexor is being used.
-<br><br>The GPIO used are given in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td></tr><tr><td>I2C 0</td><td>0</td><td>1</td></tr><tr><td>I2C 1</td><td>2</td><td>3</td></tr></tbody></table><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_BAD_I2C_BUS, PI_BAD_I2C_ADDR,
-PI_BAD_FLAGS, PI_NO_HANDLE, or PI_I2C_OPEN_FAILED.
-<br><br>For the SMBus commands the low level transactions are shown at the end
-of the function description. The following abbreviations are used.
-<br><br><code>S&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Start&nbsp;bit<br>P&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Stop&nbsp;bit<br>Rd/Wr&nbsp;&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Read/Write&nbsp;bit.&nbsp;Rd&nbsp;equals&nbsp;1,&nbsp;Wr&nbsp;equals&nbsp;0.<br>A,&nbsp;NA&nbsp;&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Accept&nbsp;and&nbsp;not&nbsp;accept&nbsp;bit.<br><br>Addr&nbsp;&nbsp;&nbsp;&nbsp;(7&nbsp;bits):&nbsp;I2C&nbsp;7&nbsp;bit&nbsp;address.<br>i2c_reg&nbsp;(8&nbsp;bits):&nbsp;A&nbsp;byte&nbsp;which&nbsp;often&nbsp;selects&nbsp;a&nbsp;register.<br>Data&nbsp;&nbsp;&nbsp;&nbsp;(8&nbsp;bits):&nbsp;A&nbsp;data&nbsp;byte.<br>Count&nbsp;&nbsp;&nbsp;(8&nbsp;bits):&nbsp;A&nbsp;byte&nbsp;defining&nbsp;the&nbsp;length&nbsp;of&nbsp;a&nbsp;block&nbsp;operation.<br><br>[..]:&nbsp;Data&nbsp;sent&nbsp;by&nbsp;the&nbsp;device.<br></code><h3><a name="i2c_close"></a><a href="#int"><small>int</small></a> i2c_close<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This closes the I2C device associated with the handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<h3><a name="i2c_write_quick"></a><a href="#int"><small>int</small></a> i2c_write_quick<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#bit">bit</a>)</small></h3>
-This sends a single bit (in the Rd/Wr bit) to the device associated
-with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>&nbsp;&nbsp;&nbsp;bit:&nbsp;0-1,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Quick command. SMBus 2.0 5.5.1
-<code>S&nbsp;Addr&nbsp;bit&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_write_byte"></a><a href="#int"><small>int</small></a> i2c_write_byte<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#bVal">bVal</a>)</small></h3>
-This sends a single byte to the device associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>&nbsp;&nbsp;bVal:&nbsp;0-0xFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Send byte. SMBus 2.0 5.5.2
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;bVal&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_read_byte"></a><a href="#int"><small>int</small></a> i2c_read_byte<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This reads a single byte from the device associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br></code><br><br>Returns the byte read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-or PI_I2C_READ_FAILED.
-<br><br>Receive byte. SMBus 2.0 5.5.3
-<code>S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_write_byte_data"></a><a href="#int"><small>int</small></a> i2c_write_byte_data<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#unsigned">unsigned</a> <a href="#bVal">bVal</a>)</small></h3>
-This writes a single byte to the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write.<br>&nbsp;&nbsp;&nbsp;bVal:&nbsp;0-0xFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Write byte. SMBus 2.0 5.5.4
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2c_reg&nbsp;[A]&nbsp;bVal&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_write_word_data"></a><a href="#int"><small>int</small></a> i2c_write_word_data<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#unsigned">unsigned</a> <a href="#wVal">wVal</a>)</small></h3>
-This writes a single 16 bit word to the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write.<br>&nbsp;&nbsp;&nbsp;wVal:&nbsp;0-0xFFFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Write word. SMBus 2.0 5.5.4
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2c_reg&nbsp;[A]&nbsp;wval_Low&nbsp;[A]&nbsp;wVal_High&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_read_byte_data"></a><a href="#int"><small>int</small></a> i2c_read_byte_data<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>)</small></h3>
-This reads a single byte from the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read.<br></code><br><br>Returns the byte read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Read byte. SMBus 2.0 5.5.5
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2c_reg&nbsp;[A]&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_read_word_data"></a><a href="#int"><small>int</small></a> i2c_read_word_data<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>)</small></h3>
-This reads a single 16 bit word from the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read.<br></code><br><br>Returns the word read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Read word. SMBus 2.0 5.5.5
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2c_reg&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[DataLow]&nbsp;A&nbsp;[DataHigh]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_process_call"></a><a href="#int"><small>int</small></a> i2c_process_call<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#unsigned">unsigned</a> <a href="#wVal">wVal</a>)</small></h3>
-This writes 16 bits of data to the specified register of the device
-associated with handle and and reads 16 bits of data in return.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write/read.<br>&nbsp;&nbsp;&nbsp;wVal:&nbsp;0-0xFFFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></code><br><br>Returns the word read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Process call. SMBus 2.0 5.5.6
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2c_reg&nbsp;[A]&nbsp;wVal_Low&nbsp;[A]&nbsp;wVal_High&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[DataLow]&nbsp;A&nbsp;[DataHigh]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_write_block_data"></a><a href="#int"><small>int</small></a> i2c_write_block_data<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes up to 32 bytes to the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write.<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;with&nbsp;the&nbsp;data&nbsp;to&nbsp;send.<br>&nbsp;&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Block write. SMBus 2.0 5.5.7
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2c_reg&nbsp;[A]&nbsp;count&nbsp;[A]&nbsp;buf0&nbsp;[A]&nbsp;buf1&nbsp;[A]&nbsp;...<br>&nbsp;&nbsp;&nbsp;[A]&nbsp;bufn&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_read_block_data"></a><a href="#int"><small>int</small></a> i2c_read_block_data<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>)</small></h3>
-This reads a block of up to 32 bytes from the specified register of
-the device associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read.<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data.<br></code><br><br>The amount of returned data is set by the device.
-<br><br>Returns the number of bytes read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Block read. SMBus 2.0 5.5.7
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2c_reg&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Count]&nbsp;A&nbsp;[buf0]&nbsp;A&nbsp;[buf1]&nbsp;A&nbsp;...&nbsp;A&nbsp;[bufn]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_block_process_call"></a><a href="#int"><small>int</small></a> i2c_block_process_call<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes data bytes to the specified register of the device
-associated with handle and reads a device specified number
-of bytes of data in return.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write/read.<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;with&nbsp;the&nbsp;data&nbsp;to&nbsp;send&nbsp;and&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data.<br>&nbsp;&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns the number of bytes read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>The smbus 2.0 documentation states that a minimum of 1 byte may be
-sent and a minimum of 1 byte may be received. The total number of
-bytes sent/received must be 32 or less.
-<br><br>Block write-block read. SMBus 2.0 5.5.8
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2c_reg&nbsp;[A]&nbsp;count&nbsp;[A]&nbsp;buf0&nbsp;[A]&nbsp;...<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Count]&nbsp;A&nbsp;[Data]&nbsp;...&nbsp;A&nbsp;P<br></code><h3><a name="i2c_read_i2c_block_data"></a><a href="#int"><small>int</small></a> i2c_read_i2c_block_data<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This reads count bytes from the specified register of the device
-associated with handle . The count may be 1-32.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read.<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data.<br>&nbsp;&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></code><br><br>Returns the number of bytes read (&gt;0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br><code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2c_reg&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[buf0]&nbsp;A&nbsp;[buf1]&nbsp;A&nbsp;...&nbsp;A&nbsp;[bufn]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_write_i2c_block_data"></a><a href="#int"><small>int</small></a> i2c_write_i2c_block_data<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes 1 to 32 bytes to the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write.<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;data&nbsp;to&nbsp;write.<br>&nbsp;&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br><code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2c_reg&nbsp;[A]&nbsp;buf0&nbsp;[A]&nbsp;buf1&nbsp;[A]&nbsp;...&nbsp;[A]&nbsp;bufn&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_read_device"></a><a href="#int"><small>int</small></a> i2c_read_device<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This reads count bytes from the raw device into buf.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data&nbsp;bytes.<br>&nbsp;count:&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></code><br><br>Returns count (&gt;0) if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_READ_FAILED.
-<br><br><code>S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[buf0]&nbsp;A&nbsp;[buf1]&nbsp;A&nbsp;...&nbsp;A&nbsp;[bufn]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_write_device"></a><a href="#int"><small>int</small></a> i2c_write_device<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes count bytes from buf to the raw device.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;containing&nbsp;the&nbsp;data&nbsp;bytes&nbsp;to&nbsp;write.<br>&nbsp;count:&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br><code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;buf0&nbsp;[A]&nbsp;buf1&nbsp;[A]&nbsp;...&nbsp;[A]&nbsp;bufn&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_zip"></a><a href="#int"><small>int</small></a> i2c_zip<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*inBuf">*inBuf</a>, <a href="#unsigned">unsigned</a> <a href="#inLen">inLen</a>, <a href="#char">char</a> <a href="#*outBuf">*outBuf</a>, <a href="#unsigned">unsigned</a> <a href="#outLen">outLen</a>)</small></h3>
-This function executes a sequence of I2C operations. The
-operations to be performed are specified by the contents of inBuf
-which contains the concatenated command codes and associated data.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>&nbsp;inBuf:&nbsp;pointer&nbsp;to&nbsp;the&nbsp;concatenated&nbsp;I2C&nbsp;commands,&nbsp;see&nbsp;below<br>&nbsp;inLen:&nbsp;size&nbsp;of&nbsp;command&nbsp;buffer<br>outBuf:&nbsp;pointer&nbsp;to&nbsp;buffer&nbsp;to&nbsp;hold&nbsp;returned&nbsp;data<br>outLen:&nbsp;size&nbsp;of&nbsp;output&nbsp;buffer<br></code><br><br>Returns &gt;= 0 if OK (the number of bytes read), otherwise
-PI_BAD_HANDLE, PI_BAD_POINTER, PI_BAD_I2C_CMD, PI_BAD_I2C_RLEN.
-PI_BAD_I2C_WLEN, or PI_BAD_I2C_SEG.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>End</td><td>0</td><td>No more commands</td></tr><tr><td>Escape</td><td>1</td><td>Next P is two bytes</td></tr><tr><td>On</td><td>2</td><td>Switch combined flag on</td></tr><tr><td>Off</td><td>3</td><td>Switch combined flag off</td></tr><tr><td>Address</td><td>4 P</td><td>Set I2C address to P</td></tr><tr><td>Flags</td><td>5 lsb msb</td><td>Set I2C flags to lsb + (msb &lt;&lt; 8)</td></tr><tr><td>Read</td><td>6 P</td><td>Read P bytes of data</td></tr><tr><td>Write</td><td>7 P ...</td><td>Write P bytes of data</td></tr></tbody></table><br><br>The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-<br><br>The address defaults to that associated with the handle.
-The flags default to 0. The address and flags maintain their
-previous value until updated.
-<br><br>The returned I2C data is stored in consecutive locations of outBuf.
-<br><br><b><small>Example</small></b><br><br><code>Set&nbsp;address&nbsp;0x53,&nbsp;write&nbsp;0x32,&nbsp;read&nbsp;6&nbsp;bytes<br>Set&nbsp;address&nbsp;0x1E,&nbsp;write&nbsp;0x03,&nbsp;read&nbsp;6&nbsp;bytes<br>Set&nbsp;address&nbsp;0x68,&nbsp;write&nbsp;0x1B,&nbsp;read&nbsp;8&nbsp;bytes<br>End<br><br>0x04&nbsp;0x53&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x32&nbsp;&nbsp;&nbsp;0x06&nbsp;0x06<br>0x04&nbsp;0x1E&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x03&nbsp;&nbsp;&nbsp;0x06&nbsp;0x06<br>0x04&nbsp;0x68&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x1B&nbsp;&nbsp;&nbsp;0x06&nbsp;0x08<br>0x00<br></code><h3><a name="bb_i2c_open"></a><a href="#int"><small>int</small></a> bb_i2c_open<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#SDA">SDA</a>, <a href="#unsigned">unsigned</a> <a href="#SCL">SCL</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>)</small></h3>
-This function selects a pair of GPIO for bit banging I2C at a
-specified baud rate.
-<br><br>Bit banging I2C allows for certain operations which are not possible
-with the standard I2C driver.
-<br><br>o baud rates as low as 50<br>
-o repeated starts<br>
-o clock stretching<br>
-o I2C on any pair of spare GPIO
-<br><br><code>&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;SDA:&nbsp;0-31<br>&nbsp;SCL:&nbsp;0-31<br>baud:&nbsp;50-500000<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_I2C_BAUD, or
-PI_GPIO_IN_USE.
-<br><br>NOTE:
-<br><br>The GPIO used for SDA and SCL must have pull-ups to 3V3 connected. As
-a guide the hardware pull-ups on pins 3 and 5 are 1k8 in value.
-<h3><a name="bb_i2c_close"></a><a href="#int"><small>int</small></a> bb_i2c_close<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#SDA">SDA</a>)</small></h3>
-This function stops bit banging I2C on a pair of GPIO previously
-opened with <a href="#bb_i2c_open">bb_i2c_open</a>.
-<br><br><code>&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>SDA:&nbsp;0-31,&nbsp;the&nbsp;SDA&nbsp;GPIO&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_i2c_open">bb_i2c_open</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_I2C_GPIO.
-<h3><a name="bb_i2c_zip"></a><a href="#int"><small>int</small></a> bb_i2c_zip<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#SDA">SDA</a>, <a href="#char">char</a> <a href="#*inBuf">*inBuf</a>, <a href="#unsigned">unsigned</a> <a href="#inLen">inLen</a>, <a href="#char">char</a> <a href="#*outBuf">*outBuf</a>, <a href="#unsigned">unsigned</a> <a href="#outLen">outLen</a>)</small></h3>
-This function executes a sequence of bit banged I2C operations. The
-operations to be performed are specified by the contents of inBuf
-which contains the concatenated command codes and associated data.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;&nbsp;SDA:&nbsp;0-31&nbsp;(as&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_i2c_open">bb_i2c_open</a>)<br>&nbsp;inBuf:&nbsp;pointer&nbsp;to&nbsp;the&nbsp;concatenated&nbsp;I2C&nbsp;commands,&nbsp;see&nbsp;below<br>&nbsp;inLen:&nbsp;size&nbsp;of&nbsp;command&nbsp;buffer<br>outBuf:&nbsp;pointer&nbsp;to&nbsp;buffer&nbsp;to&nbsp;hold&nbsp;returned&nbsp;data<br>outLen:&nbsp;size&nbsp;of&nbsp;output&nbsp;buffer<br></code><br><br>Returns &gt;= 0 if OK (the number of bytes read), otherwise
-PI_BAD_USER_GPIO, PI_NOT_I2C_GPIO, PI_BAD_POINTER,
-PI_BAD_I2C_CMD, PI_BAD_I2C_RLEN, PI_BAD_I2C_WLEN,
-PI_I2C_READ_FAILED, or PI_I2C_WRITE_FAILED.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>End</td><td>0</td><td>No more commands</td></tr><tr><td>Escape</td><td>1</td><td>Next P is two bytes</td></tr><tr><td>Start</td><td>2</td><td>Start condition</td></tr><tr><td>Stop</td><td>3</td><td>Stop condition</td></tr><tr><td>Address</td><td>4 P</td><td>Set I2C address to P</td></tr><tr><td>Flags</td><td>5 lsb msb</td><td>Set I2C flags to lsb + (msb &lt;&lt; 8)</td></tr><tr><td>Read</td><td>6 P</td><td>Read P bytes of data</td></tr><tr><td>Write</td><td>7 P ...</td><td>Write P bytes of data</td></tr></tbody></table><br><br>The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-<br><br>The address and flags default to 0. The address and flags maintain
-their previous value until updated.
-<br><br>No flags are currently defined.
-<br><br>The returned I2C data is stored in consecutive locations of outBuf.
-<br><br><b><small>Example</small></b><br><br><code>Set&nbsp;address&nbsp;0x53<br>start,&nbsp;write&nbsp;0x32,&nbsp;(re)start,&nbsp;read&nbsp;6&nbsp;bytes,&nbsp;stop<br>Set&nbsp;address&nbsp;0x1E<br>start,&nbsp;write&nbsp;0x03,&nbsp;(re)start,&nbsp;read&nbsp;6&nbsp;bytes,&nbsp;stop<br>Set&nbsp;address&nbsp;0x68<br>start,&nbsp;write&nbsp;0x1B,&nbsp;(re)start,&nbsp;read&nbsp;8&nbsp;bytes,&nbsp;stop<br>End<br><br>0x04&nbsp;0x53<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x32&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x06&nbsp;0x03<br><br>0x04&nbsp;0x1E<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x03&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x06&nbsp;0x03<br><br>0x04&nbsp;0x68<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x1B&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x08&nbsp;0x03<br><br>0x00<br></code><h3><a name="bb_spi_open"></a><a href="#int"><small>int</small></a> bb_spi_open<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#CS">CS</a>, <a href="#unsigned">unsigned</a> <a href="#MISO">MISO</a>, <a href="#unsigned">unsigned</a> <a href="#MOSI">MOSI</a>, <a href="#unsigned">unsigned</a> <a href="#SCLK">SCLK</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#spi_flags">spi_flags</a>)</small></h3>
-This function selects a set of GPIO for bit banging SPI at a
-specified baud rate.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CS:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MISO:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOSI:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SCLK:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;50-250000<br>spi_flags:&nbsp;see&nbsp;below<br></code><br><br>spi_flags consists of the least significant 22 bits.
-<br><br><code>21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;p&nbsp;&nbsp;m&nbsp;&nbsp;m<br></code><br><br>mm defines the SPI mode, defaults to 0
-<br><br><code>Mode&nbsp;CPOL&nbsp;CPHA<br>&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0<br>&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;1<br>&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;0<br>&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;1<br></code><br><br>p is 0 if CS is active low (default) and 1 for active high.
-<br><br>T is 1 if the least significant bit is transmitted on MOSI first, the
-default (0) shifts the most significant bit out first.
-<br><br>R is 1 if the least significant bit is received on MISO first, the
-default (0) receives the most significant bit first.
-<br><br>The other bits in flags should be set to zero.
-<br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_SPI_BAUD, or
-PI_GPIO_IN_USE.
-<br><br>If more than one device is connected to the SPI bus (defined by
-SCLK, MOSI, and MISO) each must have its own CS.
-<br><br><b><small>Example</small></b><br><br><code>bb_spi_open(pi,10,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;10000,&nbsp;0);&nbsp;//&nbsp;device&nbsp;1<br>bb_spi_open(pi,11,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;20000,&nbsp;3);&nbsp;//&nbsp;device&nbsp;2<br></code><h3><a name="bb_spi_close"></a><a href="#int"><small>int</small></a> bb_spi_close<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#CS">CS</a>)</small></h3>
-This function stops bit banging SPI on a set of GPIO
-opened with <a href="#bbSPIOpen">bbSPIOpen</a>.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>CS:&nbsp;0-31,&nbsp;the&nbsp;CS&nbsp;GPIO&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_spi_open">bb_spi_open</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_SPI_GPIO.
-<h3><a name="bb_spi_xfer"></a><a href="#int"><small>int</small></a> bb_spi_xfer<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#CS">CS</a>, <a href="#char">char</a> <a href="#*txBuf">*txBuf</a>, <a href="#char">char</a> <a href="#*rxBuf">*rxBuf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function executes a bit banged SPI transfer.
-<br><br><code>&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;&nbsp;CS:&nbsp;0-31&nbsp;(as&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_spi_open">bb_spi_open</a>)<br>txBuf:&nbsp;pointer&nbsp;to&nbsp;buffer&nbsp;to&nbsp;hold&nbsp;data&nbsp;to&nbsp;be&nbsp;sent<br>rxBuf:&nbsp;pointer&nbsp;to&nbsp;buffer&nbsp;to&nbsp;hold&nbsp;returned&nbsp;data<br>count:&nbsp;size&nbsp;of&nbsp;data&nbsp;transfer<br></code><br><br>Returns &gt;= 0 if OK (the number of bytes read), otherwise
-PI_BAD_USER_GPIO, PI_NOT_SPI_GPIO or PI_BAD_POINTER.
-<br><br><b><small>Example</small></b><br><br><code>//&nbsp;gcc&nbsp;-Wall&nbsp;-pthread&nbsp;-o&nbsp;bb_spi_x_test&nbsp;bb_spi_x_test.c&nbsp;-lpigpiod_if2<br>//&nbsp;./bb_spi_x_test<br><br>#include&nbsp;&lt;stdio.h&gt;<br><br>#include&nbsp;"pigpiod_if2.h"<br><br>#define&nbsp;CE0&nbsp;5<br>#define&nbsp;CE1&nbsp;6<br>#define&nbsp;MISO&nbsp;13<br>#define&nbsp;MOSI&nbsp;19<br>#define&nbsp;SCLK&nbsp;12<br><br>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;*argv[])<br>{<br>&nbsp;&nbsp;&nbsp;int&nbsp;i,&nbsp;pi,&nbsp;count,&nbsp;set_val,&nbsp;read_val;<br>&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;inBuf[3];<br>&nbsp;&nbsp;&nbsp;char&nbsp;cmd1[]&nbsp;=&nbsp;{0,&nbsp;0};<br>&nbsp;&nbsp;&nbsp;char&nbsp;cmd2[]&nbsp;=&nbsp;{12,&nbsp;0};<br>&nbsp;&nbsp;&nbsp;char&nbsp;cmd3[]&nbsp;=&nbsp;{1,&nbsp;128,&nbsp;0};<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;((pi&nbsp;=&nbsp;pigpio_start(0,&nbsp;0))&nbsp;&lt;&nbsp;0)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fprintf(stderr,&nbsp;"pigpio&nbsp;initialisation&nbsp;failed&nbsp;(%d).\n",&nbsp;pi);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;1;<br>&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;bb_spi_open(pi,&nbsp;CE0,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;10000,&nbsp;0);&nbsp;//&nbsp;MCP4251&nbsp;DAC<br>&nbsp;&nbsp;&nbsp;bb_spi_open(pi,&nbsp;CE1,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;20000,&nbsp;3);&nbsp;//&nbsp;MCP3008&nbsp;ADC<br><br>&nbsp;&nbsp;&nbsp;for&nbsp;(i=0;&nbsp;i&lt;256;&nbsp;i++)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cmd1[1]&nbsp;=&nbsp;i;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count&nbsp;=&nbsp;bb_spi_xfer(pi,&nbsp;CE0,&nbsp;cmd1,&nbsp;(char&nbsp;*)inBuf,&nbsp;2);&nbsp;//&nbsp;&gt;&nbsp;DAC<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(count&nbsp;==&nbsp;2)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count&nbsp;=&nbsp;bb_spi_xfer(pi,&nbsp;CE0,&nbsp;cmd2,&nbsp;(char&nbsp;*)inBuf,&nbsp;2);&nbsp;//&nbsp;&lt;&nbsp;DAC<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(count&nbsp;==&nbsp;2)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set_val&nbsp;=&nbsp;inBuf[1];<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count&nbsp;=&nbsp;bb_spi_xfer(pi,&nbsp;CE1,&nbsp;cmd3,&nbsp;(char&nbsp;*)inBuf,&nbsp;3);&nbsp;//&nbsp;&lt;&nbsp;ADC<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(count&nbsp;==&nbsp;3)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;read_val&nbsp;=&nbsp;((inBuf[1]&3)&lt;&lt;8)&nbsp;|&nbsp;inBuf[2];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("%d&nbsp;%d\n",&nbsp;set_val,&nbsp;read_val);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;bb_spi_close(pi,&nbsp;CE0);<br>&nbsp;&nbsp;&nbsp;bb_spi_close(pi,&nbsp;CE1);<br><br>&nbsp;&nbsp;&nbsp;pigpio_stop(pi);<br>}<br></code><h3><a name="spi_open"></a><a href="#int"><small>int</small></a> spi_open<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#spi_channel">spi_channel</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#spi_flags">spi_flags</a>)</small></h3>
-This function returns a handle for the SPI device on the channel.
-Data will be transferred at baud bits per second. The flags may
-be used to modify the default behaviour of 4-wire operation, mode 0,
-active low chip select.
-<br><br>The Pi has two SPI peripherals: main and auxiliary.
-<br><br>The main SPI has two chip selects (channels), the auxiliary has
-three.
-<br><br>The auxiliary SPI is available on all models but the A and B.
-<br><br>The GPIO used are given in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>MISO</td><td>MOSI</td><td>SCLK</td><td>CE0</td><td>CE1</td><td>CE2</td></tr><tr><td>Main SPI</td><td>9</td><td>10</td><td>11</td><td>8</td><td>7</td><td>-</td></tr><tr><td>Aux SPI</td><td>19</td><td>20</td><td>21</td><td>18</td><td>17</td><td>16</td></tr></tbody></table><br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>spi_channel:&nbsp;0-1&nbsp;(0-2&nbsp;for&nbsp;the&nbsp;auxiliary&nbsp;SPI).<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;32K-125M&nbsp;(values&nbsp;above&nbsp;30M&nbsp;are&nbsp;unlikely&nbsp;to&nbsp;work).<br>&nbsp;&nbsp;spi_flags:&nbsp;see&nbsp;below.<br></code><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_BAD_SPI_CHANNEL,
-PI_BAD_SPI_SPEED, PI_BAD_FLAGS, PI_NO_AUX_SPI, or PI_SPI_OPEN_FAILED.
-<br><br>spi_flags consists of the least significant 22 bits.
-<br><br><code>21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;W&nbsp;&nbsp;A&nbsp;u2&nbsp;u1&nbsp;u0&nbsp;p2&nbsp;p1&nbsp;p0&nbsp;&nbsp;m&nbsp;&nbsp;m<br></code><br><br>mm defines the SPI mode.
-<br><br>Warning: modes 1 and 3 do not appear to work on the auxiliary SPI.
-<br><br><code>Mode&nbsp;POL&nbsp;PHA<br>&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;0<br>&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;1<br>&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;0<br>&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;1<br></code><br><br>px is 0 if CEx is active low (default) and 1 for active high.
-<br><br>ux is 0 if the CEx GPIO is reserved for SPI (default) and 1 otherwise.
-<br><br>A is 0 for the main SPI, 1 for the auxiliary SPI.
-<br><br>W is 0 if the device is not 3-wire, 1 if the device is 3-wire. Main
-SPI only.
-<br><br>nnnn defines the number of bytes (0-15) to write before switching
-the MOSI line to MISO to read data. This field is ignored
-if W is not set. Main SPI only.
-<br><br>T is 1 if the least significant bit is transmitted on MOSI first, the
-default (0) shifts the most significant bit out first. Auxiliary SPI
-only.
-<br><br>R is 1 if the least significant bit is received on MISO first, the
-default (0) receives the most significant bit first. Auxiliary SPI
-only.
-<br><br>bbbbbb defines the word size in bits (0-32). The default (0)
-sets 8 bits per word. Auxiliary SPI only.
-<br><br>The <a href="#spi_read">spi_read</a>, <a href="#spi_write">spi_write</a>, and <a href="#spi_xfer">spi_xfer</a> functions
-transfer data packed into 1, 2, or 4 bytes according to
-the word size in bits.
-<br><br>For bits 1-8 there will be one byte per character.<br>
-For bits 9-16 there will be two bytes per character.<br>
-For bits 17-32 there will be four bytes per character.
-<br><br>Multi-byte transfers are made in least significant byte first order.
-<br><br>E.g. to transfer 32 11-bit words buf should contain 64 bytes
-and count should be 64.
-<br><br>E.g. to transfer the 14 bit value 0x1ABC send the bytes 0xBC followed
-by 0x1A.
-<br><br>The other bits in flags should be set to zero.
-<h3><a name="spi_close"></a><a href="#int"><small>int</small></a> spi_close<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This functions closes the SPI device identified by the handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<h3><a name="spi_read"></a><a href="#int"><small>int</small></a> spi_read<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function reads count bytes of data from the SPI
-device associated with the handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data&nbsp;bytes.<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></code><br><br>Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-<h3><a name="spi_write"></a><a href="#int"><small>int</small></a> spi_write<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function writes count bytes of data from buf to the SPI
-device associated with the handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;data&nbsp;bytes&nbsp;to&nbsp;write.<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-<h3><a name="spi_xfer"></a><a href="#int"><small>int</small></a> spi_xfer<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*txBuf">*txBuf</a>, <a href="#char">char</a> <a href="#*rxBuf">*rxBuf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function transfers count bytes of data from txBuf to the SPI
-device associated with the handle. Simultaneously count bytes of
-data are read from the device and placed in rxBuf.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>.<br>&nbsp;txBuf:&nbsp;the&nbsp;data&nbsp;bytes&nbsp;to&nbsp;write.<br>&nbsp;rxBuf:&nbsp;the&nbsp;received&nbsp;data&nbsp;bytes.<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;transfer.<br></code><br><br>Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-<h3><a name="serial_open"></a><a href="#int"><small>int</small></a> serial_open<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#char">char</a> <a href="#*ser_tty">*ser_tty</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#ser_flags">ser_flags</a>)</small></h3>
-This function opens a serial device at a specified baud rate
-with specified flags. The device name must start with
-/dev/tty or /dev/serial.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;ser_tty:&nbsp;the&nbsp;serial&nbsp;device&nbsp;to&nbsp;open.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;the&nbsp;baud&nbsp;rate&nbsp;in&nbsp;bits&nbsp;per&nbsp;second,&nbsp;see&nbsp;below.<br>ser_flags:&nbsp;0.<br></code><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_NO_HANDLE, or
-PI_SER_OPEN_FAILED.
-<br><br>The baud rate must be one of 50, 75, 110, 134, 150,
-200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
-38400, 57600, 115200, or 230400.
-<br><br>No flags are currently defined. This parameter should be set to zero.
-<h3><a name="serial_close"></a><a href="#int"><small>int</small></a> serial_close<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This function closes the serial device associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<h3><a name="serial_write_byte"></a><a href="#int"><small>int</small></a> serial_write_byte<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#bVal">bVal</a>)</small></h3>
-This function writes bVal to the serial port associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_SER_WRITE_FAILED.
-<h3><a name="serial_read_byte"></a><a href="#int"><small>int</small></a> serial_read_byte<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This function reads a byte from the serial port associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br></code><br><br>Returns the read byte (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_SER_READ_NO_DATA, or PI_SER_READ_FAILED.
-<br><br>If no data is ready PI_SER_READ_NO_DATA is returned.
-<h3><a name="serial_write"></a><a href="#int"><small>int</small></a> serial_write<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function writes count bytes from buf to the the serial port
-associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;array&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_SER_WRITE_FAILED.
-<h3><a name="serial_read"></a><a href="#int"><small>int</small></a> serial_read<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function reads up to count bytes from the the serial port
-associated with handle and writes them to buf.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data.<br>&nbsp;count:&nbsp;the&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></code><br><br>Returns the number of bytes read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, PI_SER_READ_NO_DATA, or PI_SER_WRITE_FAILED.
-<br><br>If no data is ready zero is returned.
-<h3><a name="serial_data_available"></a><a href="#int"><small>int</small></a> serial_data_available<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-Returns the number of bytes available to be read from the
-device associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br></code><br><br>Returns the number of bytes of data available (&gt;=0) if OK,
-otherwise PI_BAD_HANDLE.
-<h3><a name="custom_1"></a><a href="#int"><small>int</small></a> custom_1<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#arg1">arg1</a>, <a href="#unsigned">unsigned</a> <a href="#arg2">arg2</a>, <a href="#char">char</a> <a href="#*argx">*argx</a>, <a href="#unsigned">unsigned</a> <a href="#argc">argc</a>)</small></h3>
-This function is available for user customisation.
-<br><br>It returns a single integer value.
-<br><br><code>&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>arg1:&nbsp;&gt;=0<br>arg2:&nbsp;&gt;=0<br>argx:&nbsp;extra&nbsp;(byte)&nbsp;arguments<br>argc:&nbsp;number&nbsp;of&nbsp;extra&nbsp;arguments<br></code><br><br>Returns &gt;= 0 if OK, less than 0 indicates a user defined error.
-<h3><a name="custom_2"></a><a href="#int"><small>int</small></a> custom_2<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#arg1">arg1</a>, <a href="#char">char</a> <a href="#*argx">*argx</a>, <a href="#unsigned">unsigned</a> <a href="#argc">argc</a>, <a href="#char">char</a> <a href="#*retBuf">*retBuf</a>, <a href="#unsigned">unsigned</a> <a href="#retMax">retMax</a>)</small></h3>
-This function is available for user customisation.
-<br><br>It differs from custom_1 in that it returns an array of bytes
-rather than just an integer.
-<br><br>The return value is an integer indicating the number of returned bytes.
-<code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;arg1:&nbsp;&gt;=0<br>&nbsp;&nbsp;argc:&nbsp;extra&nbsp;(byte)&nbsp;arguments<br>&nbsp;count:&nbsp;number&nbsp;of&nbsp;extra&nbsp;arguments<br>retBuf:&nbsp;buffer&nbsp;for&nbsp;returned&nbsp;data<br>retMax:&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;return<br></code><br><br>Returns &gt;= 0 if OK, less than 0 indicates a user defined error.
-<br><br>Note, the number of returned bytes will be retMax or less.
-<h3><a name="get_pad_strength"></a><a href="#int"><small>int</small></a> get_pad_strength<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#pad">pad</a>)</small></h3>
-This function returns the pad drive strength in mA.
-<br><br><code>&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>pad:&nbsp;0-2,&nbsp;the&nbsp;pad&nbsp;to&nbsp;get.<br></code><br><br>Returns the pad drive strength if OK, otherwise PI_BAD_PAD.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>strength&nbsp;=&nbsp;get_pad_strength(pi,&nbsp;0);&nbsp;//&nbsp;&nbsp;get&nbsp;pad&nbsp;0&nbsp;strength<br></code><h3><a name="set_pad_strength"></a><a href="#int"><small>int</small></a> set_pad_strength<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#pad">pad</a>, <a href="#unsigned">unsigned</a> <a href="#padStrength">padStrength</a>)</small></h3>
-This function sets the pad drive strength in mA.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pad:&nbsp;0-2,&nbsp;the&nbsp;pad&nbsp;to&nbsp;set.<br>padStrength:&nbsp;1-16&nbsp;mA.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_PAD, or PI_BAD_STRENGTH.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>set_pad_strength(pi,&nbsp;0,&nbsp;10);&nbsp;//&nbsp;set&nbsp;pad&nbsp;0&nbsp;strength&nbsp;to&nbsp;10&nbsp;mA<br></code><h3><a name="shell_"></a><a href="#int"><small>int</small></a> shell_<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#char">char</a> <a href="#*scriptName">*scriptName</a>, <a href="#char">char</a> <a href="#*scriptString">*scriptString</a>)</small></h3>
-This function uses the system call to execute a shell script
-with the given string as its parameter.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;scriptName:&nbsp;the&nbsp;name&nbsp;of&nbsp;the&nbsp;script,&nbsp;only&nbsp;alphanumeric&nbsp;characters,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'-'&nbsp;and&nbsp;'_'&nbsp;are&nbsp;allowed&nbsp;in&nbsp;the&nbsp;name.<br>scriptString:&nbsp;the&nbsp;string&nbsp;to&nbsp;pass&nbsp;to&nbsp;the&nbsp;script.<br></code><br><br>The exit status of the system call is returned if OK, otherwise
-PI_BAD_SHELL_STATUS.
-<br><br>scriptName must exist in /opt/pigpio/cgi and must be executable.
-<br><br>The returned exit status is normally 256 times that set by the
-shell script exit function. If the script can't be found 32512 will
-be returned.
-<br><br>The following table gives some example returned statuses.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Script exit status</td><td>Returned system call status</td></tr><tr><td>1</td><td>256</td></tr><tr><td>5</td><td>1280</td></tr><tr><td>10</td><td>2560</td></tr><tr><td>200</td><td>51200</td></tr><tr><td>script not found</td><td>32512</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>//&nbsp;pass&nbsp;two&nbsp;parameters,&nbsp;hello&nbsp;and&nbsp;world<br>status&nbsp;=&nbsp;shell_(pi,&nbsp;"scr1",&nbsp;"hello&nbsp;world");<br><br>//&nbsp;pass&nbsp;three&nbsp;parameters,&nbsp;hello,&nbsp;string&nbsp;with&nbsp;spaces,&nbsp;and&nbsp;world<br>status&nbsp;=&nbsp;shell_(pi,&nbsp;"scr1",&nbsp;"hello&nbsp;'string&nbsp;with&nbsp;spaces'&nbsp;world");<br><br>//&nbsp;pass&nbsp;one&nbsp;parameter,&nbsp;hello&nbsp;string&nbsp;with&nbsp;spaces&nbsp;world<br>status&nbsp;=&nbsp;shell_(pi,&nbsp;"scr1",&nbsp;"\"hello&nbsp;string&nbsp;with&nbsp;spaces&nbsp;world\"");<br></code><h3><a name="file_open"></a><a href="#int"><small>int</small></a> file_open<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#char">char</a> <a href="#*file">*file</a>, <a href="#unsigned">unsigned</a> <a href="#mode">mode</a>)</small></h3>
-This function returns a handle to a file opened in a specified mode.
-<br><br><code>&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>file:&nbsp;the&nbsp;file&nbsp;to&nbsp;open.<br>mode:&nbsp;the&nbsp;file&nbsp;open&nbsp;mode.<br></code><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_NO_HANDLE, PI_NO_FILE_ACCESS,
-PI_BAD_FILE_MODE, PI_FILE_OPEN_FAILED, or PI_FILE_IS_A_DIR.
-<br><br>File
-<br><br>A file may only be opened if permission is granted by an entry in
-/opt/pigpio/access. This is intended to allow remote access to files
-in a more or less controlled manner.
-<br><br>Each entry in /opt/pigpio/access takes the form of a file path
-which may contain wildcards followed by a single letter permission.
-The permission may be R for read, W for write, U for read/write,
-and N for no access.
-<br><br>Where more than one entry matches a file the most specific rule
-applies. If no entry matches a file then access is denied.
-<br><br>Suppose /opt/pigpio/access contains the following entries
-<br><br><code>/home/*&nbsp;n<br>/home/pi/shared/dir_1/*&nbsp;w<br>/home/pi/shared/dir_2/*&nbsp;r<br>/home/pi/shared/dir_3/*&nbsp;u<br>/home/pi/shared/dir_1/file.txt&nbsp;n<br></code><br><br>Files may be written in directory dir_1 with the exception
-of file.txt.
-<br><br>Files may be read in directory dir_2.
-<br><br>Files may be read and written in directory dir_3.
-<br><br>If a directory allows read, write, or read/write access then files may
-be created in that directory.
-<br><br>In an attempt to prevent risky permissions the following paths are
-ignored in /opt/pigpio/access.
-<br><br><code>a&nbsp;path&nbsp;containing&nbsp;..<br>a&nbsp;path&nbsp;containing&nbsp;only&nbsp;wildcards&nbsp;(*?)<br>a&nbsp;path&nbsp;containing&nbsp;less&nbsp;than&nbsp;two&nbsp;non-wildcard&nbsp;parts<br></code><br><br>Mode
-<br><br>The mode may have the following values.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Macro</td><td>Value</td><td>Meaning</td></tr><tr><td>PI_FILE_READ</td><td>1</td><td>open file for reading</td></tr><tr><td>PI_FILE_WRITE</td><td>2</td><td>open file for writing</td></tr><tr><td>PI_FILE_RW</td><td>3</td><td>open file for reading and writing</td></tr></tbody></table><br><br>The following values may be or'd into the mode.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Macro</td><td>Value</td><td>Meaning</td></tr><tr><td>PI_FILE_APPEND</td><td>4</td><td>Writes append data to the end of the file</td></tr><tr><td>PI_FILE_CREATE</td><td>8</td><td>The file is created if it doesn't exist</td></tr><tr><td>PI_FILE_TRUNC</td><td>16</td><td>The file is truncated</td></tr></tbody></table><br><br>Newly created files are owned by root with permissions owner read and write.
-<br><br><b><small>Example</small></b><br><br><code>#include&nbsp;&lt;stdio.h&gt;<br>#include&nbsp;&lt;pigpiod_if2.h&gt;<br><br>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;*argv[])<br>{<br>&nbsp;&nbsp;&nbsp;int&nbsp;pi,&nbsp;handle,&nbsp;c;<br>&nbsp;&nbsp;&nbsp;char&nbsp;buf[60000];<br><br>&nbsp;&nbsp;&nbsp;pi&nbsp;=&nbsp;pigpio_start(NULL,&nbsp;NULL);<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(pi&nbsp;&lt;&nbsp;0)&nbsp;return&nbsp;1;<br><br>&nbsp;&nbsp;&nbsp;//&nbsp;assumes&nbsp;/opt/pigpio/access&nbsp;contains&nbsp;the&nbsp;following&nbsp;line<br>&nbsp;&nbsp;&nbsp;//&nbsp;/ram/*.c&nbsp;r<br><br>&nbsp;&nbsp;&nbsp;handle&nbsp;=&nbsp;file_open(pi,&nbsp;"/ram/pigpio.c",&nbsp;PI_FILE_READ);<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(handle&nbsp;&gt;=&nbsp;0)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;((c=file_read(pi,&nbsp;handle,&nbsp;buf,&nbsp;sizeof(buf)-1)))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf[c]&nbsp;=&nbsp;0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("%s",&nbsp;buf);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;file_close(pi,&nbsp;handle);<br>&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;pigpio_stop(pi);<br>}<br></code><h3><a name="file_close"></a><a href="#int"><small>int</small></a> file_close<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This function closes the file associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#file_open">file_open</a>).<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<br><br><b><small>Example</small></b><br><br><code>file_close(pi,&nbsp;handle);<br></code><h3><a name="file_write"></a><a href="#int"><small>int</small></a> file_write<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function writes count bytes from buf to the the file
-associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#file_open">file_open</a>).<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;array&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM,
-PI_FILE_NOT_WOPEN, or PI_BAD_FILE_WRITE.
-<br><br><b><small>Example</small></b><br><br><code>if&nbsp;(file_write(pi,&nbsp;handle,&nbsp;buf,&nbsp;100)&nbsp;==&nbsp;0)<br>{<br>&nbsp;&nbsp;&nbsp;//&nbsp;file&nbsp;written&nbsp;okay<br>}<br>else<br>{<br>&nbsp;&nbsp;&nbsp;//&nbsp;error<br>}<br></code><h3><a name="file_read"></a><a href="#int"><small>int</small></a> file_read<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function reads up to count bytes from the the file
-associated with handle and writes them to buf.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#file_open">file_open</a>).<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data.<br>&nbsp;count:&nbsp;the&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></code><br><br>Returns the number of bytes read (&gt;0) if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, PI_FILE_NOT_ROPEN, or PI_BAD_FILE_WRITE.
-<br><br><b><small>Example</small></b><br><br><code>&nbsp;&nbsp;&nbsp;bytes&nbsp;=&nbsp;file_read(pi,&nbsp;handle,&nbsp;buf,&nbsp;sizeof(buf));<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(bytes&nbsp;&gt;=&nbsp;0)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;process&nbsp;read&nbsp;data<br>&nbsp;&nbsp;&nbsp;}<br></code><h3><a name="file_seek"></a><a href="#int"><small>int</small></a> file_seek<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#int32_t">int32_t</a> <a href="#seekOffset">seekOffset</a>, <a href="#int">int</a> <a href="#seekFrom">seekFrom</a>)</small></h3>
-This function seeks to a position within the file associated
-with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;&nbsp;&nbsp;handle:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#file_open">file_open</a>).<br>seekOffset:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;move.&nbsp;&nbsp;Positive&nbsp;offsets<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;move&nbsp;forward,&nbsp;negative&nbsp;offsets&nbsp;backwards.<br>&nbsp;&nbsp;seekFrom:&nbsp;one&nbsp;of&nbsp;PI_FROM_START&nbsp;(0),&nbsp;PI_FROM_CURRENT&nbsp;(1),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or&nbsp;PI_FROM_END&nbsp;(2).<br></code><br><br>Returns the new byte position within the file (&gt;=0) if OK, otherwise PI_BAD_HANDLE, or PI_BAD_FILE_SEEK.
-<br><br><b><small>Example</small></b><br><br><code>file_seek(pi,&nbsp;handle,&nbsp;123,&nbsp;PI_FROM_START);&nbsp;//&nbsp;Start&nbsp;plus&nbsp;123<br><br>size&nbsp;=&nbsp;file_seek(pi,&nbsp;handle,&nbsp;0,&nbsp;PI_FROM_END);&nbsp;//&nbsp;End,&nbsp;return&nbsp;size<br><br>pos&nbsp;=&nbsp;file_seek(pi,&nbsp;handle,&nbsp;0,&nbsp;PI_FROM_CURRENT);&nbsp;//&nbsp;Current&nbsp;position<br></code><h3><a name="file_list"></a><a href="#int"><small>int</small></a> file_list<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#char">char</a> <a href="#*fpat">*fpat</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function returns a list of files which match a pattern.
-<br><br><code>&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;fpat:&nbsp;file&nbsp;pattern&nbsp;to&nbsp;match.<br>&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;matching&nbsp;file&nbsp;names.<br>count:&nbsp;the&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></code><br><br>Returns the number of returned bytes if OK, otherwise PI_NO_FILE_ACCESS,
-or PI_NO_FILE_MATCH.
-<br><br>The pattern must match an entry in /opt/pigpio/access. The pattern
-may contain wildcards. See <a href="#file_open">file_open</a>.
-<br><br>NOTE
-<br><br>The returned value is not the number of files, it is the number
-of bytes in the buffer. The file names are separated by newline
-characters.
-<br><br><b><small>Example</small></b><br><br><code>#include&nbsp;&lt;stdio.h&gt;<br>#include&nbsp;&lt;pigpiod_if2.h&gt;<br><br>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;*argv[])<br>{<br>&nbsp;&nbsp;&nbsp;int&nbsp;pi,&nbsp;handle,&nbsp;c;<br>&nbsp;&nbsp;&nbsp;char&nbsp;buf[60000];<br><br>&nbsp;&nbsp;&nbsp;pi&nbsp;=&nbsp;pigpio_start(NULL,&nbsp;NULL);<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(pi&nbsp;&lt;&nbsp;0)&nbsp;return&nbsp;1;<br><br>&nbsp;&nbsp;&nbsp;//&nbsp;assumes&nbsp;/opt/pigpio/access&nbsp;contains&nbsp;the&nbsp;following&nbsp;line<br>&nbsp;&nbsp;&nbsp;//&nbsp;/ram/*.c&nbsp;r<br><br>&nbsp;&nbsp;&nbsp;c&nbsp;=&nbsp;file_list(pi,&nbsp;"/ram/p*.c",&nbsp;buf,&nbsp;sizeof(buf));<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(c&nbsp;&gt;=&nbsp;0)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf[c]&nbsp;=&nbsp;0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("%s",&nbsp;buf);<br>&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;pigpio_stop(pi);<br>}<br></code><h3><a name="callback"></a><a href="#int"><small>int</small></a> callback<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#edge">edge</a>, <a href="#CBFunc_t">CBFunc_t</a> <a href="#f">f</a>)</small></h3>
-This function initialises a new callback.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edge:&nbsp;RISING_EDGE,&nbsp;FALLING_EDGE,&nbsp;or&nbsp;EITHER_EDGE.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function.<br></code><br><br>The function returns a callback id if OK, otherwise pigif_bad_malloc,
-pigif_duplicate_callback, or pigif_bad_callback.
-<br><br>The callback is called with the GPIO, edge, and tick, whenever the
-GPIO has the identified edge.
-<br><br><code>Parameter&nbsp;&nbsp;&nbsp;Value&nbsp;&nbsp;&nbsp;&nbsp;Meaning<br><br>GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-31&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;GPIO&nbsp;which&nbsp;has&nbsp;changed&nbsp;state<br><br>edge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;=&nbsp;change&nbsp;to&nbsp;low&nbsp;(a&nbsp;falling&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&nbsp;change&nbsp;to&nbsp;high&nbsp;(a&nbsp;rising&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;=&nbsp;no&nbsp;level&nbsp;change&nbsp;(a&nbsp;watchdog&nbsp;timeout)<br><br>tick&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32&nbsp;bit&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;microseconds&nbsp;since&nbsp;boot<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WARNING:&nbsp;this&nbsp;wraps&nbsp;around&nbsp;from<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4294967295&nbsp;to&nbsp;0&nbsp;roughly&nbsp;every&nbsp;72&nbsp;minutes<br></code><br><br>The GPIO are sampled at a rate set when the pigpio daemon
-is started (default 5 us).
-<br><br>The number of samples per second is given in the following table.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;samples<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;per&nbsp;sec<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;1,000,000<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;500,000<br>sample&nbsp;&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;250,000<br>rate&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;200,000<br>(us)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8&nbsp;&nbsp;&nbsp;&nbsp;125,000<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;100,000<br></code><br><br>GPIO level changes shorter than the sample rate may be missed.
-<br><br>The daemon software which generates the callbacks is triggered
-1000 times per second. The callbacks will be called once per
-level change since the last time they were called.
-i.e. The callbacks will get all level changes but there will
-be a latency.
-<br><br>If you want to track the level of more than one GPIO do so by
-maintaining the state in the callback. Do not use <a href="#gpio_read">gpio_read</a>.
-Remember the event that triggered the callback may have
-happened several milliseconds before and the GPIO may have
-changed level many times since then.
-<h3><a name="callback_ex"></a><a href="#int"><small>int</small></a> callback_ex<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#edge">edge</a>, <a href="#CBFuncEx_t">CBFuncEx_t</a> <a href="#f">f</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-This function initialises a new callback.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edge:&nbsp;RISING_EDGE,&nbsp;FALLING_EDGE,&nbsp;or&nbsp;EITHER_EDGE.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function.<br>&nbsp;userdata:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;arbitrary&nbsp;user&nbsp;data.<br></code><br><br>The function returns a callback id if OK, otherwise pigif_bad_malloc,
-pigif_duplicate_callback, or pigif_bad_callback.
-<br><br>The callback is called with the GPIO, edge, tick, and the userdata
-pointer, whenever the GPIO has the identified edge.
-<br><br><code>Parameter&nbsp;&nbsp;&nbsp;Value&nbsp;&nbsp;&nbsp;&nbsp;Meaning<br><br>GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-31&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;GPIO&nbsp;which&nbsp;has&nbsp;changed&nbsp;state<br><br>edge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;=&nbsp;change&nbsp;to&nbsp;low&nbsp;(a&nbsp;falling&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&nbsp;change&nbsp;to&nbsp;high&nbsp;(a&nbsp;rising&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;=&nbsp;no&nbsp;level&nbsp;change&nbsp;(a&nbsp;watchdog&nbsp;timeout)<br><br>tick&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32&nbsp;bit&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;microseconds&nbsp;since&nbsp;boot<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WARNING:&nbsp;this&nbsp;wraps&nbsp;around&nbsp;from<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4294967295&nbsp;to&nbsp;0&nbsp;roughly&nbsp;every&nbsp;72&nbsp;minutes<br><br>userdata&nbsp;&nbsp;&nbsp;&nbsp;pointer&nbsp;&nbsp;Pointer&nbsp;to&nbsp;an&nbsp;arbitrary&nbsp;object<br></code><h3><a name="callback_cancel"></a><a href="#int"><small>int</small></a> callback_cancel<small>(<a href="#unsigned">unsigned</a> <a href="#callback_id">callback_id</a>)</small></h3>
-This function cancels a callback identified by its id.
-<br><br><code>callback_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#callback">callback</a>&nbsp;or&nbsp;<a href="#callback_ex">callback_ex</a>.<br></code><br><br>The function returns 0 if OK, otherwise pigif_callback_not_found.
-<h3><a name="wait_for_edge"></a><a href="#int"><small>int</small></a> wait_for_edge<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#edge">edge</a>, <a href="#double">double</a> <a href="#timeout">timeout</a>)</small></h3>
-This function waits for an edge on the GPIO for up to timeout
-seconds.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edge:&nbsp;RISING_EDGE,&nbsp;FALLING_EDGE,&nbsp;or&nbsp;EITHER_EDGE.<br>&nbsp;&nbsp;timeout:&nbsp;&gt;=0.<br></code><br><br>The function returns when the edge occurs or after the timeout.
-<br><br>Do not use this function for precise timing purposes,
-the edge is only checked 20 times a second. Whenever
-you need to know the accurate time of GPIO events use
-a <a href="#callback">callback</a> function.
-<br><br>The function returns 1 if the edge occurred, otherwise 0.
-<h3><a name="bsc_xfer"></a><a href="#int"><small>int</small></a> bsc_xfer<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#bsc_xfer_t">bsc_xfer_t</a> <a href="#*bscxfer">*bscxfer</a>)</small></h3>
-This function provides a low-level interface to the SPI/I2C Slave
-peripheral on the BCM chip.
-<br><br>This peripheral allows the Pi to act as a hardware slave device
-on an I2C or SPI bus.
-<br><br>This is not a bit bang version and as such is OS timing
-independent. The bus timing is handled directly by the chip.
-<br><br>The output process is simple. You simply append data to the FIFO
-buffer on the chip. This works like a queue, you add data to the
-queue and the master removes it.
-<br><br>I can't get SPI to work properly. I tried with a
-control word of 0x303 and swapped MISO and MOSI.
-<br><br>The function sets the BSC mode, writes any data in
-the transmit buffer to the BSC transmit FIFO, and
-copies any data in the BSC receive FIFO to the
-receive buffer.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>bscxfer:&nbsp;a&nbsp;structure&nbsp;defining&nbsp;the&nbsp;transfer.<br><br>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;control;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Write<br>&nbsp;&nbsp;&nbsp;int&nbsp;rxCnt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Read&nbsp;only<br>&nbsp;&nbsp;&nbsp;char&nbsp;rxBuf[BSC_FIFO_SIZE];&nbsp;//&nbsp;Read&nbsp;only<br>&nbsp;&nbsp;&nbsp;int&nbsp;txCnt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Write<br>&nbsp;&nbsp;&nbsp;char&nbsp;txBuf[BSC_FIFO_SIZE];&nbsp;//&nbsp;Write<br>}&nbsp;bsc_xfer_t;<br></code><br><br>To start a transfer set control (see below), copy the bytes to
-be added to the transmit FIFO (if any) to txBuf and set txCnt to
-the number of copied bytes.
-<br><br>Upon return rxCnt will be set to the number of received bytes placed
-in rxBuf.
-<br><br>The returned function value is the status of the transfer (see below).
-<br><br>If there was an error the status will be less than zero
-(and will contain the error code).
-<br><br>The most significant word of the returned status contains the number
-of bytes actually copied from txBuf to the BSC transmit FIFO (may be
-less than requested if the FIFO already contained untransmitted data).
-<br><br>Note that the control word sets the BSC mode. The BSC will stay in
-that mode until a different control word is sent.
-<br><br>GPIO used for models other than those based on the BCM2711.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td><td>MOSI</td><td>SCLK</td><td>MISO</td><td>CE</td></tr><tr><td>I2C</td><td>18</td><td>19</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>SPI</td><td>-</td><td>-</td><td>18</td><td>19</td><td>20</td><td>21</td></tr></tbody></table><br><br>GPIO used for models based on the BCM2711 (e.g. the Pi4B).
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td><td>MOSI</td><td>SCLK</td><td>MISO</td><td>CE</td></tr><tr><td>I2C</td><td>10</td><td>11</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>SPI</td><td>-</td><td>-</td><td>10</td><td>11</td><td>9</td><td>8</td></tr></tbody></table><br><br>When a zero control word is received the used GPIO will be reset
-to INPUT mode.
-<br><br>control consists of the following bits.
-<br><br><code>22&nbsp;21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;IT&nbsp;HC&nbsp;TF&nbsp;IR&nbsp;RE&nbsp;TE&nbsp;BK&nbsp;EC&nbsp;ES&nbsp;PL&nbsp;PH&nbsp;I2&nbsp;SP&nbsp;EN<br></code><br><br>Bits 0-13 are copied unchanged to the BSC CR register. See
-pages 163-165 of the Broadcom peripherals document for full
-details.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>aaaaaaa</td><td>defines the I2C slave address (only relevant in I2C mode)</td></tr><tr><td>IT</td><td>invert transmit status flags</td></tr><tr><td>HC</td><td>enable host control</td></tr><tr><td>TF</td><td>enable test FIFO</td></tr><tr><td>IR</td><td>invert receive status flags</td></tr><tr><td>RE</td><td>enable receive</td></tr><tr><td>TE</td><td>enable transmit</td></tr><tr><td>BK</td><td>abort operation and clear FIFOs</td></tr><tr><td>EC</td><td>send control register as first I2C byte</td></tr><tr><td>ES</td><td>send status register as first I2C byte</td></tr><tr><td>PL</td><td>set SPI polarity high</td></tr><tr><td>PH</td><td>set SPI phase high</td></tr><tr><td>I2</td><td>enable I2C mode</td></tr><tr><td>SP</td><td>enable SPI mode</td></tr><tr><td>EN</td><td>enable BSC peripheral</td></tr></tbody></table><br><br>The returned status has the following format
-<br><br><code>20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;RB&nbsp;TE&nbsp;RF&nbsp;TF&nbsp;RE&nbsp;TB<br></code><br><br>Bits 0-15 are copied unchanged from the BSC FR register. See
-pages 165-166 of the Broadcom peripherals document for full
-details.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>SSSSS</td><td>number of bytes successfully copied to transmit FIFO</td></tr><tr><td>RRRRR</td><td>number of bytes in receieve FIFO</td></tr><tr><td>TTTTT</td><td>number of bytes in transmit FIFO</td></tr><tr><td>RB</td><td>receive busy</td></tr><tr><td>TE</td><td>transmit FIFO empty</td></tr><tr><td>RF</td><td>receive FIFO full</td></tr><tr><td>TF</td><td>transmit FIFO full</td></tr><tr><td>RE</td><td>receive FIFO empty</td></tr><tr><td>TB</td><td>transmit busy</td></tr></tbody></table><br><br>The following example shows how to configure the BSC peripheral as
-an I2C slave with address 0x13 and send four bytes.
-<br><br><b><small>Example</small></b><br><br><code>bsc_xfer_t&nbsp;xfer;<br><br>xfer.control&nbsp;=&nbsp;(0x13&lt;&lt;16)&nbsp;|&nbsp;0x305;<br><br>memcpy(xfer.txBuf,&nbsp;"ABCD",&nbsp;4);<br>xfer.txCnt&nbsp;=&nbsp;4;<br><br>status&nbsp;=&nbsp;bsc_xfer(pi,&nbsp;&xfer);<br><br>if&nbsp;(status&nbsp;&gt;=&nbsp;0)<br>{<br>&nbsp;&nbsp;&nbsp;//&nbsp;process&nbsp;transfer<br>}<br></code><h3><a name="bsc_i2c"></a><a href="#int"><small>int</small></a> bsc_i2c<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#int">int</a> <a href="#i2c_addr">i2c_addr</a>, <a href="#bsc_xfer_t">bsc_xfer_t</a> <a href="#*bscxfer">*bscxfer</a>)</small></h3>
-This function allows the Pi to act as a slave I2C device.
-<br><br>This function is not available on the BCM2711 (e.g.as
-used in the Pi4B).
-<br><br>The data bytes (if any) are written to the BSC transmit
-FIFO and the bytes in the BSC receive FIFO are returned.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>i2c_addr:&nbsp;0-0x7F.<br>&nbsp;bscxfer:&nbsp;a&nbsp;structure&nbsp;defining&nbsp;the&nbsp;transfer.<br><br>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;control;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;N/A<br>&nbsp;&nbsp;&nbsp;int&nbsp;rxCnt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Read&nbsp;only<br>&nbsp;&nbsp;&nbsp;char&nbsp;rxBuf[BSC_FIFO_SIZE];&nbsp;//&nbsp;Read&nbsp;only<br>&nbsp;&nbsp;&nbsp;int&nbsp;txCnt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Write<br>&nbsp;&nbsp;&nbsp;char&nbsp;txBuf[BSC_FIFO_SIZE];&nbsp;//&nbsp;Write<br>}&nbsp;bsc_xfer_t;<br></code><br><br>txCnt is set to the number of bytes to be transmitted, possibly
-zero. The data itself should be copied to txBuf.
-<br><br>Any received data will be written to rxBuf with rxCnt set.
-<br><br>See <a href="#bsc_xfer">bsc_xfer</a> for details of the returned status value.
-<br><br>If there was an error the status will be less than zero
-(and will contain the error code).
-<br><br>Note that an i2c_address of 0 may be used to close
-the BSC device and reassign the used GPIO as inputs.
-<h3><a name="event_callback"></a><a href="#int"><small>int</small></a> event_callback<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#event">event</a>, <a href="#evtCBFunc_t">evtCBFunc_t</a> <a href="#f">f</a>)</small></h3>
-This function initialises an event callback.
-<br><br><code>&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>event:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function.<br></code><br><br>The function returns a callback id if OK, otherwise pigif_bad_malloc,
-pigif_duplicate_callback, or pigif_bad_callback.
-<br><br>The callback is called with the event id, and tick, whenever the
-event occurs.
-<h3><a name="event_callback_ex"></a><a href="#int"><small>int</small></a> event_callback_ex<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#event">event</a>, <a href="#evtCBFuncEx_t">evtCBFuncEx_t</a> <a href="#f">f</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-This function initialises an event callback.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;&nbsp;event:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function.<br>userdata:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;arbitrary&nbsp;user&nbsp;data.<br></code><br><br>The function returns a callback id if OK, otherwise pigif_bad_malloc,
-pigif_duplicate_callback, or pigif_bad_callback.
-<br><br>The callback is called with the event id, the tick, and the userdata
-pointer whenever the event occurs.
-<h3><a name="event_callback_cancel"></a><a href="#int"><small>int</small></a> event_callback_cancel<small>(<a href="#unsigned">unsigned</a> <a href="#callback_id">callback_id</a>)</small></h3>
-This function cancels an event callback identified by its id.
-<br><br><code>callback_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#event_callback">event_callback</a>&nbsp;or<br><a href="#event_callback_ex">event_callback_ex</a>.<br></code><br><br>The function returns 0 if OK, otherwise pigif_callback_not_found.
-<h3><a name="wait_for_event"></a><a href="#int"><small>int</small></a> wait_for_event<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#event">event</a>, <a href="#double">double</a> <a href="#timeout">timeout</a>)</small></h3>
-This function waits for an event for up to timeout seconds.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;event:&nbsp;0-31.<br>timeout:&nbsp;&gt;=0.<br></code><br><br>The function returns when the event occurs or after the timeout.
-<br><br>The function returns 1 if the event occurred, otherwise 0.
-<h3><a name="event_trigger"></a><a href="#int"><small>int</small></a> event_trigger<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#event">event</a>)</small></h3>
-This function signals the occurrence of an event.
-<br><br><code>&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>event:&nbsp;0-31.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_EVENT_ID.
-<br><br>An event is a signal used to inform one or more consumers
-to start an action. Each consumer which has registered an interest
-in the event (e.g. by calling <a href="#event_callback">event_callback</a>) will be informed by
-a callback.
-<br><br>One event, PI_EVENT_BSC (31) is predefined. This event is
-auto generated on BSC slave activity.
-<br><br>The meaning of other events is arbitrary.
-<br><br>Note that other than its id and its tick there is no data associated
-with an event.
-<h2>PARAMETERS</h2><h3><a name="active">active</a>: 0-1000000</h3>
-The number of microseconds level changes are reported for once
-a noise filter has been triggered (by <a href="#steady">steady</a> microseconds of
-a stable level).
-<h3><a name="*addrStr">*addrStr</a></h3>
-A string specifying the host or IP address of the Pi running
-the pigpio daemon. It may be NULL in which case localhost
-is used unless overridden by the PIGPIO_ADDR environment
-variable.
-<h3><a name="arg1">arg1</a></h3>
-An unsigned argument passed to a user customised function. Its
-meaning is defined by the customiser.
-<h3><a name="arg2">arg2</a></h3>
-An unsigned argument passed to a user customised function. Its
-meaning is defined by the customiser.
-<h3><a name="argc">argc</a></h3>
-The count of bytes passed to a user customised function.
-<h3><a name="*argx">*argx</a></h3>
-A pointer to an array of bytes passed to a user customised function.
-Its meaning and content is defined by the customiser.
-<h3><a name="baud">baud</a></h3>
-The speed of serial communication (I2C, SPI, serial link, waves) in
-bits per second.
-<h3><a name="bit">bit</a></h3>
-A value of 0 or 1.
-<h3><a name="bits">bits</a></h3>
-A value used to select GPIO. If bit n of bits is set then GPIO n is
-selected.
-<br><br>A convenient way to set bit n is to or in (1&lt;&lt;n).
-<br><br>e.g. to select bits 5, 9, 23 you could use (1&lt;&lt;5) | (1&lt;&lt;9) | (1&lt;&lt;23).
-<h3><a name="bsc_xfer_t">bsc_xfer_t</a></h3>
-<code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;control;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Write<br>&nbsp;&nbsp;&nbsp;int&nbsp;rxCnt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Read&nbsp;only<br>&nbsp;&nbsp;&nbsp;char&nbsp;rxBuf[BSC_FIFO_SIZE];&nbsp;//&nbsp;Read&nbsp;only<br>&nbsp;&nbsp;&nbsp;int&nbsp;txCnt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Write<br>&nbsp;&nbsp;&nbsp;char&nbsp;txBuf[BSC_FIFO_SIZE];&nbsp;//&nbsp;Write<br>}&nbsp;bsc_xfer_t;<br></code><h3><a name="*bscxfer">*bscxfer</a></h3>
-A pointer to a <a href="#bsc_xfer_t">bsc_xfer_t</a> object used to control a BSC transfer.
-<h3><a name="*buf">*buf</a></h3>
-A buffer to hold data being sent or being received.
-<h3><a name="bufSize">bufSize</a></h3>
-The size in bytes of a buffer.
-<h3><a name="bVal">bVal</a>: 0-255 (Hex 0x0-0xFF, Octal 0-0377)</h3>
-An 8-bit byte value.
-<h3><a name="callback_id">callback_id</a></h3>
-A value &gt;=0, as returned by a call to a callback function, one of
-<br><br><a href="#callback">callback</a><br>
-<a href="#callback_ex">callback_ex</a><br>
-<a href="#event_callback">event_callback</a><br>
-<a href="#event_callback_ex">event_callback_ex</a>
-<br><br>The id is passed to <a href="#callback_cancel">callback_cancel</a> or <a href="#event_callback_cancel">event_callback_cancel</a>
-to cancel the callback.
-<h3><a name="CBFunc_t">CBFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*CBFunc_t)<br>&nbsp;&nbsp;&nbsp;(int&nbsp;pi,&nbsp;unsigned&nbsp;user_gpio,&nbsp;unsigned&nbsp;level,&nbsp;uint32_t&nbsp;tick);<br></code><h3><a name="CBFuncEx_t">CBFuncEx_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*CBFuncEx_t)<br>&nbsp;&nbsp;&nbsp;(int&nbsp;pi,&nbsp;unsigned&nbsp;user_gpio,&nbsp;unsigned&nbsp;level,&nbsp;uint32_t&nbsp;tick,&nbsp;void&nbsp;*&nbsp;userdata);<br></code><h3><a name="char">char</a></h3>
-A single character, an 8 bit quantity able to store 0-255.
-<h3><a name="clkfreq">clkfreq</a>: 4689-250M (13184-375M for the BCM2711)</h3>
-The hardware clock frequency.
-<h3><a name="count">count</a></h3>
-The number of bytes to be transferred in a file, I2C, SPI, or serial
-command.
-<h3><a name="CS">CS</a></h3>
-The GPIO used for the slave select signal when bit banging SPI.
-<h3><a name="data_bits">data_bits</a>: 1-32</h3>
-The number of data bits in each character of serial data.
-<br><br><code>#define&nbsp;PI_MIN_WAVE_DATABITS&nbsp;1<br>#define&nbsp;PI_MAX_WAVE_DATABITS&nbsp;32<br></code><h3><a name="double">double</a></h3>
-A floating point number.
-<h3><a name="dutycycle">dutycycle</a>: 0-range</h3>
-A number representing the ratio of on time to off time for PWM.
-<br><br>The number may vary between 0 and range (default 255) where
-0 is off and range is fully on.
-<h3><a name="edge">edge</a></h3>
-Used to identify a GPIO level transition of interest. A rising edge is
-a level change from 0 to 1. A falling edge is a level change from 1 to 0.
-<br><br><code>RISING_EDGE&nbsp;&nbsp;0<br>FALLING_EDGE&nbsp;1<br>EITHER_EDGE.&nbsp;2<br></code><h3><a name="errnum">errnum</a></h3>
-A negative number indicating a function call failed and the nature
-of the error.
-<h3><a name="event">event</a>: 0-31</h3>
-An event is a signal used to inform one or more consumers
-to start an action.
-<h3><a name="evtCBFunc_t">evtCBFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*evtCBFunc_t)<br>&nbsp;&nbsp;&nbsp;(int&nbsp;pi,&nbsp;unsigned&nbsp;event,&nbsp;uint32_t&nbsp;tick);<br></code><h3><a name="evtCBFuncEx_t">evtCBFuncEx_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*evtCBFuncEx_t)<br>&nbsp;&nbsp;&nbsp;(int&nbsp;pi,&nbsp;unsigned&nbsp;event,&nbsp;uint32_t&nbsp;tick,&nbsp;void&nbsp;*userdata);<br></code><h3><a name="f">f</a></h3>
-A function.
-<h3><a name="*file">*file</a></h3>
-A full file path. To be accessible the path must match an entry in
-/opt/pigpio/access.
-<h3><a name="*fpat">*fpat</a></h3>
-A file path which may contain wildcards. To be accessible the path
-must match an entry in /opt/pigpio/access.
-<h3><a name="frequency">frequency</a>: &gt;=0</h3>
-The number of times a GPIO is swiched on and off per second. This
-can be set per GPIO and may be as little as 5Hz or as much as
-40KHz. The GPIO will be on for a proportion of the time as defined
-by its dutycycle.
-<h3><a name="gpio">gpio</a></h3>
-A Broadcom numbered GPIO, in the range 0-53.
-<br><br>There are 54 General Purpose Input Outputs (GPIO) named GPIO0 through
-GPIO53.
-<br><br>They are split into two banks. Bank 1 consists of GPIO0 through
-GPIO31. Bank 2 consists of GPIO32 through GPIO53.
-<br><br>All the GPIO which are safe for the user to read and write are in
-bank 1. Not all GPIO in bank 1 are safe though. Type 1 boards
-have 17 safe GPIO. Type 2 boards have 21. Type 3 boards have 26.
-<br><br>See <a href="#get_hardware_revision">get_hardware_revision</a>.
-<br><br>The user GPIO are marked with an X in the following table.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;1&nbsp;&nbsp;2&nbsp;&nbsp;3&nbsp;&nbsp;4&nbsp;&nbsp;5&nbsp;&nbsp;6&nbsp;&nbsp;7&nbsp;&nbsp;8&nbsp;&nbsp;9&nbsp;10&nbsp;11&nbsp;12&nbsp;13&nbsp;14&nbsp;15<br>Type&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16&nbsp;17&nbsp;18&nbsp;19&nbsp;20&nbsp;21&nbsp;22&nbsp;23&nbsp;24&nbsp;25&nbsp;26&nbsp;27&nbsp;28&nbsp;29&nbsp;30&nbsp;31<br>Type&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-<br>Type&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-<br></code><h3><a name="gpioPulse_t">gpioPulse_t</a></h3>
-<code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOn;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOff;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;usDelay;<br>}&nbsp;gpioPulse_t;<br></code><h3><a name="gpioThreadFunc_t">gpioThreadFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;*(gpioThreadFunc_t)&nbsp;(void&nbsp;*);<br></code><h3><a name="handle">handle</a>: &gt;=0</h3>
-A number referencing an object opened by one of
-<br><br><a href="#file_open">file_open</a><br>
-<a href="#i2c_open">i2c_open</a><br>
-<a href="#notify_open">notify_open</a><br>
-<a href="#serial_open">serial_open</a><br>
-<a href="#spi_open">spi_open</a>
-<h3><a name="i2c_addr">i2c_addr</a>: 0-0x7F</h3>
-The address of a device on the I2C bus.
-<h3><a name="i2c_bus">i2c_bus</a>: &gt;=0</h3>
-An I2C bus number.
-<h3><a name="i2c_flags">i2c_flags</a>: 0</h3>
-Flags which modify an I2C open command. None are currently defined.
-<h3><a name="i2c_reg">i2c_reg</a>: 0-255</h3>
-A register of an I2C device.
-<h3><a name="*inBuf">*inBuf</a></h3>
-A buffer used to pass data to a function.
-<h3><a name="inLen">inLen</a></h3>
-The number of bytes of data in a buffer.
-<h3><a name="int">int</a></h3>
-A whole number, negative or positive.
-<h3><a name="int32_t">int32_t</a></h3>
-A 32-bit signed value.
-<h3><a name="invert">invert</a></h3>
-A flag used to set normal or inverted bit bang serial data level logic.
-<h3><a name="level">level</a></h3>
-The level of a GPIO. Low or High.
-<br><br><code>PI_OFF&nbsp;0<br>PI_ON&nbsp;1<br><br>PI_CLEAR&nbsp;0<br>PI_SET&nbsp;1<br><br>PI_LOW&nbsp;0<br>PI_HIGH&nbsp;1<br></code><br><br>There is one exception. If a watchdog expires on a GPIO the level will be
-reported as PI_TIMEOUT. See <a href="#set_watchdog">set_watchdog</a>.
-<br><br><code>PI_TIMEOUT&nbsp;2<br></code><h3><a name="MISO">MISO</a></h3>
-The GPIO used for the MISO signal when bit banging SPI.
-<h3><a name="mode">mode</a></h3>
-1. The operational mode of a GPIO, normally INPUT or OUTPUT.
-<br><br><code>PI_INPUT&nbsp;0<br>PI_OUTPUT&nbsp;1<br>PI_ALT0&nbsp;4<br>PI_ALT1&nbsp;5<br>PI_ALT2&nbsp;6<br>PI_ALT3&nbsp;7<br>PI_ALT4&nbsp;3<br>PI_ALT5&nbsp;2<br></code><br><br>2. The mode of waveform transmission.
-<br><br><code>PI_WAVE_MODE_ONE_SHOT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0<br>PI_WAVE_MODE_REPEAT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1<br>PI_WAVE_MODE_ONE_SHOT_SYNC&nbsp;2<br>PI_WAVE_MODE_REPEAT_SYNC&nbsp;&nbsp;&nbsp;3<br></code><br><br>3. A file open mode.
-<br><br><code>PI_FILE_READ&nbsp;&nbsp;1<br>PI_FILE_WRITE&nbsp;2<br>PI_FILE_RW&nbsp;&nbsp;&nbsp;&nbsp;3<br></code><br><br>The following values can be or'd into the mode.
-<br><br><code>PI_FILE_APPEND&nbsp;4<br>PI_FILE_CREATE&nbsp;8<br>PI_FILE_TRUNC&nbsp;&nbsp;16<br></code><h3><a name="MOSI">MOSI</a></h3>
-The GPIO used for the MOSI signal when bit banging SPI.
-<h3><a name="numBytes">numBytes</a></h3>
-The number of bytes used to store characters in a string. Depending
-on the number of bits per character there may be 1, 2, or 4 bytes
-per character.
-<h3><a name="numPar">numPar</a>: 0-10</h3>
-The number of parameters passed to a script.
-<h3><a name="numPulses">numPulses</a></h3>
-The number of pulses to be added to a waveform.
-<h3><a name="offset">offset</a></h3>
-The associated data starts this number of microseconds from the start of
-the waveform.
-<h3><a name="*outBuf">*outBuf</a></h3>
-A buffer used to return data from a function.
-<h3><a name="outLen">outLen</a></h3>
-The size in bytes of an output buffer.
-<h3><a name="pad">pad</a>: 0-2</h3>
-A set of GPIO which share common drivers.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><h3><a name="padStrength">padStrength</a>: 1-16</h3>
-The mA which may be drawn from each GPIO whilst still guaranteeing the
-high and low levels.
-<h3><a name="*param">*param</a></h3>
-An array of script parameters.
-<h3><a name="percent">percent</a>: 0-100</h3>
-The size of waveform as percentage of maximum available.
-<h3><a name="pi">pi</a></h3>
-An integer defining a connected Pi. The value is returned by
-<a href="#pigpio_start">pigpio_start</a> upon success.
-<h3><a name="*portStr">*portStr</a></h3>
-A string specifying the port address used by the Pi running
-the pigpio daemon. It may be NULL in which case "8888"
-is used unless overridden by the PIGPIO_PORT environment
-variable.
-<h3><a name="*pth">*pth</a></h3>
-A thread identifier, returned by <a href="#start_thread">start_thread</a>.
-<h3><a name="pthread_t">pthread_t</a></h3>
-A thread identifier.
-<h3><a name="pud">pud</a>: 0-2</h3>
-The setting of the pull up/down resistor for a GPIO, which may be off,
-pull-up, or pull-down.
-<code>PI_PUD_OFF&nbsp;0<br>PI_PUD_DOWN&nbsp;1<br>PI_PUD_UP&nbsp;2<br></code><h3><a name="pulseLen">pulseLen</a></h3>
-1-100, the length of a trigger pulse in microseconds.
-<h3><a name="*pulses">*pulses</a></h3>
-An array of pulses to be added to a waveform.
-<h3><a name="pulsewidth">pulsewidth</a>: 0, 500-2500</h3>
-<code>PI_SERVO_OFF&nbsp;0<br>PI_MIN_SERVO_PULSEWIDTH&nbsp;500<br>PI_MAX_SERVO_PULSEWIDTH&nbsp;2500<br></code><h3><a name="PWMduty">PWMduty</a>: 0-1000000 (1M)</h3>
-The hardware PWM dutycycle.
-<br><br><code>#define&nbsp;PI_HW_PWM_RANGE&nbsp;1000000<br></code><h3><a name="PWMfreq">PWMfreq</a>: 1-125M (1-187.5M for the BCM2711)</h3>
-The hardware PWM frequency.
-<br><br><code>#define&nbsp;PI_HW_PWM_MIN_FREQ&nbsp;1<br>#define&nbsp;PI_HW_PWM_MAX_FREQ&nbsp;125000000<br>#define&nbsp;PI_HW_PWM_MAX_FREQ_2711&nbsp;187500000<br></code><h3><a name="range">range</a>: 25-40000</h3>
-The permissible dutycycle values are 0-range.
-<br><br><code>PI_MIN_DUTYCYCLE_RANGE&nbsp;25<br>PI_MAX_DUTYCYCLE_RANGE&nbsp;40000<br></code><h3><a name="*retBuf">*retBuf</a></h3>
-A buffer to hold a number of bytes returned to a used customised function,
-<h3><a name="retMax">retMax</a></h3>
-The maximum number of bytes a user customised function should return.
-<h3><a name="*rxBuf">*rxBuf</a></h3>
-A pointer to a buffer to receive data.
-<h3><a name="SCL">SCL</a></h3>
-The user GPIO to use for the clock when bit banging I2C.
-<h3><a name="SCLK">SCLK</a></h3>
-The GPIO used for the SCLK signal when bit banging SPI.
-<h3><a name="*script">*script</a></h3>
-A pointer to the text of a script.
-<h3><a name="script_id">script_id</a></h3>
-An id of a stored script as returned by <a href="#store_script">store_script</a>.
-<h3><a name="*scriptName">*scriptName</a></h3>
-The name of a <a href="#shell_">shell_</a> script to be executed. The script must be present in
-/opt/pigpio/cgi and must have execute permission.
-<h3><a name="*scriptString">*scriptString</a></h3>
-The string to be passed to a <a href="#shell_">shell_</a> script to be executed.
-<h3><a name="SDA">SDA</a></h3>
-The user GPIO to use for data when bit banging I2C.
-<h3><a name="seconds">seconds</a></h3>
-The number of seconds.
-<h3><a name="seekFrom">seekFrom</a></h3>
-<code>PI_FROM_START&nbsp;&nbsp;&nbsp;0<br>PI_FROM_CURRENT&nbsp;1<br>PI_FROM_END&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2<br></code><h3><a name="seekOffset">seekOffset</a></h3>
-The number of bytes to move forward (positive) or backwards (negative)
-from the seek position (start, current, or end of file).
-<h3><a name="ser_flags">ser_flags</a></h3>
-Flags which modify a serial open command. None are currently defined.
-<h3><a name="*ser_tty">*ser_tty</a></h3>
-The name of a serial tty device, e.g. /dev/ttyAMA0, /dev/ttyUSB0, /dev/tty1.
-<h3><a name="size_t">size_t</a></h3>
-A standard type used to indicate the size of an object in bytes.
-<h3><a name="spi_channel">spi_channel</a></h3>
-A SPI channel, 0-2.
-<h3><a name="spi_flags">spi_flags</a></h3>
-See <a href="#spi_open">spi_open</a> and <a href="#bb_spi_open">bb_spi_open</a>.
-<h3><a name="steady">steady</a>: 0-300000</h3>
-The number of microseconds level changes must be stable for
-before reporting the level changed (<a href="#set_glitch_filter">set_glitch_filter</a>) or triggering
-the active part of a noise filter (<a href="#set_noise_filter">set_noise_filter</a>).
-<h3><a name="stop_bits">stop_bits</a>: 2-8</h3>
-The number of (half) stop bits to be used when adding serial data
-to a waveform.
-<br><br><code>#define&nbsp;PI_MIN_WAVE_HALFSTOPBITS&nbsp;2<br>#define&nbsp;PI_MAX_WAVE_HALFSTOPBITS&nbsp;8<br></code><h3><a name="*str">*str</a></h3>
- An array of characters.
-<h3><a name="thread_func">thread_func</a></h3>
-A function of type gpioThreadFunc_t used as the main function of a
-thread.
-<h3><a name="timeout">timeout</a></h3>
-A GPIO watchdog timeout in milliseconds.
-<br><br><code>PI_MIN_WDOG_TIMEOUT&nbsp;0<br>PI_MAX_WDOG_TIMEOUT&nbsp;60000<br></code><h3><a name="*txBuf">*txBuf</a></h3>
-An array of bytes to transmit.
-<h3><a name="uint32_t">uint32_t</a>: 0-0-4,294,967,295 (Hex 0x0-0xFFFFFFFF)</h3>
-A 32-bit unsigned value.
-<h3><a name="unsigned">unsigned</a></h3>
-A whole number &gt;= 0.
-<h3><a name="user_gpio">user_gpio</a></h3>
-0-31, a Broadcom numbered GPIO.
-<br><br>See <a href="#gpio">gpio</a>.
-<h3><a name="*userdata">*userdata</a></h3>
-A pointer to arbitrary user data. This may be used to identify the instance.
-<br><br>You must ensure that the pointer is in scope at the time it is processed. If
-it is a pointer to a global this is automatic. Do not pass the address of a
-local variable. If you want to pass a transient object then use the
-following technique.
-<br><br>In the calling function:
-<br><br><code>user_type&nbsp;*userdata;<br><br>user_type&nbsp;my_userdata;<br><br>userdata&nbsp;=&nbsp;malloc(sizeof(user_type));<br><br>*userdata&nbsp;=&nbsp;my_userdata;<br></code><br><br>In the receiving function:
-<br><br><code>user_type&nbsp;my_userdata&nbsp;=&nbsp;*(user_type*)userdata;<br><br>free(userdata);<br></code><h3><a name="void">void</a></h3>
-Denoting no parameter is required
-<h3><a name="wave_add_*">wave_add_*</a></h3>
-One of
-<br><br><a href="#wave_add_new">wave_add_new</a><br>
-<a href="#wave_add_generic">wave_add_generic</a><br>
-<a href="#wave_add_serial">wave_add_serial</a>
-<h3><a name="wave_id">wave_id</a></h3>
-A number representing a waveform created by <a href="#wave_create">wave_create</a>.
-<h3><a name="wave_send_*">wave_send_*</a></h3>
-One of
-<br><br><a href="#wave_send_once">wave_send_once</a><br>
-<a href="#wave_send_repeat">wave_send_repeat</a>
-<h3><a name="wVal">wVal</a>: 0-65535 (Hex 0x0-0xFFFF, Octal 0-0177777)</h3>
-A 16-bit word value.
-<h2>pigpiod_if2 Error Codes</h2><code><br>typedef&nbsp;enum<br>{<br>&nbsp;&nbsp;&nbsp;pigif_bad_send&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2000,<br>&nbsp;&nbsp;&nbsp;pigif_bad_recv&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2001,<br>&nbsp;&nbsp;&nbsp;pigif_bad_getaddrinfo&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2002,<br>&nbsp;&nbsp;&nbsp;pigif_bad_connect&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2003,<br>&nbsp;&nbsp;&nbsp;pigif_bad_socket&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2004,<br>&nbsp;&nbsp;&nbsp;pigif_bad_noib&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2005,<br>&nbsp;&nbsp;&nbsp;pigif_duplicate_callback&nbsp;=&nbsp;-2006,<br>&nbsp;&nbsp;&nbsp;pigif_bad_malloc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2007,<br>&nbsp;&nbsp;&nbsp;pigif_bad_callback&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2008,<br>&nbsp;&nbsp;&nbsp;pigif_notify_failed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2009,<br>&nbsp;&nbsp;&nbsp;pigif_callback_not_found&nbsp;=&nbsp;-2010,<br>&nbsp;&nbsp;&nbsp;pigif_unconnected_pi&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2011,<br>&nbsp;&nbsp;&nbsp;pigif_too_many_pis&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2012,<br>}&nbsp;pigifError_t;<br><br></code></td>
-</table>
-<div style="vertical-align: center; text-align: center; background-color:#98bf21; font-size:0.8em; height:30px"><a class="l2" href="index.html">[pigpio]</a>
-<a class="l2" href="cif.html">[pigpio C I/F]</a>
-<a class="l2" href="pigpiod.html">[pigpiod]</a>
-<a class="l2" href="pdif2.html">[pigpiod C I/F]</a>
-<a class="l2" href="python.html">[Python]</a>
-<a class="l2" href="pigs.html">[pigs]</a>
-<a class="l2" href="piscope.html">[piscope]</a>
-<a class="l2" href="misc.html">[Misc]</a>
-<a class="l2" href="examples.html">[Examples]</a>
-<a class="l2" href="download.html">[Download]</a>
-<a class="l2" href="faq.html">[FAQ]</a>
-<a class="l2" href="sitemap.html">[Site Map]</a>
-</div>
-<table><tr>
-<td style="width: 200px"><div style="text-align: left;"><small>&copy; 2012-2020</small></div></td>
-<td style="width: 350px"><div style="text-align: center;">e-mail: pigpio @ abyz.me.uk</div></td>
-<td style="width: 200px"><div style="text-align: right;"><small>Updated: 30/04/2020</small></div></td>
-</tr></table>
-</td>
-</table>
-</body>
-</html>
diff --git a/DOC/HTML/pif.html b/DOC/HTML/pif.html
deleted file mode 100644
index 1cc3c17..0000000
--- a/DOC/HTML/pif.html
+++ /dev/null
@@ -1,85 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta name="description" content="Raspberry Pi Reg. C GPIO library and Python GPIO module and shell command utilities to control the GPIO, including SPI, I2C, and serial links." />
- <meta name="keywords" content="raspberry, pi, C, Python, GPIO, library, shell, command, utilities, module, SPI, I2C, serial" />
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>pigpio library</title>
- <link rel="stylesheet" type="text/css" href="scripts/index.css">
- <link rel="icon" href="favicon.ico" type="image/x-icon">
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
-</head>
-<body>
-
-<table style="padding:0px; border:0px; margin:0px; width:780px; background-color:#e0e0e0;">
-<td style="background:#EAF2E6 url('images/sidebar.gif') repeat-y; width:35px; height:100%"></td>
-<td>
-<table>
-<div style="background:url('images/topbar.gif') repeat-x; height: 70px; font-size:1.5em; vertical-align: top;"><a href="index.html"><img src="images/pigpio-logo.gif" border="0" /></a>pigpio library</div>
-</table>
-<table><div>
-<td><img src="images/switches.jpg" width="250"></td>
-<td><img src="images/uln2003a.jpg" width="250"></td>
-<td><img src="images/yl-40.jpg" width="250"></td>
-</div></table>
-<table>
-<td style="vertical-align: top; background-color: #98bf21;"><a class="l1" href="index.html">pigpio</a>
-<a class="l1" href="cif.html">pigpio C I/F</a>
-<a class="l1" href="pigpiod.html">pigpiod</a>
-<a class="l1" href="pdif2.html">pigpiod C I/F</a>
-<a class="l1" href="python.html">Python</a>
-<a class="l1" href="pigs.html">pigs</a>
-<a class="l1" href="piscope.html">piscope</a>
-<a class="l1" href="misc.html">Misc</a>
-<a class="l1" href="examples.html">Examples</a>
-<a class="l1" href="download.html">Download</a>
-<a class="l1" href="faq.html">FAQ</a>
-<a class="l1" href="sitemap.html">Site Map</a>
-</td>
-<td><center><h2>Pipe Interface</h2></center>
-pigpio provides a pipe interface to many of its functions.<br>
-<br>
-The pipe interface is available whenever pigpio is running, either
-because it has been started as a daemon, or it has been linked in
-to a running user program.&nbsp; The pipe interface can be disabled
-by the program which initialises the library.&nbsp; pigpiod offers
-the -f option to disable the pipe interface.&nbsp; User programs
-should call <a href=
-"http://abyz.me.uk/rpi/pigpio/cif.html#gpioCfgInterfaces">gpioCfgInterfaces</a>
-if they wish to disable the pipe interface.<br>
-<br>
-pigpio listens for commands on pipe /dev/pigpio.&nbsp; The commands
-consist of a command identifier with, depending on the command,
-zero, one, or two parameters.&nbsp; The result, if any, may be read
-from pipe /dev/pigout.&nbsp; If any errors are detected a message
-will be written to pipe /dev/pigerr.<br>
-<br>
-<br>
-The format of the commands is identical to those used by <a href=
-"pigs.html">pigs</a>.
-</td>
-</table>
-<div style="vertical-align: center; text-align: center; background-color:#98bf21; font-size:0.8em; height:30px"><a class="l2" href="index.html">[pigpio]</a>
-<a class="l2" href="cif.html">[pigpio C I/F]</a>
-<a class="l2" href="pigpiod.html">[pigpiod]</a>
-<a class="l2" href="pdif2.html">[pigpiod C I/F]</a>
-<a class="l2" href="python.html">[Python]</a>
-<a class="l2" href="pigs.html">[pigs]</a>
-<a class="l2" href="piscope.html">[piscope]</a>
-<a class="l2" href="misc.html">[Misc]</a>
-<a class="l2" href="examples.html">[Examples]</a>
-<a class="l2" href="download.html">[Download]</a>
-<a class="l2" href="faq.html">[FAQ]</a>
-<a class="l2" href="sitemap.html">[Site Map]</a>
-</div>
-<table><tr>
-<td style="width: 200px"><div style="text-align: left;"><small>&copy; 2012-2020</small></div></td>
-<td style="width: 350px"><div style="text-align: center;">e-mail: pigpio @ abyz.me.uk</div></td>
-<td style="width: 200px"><div style="text-align: right;"><small>Updated: 30/04/2020</small></div></td>
-</tr></table>
-</td>
-</table>
-</body>
-</html>
diff --git a/DOC/HTML/pig2vcd.html b/DOC/HTML/pig2vcd.html
deleted file mode 100644
index e64a2fb..0000000
--- a/DOC/HTML/pig2vcd.html
+++ /dev/null
@@ -1,83 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta name="description" content="Raspberry Pi Reg. C GPIO library and Python GPIO module and shell command utilities to control the GPIO, including SPI, I2C, and serial links." />
- <meta name="keywords" content="raspberry, pi, C, Python, GPIO, library, shell, command, utilities, module, SPI, I2C, serial" />
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>pigpio library</title>
- <link rel="stylesheet" type="text/css" href="scripts/index.css">
- <link rel="icon" href="favicon.ico" type="image/x-icon">
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
-</head>
-<body>
-
-<table style="padding:0px; border:0px; margin:0px; width:780px; background-color:#e0e0e0;">
-<td style="background:#EAF2E6 url('images/sidebar.gif') repeat-y; width:35px; height:100%"></td>
-<td>
-<table>
-<div style="background:url('images/topbar.gif') repeat-x; height: 70px; font-size:1.5em; vertical-align: top;"><a href="index.html"><img src="images/pigpio-logo.gif" border="0" /></a>pigpio library</div>
-</table>
-<table><div>
-<td><img src="images/wheel.jpg" width="250"></td>
-<td><img src="images/srf04.jpg" width="250"></td>
-<td><img src="images/servo.jpg" width="250"></td>
-</div></table>
-<table>
-<td style="vertical-align: top; background-color: #98bf21;"><a class="l1" href="index.html">pigpio</a>
-<a class="l1" href="cif.html">pigpio C I/F</a>
-<a class="l1" href="pigpiod.html">pigpiod</a>
-<a class="l1" href="pdif2.html">pigpiod C I/F</a>
-<a class="l1" href="python.html">Python</a>
-<a class="l1" href="pigs.html">pigs</a>
-<a class="l1" href="piscope.html">piscope</a>
-<a class="l1" href="misc.html">Misc</a>
-<a class="l1" href="examples.html">Examples</a>
-<a class="l1" href="download.html">Download</a>
-<a class="l1" href="faq.html">FAQ</a>
-<a class="l1" href="sitemap.html">Site Map</a>
-</td>
-<td><center><h2>pig2vcd</h2></center>pig2vcd is a utility which reads notifications on stdin and writes the
-output as a Value Change Dump (VCD) file on stdout.
-<br><br>The VCD file can be viewed using GTKWave.
-<h3>Notifications</h3>Notifications consist of 12 bytes with the following binary format.
-<br><br><code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;seqno;<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;flags;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;tick;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;level;<br>}&nbsp;gpioReport_t;<br></code><br><br>seqno: starts at 0 each time the handle is opened and then increments by one for each report.
-<br><br>flags: two flags are defined, PI_NTFY_FLAGS_WDOG and PI_NTFY_FLAGS_ALIVE. If bit 5 is set (PI_NTFY_FLAGS_WDOG) then bits 0-4 of the flags indicate a gpio which has had a watchdog timeout; if bit 6 is set (PI_NTFY_FLAGS_ALIVE) this indicates a keep alive signal on the pipe/socket and is sent once a minute in the absence of other notification activity.
-<br><br>tick: the number of microseconds since system boot. It wraps around after 1h12m.
-<br><br>level: indicates the level of each gpio. If bit 1&lt;&lt;x is set then gpio x is high. pig2vcd takes these notifications and outputs a text format VCD.
-<h3>VCD format</h3>The VCD starts with a header.
-<br><br><code>$date&nbsp;2013-05-31&nbsp;18:49:36&nbsp;$end<br>$version&nbsp;pig2vcd&nbsp;V1&nbsp;$end<br>$timescale&nbsp;1&nbsp;us&nbsp;$end<br>$scope&nbsp;module&nbsp;top&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;A&nbsp;0&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;B&nbsp;1&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;C&nbsp;2&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;D&nbsp;3&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;E&nbsp;4&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;F&nbsp;5&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;G&nbsp;6&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;H&nbsp;7&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;I&nbsp;8&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;J&nbsp;9&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;K&nbsp;10&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;L&nbsp;11&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;M&nbsp;12&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;N&nbsp;13&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;O&nbsp;14&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;P&nbsp;15&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;Q&nbsp;16&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;R&nbsp;17&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;S&nbsp;18&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;T&nbsp;19&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;U&nbsp;20&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;V&nbsp;21&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;W&nbsp;22&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;X&nbsp;23&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;Y&nbsp;24&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;Z&nbsp;25&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;a&nbsp;26&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;b&nbsp;27&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;c&nbsp;28&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;d&nbsp;29&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;e&nbsp;30&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;f&nbsp;31&nbsp;$end<br>$upscope&nbsp;$end<br>$enddefinitions&nbsp;$end<br></code><br><br>The header defines gpio identifiers and their name. Each gpio identifier
-must be unique. pig2vcd arbitrarily uses 'A' through 'Z' for gpios 0
-through 25, and 'a' through 'f' for gpios 26 through 31.
-The corresponding names are 0 through 31.<br>
-<br><br>The VCD file may be edited to give a frendlier name, e.g. 8 could be
-changed to ENCODER_A if an encoder switch A is connected to gpio 8.
-<br><br>Following the header pig2vcd takes notifications and outputs a timestamp
-followed by a list of one or more gpios which have changed state.
-The timestamp consists of a '#' followed by the microsecond tick.
-The state lines contain the new state followed by the gpio identifier.
-<br><br><code>#1058747<br>0H<br>0I<br>#1059012<br>1H<br>#1079777<br>1I<br>#1079782<br>0I<br>#1079852<br>1I<br>#1079857<br>0I<br>0H<br>#1165113<br>1H<br>#1165118<br>0H<br>#1165153<br>1H<br></code></td>
-</table>
-<div style="vertical-align: center; text-align: center; background-color:#98bf21; font-size:0.8em; height:30px"><a class="l2" href="index.html">[pigpio]</a>
-<a class="l2" href="cif.html">[pigpio C I/F]</a>
-<a class="l2" href="pigpiod.html">[pigpiod]</a>
-<a class="l2" href="pdif2.html">[pigpiod C I/F]</a>
-<a class="l2" href="python.html">[Python]</a>
-<a class="l2" href="pigs.html">[pigs]</a>
-<a class="l2" href="piscope.html">[piscope]</a>
-<a class="l2" href="misc.html">[Misc]</a>
-<a class="l2" href="examples.html">[Examples]</a>
-<a class="l2" href="download.html">[Download]</a>
-<a class="l2" href="faq.html">[FAQ]</a>
-<a class="l2" href="sitemap.html">[Site Map]</a>
-</div>
-<table><tr>
-<td style="width: 200px"><div style="text-align: left;"><small>&copy; 2012-2020</small></div></td>
-<td style="width: 350px"><div style="text-align: center;">e-mail: pigpio @ abyz.me.uk</div></td>
-<td style="width: 200px"><div style="text-align: right;"><small>Updated: 30/04/2020</small></div></td>
-</tr></table>
-</td>
-</table>
-</body>
-</html>
diff --git a/DOC/HTML/pigpiod.html b/DOC/HTML/pigpiod.html
deleted file mode 100644
index d522889..0000000
--- a/DOC/HTML/pigpiod.html
+++ /dev/null
@@ -1,114 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta name="description" content="Raspberry Pi Reg. C GPIO library and Python GPIO module and shell command utilities to control the GPIO, including SPI, I2C, and serial links." />
- <meta name="keywords" content="raspberry, pi, C, Python, GPIO, library, shell, command, utilities, module, SPI, I2C, serial" />
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>pigpio library</title>
- <link rel="stylesheet" type="text/css" href="scripts/index.css">
- <link rel="icon" href="favicon.ico" type="image/x-icon">
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
-</head>
-<body>
-
-<table style="padding:0px; border:0px; margin:0px; width:780px; background-color:#e0e0e0;">
-<td style="background:#EAF2E6 url('images/sidebar.gif') repeat-y; width:35px; height:100%"></td>
-<td>
-<table>
-<div style="background:url('images/topbar.gif') repeat-x; height: 70px; font-size:1.5em; vertical-align: top;"><a href="index.html"><img src="images/pigpio-logo.gif" border="0" /></a>pigpio library</div>
-</table>
-<table><div>
-<td><img src="images/breadboard.jpg" width="250"></td>
-<td><img src="images/caps.jpg" width="250"></td>
-<td><img src="images/driver.jpg" width="250"></td>
-</div></table>
-<table>
-<td style="vertical-align: top; background-color: #98bf21;"><a class="l1" href="index.html">pigpio</a>
-<a class="l1" href="cif.html">pigpio C I/F</a>
-<a class="l1" href="pigpiod.html">pigpiod</a>
-<a class="l1" href="pdif2.html">pigpiod C I/F</a>
-<a class="l1" href="python.html">Python</a>
-<a class="l1" href="pigs.html">pigs</a>
-<a class="l1" href="piscope.html">piscope</a>
-<a class="l1" href="misc.html">Misc</a>
-<a class="l1" href="examples.html">Examples</a>
-<a class="l1" href="download.html">Download</a>
-<a class="l1" href="faq.html">FAQ</a>
-<a class="l1" href="sitemap.html">Site Map</a>
-</td>
-<td><center><h2>pigpio Daemon</h2></center>pigpiod is a utility which launches the pigpio library as a daemon.<br>
-<br>
-Once launched the pigpio library runs in the background accepting commands from the pipe and socket interfaces.<br>
-<br>
-The pigpiod utility requires sudo privileges to launch the library but thereafter the pipe and socket commands may be issued by normal users.<br>
-<br>
-pigpiod accepts the following configuration options<br>
-<br>
-<table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td><b>-a value</b></td><td>DMA memory allocation mode</td><td>0=AUTO, 1=PMAP, 2=MBOX</td><td>Default AUTO
-</td></tr><tr><td><b>-b value</b></td><td>GPIO sample buffer size in milliseconds</td><td>100-10000</td><td>Default 120
-</td></tr><tr><td><b>-c value</b></td><td>Library internal settings</td><td></td><td>Default 0
-</td></tr><tr><td><b>-d value</b></td><td>Primary DMA channel</td><td>0-14</td><td>Default 14
-</td></tr><tr><td><b>-e value</b></td><td>Secondary DMA channel</td><td>0-14</td><td>Default 6. Preferably use one of DMA channels 0 to 6 for the secondary channel
-</td></tr><tr><td><b>-f</b></td><td>Disable fifo interface</td><td></td><td>Default enabled
-</td></tr><tr><td><b>-g</b></td><td>Run in foreground (do not fork)</td><td></td><td>Default disabled
-</td></tr><tr><td><b>-k</b></td><td>Disable local and remote socket interface</td><td></td><td>Default enabled
-</td></tr><tr><td><b>-l</b></td><td>Disable remote socket interface</td><td></td><td>Default enabled
-</td></tr><tr><td><b>-m</b></td><td>Disable alerts (sampling)</td><td></td><td>Default enabled
-</td></tr><tr><td><b>-n IP address</b></td><td>Allow IP address to use the socket interface</td><td>Name (e.g. paul) or dotted quad (e.g. 192.168.1.66)</td><td>If the -n option is not used all addresses are allowed (unless overridden by the -k or -l options). Multiple -n options are allowed. If -k has been used -n has no effect. If -l has been used only -n localhost has any effect
-</td></tr><tr><td><b>-p value</b></td><td>Socket port</td><td>1024-32000</td><td>Default 8888
-</td></tr><tr><td><b>-s value</b></td><td>Sample rate</td><td>1, 2, 4, 5, 8, or 10 microseconds</td><td>Default 5
-</td></tr><tr><td><b>-t value</b></td><td>Clock peripheral</td><td>0=PWM 1=PCM</td><td>Default PCM. pigpio uses one or both of PCM and PWM. If PCM is used then PWM is available for audio. If PWM is used then PCM is available for audio. If waves or hardware PWM are used neither PWM nor PCM will be available for audio.
-</td></tr><tr><td><b>-v -V</b></td><td>Display pigpio version and exit</td><td></td><td>
-</td></tr><tr><td><b>-x mask</b></td><td>GPIO which may be updated</td><td>A 54 bit mask with (1&lt;&lt;n) set if the user may update GPIO #n</td><td>Default is the set of user GPIO for the board revision. Use -x -1 to allow all GPIO
-</td></tr></tbody></table><h3>Example</h3><code>sudo&nbsp;pigpiod&nbsp;-s&nbsp;2&nbsp;-b&nbsp;200&nbsp;-f<br></code><br><br>Launch the pigpio library with a sample rate of 2 microseconds and a 200 millisecond buffer. Disable the fifo interface.
-<h3>Permissions</h3>pigpio provides a rudimentary permissions system for commands issued via the socket and pipe interfaces.
-<br><br>All GPIO may be read.
-<br><br>Only the user GPIO for the board type or those specified by the -x option may be updated.
-<br><br><code>Type&nbsp;1&nbsp;boards&nbsp;0x03E6CF93&nbsp;(26&nbsp;pin&nbsp;header)<br>Type&nbsp;2&nbsp;boards&nbsp;0xFBC6CF9C&nbsp;(26&nbsp;pin&nbsp;+&nbsp;8&nbsp;pin&nbsp;header)<br>Type&nbsp;3&nbsp;boards&nbsp;0x0FFFFFFC&nbsp;(40&nbsp;pin&nbsp;header)<br></code><br><br>In this context an update includes the following:
-<br><br>GPIO mode set<br>
-GPIO pull/up down<br>
-GPIO write<br>
-GPIO set PWM (including range and frequency)<br>
-GPIO set servo
-<br><br>In addition the bank clear and set commands, and the wave commands will only
-affect updateable GPIO.
-<h3>Exceptions</h3>The following exceptions are made for particular models.
-<br><br><b>Models A and B</b><br><br>The green activity LED (GPIO 16) may be written.<br>
-<br><b>Models A+ and B+</b><br><br>The green activity LED (GPIO 47) may be written.<br>
-The red power LED (GPIO 35) may be written.<br>
-The high USB power mode (GPIO 38) may be written.<br>
-<br><b>Pi Zero</b><br><br>The green activity LED (GPIO 47) may be written.<br>
-<br><b>Pi2B</b><br><br>The green activity LED (GPIO 47) may be written.<br>
-The red power LED (GPIO 35) may be written.<br>
-The high USB power mode (GPIO 38) may be written.<br>
-<br><b>Pi3B</b><br><br>The green activity LED and the red power LED are not writable.<br>
-The USB power mode is fixed at 1.2 amps (high power).<br>
-<h3>DMA Channels</h3>The secondary channel is only used for the transmission of waves.
-<br><br>If possible use one of channels 0 to 6 for the secondary channel (a full channel).
-<br><br>A full channel only requires one DMA control block regardless of the length of a pulse delay. Channels 7 to 14 (lite channels) require one DMA control block for each 16383 microseconds of delay. I.e. a 10 second pulse delay requires one control block on a full channel and 611 control blocks on a lite channel.
-<br><br></td>
-</table>
-<div style="vertical-align: center; text-align: center; background-color:#98bf21; font-size:0.8em; height:30px"><a class="l2" href="index.html">[pigpio]</a>
-<a class="l2" href="cif.html">[pigpio C I/F]</a>
-<a class="l2" href="pigpiod.html">[pigpiod]</a>
-<a class="l2" href="pdif2.html">[pigpiod C I/F]</a>
-<a class="l2" href="python.html">[Python]</a>
-<a class="l2" href="pigs.html">[pigs]</a>
-<a class="l2" href="piscope.html">[piscope]</a>
-<a class="l2" href="misc.html">[Misc]</a>
-<a class="l2" href="examples.html">[Examples]</a>
-<a class="l2" href="download.html">[Download]</a>
-<a class="l2" href="faq.html">[FAQ]</a>
-<a class="l2" href="sitemap.html">[Site Map]</a>
-</div>
-<table><tr>
-<td style="width: 200px"><div style="text-align: left;"><small>&copy; 2012-2020</small></div></td>
-<td style="width: 350px"><div style="text-align: center;">e-mail: pigpio @ abyz.me.uk</div></td>
-<td style="width: 200px"><div style="text-align: right;"><small>Updated: 30/04/2020</small></div></td>
-</tr></table>
-</td>
-</table>
-</body>
-</html>
diff --git a/DOC/HTML/pigs.html b/DOC/HTML/pigs.html
deleted file mode 100644
index d4b4079..0000000
--- a/DOC/HTML/pigs.html
+++ /dev/null
@@ -1,1268 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta name="description" content="Raspberry Pi Reg. C GPIO library and Python GPIO module and shell command utilities to control the GPIO, including SPI, I2C, and serial links." />
- <meta name="keywords" content="raspberry, pi, C, Python, GPIO, library, shell, command, utilities, module, SPI, I2C, serial" />
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>pigpio library</title>
- <link rel="stylesheet" type="text/css" href="scripts/index.css">
- <link rel="icon" href="favicon.ico" type="image/x-icon">
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
-</head>
-<body>
-
-<table style="padding:0px; border:0px; margin:0px; width:780px; background-color:#e0e0e0;">
-<td style="background:#EAF2E6 url('images/sidebar.gif') repeat-y; width:35px; height:100%"></td>
-<td>
-<table>
-<div style="background:url('images/topbar.gif') repeat-x; height: 70px; font-size:1.5em; vertical-align: top;"><a href="index.html"><img src="images/pigpio-logo.gif" border="0" /></a>pigpio library</div>
-</table>
-<table><div>
-<td><img src="images/pins.jpg" width="250"></td>
-<td><img src="images/meter.jpg" width="250"></td>
-<td><img src="images/keypad.jpg" width="250"></td>
-</div></table>
-<table>
-<td style="vertical-align: top; background-color: #98bf21;"><a class="l1" href="index.html">pigpio</a>
-<a class="l1" href="cif.html">pigpio C I/F</a>
-<a class="l1" href="pigpiod.html">pigpiod</a>
-<a class="l1" href="pdif2.html">pigpiod C I/F</a>
-<a class="l1" href="python.html">Python</a>
-<a class="l1" href="pigs.html">pigs</a>
-<a class="l1" href="piscope.html">piscope</a>
-<a class="l1" href="misc.html">Misc</a>
-<a class="l1" href="examples.html">Examples</a>
-<a class="l1" href="download.html">Download</a>
-<a class="l1" href="faq.html">FAQ</a>
-<a class="l1" href="sitemap.html">Site Map</a>
-</td>
-<td><center><h2>pigs</h2></center><h2><a name="Introduction">Introduction</a></h2>
-The socket and pipe interfaces allow control of the Pi's GPIO by
-passing messages to the running pigpio library.
-<br><br>The normal way to start the pigpio library would be as a daemon during boot.
-<br><br><code>sudo&nbsp;pigpiod<br></code><h3>Features</h3>o hardware timed PWM on any of GPIO 0-31
-<br><br>o hardware timed servo pulses on any of GPIO 0-31
-<br><br>o reading/writing all of the GPIO in a bank as one operation
-<br><br>o individually setting GPIO modes, reading and writing
-<br><br>o notifications when any of GPIO 0-31 change state
-<br><br>o the construction of output waveforms with microsecond timing
-<br><br>o I2C, SPI, and serial link wrappers
-<br><br>o creating and running scripts on the pigpio daemon
-<h3>GPIO</h3>ALL GPIO are identified by their Broadcom number.
-<h3>Usage</h3>pigs is a program and internally uses the socket interface to pigpio
-whereas /dev/pigpio uses the pipe interface.
-<br><br>pigs and the pipe interface share the same commands and are invoked in
-a similar fashion from the command line.
-<br><br>The pigpio library must be running, either by running a program linked
-with the library or starting the pigpio daemon (sudo pigpiod).
-<br><br>pigs {command}+
-<br><br>echo "{command}+" &gt;/dev/pigpio
-<br><br>pigs will show the result of the command on screen.
-<br><br>The pigs process returns an exit status (which can be displayed with
-the command echo $?).
-<br><br><code>PIGS_OK&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0<br>PIGS_CONNECT_ERR&nbsp;255<br>PIGS_OPTION_ERR&nbsp;&nbsp;254<br>PIGS_SCRIPT_ERR&nbsp;&nbsp;253<br><br></code><br><br>The results of /dev/pigpio commands need to be read from /dev/pigout,
-e.g. cat /dev/pigout (try cat /dev/pigout& so that all subsequent
-results are shown on screen).
-<br><br>In both cases if an error was detected a message will have been written
-to /dev/pigerr (try cat /dev/pigerr&). This is likely to be more
-informative than the message returned by pigs or the error code
-returned by the pipe interface.
-<br><br>Several commands may be entered on a line. If present PROC and PARSE must
-be the last command on a line.
-<br><br>E.g.
-<br><br><code>pigs&nbsp;w&nbsp;22&nbsp;1&nbsp;mils&nbsp;1000&nbsp;w&nbsp;22&nbsp;0<br></code><br><br>is equivalent to
-<br><br><code>pigs&nbsp;w&nbsp;22&nbsp;1<br>pigs&nbsp;mils&nbsp;1000<br>pigs&nbsp;w&nbsp;22&nbsp;0<br></code><br><br>and
-<br><br><code>echo&nbsp;"m&nbsp;4&nbsp;w&nbsp;w&nbsp;4&nbsp;0&nbsp;mils&nbsp;250&nbsp;m&nbsp;4&nbsp;r&nbsp;r&nbsp;4"&nbsp;&gt;/dev/pigpio<br></code><br><br>is equivalent to
-<br><br><code>echo&nbsp;"m&nbsp;4&nbsp;w"&nbsp;&nbsp;&nbsp;&nbsp;&gt;/dev/pigpio<br>echo&nbsp;"w&nbsp;4&nbsp;0"&nbsp;&nbsp;&nbsp;&nbsp;&gt;/dev/pigpio<br>echo&nbsp;"mils&nbsp;250"&nbsp;&gt;/dev/pigpio<br>echo&nbsp;"m&nbsp;4&nbsp;r"&nbsp;&nbsp;&nbsp;&nbsp;&gt;/dev/pigpio<br>echo&nbsp;"r&nbsp;4"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;/dev/pigpio<br></code><h3>Notes</h3>The examples from now on will show the pigs interface but the same
-commands will also work on the pipe interface.
-<br><br>pigs does not show the status of successful commands unless the
-command itself returns data. The status (0) will be returned to
-pigs but will be discarded.
-<br><br>The status/data of each command sent to the pipe interface should
-be read from /dev/pigout.
-<br><br>When a command takes a number as a parameter it may be entered as hex
-(precede by 0x), octal (precede by 0), or decimal.
-<br><br>E.g. 23 is 23 decimal, 0x100 is 256 decimal, 070 is 56 decimal.
-<br><br>Some commands can return a variable number of data bytes. By
-default this data is displayed as decimal. The pigs -a option
-can be used to force the display as ASCII and the pigs -x
-option can be used to force the display as hex.
-<br><br>E.g. assuming the transmitted serial data is the letters ABCDEONM
-<br><br><code>$&nbsp;pigs&nbsp;slr&nbsp;4&nbsp;100<br>8&nbsp;65&nbsp;66&nbsp;67&nbsp;68&nbsp;69&nbsp;79&nbsp;78&nbsp;77<br><br>$&nbsp;pigs&nbsp;-a&nbsp;slr&nbsp;4&nbsp;100<br>8&nbsp;ABCDEONM<br><br>$&nbsp;pigs&nbsp;-x&nbsp;slr&nbsp;4&nbsp;100<br>8&nbsp;41&nbsp;42&nbsp;43&nbsp;44&nbsp;45&nbsp;4f&nbsp;4e&nbsp;4d<br></code><h2><a name="Overview">Overview</a></h2>
-<table border="0" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td></td><td></td></tr><tr><td>BASIC
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#M/MODES">M/MODES</a> <a href="#g">g</a> <a href="#m">m</a></td><td>Set GPIO mode </td><td><small><a href="cif.html#gpioSetMode">gpioSetMode</a></small></td></tr><tr><td><a href="#MG/MODEG">MG/MODEG</a> <a href="#g">g</a></td><td>Get GPIO mode </td><td><small><a href="cif.html#gpioGetMode">gpioGetMode</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#PUD">PUD</a> <a href="#g">g</a> <a href="#p">p</a></td><td>Set GPIO pull up/down </td><td><small><a href="cif.html#gpioSetPullUpDown">gpioSetPullUpDown</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#R/READ">R/READ</a> <a href="#g">g</a></td><td>Read GPIO level </td><td><small><a href="cif.html#gpioRead">gpioRead</a></small></td></tr><tr><td><a href="#W/WRITE">W/WRITE</a> <a href="#g">g</a> <a href="#L">L</a></td><td>Write GPIO level </td><td><small><a href="cif.html#gpioWrite">gpioWrite</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>PWM (overrides servo commands on same GPIO)
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#P/PWM">P/PWM</a> <a href="#u">u</a> <a href="#v">v</a></td><td>Set GPIO PWM value </td><td><small><a href="cif.html#gpioPWM">gpioPWM</a></small></td></tr><tr><td><a href="#PFS">PFS</a> <a href="#u">u</a> <a href="#v">v</a></td><td>Set GPIO PWM frequency </td><td><small><a href="cif.html#gpioSetPWMfrequency">gpioSetPWMfrequency</a></small></td></tr><tr><td><a href="#PRS">PRS</a> <a href="#u">u</a> <a href="#v">v</a></td><td>Set GPIO PWM range </td><td><small><a href="cif.html#gpioSetPWMrange">gpioSetPWMrange</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#GDC">GDC</a> <a href="#u">u</a></td><td>Get GPIO PWM dutycycle </td><td><small><a href="cif.html#gpioGetPWMdutycycle">gpioGetPWMdutycycle</a></small></td></tr><tr><td><a href="#PFG">PFG</a> <a href="#u">u</a></td><td>Get GPIO PWM frequency </td><td><small><a href="cif.html#gpioGetPWMfrequency">gpioGetPWMfrequency</a></small></td></tr><tr><td><a href="#PRG">PRG</a> <a href="#u">u</a></td><td>Get GPIO PWM range </td><td><small><a href="cif.html#gpioGetPWMrange">gpioGetPWMrange</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#PRRG">PRRG</a> <a href="#u">u</a></td><td>Get GPIO PWM real range </td><td><small><a href="cif.html#gpioGetPWMrealRange">gpioGetPWMrealRange</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>Servo (overrides PWM commands on same GPIO)
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#S/SERVO">S/SERVO</a> <a href="#u">u</a> <a href="#v">v</a></td><td>Set GPIO servo pulsewidth </td><td><small><a href="cif.html#gpioServo">gpioServo</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#GPW">GPW</a> <a href="#u">u</a></td><td>Get GPIO servo pulsewidth </td><td><small><a href="cif.html#gpioGetServoPulsewidth">gpioGetServoPulsewidth</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>INTERMEDIATE
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#TRIG">TRIG</a> <a href="#u">u</a> <a href="#pl">pl</a> <a href="#L">L</a></td><td>Send a trigger pulse </td><td><small><a href="cif.html#gpioTrigger">gpioTrigger</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#WDOG">WDOG</a> <a href="#u">u</a> <a href="#v">v</a></td><td>Set GPIO watchdog </td><td><small><a href="cif.html#gpioSetWatchdog">gpioSetWatchdog</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#BR1">BR1</a></td><td>Read bank 1 GPIO </td><td><small><a href="cif.html#gpioRead_Bits_0_31">gpioRead_Bits_0_31</a></small></td></tr><tr><td><a href="#BR2">BR2</a></td><td>Read bank 2 GPIO </td><td><small><a href="cif.html#gpioRead_Bits_32_53">gpioRead_Bits_32_53</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#BC1">BC1</a> <a href="#bits">bits</a></td><td>Clear specified GPIO in bank 1 </td><td><small><a href="cif.html#gpioWrite_Bits_0_31_Clear">gpioWrite_Bits_0_31_Clear</a></small></td></tr><tr><td><a href="#BC2">BC2</a> <a href="#bits">bits</a></td><td>Clear specified GPIO in bank 2 </td><td><small><a href="cif.html#gpioWrite_Bits_32_53_Clear">gpioWrite_Bits_32_53_Clear</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#BS1">BS1</a> <a href="#bits">bits</a></td><td>Set specified GPIO in bank 1 </td><td><small><a href="cif.html#gpioWrite_Bits_0_31_Set">gpioWrite_Bits_0_31_Set</a></small></td></tr><tr><td><a href="#BS2">BS2</a> <a href="#bits">bits</a></td><td>Set specified GPIO in bank 2 </td><td><small><a href="cif.html#gpioWrite_Bits_32_53_Set">gpioWrite_Bits_32_53_Set</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>ADVANCED
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#NO">NO</a></td><td>Request a notification </td><td><small><a href="cif.html#gpioNotifyOpen">gpioNotifyOpen</a></small></td></tr><tr><td><a href="#NC">NC</a> <a href="#h">h</a></td><td>Close notification </td><td><small><a href="cif.html#gpioNotifyClose">gpioNotifyClose</a></small></td></tr><tr><td><a href="#NB">NB</a> <a href="#h">h</a> <a href="#bits">bits</a></td><td>Start notification </td><td><small><a href="cif.html#gpioNotifyBegin">gpioNotifyBegin</a></small></td></tr><tr><td><a href="#NP">NP</a> <a href="#h">h</a></td><td>Pause notification </td><td><small><a href="cif.html#gpioNotifyPause">gpioNotifyPause</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#HC">HC</a> <a href="#g">g</a> <a href="#cf">cf</a></td><td>Set hardware clock frequency </td><td><small><a href="cif.html#gpioHardwareClock">gpioHardwareClock</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#HP">HP</a> <a href="#g">g</a> <a href="#pf">pf</a> <a href="#pdc">pdc</a></td><td>Set hardware PWM frequency and dutycycle </td><td><small><a href="cif.html#gpioHardwarePWM">gpioHardwarePWM</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#FG">FG</a> <a href="#u">u</a> <a href="#stdy">stdy</a></td><td>Set a glitch filter on a GPIO </td><td><small><a href="cif.html#gpioGlitchFilter">gpioGlitchFilter</a></small></td></tr><tr><td><a href="#FN">FN</a> <a href="#u">u</a> <a href="#stdy">stdy</a> <a href="#actv">actv</a></td><td>Set a noise filter on a GPIO </td><td><small><a href="cif.html#gpioNoiseFilter">gpioNoiseFilter</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#PADS">PADS</a> <a href="#pad">pad</a> <a href="#padma">padma</a></td><td>Set pad drive strength </td><td><small><a href="cif.html#gpioSetPad">gpioSetPad</a></small></td></tr><tr><td><a href="#PADG">PADG</a> <a href="#pad">pad</a></td><td>Get pad drive strength </td><td><small><a href="cif.html#gpioGetPad">gpioGetPad</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#SHELL">SHELL</a> <a href="#name">name</a> <a href="#str">str</a></td><td>Execute a shell command </td><td><small><a href="cif.html#shell">shell</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>Custom
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#CF1">CF1</a> <a href="#uvs">uvs</a></td><td>Custom function 1 </td><td><small><a href="cif.html#gpioCustom1">gpioCustom1</a></small></td></tr><tr><td><a href="#CF2">CF2</a> <a href="#uvs">uvs</a></td><td>Custom function 2 </td><td><small><a href="cif.html#gpioCustom1">gpioCustom1</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>Events
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#EVM">EVM</a> <a href="#h">h</a> <a href="#bits">bits</a></td><td>Set events to monitor </td><td><small><a href="cif.html#eventMonitor">eventMonitor</a></small></td></tr><tr><td><a href="#EVT">EVT</a> <a href="#event">event</a></td><td>Trigger event </td><td><small><a href="cif.html#eventTrigger">eventTrigger</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>Scripts
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#PROC">PROC</a> <a href="#t">t</a></td><td>Store script </td><td><small><a href="cif.html#gpioStoreScript">gpioStoreScript</a></small></td></tr><tr><td><a href="#PROCR">PROCR</a> <a href="#sid">sid</a> <a href="#pars">pars</a></td><td>Run script </td><td><small><a href="cif.html#gpioRunScript">gpioRunScript</a></small></td></tr><tr><td><a href="#PROCU">PROCU</a> <a href="#sid">sid</a> <a href="#pars">pars</a></td><td>Set script parameters </td><td><small><a href="cif.html#gpioUpdateScript">gpioUpdateScript</a></small></td></tr><tr><td><a href="#PROCP">PROCP</a> <a href="#sid">sid</a></td><td>Get script status and parameters </td><td><small><a href="cif.html#gpioScriptStatus">gpioScriptStatus</a></small></td></tr><tr><td><a href="#PROCS">PROCS</a> <a href="#sid">sid</a></td><td>Stop script </td><td><small><a href="cif.html#gpioStopScript">gpioStopScript</a></small></td></tr><tr><td><a href="#PROCD">PROCD</a> <a href="#sid">sid</a></td><td>Delete script </td><td><small><a href="cif.html#gpioDeleteScript">gpioDeleteScript</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#PARSE">PARSE</a> <a href="#t">t</a></td><td>Validate script </td><td><small><a href="cif.html#gpioParseScript">gpioParseScript</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>I2C
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#I2CO">I2CO</a> <a href="#ib">ib</a> <a href="#id">id</a> <a href="#if">if</a></td><td>Open I2C bus and device with flags </td><td><small><a href="cif.html#i2cOpen">i2cOpen</a></small></td></tr><tr><td><a href="#I2CC">I2CC</a> <a href="#h">h</a></td><td>Close I2C handle </td><td><small><a href="cif.html#i2cClose">i2cClose</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#I2CWQ">I2CWQ</a> <a href="#h">h</a> <a href="#bit">bit</a></td><td>smb Write Quick: write bit </td><td><small><a href="cif.html#i2cWriteQuick">i2cWriteQuick</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#I2CRS">I2CRS</a> <a href="#h">h</a></td><td>smb Read Byte: read byte </td><td><small><a href="cif.html#i2cReadByte">i2cReadByte</a></small></td></tr><tr><td><a href="#I2CWS">I2CWS</a> <a href="#h">h</a> <a href="#bv">bv</a></td><td>smb Write Byte: write byte </td><td><small><a href="cif.html#i2cWriteByte">i2cWriteByte</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#I2CRB">I2CRB</a> <a href="#h">h</a> <a href="#r">r</a></td><td>smb Read Byte Data: read byte from register </td><td><small><a href="cif.html#i2cReadByteData">i2cReadByteData</a></small></td></tr><tr><td><a href="#I2CWB">I2CWB</a> <a href="#h">h</a> <a href="#r">r</a> <a href="#bv">bv</a></td><td>smb Write Byte Data: write byte to register </td><td><small><a href="cif.html#i2cWriteByteData">i2cWriteByteData</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#I2CRW">I2CRW</a> <a href="#h">h</a> <a href="#r">r</a></td><td>smb Read Word Data: read word from register </td><td><small><a href="cif.html#i2cReadWordData">i2cReadWordData</a></small></td></tr><tr><td><a href="#I2CWW">I2CWW</a> <a href="#h">h</a> <a href="#r">r</a> <a href="#wv">wv</a></td><td>smb Write Word Data: write word to register </td><td><small><a href="cif.html#i2cWriteWordData">i2cWriteWordData</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#I2CRK">I2CRK</a> <a href="#h">h</a> <a href="#r">r</a></td><td>smb Read Block Data: read data from register </td><td><small><a href="cif.html#i2cReadBlockData">i2cReadBlockData</a></small></td></tr><tr><td><a href="#I2CWK">I2CWK</a> <a href="#h">h</a> <a href="#r">r</a> <a href="#bvs">bvs</a></td><td>smb Write Block Data: write data to register </td><td><small><a href="cif.html#i2cWriteBlockData">i2cWriteBlockData</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#I2CWI">I2CWI</a> <a href="#h">h</a> <a href="#r">r</a> <a href="#bvs">bvs</a></td><td>smb Write I2C Block Data </td><td><small><a href="cif.html#i2cWriteI2CBlockData">i2cWriteI2CBlockData</a></small></td></tr><tr><td><a href="#I2CRI">I2CRI</a> <a href="#h">h</a> <a href="#r">r</a> <a href="#num">num</a></td><td>smb Read I2C Block Data: read bytes from register </td><td><small><a href="cif.html#i2cReadI2CBlockData">i2cReadI2CBlockData</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#I2CRD">I2CRD</a> <a href="#h">h</a> <a href="#num">num</a></td><td>i2c Read device </td><td><small><a href="cif.html#i2cReadDevice">i2cReadDevice</a></small></td></tr><tr><td><a href="#I2CWD">I2CWD</a> <a href="#h">h</a> <a href="#bvs">bvs</a></td><td>i2c Write device </td><td><small><a href="cif.html#i2cWriteDevice">i2cWriteDevice</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#I2CPC">I2CPC</a> <a href="#h">h</a> <a href="#r">r</a> <a href="#wv">wv</a></td><td>smb Process Call: exchange register with word </td><td><small><a href="cif.html#i2cProcessCall">i2cProcessCall</a></small></td></tr><tr><td><a href="#I2CPK">I2CPK</a> <a href="#h">h</a> <a href="#r">r</a> <a href="#bvs">bvs</a></td><td>smb Block Process Call: exchange data bytes with register </td><td><small><a href="cif.html#i2cBlockProcessCall">i2cBlockProcessCall</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#I2CZ">I2CZ</a> <a href="#h">h</a> <a href="#bvs">bvs</a></td><td>Performs multiple I2C transactions </td><td><small><a href="cif.html#i2cZip">i2cZip</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>I2C BIT BANG
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#BI2CO">BI2CO</a> <a href="#sda">sda</a> <a href="#scl">scl</a> <a href="#b">b</a></td><td>Open bit bang I2C </td><td><small><a href="cif.html#bbI2COpen">bbI2COpen</a></small></td></tr><tr><td><a href="#BI2CC">BI2CC</a> <a href="#sda">sda</a></td><td>Close bit bang I2C </td><td><small><a href="cif.html#bbI2CClose">bbI2CClose</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#BI2CZ">BI2CZ</a> <a href="#sda">sda</a> <a href="#bvs">bvs</a></td><td>I2C bit bang multiple transactions </td><td><small><a href="cif.html#bbI2CZip">bbI2CZip</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>I2C/SPI SLAVE
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#BSCX">BSCX</a> <a href="#bctl">bctl</a> <a href="#bvs">bvs</a></td><td>BSC I2C/SPI transfer </td><td><small><a href="cif.html#bscXfer">bscXfer</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>SERIAL
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#SERO">SERO</a> <a href="#dev">dev</a> <a href="#b">b</a> <a href="#sef">sef</a></td><td>Open serial device dev at baud b with flags </td><td><small><a href="cif.html#serOpen">serOpen</a></small></td></tr><tr><td><a href="#SERC">SERC</a> <a href="#h">h</a></td><td>Close serial handle </td><td><small><a href="cif.html#serClose">serClose</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#SERRB">SERRB</a></td><td>Read byte from serial handle </td><td><small><a href="cif.html#serReadByte">serReadByte</a></small></td></tr><tr><td><a href="#SERWB">SERWB</a> <a href="#h">h</a> <a href="#bv">bv</a></td><td>Write byte to serial handle </td><td><small><a href="cif.html#serWriteByte">serWriteByte</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#SERR">SERR</a> <a href="#h">h</a> <a href="#num">num</a></td><td>Read bytes from serial handle </td><td><small><a href="cif.html#serRead">serRead</a></small></td></tr><tr><td><a href="#SERW">SERW</a> <a href="#h">h</a> <a href="#bvs">bvs</a></td><td>Write bytes to serial handle </td><td><small><a href="cif.html#serWrite">serWrite</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#SERDA">SERDA</a> <a href="#h">h</a></td><td>Check for serial data ready to read </td><td><small><a href="cif.html#serDataAvailable">serDataAvailable</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>SERIAL BIT BANG (read only)
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#SLRO">SLRO</a> <a href="#u">u</a> <a href="#b">b</a> <a href="#db">db</a></td><td>Open GPIO for bit bang serial data </td><td><small><a href="cif.html#gpioSerialReadOpen">gpioSerialReadOpen</a></small></td></tr><tr><td><a href="#SLRC">SLRC</a> <a href="#u">u</a></td><td>Close GPIO for bit bang serial data </td><td><small><a href="cif.html#gpioSerialReadClose">gpioSerialReadClose</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#SLRI">SLRI</a> <a href="#u">u</a> <a href="#v">v</a></td><td>Sets bit bang serial data logic levels </td><td><small><a href="cif.html#gpioSerialReadInvert">gpioSerialReadInvert</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#SLR">SLR</a> <a href="#u">u</a> <a href="#num">num</a></td><td>Read bit bang serial data from GPIO </td><td><small><a href="cif.html#gpioSerialRead">gpioSerialRead</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>SPI
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#SPIO">SPIO</a> <a href="#c">c</a> <a href="#b">b</a> <a href="#spf">spf</a></td><td>SPI open channel at baud b with flags </td><td><small><a href="cif.html#spiOpen">spiOpen</a></small></td></tr><tr><td><a href="#SPIC">SPIC</a> <a href="#h">h</a></td><td>SPI close handle </td><td><small><a href="cif.html#spiClose">spiClose</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#SPIR">SPIR</a> <a href="#h">h</a> <a href="#num">num</a></td><td>SPI read bytes from handle </td><td><small><a href="cif.html#spiRead">spiRead</a></small></td></tr><tr><td><a href="#SPIW">SPIW</a> <a href="#h">h</a> <a href="#bvs">bvs</a></td><td>SPI write bytes to handle </td><td><small><a href="cif.html#spiWrite">spiWrite</a></small></td></tr><tr><td><a href="#SPIX">SPIX</a> <a href="#h">h</a> <a href="#bvs">bvs</a></td><td>SPI transfer bytes to handle </td><td><small><a href="cif.html#spiXfer">spiXfer</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>SPI BIT BANG
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#BSPIO">BSPIO</a> <a href="#cs">cs</a> <a href="#miso">miso</a> <a href="#mosi">mosi</a> <a href="#sclk">sclk</a> <a href="#b">b</a> <a href="#spf">spf</a></td><td>Open bit bang SPI </td><td><small><a href="cif.html#bbSPIOpen">bbSPIOpen</a></small></td></tr><tr><td><a href="#BSPIC">BSPIC</a> <a href="#cs">cs</a></td><td>Close bit bang SPI </td><td><small><a href="cif.html#bbSPIClose">bbSPIClose</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#BSPIX">BSPIX</a> <a href="#cs">cs</a> <a href="#bvs">bvs</a></td><td>SPI bit bang transfer </td><td><small><a href="cif.html#bbSPIXfer">bbSPIXfer</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>FILES
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#FO">FO</a> <a href="#file">file</a> <a href="#mode">mode</a></td><td>Open a file in mode </td><td><small><a href="cif.html#fileOpen">fileOpen</a></small></td></tr><tr><td><a href="#FC">FC</a> <a href="#h">h</a></td><td>Close file handle </td><td><small><a href="cif.html#fileClose">fileClose</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#FR">FR</a> <a href="#h">h</a> <a href="#num">num</a></td><td>Read bytes from file handle </td><td><small><a href="cif.html#fileRead">fileRead</a></small></td></tr><tr><td><a href="#FW">FW</a> <a href="#h">h</a> <a href="#bvs">bvs</a></td><td>Write bytes to file handle </td><td><small><a href="cif.html#fileWrite">fileWrite</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#FS">FS</a> <a href="#h">h</a> <a href="#num">num</a> <a href="#from">from</a></td><td>Seek to file handle position </td><td><small><a href="cif.html#fileSeek">fileSeek</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#FL">FL</a> <a href="#pat">pat</a> <a href="#num">num</a></td><td>List files which match pattern </td><td><small><a href="cif.html#fileList">fileList</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>WAVES
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#WVCLR">WVCLR</a></td><td>Clear all waveforms </td><td><small><a href="cif.html#gpioWaveClear">gpioWaveClear</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#WVNEW">WVNEW</a></td><td>Initialise a new waveform </td><td><small><a href="cif.html#gpioWaveAddNew">gpioWaveAddNew</a></small></td></tr><tr><td><a href="#WVAG">WVAG</a> <a href="#trips">trips</a></td><td>Add generic pulses to waveform </td><td><small><a href="cif.html#gpioWaveAddGeneric">gpioWaveAddGeneric</a></small></td></tr><tr><td><a href="#WVAS">WVAS</a> <a href="#u">u</a> <a href="#b">b</a> <a href="#db">db</a> <a href="#sb">sb</a> <a href="#o">o</a> <a href="#bvs">bvs</a></td><td>Add serial data to waveform </td><td><small><a href="cif.html#gpioWaveAddSerial">gpioWaveAddSerial</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#WVCRE">WVCRE</a></td><td>Create a waveform </td><td><small><a href="cif.html#gpioWaveCreate">gpioWaveCreate</a></small></td></tr><tr><td><a href="#WVCAP">WVCAP</a></td><td>Create a waveform of fixed size </td><td><small><a href="cif.html#gpioWaveCreatePad">gpioWaveCreatePad</a></small></td></tr><tr><td><a href="#WVDEL">WVDEL</a> <a href="#wid">wid</a></td><td>Delete selected waveform </td><td><small><a href="cif.html#gpioWaveDelete">gpioWaveDelete</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#WVTX">WVTX</a> <a href="#wid">wid</a></td><td>Transmits waveform once </td><td><small><a href="cif.html#gpioWaveTxSend">gpioWaveTxSend</a></small></td></tr><tr><td><a href="#WVTXM">WVTXM</a> <a href="#wid">wid</a> <a href="#wmde">wmde</a></td><td>Transmits waveform using mode </td><td><small><a href="cif.html#gpioWaveTxSend">gpioWaveTxSend</a></small></td></tr><tr><td><a href="#WVTXR">WVTXR</a> <a href="#wid">wid</a></td><td>Transmits waveform repeatedly </td><td><small><a href="cif.html#gpioWaveTxSend">gpioWaveTxSend</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#WVCHA">WVCHA</a> <a href="#bvs">bvs</a></td><td>Transmits a chain of waveforms </td><td><small><a href="cif.html#gpioWaveChain">gpioWaveChain</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#WVTAT">WVTAT</a></td><td>Returns the current transmitting waveform </td><td><small><a href="cif.html#gpioWaveTxAt">gpioWaveTxAt</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#WVBSY">WVBSY</a></td><td>Check if waveform is being transmitted </td><td><small><a href="cif.html#gpioWaveTxBusy">gpioWaveTxBusy</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#WVHLT">WVHLT</a></td><td>Stop waveform </td><td><small><a href="cif.html#gpioWaveTxStop">gpioWaveTxStop</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#WVSC">WVSC</a> <a href="#ws">ws</a></td><td>Get waveform DMA CB stats </td><td><small><a href="cif.html#gpioWaveGetCbs">gpioWaveGetCbs</a></small></td></tr><tr><td><a href="#WVSM">WVSM</a> <a href="#ws">ws</a></td><td>Get waveform time stats </td><td><small><a href="cif.html#gpioWaveGetMicros">gpioWaveGetMicros</a></small></td></tr><tr><td><a href="#WVSP">WVSP</a> <a href="#ws">ws</a></td><td>Get waveform pulse stats </td><td><small><a href="cif.html#gpioWaveGetPulses">gpioWaveGetPulses</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>UTILITIES
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#H/HELP">H/HELP</a></td><td>Display command help </td><td><small><a href="cif.html#"></a></small></td></tr><tr><td><a href="#HWVER">HWVER</a></td><td>Get hardware version </td><td><small><a href="cif.html#gpioHardwareRevision">gpioHardwareRevision</a></small></td></tr><tr><td><a href="#MICS">MICS</a> <a href="#v">v</a></td><td>Microseconds delay </td><td><small><a href="cif.html#gpioDelay">gpioDelay</a></small></td></tr><tr><td><a href="#MILS">MILS</a> <a href="#v">v</a></td><td>Milliseconds delay </td><td><small><a href="cif.html#gpioDelay">gpioDelay</a></small></td></tr><tr><td><a href="#PIGPV">PIGPV</a></td><td>Get pigpio library version </td><td><small><a href="cif.html#gpioVersion">gpioVersion</a></small></td></tr><tr><td><a href="#T/TICK">T/TICK</a></td><td>Get current tick </td><td><small><a href="cif.html#gpioTick">gpioTick</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>CONFIGURATION
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#CGI">CGI</a></td><td>Configuration get internals </td><td><small><a href="cif.html#gpioCfgGetInternals">gpioCfgGetInternals</a></small></td></tr><tr><td><a href="#CSI">CSI</a> <a href="#v">v</a></td><td>Configuration set internals </td><td><small><a href="cif.html#gpioCfgSetInternals">gpioCfgSetInternals</a></small></td></tr><tr><td></td><td></td><td></td></tr></tbody></table><h2><a name="Commands">Commands</a></h2>
-<h3><a name="BC1">BC1</a>
- <a href="#bits">bits</a> - Clear specified GPIO in bank 1</h3>This command clears (sets low) the GPIO specified by <a href="#bits">bits</a> in bank 1.
-Bank 1 consists of GPIO 0-31.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;bc1&nbsp;0x400010&nbsp;#&nbsp;clear&nbsp;GPIO&nbsp;4&nbsp;(1&lt;&lt;4)&nbsp;and&nbsp;22&nbsp;(1&lt;&lt;22)<br><br>$&nbsp;pigs&nbsp;bc1&nbsp;32&nbsp;#&nbsp;clear&nbsp;GPIO&nbsp;5&nbsp;(1&lt;&lt;5)<br>-42<br>ERROR:&nbsp;no&nbsp;permission&nbsp;to&nbsp;update&nbsp;one&nbsp;or&nbsp;more&nbsp;GPIO<br></code><h3><a name="BC2">BC2</a>
- <a href="#bits">bits</a> - Clear specified GPIO in bank 2</h3>This command clears (sets low) the GPIO specified by <a href="#bits">bits</a> in bank 2.
-Bank 2 consists of GPIO 32-53.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;bc2&nbsp;0x8000&nbsp;#&nbsp;clear&nbsp;GPIO&nbsp;47&nbsp;(activity&nbsp;LED&nbsp;on&nbsp;A+/B+/Pi2/Pi3)<br><br>$&nbsp;pigs&nbsp;bc2&nbsp;1&nbsp;#&nbsp;clear&nbsp;GPIO&nbsp;32&nbsp;(first&nbsp;in&nbsp;bank&nbsp;2)<br>-42<br>ERROR:&nbsp;no&nbsp;permission&nbsp;to&nbsp;update&nbsp;one&nbsp;or&nbsp;more&nbsp;GPIO<br></code><h3><a name="BI2CC">BI2CC</a>
- <a href="#sda">sda</a> - Close bit bang I2C</h3>This command signals that bit banging I2C on <a href="#sda">sda</a> (and <a href="#scl">scl</a>) is no
-longer required.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;bi2cc&nbsp;5<br></code><h3><a name="BI2CO">BI2CO</a>
- <a href="#sda">sda</a> <a href="#scl">scl</a> <a href="#b">b</a> - Open bit bang I2C</h3>This command signals that GPIO <a href="#sda">sda</a> and <a href="#scl">scl</a> are to be used
-for bit banging I2C at <a href="#b">b</a> baud.
-<br><br>Bit banging I2C allows for certain operations which are not possible
-with the standard I2C driver.
-<br><br>o baud rates as low as 50<br>
-o repeated starts<br>
-o clock stretching<br>
-o I2C on any pair of spare GPIO
-<br><br>The baud rate may be between 50 and 500000 bits per second.
-<br><br>The GPIO used for SDA and SCL must have pull-ups to 3V3 connected. As
-a guide the hardware pull-ups on pins 3 and 5 are 1k8 in value.
-<h3><a name="BI2CZ">BI2CZ</a>
- <a href="#sda">sda</a> <a href="#bvs">bvs</a> - I2C bit bang multiple transactions</h3>This function executes a sequence of bit banged I2C operations. The
-operations to be performed are specified by the contents of <a href="#bvs">bvs</a>
-which contains the concatenated command codes and associated data.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>End</td><td>0</td><td>No more commands</td></tr><tr><td>Escape</td><td>1</td><td>Next P is two bytes</td></tr><tr><td>Start</td><td>2</td><td>Start condition</td></tr><tr><td>Stop</td><td>3</td><td>Stop condition</td></tr><tr><td>Address</td><td>4 P</td><td>Set I2C address to P</td></tr><tr><td>Flags</td><td>5 lsb msb</td><td>Set I2C flags to lsb + (msb &lt;&lt; 8)</td></tr><tr><td>Read</td><td>6 P</td><td>Read P bytes of data</td></tr><tr><td>Write</td><td>7 P ...</td><td>Write P bytes of data</td></tr></tbody></table><br><br>The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-<br><br>The address and flags default to 0. The address and flags maintain
-their previous value until updated.
-<br><br>No flags are currently defined.
-<br><br><b><small>Example</small></b><br><br><code>Set&nbsp;address&nbsp;0x53<br>start,&nbsp;write&nbsp;0x32,&nbsp;(re)start,&nbsp;read&nbsp;6&nbsp;bytes,&nbsp;stop<br>Set&nbsp;address&nbsp;0x1E<br>start,&nbsp;write&nbsp;0x03,&nbsp;(re)start,&nbsp;read&nbsp;6&nbsp;bytes,&nbsp;stop<br>Set&nbsp;address&nbsp;0x68<br>start,&nbsp;write&nbsp;0x1B,&nbsp;(re)start,&nbsp;read&nbsp;8&nbsp;bytes,&nbsp;stop<br>End<br><br>0x04&nbsp;0x53<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x32&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x06&nbsp;0x03<br><br>0x04&nbsp;0x1E<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x03&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x06&nbsp;0x03<br><br>0x04&nbsp;0x68<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x1B&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x08&nbsp;0x03<br><br>0x00<br></code><h3><a name="BR1">BR1</a>
- - Read bank 1 GPIO</h3>This command read GPIO 0-31 (bank 1) and returns the levels as a
-32-bit hexadecimal value.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;br1<br>1001C1CF<br></code><h3><a name="BR2">BR2</a>
- - Read bank 2 GPIO</h3>This command read GPIO 32-53 (bank 2) and returns the levels as a
-32-bit hexadecimal value.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;br2<br>003F0000<br></code><h3><a name="BS1">BS1</a>
- <a href="#bits">bits</a> - Set specified GPIO in bank 1</h3>This command sets (sets high) the GPIO specified by <a href="#bits">bits</a> in bank 1.
-Bank 1 consists of GPIO 0-31.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;bs1&nbsp;16&nbsp;#&nbsp;set&nbsp;GPIO&nbsp;4&nbsp;(1&lt;&lt;4)<br><br>$&nbsp;pigs&nbsp;bs1&nbsp;1&nbsp;#&nbsp;set&nbsp;GPIO&nbsp;1&nbsp;(1&lt;&lt;0)<br>-42<br>ERROR:&nbsp;no&nbsp;permission&nbsp;to&nbsp;update&nbsp;one&nbsp;or&nbsp;more&nbsp;GPIO<br></code><h3><a name="BS2">BS2</a>
- <a href="#bits">bits</a> - Set specified GPIO in bank 2</h3>This command sets (sets high) the GPIO specified by <a href="#bits">bits</a> in bank 2.
-Bank 2 consists of GPIO 32-53.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;bs2&nbsp;0x40&nbsp;#&nbsp;set&nbsp;GPIO&nbsp;38&nbsp;(enable&nbsp;high&nbsp;current&nbsp;mode&nbsp;A+/B+/Pi2/Pi3)<br><br>$&nbsp;pigs&nbsp;bs2&nbsp;1&nbsp;#&nbsp;set&nbsp;GPIO&nbsp;32&nbsp;(first&nbsp;in&nbsp;bank&nbsp;2)<br>-42<br>ERROR:&nbsp;no&nbsp;permission&nbsp;to&nbsp;update&nbsp;one&nbsp;or&nbsp;more&nbsp;GPIO<br></code><h3><a name="BSCX">BSCX</a>
- <a href="#bctl">bctl</a> <a href="#bvs">bvs</a> - BSC I2C/SPI transfer</h3>This command performs a BSC I2C/SPI slave transfer as defined by
-<a href="#bctl">bctl</a> with data <a href="#bvs">bvs</a>.
-<br><br>This function provides a low-level interface to the SPI/I2C Slave
-peripheral on the BCM chip.
-<br><br>This peripheral allows the Pi to act as a hardware slave device
-on an I2C or SPI bus.
-<br><br>This is not a bit bang version and as such is OS timing
-independent. The bus timing is handled directly by the chip.
-<br><br>The output process is simple. You simply append data to the FIFO
-buffer on the chip. This works like a queue, you add data to the
-queue and the master removes it.
-<br><br>I can't get SPI to work properly. I tried with a
-control word of 0x303 and swapped MISO and MOSI.
-<br><br>The command sets the BSC mode and writes any data <a href="#bvs">bvs</a>
-to the BSC transmit FIFO. It returns the data count (at least 1
-for the status word), the status word, followed by any data bytes
-read from the BSC receive FIFO.
-<br><br>Note that the control word sets the BSC mode. The BSC will stay in
-that mode until a different control word is sent.
-<br><br>For I2C use a control word of (I2C address &lt;&lt; 16) + 0x305.
-<br><br>E.g. to talk as I2C slave with address 0x13 use 0x130305.
-<br><br>GPIO used for models other than those based on the BCM2711.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td><td>MOSI</td><td>SCLK</td><td>MISO</td><td>CE</td></tr><tr><td>I2C</td><td>18</td><td>19</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>SPI</td><td>-</td><td>-</td><td>18</td><td>19</td><td>20</td><td>21</td></tr></tbody></table><br><br>GPIO used for models based on the BCM2711 (e.g. the Pi4B).
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td><td>MOSI</td><td>SCLK</td><td>MISO</td><td>CE</td></tr><tr><td>I2C</td><td>10</td><td>11</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>SPI</td><td>-</td><td>-</td><td>10</td><td>11</td><td>9</td><td>8</td></tr></tbody></table><br><br>When a zero control word is received the used GPIO will be reset
-to INPUT mode.
-<br><br>The control word consists of the following bits.
-<br><br><code>22&nbsp;21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;IT&nbsp;HC&nbsp;TF&nbsp;IR&nbsp;RE&nbsp;TE&nbsp;BK&nbsp;EC&nbsp;ES&nbsp;PL&nbsp;PH&nbsp;I2&nbsp;SP&nbsp;EN<br></code><br><br>Bits 0-13 are copied unchanged to the BSC CR register. See
-pages 163-165 of the Broadcom peripherals document for full
-details.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>aaaaaaa</td><td>defines the I2C slave address (only relevant in I2C mode)</td></tr><tr><td>IT</td><td>invert transmit status flags</td></tr><tr><td>HC</td><td>enable host control</td></tr><tr><td>TF</td><td>enable test FIFO</td></tr><tr><td>IR</td><td>invert receive status flags</td></tr><tr><td>RE</td><td>enable receive</td></tr><tr><td>TE</td><td>enable transmit</td></tr><tr><td>BK</td><td>abort operation and clear FIFOs</td></tr><tr><td>EC</td><td>send control register as first I2C byte</td></tr><tr><td>ES</td><td>send status register as first I2C byte</td></tr><tr><td>PL</td><td>set SPI polarity high</td></tr><tr><td>PH</td><td>set SPI phase high</td></tr><tr><td>I2</td><td>enable I2C mode</td></tr><tr><td>SP</td><td>enable SPI mode</td></tr><tr><td>EN</td><td>enable BSC peripheral</td></tr></tbody></table><br><br>The returned status has the following format
-<br><br><code>20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;RB&nbsp;TE&nbsp;RF&nbsp;TF&nbsp;RE&nbsp;TB<br></code><br><br>Bits 0-15 are copied unchanged from the BSC FR register. See
-pages 165-166 of the Broadcom peripherals document for full
-details.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>SSSSS</td><td>number of bytes successfully copied to transmit FIFO</td></tr><tr><td>RRRRR</td><td>number of bytes in receieve FIFO</td></tr><tr><td>TTTTT</td><td>number of bytes in transmit FIFO</td></tr><tr><td>RB</td><td>receive busy</td></tr><tr><td>TE</td><td>transmit FIFO empty</td></tr><tr><td>RF</td><td>receive FIFO full</td></tr><tr><td>TF</td><td>transmit FIFO full</td></tr><tr><td>RE</td><td>receive FIFO empty</td></tr><tr><td>TB</td><td>transmit busy</td></tr></tbody></table><br><br>This example assumes that GPIO 2/3 are connected to GPIO 18/19
-(GPIO 10/11 on the BCM2711).
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;bscx&nbsp;0x130305&nbsp;#&nbsp;start&nbsp;BSC&nbsp;as&nbsp;I2C&nbsp;slave&nbsp;0x13<br>1&nbsp;18<br><br>$&nbsp;i2cdetect&nbsp;-y&nbsp;1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;1&nbsp;&nbsp;2&nbsp;&nbsp;3&nbsp;&nbsp;4&nbsp;&nbsp;5&nbsp;&nbsp;6&nbsp;&nbsp;7&nbsp;&nbsp;8&nbsp;&nbsp;9&nbsp;&nbsp;a&nbsp;&nbsp;b&nbsp;&nbsp;c&nbsp;&nbsp;d&nbsp;&nbsp;e&nbsp;&nbsp;f<br>00:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>10:&nbsp;--&nbsp;--&nbsp;--&nbsp;13&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>20:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>30:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>40:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>50:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>60:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>70:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br><br>$&nbsp;pigs&nbsp;i2co&nbsp;1&nbsp;0x13&nbsp;0&nbsp;#&nbsp;get&nbsp;handle&nbsp;for&nbsp;device&nbsp;0x13&nbsp;on&nbsp;bus&nbsp;1<br>0<br><br>$&nbsp;pigs&nbsp;i2cwd&nbsp;0&nbsp;90&nbsp;87&nbsp;51&nbsp;9&nbsp;23&nbsp;#&nbsp;write&nbsp;5&nbsp;bytes<br><br>$&nbsp;pigs&nbsp;bscx&nbsp;0x130305&nbsp;#&nbsp;check&nbsp;for&nbsp;data<br>6&nbsp;18&nbsp;90&nbsp;87&nbsp;51&nbsp;9&nbsp;23<br><br>$&nbsp;pigs&nbsp;bscx&nbsp;0x130305&nbsp;11&nbsp;13&nbsp;15&nbsp;17&nbsp;#&nbsp;check&nbsp;for&nbsp;data&nbsp;and&nbsp;send&nbsp;4&nbsp;bytes<br>1&nbsp;262338<br><br>$&nbsp;pigs&nbsp;i2crd&nbsp;0&nbsp;4&nbsp;#&nbsp;read&nbsp;4&nbsp;bytes<br>4&nbsp;11&nbsp;13&nbsp;15&nbsp;17<br><br>$&nbsp;pigs&nbsp;i2cwd&nbsp;0&nbsp;90&nbsp;87&nbsp;51&nbsp;9&nbsp;23&nbsp;#&nbsp;write&nbsp;5&nbsp;bytes<br>$&nbsp;pigs&nbsp;bscx&nbsp;0x130305&nbsp;11&nbsp;13&nbsp;15&nbsp;17&nbsp;#&nbsp;check&nbsp;for&nbsp;data&nbsp;and&nbsp;send&nbsp;4&nbsp;bytes<br>6&nbsp;262338&nbsp;90&nbsp;87&nbsp;51&nbsp;9&nbsp;23<br><br>$&nbsp;pigs&nbsp;i2crd&nbsp;0&nbsp;4<br>4&nbsp;11&nbsp;13&nbsp;15&nbsp;17<br><br>$&nbsp;pigs&nbsp;bscx&nbsp;0x130305&nbsp;22&nbsp;33&nbsp;44&nbsp;55&nbsp;66<br>1&nbsp;327938<br>$&nbsp;pigs&nbsp;i2crd&nbsp;0&nbsp;5<br>5&nbsp;22&nbsp;33&nbsp;44&nbsp;55&nbsp;66<br></code><h3><a name="BSPIC">BSPIC</a>
- <a href="#cs">cs</a> - Close bit bang SPI</h3>This command stops bit banging SPI on a set of GPIO
-opened with <a href="#BSPIO">BSPIO</a>.
-<br><br>The set of GPIO is specifed by <a href="#cs">cs</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;bspic&nbsp;10<br><br>$&nbsp;pigs&nbsp;bspic&nbsp;10<br>-142<br>ERROR:&nbsp;no&nbsp;bit&nbsp;bang&nbsp;SPI&nbsp;in&nbsp;progress&nbsp;on&nbsp;GPIO<br></code><h3><a name="BSPIO">BSPIO</a>
- <a href="#cs">cs</a> <a href="#miso">miso</a> <a href="#mosi">mosi</a> <a href="#sclk">sclk</a> <a href="#b">b</a> <a href="#spf">spf</a> - Open bit bang SPI</h3>This command starts bit banging SPI on a group of GPIO with slave
-select <a href="#cs">cs</a>, MISO <a href="#miso">miso</a>, MOSI <a href="#mosi">mosi</a>, and clock <a href="#sclk">sclk</a>.
-<br><br>Data will be transferred at baud <a href="#b">b</a> bits per second (which may
-be set in the range 50-250000).
-<br><br>The flags <a href="#spf">spf</a> may be used to modify the default behaviour of
-mode 0, active low chip select.
-<br><br>The flags consists of the least significant 22 bits.
-<br><br><code>21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;p&nbsp;&nbsp;m&nbsp;&nbsp;m<br></code><br><br>mm defines the SPI mode.
-<br><br><code>Mode&nbsp;POL&nbsp;PHA<br>&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;0<br>&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;1<br>&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;0<br>&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;1<br></code><br><br>p is 0 if CS is active low (default) and 1 for active high.
-<br><br>T is 1 if the least significant bit is transmitted on MOSI first, the
-default (0) shifts the most significant bit out first.
-<br><br>R is 1 if the least significant bit is received on MISO first, the
-default (0) receives the most significant bit first.
-<br><br>The other bits in flags should be set to zero.
-<br><br>Upon success 0 is returned. On error a negative status code
-will be returned.
-<br><br>If more than one device is connected to the SPI bus (defined by
-SCLK, MOSI, and MISO) each must have its own CS.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;bspio&nbsp;&nbsp;9&nbsp;11&nbsp;12&nbsp;13&nbsp;50000&nbsp;0<br><br>$&nbsp;pigs&nbsp;bspio&nbsp;10&nbsp;11&nbsp;12&nbsp;13&nbsp;50000&nbsp;0<br><br>$&nbsp;pigs&nbsp;bspio&nbsp;29&nbsp;19&nbsp;20&nbsp;21&nbsp;50000&nbsp;0&nbsp;#&nbsp;GPIO&nbsp;29&nbsp;not&nbsp;avaialble&nbsp;on&nbsp;this&nbsp;Pi<br>-41<br>ERROR:&nbsp;no&nbsp;permission&nbsp;to&nbsp;update&nbsp;GPIO<br></code><h3><a name="BSPIX">BSPIX</a>
- <a href="#cs">cs</a> <a href="#bvs">bvs</a> - SPI bit bang transfer</h3>This command writes bytes <a href="#bvs">bvs</a> to the bit bang SPI device
-associated with slave select <a href="#cs">cs</a>. It returns the same
-number of bytes read from the device.
-<br><br>Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;bspio&nbsp;5&nbsp;13&nbsp;19&nbsp;12&nbsp;10000&nbsp;0&nbsp;#&nbsp;MCP4251&nbsp;DAC<br>$&nbsp;pigs&nbsp;bspio&nbsp;6&nbsp;13&nbsp;19&nbsp;12&nbsp;20000&nbsp;3&nbsp;#&nbsp;MCP3008&nbsp;ADC<br><br>$&nbsp;pigs&nbsp;bspix&nbsp;5&nbsp;0&nbsp;16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;set&nbsp;DAC&nbsp;to&nbsp;16<br>2&nbsp;255&nbsp;255<br><br>$&nbsp;pigs&nbsp;bspix&nbsp;5&nbsp;12&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;read&nbsp;back&nbsp;DAC<br>2&nbsp;254&nbsp;16<br><br>$&nbsp;pigs&nbsp;bspix&nbsp;6&nbsp;1&nbsp;128&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;read&nbsp;ADC&nbsp;input&nbsp;0<br>3&nbsp;0&nbsp;3&nbsp;184&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;952<br><br>$&nbsp;pigs&nbsp;bspix&nbsp;5&nbsp;0&nbsp;240&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;set&nbsp;DAC&nbsp;to&nbsp;240<br>2&nbsp;255&nbsp;255<br><br>$&nbsp;pigs&nbsp;bspix&nbsp;5&nbsp;12&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;read&nbsp;back&nbsp;DAC<br>2&nbsp;254&nbsp;240<br><br>$&nbsp;pigs&nbsp;bspix&nbsp;6&nbsp;1&nbsp;128&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;read&nbsp;ADC&nbsp;input&nbsp;0<br>3&nbsp;0&nbsp;0&nbsp;63&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;63<br><br>$&nbsp;pigs&nbsp;bspix&nbsp;5&nbsp;0&nbsp;128&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;set&nbsp;DAC&nbsp;to&nbsp;128<br>2&nbsp;255&nbsp;255<br><br>$&nbsp;pigs&nbsp;bspix&nbsp;5&nbsp;12&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;read&nbsp;back&nbsp;DAC<br>2&nbsp;254&nbsp;128<br><br>$&nbsp;pigs&nbsp;bspix&nbsp;6&nbsp;1&nbsp;128&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;read&nbsp;ADC&nbsp;input&nbsp;0<br>3&nbsp;0&nbsp;1&nbsp;255&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;511<br><br>$&nbsp;pigs&nbsp;bspic&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;close&nbsp;SPI&nbsp;CS&nbsp;5<br>$&nbsp;pigs&nbsp;bspic&nbsp;6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;close&nbsp;SPI&nbsp;CS&nbsp;6<br><br>$&nbsp;pigs&nbsp;bspic&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;try&nbsp;to&nbsp;close&nbsp;SPI&nbsp;CS&nbsp;5&nbsp;again<br>-142<br>ERROR:&nbsp;no&nbsp;bit&nbsp;bang&nbsp;SPI&nbsp;in&nbsp;progress&nbsp;on&nbsp;GPIO<br></code><h3><a name="CF1">CF1</a>
- <a href="#uvs">uvs</a> - Custom function 1</h3>This command calls a user customised function. The meaning of
-any paramaters and the returned value is defined by the
-customiser.
-<h3><a name="CF2">CF2</a>
- <a href="#uvs">uvs</a> - Custom function 2</h3>This command calls a user customised function. The meaning of
-any paramaters and the returned value is defined by the
-customiser.
-<h3><a name="CGI">CGI</a>
- - Configuration get internals</h3>This command returns the value of the internal library
-configuration settings.
-<h3><a name="CSI">CSI</a>
- <a href="#v">v</a> - Configuration set internals</h3>This command sets the value of the internal library
-configuration settings to <a href="#v">v</a>.
-<h3><a name="EVM">EVM</a>
- <a href="#h">h</a> <a href="#bits">bits</a> - Set events to monitor</h3>This command starts event reporting on handle <a href="#h">h</a> (returned by
-a prior call to <a href="#NO">NO</a>).
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>The notification gets reports for each event specified by <a href="#bits">bits</a>.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;evm&nbsp;0&nbsp;-1&nbsp;#&nbsp;Shorthand&nbsp;for&nbsp;events&nbsp;0-31.<br>$&nbsp;pigs&nbsp;evm&nbsp;0&nbsp;0xf0&nbsp;#&nbsp;Get&nbsp;notifications&nbsp;for&nbsp;events&nbsp;4-7.<br><br>$&nbsp;pigs&nbsp;evm&nbsp;1&nbsp;0xf<br>-25<br>ERROR:&nbsp;unknown&nbsp;handle<br></code><h3><a name="EVT">EVT</a>
- <a href="#event">event</a> - Trigger event</h3>This command triggers event <a href="#event">event</a>.
-<br><br>One event, number 31, is predefined. This event is
-auto generated on BSC slave activity.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;evt&nbsp;12<br>$&nbsp;pigs&nbsp;evt&nbsp;5<br><br>$&nbsp;pigs&nbsp;evt&nbsp;32<br>-143<br>ERROR:&nbsp;bad&nbsp;event&nbsp;id<br></code><h3><a name="FC">FC</a>
- <a href="#h">h</a> - Close file handle</h3>This command closes a file handle <a href="#h">h</a> previously opened with <a href="#FO">FO</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;fc&nbsp;0&nbsp;#&nbsp;First&nbsp;close&nbsp;okay.<br><br>$&nbsp;pigs&nbsp;fc&nbsp;0&nbsp;#&nbsp;Second&nbsp;fails.<br>-25<br>ERROR:&nbsp;unknown&nbsp;handle<br></code><h3><a name="FG">FG</a>
- <a href="#u">u</a> <a href="#stdy">stdy</a> - Set a glitch filter on a GPIO</h3>Level changes on the GPIO <a href="#u">u</a> are not reported unless the level
-has been stable for at least <a href="#stdy">stdy</a> microseconds. The
-level is then reported. Level changes of less than <a href="#stdy">stdy</a>
-microseconds are ignored.
-<br><br>The filter only affects callbacks (including pipe notifications).
-<br><br>The <a href="#R/READ">R/READ</a>, <a href="#BR1">BR1</a>, and <a href="#BR2">BR2</a> commands are not affected.
-<br><br>Note, each (stable) edge will be timestamped <a href="#stdy">stdy</a> microseconds
-after it was first detected.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;fg&nbsp;4&nbsp;250<br><br>$&nbsp;pigs&nbsp;fg&nbsp;4&nbsp;1000000<br>-125<br>ERROR:&nbsp;bad&nbsp;filter&nbsp;parameter<br></code><h3><a name="FL">FL</a>
- <a href="#pat">pat</a> <a href="#num">num</a> - List files which match pattern</h3>This command returns a list of the files matching <a href="#pat">pat</a>. Up
-to <a href="#num">num</a> bytes may be returned.
-<br><br>Upon success the count of returned bytes followed by the matching
-files is returned. On error a negative status code will be returned.
-<br><br>A newline (0x0a) character separates each file name.
-<br><br>Only files which have a matching entry in /opt/pigpio/access may
-be listed.
-<br><br>Suppose /opt/pigpio/access contains
-<br><br>/sys/bus/w1/devices/28*/w1_slave r
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;-a&nbsp;fl&nbsp;"/sys/bus/w1/devices/28*/w1_slave"&nbsp;5000<br>90&nbsp;/sys/bus/w1/devices/28-000005d34cd2/w1_slave<br>/sys/bus/w1/devices/28-001414abbeff/w1_slave<br><br>$&nbsp;pigs&nbsp;-a&nbsp;fl&nbsp;"/sys/bus/*"&nbsp;5000<br>ERROR:&nbsp;no&nbsp;permission&nbsp;to&nbsp;access&nbsp;file<br>-137<br></code><h3><a name="FN">FN</a>
- <a href="#u">u</a> <a href="#stdy">stdy</a> <a href="#actv">actv</a> - Set a noise filter on a GPIO</h3>Level changes on the GPIO <a href="#u">u</a> are ignored until a level which has
-been stable for <a href="#stdy">stdy</a> microseconds is detected. Level
-changes on the GPIO are then reported for <a href="#actv">actv</a> microseconds
-after which the process repeats.
-<br><br>The filter only affects callbacks (including pipe notifications).
-<br><br>The <a href="#R/READ">R/READ</a>, <a href="#BR1">BR1</a>, and <a href="#BR2">BR2</a> commands are not affected.
-<br><br>Note, level changes before and after the active period may
-be reported. Your software must be designed to cope with
-such reports.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;fn&nbsp;7&nbsp;250&nbsp;1000<br><br>$&nbsp;pigs&nbsp;fn&nbsp;7&nbsp;2500000&nbsp;1000<br>-125<br>ERROR:&nbsp;bad&nbsp;filter&nbsp;parameter<br></code><h3><a name="FO">FO</a>
- <a href="#file">file</a> <a href="#mode">mode</a> - Open a file in mode</h3>This function returns a handle to a file <a href="#file">file</a> opened
-in a specified mode <a href="#mode">mode</a>.
-<br><br>Upon success a handle (&gt;=0) is returned. On error a negative status code
-will be returned.
-<br><br>File
-<br><br>A file may only be opened if permission is granted by an entry in
-/opt/pigpio/access. This is intended to allow remote access to files
-in a more or less controlled manner.
-<br><br>Each entry in /opt/pigpio/access takes the form of a file path
-which may contain wildcards followed by a single letter permission.
-The permission may be R for read, W for write, U for read/write,
-and N for no access.
-<br><br>Where more than one entry matches a file the most specific rule
-applies. If no entry matches a file then access is denied.
-<br><br>Suppose /opt/pigpio/access contains the following entries
-<br><br><code>/home/*&nbsp;n<br>/home/pi/shared/dir_1/*&nbsp;w<br>/home/pi/shared/dir_2/*&nbsp;r<br>/home/pi/shared/dir_3/*&nbsp;u<br>/home/pi/shared/dir_1/file.txt&nbsp;n<br></code><br><br>Files may be written in directory dir_1 with the exception
-of file.txt.
-<br><br>Files may be read in directory dir_2.
-<br><br>Files may be read and written in directory dir_3.
-<br><br>If a directory allows read, write, or read/write access then files may
-be created in that directory.
-<br><br>In an attempt to prevent risky permissions the following paths are
-ignored in /opt/pigpio/access.
-<br><br><code>a&nbsp;path&nbsp;containing&nbsp;..<br>a&nbsp;path&nbsp;containing&nbsp;only&nbsp;wildcards&nbsp;(*?)<br>a&nbsp;path&nbsp;containing&nbsp;less&nbsp;than&nbsp;two&nbsp;non-wildcard&nbsp;parts<br></code><br><br>Mode
-<br><br>The mode may have the following values.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>Value</td><td>Meaning</td></tr><tr><td>READ</td><td>1</td><td>open file for reading</td></tr><tr><td>WRITE</td><td>2</td><td>open file for writing</td></tr><tr><td>RW</td><td>3</td><td>open file for reading and writing</td></tr></tbody></table><br><br>The following values may be or'd into the mode.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>Value</td><td>Meaning</td></tr><tr><td>APPEND</td><td>4</td><td>All writes append data to the end of the file</td></tr><tr><td>CREATE</td><td>8</td><td>The file is created if it doesn't exist</td></tr><tr><td>TRUNC</td><td>16</td><td>The file is truncated</td></tr></tbody></table><br><br>Newly created files are owned by root with permissions owner read and write.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;ls&nbsp;/ram/*.c<br>/ram/command.c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/ram/pigpiod.c&nbsp;&nbsp;/ram/pigs.c<br>/ram/x_pigpiod_if.c&nbsp;/ram/pig2vcd.c&nbsp;&nbsp;/ram/pigpiod_if2.c<br>/ram/x_pigpio.c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/ram/x_repeat.c&nbsp;/ram/pigpio.c<br>/ram/pigpiod_if.c&nbsp;&nbsp;&nbsp;/ram/x_pigpiod_if2.c<br><br>#&nbsp;assumes&nbsp;/opt/pigpio/access&nbsp;contains&nbsp;the&nbsp;following&nbsp;line<br>#&nbsp;/ram/*.c&nbsp;r<br><br>$&nbsp;pigs&nbsp;fo&nbsp;/ram/pigpio.c&nbsp;1<br>0<br><br>$&nbsp;pigs&nbsp;fo&nbsp;/ram/new.c&nbsp;1<br>-128<br>ERROR:&nbsp;file&nbsp;open&nbsp;failed<br><br>$&nbsp;pigs&nbsp;fo&nbsp;/ram/new.c&nbsp;9<br>1<br><br>$&nbsp;ls&nbsp;/ram/*.c&nbsp;-l<br>-rw-r--r--&nbsp;1&nbsp;joan&nbsp;joan&nbsp;&nbsp;42923&nbsp;Jul&nbsp;10&nbsp;11:22&nbsp;/ram/command.c<br>-rw-------&nbsp;1&nbsp;root&nbsp;root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;Jul&nbsp;10&nbsp;16:54&nbsp;/ram/new.c<br>-rw-r--r--&nbsp;1&nbsp;joan&nbsp;joan&nbsp;&nbsp;&nbsp;2971&nbsp;Jul&nbsp;10&nbsp;11:22&nbsp;/ram/pig2vcd.c<br>-rw-------&nbsp;1&nbsp;joan&nbsp;joan&nbsp;296235&nbsp;Jul&nbsp;10&nbsp;11:22&nbsp;/ram/pigpio.c<br>-rw-r--r--&nbsp;1&nbsp;joan&nbsp;joan&nbsp;&nbsp;&nbsp;9266&nbsp;Jul&nbsp;10&nbsp;11:22&nbsp;/ram/pigpiod.c<br>-rw-r--r--&nbsp;1&nbsp;joan&nbsp;joan&nbsp;&nbsp;37331&nbsp;Jul&nbsp;10&nbsp;11:22&nbsp;/ram/pigpiod_if2.c<br>-rw-r--r--&nbsp;1&nbsp;joan&nbsp;joan&nbsp;&nbsp;33088&nbsp;Jul&nbsp;10&nbsp;11:22&nbsp;/ram/pigpiod_if.c<br>-rw-r--r--&nbsp;1&nbsp;joan&nbsp;joan&nbsp;&nbsp;&nbsp;7990&nbsp;Jul&nbsp;10&nbsp;11:22&nbsp;/ram/pigs.c<br>-rw-r--r--&nbsp;1&nbsp;joan&nbsp;joan&nbsp;&nbsp;19970&nbsp;Jul&nbsp;10&nbsp;11:22&nbsp;/ram/x_pigpio.c<br>-rw-r--r--&nbsp;1&nbsp;joan&nbsp;joan&nbsp;&nbsp;20804&nbsp;Jul&nbsp;10&nbsp;11:22&nbsp;/ram/x_pigpiod_if2.c<br>-rw-r--r--&nbsp;1&nbsp;joan&nbsp;joan&nbsp;&nbsp;19844&nbsp;Jul&nbsp;10&nbsp;11:22&nbsp;/ram/x_pigpiod_if.c<br>-rw-r--r--&nbsp;1&nbsp;joan&nbsp;joan&nbsp;&nbsp;19907&nbsp;Jul&nbsp;10&nbsp;11:22&nbsp;/ram/x_repeat.c<br></code><h3><a name="FR">FR</a>
- <a href="#h">h</a> <a href="#num">num</a> - Read bytes from file handle</h3>This command returns up to <a href="#num">num</a> bytes of data read from the
-file associated with handle <a href="#h">h</a>.
-<br><br>Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;fr&nbsp;0&nbsp;10<br>5&nbsp;48&nbsp;49&nbsp;128&nbsp;144&nbsp;255<br><br>$&nbsp;pigs&nbsp;fr&nbsp;0&nbsp;10<br>0<br></code><h3><a name="FS">FS</a>
- <a href="#h">h</a> <a href="#num">num</a> <a href="#from">from</a> - Seek to file handle position</h3>This command seeks to a position within the file associated
-with handle <a href="#h">h</a>.
-<br><br>The number of bytes to move is <a href="#num">num</a>. Positive offsets
-move forward, negative offsets backwards. The move start
-position is determined by <a href="#from">from</a> as follows.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>From</td></tr><tr><td>0</td><td>start</td></tr><tr><td>1</td><td>current position</td></tr><tr><td>2</td><td>end</td></tr></tbody></table><br><br>Upon success the new byte position within the file (&gt;=0) is
-returned. On error a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;fs&nbsp;0&nbsp;200&nbsp;0&nbsp;#&nbsp;Seek&nbsp;to&nbsp;start&nbsp;of&nbsp;file&nbsp;plus&nbsp;200<br>200<br><br>$&nbsp;pigs&nbsp;fs&nbsp;0&nbsp;0&nbsp;1&nbsp;#&nbsp;Return&nbsp;current&nbsp;position<br>200<br><br>$&nbsp;pigs&nbsp;fs&nbsp;0&nbsp;0&nbsp;2&nbsp;#&nbsp;Seek&nbsp;to&nbsp;end&nbsp;of&nbsp;file,&nbsp;return&nbsp;size<br>296235<br></code><h3><a name="FW">FW</a>
- <a href="#h">h</a> <a href="#bvs">bvs</a> - Write bytes to file handle</h3>This command writes bytes <a href="#bvs">bvs</a> to the file
-associated with handle <a href="#h">h</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;fw&nbsp;0&nbsp;23&nbsp;45&nbsp;67&nbsp;89<br></code><h3><a name="GDC">GDC</a>
- <a href="#u">u</a> - Get GPIO PWM dutycycle</h3>This command returns the PWM dutycycle in use on GPIO <a href="#u">u</a>.
-<br><br>Upon success the dutycycle is returned. On error a negative
-status code will be returned.
-<br><br>For normal PWM the dutycycle will be out of the defined range
-for the GPIO (see <a href="#PRG">PRG</a>).
-<br><br>If a hardware clock is active on the GPIO the reported
-dutycycle will be 500000 (500k) out of 1000000 (1M).
-<br><br>If hardware PWM is active on the GPIO the reported dutycycle
-will be out of a 1000000 (1M).
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;p&nbsp;4&nbsp;129<br>$&nbsp;pigs&nbsp;gdc&nbsp;4<br>129<br><br>pigs&nbsp;gdc&nbsp;5<br>-92<br>ERROR:&nbsp;GPIO&nbsp;is&nbsp;not&nbsp;in&nbsp;use&nbsp;for&nbsp;PWM<br></code><h3><a name="GPW">GPW</a>
- <a href="#u">u</a> - Get GPIO servo pulsewidth</h3>This command returns the servo pulsewidth in use on GPIO <a href="#u">u</a>.
-<br><br>Upon success the servo pulsewidth is returned. On error a negative
-status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;s&nbsp;4&nbsp;1235<br>$&nbsp;pigs&nbsp;gpw&nbsp;4<br>1235<br><br>$&nbsp;pigs&nbsp;gpw&nbsp;9<br>-93<br>ERROR:&nbsp;GPIO&nbsp;is&nbsp;not&nbsp;in&nbsp;use&nbsp;for&nbsp;servo&nbsp;pulses<br></code><h3><a name="H/HELP">H/HELP</a>
- - Display command help</h3>This command displays a brief list of the commands and their parameters.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;h<br><br>$&nbsp;pigs&nbsp;help<br></code><h3><a name="HC">HC</a>
- <a href="#g">g</a> <a href="#cf">cf</a> - Set hardware clock frequency</h3>This command sets the hardware clock associated with GPIO <a href="#g">g</a> to
-frequency <a href="#cf">cf</a>. Frequencies above 30MHz are unlikely to work.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;hc&nbsp;4&nbsp;5000&nbsp;#&nbsp;start&nbsp;a&nbsp;5&nbsp;KHz&nbsp;clock&nbsp;on&nbsp;GPIO&nbsp;4&nbsp;(clock&nbsp;0)<br><br>$&nbsp;pigs&nbsp;hc&nbsp;5&nbsp;5000000&nbsp;#&nbsp;start&nbsp;a&nbsp;5&nbsp;MHz&nbsp;clcok&nbsp;on&nbsp;GPIO&nbsp;5&nbsp;(clock&nbsp;1)<br>-99<br>ERROR:&nbsp;need&nbsp;password&nbsp;to&nbsp;use&nbsp;hardware&nbsp;clock&nbsp;1<br></code><br><br>The same clock is available on multiple GPIO. The latest
-frequency setting will be used by all GPIO which share a clock.
-<br><br>The GPIO must be one of the following.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>4</td><td>clock 0</td><td>All models</td></tr><tr><td>5</td><td>clock 1</td><td>All models but A and B (reserved for system use)</td></tr><tr><td>6</td><td>clock 2</td><td>All models but A and B</td></tr><tr><td>20</td><td>clock 0</td><td>All models but A and B</td></tr><tr><td>21</td><td>clock 1</td><td>All models but A and B Rev.2 (reserved for system use)</td></tr></tbody></table><br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>32</td><td>clock 0</td><td>Compute module only</td></tr><tr><td>34</td><td>clock 0</td><td>Compute module only</td></tr><tr><td>42</td><td>clock 1</td><td>Compute module only (reserved for system use)</td></tr><tr><td>43</td><td>clock 2</td><td>Compute module only</td></tr><tr><td>44</td><td>clock 1</td><td>Compute module only (reserved for system use)</td></tr></tbody></table><br><br>Access to clock 1 is protected by a password as its use will
-likely crash the Pi. The password is given by or'ing 0x5A000000
-with the GPIO number.
-<h3><a name="HP">HP</a>
- <a href="#g">g</a> <a href="#pf">pf</a> <a href="#pdc">pdc</a> - Set hardware PWM frequency and dutycycle</h3>This command sets the hardware PWM associated with GPIO <a href="#g">g</a> to
-frequency <a href="#pf">pf</a> with dutycycle <a href="#pdc">pdc</a>. Frequencies above 30MHz
-are unlikely to work.
-<br><br>NOTE: Any waveform started by <a href="#WVTX">WVTX</a>, <a href="#WVTXR">WVTXR</a>, or <a href="#WVCHA">WVCHA</a>
-will be cancelled.
-<br><br>This function is only valid if the pigpio main clock is PCM. The
-main clock defaults to PCM but may be overridden when the pigpio
-daemon is started (option -t).
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><code>$&nbsp;pigs&nbsp;hp&nbsp;18&nbsp;100&nbsp;800000&nbsp;#&nbsp;80%&nbsp;dutycycle<br><br>$&nbsp;pigs&nbsp;hp&nbsp;19&nbsp;100&nbsp;200000&nbsp;#&nbsp;20%&nbsp;dutycycle<br><br>$&nbsp;pigs&nbsp;hp&nbsp;19&nbsp;400000000&nbsp;100000<br>-96<br>ERROR:&nbsp;invalid&nbsp;hardware&nbsp;PWM&nbsp;frequency<br></code><br><br>The same PWM channel is available on multiple GPIO. The latest
-frequency and dutycycle setting will be used by all GPIO which
-share a PWM channel.
-<br><br>The GPIO must be one of the following.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>12</td><td>PWM channel 0</td><td>All models but A and B</td></tr><tr><td>13</td><td>PWM channel 1</td><td>All models but A and B</td></tr><tr><td>18</td><td>PWM channel 0</td><td>All models</td></tr><tr><td>19</td><td>PWM channel 1</td><td>All models but A and B</td></tr></tbody></table><br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>40</td><td>PWM channel 0</td><td>Compute module only</td></tr><tr><td>41</td><td>PWM channel 1</td><td>Compute module only</td></tr><tr><td>45</td><td>PWM channel 1</td><td>Compute module only</td></tr><tr><td>52</td><td>PWM channel 0</td><td>Compute module only</td></tr><tr><td>53</td><td>PWM channel 1</td><td>Compute module only</td></tr></tbody></table><br><br>The actual number of steps beween off and fully on is the
-integral part of 250M/<a href="#pf">pf</a> (375M/<a href="#pf">pf</a> for the BCM2711).
-<br><br>The actual frequency set is 250M/steps (375M/steps for the BCM2711).
-<br><br>There will only be a million steps for a <a href="#pf">pf</a> of 250 (375 for
-the BCM2711). Lower frequencies will have more steps and higher
-frequencies will have fewer steps. <a href="#pdc">pdc</a> is
-automatically scaled to take this into account.
-<h3><a name="HWVER">HWVER</a>
- - Get hardware version</h3>This command returns the hardware revision of the Pi.
-<br><br>The hardware revision is found in the last 4 characters on the revision
-line of /proc/cpuinfo.
-<br><br>If the hardware revision can not be found or is not a valid hexadecimal
-number the command returns 0.
-<br><br>The revision number can be used to determine the assignment of GPIO
-to pins (see <a href="#g">g</a>).
-<br><br>There are currently three types of board.
-<br><br>Type 1 boards have hardware revision numbers of 2 and 3.
-<br><br>Type 2 boards have hardware revision numbers of 4, 5, 6, and 15.
-<br><br>Type 3 boards have hardware revision numbers of 16 or greater.
-<br><br>for "Revision : 0002" the command returns 2.
-<br><br>for "Revision : 000f" the command returns 15.
-<br><br>for "Revision : 000g" the command returns 0.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;hwver&nbsp;#&nbsp;On&nbsp;a&nbsp;B+<br>16<br></code><h3><a name="I2CC">I2CC</a>
- <a href="#h">h</a> - Close I2C handle</h3>This command closes an I2C handle <a href="#h">h</a> previously opened with <a href="#I2CO">I2CO</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2cc&nbsp;0&nbsp;#&nbsp;First&nbsp;close&nbsp;okay.<br><br>$&nbsp;pigs&nbsp;i2cc&nbsp;0&nbsp;#&nbsp;Second&nbsp;fails.<br>-25<br>ERROR:&nbsp;unknown&nbsp;handle<br></code><h3><a name="I2CO">I2CO</a>
- <a href="#ib">ib</a> <a href="#id">id</a> <a href="#if">if</a> - Open I2C bus and device with flags</h3>This command returns a handle to access device <a href="#id">id</a> on I2C bus <a href="#ib">ib</a>.
-The device is opened with flags <a href="#if">if</a>.
-<br><br>Physically buses 0 and 1 are available on the Pi. Higher
-numbered buses will be available if a kernel supported bus
-multiplexor is being used.
-<br><br>The GPIO used are given in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td></tr><tr><td>I2C 0</td><td>0</td><td>1</td></tr><tr><td>I2C 1</td><td>2</td><td>3</td></tr></tbody></table><br><br>No flags are currently defined. The parameter <a href="#if">if</a> should be 0.
-<br><br>Upon success the next free handle (&gt;=0) is returned. On error a
-negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2co&nbsp;1&nbsp;0x70&nbsp;0&nbsp;#&nbsp;Bus&nbsp;1,&nbsp;device&nbsp;0x70,&nbsp;flags&nbsp;0.<br>0<br><br>$&nbsp;pigs&nbsp;i2co&nbsp;1&nbsp;0x53&nbsp;0&nbsp;#&nbsp;Bus&nbsp;1,&nbsp;device&nbsp;0x53,&nbsp;flags&nbsp;0.<br>1<br></code><h3><a name="I2CPC">I2CPC</a>
- <a href="#h">h</a> <a href="#r">r</a> <a href="#wv">wv</a> - smb Process Call: exchange register with word</h3>This command writes <a href="#wv">wv</a> to register <a href="#r">r</a> of the I2C device
-associated with handle <a href="#h">h</a> and returns a 16-bit word read from the
-device.
-<br><br>Upon success a value between 0 and 65535 will be returned. On error
-a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2cpc&nbsp;0&nbsp;37&nbsp;43210<br>39933<br><br>$&nbsp;pigs&nbsp;i2cpc&nbsp;0&nbsp;256&nbsp;43210<br>ERROR:&nbsp;bad&nbsp;i2c/spi/ser&nbsp;parameter<br>-81<br></code><h3><a name="I2CPK">I2CPK</a>
- <a href="#h">h</a> <a href="#r">r</a> <a href="#bvs">bvs</a> - smb Block Process Call: exchange data bytes with register</h3>This command writes the data bytes <a href="#bvs">bvs</a> to register <a href="#r">r</a> of the I2C device
-associated with handle <a href="#h">h</a> and returns a device specific number of bytes.
-<br><br>Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2cpk&nbsp;0&nbsp;0&nbsp;0x11&nbsp;0x12<br>6&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br></code><h3><a name="I2CRB">I2CRB</a>
- <a href="#h">h</a> <a href="#r">r</a> - smb Read Byte Data: read byte from register</h3>This command returns a single byte read from register <a href="#r">r</a> of the I2C device
-associated with handle <a href="#h">h</a>.
-<br><br>Upon success a value between 0 and 255 will be returned. On error
-a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2crb&nbsp;0&nbsp;0<br>6<br></code><h3><a name="I2CRD">I2CRD</a>
- <a href="#h">h</a> <a href="#num">num</a> - i2c Read device</h3>This command returns <a href="#num">num</a> bytes read from the I2C device associated with
-handle <a href="#h">h</a>.
-<br><br>Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-<br><br>This command operates on the raw I2C device. The maximum value of the
-parameter <a href="#num">num</a> is dependent on the I2C drivers and the device
-itself. pigs imposes a limit of about 8000 bytes.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2crd&nbsp;0&nbsp;16<br>16&nbsp;6&nbsp;24&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;32&nbsp;78<br></code><h3><a name="I2CRI">I2CRI</a>
- <a href="#h">h</a> <a href="#r">r</a> <a href="#num">num</a> - smb Read I2C Block Data: read bytes from register</h3>This command returns <a href="#num">num</a> bytes from register <a href="#r">r</a> of the I2C device
-associated with handle <a href="#h">h</a>.
-<br><br>Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-<br><br>The parameter <a href="#num">num</a> may be 1-32.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2cri&nbsp;0&nbsp;0&nbsp;16<br>16&nbsp;237&nbsp;155&nbsp;155&nbsp;155&nbsp;155&nbsp;155&nbsp;155&nbsp;155&nbsp;155&nbsp;155&nbsp;155&nbsp;155&nbsp;155&nbsp;155&nbsp;155&nbsp;155<br></code><h3><a name="I2CRK">I2CRK</a>
- <a href="#h">h</a> <a href="#r">r</a> - smb Read Block Data: read data from register</h3>This command returns between 1 and 32 bytes read from register <a href="#r">r</a> of
-the I2C device associated with handle <a href="#h">h</a>.
-<br><br>Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-<br><br>The number of bytes of returned data is specific to the device and
-register.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2crk&nbsp;0&nbsp;0<br>6&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br><br>$&nbsp;pigs&nbsp;i2crk&nbsp;0&nbsp;1<br>24&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;120&nbsp;222&nbsp;105&nbsp;215&nbsp;128&nbsp;87&nbsp;195&nbsp;217&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br></code><h3><a name="I2CRS">I2CRS</a>
- <a href="#h">h</a> - smb Read Byte: read byte</h3>This command returns a single byte read from the I2C device
-associated with handle <a href="#h">h</a>.
-<br><br>Upon success a value between 0 and 255 will be returned. On error
-a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2crs&nbsp;0<br>0<br></code><h3><a name="I2CRW">I2CRW</a>
- <a href="#h">h</a> <a href="#r">r</a> - smb Read Word Data: read word from register</h3>This command returns a single 16 bit word read from register <a href="#r">r</a> of
-the I2C device associated with handle <a href="#h">h</a>.
-<br><br>Upon success a value between 0 and 65535 will be returned. On error
-a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2crw&nbsp;0&nbsp;0<br>6150<br></code><h3><a name="I2CWB">I2CWB</a>
- <a href="#h">h</a> <a href="#r">r</a> <a href="#bv">bv</a> - smb Write Byte Data: write byte to register</h3>This command writes a single byte <a href="#bv">bv</a> to register <a href="#r">r</a> of the
-I2C device associated with handle <a href="#h">h</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2cwb&nbsp;0&nbsp;10&nbsp;0x54<br></code><h3><a name="I2CWD">I2CWD</a>
- <a href="#h">h</a> <a href="#bvs">bvs</a> - i2c Write device</h3>This command writes a block of bytes <a href="#bvs">bvs</a> to the I2C device
-associated with handle <a href="#h">h</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>The number of bytes which may be written in one transaction is
-dependent on the I2C drivers and the device itself. pigs imposes
-a limit of about 500 bytes.
-<br><br>This command operates on the raw I2C device.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2cwd&nbsp;0&nbsp;0x01&nbsp;0x02&nbsp;0x03&nbsp;0x04<br></code><h3><a name="I2CWI">I2CWI</a>
- <a href="#h">h</a> <a href="#r">r</a> <a href="#bvs">bvs</a> - smb Write I2C Block Data</h3>This command writes between 1 and 32 bytes <a href="#bvs">bvs</a> to register <a href="#r">r</a> of
-the I2C device associated with handle <a href="#h">h</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2cwi&nbsp;0&nbsp;4&nbsp;0x01&nbsp;0x04&nbsp;0xc0<br></code><h3><a name="I2CWK">I2CWK</a>
- <a href="#h">h</a> <a href="#r">r</a> <a href="#bvs">bvs</a> - smb Write Block Data: write data to register</h3>This command writes between 1 and 32 bytes <a href="#bvs">bvs</a> to register <a href="#r">r</a> of
-the I2C device associated with handle <a href="#h">h</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>pigs&nbsp;i2cwk&nbsp;0&nbsp;4&nbsp;0x01&nbsp;0x04&nbsp;0xc0<br></code><h3><a name="I2CWQ">I2CWQ</a>
- <a href="#h">h</a> <a href="#bit">bit</a> - smb Write Quick: write bit</h3>This command writes a single <a href="#bit">bit</a> to the I2C device associated
-with handle <a href="#h">h</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2cwq&nbsp;0&nbsp;1<br></code><h3><a name="I2CWS">I2CWS</a>
- <a href="#h">h</a> <a href="#bv">bv</a> - smb Write Byte: write byte</h3>This command writes a single byte <a href="#bv">bv</a> to the I2C device associated
-with handle <a href="#h">h</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2cws&nbsp;0&nbsp;0x12<br><br>$&nbsp;pigs&nbsp;i2cws&nbsp;0&nbsp;0xff<br>-82<br>ERROR:&nbsp;I2C&nbsp;write&nbsp;failed<br></code><h3><a name="I2CWW">I2CWW</a>
- <a href="#h">h</a> <a href="#r">r</a> <a href="#wv">wv</a> - smb Write Word Data: write word to register</h3>This command writes a single 16 bit word <a href="#wv">wv</a> to register <a href="#r">r</a> of
-the I2C device associated with handle <a href="#h">h</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2cww&nbsp;0&nbsp;0&nbsp;0xffff<br></code><h3><a name="I2CZ">I2CZ</a>
- <a href="#h">h</a> <a href="#bvs">bvs</a> - Performs multiple I2C transactions</h3>This command executes a sequence of I2C operations. The
-operations to be performed are specified by the contents of <a href="#bvs">bvs</a>
-which contains the concatenated command codes and associated data.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>End</td><td>0</td><td>No more commands</td></tr><tr><td>Escape</td><td>1</td><td>Next P is two bytes</td></tr><tr><td>On</td><td>2</td><td>Switch combined flag on</td></tr><tr><td>Off</td><td>3</td><td>Switch combined flag off</td></tr><tr><td>Address</td><td>4 P</td><td>Set I2C address to P</td></tr><tr><td>Flags</td><td>5 lsb msb</td><td>Set I2C flags to lsb + (msb &lt;&lt; 8)</td></tr><tr><td>Read</td><td>6 P</td><td>Read P bytes of data</td></tr><tr><td>Write</td><td>7 P ...</td><td>Write P bytes of data</td></tr></tbody></table><br><br>The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-<br><br>The address defaults to that associated with the handle <a href="#h">h</a>.
-The flags default to 0. The address and flags maintain their
-previous value until updated.
-<br><br><b><small>Example</small></b><br><br><code>Set&nbsp;address&nbsp;0x53,&nbsp;write&nbsp;0x32,&nbsp;read&nbsp;6&nbsp;bytes<br>Set&nbsp;address&nbsp;0x1E,&nbsp;write&nbsp;0x03,&nbsp;read&nbsp;6&nbsp;bytes<br>Set&nbsp;address&nbsp;0x68,&nbsp;write&nbsp;0x1B,&nbsp;read&nbsp;8&nbsp;bytes<br>End<br><br>0x04&nbsp;0x53&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x32&nbsp;&nbsp;&nbsp;0x06&nbsp;0x06<br>0x04&nbsp;0x1E&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x03&nbsp;&nbsp;&nbsp;0x06&nbsp;0x06<br>0x04&nbsp;0x68&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x1B&nbsp;&nbsp;&nbsp;0x06&nbsp;0x08<br>0x00<br></code><h3><a name="M/MODES">M/MODES</a>
- <a href="#g">g</a> <a href="#m">m</a> - Set GPIO mode</h3>This command sets GPIO <a href="#g">g</a> to mode <a href="#m">m</a>, typically input (read)
-or output (write).
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>Each GPIO can be configured to be in one of 8 different modes. The modes
-are named Input, Output, ALT0, ALT1, ALT2, ALT3, ALT4, and ALT5.
-<br><br>To set the mode use the code for the mode.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Mode</td><td>Input</td><td>Output</td><td>ALT0</td><td>ALT1</td><td>ALT2</td><td>ALT3</td><td>ALT4</td><td>ALT5</td></tr><tr><td>Code</td><td>R</td><td>W</td><td>0</td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;m&nbsp;4&nbsp;r&nbsp;#&nbsp;Input&nbsp;(read)<br>$&nbsp;pigs&nbsp;m&nbsp;4&nbsp;w&nbsp;#&nbsp;Output&nbsp;(write)<br>$&nbsp;pigs&nbsp;m&nbsp;4&nbsp;0&nbsp;#&nbsp;ALT&nbsp;0<br>$&nbsp;pigs&nbsp;m&nbsp;4&nbsp;5&nbsp;#&nbsp;ALT&nbsp;5<br></code><h3><a name="MG/MODEG">MG/MODEG</a>
- <a href="#g">g</a> - Get GPIO mode</h3>This command returns the current mode of GPIO <a href="#g">g</a>.
-<br><br>Upon success the value of the GPIO mode is returned.
-On error a negative status code will be returned.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Value</td><td>0</td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr><tr><td>Mode</td><td>Input</td><td>Output</td><td>ALT5</td><td>ALT4</td><td>ALT0</td><td>ALT1</td><td>ALT2</td><td>ALT3</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;mg&nbsp;4<br>1<br></code><h3><a name="MICS">MICS</a>
- <a href="#v">v</a> - Microseconds delay</h3>This command delays execution for <a href="#v">v</a> microseconds.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>The main use of this command is expected to be within <a href="#Scripts">Scripts</a>.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;mics&nbsp;20&nbsp;#&nbsp;Delay&nbsp;20&nbsp;microseconds.<br>$&nbsp;pigs&nbsp;mics&nbsp;1000000&nbsp;#&nbsp;Delay&nbsp;1&nbsp;second.<br><br>$&nbsp;pigs&nbsp;mics&nbsp;2000000<br>-64<br>ERROR:&nbsp;bad&nbsp;MICS&nbsp;delay&nbsp;(too&nbsp;large)<br></code><h3><a name="MILS">MILS</a>
- <a href="#v">v</a> - Milliseconds delay</h3>This command delays execution for <a href="#v">v</a> milliseconds.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;mils&nbsp;2000&nbsp;#&nbsp;Delay&nbsp;2&nbsp;seconds.<br><br>$&nbsp;pigs&nbsp;mils&nbsp;61000<br>-65<br>ERROR:&nbsp;bad&nbsp;MILS&nbsp;delay&nbsp;(too&nbsp;large)<br></code><h3><a name="NB">NB</a>
- <a href="#h">h</a> <a href="#bits">bits</a> - Start notification</h3>This command starts notifications on handle <a href="#h">h</a> returned by
-a prior call to <a href="#NO">NO</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>The notification gets state changes for each GPIO specified by <a href="#bits">bits</a>.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;nb&nbsp;0&nbsp;-1&nbsp;#&nbsp;Shorthand&nbsp;for&nbsp;GPIO&nbsp;0-31.<br>$&nbsp;pigs&nbsp;nb&nbsp;0&nbsp;0xf0&nbsp;#&nbsp;Get&nbsp;notifications&nbsp;for&nbsp;GPIO&nbsp;4-7.<br><br>$&nbsp;pigs&nbsp;nb&nbsp;1&nbsp;0xf<br>-25<br>ERROR:&nbsp;unknown&nbsp;handle<br></code><h3><a name="NC">NC</a>
- <a href="#h">h</a> - Close notification</h3>This command stops notifications on handle <a href="#h">h</a> returned by
-a prior call to <a href="#NO">NO</a> and releases the handle for reuse.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;nc&nbsp;0&nbsp;#&nbsp;First&nbsp;call&nbsp;succeeds.<br><br>$&nbsp;pigs&nbsp;nc&nbsp;1&nbsp;#&nbsp;Second&nbsp;call&nbsp;fails.<br>-25<br>ERROR:&nbsp;unknown&nbsp;handle<br></code><h3><a name="NO">NO</a>
- - Request a notification</h3>This command requests a free notification handle.
-<br><br>A notification is a method for being notified of GPIO state changes via a pipe.
-<br><br>Upon success the command returns a handle greater than or equal to zero.
-On error a negative status code will be returned.
-<br><br>Notifications for handle x will be available at the pipe named /dev/pigpiox
-(where x is the handle number).
-<br><br>E.g. if the command returns 15 then the notifications must be read
-from /dev/pigpio15.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;no<br>0<br></code><h3><a name="NP">NP</a>
- <a href="#h">h</a> - Pause notification</h3>This command pauses notifications on handle <a href="#h">h</a> returned by
-a prior call to <a href="#NO">NO</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>Notifications for the handle are suspended until a new <a href="#NB">NB</a> command
-is given for the handle.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;np&nbsp;0<br></code><h3><a name="P/PWM">P/PWM</a>
- <a href="#u">u</a> <a href="#v">v</a> - Set GPIO PWM value</h3>This command starts PWM on GPIO <a href="#u">u</a> with dutycycle <a href="#v">v</a>. The dutycycle
-varies from 0 (off) to range (fully on). The range defaults to 255.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>This and the servo functionality use the DMA and PWM or PCM peripherals
-to control and schedule the pulsewidths and dutycycles.
-<br><br>The <a href="#PRS">PRS</a> command may be used to change the default range of 255.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;p&nbsp;4&nbsp;64&nbsp;&nbsp;#&nbsp;Start&nbsp;PWM&nbsp;on&nbsp;GPIO&nbsp;4&nbsp;with&nbsp;25%&nbsp;dutycycle<br>$&nbsp;pigs&nbsp;p&nbsp;4&nbsp;128&nbsp;#&nbsp;50%<br>$&nbsp;pigs&nbsp;p&nbsp;4&nbsp;192&nbsp;#&nbsp;75%<br>$&nbsp;pigs&nbsp;p&nbsp;4&nbsp;255&nbsp;#&nbsp;100%<br></code><h3><a name="PADG">PADG</a>
- <a href="#pad">pad</a> - Get pad drive strength</h3>This command gets the <a href="#pad">pad</a> drive strength <a href="#padma">padma</a> in mA.
-<br><br>Returns the pad drive strength if OK. On error a negative status code
-will be returned.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;padg&nbsp;0<br>8<br>$&nbsp;pigs&nbsp;pads&nbsp;0&nbsp;16<br>$&nbsp;pigs&nbsp;padg&nbsp;0<br>16<br>pigs&nbsp;padg&nbsp;3<br>-126<br>ERROR:&nbsp;bad&nbsp;pad&nbsp;number<br></code><h3><a name="PADS">PADS</a>
- <a href="#pad">pad</a> <a href="#padma">padma</a> - Set pad drive strength</h3>This command sets the <a href="#pad">pad</a> drive strength <a href="#padma">padma</a> in mA.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;pads&nbsp;0&nbsp;16<br>$&nbsp;pigs&nbsp;padg&nbsp;0<br>16<br>$&nbsp;pigs&nbsp;pads&nbsp;0&nbsp;17<br>-127<br>ERROR:&nbsp;bad&nbsp;pad&nbsp;drive&nbsp;strength<br></code><h3><a name="PARSE">PARSE</a>
- <a href="#t">t</a> - Validate script</h3>Validates the text <a href="#t">t</a> of a script without storing the script.
-<br><br>Upon success nothing is returned. On error a list of detected
-script errors will be given.
-<br><br>See <a href="#Scripts">Scripts</a>.
-<br><br>This command may be used to find script syntax faults.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;parse&nbsp;tag&nbsp;100&nbsp;w&nbsp;22&nbsp;1&nbsp;mils&nbsp;200&nbsp;w&nbsp;22&nbsp;0&nbsp;mils&nbsp;800&nbsp;jmp&nbsp;100<br><br>$&nbsp;pigs&nbsp;parse&nbsp;tag&nbsp;0&nbsp;w&nbsp;22&nbsp;1&nbsp;mills&nbsp;50&nbsp;w&nbsp;22&nbsp;0&nbsp;dcr&nbsp;p10&nbsp;jp&nbsp;99<br>Unknown&nbsp;command:&nbsp;mills<br>Unknown&nbsp;command:&nbsp;50<br>Bad&nbsp;parameter&nbsp;to&nbsp;dcr<br>Can't&nbsp;resolve&nbsp;tag&nbsp;99<br></code><h3><a name="PFG">PFG</a>
- <a href="#u">u</a> - Get GPIO PWM frequency</h3>This command returns the PWM frequency in Hz used for GPIO <a href="#u">u</a>.
-<br><br>Upon success the PWM frequency is returned. On error a negative
-status code will be returned.
-<br><br>For normal PWM the frequency will be that defined for the GPIO
-by <a href="#PFS">PFS</a>.
-<br><br>If a hardware clock is active on the GPIO the reported frequency
-will be that set by <a href="#HC">HC</a>.
-<br><br>If hardware PWM is active on the GPIO the reported frequency
-will be that set by <a href="#HP">HP</a>.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;pfg&nbsp;4<br>800<br><br>$&nbsp;pigs&nbsp;pfg&nbsp;34<br>ERROR:&nbsp;GPIO&nbsp;not&nbsp;0-31<br>-2<br></code><h3><a name="PFS">PFS</a>
- <a href="#u">u</a> <a href="#v">v</a> - Set GPIO PWM frequency</h3>This command sets the PWM frequency <a href="#v">v</a> to be used for GPIO <a href="#u">u</a>.
-<br><br>The numerically closest frequency to <a href="#v">v</a> will be selected.
-<br><br>Upon success the new frequency is returned. On error a negative status code
-will be returned.
-<br><br>If PWM is currently active on the GPIO it will be
-switched off and then back on at the new frequency.
-<br><br>Each GPIO can be independently set to one of 18 different PWM
-frequencies.
-<br><br>The selectable frequencies depend upon the sample rate which
-may be 1, 2, 4, 5, 8, or 10 microseconds (default 5). The
-sample rate is set when the pigpio daemon is started.
-<br><br>The frequencies for each sample rate are:
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hertz<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1:&nbsp;40000&nbsp;20000&nbsp;10000&nbsp;8000&nbsp;5000&nbsp;4000&nbsp;2500&nbsp;2000&nbsp;1600<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1250&nbsp;&nbsp;1000&nbsp;&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;50<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2:&nbsp;20000&nbsp;10000&nbsp;&nbsp;5000&nbsp;4000&nbsp;2500&nbsp;2000&nbsp;1250&nbsp;1000&nbsp;&nbsp;800<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;625&nbsp;&nbsp;&nbsp;500&nbsp;&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;125&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;25<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4:&nbsp;10000&nbsp;&nbsp;5000&nbsp;&nbsp;2500&nbsp;2000&nbsp;1250&nbsp;1000&nbsp;&nbsp;625&nbsp;&nbsp;500&nbsp;&nbsp;400<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;313&nbsp;&nbsp;&nbsp;250&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;125&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;63&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;13<br>sample<br>&nbsp;rate<br>&nbsp;(us)&nbsp;&nbsp;5:&nbsp;&nbsp;8000&nbsp;&nbsp;4000&nbsp;&nbsp;2000&nbsp;1600&nbsp;1000&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;320<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;250&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;&nbsp;160&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;80&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;&nbsp;20&nbsp;&nbsp;&nbsp;10<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8:&nbsp;&nbsp;5000&nbsp;&nbsp;2500&nbsp;&nbsp;1250&nbsp;1000&nbsp;&nbsp;625&nbsp;&nbsp;500&nbsp;&nbsp;313&nbsp;&nbsp;250&nbsp;&nbsp;200<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;156&nbsp;&nbsp;&nbsp;125&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;63&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;31&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;13&nbsp;&nbsp;&nbsp;&nbsp;6<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10:&nbsp;&nbsp;4000&nbsp;&nbsp;2000&nbsp;&nbsp;1000&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;160<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;125&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;&nbsp;80&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;20&nbsp;&nbsp;&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;5<br></code><br><br><b><small>Example</small></b><br><br><code>pigs&nbsp;pfs&nbsp;4&nbsp;0&nbsp;#&nbsp;0&nbsp;selects&nbsp;the&nbsp;lowest&nbsp;frequency.<br>10<br><br>$&nbsp;pigs&nbsp;pfs&nbsp;4&nbsp;1000&nbsp;#&nbsp;Set&nbsp;1000Hz&nbsp;PWM.<br>1000<br><br>$&nbsp;pigs&nbsp;pfs&nbsp;4&nbsp;100000&nbsp;#&nbsp;Very&nbsp;big&nbsp;number&nbsp;selects&nbsp;the&nbsp;highest&nbsp;frequency.<br>8000<br></code><h3><a name="PIGPV">PIGPV</a>
- - Get pigpio library version</h3>This command returns the pigpio library version.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;pigpv<br>17<br></code><h3><a name="PRG">PRG</a>
- <a href="#u">u</a> - Get GPIO PWM range</h3>This command returns the dutycycle range for GPIO <a href="#u">u</a>.
-<br><br>Upon success the range is returned. On error a negative status code
-will be returned.
-<br><br>If a hardware clock or hardware PWM is active on the GPIO the reported
-range will be 1000000 (1M).
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;prg&nbsp;4<br>255<br></code><h3><a name="PROC">PROC</a>
- <a href="#t">t</a> - Store script</h3>This command stores a script <a href="#t">t</a> for later execution.
-<br><br>If the script is valid a script id (&gt;=0) is returned which is passed
-to the other script commands. On error a negative status code
-will be returned.
-<br><br>See <a href="#Scripts">Scripts</a>.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;proc&nbsp;tag&nbsp;123&nbsp;w&nbsp;4&nbsp;0&nbsp;mils&nbsp;200&nbsp;w&nbsp;4&nbsp;1&nbsp;mils&nbsp;300&nbsp;dcr&nbsp;p0&nbsp;jp&nbsp;123<br>0<br><br>$&nbsp;pigs&nbsp;proc&nbsp;tag&nbsp;123&nbsp;w&nbsp;4&nbsp;0&nbsp;mils&nbsp;5&nbsp;w&nbsp;4&nbsp;1&nbsp;mils&nbsp;5&nbsp;jmp&nbsp;12<br>ERROR:&nbsp;script&nbsp;has&nbsp;unresolved&nbsp;tag<br>-63<br></code><h3><a name="PROCD">PROCD</a>
- <a href="#sid">sid</a> - Delete script</h3>This command deletes script <a href="#sid">sid</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>See <a href="#Scripts">Scripts</a>.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;procd&nbsp;1<br><br>$&nbsp;pigs&nbsp;procd&nbsp;1<br>ERROR:&nbsp;unknown&nbsp;script&nbsp;id<br>-48<br></code><h3><a name="PROCP">PROCP</a>
- <a href="#sid">sid</a> - Get script status and parameters</h3>This command returns the status of script <a href="#sid">sid</a> as well as the
-current value of its 10 parameters.
-<br><br>Upon success the script status and parameters are returned.
-On error a negative status code will be returned.
-<br><br>The script status may be one of
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>0</td><td>being initialised</td></tr><tr><td>1</td><td>halted</td></tr><tr><td>2</td><td>running</td></tr><tr><td>3</td><td>waiting</td></tr><tr><td>4</td><td>failed</td></tr></tbody></table><br><br>See <a href="#Scripts">Scripts</a>.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;procp&nbsp;0<br>1&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br></code><h3><a name="PROCR">PROCR</a>
- <a href="#sid">sid</a> <a href="#pars">pars</a> - Run script</h3>This command runs stored script <a href="#sid">sid</a> passing it up to 10 optional
-parameters.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>See <a href="#Scripts">Scripts</a>.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;proc&nbsp;tag&nbsp;123&nbsp;w&nbsp;4&nbsp;0&nbsp;mils&nbsp;200&nbsp;w&nbsp;4&nbsp;1&nbsp;mils&nbsp;300&nbsp;dcr&nbsp;p0&nbsp;jp&nbsp;123<br>0<br><br>$&nbsp;pigs&nbsp;procr&nbsp;0&nbsp;50&nbsp;#&nbsp;Run&nbsp;script&nbsp;0&nbsp;with&nbsp;parameter&nbsp;0&nbsp;of&nbsp;50.<br><br>$&nbsp;pigs&nbsp;procp&nbsp;0<br>2&nbsp;44&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br>$&nbsp;pigs&nbsp;procp&nbsp;0<br>2&nbsp;37&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br>$&nbsp;pigs&nbsp;procp&nbsp;0<br>2&nbsp;10&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br>$&nbsp;pigs&nbsp;procp&nbsp;0<br>2&nbsp;5&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br>$&nbsp;pigs&nbsp;procp&nbsp;0<br>2&nbsp;2&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br>$&nbsp;pigs&nbsp;procp&nbsp;0<br>1&nbsp;-1&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br></code><h3><a name="PROCS">PROCS</a>
- <a href="#sid">sid</a> - Stop script</h3>This command stops a running script <a href="#sid">sid</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>See <a href="#Scripts">Scripts</a>.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;procs&nbsp;0<br><br>$&nbsp;pigs&nbsp;procs&nbsp;1<br>-48<br>ERROR:&nbsp;unknown&nbsp;script&nbsp;id<br></code><h3><a name="PROCU">PROCU</a>
- <a href="#sid">sid</a> <a href="#pars">pars</a> - Set script parameters</h3>This command sets the parameters of a stored script <a href="#sid">sid</a> passing
-it up to 10 parameters.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>See <a href="#Scripts">Scripts</a>.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;proc&nbsp;tag&nbsp;0&nbsp;hp&nbsp;18&nbsp;p0&nbsp;p1&nbsp;mils&nbsp;1000&nbsp;jmp&nbsp;0<br>0<br>$&nbsp;pigs&nbsp;procu&nbsp;0&nbsp;50&nbsp;500000<br>$&nbsp;pigs&nbsp;procr&nbsp;0<br>$&nbsp;pigs&nbsp;procu&nbsp;0&nbsp;100<br>$&nbsp;pigs&nbsp;procu&nbsp;0&nbsp;200<br>$&nbsp;pigs&nbsp;procu&nbsp;0&nbsp;200&nbsp;100000<br></code><h3><a name="PRRG">PRRG</a>
- <a href="#u">u</a> - Get GPIO PWM real range</h3>This command returns the real underlying range used by GPIO <a href="#u">u</a>.
-<br><br>If a hardware clock is active on the GPIO the reported
-real range will be 1000000 (1M).
-<br><br>If hardware PWM is active on the GPIO the reported real range
-will be approximately 250M divided by the set PWM frequency.
-<br><br>On error a negative status code will be returned.
-<br><br>See <a href="#PRS">PRS</a>.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;prrg&nbsp;17<br>250<br><br>$&nbsp;pigs&nbsp;pfs&nbsp;17&nbsp;0<br>10<br>$&nbsp;pigs&nbsp;prrg&nbsp;17<br>20000<br><br>$&nbsp;pigs&nbsp;pfs&nbsp;17&nbsp;100000<br>8000<br>$&nbsp;pigs&nbsp;prrg&nbsp;17<br>25<br></code><h3><a name="PRS">PRS</a>
- <a href="#u">u</a> <a href="#v">v</a> - Set GPIO PWM range</h3>This command sets the dutycycle range <a href="#v">v</a> to be used for GPIO <a href="#u">u</a>.
-Subsequent uses of command <a href="#P/PWM">P/PWM</a> will use a dutycycle between 0 (off)
-and <a href="#v">v</a> (fully on).
-<br><br>Upon success the real underlying range used by the GPIO is returned.
-On error a negative status code will be returned.
-<br><br>If PWM is currently active on the GPIO its dutycycle will be scaled to
-reflect the new range.
-<br><br>The real range, the number of steps between fully off and fully on
-for each frequency, is given in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>#1</td><td>#2</td><td>#3</td><td>#4</td><td>#5</td><td>#6</td><td>#7</td><td>#8</td><td>#9</td></tr><tr><td>25</td><td>50</td><td>100</td><td>125</td><td>200</td><td>250</td><td>400</td><td>500</td><td>625</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>#10</td><td>#11</td><td>#12</td><td>#13</td><td>#14</td><td>#15</td><td>#16</td><td>#17</td><td>#18</td></tr><tr><td>800</td><td>1000</td><td>1250</td><td>2000</td><td>2500</td><td>4000</td><td>5000</td><td>10000</td><td>20000</td></tr></tbody></table><br><br>The real value set by <a href="#PRS">PRS</a> is (dutycycle * real range) / range.
-<br><br>See <a href="#PRRG">PRRG</a>
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;prs&nbsp;18&nbsp;1000<br>250<br></code><h3><a name="PUD">PUD</a>
- <a href="#g">g</a> <a href="#p">p</a> - Set GPIO pull up/down</h3>This command sets the internal pull/up down for GPIO <a href="#g">g</a> to mode <a href="#p">p</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>The mode may be pull-down (D), pull-up (U), or off (O).
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;pud&nbsp;4&nbsp;d&nbsp;#&nbsp;Set&nbsp;pull-down&nbsp;on&nbsp;GPIO&nbsp;4.<br>$&nbsp;pigs&nbsp;pud&nbsp;4&nbsp;u&nbsp;#&nbsp;Set&nbsp;pull-up&nbsp;on&nbsp;GPIO&nbsp;4.<br>$&nbsp;pigs&nbsp;pud&nbsp;4&nbsp;o&nbsp;#&nbsp;No&nbsp;pull-up/down&nbsp;on&nbsp;GPIO&nbsp;4.<br></code><h3><a name="R/READ">R/READ</a>
- <a href="#g">g</a> - Read GPIO level</h3>This reads the current level of GPIO <a href="#g">g</a>.
-<br><br>Upon success the current level is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;r&nbsp;17&nbsp;#&nbsp;Get&nbsp;level&nbsp;of&nbsp;GPIO&nbsp;17.<br>0<br><br>$&nbsp;pigs&nbsp;r&nbsp;4&nbsp;#&nbsp;Get&nbsp;level&nbsp;of&nbsp;GPIO&nbsp;4.<br>1<br></code><h3><a name="S/SERVO">S/SERVO</a>
- <a href="#u">u</a> <a href="#v">v</a> - Set GPIO servo pulsewidth</h3>This command starts servo pulses of <a href="#v">v</a> microseconds on GPIO <a href="#u">u</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>The servo pulsewidth may be 0 (off), 500 (most anti-clockwise)
-to 2500 (most clockwise).
-<br><br>The range supported by servos varies and should probably be determined
-by experiment. Generally values between 1000-2000 should be safe.
-A value of 1500 should always be safe and represents
-the mid-point of rotation.
-<br><br>You can DAMAGE a servo if you command it to move beyond its limits.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;SERVO&nbsp;17&nbsp;1500<br></code><br><br>This example causes an on pulse of 1500 microseconds duration to be
-transmitted on GPIO 17 at a rate of 50 times per second.
-<br><br>This will command a servo connected to GPIO 17 to rotate to its mid-point.
-<br><br><b><small>Example</small></b><br><br><code>pigs&nbsp;s&nbsp;17&nbsp;0&nbsp;#&nbsp;Switch&nbsp;servo&nbsp;pulses&nbsp;off.<br></code><h3><a name="SERC">SERC</a>
- <a href="#h">h</a> - Close serial handle</h3>This command closes a serial handle <a href="#h">h</a> previously opened with <a href="#SERO">SERO</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;serc&nbsp;0&nbsp;#&nbsp;First&nbsp;close&nbsp;okay.<br><br>$&nbsp;pigs&nbsp;serc&nbsp;0&nbsp;#&nbsp;Second&nbsp;close&nbsp;gives&nbsp;error.<br>-25<br>ERROR:&nbsp;unknown&nbsp;handle<br></code><h3><a name="SERDA">SERDA</a>
- <a href="#h">h</a> - Check for serial data ready to read</h3>This command returns the number of bytes of data available
-to be read from the serial device associated with handle <a href="#h">h</a>.
-<br><br>Upon success the count of bytes available to be read is
-returned (which may be 0). On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;serda&nbsp;0<br>0<br></code><h3><a name="SERO">SERO</a>
- <a href="#dev">dev</a> <a href="#b">b</a> <a href="#sef">sef</a> - Open serial device dev at baud b with flags</h3>This command opens the serial <a href="#dev">dev</a> at <a href="#b">b</a> bits per second.
-<br><br>No flags are currently defined. <a href="#sef">sef</a> should be set to zero.
-<br><br>Upon success a handle (&gt;=0) is returned. On error a negative status code
-will be returned.
-<br><br>The device name must start with /dev/tty or /dev/serial.
-<br><br>The baud rate must be one of 50, 75, 110, 134, 150,
-200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
-38400, 57600, 115200, or 230400.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;sero&nbsp;/dev/ttyAMA0&nbsp;9600&nbsp;0<br>0<br><br>$&nbsp;pigs&nbsp;sero&nbsp;/dev/tty1&nbsp;38400&nbsp;0<br>1<br></code><h3><a name="SERR">SERR</a>
- <a href="#h">h</a> <a href="#num">num</a> - Read bytes from serial handle</h3>This command returns up to <a href="#num">num</a> bytes of data read from the
-serial device associated with handle <a href="#h">h</a>.
-<br><br>Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;serr&nbsp;0&nbsp;10<br>5&nbsp;48&nbsp;49&nbsp;128&nbsp;144&nbsp;255<br><br>$&nbsp;pigs&nbsp;serr&nbsp;0&nbsp;10<br>0<br></code><h3><a name="SERRB">SERRB</a>
- - Read byte from serial handle</h3>This command returns a byte of data read from the serial
-device associated with handle <a href="#h">h</a>.
-<br><br>Upon success a number between 0 and 255 is returned.
-On error a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;serrb&nbsp;0<br>23<br>$&nbsp;pigs&nbsp;serrb&nbsp;0<br>45<br></code><h3><a name="SERW">SERW</a>
- <a href="#h">h</a> <a href="#bvs">bvs</a> - Write bytes to serial handle</h3>This command writes bytes <a href="#bvs">bvs</a> to the serial device
-associated with handle <a href="#h">h</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;serw&nbsp;0&nbsp;23&nbsp;45&nbsp;67&nbsp;89<br></code><h3><a name="SERWB">SERWB</a>
- <a href="#h">h</a> <a href="#bv">bv</a> - Write byte to serial handle</h3>This command writes a single byte <a href="#bv">bv</a> to the serial device
-associated with handle <a href="#h">h</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;serwb&nbsp;0&nbsp;23<br>$&nbsp;pigs&nbsp;serwb&nbsp;0&nbsp;0xf0<br></code><h3><a name="SHELL">SHELL</a>
- <a href="#name">name</a> <a href="#str">str</a> - Execute a shell command</h3>This command uses the system call to execute a shell script <a href="#name">name</a>
-with the given string <a href="#str">str</a> as its parameter.
-<br><br>The exit status of the system call is returned if OK, otherwise
-PI_BAD_SHELL_STATUS.
-<br><br><a href="#name">name</a> must exist in /opt/pigpio/cgi and must be executable.
-<br><br>The returned exit status is normally 256 times that set
-by the shell script exit function. If the script can't
-be found 32512 will be returned.
-<br><br>The following table gives some example returned statuses.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Script exit status</td><td>Returned system call status</td></tr><tr><td>1</td><td>256</td></tr><tr><td>5</td><td>1280</td></tr><tr><td>10</td><td>2560</td></tr><tr><td>200</td><td>51200</td></tr><tr><td>script not found</td><td>32512</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>#&nbsp;pass&nbsp;two&nbsp;parameters,&nbsp;hello&nbsp;and&nbsp;world<br>$&nbsp;pigs&nbsp;shell&nbsp;scr1&nbsp;hello&nbsp;world<br>256<br><br>#&nbsp;pass&nbsp;three&nbsp;parameters,&nbsp;hello,&nbsp;string&nbsp;with&nbsp;spaces,&nbsp;and&nbsp;world<br>$&nbsp;pigs&nbsp;shell&nbsp;scr1&nbsp;"hello&nbsp;'string&nbsp;with&nbsp;spaces'&nbsp;world"<br>256<br><br>#&nbsp;pass&nbsp;one&nbsp;parameter,&nbsp;hello&nbsp;string&nbsp;with&nbsp;spaces&nbsp;world<br>$&nbsp;pigs&nbsp;shell&nbsp;scr1&nbsp;"\"hello&nbsp;string&nbsp;with&nbsp;spaces&nbsp;world\""<br>256<br><br>#&nbsp;non-existent&nbsp;script<br>$&nbsp;pigs&nbsp;shell&nbsp;scr78&nbsp;par1<br>32512<br></code><h3><a name="SLR">SLR</a>
- <a href="#u">u</a> <a href="#num">num</a> - Read bit bang serial data from GPIO</h3>This command returns up to <a href="#num">num</a> bytes of bit bang serial data
-read from GPIO <a href="#u">u</a>.
-<br><br>Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-<br><br>The GPIO <a href="#u">u</a> should have been initialised with the <a href="#SLRO">SLRO</a> command.
-<br><br>The bytes returned for each character depend upon the number of
-data bits <a href="#db">db</a> specified in the <a href="#SLRO">SLRO</a> command.
-<br><br>For <a href="#db">db</a> 1-8 there will be one byte per character.<br>
-For <a href="#db">db</a> 9-16 there will be two bytes per character.<br>
-For <a href="#db">db</a> 17-32 there will be four bytes per character.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;slr&nbsp;15&nbsp;20<br>6&nbsp;1&nbsp;0&nbsp;23&nbsp;45&nbsp;89&nbsp;0<br></code><h3><a name="SLRC">SLRC</a>
- <a href="#u">u</a> - Close GPIO for bit bang serial data</h3>This command closes GPIO <a href="#u">u</a> for reading bit bang serial data.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;slrc&nbsp;23<br><br>$&nbsp;pigs&nbsp;slrc&nbsp;23<br>-38<br>ERROR:&nbsp;no&nbsp;serial&nbsp;read&nbsp;in&nbsp;progress&nbsp;on&nbsp;GPIO<br></code><h3><a name="SLRI">SLRI</a>
- <a href="#u">u</a> <a href="#v">v</a> - Sets bit bang serial data logic levels</h3>This command sets the logic level for reading bit bang serial data
-on GPIO <a href="#u">u</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>The invert parameter <a href="#v">v</a> is 1 for inverted signal, 0 for normal.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;slri&nbsp;17&nbsp;1&nbsp;#&nbsp;invert&nbsp;logic&nbsp;on&nbsp;GPIO&nbsp;17<br><br>$&nbsp;pigs&nbsp;slri&nbsp;23&nbsp;0&nbsp;#&nbsp;use&nbsp;normal&nbsp;logic&nbsp;on&nbsp;GPIO&nbsp;23<br></code><h3><a name="SLRO">SLRO</a>
- <a href="#u">u</a> <a href="#b">b</a> <a href="#db">db</a> - Open GPIO for bit bang serial data</h3>This command opens GPIO <a href="#u">u</a> for reading bit bang serial data
-at <a href="#b">b</a> baud and <a href="#db">db</a> data bits.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>The baud rate may be between 50 and 250000 bits per second.
-<br><br>The received data is held in a cyclic buffer.
-<br><br>It is the user's responsibility to read the data (with <a href="#SLR">SLR</a>)
-in a timely fashion.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;slro&nbsp;23&nbsp;19200&nbsp;8<br><br>$&nbsp;pigs&nbsp;slro&nbsp;23&nbsp;19200&nbsp;8<br>-50<br>ERROR:&nbsp;GPIO&nbsp;already&nbsp;in&nbsp;use<br></code><h3><a name="SPIC">SPIC</a>
- <a href="#h">h</a> - SPI close handle</h3>This command closes the SPI handle <a href="#h">h</a> returned by a prior
-call to <a href="#SPIO">SPIO</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;spic&nbsp;1<br><br>$&nbsp;pigs&nbsp;spic&nbsp;1<br>-25<br>ERROR:&nbsp;unknown&nbsp;handle<br></code><h3><a name="SPIO">SPIO</a>
- <a href="#c">c</a> <a href="#b">b</a> <a href="#spf">spf</a> - SPI open channel at baud b with flags</h3>This command returns a handle to a SPI device on channel <a href="#c">c</a>.
-<br><br>Data will be transferred at <a href="#b">b</a> bits per second. The flags <a href="#spf">spf</a>
-may be used to modify the default behaviour of 4-wire operation,
-mode 0, active low chip select.
-<br><br>Speeds between 32kbps and 125Mbps are allowed. Speeds above 30Mbps
-are unlikely to work.
-<br><br>The Pi has two SPI peripherals: main and auxiliary.
-<br><br>The main SPI has two chip selects (channels), the auxiliary has
-three.
-<br><br>The auxiliary SPI is available on all models but the A and B.
-<br><br>The GPIO used are given in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>MISO</td><td>MOSI</td><td>SCLK</td><td>CE0</td><td>CE1</td><td>CE2</td></tr><tr><td>Main SPI</td><td>9</td><td>10</td><td>11</td><td>8</td><td>7</td><td>-</td></tr><tr><td>Aux SPI</td><td>19</td><td>20</td><td>21</td><td>18</td><td>17</td><td>16</td></tr></tbody></table><br><br>The flags consists of the least significant 22 bits.
-<br><br><code>21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;W&nbsp;&nbsp;A&nbsp;u2&nbsp;u1&nbsp;u0&nbsp;p2&nbsp;p1&nbsp;p0&nbsp;&nbsp;m&nbsp;&nbsp;m<br></code><br><br>mm defines the SPI mode.
-<br><br>Warning: modes 1 and 3 do not appear to work on the auxiliary SPI.
-<br><br><code>Mode&nbsp;POL&nbsp;PHA<br>&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;0<br>&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;1<br>&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;0<br>&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;1<br></code><br><br>px is 0 if CEx is active low (default) and 1 for active high.
-<br><br>ux is 0 if the CEx GPIO is reserved for SPI (default) and 1 otherwise.
-<br><br>A is 0 for the main SPI, 1 for the auxiliary SPI.
-<br><br>W is 0 if the device is not 3-wire, 1 if the device is 3-wire. Main
-SPI only.
-<br><br>nnnn defines the number of bytes (0-15) to write before switching
-the MOSI line to MISO to read data. This field is ignored
-if W is not set. Main SPI only.
-<br><br>T is 1 if the least significant bit is transmitted on MOSI first, the
-default (0) shifts the most significant bit out first. Auxiliary SPI
-only.
-<br><br>R is 1 if the least significant bit is received on MISO first, the
-default (0) receives the most significant bit first. Auxiliary SPI
-only.
-<br><br>bbbbbb defines the word size in bits (0-32). The default (0)
-sets 8 bits per word. Auxiliary SPI only.
-<br><br>The <a href="#SPIR">SPIR</a>, <a href="#SPIW">SPIW</a>, and <a href="#SPIX">SPIX</a> commands transfer data
-packed into 1, 2, or 4 bytes according to the word size in bits.
-<br><br>For bits 1-8 there will be one byte per character.<br>
-For bits 9-16 there will be two bytes per character.<br>
-For bits 17-32 there will be four bytes per character.
-<br><br>Multi-byte transfers are made in least significant byte first order.
-<br><br>E.g. to transfer 32 11-bit words 64 bytes need to be sent.
-<br><br>E.g. to transfer the 14 bit value 0x1ABC send the bytes 0xBC followed
-by 0x1A.
-<br><br>The other bits in flags should be set to zero.
-<br><br>Upon success a handle (&gt;=0) is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;spio&nbsp;0&nbsp;100000&nbsp;3&nbsp;#&nbsp;Open&nbsp;channel&nbsp;0&nbsp;at&nbsp;100kbps&nbsp;in&nbsp;mode&nbsp;3.<br>0<br><br>$&nbsp;pigs&nbsp;spio&nbsp;0&nbsp;32000&nbsp;256&nbsp;#&nbsp;Open&nbsp;channel&nbsp;0&nbsp;of&nbsp;auxiliary&nbsp;spi&nbsp;at&nbsp;32kbps.<br>1<br></code><h3><a name="SPIR">SPIR</a>
- <a href="#h">h</a> <a href="#num">num</a> - SPI read bytes from handle</h3>This command returns <a href="#num">num</a> bytes read from the SPI device
-associated with handle <a href="#h">h</a>.
-<br><br>Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;spir&nbsp;0&nbsp;10&nbsp;#&nbsp;Read&nbsp;10&nbsp;bytes&nbsp;from&nbsp;the&nbsp;SPI&nbsp;device.<br>10&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br></code><h3><a name="SPIW">SPIW</a>
- <a href="#h">h</a> <a href="#bvs">bvs</a> - SPI write bytes to handle</h3>This command writes bytes <a href="#bvs">bvs</a> to the SPI device
-associated with handle <a href="#h">h</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;spiw&nbsp;0&nbsp;0x22&nbsp;0x33&nbsp;0xcc&nbsp;0xff<br></code><h3><a name="SPIX">SPIX</a>
- <a href="#h">h</a> <a href="#bvs">bvs</a> - SPI transfer bytes to handle</h3>This command writes bytes <a href="#bvs">bvs</a> to the SPI device
-associated with handle <a href="#h">h</a>. It returns the same
-number of bytes read from the device.
-<br><br>Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;spix&nbsp;0&nbsp;0x22&nbsp;0x33&nbsp;0xcc&nbsp;0xff<br>4&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br></code><h3><a name="T/TICK">T/TICK</a>
- - Get current tick</h3>This command returns the current system tick.
-<br><br>Tick is the number of microseconds since system boot.
-<br><br>As tick is an unsigned 32 bit quantity it wraps around after 2^32 microseconds,
-which is approximately 1 hour 12 minutes.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;t&nbsp;mils&nbsp;1000&nbsp;t<br>3691823946<br>3692833987<br></code><h3><a name="TRIG">TRIG</a>
- <a href="#u">u</a> <a href="#pl">pl</a> <a href="#L">L</a> - Send a trigger pulse</h3>This command sends a trigger pulse of <a href="#pl">pl</a> microseconds at level <a href="#L">L</a>
-to GPIO <a href="#u">u</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>The GPIO is set to not level at the end of the pulse.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;trig&nbsp;4&nbsp;10&nbsp;1<br><br>$&nbsp;pigs&nbsp;trig&nbsp;4&nbsp;51&nbsp;1<br>-46<br>ERROR:&nbsp;trigger&nbsp;pulse&nbsp;&gt;&nbsp;50&nbsp;microseconds<br></code><h3><a name="W/WRITE">W/WRITE</a>
- <a href="#g">g</a> <a href="#L">L</a> - Write GPIO level</h3>This command sets GPIO <a href="#g">g</a> to level <a href="#L">L</a>. The level may be 0
-(low, off, clear) or 1 (high, on, set).
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;w&nbsp;23&nbsp;0<br>$&nbsp;pigs&nbsp;w&nbsp;23&nbsp;1<br><br>$&nbsp;pigs&nbsp;w&nbsp;23&nbsp;2<br>-5<br>ERROR:&nbsp;level&nbsp;not&nbsp;0-1<br></code><h3><a name="WDOG">WDOG</a>
- <a href="#u">u</a> <a href="#v">v</a> - Set GPIO watchdog</h3>This command sets a watchdog of <a href="#v">v</a> milliseconds on GPIO <a href="#u">u</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>The watchdog is nominally in milliseconds.
-<br><br>One watchdog may be registered per GPIO.
-<br><br>The watchdog may be cancelled by setting timeout to 0.
-<br><br>Once a watchdog has been started monitors of the GPIO
-will be triggered every timeout interval after the last
-GPIO activity. The watchdog expiry will be indicated by
-a special TIMEOUT value.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wdog&nbsp;23&nbsp;90000<br>-15<br>ERROR:&nbsp;timeout&nbsp;not&nbsp;0-60000<br><br>$&nbsp;pigs&nbsp;wdog&nbsp;23&nbsp;9000<br></code><br><br>This example causes a report to be written to any notification pipes
-listening on GPIO 23 whenever GPIO 23 changes state or approximately
-every 9000 ms.
-<h3><a name="WVAG">WVAG</a>
- <a href="#trips">trips</a> - Add generic pulses to waveform</h3>This command adds 1 one or more triplets <a href="#trips">trips</a> of GPIO on, GPIO off,
-delay to the existing waveform (if any).
-<br><br>Upon success the total number of pulses in the waveform so far is
-returned. On error a negative status code will be returned.
-<br><br>The triplets will be added at the start of the existing waveform. If
-they are to start offset from the start then the first triplet should
-consist solely of a delay i.e. 0 0 offset.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvag&nbsp;0x10&nbsp;0x80&nbsp;1000&nbsp;0x80&nbsp;0x10&nbsp;9000<br>2<br><br>$&nbsp;pigs&nbsp;wvag&nbsp;0&nbsp;0&nbsp;10000&nbsp;0x10&nbsp;0x80&nbsp;1000&nbsp;0x80&nbsp;0x10&nbsp;9000<br>4<br></code><h3><a name="WVAS">WVAS</a>
- <a href="#u">u</a> <a href="#b">b</a> <a href="#db">db</a> <a href="#sb">sb</a> <a href="#o">o</a> <a href="#bvs">bvs</a> - Add serial data to waveform</h3>This command adds a waveform representing serial data <a href="#bvs">bvs</a> to
-GPIO <a href="#u">u</a> at <a href="#b">b</a> baud to the existing waveform (if any).
-The serial data starts <a href="#o">o</a> microseconds from the start of the
-waveform.
-<br><br>Upon success the total number of pulses in the waveform so far is
-returned. On error a negative status code will be returned.
-<br><br>The serial data is formatted as one start bit, <a href="#db">db</a> data bits, and
-<a href="#sb">sb</a>/2 stop bits.
-<br><br>The baud rate may be between 50 and 1000000 bits per second.
-<br><br>It is legal to add serial data streams with different baud rates to
-the same waveform.
-<br><br>The bytes required for each character depend upon <a href="#db">db</a>.
-<br><br>For <a href="#db">db</a> 1-8 there will be one byte per character.<br>
-For <a href="#db">db</a> 9-16 there will be two bytes per character.<br>
-For <a href="#db">db</a> 17-32 there will be four bytes per character.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvas&nbsp;4&nbsp;9600&nbsp;8&nbsp;2&nbsp;0&nbsp;0x30&nbsp;0x31&nbsp;0x32&nbsp;0x33<br>23<br><br>$&nbsp;pigs&nbsp;wvas&nbsp;7&nbsp;38400&nbsp;8&nbsp;2&nbsp;0&nbsp;0x41&nbsp;0x42<br>35<br></code><h3><a name="WVTAT">WVTAT</a>
- - Returns the current transmitting waveform</h3>This command returns the id of the waveform currently
-being transmitted.
-<br><br>Returns the waveform id or one of the following special
-values:
-<br><br>9998 - transmitted wave not found<br>
-9999 - no wave being transmitted
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvtat<br>9999<br></code><h3><a name="WVBSY">WVBSY</a>
- - Check if waveform is being transmitted</h3>This command checks to see if a waveform is currently being transmitted.
-<br><br>Returns 1 if a waveform is currently being transmitted, otherwise 0.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvbsy<br>0<br></code><h3><a name="WVCHA">WVCHA</a>
- <a href="#bvs">bvs</a> - Transmits a chain of waveforms</h3>This command transmits a chain of waveforms.
-<br><br>NOTE: Any hardware PWM started by <a href="#HP">HP</a> will
-be cancelled.
-<br><br>The waves to be transmitted are specified by the contents of
-<a href="#bvs">bvs</a> which contains an ordered list of wave_ids and optional
-command codes and related data.
-<br><br>Upon success 0 is returned. On error a negative status code
-will be returned.
-<br><br>Each wave is transmitted in the order specified. A wave may
-occur multiple times per chain.
-<br><br>A blocks of waves may be transmitted multiple times by using
-the loop commands. The block is bracketed by loop start and
-end commands. Loops may be nested.
-<br><br>Delays between waves may be added with the delay command.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>Loop Start</td><td>255 0</td><td>Identify start of a wave block</td></tr><tr><td>Loop Repeat</td><td>255 1 x y</td><td>loop x + y*256 times</td></tr><tr><td>Delay</td><td>255 2 x y</td><td>delay x + y*256 microseconds</td></tr><tr><td>Loop Forever</td><td>255 3</td><td>loop forever</td></tr></tbody></table><br><br>If present Loop Forever must be the last entry in the chain.
-<br><br>The code is currently dimensioned to support a chain with roughly
-600 entries and 20 loop counters.
-<br><br><b><small>Example</small></b><br><br><code>#!/bin/bash<br><br>GPIO=4<br>WAVES=5<br><br>pigs&nbsp;m&nbsp;$GPIO&nbsp;w<br><br>for&nbsp;((i=0;&nbsp;i&lt;$WAVES;&nbsp;i++))<br>do<br>&nbsp;&nbsp;&nbsp;pigs&nbsp;wvag&nbsp;$((1&lt;&lt;GPIO))&nbsp;0&nbsp;20&nbsp;0&nbsp;$((1&lt;&lt;GPIO))&nbsp;$(((i+1)*200))<br>&nbsp;&nbsp;&nbsp;w[i]=$(pigs&nbsp;wvcre)<br>done<br><br>#&nbsp;transmit&nbsp;waves&nbsp;4+3+2<br>#&nbsp;loop&nbsp;start<br>#&nbsp;&nbsp;&nbsp;&nbsp;transmit&nbsp;waves&nbsp;0+0+0<br>#&nbsp;&nbsp;&nbsp;&nbsp;loop&nbsp;start<br>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;transmit&nbsp;waves&nbsp;0+1<br>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;delay&nbsp;5000us<br>#&nbsp;&nbsp;&nbsp;&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;30&nbsp;times)<br>#&nbsp;&nbsp;&nbsp;&nbsp;loop&nbsp;start<br>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;transmit&nbsp;waves&nbsp;2+3+0<br>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;transmit&nbsp;waves&nbsp;3+1+2<br>#&nbsp;&nbsp;&nbsp;&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;10&nbsp;times)<br>#&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;5&nbsp;times)<br>#&nbsp;transmit&nbsp;waves&nbsp;4+4+4<br>#&nbsp;delay&nbsp;20000us<br>#&nbsp;transmit&nbsp;waves&nbsp;0+0+0<br><br>pigs&nbsp;wvcha&nbsp;\<br>&nbsp;&nbsp;&nbsp;${w[4]}&nbsp;${w[3]}&nbsp;${w[2]}&nbsp;\<br>&nbsp;&nbsp;&nbsp;255&nbsp;0&nbsp;\<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${w[0]}&nbsp;${w[0]}&nbsp;${w[0]}&nbsp;\<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255&nbsp;0&nbsp;\<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${w[0]}&nbsp;${w[1]}&nbsp;\<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255&nbsp;2&nbsp;0x88&nbsp;0x13&nbsp;\<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255&nbsp;1&nbsp;30&nbsp;0&nbsp;\<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255&nbsp;0&nbsp;\<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${w[2]}&nbsp;${w[3]}&nbsp;${w[0]}&nbsp;\<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${w[3]}&nbsp;${w[1]}&nbsp;${w[2]}&nbsp;\<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255&nbsp;1&nbsp;10&nbsp;0&nbsp;\<br>&nbsp;&nbsp;&nbsp;255&nbsp;1&nbsp;5&nbsp;0&nbsp;\<br>&nbsp;&nbsp;&nbsp;${w[4]}&nbsp;${w[4]}&nbsp;${w[4]}&nbsp;\<br>&nbsp;&nbsp;&nbsp;255&nbsp;2&nbsp;0x20&nbsp;0x4E&nbsp;\<br>&nbsp;&nbsp;&nbsp;${w[0]}&nbsp;${w[0]}&nbsp;${w[0]}<br><br>while&nbsp;[[&nbsp;$(pigs&nbsp;wvbsy)&nbsp;-eq&nbsp;1&nbsp;]];&nbsp;do&nbsp;sleep&nbsp;0.1;&nbsp;done<br><br>for&nbsp;((i=0;&nbsp;i&lt;$WAVES;&nbsp;i++));&nbsp;do&nbsp;echo&nbsp;${w[i]};&nbsp;pigs&nbsp;wvdel&nbsp;${w[i]};&nbsp;done<br></code><h3><a name="WVCLR">WVCLR</a>
- - Clear all waveforms</h3>This command clears all waveforms.
-<br><br>Nothing is returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvclr<br></code><h3><a name="WVCRE">WVCRE</a>
- - Create a waveform</h3>This command creates a waveform from the data provided by the prior
-calls to the <a href="#WVAG">WVAG</a> and <a href="#WVAS">WVAS</a> commands.
-<br><br>Upon success a wave id (&gt;=0) is returned. On error a negative status
-code will be returned.
-<br><br>The data provided by the <a href="#WVAG">WVAG</a> and <a href="#WVAS">WVAS</a> commands is
-consumed by this command.
-<br><br>As many waveforms may be created as there is space available.
-The wave id is passed to <a href="#WVTX">WVTX</a> or <a href="#WVTXR">WVTXR</a> to specify the
-waveform to transmit.
-<br><br>Normal usage would be
-<br><br>Step 1. <a href="#WVCLR">WVCLR</a> to clear all waveforms and added data.
-<br><br>Step 2. <a href="#WVAG">WVAG</a>/<a href="#WVAS">WVAS</a> calls to supply the waveform data.
-<br><br>Step 3. <a href="#WVCRE">WVCRE</a> to create the waveform and get a unique id.
-<br><br>Repeat steps 2 and 3 as needed.
-<br><br>Step 4. <a href="#WVTX">WVTX</a> or <a href="#WVTXR">WVTXR</a> with the id of the waveform to transmit.
-<br><br>A waveform comprises of one or more pulses.
-<br><br>A pulse specifies
-<br><br>1) the GPIO to be switched on at the start of the pulse.<br>
-2) the GPIO to be switched off at the start of the pulse.<br>
-3) the delay in microseconds before the next pulse.
-<br><br>Any or all the fields can be zero. It doesn't make any sense to
-set all the fields to zero (the pulse will be ignored).
-<br><br>When a waveform is started each pulse is executed in order with
-the specified delay between the pulse and the next.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvas&nbsp;4&nbsp;9600&nbsp;0&nbsp;23&nbsp;45&nbsp;67&nbsp;89&nbsp;90<br>37<br>$&nbsp;pigs&nbsp;wvcre<br>0<br><br>$&nbsp;pigs&nbsp;wvcre<br>-69<br>ERROR:&nbsp;attempt&nbsp;to&nbsp;create&nbsp;an&nbsp;empty&nbsp;waveform<br></code><h3><a name="WVCAP">WVCAP</a>
- - Create a waveform of fixed size</h3>Similar to <a href="#WVCRE">WVCRE</a>, 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.
-<br><br>Upon success a wave id (&gt;=0) is returned. On error a negative status
-code will be returned.
-<br><br>The data provided by the <a href="#WVAG">WVAG</a> and <a href="#WVAS">WVAS</a> commands are
-consumed by this command.
-<br><br>As many waveforms may be created as there is space available.
-The wave id is passed to <a href="#WVTX">WVTX</a> or <a href="#WVTXR">WVTXR</a> to specify the
-waveform to transmit.
-<br><br>Normal usage would be
-<br><br>Step 1. <a href="#WVCLR">WVCLR</a> to clear all waveforms and added data.
-<br><br>Step 2. <a href="#WVAG">WVAG</a>/<a href="#WVAS">WVAS</a> calls to supply the waveform data.
-<br><br>Step 3. <a href="#WVCAP">WVCAP</a> to create a waveform of a uniform size.
-<br><br>Step 4. <a href="#WVTX">WVTX</a> or <a href="#WVTXR">WVTXR</a> with the id of the waveform to transmit.
-<br><br>Repeat steps 2 - 4 as needed.
-<br><br>Step 5. Any wave id can now be deleted and another wave of the same size
- can be created in its place.
-<br><br><b><small>Example</small></b><br><br><code>#&nbsp;Create&nbsp;a&nbsp;wave&nbsp;that&nbsp;consumes&nbsp;50%&nbsp;of&nbsp;the&nbsp;total&nbsp;resource:<br><br>$&nbsp;pigs&nbsp;wvag&nbsp;16&nbsp;0&nbsp;5000000&nbsp;0&nbsp;16&nbsp;5000000<br>2<br>$&nbsp;pigs&nbsp;wvcap&nbsp;50<br>0<br>$&nbsp;pigs&nbsp;wvtx&nbsp;0<br>11918<br></code><h3><a name="WVDEL">WVDEL</a>
- <a href="#wid">wid</a> - Delete selected waveform</h3>This command deletes the waveform with id <a href="#wid">wid</a>.
-<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>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvdel&nbsp;0<br><br>$&nbsp;pigs&nbsp;wvdel&nbsp;0<br>-66<br>ERROR:&nbsp;non&nbsp;existent&nbsp;wave&nbsp;id<br></code><h3><a name="WVHLT">WVHLT</a>
- - Stop waveform</h3>This command aborts the transmission of the current waveform.
-<br><br>Nothing is returned.
-<br><br>This command is intended to stop a waveform started in the repeat mode.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvhlt<br></code><h3><a name="WVNEW">WVNEW</a>
- - Initialise a new waveform</h3>This clears any existing waveform data ready for the creation of a new
-waveform.
-<br><br>Nothing is returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvnew<br></code><h3><a name="WVSC">WVSC</a>
- <a href="#ws">ws</a> - Get waveform DMA CB stats</h3>The statistic requested by <a href="#ws">ws</a> is returned.
-<br><br><a href="#ws">ws</a> identifies the subcommand as follows.
-<br><br>0 Get Cbs<br>
-1 Get High Cbs<br>
-2 Get Max Cbs
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvas&nbsp;4&nbsp;9600&nbsp;0&nbsp;23&nbsp;45&nbsp;67&nbsp;89&nbsp;90<br>37<br><br>$&nbsp;pigs&nbsp;wvsc&nbsp;0<br>74<br>$&nbsp;pigs&nbsp;wvsc&nbsp;1<br>74<br>$&nbsp;pigs&nbsp;wvsc&nbsp;2<br>25016<br></code><h3><a name="WVSM">WVSM</a>
- <a href="#ws">ws</a> - Get waveform time stats</h3>The statistic requested by <a href="#ws">ws</a> is returned.
-<br><br><a href="#ws">ws</a> identifies the subcommand as follows.
-<br><br>0 Get Micros<br>
-1 Get High Micros<br>
-2 Get Max Micros
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvsm&nbsp;0<br>5314<br>$&nbsp;pigs&nbsp;wvsm&nbsp;1<br>5314<br>$&nbsp;pigs&nbsp;wvsm&nbsp;2<br>1800000000<br></code><h3><a name="WVSP">WVSP</a>
- <a href="#ws">ws</a> - Get waveform pulse stats</h3>The statistic requested by <a href="#ws">ws</a> is returned.
-<br><br><a href="#ws">ws</a> identifies the subcommand as follows.
-<br><br>0 Get Pulses<br>
-1 Get High Pulses<br>
-2 Get Max Pulses
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvsp&nbsp;0<br>37<br>$&nbsp;pigs&nbsp;wvsp&nbsp;1<br>37<br>$&nbsp;pigs&nbsp;wvsp&nbsp;2<br>12000<br></code><h3><a name="WVTX">WVTX</a>
- <a href="#wid">wid</a> - Transmits waveform once</h3>This command transmits the waveform with id <a href="#wid">wid</a> once.
-<br><br>NOTE: Any hardware PWM started by <a href="#HP">HP</a> will be cancelled.
-<br><br>Upon success the number of DMA control blocks in the waveform is returned.
-On error a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvtx&nbsp;1<br>75<br><br>$&nbsp;pigs&nbsp;wvtx&nbsp;2<br>-66<br>ERROR:&nbsp;non&nbsp;existent&nbsp;wave&nbsp;id<br></code><h3><a name="WVTXM">WVTXM</a>
- <a href="#wid">wid</a> <a href="#wmde">wmde</a> - Transmits waveform using mode</h3>This command transmits the waveform with id <a href="#wid">wid</a> using mode <a href="#wmde">wmde</a>.
-<br><br>The mode may be send once (0), send repeatedly (1), send once but
-first sync with previous wave (2), or send repeatedly but first
-sync with previous wave (3).
-<br><br>WARNING: bad things may happen if you delete the previous
-waveform before it has been synced to the new waveform.
-<br><br>NOTE: Any hardware PWM started by <a href="#HP">HP</a> will be cancelled.
-<br><br>Upon success the number of DMA control blocks in the waveform is returned.
-On error a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvtxm&nbsp;1&nbsp;3<br>75<br><br>$&nbsp;pigs&nbsp;wvtxm&nbsp;2&nbsp;0<br>-66<br>ERROR:&nbsp;non&nbsp;existent&nbsp;wave&nbsp;id<br></code><h3><a name="WVTXR">WVTXR</a>
- <a href="#wid">wid</a> - Transmits waveform repeatedly</h3>This command transmits the waveform with id <a href="#wid">wid</a> repeatedly.
-<br><br>NOTE: Any hardware PWM started by <a href="#HP">HP</a> will be cancelled.
-<br><br>Upon success the number of DMA control blocks in the waveform is returned.
-On error a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvtxr&nbsp;1<br>75<br><br>$&nbsp;pigs&nbsp;wvtxr&nbsp;2<br>-66<br>ERROR:&nbsp;non&nbsp;existent&nbsp;wave&nbsp;id<br></code><h2><a name="Parameters">Parameters</a></h2>
-<h3><a name="actv">actv</a> - 0-1000000</h3>
-The number of microseconds level changes are reported for once
-a noise filter has been triggered (by <a href="#stdy">stdy</a> microseconds of
-a stable level).
-<h3><a name="b">b</a> - baud</h3>
-The command expects the baud rate in bits per second for
-the transmission of serial data (I2C/SPI/serial link, waves).
-<h3><a name="bctl">bctl</a> - BSC control word</h3>
-The command expects a BSC control word, see <a href="#BSCX">BSCX</a>.
-<h3><a name="bit">bit</a> - bit value (0-1)</h3>
-The command expects 0 or 1.
-<h3><a name="bits">bits</a> - a bit mask</h3>
-A mask is used to select one or more GPIO. A GPIO is selected
-if bit (1&lt;&lt;GPIO) is set in the mask.
-<br><br>E.g. a mask of 6 (binary 110) select GPIO 1 and 2, a mask of
-0x103 (binary 100000011) selects GPIO 0, 1, and 8.
-<h3><a name="bv">bv</a> - a byte value (0-255)</h3>
-The command expects a byte value.
-<h3><a name="bvs">bvs</a> - byte values (0-255)</h3>
-The command expects one or more byte values.
-<h3><a name="c">c</a> - SPI channel (0-1)</h3>
-The command expects a SPI channel.
-<h3><a name="cf">cf</a> - hardware clock frequency (4689-250M, 13184-375M for the BCM2711)</h3>
-The command expects a frequency.
-<h3><a name="cs">cs</a> - GPIO (0-31)</h3>
-The GPIO used for the slave select signal when bit banging SPI.
-<h3><a name="db">db</a> - serial data bits (1-32)</h3>
-The command expects the number of data bits per serial character.
-<h3><a name="dev">dev</a> - a tty serial device (/dev/tty* or /dev/serial*)</h3>
-The command expects the name of a tty serial device, e.g.
-<br><br><code>/dev/ttyAMA0<br>/dev/ttyUSB0<br>/dev/tty0<br>/dev/serial0<br></code><h3><a name="event">event</a> - 0-31</h3>
-An event is a signal used to inform one or more consumers
-to start an action.
-<h3><a name="file">file</a> - a file name</h3>
-The file name must match an entry in /opt/pigpio/access.
-<h3><a name="from">from</a> - 0-2</h3>
-Position to seek from <a href="#FS">FS</a>.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>From</td></tr><tr><td>0</td><td>start</td></tr><tr><td>1</td><td>current position</td></tr><tr><td>2</td><td>end</td></tr></tbody></table><h3><a name="g">g</a> - GPIO (0-53)</h3>
-The command expects a GPIO.
-<br><br>There are 54 General Purpose Input Outputs (GPIO) named gpio0 through gpio53.
-<br><br>They are split into two banks. Bank 1 consists of gpio0 through gpio31.
-Bank 2 consists of gpio32 through gpio53.
-<br><br>All the GPIO which are safe for the user to read and write are in bank 1.
-Not all GPIO in bank 1 are safe though. Type 1 boards have 17 safe GPIO.
-Type 2 boards have 21. Type 3 boards have 26.
-<br><br>See <a href="#HWVER">HWVER</a>.
-<br><br>The user GPIO are marked with an X in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>0</td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td><td>15</td></tr><tr><td>Type 1</td><td>X</td><td>X</td><td>-</td><td>-</td><td>X</td><td>-</td><td>-</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>-</td><td>-</td><td>X</td><td>X</td></tr><tr><td>Type 2</td><td>-</td><td>-</td><td>X</td><td>X</td><td>X</td><td>-</td><td>-</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>-</td><td>-</td><td>X</td><td>X</td></tr><tr><td>Type 3</td><td></td><td></td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>16</td><td>17</td><td>18</td><td>19</td><td>20</td><td>21</td><td>22</td><td>23</td><td>24</td><td>25</td><td>26</td><td>27</td><td>28</td><td>29</td><td>30</td><td>31</td></tr><tr><td>Type 1</td><td>-</td><td>X</td><td>X</td><td>-</td><td>-</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Type 2</td><td>-</td><td>X</td><td>X</td><td>-</td><td>-</td><td>-</td><td>X</td><td>X</td><td>X</td><td>X</td><td>-</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr><tr><td>Type 3</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>-</td><td>-</td><td>-</td><td>-</td></tr></tbody></table><br><br>You are not prevented from writing to unsafe GPIO. The consequences
-of doing so range from no effect, to a crash, or corrupted data.
-<h3><a name="h">h</a> - handle (&gt;=0)</h3>
-The command expects a handle.
-<br><br>A handle is a number referencing an object opened by one of <a href="#FO">FO</a>,
-<a href="#I2CO">I2CO</a>, <a href="#NO">NO</a>, <a href="#SERO">SERO</a>, <a href="#SPIO">SPIO</a>.
-<h3><a name="ib">ib</a> - I2C bus (&gt;=0)</h3>
-The command expects an I2C bus number.
-<h3><a name="id">id</a> - I2C device (0-0x7F)</h3>
-The command expects the address of an I2C device.
-<h3><a name="if">if</a> - I2C flags (0)</h3>
-The command expects an I2C flags value. No flags are currently defined.
-<h3><a name="L">L</a> - level (0-1)</h3>
-The command expects a GPIO level.
-<h3><a name="m">m</a> - mode (RW540123)</h3>
-The command expects a mode character.
-<br><br>Each GPIO can be configured to be in one of 8 different modes. The modes
-are named Input, Output, ALT0, ALT1, ALT2, ALT3, ALT4, and ALT5.
-<br><br>To set the mode use the code for the mode.
-<br><br>The value is returned by the mode get command.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Mode</td><td>Input</td><td>Output</td><td>ALT0</td><td>ALT1</td><td>ALT2</td><td>ALT3</td><td>ALT4</td><td>ALT5</td></tr><tr><td>Code</td><td>R</td><td>W</td><td>0</td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td></tr><tr><td>Value</td><td>0</td><td>1</td><td>4</td><td>5</td><td>6</td><td>7</td><td>3</td><td>2</td></tr></tbody></table><h3><a name="miso">miso</a> - GPIO (0-31)</h3>
-The GPIO used for the MISO signal when bit banging SPI.
-<h3><a name="mode">mode</a> - file open mode</h3>
-One of the following values.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>Value</td><td>Meaning</td></tr><tr><td>READ</td><td>1</td><td>open file for reading</td></tr><tr><td>WRITE</td><td>2</td><td>open file for writing</td></tr><tr><td>RW</td><td>3</td><td>open file for reading and writing</td></tr></tbody></table><br><br>The following values can be or'd into the mode.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>Value</td><td>Meaning</td></tr><tr><td>APPEND</td><td>4</td><td>All writes append data to the end of the file</td></tr><tr><td>CREATE</td><td>8</td><td>The file is created if it doesn't exist</td></tr><tr><td>TRUNC</td><td>16</td><td>The file is truncated</td></tr></tbody></table><h3><a name="mosi">mosi</a> - GPIO (0-31)</h3>
-The GPIO used for the MOSI signal when bit banging SPI.
-<h3><a name="name">name</a> - the name of a script</h3>
-Only alphanumeric characters, '-' and '_' are allowed in the name.
-<h3><a name="num">num</a> - maximum number of bytes to return (1-)</h3>
-The command expects the maximum number of bytes to return.
-<br><br>For the I2C and SPI commands the requested number of bytes will always
-be returned.
-<br><br>For the serial and file commands the smaller of the number of
-bytes available to be read (which may be zero) and <a href="#num">num</a> bytes
-will be returned.
-<h3><a name="o">o</a> - offset (&gt;=0)</h3>
-Serial data is stored offset microseconds from the start of the waveform.
-<h3><a name="p">p</a> - PUD (ODU)</h3>
-The command expects a PUD character.
-<br><br>Each GPIO can be configured to use or not use an internal pull up or
-pull down resistor. This is useful to provide a default state for inputs.
-<br><br>A pull up will default the input to 1 (high).
-<br><br>A pull down will default the input to 0 (low).
-<br><br>To set the pull up down state use the command character for the state.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pull Up Down</td><td>Off</td><td>Pull Down</td><td>Pull Up</td></tr><tr><td>Command Character</td><td>O</td><td>D</td><td>U</td></tr></tbody></table><br><br>There is no mechanism to read the pull up down state.
-<h3><a name="pad">pad</a> - 0-2</h3>
-A set of GPIO which share common drivers.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><h3><a name="padma">padma</a> - 1-16</h3>
-The mA which may be drawn from each GPIO whilst still guaranteeing the
-high and low levels.
-<h3><a name="pars">pars</a> - script parameters</h3>
-The command expects 0 to 10 numbers as parameters to be passed to the script.
-<h3><a name="pat">pat</a> - a file name pattern</h3>
-A file path which may contain wildcards. To be accessible the path
-must match an entry in /opt/pigpio/access.
-<h3><a name="pdc">pdc</a> - hardware PWM dutycycle (0-1000000)</h3>
-The command expects a dutycycle.
-<h3><a name="pf">pf</a> - hardware PWM frequency (1-125M, 1-187.5M for the BCM2711)</h3>
-The command expects a frequency.
-<h3><a name="pl">pl</a> - pulse length (1-100)</h3>
-The command expects a pulse length in microseconds.
-<h3><a name="r">r</a> - register (0-255)</h3>
-The command expects an I2C register number.
-<h3><a name="sb">sb</a> - serial stop (half) bits (2-8)</h3>
-The command expects the number of stop (half) bits per serial character.
-<h3><a name="scl">scl</a> - user GPIO (0-31)</h3>
-The command expects the number of the GPIO to be used for SCL
-when bit banging I2C.
-<h3><a name="sclk">sclk</a> - user GPIO (0-31)</h3>
-The GPIO used for the SCLK signal when bit banging SPI.
-<h3><a name="sda">sda</a> - user GPIO (0-31)</h3>
-The command expects the number of the GPIO to be used for SDA
-when bit banging I2C.
-<h3><a name="sef">sef</a> - serial flags (32 bits)</h3>
-The command expects a flag value. No serial flags are currently defined.
-<h3><a name="sid">sid</a> - script id (&gt;= 0)</h3>
-The command expects a script id as returned by a call to <a href="#PROC">PROC</a>.
-<h3><a name="spf">spf</a> - SPI flags (32 bits)</h3>
-See <a href="#SPIO">SPIO</a> and <a href="#BSPIO">BSPIO</a>.
-<h3><a name="stdy">stdy</a> - 0-300000</h3>
-The number of microseconds level changes must be stable for
-before reporting the level changed (<a href="#FG">FG</a>) or triggering
-the active part of a noise filter (<a href="#FN">FN</a>).
-<h3><a name="str">str</a> - a string</h3>
-The command expects a string.
-<h3><a name="t">t</a> - a string</h3>
-The command expects a string.
-<h3><a name="trips">trips</a> - triplets</h3>
-The command expects 1 or more triplets of GPIO on, GPIO off, delay.
-<br><br>E.g. 0x400000 0 100000 0 0x400000 900000 defines two pulses as follows
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>GPIO on</td><td>GPIO off</td><td>delay</td></tr><tr><td>0x400000 (GPIO 22)</td><td>0 (None)</td><td>100000 (1/10th s)</td></tr><tr><td>0 (None)</td><td>0x400000 (GPIO 22)</td><td>900000 (9/10th s)</td></tr></tbody></table><h3><a name="u">u</a> - user GPIO (0-31)</h3>
-The command expects the number of a user GPIO.
-<br><br>A number of commands are restricted to GPIO in bank 1,
-in particular the PWM commands, the servo command,
-the watchdog command, and the notification command.
-<br><br>It is your responsibility to ensure that the PWM and servo commands
-are only used on safe GPIO.
-<br><br>See <a href="#g">g</a>
-<h3><a name="uvs">uvs</a> - values</h3>
-The command expects an arbitrary number of &gt;=0 values (possibly none).
-Any after the first two must be &lt;= 255.
-<h3><a name="v">v</a> - value</h3>
-The command expects a number.
-<h3><a name="wid">wid</a> - wave id (&gt;=0)</h3>
-The command expects a wave id.
-<br><br>When a waveform is created it is given an id (0, 1, 2, ...).
-<h3><a name="wmde">wmde</a> - mode (0-3)</h3>
-The command expects a wave transmission mode.
-<br><br>0 = send once<br>
-1 = send repeatedly<br>
-2 = send once but first sync with previous wave<br>
-3 = send repeatedly but first sync with previous wave<br>
-<h3><a name="ws">ws</a> - wave stats sucommand (0-2)</h3>
-The command expects a subcommand.
-<br><br>0 = current value.<br>
-1 = highest value so far.<br>
-2 = maximum possible value.
-<h3><a name="wv">wv</a> - word value (0-65535)</h3>
-The command expects a word value.
-<h2><a name="Scripts">Scripts</a></h2>
-Scripts are programs to be stored and executed by the pigpio daemon.
-They are intended to mitigate any performance problems associated with
-the pigpio daemon server/client model.
-<h3>Example</h3>A trivial example might be useful. Suppose you want to toggle a GPIO
-on and off as fast as possible.
-<br><br>From the command line you could write
-<br><br><code>for&nbsp;((i=0;&nbsp;i&lt;1000;i++));&nbsp;do&nbsp;pigs&nbsp;w&nbsp;22&nbsp;1&nbsp;w&nbsp;22&nbsp;0;&nbsp;done<br></code><br><br>Timing that you will see it takes about 14 seconds, or roughly
-70 toggles per second.
-<br><br>Using the pigpio Python module you could use code such as
-<br><br><code>#!/usr/bin/env&nbsp;python<br><br>import&nbsp;time<br><br>import&nbsp;pigpio<br><br>PIN=4<br><br>TOGGLE=10000<br><br>pi&nbsp;=&nbsp;pigpio.pi()&nbsp;#&nbsp;Connect&nbsp;to&nbsp;local&nbsp;Pi.<br><br>s&nbsp;=&nbsp;time.time()<br><br>for&nbsp;i&nbsp;in&nbsp;range(TOGGLE):<br>&nbsp;&nbsp;&nbsp;pi.write(PIN,&nbsp;1)<br>&nbsp;&nbsp;&nbsp;pi.write(PIN,&nbsp;0)<br><br>e&nbsp;=&nbsp;time.time()<br><br>print("pigpio&nbsp;did&nbsp;{}&nbsp;toggles&nbsp;per&nbsp;second".format(int(TOGGLE/(e-s))))<br><br>pi.stop()<br></code><br><br>Timing that shows a speed improvement to roughly 800 toggles per second.
-<br><br>Now let's use a script.
-<br><br><code>pigs&nbsp;proc&nbsp;tag&nbsp;999&nbsp;w&nbsp;22&nbsp;1&nbsp;w&nbsp;22&nbsp;0&nbsp;dcr&nbsp;p0&nbsp;jp&nbsp;999<br></code><br><br>Ignore the details for now.
-<br><br>Let's time the script running.
-<br><br>Again, ignore the details for now.
-<br><br><code>time&nbsp;(pigs&nbsp;procr&nbsp;0&nbsp;10000000;&nbsp;while&nbsp;a=$(pigs&nbsp;procp&nbsp;0);&nbsp;[[&nbsp;${a::1}&nbsp;-eq&nbsp;2&nbsp;]];\<br>&nbsp;do&nbsp;sleep&nbsp;0.2;&nbsp;done)<br></code><br><br>The script takes roughly 12 seconds to complete, or 800,000 toggles per second.
-<br><br>That is the advantage of a stored script.
-<br><br>Some details.
-<br><br><code>pigs&nbsp;proc&nbsp;tag&nbsp;999&nbsp;w&nbsp;22&nbsp;1&nbsp;w&nbsp;22&nbsp;0&nbsp;dcr&nbsp;p0&nbsp;jp&nbsp;999<br></code><br><br>proc introduces a script. Everything after proc is part of the script.<br>
-tag 999 names the current position in the script.<br>
-w 22 1 writes 1 to GPIO 22.<br>
-w 22 0 writes 0 to GPIO 22.<br>
-dcr p0 decrements parameter 0.<br>
-jp 999 jumps to tag 999 if the result is positive.
-<br><br><code>time&nbsp;(pigs&nbsp;procr&nbsp;0&nbsp;10000000;&nbsp;while&nbsp;a=$(pigs&nbsp;procp&nbsp;0);&nbsp;[[&nbsp;${a::1}&nbsp;-eq&nbsp;2&nbsp;]];\<br>&nbsp;do&nbsp;sleep&nbsp;0.2;&nbsp;done)<br></code><br><br>pigs procr 0 10000000 starts script 0 with parameter 0 of 10 million.
-<br><br>The rest is bash apart from
-<br><br>pigs procp 0 asks for the status and parameters of script 0.
-The status will be 2 while the script is running and 1 when it is complete.
-<h3>Virtual machine</h3>A script runs within a virtual machine with
-<br><br>a 32 bit accumulator A.<br>
-a flags register F.<br>
-a program counter PC.
-<br><br>Each script has
-<br><br>10 parameters named 0 through 9.<br>
-150 variables named 0 through 149.<br>
-50 labels which are named by any unique number.
-<h3>Commands</h3>Many pigpio commands may be used within a script. However
-some commands do not work within the script model as designed and
-are not permitted.
-<br><br>The following commands are not permitted within a script:
-<br><br>File - FL FO FR FW
-<br><br>I2C - BI2CZ I2CPK I2CRD I2CRI I2CRK I2CWD I2CWI I2CWK I2CZ
-<br><br>Misc - BSCX CF1 CF2 SHELL
-<br><br>Script control - PARSE PROC PROCD PROCP PROCR PROCS PROCU
-<br><br>Serial - SERO SERR SERW SLR
-<br><br>SPI - BSPIO BSPIX SPIR SPIW SPIX
-<br><br>Waves - WVAG WVAS WVCHA WVGO WVGOR
-<br><br>The following commands are only permitted within a script:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Command</td><td>Description</td><td>Definition</td></tr><tr><td>ADD x</td><td>Add x to accumulator</td><td>A+=x; F=A</td></tr><tr><td>AND x</td><td>And x with accumulator</td><td>A&=x; F=A</td></tr><tr><td>CALL L</td><td>Call subroutine at tag L</td><td>push(PC+1); PC=L</td></tr><tr><td>CMP x</td><td>Compare x with accumulator</td><td>F=A-x</td></tr><tr><td>DCR y</td><td>Decrement register</td><td>--*y; F=*y</td></tr><tr><td>DCRA</td><td>Decrement accumulator</td><td>--A; F=A</td></tr><tr><td>DIV x</td><td>Divide x into accumulator</td><td>A/=x; F=A</td></tr><tr><td>EVTWT</td><td>Wait for an event to occur</td><td>A=wait(x); F=A</td></tr><tr><td>HALT</td><td>Halt</td><td>Halt</td></tr><tr><td>INR y</td><td>Increment register</td><td>++*y; F=*y</td></tr><tr><td>INRA</td><td>Increment accumulator</td><td>++A; F=A</td></tr><tr><td>JM L</td><td>Jump if minus to tag L</td><td>if (F&lt;0) PC=L</td></tr><tr><td>JMP L</td><td>Jump to tag L</td><td>PC=L</td></tr><tr><td>JNZ L</td><td>Jump if non-zero to tag L</td><td>if (F) PC=L</td></tr><tr><td>JP L</td><td>Jump if positive to tag L</td><td>if (F&gt;=0) PC=L</td></tr><tr><td>JZ L</td><td>Jump if zero to tag L</td><td>if (!F) PC=L</td></tr><tr><td>LD y x</td><td>Load register with x</td><td>*y=x</td></tr><tr><td>LDA x</td><td>Load accumulator with x</td><td>A=x</td></tr><tr><td>MLT x</td><td>Multiply x with accumulator</td><td>A*=x; F=A</td></tr><tr><td>MOD x</td><td>Modulus x with accumulator</td><td>A%=x; F=A</td></tr><tr><td>OR x</td><td>Or x with accumulator</td><td>A|=x; F=A</td></tr><tr><td>POP y</td><td>Pop register</td><td>y=pop()</td></tr><tr><td>POPA</td><td>Pop accumulator</td><td>A=pop()</td></tr><tr><td>PUSH y</td><td>Push register</td><td>push(y)</td></tr><tr><td>PUSHA</td><td>Push accumulator</td><td>push(A)</td></tr><tr><td>RET</td><td>Return from subroutine</td><td>PC=pop()</td></tr><tr><td>RL y x</td><td>Rotate left register x bits</td><td>*y&lt;&lt;=x; F=*y</td></tr><tr><td>RLA x</td><td>Rotate left accumulator x bits</td><td>A&lt;&lt;=x; F=A</td></tr><tr><td>RR y x</td><td>Rotate right register x bits</td><td>*y&gt;&gt;=x; F=*y</td></tr><tr><td>RRA x</td><td>Rotate right accumulator x bits</td><td>A&gt;&gt;=x; F=A</td></tr><tr><td>STA y</td><td>Store accumulator in register</td><td>y=A</td></tr><tr><td>SUB x</td><td>Subtract x from accumulator</td><td>A-=x; F=A</td></tr><tr><td>SYS str</td><td>Run external script (/opt/pigpio/cgi/str)</td><td>system(str); F=A</td></tr><tr><td>TAG L</td><td>Label the current script position</td><td>N/A</td></tr><tr><td>WAIT x</td><td>Wait for a GPIO in x to change state</td><td>A=wait(x); F=A</td></tr><tr><td>X y1 y2</td><td>Exchange contents of registers y1 and y2</td><td>t=*y1;*y1=*y2;*y2=t</td></tr><tr><td>XA y</td><td>Exchange contents of accumulator and register</td><td>t=A;A=*y;*y=t</td></tr><tr><td>XOR x</td><td>Xor x with accumulator</td><td>A^=x; F=A</td></tr></tbody></table><br><br>x may be a constant, a parameter (p0-p9), or a variable (v0-v149).
-<br><br>y may be a parameter (p0-p9), or a variable (v0-v149). If p or v isn't
-specified y is assumed to be a variable.
-<br><br>The EVTWT command parameter is a bit-mask with 1 set for events of interest.
-<br><br>The WAIT command parameter is a bit-mask with 1 set for GPIO of interest.
-<br><br>The SYS script receives two unsigned parameters: the accumulator A and
-the current GPIO levels.
-<br><br></td>
-</table>
-<div style="vertical-align: center; text-align: center; background-color:#98bf21; font-size:0.8em; height:30px"><a class="l2" href="index.html">[pigpio]</a>
-<a class="l2" href="cif.html">[pigpio C I/F]</a>
-<a class="l2" href="pigpiod.html">[pigpiod]</a>
-<a class="l2" href="pdif2.html">[pigpiod C I/F]</a>
-<a class="l2" href="python.html">[Python]</a>
-<a class="l2" href="pigs.html">[pigs]</a>
-<a class="l2" href="piscope.html">[piscope]</a>
-<a class="l2" href="misc.html">[Misc]</a>
-<a class="l2" href="examples.html">[Examples]</a>
-<a class="l2" href="download.html">[Download]</a>
-<a class="l2" href="faq.html">[FAQ]</a>
-<a class="l2" href="sitemap.html">[Site Map]</a>
-</div>
-<table><tr>
-<td style="width: 200px"><div style="text-align: left;"><small>&copy; 2012-2020</small></div></td>
-<td style="width: 350px"><div style="text-align: center;">e-mail: pigpio @ abyz.me.uk</div></td>
-<td style="width: 200px"><div style="text-align: right;"><small>Updated: 30/04/2020</small></div></td>
-</tr></table>
-</td>
-</table>
-</body>
-</html>
diff --git a/DOC/HTML/piscope.html b/DOC/HTML/piscope.html
deleted file mode 100644
index 9236731..0000000
--- a/DOC/HTML/piscope.html
+++ /dev/null
@@ -1,269 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta name="description" content="Raspberry Pi Reg. C GPIO library and Python GPIO module and shell command utilities to control the GPIO, including SPI, I2C, and serial links." />
- <meta name="keywords" content="raspberry, pi, C, Python, GPIO, library, shell, command, utilities, module, SPI, I2C, serial" />
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>pigpio library</title>
- <link rel="stylesheet" type="text/css" href="scripts/index.css">
- <link rel="icon" href="favicon.ico" type="image/x-icon">
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
-</head>
-<body>
-
-<table style="padding:0px; border:0px; margin:0px; width:780px; background-color:#e0e0e0;">
-<td style="background:#EAF2E6 url('images/sidebar.gif') repeat-y; width:35px; height:100%"></td>
-<td>
-<table>
-<div style="background:url('images/topbar.gif') repeat-x; height: 70px; font-size:1.5em; vertical-align: top;"><a href="index.html"><img src="images/pigpio-logo.gif" border="0" /></a>pigpio library</div>
-</table>
-<table><div>
-<td><img src="images/pisc-1.jpg" width="250"></td>
-<td><img src="images/pisc-2.jpg" width="250"></td>
-<td><img src="images/pisc-3.jpg" width="250"></td>
-</div></table>
-<table>
-<td style="vertical-align: top; background-color: #98bf21;"><a class="l1" href="index.html">pigpio</a>
-<a class="l1" href="cif.html">pigpio C I/F</a>
-<a class="l1" href="pigpiod.html">pigpiod</a>
-<a class="l1" href="pdif2.html">pigpiod C I/F</a>
-<a class="l1" href="python.html">Python</a>
-<a class="l1" href="pigs.html">pigs</a>
-<a class="l1" href="piscope.html">piscope</a>
-<a class="l1" href="misc.html">Misc</a>
-<a class="l1" href="examples.html">Examples</a>
-<a class="l1" href="download.html">Download</a>
-<a class="l1" href="faq.html">FAQ</a>
-<a class="l1" href="sitemap.html">Site Map</a>
-</td>
-<td><center><h2>piscope</h2></center>
-<h2>Introduction<br></h2>
-<a href="piscope.tar">piscope</a> is a logic analyser (digital
-waveform viewer) for the Raspberry.&nbsp; It shows the state (high
-or low) of selected GPIO in real-time.<br>
-<br>
-See <a href="http://youtu.be/2apqOiLHEzs">video</a>.<br>
-<br>
-piscope uses the services of the pigpio <a href=
-"download.html">library</a>.&nbsp; pigpio needs to be running on
-the Pi whose GPIO are to be monitored.<br>
-<br>
-The pigpio library may be started as a daemon (background process)
-by the following command.<br>
-<br>
-<code>sudo pigpiod<br></code><br>
-piscope may be invoked in several different ways<br>
-<br>
-<table summary="" style=
-"text-align: left; width: 90%; height: 246px;" cellspacing="2"
-cellpadding="2" border="1">
-<tbody>
-<tr>
-<td style="width: 15%;"><small>Pi<br></small></td>
-<td style="vertical-align: top; width: 55%;"><small><span style=
-"font-style: italic;">pi_host</span> ~ $ piscope
-&amp;<br></small></td>
-<td style="vertical-align: top; width: 30%;"><small>Pi captures
-data<br>
-Pi processes data<br>
-Pi displays data<br></small></td>
-</tr>
-<tr>
-<td style="vertical-align: top;"><small>Pi plus Linux PC<br>
-<br>
-(with the<br>
-display on a remote<br>
-&nbsp; Linux PC)<br></small></td>
-<td style="vertical-align: top;"><small><span style=
-"font-style: italic;">remote_host</span> ~ $ ssh -X <span style=
-"font-style: italic;">pi_host</span><br></small><small><span style=
-"font-style: italic;">pi_host</span> ~ $ piscope
-&amp;</small><small><br></small></td>
-<td style="vertical-align: top;"><small>Pi captures data<br>
-Pi processes data<br>
-Remote Linux PC displays data<br></small></td>
-</tr>
-<tr>
-<td style="vertical-align: top;"><small>Pi plus Windows PC<br>
-<br>
-(with the<br>
-display on a remote<br>
-&nbsp; Windows PC)</small></td>
-<td style="vertical-align: top;"><small>You need to install an SSH
-client (putty suggested) and a X11 server (xming suggested).<br>
-<br>
-Run Program Files -&gt; Xming -&gt; XLaunch and accept the
-defaults.<br>
-<br>
-Run putty and enter the Pi's host name or IP address.&nbsp; Click
-on SSH X11 and tick Enable X11 forwarding and then select
-Open.</small><br>
-<small><br></small> <small><span style=
-"font-style: italic;">pi_host</span> ~ $ piscope
-&amp;</small><br></td>
-<td style="vertical-align: top;"><small>Pi captures data<br>
-Pi processes data<br>
-Remote Windows PC displays data</small></td>
-</tr>
-<tr>
-<td style="vertical-align: top;"><small>Pi plus Linux PC<br>
-<br>
-(with the display and processing on a remote Linux
-PC)<br></small></td>
-<td style="vertical-align: top;"><small><span style=
-"font-style: italic;">remote_host</span> ~ $ export
-PIGPIO_ADDR=<span style="font-style: italic;">pi_host</span><br>
-<span style="font-style: italic;">remote_host</span> ~ $ piscope
-&amp;<br></small></td>
-<td style="vertical-align: top;"><small>Pi captures data<br>
-Remote processes data<br>
-Remote displays data<br></small></td>
-</tr>
-</tbody>
-</table>
-<br>
-piscope operates in one of three modes<br>
-<br>
-<table summary="" style="text-align: left; width: 90%;"
-cellspacing="2" cellpadding="2" border="1">
-<tbody>
-<tr>
-<td style="vertical-align: top;">Live<br></td>
-<td style="vertical-align: top;">The latest GPIO samples are
-displayed.<br>
-<br>
-The mode will automatically change to Pause if a sampling trigger
-is detected.<br>
-<br>
-There are four triggers.&nbsp; Each trigger is made up of a
-combination of GPIO states (one of don't care, low, high, edge,
-falling, or rising per GPIO).&nbsp; Triggers are always
-counted.&nbsp; In addition a trigger may be sample to, sample
-around, or sample from, a so called sampling trigger.<br></td>
-<td style="vertical-align: top;">New samples are added to the
-sample buffer.<br>
-<br>
-Once the sample buffer is full the <span style=
-"font-weight: bold;">oldest</span> samples are discarded.</td>
-</tr>
-<tr>
-<td style="vertical-align: top;">Play<br></td>
-<td style="vertical-align: top;">Recorded GPIO samples are
-displayed.<br>
-<br>
-The play speed may be varied between 64 times real-time to 1/32768
-of real-time.<br>
-<br>
-The page up key increases the play speed by a factor of 2.&nbsp;
-The page down key decreases the play speed by a factor of 2.&nbsp;
-The home key sets the play speed to 1X.<br></td>
-<td style="vertical-align: top;">New samples are added to the
-sample buffer.<br>
-<br>
-Once the sample buffer is full <span style=
-"font-weight: bold;">new</span> samples are discarded.</td>
-</tr>
-<tr>
-<td style="vertical-align: top;">Pause<br></td>
-<td style="vertical-align: top;">Recorded GPIO samples are
-displayed.<br>
-<br>
-The left and right cursor keys move the blue marker to the previous
-or next edge.&nbsp; By default all GPIO edges are considered.&nbsp;
-Clicking on a GPIO name will limit edge searches to the highlighted
-GPIO only.<br>
-<br>
-The left and right square bracket keys move the blue marker to the
-previous or next trigger.<br>
-<br>
-The time between the blue and gold markers is displayed.&nbsp; The
-gold marker is set to the blue marker by a press of the 'g'
-key.<br></td>
-<td style="vertical-align: top;">New samples are added to the
-sample buffer.<br>
-<br>
-Once the sample buffer is full <span style=
-"font-weight: bold;">new</span> samples are discarded.</td>
-</tr>
-</tbody>
-</table>
-<br>
-In all modes the down and up cursor keys zoom the time scale in and
-out.<br>
-<br>
-Samples can be saved with File Save All Samples or File Save
-Selected Samples.
-<p>To select samples enter pause mode. Press 1 to specify the start
-of the samples (green marker) and 2 to specify the end of the
-samples (red marker).</p>
-<p>The samples may be saved in the native piscope format or in VCD
-format.</p>
-<p>Data saved in VCD format may be viewed and further processed
-with GTKWave.</p>
-<p>Data saved in the native piscope format may be restored later
-with File Restore Saved Data.</p>
-<h2>Installation</h2>
-<p>To download and install piscope.</p>
-<h3>Pi (pre-built image)</h3>
-<code>wget abyz.me.uk/rpi/pigpio/piscope.tar<br>
-tar xvf piscope.tar<br>
-cd PISCOPE<br>
-make hf<br>
-make install</code><span style="font-weight: bold;"><br></span>
-<h3>Linux 64 bit X86/AMD (pre-built image)</h3>
-<code>wget abyz.me.uk/rpi/pigpio/piscope.tar<br>
-tar xvf piscope.tar<br>
-cd PISCOPE<br>
-make x86_64<br>
-make install<br></code>
-<h3>All machines (building from source)</h3>
-You only need to perform this step if you want to build the
-executable from the source files.&nbsp; This is not needed if you
-use a pre-built image.<br>
-<span style="font-weight: bold;"><br>
-WARNING</span>: Installing gtk+-3.0 uses a lot of SD card
-space.<br>
-<br>
-Most of the space used by gtk+-3.0 is taken up by unneeded *-dbg
-packages.<br>
-<br>
-With *-dbg packages an additional 3753MB SD space is required.<br>
-<br>
-If you edit the list of packages to be downloaded and remove the
-*-dbg packages only 134MB of additional SD space is needed (as at
-the time of writing).<br>
-<br>
-<code>#<br></code> <code># *** This may take a lot of time and use
-a lot of SD card space ***<br></code> <code>#<br>
-sudo apt-get install gtk+-3.0<br></code> <code>#<br></code>
-<code>wget abyz.me.uk/rpi/pigpio/piscope.tar<br>
-tar xvf piscope.tar<br>
-cd PISCOPE<br>
-make<br>
-make install<br></code><br>
-</td>
-</table>
-<div style="vertical-align: center; text-align: center; background-color:#98bf21; font-size:0.8em; height:30px"><a class="l2" href="index.html">[pigpio]</a>
-<a class="l2" href="cif.html">[pigpio C I/F]</a>
-<a class="l2" href="pigpiod.html">[pigpiod]</a>
-<a class="l2" href="pdif2.html">[pigpiod C I/F]</a>
-<a class="l2" href="python.html">[Python]</a>
-<a class="l2" href="pigs.html">[pigs]</a>
-<a class="l2" href="piscope.html">[piscope]</a>
-<a class="l2" href="misc.html">[Misc]</a>
-<a class="l2" href="examples.html">[Examples]</a>
-<a class="l2" href="download.html">[Download]</a>
-<a class="l2" href="faq.html">[FAQ]</a>
-<a class="l2" href="sitemap.html">[Site Map]</a>
-</div>
-<table><tr>
-<td style="width: 200px"><div style="text-align: left;"><small>&copy; 2012-2020</small></div></td>
-<td style="width: 350px"><div style="text-align: center;">e-mail: pigpio @ abyz.me.uk</div></td>
-<td style="width: 200px"><div style="text-align: right;"><small>Updated: 30/04/2020</small></div></td>
-</tr></table>
-</td>
-</table>
-</body>
-</html>
diff --git a/DOC/HTML/python.html b/DOC/HTML/python.html
deleted file mode 100644
index f6b5f22..0000000
--- a/DOC/HTML/python.html
+++ /dev/null
@@ -1,1294 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta name="description" content="Raspberry Pi Reg. C GPIO library and Python GPIO module and shell command utilities to control the GPIO, including SPI, I2C, and serial links." />
- <meta name="keywords" content="raspberry, pi, C, Python, GPIO, library, shell, command, utilities, module, SPI, I2C, serial" />
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>pigpio library</title>
- <link rel="stylesheet" type="text/css" href="scripts/index.css">
- <link rel="icon" href="favicon.ico" type="image/x-icon">
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
-</head>
-<body>
-
-<table style="padding:0px; border:0px; margin:0px; width:780px; background-color:#e0e0e0;">
-<td style="background:#EAF2E6 url('images/sidebar.gif') repeat-y; width:35px; height:100%"></td>
-<td>
-<table>
-<div style="background:url('images/topbar.gif') repeat-x; height: 70px; font-size:1.5em; vertical-align: top;"><a href="index.html"><img src="images/pigpio-logo.gif" border="0" /></a>pigpio library</div>
-</table>
-<table><div>
-<td><img src="images/lcd.jpg" width="250"></td>
-<td><img src="images/keypad.jpg" width="250"></td>
-<td><img src="images/driver.jpg" width="250"></td>
-</div></table>
-<table>
-<td style="vertical-align: top; background-color: #98bf21;"><a class="l1" href="index.html">pigpio</a>
-<a class="l1" href="cif.html">pigpio C I/F</a>
-<a class="l1" href="pigpiod.html">pigpiod</a>
-<a class="l1" href="pdif2.html">pigpiod C I/F</a>
-<a class="l1" href="python.html">Python</a>
-<a class="l1" href="pigs.html">pigs</a>
-<a class="l1" href="piscope.html">piscope</a>
-<a class="l1" href="misc.html">Misc</a>
-<a class="l1" href="examples.html">Examples</a>
-<a class="l1" href="download.html">Download</a>
-<a class="l1" href="faq.html">FAQ</a>
-<a class="l1" href="sitemap.html">Site Map</a>
-</td>
-<td><center><h2>Python Interface</h2></center>pigpio is a Python module for the Raspberry which talks to
-the pigpio daemon to allow control of the general purpose
-input outputs (GPIO).
-<h3>Features</h3>o the pigpio Python module can run on Windows, Macs, or Linux
-<br><br>o controls one or more Pi's
-<br><br>o hardware timed PWM on any of GPIO 0-31
-<br><br>o hardware timed servo pulses on any of GPIO 0-31
-<br><br>o callbacks when any of GPIO 0-31 change state
-<br><br>o creating and transmitting precisely timed waveforms
-<br><br>o reading/writing GPIO and setting their modes
-<br><br>o wrappers for I2C, SPI, and serial links
-<br><br>o creating and running scripts on the pigpio daemon
-<h3>GPIO</h3>ALL GPIO are identified by their Broadcom number.
-<h3>Notes</h3>Transmitted waveforms are accurate to a microsecond.
-<br><br>Callback level changes are time-stamped and will be
-accurate to within a few microseconds.
-<h3>Settings</h3>A number of settings are determined when the pigpio daemon is started.
-<br><br>o the sample rate (1, 2, 4, 5, 8, or 10 us, default 5 us).
-<br><br>o the set of GPIO which may be updated (generally written to). The
- default set is those available on the Pi board revision.
-<br><br>o the available PWM frequencies (see <a href="#set_PWM_frequency">set_PWM_frequency</a>).
-<h3>Exceptions</h3>By default a fatal exception is raised if you pass an invalid
-argument to a pigpio function.
-<br><br>If you wish to handle the returned status yourself you should set
-pigpio.exceptions to False.
-<br><br>You may prefer to check the returned status in only a few parts
-of your code. In that case do the following:
-<br><br><b><small>Example</small></b><br><br><code>pigpio.exceptions&nbsp;=&nbsp;False<br><br>#&nbsp;Code&nbsp;where&nbsp;you&nbsp;want&nbsp;to&nbsp;test&nbsp;the&nbsp;error&nbsp;status.<br><br>pigpio.exceptions&nbsp;=&nbsp;True<br></code><h3>Usage</h3>This module uses the services of the C pigpio library. pigpio
-must be running on the Pi(s) whose GPIO are to be manipulated.
-<br><br>The normal way to start pigpio is as a daemon (during system
-start).
-<br><br>sudo pigpiod
-<br><br>Your Python program must import pigpio and create one or more
-instances of the pigpio.pi class. This class gives access to
-a specified Pi's GPIO.
-<br><br><b><small>Example</small></b><br><br><code>pi1&nbsp;=&nbsp;pigpio.pi()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;pi1&nbsp;accesses&nbsp;the&nbsp;local&nbsp;Pi's&nbsp;GPIO<br>pi2&nbsp;=&nbsp;pigpio.pi('tom')&nbsp;&nbsp;#&nbsp;pi2&nbsp;accesses&nbsp;tom's&nbsp;GPIO<br>pi3&nbsp;=&nbsp;pigpio.pi('dick')&nbsp;#&nbsp;pi3&nbsp;accesses&nbsp;dick's&nbsp;GPIO<br><br>pi1.write(4,&nbsp;0)&nbsp;#&nbsp;set&nbsp;local&nbsp;Pi's&nbsp;GPIO&nbsp;4&nbsp;low<br>pi2.write(4,&nbsp;1)&nbsp;#&nbsp;set&nbsp;tom's&nbsp;GPIO&nbsp;4&nbsp;to&nbsp;high<br>pi3.read(4)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;get&nbsp;level&nbsp;of&nbsp;dick's&nbsp;GPIO&nbsp;4<br></code><br><br>The later example code snippets assume that pi is an instance of
-the pigpio.pi class.
-<h2>OVERVIEW</h2><table border="0" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td></td></tr><tr><td><b>ESSENTIAL
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#pigpio.pi">pigpio.pi</a></td><td> Initialise Pi connection
-</td></tr><tr><td><a href="#stop">stop</a></td><td> Stop a Pi connection
-</td></tr><tr><td></td><td></td></tr><tr><td><b>BASIC
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_mode">set_mode</a></td><td> Set a GPIO mode
-</td></tr><tr><td><a href="#get_mode">get_mode</a></td><td> Get a GPIO mode
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_pull_up_down">set_pull_up_down</a></td><td> Set/clear GPIO pull up/down resistor
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#read">read</a></td><td> Read a GPIO
-</td></tr><tr><td><a href="#write">write</a></td><td> Write a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>PWM (overrides servo commands on same GPIO)
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_PWM_dutycycle">set_PWM_dutycycle</a></td><td> Start/stop PWM pulses on a GPIO
-</td></tr><tr><td><a href="#set_PWM_frequency">set_PWM_frequency</a></td><td> Set PWM frequency of a GPIO
-</td></tr><tr><td><a href="#set_PWM_range">set_PWM_range</a></td><td> Configure PWM range of a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_PWM_dutycycle">get_PWM_dutycycle</a></td><td> Get PWM dutycycle set on a GPIO
-</td></tr><tr><td><a href="#get_PWM_frequency">get_PWM_frequency</a></td><td> Get PWM frequency of a GPIO
-</td></tr><tr><td><a href="#get_PWM_range">get_PWM_range</a></td><td> Get configured PWM range of a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_PWM_real_range">get_PWM_real_range</a></td><td> Get underlying PWM range for a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Servo (overrides PWM commands on same GPIO)
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_servo_pulsewidth">set_servo_pulsewidth</a></td><td> Start/Stop servo pulses on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_servo_pulsewidth">get_servo_pulsewidth</a></td><td> Get servo pulsewidth set on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>INTERMEDIATE
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpio_trigger">gpio_trigger</a></td><td> Send a trigger pulse to a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_watchdog">set_watchdog</a></td><td> Set a watchdog on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#read_bank_1">read_bank_1</a></td><td> Read all bank 1 GPIO
-</td></tr><tr><td><a href="#read_bank_2">read_bank_2</a></td><td> Read all bank 2 GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#clear_bank_1">clear_bank_1</a></td><td> Clear selected GPIO in bank 1
-</td></tr><tr><td><a href="#clear_bank_2">clear_bank_2</a></td><td> Clear selected GPIO in bank 2
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_bank_1">set_bank_1</a></td><td> Set selected GPIO in bank 1
-</td></tr><tr><td><a href="#set_bank_2">set_bank_2</a></td><td> Set selected GPIO in bank 2
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#callback">callback</a></td><td> Create GPIO level change callback
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wait_for_edge">wait_for_edge</a></td><td> Wait for GPIO level change
-</td></tr><tr><td></td><td></td></tr><tr><td><b>ADVANCED
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#notify_open">notify_open</a></td><td> Request a notification handle
-</td></tr><tr><td><a href="#notify_begin">notify_begin</a></td><td> Start notifications for selected GPIO
-</td></tr><tr><td><a href="#notify_pause">notify_pause</a></td><td> Pause notifications
-</td></tr><tr><td><a href="#notify_close">notify_close</a></td><td> Close a notification
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#hardware_clock">hardware_clock</a></td><td> Start hardware clock on supported GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#hardware_PWM">hardware_PWM</a></td><td> Start hardware PWM on supported GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_glitch_filter">set_glitch_filter</a></td><td> Set a glitch filter on a GPIO
-</td></tr><tr><td><a href="#set_noise_filter">set_noise_filter</a></td><td> Set a noise filter on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_pad_strength">set_pad_strength</a></td><td> Sets a pads drive strength
-</td></tr><tr><td><a href="#get_pad_strength">get_pad_strength</a></td><td> Gets a pads drive strength
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#shell">shell</a></td><td> Executes a shell command
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Custom
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#custom_1">custom_1</a></td><td> User custom function 1
-</td></tr><tr><td><a href="#custom_2">custom_2</a></td><td> User custom function 2
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Events
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#event_callback">event_callback</a></td><td> Sets a callback for an event
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#event_trigger">event_trigger</a></td><td> Triggers an event
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wait_for_event">wait_for_event</a></td><td> Wait for an event
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Scripts
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#store_script">store_script</a></td><td> Store a script
-</td></tr><tr><td><a href="#run_script">run_script</a></td><td> Run a stored script
-</td></tr><tr><td><a href="#update_script">update_script</a></td><td> Set a scripts parameters
-</td></tr><tr><td><a href="#script_status">script_status</a></td><td> Get script status and parameters
-</td></tr><tr><td><a href="#stop_script">stop_script</a></td><td> Stop a running script
-</td></tr><tr><td><a href="#delete_script">delete_script</a></td><td> Delete a stored script
-</td></tr><tr><td></td><td></td></tr><tr><td><b>I2C
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_open">i2c_open</a></td><td> Opens an I2C device
-</td></tr><tr><td><a href="#i2c_close">i2c_close</a></td><td> Closes an I2C device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_write_quick">i2c_write_quick</a></td><td> SMBus write quick
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_byte">i2c_read_byte</a></td><td> SMBus read byte
-</td></tr><tr><td><a href="#i2c_write_byte">i2c_write_byte</a></td><td> SMBus write byte
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_byte_data">i2c_read_byte_data</a></td><td> SMBus read byte data
-</td></tr><tr><td><a href="#i2c_write_byte_data">i2c_write_byte_data</a></td><td> SMBus write byte data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_word_data">i2c_read_word_data</a></td><td> SMBus read word data
-</td></tr><tr><td><a href="#i2c_write_word_data">i2c_write_word_data</a></td><td> SMBus write word data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_block_data">i2c_read_block_data</a></td><td> SMBus read block data
-</td></tr><tr><td><a href="#i2c_write_block_data">i2c_write_block_data</a></td><td> SMBus write block data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_i2c_block_data">i2c_read_i2c_block_data</a></td><td> SMBus read I2C block data
-</td></tr><tr><td><a href="#i2c_write_i2c_block_data">i2c_write_i2c_block_data</a></td><td> SMBus write I2C block data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_device">i2c_read_device</a></td><td> Reads the raw I2C device
-</td></tr><tr><td><a href="#i2c_write_device">i2c_write_device</a></td><td> Writes the raw I2C device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_process_call">i2c_process_call</a></td><td> SMBus process call
-</td></tr><tr><td><a href="#i2c_block_process_call">i2c_block_process_call</a></td><td> SMBus block process call
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_zip">i2c_zip</a></td><td> Performs multiple I2C transactions
-</td></tr><tr><td></td><td></td></tr><tr><td><b>I2C BIT BANG
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_i2c_open">bb_i2c_open</a></td><td> Opens GPIO for bit banging I2C
-</td></tr><tr><td><a href="#bb_i2c_close">bb_i2c_close</a></td><td> Closes GPIO for bit banging I2C
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_i2c_zip">bb_i2c_zip</a></td><td> Performs multiple bit banged I2C transactions
-</td></tr><tr><td></td><td></td></tr><tr><td><b>I2C/SPI SLAVE
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#bsc_xfer">bsc_xfer</a></td><td> I2C/SPI as slave transfer
-</td></tr><tr><td><a href="#bsc_i2c">bsc_i2c</a></td><td> I2C as slave transfer
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SERIAL
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#serial_open">serial_open</a></td><td> Opens a serial device
-</td></tr><tr><td><a href="#serial_close">serial_close</a></td><td> Closes a serial device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#serial_read_byte">serial_read_byte</a></td><td> Reads a byte from a serial device
-</td></tr><tr><td><a href="#serial_write_byte">serial_write_byte</a></td><td> Writes a byte to a serial device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#serial_read">serial_read</a></td><td> Reads bytes from a serial device
-</td></tr><tr><td><a href="#serial_write">serial_write</a></td><td> Writes bytes to a serial device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#serial_data_available">serial_data_available</a></td><td> Returns number of bytes ready to be read
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SERIAL BIT BANG (read only)
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_serial_read_open">bb_serial_read_open</a></td><td> Open a GPIO for bit bang serial reads
-</td></tr><tr><td><a href="#bb_serial_read_close">bb_serial_read_close</a></td><td> Close a GPIO for bit bang serial reads
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_serial_invert">bb_serial_invert</a></td><td> Invert serial logic (1 invert, 0 normal)
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_serial_read">bb_serial_read</a></td><td> Read bit bang serial data from a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SPI
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#spi_open">spi_open</a></td><td> Opens a SPI device
-</td></tr><tr><td><a href="#spi_close">spi_close</a></td><td> Closes a SPI device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#spi_read">spi_read</a></td><td> Reads bytes from a SPI device
-</td></tr><tr><td><a href="#spi_write">spi_write</a></td><td> Writes bytes to a SPI device
-</td></tr><tr><td><a href="#spi_xfer">spi_xfer</a></td><td> Transfers bytes with a SPI device
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SPI BIT BANG
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_spi_open">bb_spi_open</a></td><td> Opens GPIO for bit banging SPI
-</td></tr><tr><td><a href="#bb_spi_close">bb_spi_close</a></td><td> Closes GPIO for bit banging SPI
-</td></tr><tr><td><a href="#bb_spi_xfer">bb_spi_xfer</a></td><td> Transfers bytes with bit banging SPI
-</td></tr><tr><td></td><td></td></tr><tr><td><b>FILES
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#file_open">file_open</a></td><td> Opens a file
-</td></tr><tr><td><a href="#file_close">file_close</a></td><td> Closes a file
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#file_read">file_read</a></td><td> Reads bytes from a file
-</td></tr><tr><td><a href="#file_write">file_write</a></td><td> Writes bytes to a file
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#file_seek">file_seek</a></td><td> Seeks to a position within a file
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#file_list">file_list</a></td><td> List files which match a pattern
-</td></tr><tr><td></td><td></td></tr><tr><td><b>WAVES
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_clear">wave_clear</a></td><td> Deletes all waveforms
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_add_new">wave_add_new</a></td><td> Starts a new waveform
-</td></tr><tr><td><a href="#wave_add_generic">wave_add_generic</a></td><td> Adds a series of pulses to the waveform
-</td></tr><tr><td><a href="#wave_add_serial">wave_add_serial</a></td><td> Adds serial data to the waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_create">wave_create</a></td><td> Creates a waveform from added data
-</td></tr><tr><td><a href="#wave_create_and_pad">wave_create_and_pad</a></td><td> Creates a waveform of fixed size from added data
-</td></tr><tr><td><a href="#wave_delete">wave_delete</a></td><td> Deletes a waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_send_once">wave_send_once</a></td><td> Transmits a waveform once
-</td></tr><tr><td><a href="#wave_send_repeat">wave_send_repeat</a></td><td> Transmits a waveform repeatedly
-</td></tr><tr><td><a href="#wave_send_using_mode">wave_send_using_mode</a></td><td> Transmits a waveform in the chosen mode
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_chain">wave_chain</a></td><td> Transmits a chain of waveforms
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_tx_at">wave_tx_at</a></td><td> Returns the current transmitting waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_tx_busy">wave_tx_busy</a></td><td> Checks to see if a waveform has ended
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_tx_stop">wave_tx_stop</a></td><td> Aborts the current waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_get_cbs">wave_get_cbs</a></td><td> Length in cbs of the current waveform
-</td></tr><tr><td><a href="#wave_get_max_cbs">wave_get_max_cbs</a></td><td> Absolute maximum allowed cbs
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_get_micros">wave_get_micros</a></td><td> Length in microseconds of the current waveform
-</td></tr><tr><td><a href="#wave_get_max_micros">wave_get_max_micros</a></td><td> Absolute maximum allowed micros
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_get_pulses">wave_get_pulses</a></td><td> Length in pulses of the current waveform
-</td></tr><tr><td><a href="#wave_get_max_pulses">wave_get_max_pulses</a></td><td> Absolute maximum allowed pulses
-</td></tr><tr><td></td><td></td></tr><tr><td><b>UTILITIES
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_current_tick">get_current_tick</a></td><td> Get current tick (microseconds)
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_hardware_revision">get_hardware_revision</a></td><td> Get hardware revision
-</td></tr><tr><td><a href="#get_pigpio_version">get_pigpio_version</a></td><td> Get the pigpio version
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#pigpio.error_text">pigpio.error_text</a></td><td> Gets error text from error number
-</td></tr><tr><td><a href="#pigpio.tickDiff">pigpio.tickDiff</a></td><td> Returns difference between two ticks
-</td></tr><tr><td><b></b></td><td></td></tr></tbody></table><h2> class pi
-</h2><h3><a name="pigpio.pi">pigpio.pi<small>(<a href="#host">host</a>, <a href="#port">port</a>, <a href="#show_errors">show_errors</a>)</small></h3>
-Grants access to a Pi's GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>host:=&nbsp;the&nbsp;host&nbsp;name&nbsp;of&nbsp;the&nbsp;Pi&nbsp;on&nbsp;which&nbsp;the&nbsp;pigpio&nbsp;daemon&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;running.&nbsp;&nbsp;The&nbsp;default&nbsp;is&nbsp;localhost&nbsp;unless&nbsp;overridden&nbsp;by<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;PIGPIO_ADDR&nbsp;environment&nbsp;variable.<br></samp><br><br><b><small>Parameters</small></b><br><br><samp>port:=&nbsp;the&nbsp;port&nbsp;number&nbsp;on&nbsp;which&nbsp;the&nbsp;pigpio&nbsp;daemon&nbsp;is&nbsp;listening.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;default&nbsp;is&nbsp;8888&nbsp;unless&nbsp;overridden&nbsp;by&nbsp;the&nbsp;PIGPIO_PORT<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;environment&nbsp;variable.&nbsp;&nbsp;The&nbsp;pigpio&nbsp;daemon&nbsp;must&nbsp;have&nbsp;been<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;started&nbsp;with&nbsp;the&nbsp;same&nbsp;port&nbsp;number.<br></samp><br><br>This connects to the pigpio daemon and reserves resources
-to be used for sending commands and receiving notifications.
-<br><br>An instance attribute <a href="#connected">connected</a> may be used to check the
-success of the connection. If the connection is established
-successfully <a href="#connected">connected</a> will be True, otherwise False.
-<br><br><b><small>Example</small></b><br><br><code>pi&nbsp;=&nbsp;pigio.pi()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;use&nbsp;defaults<br>pi&nbsp;=&nbsp;pigpio.pi('mypi')&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;specify&nbsp;host,&nbsp;default&nbsp;port<br>pi&nbsp;=&nbsp;pigpio.pi('mypi',&nbsp;7777)&nbsp;#&nbsp;specify&nbsp;host&nbsp;and&nbsp;port<br><br>pi&nbsp;=&nbsp;pigpio.pi()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;exit&nbsp;script&nbsp;if&nbsp;no&nbsp;connection<br>if&nbsp;not&nbsp;pi.connected:<br>&nbsp;&nbsp;&nbsp;exit()<br></code><h3><a name="__repr__">__repr__<small>()</small></h3>
-<h3><a name="bb_i2c_close">bb_i2c_close<small>(<a href="#SDA">SDA</a>)</small></h3>
-This function stops bit banging I2C on a pair of GPIO
-previously opened with <a href="#bb_i2c_open">bb_i2c_open</a>.
-<br><br><b><small>Parameters</small></b><br><br><samp>SDA:=&nbsp;0-31,&nbsp;the&nbsp;SDA&nbsp;GPIO&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_i2c_open">bb_i2c_open</a><br></samp><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_I2C_GPIO.
-<br><br><b><small>Example</small></b><br><br><code>pi.bb_i2c_close(SDA)<br></code><h3><a name="bb_i2c_open">bb_i2c_open<small>(<a href="#SDA">SDA</a>, <a href="#SCL">SCL</a>, <a href="#baud">baud</a>)</small></h3>
-This function selects a pair of GPIO for bit banging I2C at a
-specified baud rate.
-<br><br>Bit banging I2C allows for certain operations which are not possible
-with the standard I2C driver.
-<br><br>o baud rates as low as 50
-o repeated starts
-o clock stretching
-o I2C on any pair of spare GPIO
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;SDA:=&nbsp;0-31<br>&nbsp;SCL:=&nbsp;0-31<br>baud:=&nbsp;50-500000<br></samp><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_I2C_BAUD, or
-PI_GPIO_IN_USE.
-<br><br>NOTE:
-<br><br>The GPIO used for SDA and SCL must have pull-ups to 3V3 connected.
-As a guide the hardware pull-ups on pins 3 and 5 are 1k8 in value.
-<br><br><b><small>Example</small></b><br><br><code>h&nbsp;=&nbsp;pi.bb_i2c_open(4,&nbsp;5,&nbsp;50000)&nbsp;#&nbsp;bit&nbsp;bang&nbsp;on&nbsp;GPIO&nbsp;4/5&nbsp;at&nbsp;50kbps<br></code><h3><a name="bb_i2c_zip">bb_i2c_zip<small>(<a href="#SDA">SDA</a>, <a href="#data">data</a>)</small></h3>
-This function executes a sequence of bit banged I2C operations.
-The operations to be performed are specified by the contents
-of data which contains the concatenated command codes and
-associated data.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;SDA:=&nbsp;0-31&nbsp;(as&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_i2c_open">bb_i2c_open</a>)<br>data:=&nbsp;the&nbsp;concatenated&nbsp;I2C&nbsp;commands,&nbsp;see&nbsp;below<br></samp><br><br>The returned value is a tuple of the number of bytes read and a
-bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br><b><small>Example</small></b><br><br><code>(count,&nbsp;data)&nbsp;=&nbsp;pi.bb_i2c_zip(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SDA,&nbsp;[4,&nbsp;0x53,&nbsp;2,&nbsp;7,&nbsp;1,&nbsp;0x32,&nbsp;2,&nbsp;6,&nbsp;6,&nbsp;3,&nbsp;0])<br></code><br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>End</td><td>0</td><td>No more commands</td></tr><tr><td>Escape</td><td>1</td><td>Next P is two bytes</td></tr><tr><td>Start</td><td>2</td><td>Start condition</td></tr><tr><td>Stop</td><td>3</td><td>Stop condition</td></tr><tr><td>Address</td><td>4 P</td><td>Set I2C address to P</td></tr><tr><td>Flags</td><td>5 lsb msb</td><td>Set I2C flags to lsb + (msb &lt;&lt; 8)</td></tr><tr><td>Read</td><td>6 P</td><td>Read P bytes of data</td></tr><tr><td>Write</td><td>7 P ...</td><td>Write P bytes of data</td></tr></tbody></table><br><br>The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-<br><br>The address and flags default to 0. The address and flags maintain
-their previous value until updated.
-<br><br>No flags are currently defined.
-<br><br>Any read I2C data is concatenated in the returned bytearray.
-<br><br><b><small>Example</small></b><br><br><code>Set&nbsp;address&nbsp;0x53<br>start,&nbsp;write&nbsp;0x32,&nbsp;(re)start,&nbsp;read&nbsp;6&nbsp;bytes,&nbsp;stop<br>Set&nbsp;address&nbsp;0x1E<br>start,&nbsp;write&nbsp;0x03,&nbsp;(re)start,&nbsp;read&nbsp;6&nbsp;bytes,&nbsp;stop<br>Set&nbsp;address&nbsp;0x68<br>start,&nbsp;write&nbsp;0x1B,&nbsp;(re)start,&nbsp;read&nbsp;8&nbsp;bytes,&nbsp;stop<br>End<br><br>0x04&nbsp;0x53<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x32&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x06&nbsp;0x03<br><br>0x04&nbsp;0x1E<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x03&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x06&nbsp;0x03<br><br>0x04&nbsp;0x68<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x1B&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x08&nbsp;0x03<br><br>0x00<br></code><h3><a name="bb_serial_invert">bb_serial_invert<small>(<a href="#user_gpio">user_gpio</a>, <a href="#invert">invert</a>)</small></h3>
-Invert serial logic.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31&nbsp;(opened&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_serial_read_open">bb_serial_read_open</a>)<br>&nbsp;&nbsp;&nbsp;&nbsp;invert:=&nbsp;0-1&nbsp;(1&nbsp;invert,&nbsp;0&nbsp;normal)<br></samp><br><br><b><small>Example</small></b><br><br><code>status&nbsp;=&nbsp;pi.bb_serial_invert(17,&nbsp;1)<br></code><h3><a name="bb_serial_read">bb_serial_read<small>(<a href="#user_gpio">user_gpio</a>)</small></h3>
-Returns data from the bit bang serial cyclic buffer.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31&nbsp;(opened&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_serial_read_open">bb_serial_read_open</a>)<br></samp><br><br>The returned value is a tuple of the number of bytes read and a
-bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br>The bytes returned for each character depend upon the number of
-data bits <a href="#bb_bits">bb_bits</a> specified in the <a href="#bb_serial_read_open">bb_serial_read_open</a>
-command.
-<br><br>For <a href="#bb_bits">bb_bits</a> 1-8 there will be one byte per character.
-For <a href="#bb_bits">bb_bits</a> 9-16 there will be two bytes per character.
-For <a href="#bb_bits">bb_bits</a> 17-32 there will be four bytes per character.
-<br><br><b><small>Example</small></b><br><br><code>(count,&nbsp;data)&nbsp;=&nbsp;pi.bb_serial_read(4)<br></code><h3><a name="bb_serial_read_close">bb_serial_read_close<small>(<a href="#user_gpio">user_gpio</a>)</small></h3>
-Closes a GPIO for bit bang reading of serial data.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31&nbsp;(opened&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_serial_read_open">bb_serial_read_open</a>)<br></samp><br><br><b><small>Example</small></b><br><br><code>status&nbsp;=&nbsp;pi.bb_serial_read_close(17)<br></code><h3><a name="bb_serial_read_open">bb_serial_read_open<small>(<a href="#user_gpio">user_gpio</a>, <a href="#baud">baud</a>, <a href="#bb_bits">bb_bits</a>)</small></h3>
-Opens a GPIO for bit bang reading of serial data.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31,&nbsp;the&nbsp;GPIO&nbsp;to&nbsp;use.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:=&nbsp;50-250000,&nbsp;the&nbsp;baud&nbsp;rate.<br>&nbsp;&nbsp;bb_bits:=&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bits&nbsp;per&nbsp;word,&nbsp;default&nbsp;8.<br></samp><br><br>The serial data is held in a cyclic buffer and is read using
-<a href="#bb_serial_read">bb_serial_read</a>.
-<br><br>It is the caller's responsibility to read data from the cyclic
-buffer in a timely fashion.
-<br><br><b><small>Example</small></b><br><br><code>status&nbsp;=&nbsp;pi.bb_serial_read_open(4,&nbsp;19200)<br>status&nbsp;=&nbsp;pi.bb_serial_read_open(17,&nbsp;9600)<br></code><h3><a name="bb_spi_close">bb_spi_close<small>(<a href="#CS">CS</a>)</small></h3>
-This function stops bit banging SPI on a set of GPIO
-opened with <a href="#bb_spi_open">bb_spi_open</a>.
-<br><br><b><small>Parameters</small></b><br><br><samp>CS:=&nbsp;0-31,&nbsp;the&nbsp;CS&nbsp;GPIO&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_spi_open">bb_spi_open</a><br></samp><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_SPI_GPIO.
-<br><br><b><small>Example</small></b><br><br><code>pi.bb_spi_close(CS)<br></code><h3><a name="bb_spi_open">bb_spi_open<small>(<a href="#CS">CS</a>, <a href="#MISO">MISO</a>, <a href="#MOSI">MOSI</a>, <a href="#SCLK">SCLK</a>, <a href="#baud">baud</a>, <a href="#spi_flags">spi_flags</a>)</small></h3>
-This function selects a set of GPIO for bit banging SPI at a
-specified baud rate.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CS&nbsp;:=&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;MISO&nbsp;:=&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;MOSI&nbsp;:=&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;SCLK&nbsp;:=&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;baud&nbsp;:=&nbsp;50-250000<br>spiFlags&nbsp;:=&nbsp;see&nbsp;below<br></samp><br><br>spiFlags consists of the least significant 22 bits.
-<br><br><code>21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;p&nbsp;&nbsp;m&nbsp;&nbsp;m<br></code><br><br>mm defines the SPI mode, defaults to 0
-<br><br><code>Mode&nbsp;CPOL&nbsp;CPHA<br>&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0<br>&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;1<br>&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;0<br>&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;1<br></code><br><br>The following constants may be used to set the mode:
-<br><br><code>pigpio.SPI_MODE_0<br>pigpio.SPI_MODE_1<br>pigpio.SPI_MODE_2<br>pigpio.SPI_MODE_3<br></code><br><br>Alternatively pigpio.SPI_CPOL and/or pigpio.SPI_CPHA
-may be used.
-<br><br>p is 0 if CS is active low (default) and 1 for active high.
-pigpio.SPI_CS_HIGH_ACTIVE may be used to set this flag.
-<br><br>T is 1 if the least significant bit is transmitted on MOSI first,
-the default (0) shifts the most significant bit out first.
-pigpio.SPI_TX_LSBFIRST may be used to set this flag.
-<br><br>R is 1 if the least significant bit is received on MISO first,
-the default (0) receives the most significant bit first.
-pigpio.SPI_RX_LSBFIRST may be used to set this flag.
-<br><br>The other bits in spiFlags should be set to zero.
-<br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_SPI_BAUD, or
-PI_GPIO_IN_USE.
-<br><br>If more than one device is connected to the SPI bus (defined by
-SCLK, MOSI, and MISO) each must have its own CS.
-<br><br><b><small>Example</small></b><br><br><code>bb_spi_open(10,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;10000,&nbsp;0);&nbsp;//&nbsp;device&nbsp;1<br>bb_spi_open(11,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;20000,&nbsp;3);&nbsp;//&nbsp;device&nbsp;2<br></code><h3><a name="bb_spi_xfer">bb_spi_xfer<small>(<a href="#CS">CS</a>, <a href="#data">data</a>)</small></h3>
-This function executes a bit banged SPI transfer.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;CS:=&nbsp;0-31&nbsp;(as&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_spi_open">bb_spi_open</a>)<br>data:=&nbsp;data&nbsp;to&nbsp;be&nbsp;sent<br></samp><br><br>The returned value is a tuple of the number of bytes read and a
-bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br><b><small>Example</small></b><br><br><code>#!/usr/bin/env&nbsp;python<br><br>import&nbsp;pigpio<br><br>CE0=5<br>CE1=6<br>MISO=13<br>MOSI=19<br>SCLK=12<br><br>pi&nbsp;=&nbsp;pigpio.pi()<br>if&nbsp;not&nbsp;pi.connected:<br>&nbsp;&nbsp;&nbsp;exit()<br><br>pi.bb_spi_open(CE0,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;10000,&nbsp;0)&nbsp;#&nbsp;MCP4251&nbsp;DAC<br>pi.bb_spi_open(CE1,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;20000,&nbsp;3)&nbsp;#&nbsp;MCP3008&nbsp;ADC<br><br>for&nbsp;i&nbsp;in&nbsp;range(256):<br><br>&nbsp;&nbsp;&nbsp;count,&nbsp;data&nbsp;=&nbsp;pi.bb_spi_xfer(CE0,&nbsp;[0,&nbsp;i])&nbsp;#&nbsp;Set&nbsp;DAC&nbsp;value<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;count&nbsp;==&nbsp;2:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count,&nbsp;data&nbsp;=&nbsp;pi.bb_spi_xfer(CE0,&nbsp;[12,&nbsp;0])&nbsp;#&nbsp;Read&nbsp;back&nbsp;DAC<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;count&nbsp;==&nbsp;2:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set_val&nbsp;=&nbsp;data[1]<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count,&nbsp;data&nbsp;=&nbsp;pi.bb_spi_xfer(CE1,&nbsp;[1,&nbsp;128,&nbsp;0])&nbsp;#&nbsp;Read&nbsp;ADC<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;count&nbsp;==&nbsp;3:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;read_val&nbsp;=&nbsp;((data[1]&3)&lt;&lt;8)&nbsp;|&nbsp;data[2]<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print("{}&nbsp;{}".format(set_val,&nbsp;read_val))<br><br>pi.bb_spi_close(CE0)<br>pi.bb_spi_close(CE1)<br><br>pi.stop()<br></code><h3><a name="bsc_i2c">bsc_i2c<small>(<a href="#i2c_address">i2c_address</a>, <a href="#data">data</a>)</small></h3>
-This function allows the Pi to act as a slave I2C device.
-<br><br>This function is not available on the BCM2711 (e.g. as
-used in the Pi4B).
-<br><br>The data bytes (if any) are written to the BSC transmit
-FIFO and the bytes in the BSC receive FIFO are returned.
-<br><br><b><small>Parameters</small></b><br><br><samp>i2c_address:=&nbsp;the&nbsp;I2C&nbsp;slave&nbsp;address.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data:=&nbsp;the&nbsp;data&nbsp;bytes&nbsp;to&nbsp;transmit.<br></samp><br><br>The returned value is a tuple of the status, the number
-of bytes read, and a bytearray containing the read bytes.
-<br><br>See <a href="#bsc_xfer">bsc_xfer</a> for details of the status value.
-<br><br>If there was an error the status will be less than zero
-(and will contain the error code).
-<br><br>Note that an i2c_address of 0 may be used to close
-the BSC device and reassign the used GPIO as inputs.
-<br><br>This example assumes GPIO 2/3 are connected to GPIO 18/19
-(GPIO 10/11 on the BCM2711).
-<br><br><b><small>Example</small></b><br><br><code>#!/usr/bin/env&nbsp;python<br>import&nbsp;time<br>import&nbsp;pigpio<br><br>I2C_ADDR=0x13<br><br>def&nbsp;i2c(id,&nbsp;tick):<br>&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;pi<br><br>&nbsp;&nbsp;&nbsp;&nbsp;s,&nbsp;b,&nbsp;d&nbsp;=&nbsp;pi.bsc_i2c(I2C_ADDR)<br>&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;b:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;d[0]&nbsp;==&nbsp;ord('t'):&nbsp;#&nbsp;116&nbsp;send&nbsp;'HH:MM:SS*'<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print("sent={}&nbsp;FR={}&nbsp;received={}&nbsp;[{}]".<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;format(s&gt;&gt;16,&nbsp;s&0xfff,b,d))<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s,&nbsp;b,&nbsp;d&nbsp;=&nbsp;pi.bsc_i2c(I2C_ADDR,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"{}*".format(time.asctime()[11:19]))<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elif&nbsp;d[0]&nbsp;==&nbsp;ord('d'):&nbsp;#&nbsp;100&nbsp;send&nbsp;'Sun&nbsp;Oct&nbsp;30*'<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print("sent={}&nbsp;FR={}&nbsp;received={}&nbsp;[{}]".<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;format(s&gt;&gt;16,&nbsp;s&0xfff,b,d))<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s,&nbsp;b,&nbsp;d&nbsp;=&nbsp;pi.bsc_i2c(I2C_ADDR,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"{}*".format(time.asctime()[:10]))<br><br>pi&nbsp;=&nbsp;pigpio.pi()<br><br>if&nbsp;not&nbsp;pi.connected:<br>&nbsp;&nbsp;&nbsp;&nbsp;exit()<br><br>#&nbsp;Respond&nbsp;to&nbsp;BSC&nbsp;slave&nbsp;activity<br><br>e&nbsp;=&nbsp;pi.event_callback(pigpio.EVENT_BSC,&nbsp;i2c)<br><br>pi.bsc_i2c(I2C_ADDR)&nbsp;#&nbsp;Configure&nbsp;BSC&nbsp;as&nbsp;I2C&nbsp;slave<br><br>time.sleep(600)<br><br>e.cancel()<br><br>pi.bsc_i2c(0)&nbsp;#&nbsp;Disable&nbsp;BSC&nbsp;peripheral<br><br>pi.stop()<br></code><br><br>While running the above.
-<br><br><code>$&nbsp;i2cdetect&nbsp;-y&nbsp;1<br>&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;1&nbsp;&nbsp;2&nbsp;&nbsp;3&nbsp;&nbsp;4&nbsp;&nbsp;5&nbsp;&nbsp;6&nbsp;&nbsp;7&nbsp;&nbsp;8&nbsp;&nbsp;9&nbsp;&nbsp;a&nbsp;&nbsp;b&nbsp;&nbsp;c&nbsp;&nbsp;d&nbsp;&nbsp;e&nbsp;&nbsp;f<br>00:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>10:&nbsp;--&nbsp;--&nbsp;--&nbsp;13&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>20:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>30:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>40:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>50:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>60:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>70:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br><br>$&nbsp;pigs&nbsp;i2co&nbsp;1&nbsp;0x13&nbsp;0<br>0<br><br>$&nbsp;pigs&nbsp;i2cwd&nbsp;0&nbsp;116<br>$&nbsp;pigs&nbsp;i2crd&nbsp;0&nbsp;9&nbsp;-a<br>9&nbsp;10:13:58*<br><br>$&nbsp;pigs&nbsp;i2cwd&nbsp;0&nbsp;116<br>$&nbsp;pigs&nbsp;i2crd&nbsp;0&nbsp;9&nbsp;-a<br>9&nbsp;10:14:29*<br><br>$&nbsp;pigs&nbsp;i2cwd&nbsp;0&nbsp;100<br>$&nbsp;pigs&nbsp;i2crd&nbsp;0&nbsp;11&nbsp;-a<br>11&nbsp;Sun&nbsp;Oct&nbsp;30*<br><br>$&nbsp;pigs&nbsp;i2cwd&nbsp;0&nbsp;100<br>$&nbsp;pigs&nbsp;i2crd&nbsp;0&nbsp;11&nbsp;-a<br>11&nbsp;Sun&nbsp;Oct&nbsp;30*<br><br>$&nbsp;pigs&nbsp;i2cwd&nbsp;0&nbsp;116<br>$&nbsp;pigs&nbsp;i2crd&nbsp;0&nbsp;9&nbsp;-a<br>9&nbsp;10:23:16*<br><br>$&nbsp;pigs&nbsp;i2cwd&nbsp;0&nbsp;100<br>$&nbsp;pigs&nbsp;i2crd&nbsp;0&nbsp;11&nbsp;-a<br>11&nbsp;Sun&nbsp;Oct&nbsp;30*<br></code><h3><a name="bsc_xfer">bsc_xfer<small>(<a href="#bsc_control">bsc_control</a>, <a href="#data">data</a>)</small></h3>
-This function provides a low-level interface to the SPI/I2C Slave
-peripheral on the BCM chip.
-<br><br>This peripheral allows the Pi to act as a hardware slave device
-on an I2C or SPI bus.
-<br><br>This is not a bit bang version and as such is OS timing
-independent. The bus timing is handled directly by the chip.
-<br><br>The output process is simple. You simply append data to the FIFO
-buffer on the chip. This works like a queue, you add data to the
-queue and the master removes it.
-<br><br>I can't get SPI to work properly. I tried with a
-control word of 0x303 and swapped MISO and MOSI.
-<br><br>The function sets the BSC mode, writes any data in
-the transmit buffer to the BSC transmit FIFO, and
-copies any data in the BSC receive FIFO to the
-receive buffer.
-<br><br><b><small>Parameters</small></b><br><br><samp>bsc_control:=&nbsp;see&nbsp;below<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data:=&nbsp;the&nbsp;data&nbsp;bytes&nbsp;to&nbsp;place&nbsp;in&nbsp;the&nbsp;transmit&nbsp;FIFO.<br></samp><br><br>The returned value is a tuple of the status (see below),
-the number of bytes read, and a bytearray containing the
-read bytes. If there was an error the status will be less
-than zero (and will contain the error code).
-<br><br>Note that the control word sets the BSC mode. The BSC will
-stay in that mode until a different control word is sent.
-<br><br>GPIO used for models other than those based on the BCM2711.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td><td>MOSI</td><td>SCLK</td><td>MISO</td><td>CE</td></tr><tr><td>I2C</td><td>18</td><td>19</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>SPI</td><td>-</td><td>-</td><td>18</td><td>19</td><td>20</td><td>21</td></tr></tbody></table><br><br>GPIO used for models based on the BCM2711 (e.g. the Pi4B).
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td><td>MOSI</td><td>SCLK</td><td>MISO</td><td>CE</td></tr><tr><td>I2C</td><td>10</td><td>11</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>SPI</td><td>-</td><td>-</td><td>10</td><td>11</td><td>9</td><td>8</td></tr></tbody></table><br><br>When a zero control word is received the used GPIO will be reset
-to INPUT mode.
-<br><br>bsc_control consists of the following bits:
-<br><br><code>22&nbsp;21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;IT&nbsp;HC&nbsp;TF&nbsp;IR&nbsp;RE&nbsp;TE&nbsp;BK&nbsp;EC&nbsp;ES&nbsp;PL&nbsp;PH&nbsp;I2&nbsp;SP&nbsp;EN<br></code><br><br>Bits 0-13 are copied unchanged to the BSC CR register. See
-pages 163-165 of the Broadcom peripherals document for full
-details.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>aaaaaaa</td><td>defines the I2C slave address (only relevant in I2C mode)</td></tr><tr><td>IT</td><td>invert transmit status flags</td></tr><tr><td>HC</td><td>enable host control</td></tr><tr><td>TF</td><td>enable test FIFO</td></tr><tr><td>IR</td><td>invert receive status flags</td></tr><tr><td>RE</td><td>enable receive</td></tr><tr><td>TE</td><td>enable transmit</td></tr><tr><td>BK</td><td>abort operation and clear FIFOs</td></tr><tr><td>EC</td><td>send control register as first I2C byte</td></tr><tr><td>ES</td><td>send status register as first I2C byte</td></tr><tr><td>PL</td><td>set SPI polarity high</td></tr><tr><td>PH</td><td>set SPI phase high</td></tr><tr><td>I2</td><td>enable I2C mode</td></tr><tr><td>SP</td><td>enable SPI mode</td></tr><tr><td>EN</td><td>enable BSC peripheral</td></tr></tbody></table><br><br>The status has the following format:
-<br><br><code>20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;RB&nbsp;TE&nbsp;RF&nbsp;TF&nbsp;RE&nbsp;TB<br></code><br><br>Bits 0-15 are copied unchanged from the BSC FR register. See
-pages 165-166 of the Broadcom peripherals document for full
-details.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>SSSSS</td><td>number of bytes successfully copied to transmit FIFO</td></tr><tr><td>RRRRR</td><td>number of bytes in receieve FIFO</td></tr><tr><td>TTTTT</td><td>number of bytes in transmit FIFO</td></tr><tr><td>RB</td><td>receive busy</td></tr><tr><td>TE</td><td>transmit FIFO empty</td></tr><tr><td>RF</td><td>receive FIFO full</td></tr><tr><td>TF</td><td>transmit FIFO full</td></tr><tr><td>RE</td><td>receive FIFO empty</td></tr><tr><td>TB</td><td>transmit busy</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>(status,&nbsp;count,&nbsp;data)&nbsp;=&nbsp;pi.bsc_xfer(0x330305,&nbsp;"Hello!")<br></code><h3><a name="callback">callback<small>(<a href="#user_gpio">user_gpio</a>, <a href="#edge">edge</a>, <a href="#func">func</a>)</small></h3>
-Calls a user supplied function (a callback) whenever the
-specified GPIO edge is detected.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edge:=&nbsp;EITHER_EDGE,&nbsp;RISING_EDGE&nbsp;(default),&nbsp;or&nbsp;FALLING_EDGE.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;func:=&nbsp;user&nbsp;supplied&nbsp;callback&nbsp;function.<br></samp><br><br>The user supplied callback receives three parameters, the GPIO,
-the level, and the tick.
-<br><br><code>Parameter&nbsp;&nbsp;&nbsp;Value&nbsp;&nbsp;&nbsp;&nbsp;Meaning<br><br>GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-31&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;GPIO&nbsp;which&nbsp;has&nbsp;changed&nbsp;state<br><br>level&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;=&nbsp;change&nbsp;to&nbsp;low&nbsp;(a&nbsp;falling&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&nbsp;change&nbsp;to&nbsp;high&nbsp;(a&nbsp;rising&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;=&nbsp;no&nbsp;level&nbsp;change&nbsp;(a&nbsp;watchdog&nbsp;timeout)<br><br>tick&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32&nbsp;bit&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;microseconds&nbsp;since&nbsp;boot<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WARNING:&nbsp;this&nbsp;wraps&nbsp;around&nbsp;from<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4294967295&nbsp;to&nbsp;0&nbsp;roughly&nbsp;every&nbsp;72&nbsp;minutes<br></code><br><br>If a user callback is not specified a default tally callback is
-provided which simply counts edges. The count may be retrieved
-by calling the tally function. The count may be reset to zero
-by calling the reset_tally function.
-<br><br>The callback may be cancelled by calling the cancel function.
-<br><br>A GPIO may have multiple callbacks (although I can't think of
-a reason to do so).
-<br><br>The GPIO are sampled at a rate set when the pigpio daemon
-is started (default 5 us).
-<br><br>The number of samples per second is given in the following table.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;samples<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;per&nbsp;sec<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;1,000,000<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;500,000<br>sample&nbsp;&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;250,000<br>rate&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;200,000<br>(us)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8&nbsp;&nbsp;&nbsp;&nbsp;125,000<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;100,000<br></code><br><br>GPIO level changes shorter than the sample rate may be missed.
-<br><br>The daemon software which generates the callbacks is triggered
-1000 times per second. The callbacks will be called once per
-level change since the last time they were called.
-i.e. The callbacks will get all level changes but there will
-be a latency.
-<br><br>If you want to track the level of more than one GPIO do so by
-maintaining the state in the callback. Do not use <a href="#read">read</a>.
-Remember the event that triggered the callback may have
-happened several milliseconds before and the GPIO may have
-changed level many times since then.
-<br><br><b><small>Example</small></b><br><br><code>def&nbsp;cbf(gpio,&nbsp;level,&nbsp;tick):<br>&nbsp;&nbsp;&nbsp;print(gpio,&nbsp;level,&nbsp;tick)<br><br>cb1&nbsp;=&nbsp;pi.callback(22,&nbsp;pigpio.EITHER_EDGE,&nbsp;cbf)<br><br>cb2&nbsp;=&nbsp;pi.callback(4,&nbsp;pigpio.EITHER_EDGE)<br><br>cb3&nbsp;=&nbsp;pi.callback(17)<br><br>print(cb3.tally())<br><br>cb3.reset_tally()<br><br>cb1.cancel()&nbsp;#&nbsp;To&nbsp;cancel&nbsp;callback&nbsp;cb1.<br></code><h3><a name="clear_bank_1">clear_bank_1<small>(<a href="#bits">bits</a>)</small></h3>
-Clears GPIO 0-31 if the corresponding bit in bits is set.
-<br><br><b><small>Parameters</small></b><br><br><samp>bits:=&nbsp;a&nbsp;32&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;cleared.<br></samp><br><br>A returned status of PI_SOME_PERMITTED indicates that the user
-is not allowed to write to one or more of the GPIO.
-<br><br><b><small>Example</small></b><br><br><code>pi.clear_bank_1(int("111110010000",2))<br></code><h3><a name="clear_bank_2">clear_bank_2<small>(<a href="#bits">bits</a>)</small></h3>
-Clears GPIO 32-53 if the corresponding bit (0-21) in bits is set.
-<br><br><b><small>Parameters</small></b><br><br><samp>bits:=&nbsp;a&nbsp;32&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;cleared.<br></samp><br><br>A returned status of PI_SOME_PERMITTED indicates that the user
-is not allowed to write to one or more of the GPIO.
-<br><br><b><small>Example</small></b><br><br><code>pi.clear_bank_2(0x1010)<br></code><h3><a name="custom_1">custom_1<small>(<a href="#arg1">arg1</a>, <a href="#arg2">arg2</a>, <a href="#argx">argx</a>)</small></h3>
-Calls a pigpio function customised by the user.
-<br><br><b><small>Parameters</small></b><br><br><samp>arg1:=&nbsp;&gt;=0,&nbsp;default&nbsp;0.<br>arg2:=&nbsp;&gt;=0,&nbsp;default&nbsp;0.<br>argx:=&nbsp;extra&nbsp;arguments&nbsp;(each&nbsp;0-255),&nbsp;default&nbsp;empty.<br></samp><br><br>The returned value is an integer which by convention
-should be &gt;=0 for OK and &lt;0 for error.
-<br><br><b><small>Example</small></b><br><br><code>value&nbsp;=&nbsp;pi.custom_1()<br><br>value&nbsp;=&nbsp;pi.custom_1(23)<br><br>value&nbsp;=&nbsp;pi.custom_1(0,&nbsp;55)<br><br>value&nbsp;=&nbsp;pi.custom_1(23,&nbsp;56,&nbsp;[1,&nbsp;5,&nbsp;7])<br><br>value&nbsp;=&nbsp;pi.custom_1(23,&nbsp;56,&nbsp;b"hello")<br><br>value&nbsp;=&nbsp;pi.custom_1(23,&nbsp;56,&nbsp;"hello")<br></code><h3><a name="custom_2">custom_2<small>(<a href="#arg1">arg1</a>, <a href="#argx">argx</a>, <a href="#retMax">retMax</a>)</small></h3>
-Calls a pigpio function customised by the user.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;arg1:=&nbsp;&gt;=0,&nbsp;default&nbsp;0.<br>&nbsp;&nbsp;argx:=&nbsp;extra&nbsp;arguments&nbsp;(each&nbsp;0-255),&nbsp;default&nbsp;empty.<br>retMax:=&nbsp;&gt;=0,&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;return,&nbsp;default&nbsp;8192.<br></samp><br><br>The returned value is a tuple of the number of bytes
-returned and a bytearray containing the bytes. If
-there was an error the number of bytes read will be
-less than zero (and will contain the error code).
-<br><br><b><small>Example</small></b><br><br><code>(count,&nbsp;data)&nbsp;=&nbsp;pi.custom_2()<br><br>(count,&nbsp;data)&nbsp;=&nbsp;pi.custom_2(23)<br><br>(count,&nbsp;data)&nbsp;=&nbsp;pi.custom_2(23,&nbsp;[1,&nbsp;5,&nbsp;7])<br><br>(count,&nbsp;data)&nbsp;=&nbsp;pi.custom_2(23,&nbsp;b"hello")<br><br>(count,&nbsp;data)&nbsp;=&nbsp;pi.custom_2(23,&nbsp;"hello",&nbsp;128)<br></code><h3><a name="delete_script">delete_script<small>(<a href="#script_id">script_id</a>)</small></h3>
-Deletes a stored script.
-<br><br><b><small>Parameters</small></b><br><br><samp>script_id:=&nbsp;id&nbsp;of&nbsp;stored&nbsp;script.<br></samp><br><br><b><small>Example</small></b><br><br><code>status&nbsp;=&nbsp;pi.delete_script(sid)<br></code><h3><a name="event_callback">event_callback<small>(<a href="#event">event</a>, <a href="#func">func</a>)</small></h3>
-Calls a user supplied function (a callback) whenever the
-specified event is signalled.
-<br><br><b><small>Parameters</small></b><br><br><samp>event:=&nbsp;0-31.<br>&nbsp;func:=&nbsp;user&nbsp;supplied&nbsp;callback&nbsp;function.<br></samp><br><br>The user supplied callback receives two parameters, the event id,
-and the tick.
-<br><br>If a user callback is not specified a default tally callback is
-provided which simply counts events. The count may be retrieved
-by calling the tally function. The count may be reset to zero
-by calling the reset_tally function.
-<br><br>The callback may be cancelled by calling the event_cancel function.
-<br><br>An event may have multiple callbacks (although I can't think of
-a reason to do so).
-<br><br><b><small>Example</small></b><br><br><code>def&nbsp;cbf(event,&nbsp;tick):<br>&nbsp;&nbsp;&nbsp;print(event,&nbsp;tick)<br><br>cb1&nbsp;=&nbsp;pi.event_callback(22,&nbsp;cbf)<br><br>cb2&nbsp;=&nbsp;pi.event_callback(4)<br><br>print(cb2.tally())<br><br>cb2.reset_tally()<br><br>cb1.event_cancel()&nbsp;#&nbsp;To&nbsp;cancel&nbsp;callback&nbsp;cb1.<br></code><h3><a name="event_trigger">event_trigger<small>(<a href="#event">event</a>)</small></h3>
-This function signals the occurrence of an event.
-<br><br><b><small>Parameters</small></b><br><br><samp>event:=&nbsp;0-31,&nbsp;the&nbsp;event<br></samp><br><br>Returns 0 if OK, otherwise PI_BAD_EVENT_ID.
-<br><br>An event is a signal used to inform one or more consumers
-to start an action. Each consumer which has registered an
-interest in the event (e.g. by calling <a href="#event_callback">event_callback</a>) will
-be informed by a callback.
-<br><br>One event, EVENT_BSC (31) is predefined. This event is
-auto generated on BSC slave activity.
-<br><br>The meaning of other events is arbitrary.
-<br><br>Note that other than its id and its tick there is no data associated
-with an event.
-<br><br><b><small>Example</small></b><br><br><code>pi.event_trigger(23)<br></code><h3><a name="file_close">file_close<small>(<a href="#handle">handle</a>)</small></h3>
-Closes the file associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#file_open">file_open</a>).<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.file_close(handle)<br></code><h3><a name="file_list">file_list<small>(<a href="#fpattern">fpattern</a>)</small></h3>
-Returns a list of files which match a pattern.
-<br><br><b><small>Parameters</small></b><br><br><samp>fpattern:=&nbsp;file&nbsp;pattern&nbsp;to&nbsp;match.<br></samp><br><br>Returns the number of returned bytes if OK, otherwise
-PI_NO_FILE_ACCESS, or PI_NO_FILE_MATCH.
-<br><br>The pattern must match an entry in /opt/pigpio/access. The
-pattern may contain wildcards. See <a href="#file_open">file_open</a>.
-<br><br>NOTE
-<br><br>The returned value is not the number of files, it is the number
-of bytes in the buffer. The file names are separated by newline
-characters.
-<br><br><b><small>Example</small></b><br><br><code>#!/usr/bin/env&nbsp;python<br><br>import&nbsp;pigpio<br><br>pi&nbsp;=&nbsp;pigpio.pi()<br><br>if&nbsp;not&nbsp;pi.connected:<br>&nbsp;&nbsp;&nbsp;exit()<br><br>#&nbsp;Assumes&nbsp;/opt/pigpio/access&nbsp;contains&nbsp;the&nbsp;following&nbsp;line:<br>#&nbsp;/ram/*.c&nbsp;r<br><br>c,&nbsp;d&nbsp;=&nbsp;pi.file_list("/ram/p*.c")<br>if&nbsp;c&nbsp;&gt;&nbsp;0:<br>&nbsp;&nbsp;&nbsp;print(d)<br><br>pi.stop()<br></code><h3><a name="file_open">file_open<small>(<a href="#file_name">file_name</a>, <a href="#file_mode">file_mode</a>)</small></h3>
-This function returns a handle to a file opened in a specified mode.
-<br><br><b><small>Parameters</small></b><br><br><samp>file_name:=&nbsp;the&nbsp;file&nbsp;to&nbsp;open.<br>file_mode:=&nbsp;the&nbsp;file&nbsp;open&nbsp;mode.<br></samp><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_NO_HANDLE,
-PI_NO_FILE_ACCESS, PI_BAD_FILE_MODE,
-PI_FILE_OPEN_FAILED, or PI_FILE_IS_A_DIR.
-<br><br><b><small>Example</small></b><br><br><code>h&nbsp;=&nbsp;pi.file_open("/home/pi/shared/dir_3/file.txt",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pigpio.FILE_WRITE&nbsp;|&nbsp;pigpio.FILE_CREATE)<br><br>pi.file_write(h,&nbsp;"Hello&nbsp;world")<br><br>pi.file_close(h)<br></code><br><br>File
-<br><br>A file may only be opened if permission is granted by an entry
-in /opt/pigpio/access. This is intended to allow remote access
-to files in a more or less controlled manner.
-<br><br>Each entry in /opt/pigpio/access takes the form of a file path
-which may contain wildcards followed by a single letter permission.
-The permission may be R for read, W for write, U for read/write,
-and N for no access.
-<br><br>Where more than one entry matches a file the most specific rule
-applies. If no entry matches a file then access is denied.
-<br><br>Suppose /opt/pigpio/access contains the following entries:
-<br><br><code>/home/*&nbsp;n<br>/home/pi/shared/dir_1/*&nbsp;w<br>/home/pi/shared/dir_2/*&nbsp;r<br>/home/pi/shared/dir_3/*&nbsp;u<br>/home/pi/shared/dir_1/file.txt&nbsp;n<br></code><br><br>Files may be written in directory dir_1 with the exception
-of file.txt.
-<br><br>Files may be read in directory dir_2.
-<br><br>Files may be read and written in directory dir_3.
-<br><br>If a directory allows read, write, or read/write access then files
-may be created in that directory.
-<br><br>In an attempt to prevent risky permissions the following paths are
-ignored in /opt/pigpio/access:
-<br><br><code>a&nbsp;path&nbsp;containing&nbsp;..<br>a&nbsp;path&nbsp;containing&nbsp;only&nbsp;wildcards&nbsp;(*?)<br>a&nbsp;path&nbsp;containing&nbsp;less&nbsp;than&nbsp;two&nbsp;non-wildcard&nbsp;parts<br></code><br><br>Mode
-<br><br>The mode may have the following values:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Constant</td><td>Value</td><td>Meaning</td></tr><tr><td>FILE_READ</td><td>1</td><td>open file for reading</td></tr><tr><td>FILE_WRITE</td><td>2</td><td>open file for writing</td></tr><tr><td>FILE_RW</td><td>3</td><td>open file for reading and writing</td></tr></tbody></table><br><br>The following values may be or'd into the mode:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Value</td><td>Meaning</td></tr><tr><td>FILE_APPEND</td><td>4</td><td>All writes append data to the end of the file</td></tr><tr><td>FILE_CREATE</td><td>8</td><td>The file is created if it doesn't exist</td></tr><tr><td>FILE_TRUNC</td><td>16</td><td>The file is truncated</td></tr></tbody></table><br><br>Newly created files are owned by root with permissions owner
-read and write.
-<br><br><b><small>Example</small></b><br><br><code>#!/usr/bin/env&nbsp;python<br><br>import&nbsp;pigpio<br><br>pi&nbsp;=&nbsp;pigpio.pi()<br><br>if&nbsp;not&nbsp;pi.connected:<br>&nbsp;&nbsp;&nbsp;exit()<br><br>#&nbsp;Assumes&nbsp;/opt/pigpio/access&nbsp;contains&nbsp;the&nbsp;following&nbsp;line:<br>#&nbsp;/ram/*.c&nbsp;r<br><br>handle&nbsp;=&nbsp;pi.file_open("/ram/pigpio.c",&nbsp;pigpio.FILE_READ)<br><br>done&nbsp;=&nbsp;False<br><br>while&nbsp;not&nbsp;done:<br>&nbsp;&nbsp;&nbsp;c,&nbsp;d&nbsp;=&nbsp;pi.file_read(handle,&nbsp;60000)<br>&nbsp;&nbsp;&nbsp;if&nbsp;c&nbsp;&gt;&nbsp;0:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(d)<br>&nbsp;&nbsp;&nbsp;else:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;done&nbsp;=&nbsp;True<br><br>pi.file_close(handle)<br><br>pi.stop()<br></code><h3><a name="file_read">file_read<small>(<a href="#handle">handle</a>, <a href="#count">count</a>)</small></h3>
-Reads up to count bytes from the file associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#file_open">file_open</a>).<br>&nbsp;count:=&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></samp><br><br>The returned value is a tuple of the number of bytes read and a
-bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br><b><small>Example</small></b><br><br><code>(b,&nbsp;d)&nbsp;=&nbsp;pi.file_read(h2,&nbsp;100)<br>if&nbsp;b&nbsp;&gt;&nbsp;0:<br>&nbsp;&nbsp;&nbsp;#&nbsp;process&nbsp;read&nbsp;data<br></code><h3><a name="file_seek">file_seek<small>(<a href="#handle">handle</a>, <a href="#seek_offset">seek_offset</a>, <a href="#seek_from">seek_from</a>)</small></h3>
-Seeks to a position relative to the start, current position,
-or end of the file. Returns the new position.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#file_open">file_open</a>).<br>seek_offset:=&nbsp;byte&nbsp;offset.<br>&nbsp;&nbsp;seek_from:=&nbsp;FROM_START,&nbsp;FROM_CURRENT,&nbsp;or&nbsp;FROM_END.<br></samp><br><br><b><small>Example</small></b><br><br><code>new_pos&nbsp;=&nbsp;pi.file_seek(h,&nbsp;100,&nbsp;pigpio.FROM_START)<br><br>cur_pos&nbsp;=&nbsp;pi.file_seek(h,&nbsp;0,&nbsp;pigpio.FROM_CURRENT)<br><br>file_size&nbsp;=&nbsp;pi.file_seek(h,&nbsp;0,&nbsp;pigpio.FROM_END)<br></code><h3><a name="file_write">file_write<small>(<a href="#handle">handle</a>, <a href="#data">data</a>)</small></h3>
-Writes the data bytes to the file associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#file_open">file_open</a>).<br>&nbsp;&nbsp;data:=&nbsp;the&nbsp;bytes&nbsp;to&nbsp;write.<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.file_write(h1,&nbsp;b'\x02\x03\x04')<br><br>pi.file_write(h2,&nbsp;b'help')<br><br>pi.file_write(h2,&nbsp;"hello")<br><br>pi.file_write(h1,&nbsp;[2,&nbsp;3,&nbsp;4])<br></code><h3><a name="get_PWM_dutycycle">get_PWM_dutycycle<small>(<a href="#user_gpio">user_gpio</a>)</small></h3>
-Returns the PWM dutycycle being used on the GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31.<br></samp><br><br>Returns the PWM dutycycle.
-<br><br>For normal PWM the dutycycle will be out of the defined range
-for the GPIO (see <a href="#get_PWM_range">get_PWM_range</a>).
-<br><br>If a hardware clock is active on the GPIO the reported
-dutycycle will be 500000 (500k) out of 1000000 (1M).
-<br><br>If hardware PWM is active on the GPIO the reported dutycycle
-will be out of a 1000000 (1M).
-<br><br><b><small>Example</small></b><br><br><code>pi.set_PWM_dutycycle(4,&nbsp;25)<br>print(pi.get_PWM_dutycycle(4))<br>25<br><br>pi.set_PWM_dutycycle(4,&nbsp;203)<br>print(pi.get_PWM_dutycycle(4))<br>203<br></code><h3><a name="get_PWM_frequency">get_PWM_frequency<small>(<a href="#user_gpio">user_gpio</a>)</small></h3>
-Returns the frequency of PWM being used on the GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31.<br></samp><br><br>Returns the frequency (in Hz) used for the GPIO.
-<br><br>For normal PWM the frequency will be that defined for the GPIO
-by <a href="#set_PWM_frequency">set_PWM_frequency</a>.
-<br><br>If a hardware clock is active on the GPIO the reported frequency
-will be that set by <a href="#hardware_clock">hardware_clock</a>.
-<br><br>If hardware PWM is active on the GPIO the reported frequency
-will be that set by <a href="#hardware_PWM">hardware_PWM</a>.
-<br><br><b><small>Example</small></b><br><br><code>pi.set_PWM_frequency(4,0)<br>print(pi.get_PWM_frequency(4))<br>10<br><br>pi.set_PWM_frequency(4,&nbsp;800)<br>print(pi.get_PWM_frequency(4))<br>800<br></code><h3><a name="get_PWM_range">get_PWM_range<small>(<a href="#user_gpio">user_gpio</a>)</small></h3>
-Returns the range of PWM values being used on the GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31.<br></samp><br><br>If a hardware clock or hardware PWM is active on the GPIO
-the reported range will be 1000000 (1M).
-<br><br><b><small>Example</small></b><br><br><code>pi.set_PWM_range(9,&nbsp;500)<br>print(pi.get_PWM_range(9))<br>500<br></code><h3><a name="get_PWM_real_range">get_PWM_real_range<small>(<a href="#user_gpio">user_gpio</a>)</small></h3>
-Returns the real (underlying) range of PWM values being
-used on the GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31.<br></samp><br><br>If a hardware clock is active on the GPIO the reported
-real range will be 1000000 (1M).
-<br><br>If hardware PWM is active on the GPIO the reported real range
-will be approximately 250M divided by the set PWM frequency.
-<br><br><b><small>Example</small></b><br><br><code>pi.set_PWM_frequency(4,&nbsp;800)<br>print(pi.get_PWM_real_range(4))<br>250<br></code><h3><a name="get_current_tick">get_current_tick<small>()</small></h3>
-Returns the current system tick.
-<br><br>Tick is the number of microseconds since system boot. As an
-unsigned 32 bit quantity tick wraps around approximately
-every 71.6 minutes.
-<br><br><b><small>Example</small></b><br><br><code>t1&nbsp;=&nbsp;pi.get_current_tick()<br>time.sleep(1)<br>t2&nbsp;=&nbsp;pi.get_current_tick()<br></code><h3><a name="get_hardware_revision">get_hardware_revision<small>()</small></h3>
-Returns the Pi's hardware revision number.
-<br><br>The hardware revision is the last few characters on the
-Revision line of /proc/cpuinfo.
-<br><br>The revision number can be used to determine the assignment
-of GPIO to pins (see <a href="#gpio">gpio</a>).
-<br><br>There are at least three types of board.
-<br><br>Type 1 boards have hardware revision numbers of 2 and 3.
-<br><br>Type 2 boards have hardware revision numbers of 4, 5, 6, and 15.
-<br><br>Type 3 boards have hardware revision numbers of 16 or greater.
-<br><br>If the hardware revision can not be found or is not a valid
-hexadecimal number the function returns 0.
-<br><br><b><small>Example</small></b><br><br><code>print(pi.get_hardware_revision())<br>2<br></code><h3><a name="get_mode">get_mode<small>(<a href="#gpio">gpio</a>)</small></h3>
-Returns the GPIO mode.
-<br><br><b><small>Parameters</small></b><br><br><samp>gpio:=&nbsp;0-53.<br></samp><br><br>Returns a value as follows
-<br><br><code>0&nbsp;=&nbsp;INPUT<br>1&nbsp;=&nbsp;OUTPUT<br>2&nbsp;=&nbsp;ALT5<br>3&nbsp;=&nbsp;ALT4<br>4&nbsp;=&nbsp;ALT0<br>5&nbsp;=&nbsp;ALT1<br>6&nbsp;=&nbsp;ALT2<br>7&nbsp;=&nbsp;ALT3<br></code><br><br><b><small>Example</small></b><br><br><code>print(pi.get_mode(0))<br>4<br></code><h3><a name="get_pad_strength">get_pad_strength<small>(<a href="#pad">pad</a>)</small></h3>
-This function returns the pad drive strength in mA.
-<br><br><b><small>Parameters</small></b><br><br><samp>pad:=&nbsp;0-2,&nbsp;the&nbsp;pad&nbsp;to&nbsp;get.<br></samp><br><br>Returns the pad drive strength if OK, otherwise PI_BAD_PAD.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>strength&nbsp;=&nbsp;pi.get_pad_strength(0)&nbsp;#&nbsp;Get&nbsp;pad&nbsp;0&nbsp;strength.<br></code><h3><a name="get_pigpio_version">get_pigpio_version<small>()</small></h3>
-Returns the pigpio software version.
-<br><br><b><small>Example</small></b><br><br><code>v&nbsp;=&nbsp;pi.get_pigpio_version()<br></code><h3><a name="get_servo_pulsewidth">get_servo_pulsewidth<small>(<a href="#user_gpio">user_gpio</a>)</small></h3>
-Returns the servo pulsewidth being used on the GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31.<br></samp><br><br>Returns the servo pulsewidth.
-<br><br><b><small>Example</small></b><br><br><code>pi.set_servo_pulsewidth(4,&nbsp;525)<br>print(pi.get_servo_pulsewidth(4))<br>525<br><br>pi.set_servo_pulsewidth(4,&nbsp;2130)<br>print(pi.get_servo_pulsewidth(4))<br>2130<br></code><h3><a name="gpio_trigger">gpio_trigger<small>(<a href="#user_gpio">user_gpio</a>, <a href="#pulse_len">pulse_len</a>, <a href="#level">level</a>)</small></h3>
-Send a trigger pulse to a GPIO. The GPIO is set to
-level for pulse_len microseconds and then reset to not level.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31<br>pulse_len:=&nbsp;1-100<br>&nbsp;&nbsp;&nbsp;&nbsp;level:=&nbsp;0-1<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.gpio_trigger(23,&nbsp;10,&nbsp;1)<br></code><h3><a name="hardware_PWM">hardware_PWM<small>(<a href="#gpio">gpio</a>, <a href="#PWMfreq">PWMfreq</a>, <a href="#PWMduty">PWMduty</a>)</small></h3>
-Starts hardware PWM on a GPIO at the specified frequency
-and dutycycle. Frequencies above 30MHz are unlikely to work.
-<br><br>NOTE: Any waveform started by <a href="#wave_send_once">wave_send_once</a>,
-<a href="#wave_send_repeat">wave_send_repeat</a>, or <a href="#wave_chain">wave_chain</a> will be cancelled.
-<br><br>This function is only valid if the pigpio main clock is PCM.
-The main clock defaults to PCM but may be overridden when the
-pigpio daemon is started (option -t).
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;&nbsp;gpio:=&nbsp;see&nbsp;descripton<br>PWMfreq:=&nbsp;0&nbsp;(off)&nbsp;or&nbsp;1-125M&nbsp;(1-187.5M&nbsp;for&nbsp;the&nbsp;BCM2711).<br>PWMduty:=&nbsp;0&nbsp;(off)&nbsp;to&nbsp;1000000&nbsp;(1M)(fully&nbsp;on).<br></samp><br><br>Returns 0 if OK, otherwise PI_NOT_PERMITTED, PI_BAD_GPIO,
-PI_NOT_HPWM_GPIO, PI_BAD_HPWM_DUTY, PI_BAD_HPWM_FREQ.
-<br><br>The same PWM channel is available on multiple GPIO.
-The latest frequency and dutycycle setting will be used
-by all GPIO which share a PWM channel.
-<br><br>The GPIO must be one of the following:
-<br><br><code>12&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>13&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>18&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;All&nbsp;models<br>19&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br><br>40&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>41&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>45&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>52&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>53&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br></code><br><br>The actual number of steps beween off and fully on is the
-integral part of 250M/PWMfreq (375M/PWMfreq for the BCM2711).
-<br><br>The actual frequency set is 250M/steps (375M/steps
-for the BCM2711).
-<br><br>There will only be a million steps for a PWMfreq of 250
-(375 for the BCM2711). Lower frequencies will have more
-steps and higher frequencies will have fewer steps.
-PWMduty is automatically scaled to take this into account.
-<br><br><b><small>Example</small></b><br><br><code>pi.hardware_PWM(18,&nbsp;800,&nbsp;250000)&nbsp;#&nbsp;800Hz&nbsp;25%&nbsp;dutycycle<br><br>pi.hardware_PWM(18,&nbsp;2000,&nbsp;750000)&nbsp;#&nbsp;2000Hz&nbsp;75%&nbsp;dutycycle<br></code><h3><a name="hardware_clock">hardware_clock<small>(<a href="#gpio">gpio</a>, <a href="#clkfreq">clkfreq</a>)</small></h3>
-Starts a hardware clock on a GPIO at the specified frequency.
-Frequencies above 30MHz are unlikely to work.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;&nbsp;gpio:=&nbsp;see&nbsp;description<br>clkfreq:=&nbsp;0&nbsp;(off)&nbsp;or&nbsp;4689-250M&nbsp;(13184-375M&nbsp;for&nbsp;the&nbsp;BCM2711)<br></samp><br><br>Returns 0 if OK, otherwise PI_NOT_PERMITTED, PI_BAD_GPIO,
-PI_NOT_HCLK_GPIO, PI_BAD_HCLK_FREQ,or PI_BAD_HCLK_PASS.
-<br><br>The same clock is available on multiple GPIO. The latest
-frequency setting will be used by all GPIO which share a clock.
-<br><br>The GPIO must be one of the following:
-<br><br><code>4&nbsp;&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;All&nbsp;models<br>5&nbsp;&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br>6&nbsp;&nbsp;&nbsp;clock&nbsp;2&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>20&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>21&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;Rev.2&nbsp;B&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br><br>32&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>34&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>42&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br>43&nbsp;&nbsp;clock&nbsp;2&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>44&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br></code><br><br>Access to clock 1 is protected by a password as its use will
-likely crash the Pi. The password is given by or'ing 0x5A000000
-with the GPIO number.
-<br><br><b><small>Example</small></b><br><br><code>pi.hardware_clock(4,&nbsp;5000)&nbsp;#&nbsp;5&nbsp;KHz&nbsp;clock&nbsp;on&nbsp;GPIO&nbsp;4<br><br>pi.hardware_clock(4,&nbsp;40000000)&nbsp;#&nbsp;40&nbsp;MHz&nbsp;clock&nbsp;on&nbsp;GPIO&nbsp;4<br></code><h3><a name="i2c_block_process_call">i2c_block_process_call<small>(<a href="#handle">handle</a>, <a href="#reg">reg</a>, <a href="#data">data</a>)</small></h3>
-Writes data bytes to the specified register of the device
-associated with handle and reads a device specified number
-of bytes of data in return.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;&nbsp;reg:=&nbsp;&gt;=0,&nbsp;the&nbsp;device&nbsp;register.<br>&nbsp;&nbsp;data:=&nbsp;the&nbsp;bytes&nbsp;to&nbsp;write.<br></samp><br><br>The SMBus 2.0 documentation states that a minimum of 1 byte may
-be sent and a minimum of 1 byte may be received. The total
-number of bytes sent/received must be 32 or less.
-<br><br>SMBus 2.0 5.5.8 - Block write-block read.
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;reg&nbsp;[A]&nbsp;len(data)&nbsp;[A]&nbsp;data0&nbsp;[A]&nbsp;...&nbsp;datan&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Count]&nbsp;A&nbsp;[Data]&nbsp;...&nbsp;A&nbsp;P<br></code><br><br>The returned value is a tuple of the number of bytes read and a
-bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br><b><small>Example</small></b><br><br><code>(b,&nbsp;d)&nbsp;=&nbsp;pi.i2c_block_process_call(h,&nbsp;10,&nbsp;b'\x02\x05\x00')<br><br>(b,&nbsp;d)&nbsp;=&nbsp;pi.i2c_block_process_call(h,&nbsp;10,&nbsp;b'abcdr')<br><br>(b,&nbsp;d)&nbsp;=&nbsp;pi.i2c_block_process_call(h,&nbsp;10,&nbsp;"abracad")<br><br>(b,&nbsp;d)&nbsp;=&nbsp;pi.i2c_block_process_call(h,&nbsp;10,&nbsp;[2,&nbsp;5,&nbsp;16])<br></code><h3><a name="i2c_close">i2c_close<small>(<a href="#handle">handle</a>)</small></h3>
-Closes the I2C device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.i2c_close(h)<br></code><h3><a name="i2c_open">i2c_open<small>(<a href="#i2c_bus">i2c_bus</a>, <a href="#i2c_address">i2c_address</a>, <a href="#i2c_flags">i2c_flags</a>)</small></h3>
-Returns a handle (&gt;=0) for the device at the I2C bus address.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;&nbsp;&nbsp;i2c_bus:=&nbsp;&gt;=0.<br>i2c_address:=&nbsp;0-0x7F.<br>&nbsp;&nbsp;i2c_flags:=&nbsp;0,&nbsp;no&nbsp;flags&nbsp;are&nbsp;currently&nbsp;defined.<br></samp><br><br>Physically buses 0 and 1 are available on the Pi. Higher
-numbered buses will be available if a kernel supported bus
-multiplexor is being used.
-<br><br>The GPIO used are given in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td></tr><tr><td>I2C 0</td><td>0</td><td>1</td></tr><tr><td>I2C 1</td><td>2</td><td>3</td></tr></tbody></table><br><br>For the SMBus commands the low level transactions are shown
-at the end of the function description. The following
-abbreviations are used:
-<br><br><code>S&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Start&nbsp;bit<br>P&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Stop&nbsp;bit<br>Rd/Wr&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Read/Write&nbsp;bit.&nbsp;Rd&nbsp;equals&nbsp;1,&nbsp;Wr&nbsp;equals&nbsp;0.<br>A,&nbsp;NA&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Accept&nbsp;and&nbsp;not&nbsp;accept&nbsp;bit.<br>Addr&nbsp;&nbsp;(7&nbsp;bits):&nbsp;I2C&nbsp;7&nbsp;bit&nbsp;address.<br>reg&nbsp;&nbsp;&nbsp;(8&nbsp;bits):&nbsp;Command&nbsp;byte,&nbsp;which&nbsp;often&nbsp;selects&nbsp;a&nbsp;register.<br>Data&nbsp;&nbsp;(8&nbsp;bits):&nbsp;A&nbsp;data&nbsp;byte.<br>Count&nbsp;(8&nbsp;bits):&nbsp;A&nbsp;byte&nbsp;defining&nbsp;the&nbsp;length&nbsp;of&nbsp;a&nbsp;block&nbsp;operation.<br><br>[..]:&nbsp;Data&nbsp;sent&nbsp;by&nbsp;the&nbsp;device.<br></code><br><br><b><small>Example</small></b><br><br><code>h&nbsp;=&nbsp;pi.i2c_open(1,&nbsp;0x53)&nbsp;#&nbsp;open&nbsp;device&nbsp;at&nbsp;address&nbsp;0x53&nbsp;on&nbsp;bus&nbsp;1<br></code><h3><a name="i2c_process_call">i2c_process_call<small>(<a href="#handle">handle</a>, <a href="#reg">reg</a>, <a href="#word_val">word_val</a>)</small></h3>
-Writes 16 bits of data to the specified register of the device
-associated with handle and reads 16 bits of data in return.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reg:=&nbsp;&gt;=0,&nbsp;the&nbsp;device&nbsp;register.<br>word_val:=&nbsp;0-65535,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></samp><br><br>SMBus 2.0 5.5.6 - Process call.
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;reg&nbsp;[A]&nbsp;word_val_Low&nbsp;[A]&nbsp;word_val_High&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[DataLow]&nbsp;A&nbsp;[DataHigh]&nbsp;NA&nbsp;P<br></code><br><br><b><small>Example</small></b><br><br><code>r&nbsp;=&nbsp;pi.i2c_process_call(h,&nbsp;4,&nbsp;0x1231)<br>r&nbsp;=&nbsp;pi.i2c_process_call(h,&nbsp;6,&nbsp;0)<br></code><h3><a name="i2c_read_block_data">i2c_read_block_data<small>(<a href="#handle">handle</a>, <a href="#reg">reg</a>)</small></h3>
-Reads a block of up to 32 bytes from the specified register of
-the device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;&nbsp;reg:=&nbsp;&gt;=0,&nbsp;the&nbsp;device&nbsp;register.<br></samp><br><br>SMBus 2.0 5.5.7 - Block read.
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;reg&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Count]&nbsp;A&nbsp;[Data]&nbsp;A&nbsp;[Data]&nbsp;A&nbsp;...&nbsp;A&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><br><br>The amount of returned data is set by the device.
-<br><br>The returned value is a tuple of the number of bytes read and a
-bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br><b><small>Example</small></b><br><br><code>(b,&nbsp;d)&nbsp;=&nbsp;pi.i2c_read_block_data(h,&nbsp;10)<br>if&nbsp;b&nbsp;&gt;=&nbsp;0:<br>&nbsp;&nbsp;&nbsp;#&nbsp;process&nbsp;data<br>else:<br>&nbsp;&nbsp;&nbsp;#&nbsp;process&nbsp;read&nbsp;failure<br></code><h3><a name="i2c_read_byte">i2c_read_byte<small>(<a href="#handle">handle</a>)</small></h3>
-Reads a single byte from the device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br></samp><br><br>SMBus 2.0 5.5.3 - Receive byte.
-<code>S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><br><br><b><small>Example</small></b><br><br><code>b&nbsp;=&nbsp;pi.i2c_read_byte(2)&nbsp;#&nbsp;read&nbsp;a&nbsp;byte&nbsp;from&nbsp;device&nbsp;2<br></code><h3><a name="i2c_read_byte_data">i2c_read_byte_data<small>(<a href="#handle">handle</a>, <a href="#reg">reg</a>)</small></h3>
-Reads a single byte from the specified register of the device
-associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;&nbsp;reg:=&nbsp;&gt;=0,&nbsp;the&nbsp;device&nbsp;register.<br></samp><br><br>SMBus 2.0 5.5.5 - Read byte.
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;reg&nbsp;[A]&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><br><br><b><small>Example</small></b><br><br><code>#&nbsp;read&nbsp;byte&nbsp;from&nbsp;reg&nbsp;17&nbsp;of&nbsp;device&nbsp;2<br>b&nbsp;=&nbsp;pi.i2c_read_byte_data(2,&nbsp;17)<br><br>#&nbsp;read&nbsp;byte&nbsp;from&nbsp;reg&nbsp;&nbsp;1&nbsp;of&nbsp;device&nbsp;0<br>b&nbsp;=&nbsp;pi.i2c_read_byte_data(0,&nbsp;1)<br></code><h3><a name="i2c_read_device">i2c_read_device<small>(<a href="#handle">handle</a>, <a href="#count">count</a>)</small></h3>
-Returns count bytes read from the raw device associated
-with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;count:=&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></samp><br><br><code>S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Data]&nbsp;A&nbsp;[Data]&nbsp;A&nbsp;...&nbsp;A&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><br><br>The returned value is a tuple of the number of bytes read and a
-bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br><b><small>Example</small></b><br><br><code>(count,&nbsp;data)&nbsp;=&nbsp;pi.i2c_read_device(h,&nbsp;12)<br></code><h3><a name="i2c_read_i2c_block_data">i2c_read_i2c_block_data<small>(<a href="#handle">handle</a>, <a href="#reg">reg</a>, <a href="#count">count</a>)</small></h3>
-Reads count bytes from the specified register of the device
-associated with handle . The count may be 1-32.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;&nbsp;reg:=&nbsp;&gt;=0,&nbsp;the&nbsp;device&nbsp;register.<br>&nbsp;count:=&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></samp><br><br><code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;reg&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Data]&nbsp;A&nbsp;[Data]&nbsp;A&nbsp;...&nbsp;A&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><br><br>The returned value is a tuple of the number of bytes read and a
-bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br><b><small>Example</small></b><br><br><code>(b,&nbsp;d)&nbsp;=&nbsp;pi.i2c_read_i2c_block_data(h,&nbsp;4,&nbsp;32)<br>if&nbsp;b&nbsp;&gt;=&nbsp;0:<br>&nbsp;&nbsp;&nbsp;#&nbsp;process&nbsp;data<br>else:<br>&nbsp;&nbsp;&nbsp;#&nbsp;process&nbsp;read&nbsp;failure<br></code><h3><a name="i2c_read_word_data">i2c_read_word_data<small>(<a href="#handle">handle</a>, <a href="#reg">reg</a>)</small></h3>
-Reads a single 16 bit word from the specified register of the
-device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;&nbsp;reg:=&nbsp;&gt;=0,&nbsp;the&nbsp;device&nbsp;register.<br></samp><br><br>SMBus 2.0 5.5.5 - Read word.
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;reg&nbsp;[A]&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[DataLow]&nbsp;A&nbsp;[DataHigh]&nbsp;NA&nbsp;P<br></code><br><br><b><small>Example</small></b><br><br><code>#&nbsp;read&nbsp;word&nbsp;from&nbsp;reg&nbsp;2&nbsp;of&nbsp;device&nbsp;3<br>w&nbsp;=&nbsp;pi.i2c_read_word_data(3,&nbsp;2)<br><br>#&nbsp;read&nbsp;word&nbsp;from&nbsp;reg&nbsp;7&nbsp;of&nbsp;device&nbsp;2<br>w&nbsp;=&nbsp;pi.i2c_read_word_data(2,&nbsp;7)<br></code><h3><a name="i2c_write_block_data">i2c_write_block_data<small>(<a href="#handle">handle</a>, <a href="#reg">reg</a>, <a href="#data">data</a>)</small></h3>
-Writes up to 32 bytes to the specified register of the device
-associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;&nbsp;reg:=&nbsp;&gt;=0,&nbsp;the&nbsp;device&nbsp;register.<br>&nbsp;&nbsp;data:=&nbsp;the&nbsp;bytes&nbsp;to&nbsp;write.<br></samp><br><br>SMBus 2.0 5.5.7 - Block write.
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;reg&nbsp;[A]&nbsp;len(data)&nbsp;[A]&nbsp;data0&nbsp;[A]&nbsp;data1&nbsp;[A]&nbsp;...&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;datan&nbsp;[A]&nbsp;P<br></code><br><br><b><small>Example</small></b><br><br><code>pi.i2c_write_block_data(4,&nbsp;5,&nbsp;b'hello')<br><br>pi.i2c_write_block_data(4,&nbsp;5,&nbsp;"data&nbsp;bytes")<br><br>pi.i2c_write_block_data(5,&nbsp;0,&nbsp;b'\x00\x01\x22')<br><br>pi.i2c_write_block_data(6,&nbsp;2,&nbsp;[0,&nbsp;1,&nbsp;0x22])<br></code><h3><a name="i2c_write_byte">i2c_write_byte<small>(<a href="#handle">handle</a>, <a href="#byte_val">byte_val</a>)</small></h3>
-Sends a single byte to the device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>byte_val:=&nbsp;0-255,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></samp><br><br>SMBus 2.0 5.5.2 - Send byte.
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;byte_val&nbsp;[A]&nbsp;P<br></code><br><br><b><small>Example</small></b><br><br><code>pi.i2c_write_byte(1,&nbsp;17)&nbsp;&nbsp;&nbsp;#&nbsp;send&nbsp;byte&nbsp;&nbsp;&nbsp;17&nbsp;to&nbsp;device&nbsp;1<br>pi.i2c_write_byte(2,&nbsp;0x23)&nbsp;#&nbsp;send&nbsp;byte&nbsp;0x23&nbsp;to&nbsp;device&nbsp;2<br></code><h3><a name="i2c_write_byte_data">i2c_write_byte_data<small>(<a href="#handle">handle</a>, <a href="#reg">reg</a>, <a href="#byte_val">byte_val</a>)</small></h3>
-Writes a single byte to the specified register of the device
-associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reg:=&nbsp;&gt;=0,&nbsp;the&nbsp;device&nbsp;register.<br>byte_val:=&nbsp;0-255,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></samp><br><br>SMBus 2.0 5.5.4 - Write byte.
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;reg&nbsp;[A]&nbsp;byte_val&nbsp;[A]&nbsp;P<br></code><br><br><b><small>Example</small></b><br><br><code>#&nbsp;send&nbsp;byte&nbsp;0xC5&nbsp;to&nbsp;reg&nbsp;2&nbsp;of&nbsp;device&nbsp;1<br>pi.i2c_write_byte_data(1,&nbsp;2,&nbsp;0xC5)<br><br>#&nbsp;send&nbsp;byte&nbsp;9&nbsp;to&nbsp;reg&nbsp;4&nbsp;of&nbsp;device&nbsp;2<br>pi.i2c_write_byte_data(2,&nbsp;4,&nbsp;9)<br></code><h3><a name="i2c_write_device">i2c_write_device<small>(<a href="#handle">handle</a>, <a href="#data">data</a>)</small></h3>
-Writes the data bytes to the raw device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;data:=&nbsp;the&nbsp;bytes&nbsp;to&nbsp;write.<br></samp><br><br><code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;data0&nbsp;[A]&nbsp;data1&nbsp;[A]&nbsp;...&nbsp;[A]&nbsp;datan&nbsp;[A]&nbsp;P<br></code><br><br><b><small>Example</small></b><br><br><code>pi.i2c_write_device(h,&nbsp;b"\x12\x34\xA8")<br><br>pi.i2c_write_device(h,&nbsp;b"help")<br><br>pi.i2c_write_device(h,&nbsp;'help')<br><br>pi.i2c_write_device(h,&nbsp;[23,&nbsp;56,&nbsp;231])<br></code><h3><a name="i2c_write_i2c_block_data">i2c_write_i2c_block_data<small>(<a href="#handle">handle</a>, <a href="#reg">reg</a>, <a href="#data">data</a>)</small></h3>
-Writes data bytes to the specified register of the device
-associated with handle . 1-32 bytes may be written.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;&nbsp;reg:=&nbsp;&gt;=0,&nbsp;the&nbsp;device&nbsp;register.<br>&nbsp;&nbsp;data:=&nbsp;the&nbsp;bytes&nbsp;to&nbsp;write.<br></samp><br><br><code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;reg&nbsp;[A]&nbsp;data0&nbsp;[A]&nbsp;data1&nbsp;[A]&nbsp;...&nbsp;[A]&nbsp;datan&nbsp;[NA]&nbsp;P<br></code><br><br><b><small>Example</small></b><br><br><code>pi.i2c_write_i2c_block_data(4,&nbsp;5,&nbsp;'hello')<br><br>pi.i2c_write_i2c_block_data(4,&nbsp;5,&nbsp;b'hello')<br><br>pi.i2c_write_i2c_block_data(5,&nbsp;0,&nbsp;b'\x00\x01\x22')<br><br>pi.i2c_write_i2c_block_data(6,&nbsp;2,&nbsp;[0,&nbsp;1,&nbsp;0x22])<br></code><h3><a name="i2c_write_quick">i2c_write_quick<small>(<a href="#handle">handle</a>, <a href="#bit">bit</a>)</small></h3>
-Sends a single bit to the device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;&nbsp;bit:=&nbsp;0&nbsp;or&nbsp;1,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></samp><br><br>SMBus 2.0 5.5.1 - Quick command.
-<code>S&nbsp;Addr&nbsp;bit&nbsp;[A]&nbsp;P<br></code><br><br><b><small>Example</small></b><br><br><code>pi.i2c_write_quick(0,&nbsp;1)&nbsp;#&nbsp;send&nbsp;1&nbsp;to&nbsp;device&nbsp;0<br>pi.i2c_write_quick(3,&nbsp;0)&nbsp;#&nbsp;send&nbsp;0&nbsp;to&nbsp;device&nbsp;3<br></code><h3><a name="i2c_write_word_data">i2c_write_word_data<small>(<a href="#handle">handle</a>, <a href="#reg">reg</a>, <a href="#word_val">word_val</a>)</small></h3>
-Writes a single 16 bit word to the specified register of the
-device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reg:=&nbsp;&gt;=0,&nbsp;the&nbsp;device&nbsp;register.<br>word_val:=&nbsp;0-65535,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></samp><br><br>SMBus 2.0 5.5.4 - Write word.
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;reg&nbsp;[A]&nbsp;word_val_Low&nbsp;[A]&nbsp;word_val_High&nbsp;[A]&nbsp;P<br></code><br><br><b><small>Example</small></b><br><br><code>#&nbsp;send&nbsp;word&nbsp;0xA0C5&nbsp;to&nbsp;reg&nbsp;5&nbsp;of&nbsp;device&nbsp;4<br>pi.i2c_write_word_data(4,&nbsp;5,&nbsp;0xA0C5)<br><br>#&nbsp;send&nbsp;word&nbsp;2&nbsp;to&nbsp;reg&nbsp;2&nbsp;of&nbsp;device&nbsp;5<br>pi.i2c_write_word_data(5,&nbsp;2,&nbsp;23)<br></code><h3><a name="i2c_zip">i2c_zip<small>(<a href="#handle">handle</a>, <a href="#data">data</a>)</small></h3>
-This function executes a sequence of I2C operations. The
-operations to be performed are specified by the contents of data
-which contains the concatenated command codes and associated data.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;data:=&nbsp;the&nbsp;concatenated&nbsp;I2C&nbsp;commands,&nbsp;see&nbsp;below<br></samp><br><br>The returned value is a tuple of the number of bytes read and a
-bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br><b><small>Example</small></b><br><br><code>(count,&nbsp;data)&nbsp;=&nbsp;pi.i2c_zip(h,&nbsp;[4,&nbsp;0x53,&nbsp;7,&nbsp;1,&nbsp;0x32,&nbsp;6,&nbsp;6,&nbsp;0])<br></code><br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>End</td><td>0</td><td>No more commands</td></tr><tr><td>Escape</td><td>1</td><td>Next P is two bytes</td></tr><tr><td>On</td><td>2</td><td>Switch combined flag on</td></tr><tr><td>Off</td><td>3</td><td>Switch combined flag off</td></tr><tr><td>Address</td><td>4 P</td><td>Set I2C address to P</td></tr><tr><td>Flags</td><td>5 lsb msb</td><td>Set I2C flags to lsb + (msb &lt;&lt; 8)</td></tr><tr><td>Read</td><td>6 P</td><td>Read P bytes of data</td></tr><tr><td>Write</td><td>7 P ...</td><td>Write P bytes of data</td></tr></tbody></table><br><br>The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-<br><br>The address defaults to that associated with the handle.
-The flags default to 0. The address and flags maintain their
-previous value until updated.
-<br><br>Any read I2C data is concatenated in the returned bytearray.
-<br><br><b><small>Example</small></b><br><br><code>Set&nbsp;address&nbsp;0x53,&nbsp;write&nbsp;0x32,&nbsp;read&nbsp;6&nbsp;bytes<br>Set&nbsp;address&nbsp;0x1E,&nbsp;write&nbsp;0x03,&nbsp;read&nbsp;6&nbsp;bytes<br>Set&nbsp;address&nbsp;0x68,&nbsp;write&nbsp;0x1B,&nbsp;read&nbsp;8&nbsp;bytes<br>End<br><br>0x04&nbsp;0x53&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x32&nbsp;&nbsp;&nbsp;0x06&nbsp;0x06<br>0x04&nbsp;0x1E&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x03&nbsp;&nbsp;&nbsp;0x06&nbsp;0x06<br>0x04&nbsp;0x68&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x1B&nbsp;&nbsp;&nbsp;0x06&nbsp;0x08<br>0x00<br></code><h3><a name="notify_begin">notify_begin<small>(<a href="#handle">handle</a>, <a href="#bits">bits</a>)</small></h3>
-Starts notifications on a handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#notify_open">notify_open</a>)<br>&nbsp;&nbsp;bits:=&nbsp;a&nbsp;32&nbsp;bit&nbsp;mask&nbsp;indicating&nbsp;the&nbsp;GPIO&nbsp;to&nbsp;be&nbsp;notified.<br></samp><br><br>The notification sends state changes for each GPIO whose
-corresponding bit in bits is set.
-<br><br>The following code starts notifications for GPIO 1, 4,
-6, 7, and 10 (1234 = 0x04D2 = 0b0000010011010010).
-<br><br><b><small>Example</small></b><br><br><code>h&nbsp;=&nbsp;pi.notify_open()<br>if&nbsp;h&nbsp;&gt;=&nbsp;0:<br>&nbsp;&nbsp;&nbsp;pi.notify_begin(h,&nbsp;1234)<br></code><h3><a name="notify_close">notify_close<small>(<a href="#handle">handle</a>)</small></h3>
-Stops notifications on a handle and releases the handle for reuse.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#notify_open">notify_open</a>)<br></samp><br><br><b><small>Example</small></b><br><br><code>h&nbsp;=&nbsp;pi.notify_open()<br>if&nbsp;h&nbsp;&gt;=&nbsp;0:<br>&nbsp;&nbsp;&nbsp;pi.notify_begin(h,&nbsp;1234)<br>&nbsp;&nbsp;&nbsp;...<br>&nbsp;&nbsp;&nbsp;pi.notify_close(h)<br>&nbsp;&nbsp;&nbsp;...<br></code><h3><a name="notify_open">notify_open<small>()</small></h3>
-Returns a notification handle (&gt;=0).
-<br><br>A notification is a method for being notified of GPIO state
-changes via a pipe.
-<br><br>Pipes are only accessible from the local machine so this
-function serves no purpose if you are using Python from a
-remote machine. The in-built (socket) notifications
-provided by <a href="#callback">callback</a> should be used instead.
-<br><br>Notifications for handle x will be available at the pipe
-named /dev/pigpiox (where x is the handle number).
-<br><br>E.g. if the function returns 15 then the notifications must be
-read from /dev/pigpio15.
-<br><br>Notifications have the following structure:
-<br><br><code>H&nbsp;seqno<br>H&nbsp;flags<br>I&nbsp;tick<br>I&nbsp;level<br></code><br><br>seqno: starts at 0 each time the handle is opened and then
-increments by one for each report.
-<br><br>flags: three flags are defined, PI_NTFY_FLAGS_WDOG,
-PI_NTFY_FLAGS_ALIVE, and PI_NTFY_FLAGS_EVENT.
-<br><br>If bit 5 is set (PI_NTFY_FLAGS_WDOG) then bits 0-4 of the
-flags indicate a GPIO which has had a watchdog timeout.
-<br><br>If bit 6 is set (PI_NTFY_FLAGS_ALIVE) this indicates a keep
-alive signal on the pipe/socket and is sent once a minute
-in the absence of other notification activity.
-<br><br>If bit 7 is set (PI_NTFY_FLAGS_EVENT) then bits 0-4 of the
-flags indicate an event which has been triggered.
-<br><br>tick: the number of microseconds since system boot. It wraps
-around after 1h12m.
-<br><br>level: indicates the level of each GPIO. If bit 1&lt;&lt;x is set
-then GPIO x is high.
-<br><br><b><small>Example</small></b><br><br><code>h&nbsp;=&nbsp;pi.notify_open()<br>if&nbsp;h&nbsp;&gt;=&nbsp;0:<br>&nbsp;&nbsp;&nbsp;pi.notify_begin(h,&nbsp;1234)<br></code><h3><a name="notify_pause">notify_pause<small>(<a href="#handle">handle</a>)</small></h3>
-Pauses notifications on a handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#notify_open">notify_open</a>)<br></samp><br><br>Notifications for the handle are suspended until
-<a href="#notify_begin">notify_begin</a> is called again.
-<br><br><b><small>Example</small></b><br><br><code>h&nbsp;=&nbsp;pi.notify_open()<br>if&nbsp;h&nbsp;&gt;=&nbsp;0:<br>&nbsp;&nbsp;&nbsp;pi.notify_begin(h,&nbsp;1234)<br>&nbsp;&nbsp;&nbsp;...<br>&nbsp;&nbsp;&nbsp;pi.notify_pause(h)<br>&nbsp;&nbsp;&nbsp;...<br>&nbsp;&nbsp;&nbsp;pi.notify_begin(h,&nbsp;1234)<br>&nbsp;&nbsp;&nbsp;...<br></code><h3><a name="read">read<small>(<a href="#gpio">gpio</a>)</small></h3>
-Returns the GPIO level.
-<br><br><b><small>Parameters</small></b><br><br><samp>gpio:=&nbsp;0-53.<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.set_mode(23,&nbsp;pigpio.INPUT)<br><br>pi.set_pull_up_down(23,&nbsp;pigpio.PUD_DOWN)<br>print(pi.read(23))<br>0<br><br>pi.set_pull_up_down(23,&nbsp;pigpio.PUD_UP)<br>print(pi.read(23))<br>1<br></code><h3><a name="read_bank_1">read_bank_1<small>()</small></h3>
-Returns the levels of the bank 1 GPIO (GPIO 0-31).
-<br><br>The returned 32 bit integer has a bit set if the corresponding
-GPIO is high. GPIO n has bit value (1&lt;&lt;n).
-<br><br><b><small>Example</small></b><br><br><code>print(bin(pi.read_bank_1()))<br>0b10010100000011100100001001111<br></code><h3><a name="read_bank_2">read_bank_2<small>()</small></h3>
-Returns the levels of the bank 2 GPIO (GPIO 32-53).
-<br><br>The returned 32 bit integer has a bit set if the corresponding
-GPIO is high. GPIO n has bit value (1&lt;&lt;(n-32)).
-<br><br><b><small>Example</small></b><br><br><code>print(bin(pi.read_bank_2()))<br>0b1111110000000000000000<br></code><h3><a name="run_script">run_script<small>(<a href="#script_id">script_id</a>, <a href="#params">params</a>)</small></h3>
-Runs a stored script.
-<br><br><b><small>Parameters</small></b><br><br><samp>script_id:=&nbsp;id&nbsp;of&nbsp;stored&nbsp;script.<br>&nbsp;&nbsp;&nbsp;params:=&nbsp;up&nbsp;to&nbsp;10&nbsp;parameters&nbsp;required&nbsp;by&nbsp;the&nbsp;script.<br></samp><br><br><b><small>Example</small></b><br><br><code>s&nbsp;=&nbsp;pi.run_script(sid,&nbsp;[par1,&nbsp;par2])<br><br>s&nbsp;=&nbsp;pi.run_script(sid)<br><br>s&nbsp;=&nbsp;pi.run_script(sid,&nbsp;[1,&nbsp;2,&nbsp;3,&nbsp;4,&nbsp;5,&nbsp;6,&nbsp;7,&nbsp;8,&nbsp;9,&nbsp;10])<br></code><h3><a name="script_status">script_status<small>(<a href="#script_id">script_id</a>)</small></h3>
-Returns the run status of a stored script as well as the
-current values of parameters 0 to 9.
-<br><br><b><small>Parameters</small></b><br><br><samp>script_id:=&nbsp;id&nbsp;of&nbsp;stored&nbsp;script.<br></samp><br><br>The run status may be
-<br><br><code>PI_SCRIPT_INITING<br>PI_SCRIPT_HALTED<br>PI_SCRIPT_RUNNING<br>PI_SCRIPT_WAITING<br>PI_SCRIPT_FAILED<br></code><br><br>The return value is a tuple of run status and a list of
-the 10 parameters. On error the run status will be negative
-and the parameter list will be empty.
-<br><br><b><small>Example</small></b><br><br><code>(s,&nbsp;pars)&nbsp;=&nbsp;pi.script_status(sid)<br></code><h3><a name="serial_close">serial_close<small>(<a href="#handle">handle</a>)</small></h3>
-Closes the serial device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>).<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.serial_close(h1)<br></code><h3><a name="serial_data_available">serial_data_available<small>(<a href="#handle">handle</a>)</small></h3>
-Returns the number of bytes available to be read from the
-device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>).<br></samp><br><br><b><small>Example</small></b><br><br><code>rdy&nbsp;=&nbsp;pi.serial_data_available(h1)<br><br>if&nbsp;rdy&nbsp;&gt;&nbsp;0:<br>&nbsp;&nbsp;&nbsp;(b,&nbsp;d)&nbsp;=&nbsp;pi.serial_read(h1,&nbsp;rdy)<br></code><h3><a name="serial_open">serial_open<small>(<a href="#tty">tty</a>, <a href="#baud">baud</a>, <a href="#ser_flags">ser_flags</a>)</small></h3>
-Returns a handle for the serial tty device opened
-at baud bits per second. The device name must start
-with /dev/tty or /dev/serial.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tty:=&nbsp;the&nbsp;serial&nbsp;device&nbsp;to&nbsp;open.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:=&nbsp;baud&nbsp;rate&nbsp;in&nbsp;bits&nbsp;per&nbsp;second,&nbsp;see&nbsp;below.<br>ser_flags:=&nbsp;0,&nbsp;no&nbsp;flags&nbsp;are&nbsp;currently&nbsp;defined.<br></samp><br><br>Normally you would only use the <a href="#serial_*">serial_*</a> functions if
-you are or will be connecting to the Pi over a network. If
-you will always run on the local Pi use the standard serial
-module instead.
-<br><br>The baud rate must be one of 50, 75, 110, 134, 150,
-200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
-38400, 57600, 115200, or 230400.
-<br><br><b><small>Example</small></b><br><br><code>h1&nbsp;=&nbsp;pi.serial_open("/dev/ttyAMA0",&nbsp;300)<br><br>h2&nbsp;=&nbsp;pi.serial_open("/dev/ttyUSB1",&nbsp;19200,&nbsp;0)<br><br>h3&nbsp;=&nbsp;pi.serial_open("/dev/serial0",&nbsp;9600)<br></code><h3><a name="serial_read">serial_read<small>(<a href="#handle">handle</a>, <a href="#count">count</a>)</small></h3>
-Reads up to count bytes from the device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>).<br>&nbsp;count:=&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read&nbsp;(defaults&nbsp;to&nbsp;1000).<br></samp><br><br>The returned value is a tuple of the number of bytes read and
-a bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br>If no data is ready a bytes read of zero is returned.
-<b><small>Example</small></b><br><br><code>(b,&nbsp;d)&nbsp;=&nbsp;pi.serial_read(h2,&nbsp;100)<br>if&nbsp;b&nbsp;&gt;&nbsp;0:<br>&nbsp;&nbsp;&nbsp;#&nbsp;process&nbsp;read&nbsp;data<br></code><h3><a name="serial_read_byte">serial_read_byte<small>(<a href="#handle">handle</a>)</small></h3>
-Returns a single byte from the device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>).<br></samp><br><br>If no data is ready a negative error code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>b&nbsp;=&nbsp;pi.serial_read_byte(h1)<br></code><h3><a name="serial_write">serial_write<small>(<a href="#handle">handle</a>, <a href="#data">data</a>)</small></h3>
-Writes the data bytes to the device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>).<br>&nbsp;&nbsp;data:=&nbsp;the&nbsp;bytes&nbsp;to&nbsp;write.<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.serial_write(h1,&nbsp;b'\x02\x03\x04')<br><br>pi.serial_write(h2,&nbsp;b'help')<br><br>pi.serial_write(h2,&nbsp;"hello")<br><br>pi.serial_write(h1,&nbsp;[2,&nbsp;3,&nbsp;4])<br></code><h3><a name="serial_write_byte">serial_write_byte<small>(<a href="#handle">handle</a>, <a href="#byte_val">byte_val</a>)</small></h3>
-Writes a single byte to the device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>).<br>byte_val:=&nbsp;0-255,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.serial_write_byte(h1,&nbsp;23)<br><br>pi.serial_write_byte(h1,&nbsp;ord('Z'))<br></code><h3><a name="set_PWM_dutycycle">set_PWM_dutycycle<small>(<a href="#user_gpio">user_gpio</a>, <a href="#dutycycle">dutycycle</a>)</small></h3>
-Starts (non-zero dutycycle) or stops (0) PWM pulses on the GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31.<br>dutycycle:=&nbsp;0-range&nbsp;(range&nbsp;defaults&nbsp;to&nbsp;255).<br></samp><br><br>The <a href="#set_PWM_range">set_PWM_range</a> function can change the default range of 255.
-<br><br><b><small>Example</small></b><br><br><code>pi.set_PWM_dutycycle(4,&nbsp;&nbsp;&nbsp;0)&nbsp;#&nbsp;PWM&nbsp;off<br>pi.set_PWM_dutycycle(4,&nbsp;&nbsp;64)&nbsp;#&nbsp;PWM&nbsp;1/4&nbsp;on<br>pi.set_PWM_dutycycle(4,&nbsp;128)&nbsp;#&nbsp;PWM&nbsp;1/2&nbsp;on<br>pi.set_PWM_dutycycle(4,&nbsp;192)&nbsp;#&nbsp;PWM&nbsp;3/4&nbsp;on<br>pi.set_PWM_dutycycle(4,&nbsp;255)&nbsp;#&nbsp;PWM&nbsp;full&nbsp;on<br></code><h3><a name="set_PWM_frequency">set_PWM_frequency<small>(<a href="#user_gpio">user_gpio</a>, <a href="#frequency">frequency</a>)</small></h3>
-Sets the frequency (in Hz) of the PWM to be used on the GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31.<br>frequency:=&nbsp;&gt;=0&nbsp;Hz<br></samp><br><br>Returns the numerically closest frequency if OK, otherwise
-PI_BAD_USER_GPIO or PI_NOT_PERMITTED.
-<br><br>If PWM is currently active on the GPIO it will be switched
-off and then back on at the new frequency.
-<br><br>Each GPIO can be independently set to one of 18 different
-PWM frequencies.
-<br><br>The selectable frequencies depend upon the sample rate which
-may be 1, 2, 4, 5, 8, or 10 microseconds (default 5). The
-sample rate is set when the pigpio daemon is started.
-<br><br>The frequencies for each sample rate are:
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hertz<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1:&nbsp;40000&nbsp;20000&nbsp;10000&nbsp;8000&nbsp;5000&nbsp;4000&nbsp;2500&nbsp;2000&nbsp;1600<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1250&nbsp;&nbsp;1000&nbsp;&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;50<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2:&nbsp;20000&nbsp;10000&nbsp;&nbsp;5000&nbsp;4000&nbsp;2500&nbsp;2000&nbsp;1250&nbsp;1000&nbsp;&nbsp;800<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;625&nbsp;&nbsp;&nbsp;500&nbsp;&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;125&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;25<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4:&nbsp;10000&nbsp;&nbsp;5000&nbsp;&nbsp;2500&nbsp;2000&nbsp;1250&nbsp;1000&nbsp;&nbsp;625&nbsp;&nbsp;500&nbsp;&nbsp;400<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;313&nbsp;&nbsp;&nbsp;250&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;125&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;63&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;13<br>sample<br>&nbsp;rate<br>&nbsp;(us)&nbsp;&nbsp;5:&nbsp;&nbsp;8000&nbsp;&nbsp;4000&nbsp;&nbsp;2000&nbsp;1600&nbsp;1000&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;320<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;250&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;&nbsp;160&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;80&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;&nbsp;20&nbsp;&nbsp;&nbsp;10<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8:&nbsp;&nbsp;5000&nbsp;&nbsp;2500&nbsp;&nbsp;1250&nbsp;1000&nbsp;&nbsp;625&nbsp;&nbsp;500&nbsp;&nbsp;313&nbsp;&nbsp;250&nbsp;&nbsp;200<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;156&nbsp;&nbsp;&nbsp;125&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;63&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;31&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;13&nbsp;&nbsp;&nbsp;&nbsp;6<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10:&nbsp;&nbsp;4000&nbsp;&nbsp;2000&nbsp;&nbsp;1000&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;160<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;125&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;&nbsp;80&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;20&nbsp;&nbsp;&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;5<br></code><br><br><b><small>Example</small></b><br><br><code>pi.set_PWM_frequency(4,0)<br>print(pi.get_PWM_frequency(4))<br>10<br><br>pi.set_PWM_frequency(4,100000)<br>print(pi.get_PWM_frequency(4))<br>8000<br></code><h3><a name="set_PWM_range">set_PWM_range<small>(<a href="#user_gpio">user_gpio</a>, <a href="#range_">range_</a>)</small></h3>
-Sets the range of PWM values to be used on the GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;range_:=&nbsp;25-40000.<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.set_PWM_range(9,&nbsp;100)&nbsp;&nbsp;#&nbsp;now&nbsp;&nbsp;25&nbsp;1/4,&nbsp;&nbsp;&nbsp;50&nbsp;1/2,&nbsp;&nbsp;&nbsp;75&nbsp;3/4&nbsp;on<br>pi.set_PWM_range(9,&nbsp;500)&nbsp;&nbsp;#&nbsp;now&nbsp;125&nbsp;1/4,&nbsp;&nbsp;250&nbsp;1/2,&nbsp;&nbsp;375&nbsp;3/4&nbsp;on<br>pi.set_PWM_range(9,&nbsp;3000)&nbsp;#&nbsp;now&nbsp;750&nbsp;1/4,&nbsp;1500&nbsp;1/2,&nbsp;2250&nbsp;3/4&nbsp;on<br></code><h3><a name="set_bank_1">set_bank_1<small>(<a href="#bits">bits</a>)</small></h3>
-Sets GPIO 0-31 if the corresponding bit in bits is set.
-<br><br><b><small>Parameters</small></b><br><br><samp>bits:=&nbsp;a&nbsp;32&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;set.<br></samp><br><br>A returned status of PI_SOME_PERMITTED indicates that the user
-is not allowed to write to one or more of the GPIO.
-<br><br><b><small>Example</small></b><br><br><code>pi.set_bank_1(int("111110010000",2))<br></code><h3><a name="set_bank_2">set_bank_2<small>(<a href="#bits">bits</a>)</small></h3>
-Sets GPIO 32-53 if the corresponding bit (0-21) in bits is set.
-<br><br><b><small>Parameters</small></b><br><br><samp>bits:=&nbsp;a&nbsp;32&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;set.<br></samp><br><br>A returned status of PI_SOME_PERMITTED indicates that the user
-is not allowed to write to one or more of the GPIO.
-<br><br><b><small>Example</small></b><br><br><code>pi.set_bank_2(0x303)<br></code><h3><a name="set_glitch_filter">set_glitch_filter<small>(<a href="#user_gpio">user_gpio</a>, <a href="#steady">steady</a>)</small></h3>
-Sets a glitch filter on a GPIO.
-<br><br>Level changes on the GPIO are not reported unless the level
-has been stable for at least <a href="#steady">steady</a> microseconds. The
-level is then reported. Level changes of less than <a href="#steady">steady</a>
-microseconds are ignored.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;steady:=&nbsp;0-300000<br></samp><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
-<br><br>This filter affects the GPIO samples returned to callbacks set up
-with <a href="#callback">callback</a> and <a href="#wait_for_edge">wait_for_edge</a>.
-<br><br>It does not affect levels read by <a href="#read">read</a>,
-<a href="#read_bank_1">read_bank_1</a>, or <a href="#read_bank_2">read_bank_2</a>.
-<br><br>Each (stable) edge will be timestamped <a href="#steady">steady</a>
-microseconds after it was first detected.
-<br><br><b><small>Example</small></b><br><br><code>pi.set_glitch_filter(23,&nbsp;100)<br></code><h3><a name="set_mode">set_mode<small>(<a href="#gpio">gpio</a>, <a href="#mode">mode</a>)</small></h3>
-Sets the GPIO mode.
-<br><br><b><small>Parameters</small></b><br><br><samp>gpio:=&nbsp;0-53.<br>mode:=&nbsp;INPUT,&nbsp;OUTPUT,&nbsp;ALT0,&nbsp;ALT1,&nbsp;ALT2,&nbsp;ALT3,&nbsp;ALT4,&nbsp;ALT5.<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.set_mode(&nbsp;4,&nbsp;pigpio.INPUT)&nbsp;&nbsp;#&nbsp;GPIO&nbsp;&nbsp;4&nbsp;as&nbsp;input<br>pi.set_mode(17,&nbsp;pigpio.OUTPUT)&nbsp;#&nbsp;GPIO&nbsp;17&nbsp;as&nbsp;output<br>pi.set_mode(24,&nbsp;pigpio.ALT2)&nbsp;&nbsp;&nbsp;#&nbsp;GPIO&nbsp;24&nbsp;as&nbsp;ALT2<br></code><h3><a name="set_noise_filter">set_noise_filter<small>(<a href="#user_gpio">user_gpio</a>, <a href="#steady">steady</a>, <a href="#active">active</a>)</small></h3>
-Sets a noise filter on a GPIO.
-<br><br>Level changes on the GPIO are ignored until a level which has
-been stable for <a href="#steady">steady</a> microseconds is detected. Level
-changes on the GPIO are then reported for <a href="#active">active</a>
-microseconds after which the process repeats.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;steady:=&nbsp;0-300000<br>&nbsp;&nbsp;&nbsp;active:=&nbsp;0-1000000<br></samp><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
-<br><br>This filter affects the GPIO samples returned to callbacks set up
-with <a href="#callback">callback</a> and <a href="#wait_for_edge">wait_for_edge</a>.
-<br><br>It does not affect levels read by <a href="#read">read</a>,
-<a href="#read_bank_1">read_bank_1</a>, or <a href="#read_bank_2">read_bank_2</a>.
-<br><br>Level changes before and after the active period may
-be reported. Your software must be designed to cope with
-such reports.
-<br><br><b><small>Example</small></b><br><br><code>pi.set_noise_filter(23,&nbsp;1000,&nbsp;5000)<br></code><h3><a name="set_pad_strength">set_pad_strength<small>(<a href="#pad">pad</a>, <a href="#pad_strength">pad_strength</a>)</small></h3>
-This function sets the pad drive strength in mA.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pad:=&nbsp;0-2,&nbsp;the&nbsp;pad&nbsp;to&nbsp;set.<br>pad_strength:=&nbsp;1-16&nbsp;mA.<br></samp><br><br>Returns 0 if OK, otherwise PI_BAD_PAD, or PI_BAD_STRENGTH.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>pi.set_pad_strength(2,&nbsp;14)&nbsp;#&nbsp;Set&nbsp;pad&nbsp;2&nbsp;to&nbsp;14&nbsp;mA.<br></code><h3><a name="set_pull_up_down">set_pull_up_down<small>(<a href="#gpio">gpio</a>, <a href="#pud">pud</a>)</small></h3>
-Sets or clears the internal GPIO pull-up/down resistor.
-<br><br><b><small>Parameters</small></b><br><br><samp>gpio:=&nbsp;0-53.<br>&nbsp;pud:=&nbsp;PUD_UP,&nbsp;PUD_DOWN,&nbsp;PUD_OFF.<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.set_pull_up_down(17,&nbsp;pigpio.PUD_OFF)<br>pi.set_pull_up_down(23,&nbsp;pigpio.PUD_UP)<br>pi.set_pull_up_down(24,&nbsp;pigpio.PUD_DOWN)<br></code><h3><a name="set_servo_pulsewidth">set_servo_pulsewidth<small>(<a href="#user_gpio">user_gpio</a>, <a href="#pulsewidth">pulsewidth</a>)</small></h3>
-Starts (500-2500) or stops (0) servo pulses on the GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;user_gpio:=&nbsp;0-31.<br>pulsewidth:=&nbsp;0&nbsp;(off),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;500&nbsp;(most&nbsp;anti-clockwise)&nbsp;-&nbsp;2500&nbsp;(most&nbsp;clockwise).<br></samp><br><br>The selected pulsewidth will continue to be transmitted until
-changed by a subsequent call to set_servo_pulsewidth.
-<br><br>The pulsewidths supported by servos varies and should probably
-be determined by experiment. A value of 1500 should always be
-safe and represents the mid-point of rotation.
-<br><br>You can DAMAGE a servo if you command it to move beyond its
-limits.
-<br><br><b><small>Example</small></b><br><br><code>pi.set_servo_pulsewidth(17,&nbsp;0)&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;off<br>pi.set_servo_pulsewidth(17,&nbsp;1000)&nbsp;#&nbsp;safe&nbsp;anti-clockwise<br>pi.set_servo_pulsewidth(17,&nbsp;1500)&nbsp;#&nbsp;centre<br>pi.set_servo_pulsewidth(17,&nbsp;2000)&nbsp;#&nbsp;safe&nbsp;clockwise<br></code><h3><a name="set_watchdog">set_watchdog<small>(<a href="#user_gpio">user_gpio</a>, <a href="#wdog_timeout">wdog_timeout</a>)</small></h3>
-Sets a watchdog timeout for a GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;&nbsp;user_gpio:=&nbsp;0-31.<br>wdog_timeout:=&nbsp;0-60000.<br></samp><br><br>The watchdog is nominally in milliseconds.
-<br><br>Only one watchdog may be registered per GPIO.
-<br><br>The watchdog may be cancelled by setting timeout to 0.
-<br><br>Once a watchdog has been started callbacks for the GPIO
-will be triggered every timeout interval after the last
-GPIO activity.
-<br><br>The callback will receive the special level TIMEOUT.
-<br><br><b><small>Example</small></b><br><br><code>pi.set_watchdog(23,&nbsp;1000)&nbsp;#&nbsp;1000&nbsp;ms&nbsp;watchdog&nbsp;on&nbsp;GPIO&nbsp;23<br>pi.set_watchdog(23,&nbsp;0)&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;cancel&nbsp;watchdog&nbsp;on&nbsp;GPIO&nbsp;23<br></code><h3><a name="shell">shell<small>(<a href="#shellscr">shellscr</a>, <a href="#pstring">pstring</a>)</small></h3>
-This function uses the system call to execute a shell script
-with the given string as its parameter.
-<br><br><b><small>Parameters</small></b><br><br><samp>shellscr:=&nbsp;the&nbsp;name&nbsp;of&nbsp;the&nbsp;script,&nbsp;only&nbsp;alphanumerics,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'-'&nbsp;and&nbsp;'_'&nbsp;are&nbsp;allowed&nbsp;in&nbsp;the&nbsp;name<br>pstring&nbsp;:=&nbsp;the&nbsp;parameter&nbsp;string&nbsp;to&nbsp;pass&nbsp;to&nbsp;the&nbsp;script<br></samp><br><br>The exit status of the system call is returned if OK,
-otherwise PI_BAD_SHELL_STATUS.
-<br><br><a href="#shellscr">shellscr</a> must exist in /opt/pigpio/cgi and must be executable.
-<br><br>The returned exit status is normally 256 times that set by
-the shell script exit function. If the script can't be
-found 32512 will be returned.
-<br><br>The following table gives some example returned statuses:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Script exit status</td><td>Returned system call status</td></tr><tr><td>1</td><td>256</td></tr><tr><td>5</td><td>1280</td></tr><tr><td>10</td><td>2560</td></tr><tr><td>200</td><td>51200</td></tr><tr><td>script not found</td><td>32512</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>//&nbsp;pass&nbsp;two&nbsp;parameters,&nbsp;hello&nbsp;and&nbsp;world<br>status&nbsp;=&nbsp;pi.shell("scr1",&nbsp;"hello&nbsp;world");<br><br>//&nbsp;pass&nbsp;three&nbsp;parameters,&nbsp;hello,&nbsp;string&nbsp;with&nbsp;spaces,&nbsp;and&nbsp;world<br>status&nbsp;=&nbsp;pi.shell("scr1",&nbsp;"hello&nbsp;'string&nbsp;with&nbsp;spaces'&nbsp;world");<br><br>//&nbsp;pass&nbsp;one&nbsp;parameter,&nbsp;hello&nbsp;string&nbsp;with&nbsp;spaces&nbsp;world<br>status&nbsp;=&nbsp;pi.shell("scr1",&nbsp;"\"hello&nbsp;string&nbsp;with&nbsp;spaces&nbsp;world\"");<br></code><h3><a name="spi_close">spi_close<small>(<a href="#handle">handle</a>)</small></h3>
-Closes the SPI device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>).<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.spi_close(h)<br></code><h3><a name="spi_open">spi_open<small>(<a href="#spi_channel">spi_channel</a>, <a href="#baud">baud</a>, <a href="#spi_flags">spi_flags</a>)</small></h3>
-Returns a handle for the SPI device on the channel. Data
-will be transferred at baud bits per second. The flags
-may be used to modify the default behaviour of 4-wire
-operation, mode 0, active low chip select.
-<br><br>The Pi has two SPI peripherals: main and auxiliary.
-<br><br>The main SPI has two chip selects (channels), the auxiliary
-has three.
-<br><br>The auxiliary SPI is available on all models but the A and B.
-<br><br>The GPIO used are given in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>MISO</td><td>MOSI</td><td>SCLK</td><td>CE0</td><td>CE1</td><td>CE2</td></tr><tr><td>Main SPI</td><td>9</td><td>10</td><td>11</td><td>8</td><td>7</td><td>-</td></tr><tr><td>Aux SPI</td><td>19</td><td>20</td><td>21</td><td>18</td><td>17</td><td>16</td></tr></tbody></table><br><br><b><small>Parameters</small></b><br><br><samp>spi_channel:=&nbsp;0-1&nbsp;(0-2&nbsp;for&nbsp;the&nbsp;auxiliary&nbsp;SPI).<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:=&nbsp;32K-125M&nbsp;(values&nbsp;above&nbsp;30M&nbsp;are&nbsp;unlikely&nbsp;to&nbsp;work).<br>&nbsp;&nbsp;spi_flags:=&nbsp;see&nbsp;below.<br></samp><br><br>spi_flags consists of the least significant 22 bits.
-<br><br><code>21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;W&nbsp;&nbsp;A&nbsp;u2&nbsp;u1&nbsp;u0&nbsp;p2&nbsp;p1&nbsp;p0&nbsp;&nbsp;m&nbsp;&nbsp;m<br></code><br><br>mm defines the SPI mode.
-<br><br>WARNING: modes 1 and 3 do not appear to work on
-the auxiliary SPI.
-<br><br><code>Mode&nbsp;POL&nbsp;PHA<br>&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;0<br>&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;1<br>&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;0<br>&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;1<br></code><br><br>px is 0 if CEx is active low (default) and 1 for active high.
-<br><br>ux is 0 if the CEx GPIO is reserved for SPI (default)
-and 1 otherwise.
-<br><br>A is 0 for the main SPI, 1 for the auxiliary SPI.
-<br><br>W is 0 if the device is not 3-wire, 1 if the device is 3-wire.
-Main SPI only.
-<br><br>nnnn defines the number of bytes (0-15) to write before
-switching the MOSI line to MISO to read data. This field
-is ignored if W is not set. Main SPI only.
-<br><br>T is 1 if the least significant bit is transmitted on MOSI
-first, the default (0) shifts the most significant bit out
-first. Auxiliary SPI only.
-<br><br>R is 1 if the least significant bit is received on MISO
-first, the default (0) receives the most significant bit
-first. Auxiliary SPI only.
-<br><br>bbbbbb defines the word size in bits (0-32). The default (0)
-sets 8 bits per word. Auxiliary SPI only.
-<br><br>The <a href="#spi_read">spi_read</a>, <a href="#spi_write">spi_write</a>, and <a href="#spi_xfer">spi_xfer</a> functions
-transfer data packed into 1, 2, or 4 bytes according to
-the word size in bits.
-<br><br>For bits 1-8 there will be one byte per character.
-For bits 9-16 there will be two bytes per character.
-For bits 17-32 there will be four bytes per character.
-<br><br>Multi-byte transfers are made in least significant byte
-first order.
-<br><br>E.g. to transfer 32 11-bit words data should
-contain 64 bytes.
-<br><br>E.g. to transfer the 14 bit value 0x1ABC send the
-bytes 0xBC followed by 0x1A.
-<br><br>The other bits in flags should be set to zero.
-<br><br><b><small>Example</small></b><br><br><code>#&nbsp;open&nbsp;SPI&nbsp;device&nbsp;on&nbsp;channel&nbsp;1&nbsp;in&nbsp;mode&nbsp;3&nbsp;at&nbsp;50000&nbsp;bits&nbsp;per&nbsp;second<br><br>h&nbsp;=&nbsp;pi.spi_open(1,&nbsp;50000,&nbsp;3)<br></code><h3><a name="spi_read">spi_read<small>(<a href="#handle">handle</a>, <a href="#count">count</a>)</small></h3>
-Reads count bytes from the SPI device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>).<br>&nbsp;count:=&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></samp><br><br>The returned value is a tuple of the number of bytes read and a
-bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br><b><small>Example</small></b><br><br><code>(b,&nbsp;d)&nbsp;=&nbsp;pi.spi_read(h,&nbsp;60)&nbsp;#&nbsp;read&nbsp;60&nbsp;bytes&nbsp;from&nbsp;device&nbsp;h<br>if&nbsp;b&nbsp;==&nbsp;60:<br>&nbsp;&nbsp;&nbsp;#&nbsp;process&nbsp;read&nbsp;data<br>else:<br>&nbsp;&nbsp;&nbsp;#&nbsp;error&nbsp;path<br></code><h3><a name="spi_write">spi_write<small>(<a href="#handle">handle</a>, <a href="#data">data</a>)</small></h3>
-Writes the data bytes to the SPI device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>).<br>&nbsp;&nbsp;data:=&nbsp;the&nbsp;bytes&nbsp;to&nbsp;write.<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.spi_write(0,&nbsp;b'\x02\xc0\x80')&nbsp;#&nbsp;write&nbsp;3&nbsp;bytes&nbsp;to&nbsp;device&nbsp;0<br><br>pi.spi_write(0,&nbsp;b'defgh')&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;write&nbsp;5&nbsp;bytes&nbsp;to&nbsp;device&nbsp;0<br><br>pi.spi_write(0,&nbsp;"def")&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;write&nbsp;3&nbsp;bytes&nbsp;to&nbsp;device&nbsp;0<br><br>pi.spi_write(1,&nbsp;[2,&nbsp;192,&nbsp;128])&nbsp;&nbsp;&nbsp;#&nbsp;write&nbsp;3&nbsp;bytes&nbsp;to&nbsp;device&nbsp;1<br></code><h3><a name="spi_xfer">spi_xfer<small>(<a href="#handle">handle</a>, <a href="#data">data</a>)</small></h3>
-Writes the data bytes to the SPI device associated with handle,
-returning the data bytes read from the device.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>).<br>&nbsp;&nbsp;data:=&nbsp;the&nbsp;bytes&nbsp;to&nbsp;write.<br></samp><br><br>The returned value is a tuple of the number of bytes read and a
-bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br><b><small>Example</small></b><br><br><code>(count,&nbsp;rx_data)&nbsp;=&nbsp;pi.spi_xfer(h,&nbsp;b'\x01\x80\x00')<br><br>(count,&nbsp;rx_data)&nbsp;=&nbsp;pi.spi_xfer(h,&nbsp;[1,&nbsp;128,&nbsp;0])<br><br>(count,&nbsp;rx_data)&nbsp;=&nbsp;pi.spi_xfer(h,&nbsp;b"hello")<br><br>(count,&nbsp;rx_data)&nbsp;=&nbsp;pi.spi_xfer(h,&nbsp;"hello")<br></code><h3><a name="stop">stop<small>()</small></h3>
-Release pigpio resources.
-<br><br><b><small>Example</small></b><br><br><code>pi.stop()<br></code><h3><a name="stop_script">stop_script<small>(<a href="#script_id">script_id</a>)</small></h3>
-Stops a running script.
-<br><br><b><small>Parameters</small></b><br><br><samp>script_id:=&nbsp;id&nbsp;of&nbsp;stored&nbsp;script.<br></samp><br><br><b><small>Example</small></b><br><br><code>status&nbsp;=&nbsp;pi.stop_script(sid)<br></code><h3><a name="store_script">store_script<small>(<a href="#script">script</a>)</small></h3>
-Store a script for later execution.
-<br><br>See <a href="http://abyz.me.uk/rpi/pigpio/pigs.html#Scripts">http://abyz.me.uk/rpi/pigpio/pigs.html#Scripts</a> for
-details.
-<br><br><b><small>Parameters</small></b><br><br><samp>script:=&nbsp;the&nbsp;script&nbsp;text&nbsp;as&nbsp;a&nbsp;series&nbsp;of&nbsp;bytes.<br></samp><br><br>Returns a &gt;=0 script id if OK.
-<br><br><b><small>Example</small></b><br><br><code>sid&nbsp;=&nbsp;pi.store_script(<br>&nbsp;&nbsp;&nbsp;b'tag&nbsp;0&nbsp;w&nbsp;22&nbsp;1&nbsp;mils&nbsp;100&nbsp;w&nbsp;22&nbsp;0&nbsp;mils&nbsp;100&nbsp;dcr&nbsp;p0&nbsp;jp&nbsp;0')<br></code><h3><a name="update_script">update_script<small>(<a href="#script_id">script_id</a>, <a href="#params">params</a>)</small></h3>
-Sets the parameters of a script. The script may or
-may not be running. The first parameters of the script are
-overwritten with the new values.
-<br><br><b><small>Parameters</small></b><br><br><samp>script_id:=&nbsp;id&nbsp;of&nbsp;stored&nbsp;script.<br>&nbsp;&nbsp;&nbsp;params:=&nbsp;up&nbsp;to&nbsp;10&nbsp;parameters&nbsp;required&nbsp;by&nbsp;the&nbsp;script.<br></samp><br><br><b><small>Example</small></b><br><br><code>s&nbsp;=&nbsp;pi.update_script(sid,&nbsp;[par1,&nbsp;par2])<br><br>s&nbsp;=&nbsp;pi.update_script(sid,&nbsp;[1,&nbsp;2,&nbsp;3,&nbsp;4,&nbsp;5,&nbsp;6,&nbsp;7,&nbsp;8,&nbsp;9,&nbsp;10])<br></code><h3><a name="wait_for_edge">wait_for_edge<small>(<a href="#user_gpio">user_gpio</a>, <a href="#edge">edge</a>, <a href="#wait_timeout">wait_timeout</a>)</small></h3>
-Wait for an edge event on a GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;&nbsp;user_gpio:=&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edge:=&nbsp;EITHER_EDGE,&nbsp;RISING_EDGE&nbsp;(default),&nbsp;or<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FALLING_EDGE.<br>wait_timeout:=&nbsp;&gt;=0.0&nbsp;(default&nbsp;60.0).<br></samp><br><br>The function returns when the edge is detected or after
-the number of seconds specified by timeout has expired.
-<br><br>Do not use this function for precise timing purposes,
-the edge is only checked 20 times a second. Whenever
-you need to know the accurate time of GPIO events use
-a <a href="#callback">callback</a> function.
-<br><br>The function returns True if the edge is detected,
-otherwise False.
-<br><br><b><small>Example</small></b><br><br><code>if&nbsp;pi.wait_for_edge(23):<br>&nbsp;&nbsp;&nbsp;print("Rising&nbsp;edge&nbsp;detected")<br>else:<br>&nbsp;&nbsp;&nbsp;print("wait&nbsp;for&nbsp;edge&nbsp;timed&nbsp;out")<br><br>if&nbsp;pi.wait_for_edge(23,&nbsp;pigpio.FALLING_EDGE,&nbsp;5.0):<br>&nbsp;&nbsp;&nbsp;print("Falling&nbsp;edge&nbsp;detected")<br>else:<br>&nbsp;&nbsp;&nbsp;print("wait&nbsp;for&nbsp;falling&nbsp;edge&nbsp;timed&nbsp;out")<br></code><h3><a name="wait_for_event">wait_for_event<small>(<a href="#event">event</a>, <a href="#wait_timeout">wait_timeout</a>)</small></h3>
-Wait for an event.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;event:=&nbsp;0-31.<br>wait_timeout:=&nbsp;&gt;=0.0&nbsp;(default&nbsp;60.0).<br></samp><br><br>The function returns when the event is signalled or after
-the number of seconds specified by timeout has expired.
-<br><br>The function returns True if the event is detected,
-otherwise False.
-<br><br><b><small>Example</small></b><br><br><code>if&nbsp;pi.wait_for_event(23):<br>&nbsp;&nbsp;&nbsp;print("event&nbsp;detected")<br>else:<br>&nbsp;&nbsp;&nbsp;print("wait&nbsp;for&nbsp;event&nbsp;timed&nbsp;out")<br></code><h3><a name="wave_add_generic">wave_add_generic<small>(<a href="#pulses">pulses</a>)</small></h3>
-Adds a list of pulses to the current waveform.
-<br><br><b><small>Parameters</small></b><br><br><samp>pulses:=&nbsp;list&nbsp;of&nbsp;pulses&nbsp;to&nbsp;add&nbsp;to&nbsp;the&nbsp;waveform.<br></samp><br><br>Returns the new total number of pulses in the current waveform.
-<br><br>The pulses are interleaved in time order within the existing
-waveform (if any).
-<br><br>Merging allows the waveform to be built in parts, that is the
-settings for GPIO#1 can be added, and then GPIO#2 etc.
-<br><br>If the added waveform is intended to start after or within
-the existing waveform then the first pulse should consist
-solely of a delay.
-<br><br><b><small>Example</small></b><br><br><code>G1=4<br>G2=24<br><br>pi.set_mode(G1,&nbsp;pigpio.OUTPUT)<br>pi.set_mode(G2,&nbsp;pigpio.OUTPUT)<br><br>flash_500=[]&nbsp;#&nbsp;flash&nbsp;every&nbsp;500&nbsp;ms<br>flash_100=[]&nbsp;#&nbsp;flash&nbsp;every&nbsp;100&nbsp;ms<br><br>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ON&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OFF&nbsp;&nbsp;DELAY<br><br>flash_500.append(pigpio.pulse(1&lt;&lt;G1,&nbsp;1&lt;&lt;G2,&nbsp;500000))<br>flash_500.append(pigpio.pulse(1&lt;&lt;G2,&nbsp;1&lt;&lt;G1,&nbsp;500000))<br><br>flash_100.append(pigpio.pulse(1&lt;&lt;G1,&nbsp;1&lt;&lt;G2,&nbsp;100000))<br>flash_100.append(pigpio.pulse(1&lt;&lt;G2,&nbsp;1&lt;&lt;G1,&nbsp;100000))<br><br>pi.wave_clear()&nbsp;#&nbsp;clear&nbsp;any&nbsp;existing&nbsp;waveforms<br><br>pi.wave_add_generic(flash_500)&nbsp;#&nbsp;500&nbsp;ms&nbsp;flashes<br>f500&nbsp;=&nbsp;pi.wave_create()&nbsp;#&nbsp;create&nbsp;and&nbsp;save&nbsp;id<br><br>pi.wave_add_generic(flash_100)&nbsp;#&nbsp;100&nbsp;ms&nbsp;flashes<br>f100&nbsp;=&nbsp;pi.wave_create()&nbsp;#&nbsp;create&nbsp;and&nbsp;save&nbsp;id<br><br>pi.wave_send_repeat(f500)<br><br>time.sleep(4)<br><br>pi.wave_send_repeat(f100)<br><br>time.sleep(4)<br><br>pi.wave_send_repeat(f500)<br><br>time.sleep(4)<br><br>pi.wave_tx_stop()&nbsp;#&nbsp;stop&nbsp;waveform<br><br>pi.wave_clear()&nbsp;#&nbsp;clear&nbsp;all&nbsp;waveforms<br></code><h3><a name="wave_add_new">wave_add_new<small>()</small></h3>
-Starts a new empty waveform.
-<br><br>You would not normally need to call this function as it is
-automatically called after a waveform is created with the
-<a href="#wave_create">wave_create</a> function.
-<br><br><b><small>Example</small></b><br><br><code>pi.wave_add_new()<br></code><h3><a name="wave_add_serial">wave_add_serial<small>(<a href="#user_gpio">user_gpio</a>, <a href="#baud">baud</a>, <a href="#data">data</a>, <a href="#offset">offset</a>, <a href="#bb_bits">bb_bits</a>, <a href="#bb_stop">bb_stop</a>)</small></h3>
-Adds a waveform representing serial data to the existing
-waveform (if any). The serial data starts <a href="#offset">offset</a>
-microseconds from the start of the waveform.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;GPIO&nbsp;to&nbsp;transmit&nbsp;data.&nbsp;&nbsp;You&nbsp;must&nbsp;set&nbsp;the&nbsp;GPIO&nbsp;mode<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;output.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:=&nbsp;50-1000000&nbsp;bits&nbsp;per&nbsp;second.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data:=&nbsp;the&nbsp;bytes&nbsp;to&nbsp;write.<br>&nbsp;&nbsp;&nbsp;offset:=&nbsp;number&nbsp;of&nbsp;microseconds&nbsp;from&nbsp;the&nbsp;start&nbsp;of&nbsp;the<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;waveform,&nbsp;default&nbsp;0.<br>&nbsp;&nbsp;bb_bits:=&nbsp;number&nbsp;of&nbsp;data&nbsp;bits,&nbsp;default&nbsp;8.<br>&nbsp;&nbsp;bb_stop:=&nbsp;number&nbsp;of&nbsp;stop&nbsp;half&nbsp;bits,&nbsp;default&nbsp;2.<br></samp><br><br>Returns the new total number of pulses in the current waveform.
-<br><br>The serial data is formatted as one start bit, <a href="#bb_bits">bb_bits</a>
-data bits, and <a href="#bb_stop">bb_stop</a>/2 stop bits.
-<br><br>It is legal to add serial data streams with different baud
-rates to the same waveform.
-<br><br>The bytes required for each character depend upon <a href="#bb_bits">bb_bits</a>.
-<br><br>For <a href="#bb_bits">bb_bits</a> 1-8 there will be one byte per character.
-For <a href="#bb_bits">bb_bits</a> 9-16 there will be two bytes per character.
-For <a href="#bb_bits">bb_bits</a> 17-32 there will be four bytes per character.
-<br><br><b><small>Example</small></b><br><br><code>pi.wave_add_serial(4,&nbsp;300,&nbsp;'Hello&nbsp;world')<br><br>pi.wave_add_serial(4,&nbsp;300,&nbsp;b"Hello&nbsp;world")<br><br>pi.wave_add_serial(4,&nbsp;300,&nbsp;b'\x23\x01\x00\x45')<br><br>pi.wave_add_serial(17,&nbsp;38400,&nbsp;[23,&nbsp;128,&nbsp;234],&nbsp;5000)<br></code><h3><a name="wave_chain">wave_chain<small>(<a href="#data">data</a>)</small></h3>
-This function transmits a chain of waveforms.
-<br><br>NOTE: Any hardware PWM started by <a href="#hardware_PWM">hardware_PWM</a>
-will be cancelled.
-<br><br>The waves to be transmitted are specified by the contents
-of data which contains an ordered list of <a href="#wave_id">wave_id</a>s
-and optional command codes and related data.
-<br><br>Returns 0 if OK, otherwise PI_CHAIN_NESTING,
-PI_CHAIN_LOOP_CNT, PI_BAD_CHAIN_LOOP, PI_BAD_CHAIN_CMD,
-PI_CHAIN_COUNTER, PI_BAD_CHAIN_DELAY, PI_CHAIN_TOO_BIG,
-or PI_BAD_WAVE_ID.
-<br><br>Each wave is transmitted in the order specified. A wave
-may occur multiple times per chain.
-<br><br>A blocks of waves may be transmitted multiple times by
-using the loop commands. The block is bracketed by loop
-start and end commands. Loops may be nested.
-<br><br>Delays between waves may be added with the delay command.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>Loop Start</td><td>255 0</td><td>Identify start of a wave block</td></tr><tr><td>Loop Repeat</td><td>255 1 x y</td><td>loop x + y*256 times</td></tr><tr><td>Delay</td><td>255 2 x y</td><td>delay x + y*256 microseconds</td></tr><tr><td>Loop Forever</td><td>255 3</td><td>loop forever</td></tr></tbody></table><br><br>If present Loop Forever must be the last entry in the chain.
-<br><br>The code is currently dimensioned to support a chain with
-roughly 600 entries and 20 loop counters.
-<br><br><b><small>Example</small></b><br><br><code>#!/usr/bin/env&nbsp;python<br><br>import&nbsp;time<br>import&nbsp;pigpio<br><br>WAVES=5<br>GPIO=4<br><br>wid=[0]*WAVES<br><br>pi&nbsp;=&nbsp;pigpio.pi()&nbsp;#&nbsp;Connect&nbsp;to&nbsp;local&nbsp;Pi.<br><br>pi.set_mode(GPIO,&nbsp;pigpio.OUTPUT);<br><br>for&nbsp;i&nbsp;in&nbsp;range(WAVES):<br>&nbsp;&nbsp;&nbsp;pi.wave_add_generic([<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pigpio.pulse(1&lt;&lt;GPIO,&nbsp;0,&nbsp;20),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pigpio.pulse(0,&nbsp;1&lt;&lt;GPIO,&nbsp;(i+1)*200)]);<br><br>&nbsp;&nbsp;&nbsp;wid[i]&nbsp;=&nbsp;pi.wave_create();<br><br>pi.wave_chain([<br>&nbsp;&nbsp;&nbsp;wid[4],&nbsp;wid[3],&nbsp;wid[2],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;transmit&nbsp;waves&nbsp;4+3+2<br>&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[0],&nbsp;wid[0],&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;transmit&nbsp;waves&nbsp;0+0+0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[1],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;transmit&nbsp;waves&nbsp;0+1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;2,&nbsp;0x88,&nbsp;0x13,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;delay&nbsp;5000us<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;30,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;30&nbsp;times)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[2],&nbsp;wid[3],&nbsp;wid[0],&nbsp;#&nbsp;transmit&nbsp;waves&nbsp;2+3+0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[3],&nbsp;wid[1],&nbsp;wid[2],&nbsp;#&nbsp;transmit&nbsp;waves&nbsp;3+1+2<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;10,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;10&nbsp;times)<br>&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;5,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;5&nbsp;times)<br>&nbsp;&nbsp;&nbsp;wid[4],&nbsp;wid[4],&nbsp;wid[4],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;transmit&nbsp;waves&nbsp;4+4+4<br>&nbsp;&nbsp;&nbsp;255,&nbsp;2,&nbsp;0x20,&nbsp;0x4E,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;delay&nbsp;20000us<br>&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[0],&nbsp;wid[0],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;transmit&nbsp;waves&nbsp;0+0+0<br>&nbsp;&nbsp;&nbsp;])<br><br>while&nbsp;pi.wave_tx_busy():<br>&nbsp;&nbsp;&nbsp;time.sleep(0.1);<br><br>for&nbsp;i&nbsp;in&nbsp;range(WAVES):<br>&nbsp;&nbsp;&nbsp;pi.wave_delete(wid[i])<br><br>pi.stop()<br></code><h3><a name="wave_clear">wave_clear<small>()</small></h3>
-Clears all waveforms and any data added by calls to the
-<a href="#wave_add_*">wave_add_*</a> functions.
-<br><br><b><small>Example</small></b><br><br><code>pi.wave_clear()<br></code><h3><a name="wave_create">wave_create<small>()</small></h3>
-Creates a waveform from the data provided by the prior calls
-to the <a href="#wave_add_*">wave_add_*</a> functions.
-<br><br>Returns a wave id (&gt;=0) if OK, otherwise PI_EMPTY_WAVEFORM,
-PI_TOO_MANY_CBS, PI_TOO_MANY_OOL, or PI_NO_WAVEFORM_ID.
-<br><br>The data provided by the <a href="#wave_add_*">wave_add_*</a> functions is consumed by
-this function.
-<br><br>As many waveforms may be created as there is space available.
-The wave id is passed to <a href="#wave_send_*">wave_send_*</a> to specify the waveform
-to transmit.
-<br><br>Normal usage would be
-<br><br>Step 1. <a href="#wave_clear">wave_clear</a> to clear all waveforms and added data.
-<br><br>Step 2. <a href="#wave_add_*">wave_add_*</a> calls to supply the waveform data.
-<br><br>Step 3. <a href="#wave_create">wave_create</a> to create the waveform and get a unique id
-<br><br>Repeat steps 2 and 3 as needed.
-<br><br>Step 4. <a href="#wave_send_*">wave_send_*</a> with the id of the waveform to transmit.
-<br><br>A waveform comprises one or more pulses.
-<br><br>A pulse specifies
-<br><br>1) the GPIO to be switched on at the start of the pulse.
-2) the GPIO to be switched off at the start of the pulse.
-3) the delay in microseconds before the next pulse.
-<br><br>Any or all the fields can be zero. It doesn't make any sense
-to set all the fields to zero (the pulse will be ignored).
-<br><br>When a waveform is started each pulse is executed in order with
-the specified delay between the pulse and the next.
-<br><br><b><small>Example</small></b><br><br><code>wid&nbsp;=&nbsp;pi.wave_create()<br></code><h3><a name="wave_create_and_pad">wave_create_and_pad<small>(<a href="#percent">percent</a>)</small></h3>
-This function creates a waveform like <a href="#wave_create">wave_create</a> but pads the consumed
-resources. Where percent gives the percentage of the resources to use
-(in terms of the theoretical maximum, not the current amount free).
-This allows the reuse of deleted waves while a transmission is active.
-<br><br>Upon success a wave id greater than or equal to 0 is returned, otherwise
-PI_EMPTY_WAVEFORM, PI_TOO_MANY_CBS, PI_TOO_MANY_OOL, or PI_NO_WAVEFORM_ID.
-<br><br><code>percent:&nbsp;0-100,&nbsp;size&nbsp;of&nbsp;waveform&nbsp;as&nbsp;percentage&nbsp;of&nbsp;maximum&nbsp;available.<br></code><br><br>The data provided by the <a href="#wave_add_*">wave_add_*</a> functions are consumed by this
-function.
-<br><br>As many waveforms may be created as there is space available. The
-wave id is passed to <a href="#wave_send_*">wave_send_*</a> to specify the waveform to transmit.
-<br><br>A usage would be the creation of two waves where one is filled while the
-other is being transmitted. Each wave is assigned 50% of the resources.
-This buffer structure allows the transmission of infinite wave sequences.
-<br><br>Normal usage:
-<br><br>Step 1. <a href="#wave_clear">wave_clear</a> to clear all waveforms and added data.
-<br><br>Step 2. <a href="#wave_add_*">wave_add_*</a> calls to supply the waveform data.
-<br><br>Step 3. <a href="#wave_create_and_pad">wave_create_and_pad</a> to create a waveform of uniform size.
-<br><br>Step 4. <a href="#wave_send_*">wave_send_*</a> with the id of the waveform to transmit.
-<br><br>Repeat steps 2-4 as needed.
-<br><br>Step 5. Any wave id can now be deleted and another wave of the same size
- can be created in its place.
-<br><br><b><small>Example</small></b><br><br><code>wid&nbsp;=&nbsp;pi.wave_create_and_pad(50)<br></code><h3><a name="wave_delete">wave_delete<small>(<a href="#wave_id">wave_id</a>)</small></h3>
-This function deletes the waveform with id wave_id.
-<br><br><b><small>Parameters</small></b><br><br><samp>wave_id:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#wave_create">wave_create</a>).<br></samp><br><br>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><b><small>Example</small></b><br><br><code>pi.wave_delete(6)&nbsp;#&nbsp;delete&nbsp;waveform&nbsp;with&nbsp;id&nbsp;6<br><br>pi.wave_delete(0)&nbsp;#&nbsp;delete&nbsp;waveform&nbsp;with&nbsp;id&nbsp;0<br></code><h3><a name="wave_get_cbs">wave_get_cbs<small>()</small></h3>
-Returns the length in DMA control blocks of the current
-waveform.
-<br><br><b><small>Example</small></b><br><br><code>cbs&nbsp;=&nbsp;pi.wave_get_cbs()<br></code><h3><a name="wave_get_max_cbs">wave_get_max_cbs<small>()</small></h3>
-Returns the maximum possible size of a waveform in DMA
-control blocks.
-<br><br><b><small>Example</small></b><br><br><code>cbs&nbsp;=&nbsp;pi.wave_get_max_cbs()<br></code><h3><a name="wave_get_max_micros">wave_get_max_micros<small>()</small></h3>
-Returns the maximum possible size of a waveform in microseconds.
-<br><br><b><small>Example</small></b><br><br><code>micros&nbsp;=&nbsp;pi.wave_get_max_micros()<br></code><h3><a name="wave_get_max_pulses">wave_get_max_pulses<small>()</small></h3>
-Returns the maximum possible size of a waveform in pulses.
-<br><br><b><small>Example</small></b><br><br><code>pulses&nbsp;=&nbsp;pi.wave_get_max_pulses()<br></code><h3><a name="wave_get_micros">wave_get_micros<small>()</small></h3>
-Returns the length in microseconds of the current waveform.
-<br><br><b><small>Example</small></b><br><br><code>micros&nbsp;=&nbsp;pi.wave_get_micros()<br></code><h3><a name="wave_get_pulses">wave_get_pulses<small>()</small></h3>
-Returns the length in pulses of the current waveform.
-<br><br><b><small>Example</small></b><br><br><code>pulses&nbsp;=&nbsp;pi.wave_get_pulses()<br></code><h3><a name="wave_send_once">wave_send_once<small>(<a href="#wave_id">wave_id</a>)</small></h3>
-Transmits the waveform with id wave_id. The waveform is sent
-once.
-<br><br>NOTE: Any hardware PWM started by <a href="#hardware_PWM">hardware_PWM</a> will
-be cancelled.
-<br><br><b><small>Parameters</small></b><br><br><samp>wave_id:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#wave_create">wave_create</a>).<br></samp><br><br>Returns the number of DMA control blocks used in the waveform.
-<br><br><b><small>Example</small></b><br><br><code>cbs&nbsp;=&nbsp;pi.wave_send_once(wid)<br></code><h3><a name="wave_send_repeat">wave_send_repeat<small>(<a href="#wave_id">wave_id</a>)</small></h3>
-Transmits the waveform with id wave_id. The waveform repeats
-until wave_tx_stop is called or another call to <a href="#wave_send_*">wave_send_*</a>
-is made.
-<br><br>NOTE: Any hardware PWM started by <a href="#hardware_PWM">hardware_PWM</a> will
-be cancelled.
-<br><br><b><small>Parameters</small></b><br><br><samp>wave_id:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#wave_create">wave_create</a>).<br></samp><br><br>Returns the number of DMA control blocks used in the waveform.
-<br><br><b><small>Example</small></b><br><br><code>cbs&nbsp;=&nbsp;pi.wave_send_repeat(wid)<br></code><h3><a name="wave_send_using_mode">wave_send_using_mode<small>(<a href="#wave_id">wave_id</a>, <a href="#mode">mode</a>)</small></h3>
-Transmits the waveform with id wave_id using mode mode.
-<br><br><b><small>Parameters</small></b><br><br><samp>wave_id:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#wave_create">wave_create</a>).<br>&nbsp;&nbsp;&nbsp;mode:=&nbsp;WAVE_MODE_ONE_SHOT,&nbsp;WAVE_MODE_REPEAT,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WAVE_MODE_ONE_SHOT_SYNC,&nbsp;or&nbsp;WAVE_MODE_REPEAT_SYNC.<br></samp><br><br>WAVE_MODE_ONE_SHOT: same as <a href="#wave_send_once">wave_send_once</a>.
-<br><br>WAVE_MODE_REPEAT same as <a href="#wave_send_repeat">wave_send_repeat</a>.
-<br><br>WAVE_MODE_ONE_SHOT_SYNC same as <a href="#wave_send_once">wave_send_once</a> but tries
-to sync with the previous waveform.
-<br><br>WAVE_MODE_REPEAT_SYNC same as <a href="#wave_send_repeat">wave_send_repeat</a> but tries
-to sync with the previous waveform.
-<br><br>WARNING: bad things may happen if you delete the previous
-waveform before it has been synced to the new waveform.
-<br><br>NOTE: Any hardware PWM started by <a href="#hardware_PWM">hardware_PWM</a> will
-be cancelled.
-<br><br><b><small>Parameters</small></b><br><br><samp>wave_id:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#wave_create">wave_create</a>).<br></samp><br><br>Returns the number of DMA control blocks used in the waveform.
-<br><br><b><small>Example</small></b><br><br><code>cbs&nbsp;=&nbsp;pi.wave_send_using_mode(wid,&nbsp;WAVE_MODE_REPEAT_SYNC)<br></code><h3><a name="wave_tx_at">wave_tx_at<small>()</small></h3>
-Returns the id of the waveform currently being
-transmitted.
-<br><br>Returns the waveform id or one of the following special
-values:
-<br><br>WAVE_NOT_FOUND (9998) - transmitted wave not found.
-NO_TX_WAVE (9999) - no wave being transmitted.
-<br><br><b><small>Example</small></b><br><br><code>wid&nbsp;=&nbsp;pi.wave_tx_at()<br></code><h3><a name="wave_tx_busy">wave_tx_busy<small>()</small></h3>
-Returns 1 if a waveform is currently being transmitted,
-otherwise 0.
-<br><br><b><small>Example</small></b><br><br><code>pi.wave_send_once(0)&nbsp;#&nbsp;send&nbsp;first&nbsp;waveform<br><br>while&nbsp;pi.wave_tx_busy():&nbsp;#&nbsp;wait&nbsp;for&nbsp;waveform&nbsp;to&nbsp;be&nbsp;sent<br>&nbsp;&nbsp;&nbsp;time.sleep(0.1)<br><br>pi.wave_send_once(1)&nbsp;#&nbsp;send&nbsp;next&nbsp;waveform<br></code><h3><a name="wave_tx_repeat">wave_tx_repeat<small>()</small></h3>
-This function is deprecated and has beeen removed.
-<br><br>Use <a href="#wave_create">wave_create</a>/<a href="#wave_send_*">wave_send_*</a> instead.
-<h3><a name="wave_tx_start">wave_tx_start<small>()</small></h3>
-This function is deprecated and has been removed.
-<br><br>Use <a href="#wave_create">wave_create</a>/<a href="#wave_send_*">wave_send_*</a> instead.
-<h3><a name="wave_tx_stop">wave_tx_stop<small>()</small></h3>
-Stops the transmission of the current waveform.
-<br><br>This function is intended to stop a waveform started with
-wave_send_repeat.
-<br><br><b><small>Example</small></b><br><br><code>pi.wave_send_repeat(3)<br><br>time.sleep(5)<br><br>pi.wave_tx_stop()<br></code><h3><a name="write">write<small>(<a href="#gpio">gpio</a>, <a href="#level">level</a>)</small></h3>
-Sets the GPIO level.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;GPIO:=&nbsp;0-53.<br>level:=&nbsp;0,&nbsp;1.<br></samp><br><br>If PWM or servo pulses are active on the GPIO they are
-switched off.
-<br><br><b><small>Example</small></b><br><br><code>pi.set_mode(17,&nbsp;pigpio.OUTPUT)<br><br>pi.write(17,0)<br>print(pi.read(17))<br>0<br><br>pi.write(17,1)<br>print(pi.read(17))<br>1<br></code><h2> class pulse
-</h2><h3><a name="pigpio.pulse">pigpio.pulse<small>(<a href="#gpio_on">gpio_on</a>, <a href="#gpio_off">gpio_off</a>, <a href="#delay">delay</a>)</small></h3>
-Initialises a pulse.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;gpio_on:=&nbsp;the&nbsp;GPIO&nbsp;to&nbsp;switch&nbsp;on&nbsp;at&nbsp;the&nbsp;start&nbsp;of&nbsp;the&nbsp;pulse.<br>gpio_off:=&nbsp;the&nbsp;GPIO&nbsp;to&nbsp;switch&nbsp;off&nbsp;at&nbsp;the&nbsp;start&nbsp;of&nbsp;the&nbsp;pulse.<br>&nbsp;&nbsp;&nbsp;delay:=&nbsp;the&nbsp;delay&nbsp;in&nbsp;microseconds&nbsp;before&nbsp;the&nbsp;next&nbsp;pulse.<br></samp><h2>FUNCTIONS</h2><h3><a name="pigpio.error_text">pigpio.error_text<small>(<a href="#errnum">errnum</a>)</small></h3>
-Returns a text description of a pigpio error.
-<br><br><b><small>Parameters</small></b><br><br><samp>errnum:=&nbsp;&lt;0,&nbsp;the&nbsp;error&nbsp;number<br></samp><br><br><b><small>Example</small></b><br><br><code>print(pigpio.error_text(-5))<br>level&nbsp;not&nbsp;0-1<br></code><h3><a name="pigpio.tickDiff">pigpio.tickDiff<small>(<a href="#t1">t1</a>, <a href="#t2">t2</a>)</small></h3>
-Returns the microsecond difference between two ticks.
-<br><br><b><small>Parameters</small></b><br><br><samp>t1:=&nbsp;the&nbsp;earlier&nbsp;tick<br>t2:=&nbsp;the&nbsp;later&nbsp;tick<br></samp><br><br><b><small>Example</small></b><br><br><code>print(pigpio.tickDiff(4294967272,&nbsp;12))<br>36<br></code><h3><a name="pigpio.u2i">pigpio.u2i<small>(<a href="#uint32">uint32</a>)</small></h3>
-Converts a 32 bit unsigned number to signed.
-<br><br><b><small>Parameters</small></b><br><br><samp>uint32:=&nbsp;an&nbsp;unsigned&nbsp;32&nbsp;bit&nbsp;number<br></samp><br><br><b><small>Example</small></b><br><br><code>print(u2i(4294967272))<br>-24<br>print(u2i(37))<br>37<br></code><h2>PARAMETERS</h2><h3><a name="active"></a>active: 0-1000000</h3>The number of microseconds level changes are reported for once
-a noise filter has been triggered (by <a href="#steady">steady</a> microseconds of
-a stable level).
-<h3><a name="arg1"></a>arg1: </h3>An unsigned argument passed to a user customised function. Its
-meaning is defined by the customiser.
-<h3><a name="arg2"></a>arg2: </h3>An unsigned argument passed to a user customised function. Its
-meaning is defined by the customiser.
-<h3><a name="argx"></a>argx: </h3>An array of bytes passed to a user customised function.
-Its meaning and content is defined by the customiser.
-<h3><a name="baud"></a>baud: </h3>The speed of serial communication (I2C, SPI, serial link, waves)
-in bits per second.
-<h3><a name="bb_bits"></a>bb_bits: 1-32</h3>The number of data bits to be used when adding serial data to a
-waveform.
-<h3><a name="bb_stop"></a>bb_stop: 2-8</h3>The number of (half) stop bits to be used when adding serial data
-to a waveform.
-<h3><a name="bit"></a>bit: 0-1</h3>A value of 0 or 1.
-<h3><a name="bits"></a>bits: 32 bit number</h3>A mask used to select GPIO to be operated on. If bit n is set
-then GPIO n is selected. A convenient way of setting bit n is to
-bit or in the value (1&lt;&lt;n).
-<br><br>To select GPIO 1, 7, 23
-<br><br>bits = (1&lt;&lt;1) | (1&lt;&lt;7) | (1&lt;&lt;23)
-<h3><a name="bsc_control"></a>bsc_control: </h3><code>22&nbsp;21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;IT&nbsp;HC&nbsp;TF&nbsp;IR&nbsp;RE&nbsp;TE&nbsp;BK&nbsp;EC&nbsp;ES&nbsp;PL&nbsp;PH&nbsp;I2&nbsp;SP&nbsp;EN<br></code><br><br>aaaaaaa defines the I2C slave address (only relevant in I2C mode)
-<br><br>Bits 0-13 are copied unchanged to the BSC CR register. See
-pages 163-165 of the Broadcom peripherals document.
-<h3><a name="byte_val"></a>byte_val: 0-255</h3>A whole number.
-<h3><a name="clkfreq"></a>clkfreq: 4689-250M (13184-375M for the BCM2711)</h3>The hardware clock frequency.
-<h3><a name="connected"></a>connected: </h3>True if a connection was established, False otherwise.
-<h3><a name="count"></a>count: </h3>The number of bytes of data to be transferred.
-<h3><a name="CS"></a>CS: </h3>The GPIO used for the slave select signal when bit banging SPI.
-<h3><a name="data"></a>data: </h3>Data to be transmitted, a series of bytes.
-<h3><a name="delay"></a>delay: &gt;=1</h3>The length of a pulse in microseconds.
-<h3><a name="dutycycle"></a>dutycycle: 0-range_</h3>A number between 0 and range_.
-<br><br>The dutycycle sets the proportion of time on versus time off during each
-PWM cycle.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Dutycycle</td><td>On time</td></tr><tr><td>0</td><td>Off</td></tr><tr><td>range_ * 0.25</td><td>25% On</td></tr><tr><td>range_ * 0.50</td><td>50% On</td></tr><tr><td>range_ * 0.75</td><td>75% On</td></tr><tr><td>range_</td><td>Fully On</td></tr></tbody></table><h3><a name="edge"></a>edge: 0-2</h3><code>EITHER_EDGE&nbsp;=&nbsp;2<br>FALLING_EDGE&nbsp;=&nbsp;1<br>RISING_EDGE&nbsp;=&nbsp;0<br></code><h3><a name="errnum"></a>errnum: &lt;0</h3><code>PI_BAD_USER_GPIO&nbsp;=&nbsp;-2<br>PI_BAD_GPIO&nbsp;=&nbsp;-3<br>PI_BAD_MODE&nbsp;=&nbsp;-4<br>PI_BAD_LEVEL&nbsp;=&nbsp;-5<br>PI_BAD_PUD&nbsp;=&nbsp;-6<br>PI_BAD_PULSEWIDTH&nbsp;=&nbsp;-7<br>PI_BAD_DUTYCYCLE&nbsp;=&nbsp;-8<br>PI_BAD_WDOG_TIMEOUT&nbsp;=&nbsp;-15<br>PI_BAD_DUTYRANGE&nbsp;=&nbsp;-21<br>PI_NO_HANDLE&nbsp;=&nbsp;-24<br>PI_BAD_HANDLE&nbsp;=&nbsp;-25<br>PI_BAD_WAVE_BAUD&nbsp;=&nbsp;-35<br>PI_TOO_MANY_PULSES&nbsp;=&nbsp;-36<br>PI_TOO_MANY_CHARS&nbsp;=&nbsp;-37<br>PI_NOT_SERIAL_GPIO&nbsp;=&nbsp;-38<br>PI_NOT_PERMITTED&nbsp;=&nbsp;-41<br>PI_SOME_PERMITTED&nbsp;=&nbsp;-42<br>PI_BAD_WVSC_COMMND&nbsp;=&nbsp;-43<br>PI_BAD_WVSM_COMMND&nbsp;=&nbsp;-44<br>PI_BAD_WVSP_COMMND&nbsp;=&nbsp;-45<br>PI_BAD_PULSELEN&nbsp;=&nbsp;-46<br>PI_BAD_SCRIPT&nbsp;=&nbsp;-47<br>PI_BAD_SCRIPT_ID&nbsp;=&nbsp;-48<br>PI_BAD_SER_OFFSET&nbsp;=&nbsp;-49<br>PI_GPIO_IN_USE&nbsp;=&nbsp;-50<br>PI_BAD_SERIAL_COUNT&nbsp;=&nbsp;-51<br>PI_BAD_PARAM_NUM&nbsp;=&nbsp;-52<br>PI_DUP_TAG&nbsp;=&nbsp;-53<br>PI_TOO_MANY_TAGS&nbsp;=&nbsp;-54<br>PI_BAD_SCRIPT_CMD&nbsp;=&nbsp;-55<br>PI_BAD_VAR_NUM&nbsp;=&nbsp;-56<br>PI_NO_SCRIPT_ROOM&nbsp;=&nbsp;-57<br>PI_NO_MEMORY&nbsp;=&nbsp;-58<br>PI_SOCK_READ_FAILED&nbsp;=&nbsp;-59<br>PI_SOCK_WRIT_FAILED&nbsp;=&nbsp;-60<br>PI_TOO_MANY_PARAM&nbsp;=&nbsp;-61<br>PI_SCRIPT_NOT_READY&nbsp;=&nbsp;-62<br>PI_BAD_TAG&nbsp;=&nbsp;-63<br>PI_BAD_MICS_DELAY&nbsp;=&nbsp;-64<br>PI_BAD_MILS_DELAY&nbsp;=&nbsp;-65<br>PI_BAD_WAVE_ID&nbsp;=&nbsp;-66<br>PI_TOO_MANY_CBS&nbsp;=&nbsp;-67<br>PI_TOO_MANY_OOL&nbsp;=&nbsp;-68<br>PI_EMPTY_WAVEFORM&nbsp;=&nbsp;-69<br>PI_NO_WAVEFORM_ID&nbsp;=&nbsp;-70<br>PI_I2C_OPEN_FAILED&nbsp;=&nbsp;-71<br>PI_SER_OPEN_FAILED&nbsp;=&nbsp;-72<br>PI_SPI_OPEN_FAILED&nbsp;=&nbsp;-73<br>PI_BAD_I2C_BUS&nbsp;=&nbsp;-74<br>PI_BAD_I2C_ADDR&nbsp;=&nbsp;-75<br>PI_BAD_SPI_CHANNEL&nbsp;=&nbsp;-76<br>PI_BAD_FLAGS&nbsp;=&nbsp;-77<br>PI_BAD_SPI_SPEED&nbsp;=&nbsp;-78<br>PI_BAD_SER_DEVICE&nbsp;=&nbsp;-79<br>PI_BAD_SER_SPEED&nbsp;=&nbsp;-80<br>PI_BAD_PARAM&nbsp;=&nbsp;-81<br>PI_I2C_WRITE_FAILED&nbsp;=&nbsp;-82<br>PI_I2C_READ_FAILED&nbsp;=&nbsp;-83<br>PI_BAD_SPI_COUNT&nbsp;=&nbsp;-84<br>PI_SER_WRITE_FAILED&nbsp;=&nbsp;-85<br>PI_SER_READ_FAILED&nbsp;=&nbsp;-86<br>PI_SER_READ_NO_DATA&nbsp;=&nbsp;-87<br>PI_UNKNOWN_COMMAND&nbsp;=&nbsp;-88<br>PI_SPI_XFER_FAILED&nbsp;=&nbsp;-89<br>PI_NO_AUX_SPI&nbsp;=&nbsp;-91<br>PI_NOT_PWM_GPIO&nbsp;=&nbsp;-92<br>PI_NOT_SERVO_GPIO&nbsp;=&nbsp;-93<br>PI_NOT_HCLK_GPIO&nbsp;=&nbsp;-94<br>PI_NOT_HPWM_GPIO&nbsp;=&nbsp;-95<br>PI_BAD_HPWM_FREQ&nbsp;=&nbsp;-96<br>PI_BAD_HPWM_DUTY&nbsp;=&nbsp;-97<br>PI_BAD_HCLK_FREQ&nbsp;=&nbsp;-98<br>PI_BAD_HCLK_PASS&nbsp;=&nbsp;-99<br>PI_HPWM_ILLEGAL&nbsp;=&nbsp;-100<br>PI_BAD_DATABITS&nbsp;=&nbsp;-101<br>PI_BAD_STOPBITS&nbsp;=&nbsp;-102<br>PI_MSG_TOOBIG&nbsp;=&nbsp;-103<br>PI_BAD_MALLOC_MODE&nbsp;=&nbsp;-104<br>PI_BAD_SMBUS_CMD&nbsp;=&nbsp;-107<br>PI_NOT_I2C_GPIO&nbsp;=&nbsp;-108<br>PI_BAD_I2C_WLEN&nbsp;=&nbsp;-109<br>PI_BAD_I2C_RLEN&nbsp;=&nbsp;-110<br>PI_BAD_I2C_CMD&nbsp;=&nbsp;-111<br>PI_BAD_I2C_BAUD&nbsp;=&nbsp;-112<br>PI_CHAIN_LOOP_CNT&nbsp;=&nbsp;-113<br>PI_BAD_CHAIN_LOOP&nbsp;=&nbsp;-114<br>PI_CHAIN_COUNTER&nbsp;=&nbsp;-115<br>PI_BAD_CHAIN_CMD&nbsp;=&nbsp;-116<br>PI_BAD_CHAIN_DELAY&nbsp;=&nbsp;-117<br>PI_CHAIN_NESTING&nbsp;=&nbsp;-118<br>PI_CHAIN_TOO_BIG&nbsp;=&nbsp;-119<br>PI_DEPRECATED&nbsp;=&nbsp;-120<br>PI_BAD_SER_INVERT&nbsp;=&nbsp;-121<br>PI_BAD_FOREVER&nbsp;=&nbsp;-124<br>PI_BAD_FILTER&nbsp;=&nbsp;-125<br>PI_BAD_PAD&nbsp;=&nbsp;-126<br>PI_BAD_STRENGTH&nbsp;=&nbsp;-127<br>PI_FIL_OPEN_FAILED&nbsp;=&nbsp;-128<br>PI_BAD_FILE_MODE&nbsp;=&nbsp;-129<br>PI_BAD_FILE_FLAG&nbsp;=&nbsp;-130<br>PI_BAD_FILE_READ&nbsp;=&nbsp;-131<br>PI_BAD_FILE_WRITE&nbsp;=&nbsp;-132<br>PI_FILE_NOT_ROPEN&nbsp;=&nbsp;-133<br>PI_FILE_NOT_WOPEN&nbsp;=&nbsp;-134<br>PI_BAD_FILE_SEEK&nbsp;=&nbsp;-135<br>PI_NO_FILE_MATCH&nbsp;=&nbsp;-136<br>PI_NO_FILE_ACCESS&nbsp;=&nbsp;-137<br>PI_FILE_IS_A_DIR&nbsp;=&nbsp;-138<br>PI_BAD_SHELL_STATUS&nbsp;=&nbsp;-139<br>PI_BAD_SCRIPT_NAME&nbsp;=&nbsp;-140<br>PI_BAD_SPI_BAUD&nbsp;=&nbsp;-141<br>PI_NOT_SPI_GPIO&nbsp;=&nbsp;-142<br>PI_BAD_EVENT_ID&nbsp;=&nbsp;-143<br>PI_CMD_INTERRUPTED&nbsp;=&nbsp;-144<br>PI_NOT_ON_BCM2711&nbsp;&nbsp;&nbsp;=&nbsp;-145<br>PI_ONLY_ON_BCM2711&nbsp;&nbsp;=&nbsp;-146<br></code><h3><a name="event"></a>event: 0-31</h3>An event is a signal used to inform one or more consumers
-to start an action.
-<h3><a name="file_mode"></a>file_mode: </h3>The mode may have the following values
-<br><br><code>FILE_READ&nbsp;&nbsp;&nbsp;1<br>FILE_WRITE&nbsp;&nbsp;2<br>FILE_RW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3<br></code><br><br>The following values can be or'd into the file open mode
-<br><br><code>FILE_APPEND&nbsp;4<br>FILE_CREATE&nbsp;8<br>FILE_TRUNC&nbsp;&nbsp;16<br></code><h3><a name="file_name"></a>file_name: </h3>A full file path. To be accessible the path must match
-an entry in /opt/pigpio/access.
-<h3><a name="fpattern"></a>fpattern: </h3>A file path which may contain wildcards. To be accessible the path
-must match an entry in /opt/pigpio/access.
-<h3><a name="frequency"></a>frequency: 0-40000</h3>Defines the frequency to be used for PWM on a GPIO.
-The closest permitted frequency will be used.
-<h3><a name="func"></a>func: </h3>A user supplied callback function.
-<h3><a name="gpio"></a>gpio: 0-53</h3>A Broadcom numbered GPIO. All the user GPIO are in the range 0-31.
-<br><br>There are 54 General Purpose Input Outputs (GPIO) named GPIO0
-through GPIO53.
-<br><br>They are split into two banks. Bank 1 consists of GPIO0
-through GPIO31. Bank 2 consists of GPIO32 through GPIO53.
-<br><br>All the GPIO which are safe for the user to read and write are in
-bank 1. Not all GPIO in bank 1 are safe though. Type 1 boards
-have 17 safe GPIO. Type 2 boards have 21. Type 3 boards have 26.
-<br><br>See <a href="#get_hardware_revision">get_hardware_revision</a>.
-<br><br>The user GPIO are marked with an X in the following table
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;1&nbsp;&nbsp;2&nbsp;&nbsp;3&nbsp;&nbsp;4&nbsp;&nbsp;5&nbsp;&nbsp;6&nbsp;&nbsp;7&nbsp;&nbsp;8&nbsp;&nbsp;9&nbsp;10&nbsp;11&nbsp;12&nbsp;13&nbsp;14&nbsp;15<br>Type&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16&nbsp;17&nbsp;18&nbsp;19&nbsp;20&nbsp;21&nbsp;22&nbsp;23&nbsp;24&nbsp;25&nbsp;26&nbsp;27&nbsp;28&nbsp;29&nbsp;30&nbsp;31<br>Type&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-<br>Type&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-<br></code><h3><a name="gpio_off"></a>gpio_off: </h3>A mask used to select GPIO to be operated on. See <a href="#bits">bits</a>.
-<br><br>This mask selects the GPIO to be switched off at the start
-of a pulse.
-<h3><a name="gpio_on"></a>gpio_on: </h3>A mask used to select GPIO to be operated on. See <a href="#bits">bits</a>.
-<br><br>This mask selects the GPIO to be switched on at the start
-of a pulse.
-<h3><a name="handle"></a>handle: &gt;=0</h3>A number referencing an object opened by one of the following
-<br><br><a href="#file_open">file_open</a>
-<a href="#i2c_open">i2c_open</a>
-<a href="#notify_open">notify_open</a>
-<a href="#serial_open">serial_open</a>
-<a href="#spi_open">spi_open</a>
-<h3><a name="host"></a>host: </h3>The name or IP address of the Pi running the pigpio daemon.
-<h3><a name="i2c_address"></a>i2c_address: 0-0x7F</h3>The address of a device on the I2C bus.
-<h3><a name="i2c_bus"></a>i2c_bus: &gt;=0</h3>An I2C bus number.
-<h3><a name="i2c_flags"></a>i2c_flags: 0</h3>No I2C flags are currently defined.
-<h3><a name="invert"></a>invert: 0-1</h3>A flag used to set normal or inverted bit bang serial data
-level logic.
-<h3><a name="level"></a>level: 0-1 (2)</h3><code>CLEAR&nbsp;=&nbsp;0<br>HIGH&nbsp;=&nbsp;1<br>LOW&nbsp;=&nbsp;0<br>OFF&nbsp;=&nbsp;0<br>ON&nbsp;=&nbsp;1<br>SET&nbsp;=&nbsp;1<br>TIMEOUT&nbsp;=&nbsp;2&nbsp;#&nbsp;only&nbsp;returned&nbsp;for&nbsp;a&nbsp;watchdog&nbsp;timeout<br></code><h3><a name="MISO"></a>MISO: </h3>The GPIO used for the MISO signal when bit banging SPI.
-<h3><a name="mode"></a>mode: </h3>1.The operational mode of a GPIO, normally INPUT or OUTPUT.
-<br><br><code>ALT0&nbsp;=&nbsp;4<br>ALT1&nbsp;=&nbsp;5<br>ALT2&nbsp;=&nbsp;6<br>ALT3&nbsp;=&nbsp;7<br>ALT4&nbsp;=&nbsp;3<br>ALT5&nbsp;=&nbsp;2<br>INPUT&nbsp;=&nbsp;0<br>OUTPUT&nbsp;=&nbsp;1<br></code><br><br>2. The mode of waveform transmission.
-<br><br><code>WAVE_MODE_ONE_SHOT&nbsp;=&nbsp;0<br>WAVE_MODE_REPEAT&nbsp;=&nbsp;1<br>WAVE_MODE_ONE_SHOT_SYNC&nbsp;=&nbsp;2<br>WAVE_MODE_REPEAT_SYNC&nbsp;=&nbsp;3<br></code><h3><a name="MOSI"></a>MOSI: </h3>The GPIO used for the MOSI signal when bit banging SPI.
-<h3><a name="offset"></a>offset: &gt;=0</h3>The offset wave data starts from the beginning of the waveform
-being currently defined.
-<h3><a name="pad"></a>pad: 0-2</h3>A set of GPIO which share common drivers.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><h3><a name="pad_strength"></a>pad_strength: 1-16</h3>The mA which may be drawn from each GPIO whilst still guaranteeing the
-high and low levels.
-<h3><a name="params"></a>params: 32 bit number</h3>When scripts are started they can receive up to 10 parameters
-to define their operation.
-<h3><a name="percent"></a>percent: : 0-100</h3>The size of waveform as percentage of maximum available.
-<h3><a name="port"></a>port: </h3>The port used by the pigpio daemon, defaults to 8888.
-<h3><a name="pstring"></a>pstring: </h3>The string to be passed to a <a href="#shell">shell</a> script to be executed.
-<h3><a name="pud"></a>pud: 0-2</h3><code>PUD_DOWN&nbsp;=&nbsp;1<br>PUD_OFF&nbsp;=&nbsp;0<br>PUD_UP&nbsp;=&nbsp;2<br></code><h3><a name="pulse_len"></a>pulse_len: 1-100</h3>The length of the trigger pulse in microseconds.
-<h3><a name="pulses"></a>pulses: </h3>A list of class pulse objects defining the characteristics of a
-waveform.
-<h3><a name="pulsewidth"></a>pulsewidth: </h3>The servo pulsewidth in microseconds. 0 switches pulses off.
-<h3><a name="PWMduty"></a>PWMduty: 0-1000000 (1M)</h3>The hardware PWM dutycycle.
-<h3><a name="PWMfreq"></a>PWMfreq: 1-125M (1-187.5M for the BCM2711)</h3>The hardware PWM frequency.
-<h3><a name="range_"></a>range_: 25-40000</h3>Defines the limits for the <a href="#dutycycle">dutycycle</a> parameter.
-<br><br>range_ defaults to 255.
-<h3><a name="reg"></a>reg: 0-255</h3>An I2C device register. The usable registers depend on the
-actual device.
-<h3><a name="retMax"></a>retMax: &gt;=0</h3>The maximum number of bytes a user customised function
-should return, default 8192.
-<h3><a name="SCL"></a>SCL: </h3>The user GPIO to use for the clock when bit banging I2C.
-<h3><a name="SCLK"></a>SCLK: :</h3>The GPIO used for the SCLK signal when bit banging SPI.
-<h3><a name="script"></a>script: </h3>The text of a script to store on the pigpio daemon.
-<h3><a name="script_id"></a>script_id: &gt;=0</h3>A number referencing a script created by <a href="#store_script">store_script</a>.
-<h3><a name="SDA"></a>SDA: </h3>The user GPIO to use for data when bit banging I2C.
-<h3><a name="seek_from"></a>seek_from: 0-2</h3>Direction to seek for <a href="#file_seek">file_seek</a>.
-<br><br><code>FROM_START=0<br>FROM_CURRENT=1<br>FROM_END=2<br></code><h3><a name="seek_offset"></a>seek_offset: </h3>The number of bytes to move forward (positive) or backwards
-(negative) from the seek position (start, current, or end of file).
-<h3><a name="ser_flags"></a>ser_flags: 32 bit</h3>No serial flags are currently defined.
-<h3><a name="serial_*"></a>serial_*: </h3>One of the serial_ functions.
-<h3><a name="shellscr"></a>shellscr: </h3>The name of a shell script. The script must exist
-in /opt/pigpio/cgi and must be executable.
-<h3><a name="show_errors"></a>show_errors: </h3>Controls the display of pigpio daemon connection failures.
-The default of True prints the probable failure reasons to
-standard output.
-<h3><a name="spi_channel"></a>spi_channel: 0-2</h3>A SPI channel.
-<h3><a name="spi_flags"></a>spi_flags: 32 bit</h3>See <a href="#spi_open">spi_open</a>.
-<h3><a name="steady"></a>steady: 0-300000</h3>The number of microseconds level changes must be stable for
-before reporting the level changed (<a href="#set_glitch_filter">set_glitch_filter</a>)
-or triggering the active part of a noise filter
-(<a href="#set_noise_filter">set_noise_filter</a>).
-<h3><a name="t1"></a>t1: </h3>A tick (earlier).
-<h3><a name="t2"></a>t2: </h3>A tick (later).
-<h3><a name="tty"></a>tty: </h3>A Pi serial tty device, e.g. /dev/ttyAMA0, /dev/ttyUSB0
-<h3><a name="uint32"></a>uint32: </h3>An unsigned 32 bit number.
-<h3><a name="user_gpio"></a>user_gpio: 0-31</h3>A Broadcom numbered GPIO.
-<br><br>All the user GPIO are in the range 0-31.
-<br><br>Not all the GPIO within this range are usable, some are reserved
-for system use.
-<br><br>See <a href="#gpio">gpio</a>.
-<h3><a name="wait_timeout"></a>wait_timeout: 0.0 -</h3>The number of seconds to wait in <a href="#wait_for_edge">wait_for_edge</a> before timing out.
-<h3><a name="wave_add_*"></a>wave_add_*: </h3>One of the following
-<br><br><a href="#wave_add_new">wave_add_new</a>
-<a href="#wave_add_generic">wave_add_generic</a>
-<a href="#wave_add_serial">wave_add_serial</a>
-<h3><a name="wave_id"></a>wave_id: &gt;=0</h3>A number referencing a wave created by <a href="#wave_create">wave_create</a>.
-<h3><a name="wave_send_*"></a>wave_send_*: </h3>One of the following
-<br><br><a href="#wave_send_once">wave_send_once</a>
-<a href="#wave_send_repeat">wave_send_repeat</a>
-<h3><a name="wdog_timeout"></a>wdog_timeout: 0-60000</h3>Defines a GPIO watchdog timeout in milliseconds. If no level
-change is detected on the GPIO for timeout millisecond a watchdog
-timeout report is issued (with level TIMEOUT).
-<h3><a name="word_val"></a>word_val: 0-65535</h3>A whole number.
-<br><br></td>
-</table>
-<div style="vertical-align: center; text-align: center; background-color:#98bf21; font-size:0.8em; height:30px"><a class="l2" href="index.html">[pigpio]</a>
-<a class="l2" href="cif.html">[pigpio C I/F]</a>
-<a class="l2" href="pigpiod.html">[pigpiod]</a>
-<a class="l2" href="pdif2.html">[pigpiod C I/F]</a>
-<a class="l2" href="python.html">[Python]</a>
-<a class="l2" href="pigs.html">[pigs]</a>
-<a class="l2" href="piscope.html">[piscope]</a>
-<a class="l2" href="misc.html">[Misc]</a>
-<a class="l2" href="examples.html">[Examples]</a>
-<a class="l2" href="download.html">[Download]</a>
-<a class="l2" href="faq.html">[FAQ]</a>
-<a class="l2" href="sitemap.html">[Site Map]</a>
-</div>
-<table><tr>
-<td style="width: 200px"><div style="text-align: left;"><small>&copy; 2012-2020</small></div></td>
-<td style="width: 350px"><div style="text-align: center;">e-mail: pigpio @ abyz.me.uk</div></td>
-<td style="width: 200px"><div style="text-align: right;"><small>Updated: 30/04/2020</small></div></td>
-</tr></table>
-</td>
-</table>
-</body>
-</html>
diff --git a/DOC/HTML/sif.html b/DOC/HTML/sif.html
deleted file mode 100644
index bbaa6e1..0000000
--- a/DOC/HTML/sif.html
+++ /dev/null
@@ -1,2058 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta name="description" content="Raspberry Pi Reg. C GPIO library and Python GPIO module and shell command utilities to control the GPIO, including SPI, I2C, and serial links." />
- <meta name="keywords" content="raspberry, pi, C, Python, GPIO, library, shell, command, utilities, module, SPI, I2C, serial" />
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>pigpio library</title>
- <link rel="stylesheet" type="text/css" href="scripts/index.css">
- <link rel="icon" href="favicon.ico" type="image/x-icon">
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
-</head>
-<body>
-
-<table style="padding:0px; border:0px; margin:0px; width:780px; background-color:#e0e0e0;">
-<td style="background:#EAF2E6 url('images/sidebar.gif') repeat-y; width:35px; height:100%"></td>
-<td>
-<table>
-<div style="background:url('images/topbar.gif') repeat-x; height: 70px; font-size:1.5em; vertical-align: top;"><a href="index.html"><img src="images/pigpio-logo.gif" border="0" /></a>pigpio library</div>
-</table>
-<table><div>
-<td><img src="images/remote-2.jpg" width="250"></td>
-<td><img src="images/serial.jpg" width="250"></td>
-<td><img src="images/srf02.jpg" width="250"></td>
-</div></table>
-<table>
-<td style="vertical-align: top; background-color: #98bf21;"><a class="l1" href="index.html">pigpio</a>
-<a class="l1" href="cif.html">pigpio C I/F</a>
-<a class="l1" href="pigpiod.html">pigpiod</a>
-<a class="l1" href="pdif2.html">pigpiod C I/F</a>
-<a class="l1" href="python.html">Python</a>
-<a class="l1" href="pigs.html">pigs</a>
-<a class="l1" href="piscope.html">piscope</a>
-<a class="l1" href="misc.html">Misc</a>
-<a class="l1" href="examples.html">Examples</a>
-<a class="l1" href="download.html">Download</a>
-<a class="l1" href="faq.html">FAQ</a>
-<a class="l1" href="sitemap.html">Site Map</a>
-</td>
-<td><center><h2>Socket Interface</h2></center>
-pigpio provides a socket interface to many of its functions.<br>
-<br>
-The socket interface is available whenever pigpio is running,
-either because it has been started as a daemon, or it has been
-linked in to a running user program.<br>
-<br>
-The socket interface can be disabled by the program which
-initialises the library.&nbsp; pigpiod offers the -k option to
-disable the socket interface.&nbsp; User programs should call
-<a href="cif.html#gpioCfgInterfaces">gpioCfgInterfaces</a> if they
-wish to disable the socket interface.<br>
-<br>
-pigpio listens for connections on port 8888 by default.&nbsp; This
-default may be overridden when pigpio starts by the <a href=
-"cif.html#gpioCfgSocketPort">gpioCfgSocketPort</a> function
-call.&nbsp; The pigpio daemon uses this function to provide an
-option to change the port number.<br>
-<br>
-The pigs utility is an example of using the socket interface from
-C.<span style="font-weight: bold;"><br></span>
-<h3><a name="Request" id="Request"></a>Request</h3>
-<p>pigpio expects messages of type <a href=
-"sif.html#cmdCmd_t">cmdCmd_t</a> immediately followed with an
-extension for a few commands.<br>
-<br>
-The caller should fill in cmd, p1, p2, p3/res, and any extension as
-needed.&nbsp; p3 will always be zero unless the command requires an
-extension in which case p3 will be the length in bytes of the
-extension.<br>
-<br>
-The <a href="sif.html#cmdCmd_t">cmdCmd_t</a> is echoed back with
-the result, if any, in p3/res, and an extension immediately
-afterwards for a few commands.<br></p>
-<table summary="" style="width: 80%;" cellspacing="2" cellpadding=
-"2" border="1">
-<tbody>
-<tr>
-<td style="font-weight: bold;">COMMAND</td>
-<td style="font-weight: bold;">cmd<br></td>
-<td style="font-weight: bold;">p1</td>
-<td style="font-weight: bold;">p2</td>
-<td style="font-weight: bold;">p3</td>
-<td style="font-weight: bold;">Extension<br></td>
-</tr>
-<tr>
-<td>MODES</td>
-<td>0</td>
-<td>gpio</td>
-<td>mode</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>MODEG</td>
-<td>1</td>
-<td>gpio</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PUD</td>
-<td>2</td>
-<td>gpio</td>
-<td>pud</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>READ</td>
-<td>3</td>
-<td>gpio</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WRITE</td>
-<td>4</td>
-<td>gpio</td>
-<td>level</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PWM</td>
-<td>5</td>
-<td>gpio</td>
-<td>dutycycle</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PRS</td>
-<td>6</td>
-<td>gpio</td>
-<td>range</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PFS</td>
-<td>7</td>
-<td>gpio</td>
-<td>frequency</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SERVO</td>
-<td>8</td>
-<td>gpio</td>
-<td>pulsewidth</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WDOG</td>
-<td>9</td>
-<td>gpio</td>
-<td>timeout</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BR1</td>
-<td>10</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BR2</td>
-<td>11</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BC1</td>
-<td>12</td>
-<td>bits</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BC2</td>
-<td>13</td>
-<td>bits</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BS1</td>
-<td>14</td>
-<td>bits</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BS2</td>
-<td>15</td>
-<td>bits</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>TICK</td>
-<td>16</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>HWVER</td>
-<td>17</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>NO</td>
-<td>18</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>NB</td>
-<td>19</td>
-<td>handle</td>
-<td>bits</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>NP</td>
-<td>20</td>
-<td>handle</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>NC</td>
-<td>21</td>
-<td>handle</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PRG</td>
-<td>22</td>
-<td>gpio</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PFG</td>
-<td>23</td>
-<td>gpio</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PRRG</td>
-<td>24</td>
-<td>gpio</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>HELP<br></td>
-<td>25</td>
-<td>N/A<br></td>
-<td>N/A<br></td>
-<td>N/A<br></td>
-<td>N/A<br></td>
-</tr>
-<tr>
-<td>PIGPV</td>
-<td>26</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVCLR</td>
-<td>27</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVAG</td>
-<td>28</td>
-<td>0</td>
-<td>0</td>
-<td>12*X</td>
-<td>gpioPulse_t pulse[X]</td>
-</tr>
-<tr>
-<td>WVAS</td>
-<td>29</td>
-<td>gpio</td>
-<td>baud</td>
-<td>12+X</td>
-<td>uint32_t databits<br>
-uint32_t stophalfbits<br>
-uint32_t offset<br>
-uint8_t data[X]</td>
-</tr>
-<tr>
-<td>N/A<br></td>
-<td>30</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>N/A<br></td>
-<td>31</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVBSY</td>
-<td>32</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVHLT</td>
-<td>33</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVSM</td>
-<td>34</td>
-<td>subcmd</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVSP</td>
-<td>35</td>
-<td>subcmd</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVSC</td>
-<td>36</td>
-<td>subcmd</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>TRIG</td>
-<td>37</td>
-<td>gpio</td>
-<td>pulselen</td>
-<td>4</td>
-<td>uint32_t level</td>
-</tr>
-<tr>
-<td>PROC</td>
-<td>38</td>
-<td>0</td>
-<td>0</td>
-<td>X</td>
-<td>uint8_t text[X]</td>
-</tr>
-<tr>
-<td>PROCD</td>
-<td>39</td>
-<td>script_id</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PROCR</td>
-<td>40</td>
-<td>script_id</td>
-<td>0</td>
-<td>4*X<br></td>
-<td>uint32_t pars[X]<br></td>
-</tr>
-<tr>
-<td>PROCS</td>
-<td>41</td>
-<td>script_id</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SLRO</td>
-<td>42</td>
-<td>gpio</td>
-<td>baud</td>
-<td>4</td>
-<td>uint32_t databits<br></td>
-</tr>
-<tr>
-<td>SLR</td>
-<td>43</td>
-<td>gpio</td>
-<td>count</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SLRC</td>
-<td>44</td>
-<td>gpio</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PROCP</td>
-<td>45</td>
-<td>script_id</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>MICS</td>
-<td>46</td>
-<td>micros</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>MILS</td>
-<td>47</td>
-<td>millis</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PARSE</td>
-<td>48</td>
-<td>N/A</td>
-<td>N/A<br></td>
-<td>N/A<br></td>
-<td>N/A</td>
-</tr>
-<tr>
-<td>WVCRE</td>
-<td>49</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVDEL</td>
-<td>50</td>
-<td>wave_id</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVTX</td>
-<td>51</td>
-<td>wave_id</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVTXR</td>
-<td>52</td>
-<td>wave_id</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVNEW</td>
-<td>53</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CO</td>
-<td>54</td>
-<td>bus</td>
-<td>device</td>
-<td>4</td>
-<td>uint32_t flags</td>
-</tr>
-<tr>
-<td>I2CC</td>
-<td>55</td>
-<td>handle</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CRD</td>
-<td>56</td>
-<td>handle</td>
-<td>count</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CWD</td>
-<td>57</td>
-<td>handle</td>
-<td>0</td>
-<td>X</td>
-<td>uint8_t data[X]</td>
-</tr>
-<tr>
-<td>I2CWQ</td>
-<td>58</td>
-<td>handle</td>
-<td>bit</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CRS</td>
-<td>59</td>
-<td>handle</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CWS</td>
-<td>60</td>
-<td>handle</td>
-<td>byte</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CRB</td>
-<td>61</td>
-<td>handle</td>
-<td>register</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CWB</td>
-<td>62</td>
-<td>handle</td>
-<td>register</td>
-<td>4</td>
-<td>uint32_t byte</td>
-</tr>
-<tr>
-<td>I2CRW</td>
-<td>63</td>
-<td>handle</td>
-<td>register</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CWW</td>
-<td>64</td>
-<td>handle</td>
-<td>register</td>
-<td>4</td>
-<td>uint32_t word</td>
-</tr>
-<tr>
-<td>I2CRK</td>
-<td>65</td>
-<td>handle</td>
-<td>register<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CWK</td>
-<td>66</td>
-<td>handle</td>
-<td>register<br></td>
-<td>X</td>
-<td>uint8_t bvs[X]<br></td>
-</tr>
-<tr>
-<td>I2CRI</td>
-<td>67</td>
-<td>handle</td>
-<td>register<br></td>
-<td>4</td>
-<td>uint32_t num<br></td>
-</tr>
-<tr>
-<td>I2CWI</td>
-<td>68</td>
-<td>handle</td>
-<td>register<br></td>
-<td>X<br></td>
-<td>uint8_t bvs[X]<br></td>
-</tr>
-<tr>
-<td>I2CPC</td>
-<td>69</td>
-<td>handle</td>
-<td>register<br></td>
-<td>4</td>
-<td>uint32_t word<br></td>
-</tr>
-<tr>
-<td>I2CPK</td>
-<td>70</td>
-<td>handle</td>
-<td>register<br></td>
-<td>X<br></td>
-<td>uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td>SPIO<br></td>
-<td>71</td>
-<td>channel</td>
-<td>baud</td>
-<td>4</td>
-<td>uint32_t flags</td>
-</tr>
-<tr>
-<td>SPIC</td>
-<td>72</td>
-<td>handle</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SPIR</td>
-<td>73</td>
-<td>handle</td>
-<td>count</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SPIW</td>
-<td>74</td>
-<td>handle</td>
-<td>0</td>
-<td>X</td>
-<td>uint8_t data[X]</td>
-</tr>
-<tr>
-<td>SPIX</td>
-<td>75</td>
-<td>handle</td>
-<td>0</td>
-<td>X</td>
-<td>uint8_t data[X]</td>
-</tr>
-<tr>
-<td>SERO</td>
-<td>76</td>
-<td>baud</td>
-<td>flags</td>
-<td>X</td>
-<td>uint8_t device[X]</td>
-</tr>
-<tr>
-<td>SERC</td>
-<td>77</td>
-<td>handle</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SERRB</td>
-<td>78</td>
-<td>handle</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SERWB</td>
-<td>79</td>
-<td>handle</td>
-<td>byte</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SERR</td>
-<td>80</td>
-<td>handle</td>
-<td>count</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SERW</td>
-<td>81</td>
-<td>handle</td>
-<td>0</td>
-<td>X</td>
-<td>uint8_t data[X]</td>
-</tr>
-<tr>
-<td>SERDA</td>
-<td>82</td>
-<td>handle</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">GDC<br></td>
-<td style="vertical-align: top;">83<br></td>
-<td style="vertical-align: top;">gpio<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">GPW<br></td>
-<td style="vertical-align: top;">84<br></td>
-<td style="vertical-align: top;">gpio<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">HC<br></td>
-<td style="vertical-align: top;">85<br></td>
-<td style="vertical-align: top;">gpio<br></td>
-<td style="vertical-align: top;">frequency<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">HP<br></td>
-<td style="vertical-align: top;">86<br></td>
-<td style="vertical-align: top;">gpio<br></td>
-<td style="vertical-align: top;">frequency<br></td>
-<td style="vertical-align: top;">4<br></td>
-<td style="vertical-align: top;">uint32_t dutycycle<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">CF1<br></td>
-<td style="vertical-align: top;">87<br></td>
-<td style="vertical-align: top;">arg1<br></td>
-<td style="vertical-align: top;">arg2<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t argx[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">CF2<br></td>
-<td style="vertical-align: top;">88<br></td>
-<td style="vertical-align: top;">arg1<br></td>
-<td style="vertical-align: top;">retMax<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t argx[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BI2CC<br></td>
-<td style="vertical-align: top;">89<br></td>
-<td style="vertical-align: top;">sda<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BI2CO<br></td>
-<td style="vertical-align: top;">90<br></td>
-<td style="vertical-align: top;">sda<br></td>
-<td style="vertical-align: top;">scl<br></td>
-<td style="vertical-align: top;">4<br></td>
-<td style="vertical-align: top;">uint32_t baud<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BI2CZ<br></td>
-<td style="vertical-align: top;">91<br></td>
-<td style="vertical-align: top;">sda<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">I2CZ<br></td>
-<td style="vertical-align: top;">92<br></td>
-<td style="vertical-align: top;">handle<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">WVCHA<br></td>
-<td style="vertical-align: top;">93<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">SLRI<br></td>
-<td style="vertical-align: top;">94<br></td>
-<td style="vertical-align: top;">gpio<br></td>
-<td style="vertical-align: top;">invert<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">CGI<br></td>
-<td style="vertical-align: top;">95<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">CSI<br></td>
-<td style="vertical-align: top;">96<br></td>
-<td style="vertical-align: top;">config<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FG<br></td>
-<td style="vertical-align: top;">97<br></td>
-<td style="vertical-align: top;">gpio<br></td>
-<td style="vertical-align: top;">steady<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FN<br></td>
-<td style="vertical-align: top;">98<br></td>
-<td style="vertical-align: top;">gpio<br></td>
-<td style="vertical-align: top;">steady<br></td>
-<td style="vertical-align: top;">4<br></td>
-<td style="vertical-align: top;">uint32_t active<br></td>
-</tr>
-<tr>
-<td>NOIB</td>
-<td>99</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">WVTXM<br></td>
-<td style="vertical-align: top;">100<br></td>
-<td style="vertical-align: top;">wave_id<br></td>
-<td style="vertical-align: top;">mode<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">WVTAT<br></td>
-<td style="vertical-align: top;">101<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">PADS<br></td>
-<td style="vertical-align: top;">102<br></td>
-<td style="vertical-align: top;">pad<br></td>
-<td style="vertical-align: top;">strength<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">PADG<br></td>
-<td style="vertical-align: top;">103<br></td>
-<td style="vertical-align: top;">pad<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FO<br></td>
-<td style="vertical-align: top;">104<br></td>
-<td style="vertical-align: top;">mode<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t file[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FC<br></td>
-<td style="vertical-align: top;">105<br></td>
-<td style="vertical-align: top;">handle<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FR<br></td>
-<td style="vertical-align: top;">106<br></td>
-<td style="vertical-align: top;">handle<br></td>
-<td style="vertical-align: top;">count<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FW<br></td>
-<td style="vertical-align: top;">107<br></td>
-<td style="vertical-align: top;">handle<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FS<br></td>
-<td style="vertical-align: top;">108<br></td>
-<td style="vertical-align: top;">handle<br></td>
-<td style="vertical-align: top;">offset<br></td>
-<td style="vertical-align: top;">4<br></td>
-<td style="vertical-align: top;">uint32_t from<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FL<br></td>
-<td style="vertical-align: top;">109<br></td>
-<td style="vertical-align: top;">count<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t pattern[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">SHELL<br></td>
-<td style="vertical-align: top;">110<br></td>
-<td style="vertical-align: top;">len(name)<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">len(name)+<br>
-1+<br>
-len(string)<br></td>
-<td style="vertical-align: top;">uint8_t name[len(name)]<br>
-uint8_t null (0)<br>
-uint8_t string[len(string)]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BSPIC<br></td>
-<td style="vertical-align: top;">111<br></td>
-<td style="vertical-align: top;">CS<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BSPIO<br></td>
-<td style="vertical-align: top;">112<br></td>
-<td style="vertical-align: top;">CS<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">20<br></td>
-<td style="vertical-align: top;">uint32_t MISO<br>
-uint32_t MOSI<br>
-uint32_t SCLK<br>
-uint32_t baud<br>
-uint32_t spi_flags<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BSPIX<br></td>
-<td style="vertical-align: top;">113<br></td>
-<td style="vertical-align: top;">CS<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BSCX<br></td>
-<td style="vertical-align: top;">114<br></td>
-<td style="vertical-align: top;">control<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">EVM<br></td>
-<td style="vertical-align: top;">115<br></td>
-<td style="vertical-align: top;">handle<br></td>
-<td style="vertical-align: top;">bits<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">EVT<br></td>
-<td style="vertical-align: top;">116<br></td>
-<td style="vertical-align: top;">event<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td valign="top">PROCU<br></td>
-<td valign="top">117<br></td>
-<td valign="top">script_id<br></td>
-<td valign="top">0<br></td>
-<td valign="top">4*X<br></td>
-<td valign="top">uint32_t pars[X]<br></td>
-</tr>
-</tbody>
-</table>
-<h3><a name="Response" id="Response"></a>Response</h3>
-<p>The response has cmd/p1/p2 as in the request.&nbsp; p3/res holds
-the return value.&nbsp; If the command returns additional values
-they will be in the immediately following extension.<br></p>
-Normally res should be treated as a 32 bit signed value and will be
-greater than or equal to zero.&nbsp; Upon failure res will be less
-than 0 and contains an error code.<br>
-<p>There are a few commands where the returned value should be
-treated as a 32 bit unsigned value.&nbsp; These commands can not
-fail.&nbsp; They are indicated with a * after the command
-name.<br></p>
-<p>Commands with an extension have the size of the extension in
-bytes returned in res (or &lt;0 on error as above).</p>
-<table summary="" style="width: 80%;" cellspacing="2" cellpadding=
-"2" border="1">
-<tbody>
-<tr>
-<td style="font-weight: bold;">COMMAND</td>
-<td style="font-weight: bold;">cmd<br></td>
-<td style="vertical-align: top; font-weight: bold;">p1<br></td>
-<td style="vertical-align: top; font-weight: bold;">p2<br></td>
-<td style="font-weight: bold;">res<br></td>
-<td style="font-weight: bold;">Extension<br></td>
-</tr>
-<tr>
-<td>MODES</td>
-<td>0</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>MODEG</td>
-<td>1</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>mode<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PUD</td>
-<td>2</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>READ</td>
-<td>3</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>level<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WRITE</td>
-<td>4</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PWM</td>
-<td>5</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PRS</td>
-<td>6</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PFS</td>
-<td>7</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SERVO</td>
-<td>8</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WDOG</td>
-<td>9</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BR1 *</td>
-<td>10</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>bits<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BR2 *</td>
-<td>11</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>bits<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BC1</td>
-<td>12</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BC2</td>
-<td>13</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BS1</td>
-<td>14</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BS2</td>
-<td>15</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>TICK *<br></td>
-<td>16</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>tick<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>HWVER *<br></td>
-<td>17</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>version<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>NO</td>
-<td>18</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>handle<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>NB</td>
-<td>19</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>NP</td>
-<td>20</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>NC</td>
-<td>21</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PRG</td>
-<td>22</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>range<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PFG</td>
-<td>23</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>frequency<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PRRG</td>
-<td>24</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>real range<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>HELP</td>
-<td>25</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>N/A<br></td>
-<td>N/A<br></td>
-</tr>
-<tr>
-<td>PIGPV *<br></td>
-<td>26</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>version<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVCLR</td>
-<td>27</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVAG</td>
-<td>28</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>wave pulses<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVAS</td>
-<td>29</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>wave pulses<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>N/A<br></td>
-<td>30</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>-<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>N/A<br></td>
-<td>31</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>-<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVBSY</td>
-<td>32</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>busy (1) or not busy (0)<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVHLT</td>
-<td>33</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVSM</td>
-<td>34</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>wave micros<br>
-wave micros - high<br>
-wave micros - max<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVSP</td>
-<td>35</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>wave pulses<br>
-wave pulses - high<br>
-wave pulses - max<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVSC</td>
-<td>36</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>wave DMA CBs<br>
-wave DMA CBs - high<br>
-wave DMA CBs - max<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>TRIG</td>
-<td>37</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0<br></td>
-<td>-</td>
-</tr>
-<tr>
-<td>PROC</td>
-<td>38</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>script id<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PROCD</td>
-<td>39</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PROCR</td>
-<td>40</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>script status<br></td>
-<td>-</td>
-</tr>
-<tr>
-<td>PROCS</td>
-<td>41</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SLRO</td>
-<td>42</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SLR</td>
-<td>43</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>X<br></td>
-<td>uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td>SLRC</td>
-<td>44</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PROCP</td>
-<td>45</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>44</td>
-<td>uint32_t script_status<br>
-uint32_t pars[10]<br></td>
-</tr>
-<tr>
-<td>MICS</td>
-<td>46</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>MILS</td>
-<td>47</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PARSE</td>
-<td>48</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>N/A<br></td>
-<td>-</td>
-</tr>
-<tr>
-<td>WVCRE</td>
-<td>49</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>wave id<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVDEL</td>
-<td>50</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVTX</td>
-<td>51</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>wave DMA CBs<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVTXR</td>
-<td>52</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>wave DMA CBs<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVNEW</td>
-<td>53</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CO</td>
-<td>54</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>handle</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CC</td>
-<td>55</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CRD</td>
-<td>56</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>X<br></td>
-<td>uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td>I2CWD</td>
-<td>57</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CWQ</td>
-<td>58</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CRS</td>
-<td>59</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>byte value<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CWS</td>
-<td>60</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CRB</td>
-<td>61</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>byte value<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CWB</td>
-<td>62</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CRW</td>
-<td>63</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>word value<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CWW</td>
-<td>64</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CRK</td>
-<td>65</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CWK</td>
-<td>66</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CRI</td>
-<td>67</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>X<br></td>
-<td>uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td>I2CWI</td>
-<td>68</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CPC</td>
-<td>69</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>word value<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CPK</td>
-<td>70</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>X<br></td>
-<td>uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td>SPIO<br></td>
-<td>71</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>handle<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SPIC</td>
-<td>72</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SPIR</td>
-<td>73</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>X<br></td>
-<td>uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td>SPIW</td>
-<td>74</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SPIX</td>
-<td>75</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>X</td>
-<td>uint8_t data[X]</td>
-</tr>
-<tr>
-<td>SERO</td>
-<td>76</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>handle<br></td>
-<td>-</td>
-</tr>
-<tr>
-<td>SERC</td>
-<td>77</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SERRB</td>
-<td>78</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>byte value<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SERWB</td>
-<td>79</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SERR</td>
-<td>80</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>X<br></td>
-<td>uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td>SERW</td>
-<td>81</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SERDA</td>
-<td>82</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>data ready count<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">GDC<br></td>
-<td style="vertical-align: top;">83<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">dutycycle<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">GPW<br></td>
-<td style="vertical-align: top;">84<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">pulsewidth<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">HC<br></td>
-<td style="vertical-align: top;">85<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">HP<br></td>
-<td style="vertical-align: top;">86<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">CF1<br></td>
-<td style="vertical-align: top;">87<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">value<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">CF2<br></td>
-<td style="vertical-align: top;">88<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t retBuf[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BI2CC<br></td>
-<td style="vertical-align: top;">89<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BI2CO<br></td>
-<td style="vertical-align: top;">90<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">handle<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BI2CZ<br></td>
-<td style="vertical-align: top;">91<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">I2CZ<br></td>
-<td style="vertical-align: top;">92<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">WVCHA<br></td>
-<td style="vertical-align: top;">93<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">SLRI<br></td>
-<td style="vertical-align: top;">94<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">CGI<br></td>
-<td style="vertical-align: top;">95<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">config<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">CSI<br></td>
-<td style="vertical-align: top;">96<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FG<br></td>
-<td style="vertical-align: top;">97<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FN<br></td>
-<td style="vertical-align: top;">98<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td>NOIB</td>
-<td>99</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">WVTXM<br></td>
-<td style="vertical-align: top;">100<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">wave DMA CBs<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">WVTAT<br></td>
-<td style="vertical-align: top;">101<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">wave id<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">PADS<br></td>
-<td style="vertical-align: top;">102<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">PADG<br></td>
-<td style="vertical-align: top;">103<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">strength<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FO<br></td>
-<td style="vertical-align: top;">104<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">handle<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FC<br></td>
-<td style="vertical-align: top;">105<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FR<br></td>
-<td style="vertical-align: top;">106<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FW<br></td>
-<td style="vertical-align: top;">107<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FS<br></td>
-<td style="vertical-align: top;">108<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">position<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FL<br></td>
-<td style="vertical-align: top;">109<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t filenames[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">SHELL<br></td>
-<td style="vertical-align: top;">110<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">exit status<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BSPIC<br></td>
-<td style="vertical-align: top;">111<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BSPIO<br></td>
-<td style="vertical-align: top;">112<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BSPIX<br></td>
-<td style="vertical-align: top;">113<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t data[X]</td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BSCX<br></td>
-<td style="vertical-align: top;">114<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">X+4<br></td>
-<td style="vertical-align: top;">uint32_t status<br>
-uint8_t data[X]</td>
-</tr>
-<tr>
-<td style="vertical-align: top;">EVM<br></td>
-<td style="vertical-align: top;">115<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">EVT<br></td>
-<td style="vertical-align: top;">116<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td valign="top">PROCU<br></td>
-<td valign="top">117<br></td>
-<td valign="top">-<br></td>
-<td valign="top">-<br></td>
-<td valign="top">0<br></td>
-<td valign="top">-<br></td>
-</tr>
-</tbody>
-</table>
-<code><br></code>
-<h3><a name="cmdCmd_t" id="cmdCmd_t"></a>cmdCmd_t</h3>
-<code>typedef struct<br>
-{<br>
-&nbsp;&nbsp; uint32_t cmd;<br>
-&nbsp;&nbsp; uint32_t p1;<br>
-&nbsp;&nbsp; uint32_t p2;<br>
-&nbsp;&nbsp; union<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uint32_t p3;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uint32_t ext_len;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uint32_t res;<br>
-&nbsp;&nbsp; };<br>
-} cmdCmd_t;<br></code><br>
-</td>
-</table>
-<div style="vertical-align: center; text-align: center; background-color:#98bf21; font-size:0.8em; height:30px"><a class="l2" href="index.html">[pigpio]</a>
-<a class="l2" href="cif.html">[pigpio C I/F]</a>
-<a class="l2" href="pigpiod.html">[pigpiod]</a>
-<a class="l2" href="pdif2.html">[pigpiod C I/F]</a>
-<a class="l2" href="python.html">[Python]</a>
-<a class="l2" href="pigs.html">[pigs]</a>
-<a class="l2" href="piscope.html">[piscope]</a>
-<a class="l2" href="misc.html">[Misc]</a>
-<a class="l2" href="examples.html">[Examples]</a>
-<a class="l2" href="download.html">[Download]</a>
-<a class="l2" href="faq.html">[FAQ]</a>
-<a class="l2" href="sitemap.html">[Site Map]</a>
-</div>
-<table><tr>
-<td style="width: 200px"><div style="text-align: left;"><small>&copy; 2012-2020</small></div></td>
-<td style="width: 350px"><div style="text-align: center;">e-mail: pigpio @ abyz.me.uk</div></td>
-<td style="width: 200px"><div style="text-align: right;"><small>Updated: 30/04/2020</small></div></td>
-</tr></table>
-</td>
-</table>
-</body>
-</html>
diff --git a/DOC/HTML/sitemap.html b/DOC/HTML/sitemap.html
deleted file mode 100644
index b2706b1..0000000
--- a/DOC/HTML/sitemap.html
+++ /dev/null
@@ -1,85 +0,0 @@
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta name="description" content="Raspberry Pi Reg. C GPIO library and Python GPIO module and shell command utilities to control the GPIO, including SPI, I2C, and serial links." />
- <meta name="keywords" content="raspberry, pi, C, Python, GPIO, library, shell, command, utilities, module, SPI, I2C, serial" />
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>pigpio library</title>
- <link rel="stylesheet" type="text/css" href="scripts/index.css">
- <link rel="icon" href="favicon.ico" type="image/x-icon">
- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
-</head>
-<body>
-
-<table style="padding:0px; border:0px; margin:0px; width:780px; background-color:#e0e0e0;">
-<td style="background:#EAF2E6 url('images/sidebar.gif') repeat-y; width:35px; height:100%"></td>
-<td>
-<table>
-<div style="background:url('images/topbar.gif') repeat-x; height: 70px; font-size:1.5em; vertical-align: top;"><a href="index.html"><img src="images/pigpio-logo.gif" border="0" /></a>pigpio library</div>
-</table>
-<table><div>
-<td><img src="images/ir-rx.jpg" width="250"></td>
-<td><img src="images/imu-2.jpg" width="250"></td>
-<td><img src="images/caps.jpg" width="250"></td>
-</div></table>
-<table>
-<td style="vertical-align: top; background-color: #98bf21;"><a class="l1" href="index.html">pigpio</a>
-<a class="l1" href="cif.html">pigpio C I/F</a>
-<a class="l1" href="pigpiod.html">pigpiod</a>
-<a class="l1" href="pdif2.html">pigpiod C I/F</a>
-<a class="l1" href="python.html">Python</a>
-<a class="l1" href="pigs.html">pigs</a>
-<a class="l1" href="piscope.html">piscope</a>
-<a class="l1" href="misc.html">Misc</a>
-<a class="l1" href="examples.html">Examples</a>
-<a class="l1" href="download.html">Download</a>
-<a class="l1" href="faq.html">FAQ</a>
-<a class="l1" href="sitemap.html">Site Map</a>
-</td>
-<td><center><h2>Site Map</h2></center><a href="index.html">pigpio</a><br>
-<a href="cif.html">pigpio C I/F</a><br>
-<a href="pigpiod.html">pigpiod</a><br>
-<a href="pdif2.html">pigpiod C I/F</a><br>
-<a href="python.html">Python</a><br>
-<a href="pigs.html">pigs</a><br>
-<a href="piscope.html">piscope</a><br>
-<a href="misc.html">Misc</a><br>
-----<a href="sif.html">Socket I/F</a><br>
-----<a href="pif.html">Pipe I/F</a><br>
-----<a href="pdif.html">pigpiod_if</a><br>
-----<a href="pig2vcd.html">pig2vcd</a><br>
-<a href="examples.html">Examples</a><br>
-----<a href="ex_rotary_encoder.html">Rotary Encoder</a><br>
-----<a href="ex_ir_remote.html">IR Remote</a><br>
-----<a href="ex_LDR.html">Light Dependent Resitor</a><br>
-----<a href="ex_sonar_ranger.html">Sonar Ranger</a><br>
-----<a href="ex_motor_shield.html">Arduino Motor Shield</a><br>
-<a href="download.html">Download</a><br>
-<a href="faq.html">FAQ</a><br>
-<a href="sitemap.html">Site Map</a><br>
-</td>
-</table>
-<div style="vertical-align: center; text-align: center; background-color:#98bf21; font-size:0.8em; height:30px"><a class="l2" href="index.html">[pigpio]</a>
-<a class="l2" href="cif.html">[pigpio C I/F]</a>
-<a class="l2" href="pigpiod.html">[pigpiod]</a>
-<a class="l2" href="pdif2.html">[pigpiod C I/F]</a>
-<a class="l2" href="python.html">[Python]</a>
-<a class="l2" href="pigs.html">[pigs]</a>
-<a class="l2" href="piscope.html">[piscope]</a>
-<a class="l2" href="misc.html">[Misc]</a>
-<a class="l2" href="examples.html">[Examples]</a>
-<a class="l2" href="download.html">[Download]</a>
-<a class="l2" href="faq.html">[FAQ]</a>
-<a class="l2" href="sitemap.html">[Site Map]</a>
-</div>
-<table><tr>
-<td style="width: 200px"><div style="text-align: left;"><small>&copy; 2012-2020</small></div></td>
-<td style="width: 350px"><div style="text-align: center;">e-mail: pigpio @ abyz.me.uk</div></td>
-<td style="width: 200px"><div style="text-align: right;"><small>Updated: 30/04/2020</small></div></td>
-</tr></table>
-</td>
-</table>
-</body>
-</html>
diff --git a/DOC/MAN/pig2vcd.1 b/DOC/MAN/pig2vcd.1
deleted file mode 100644
index eacce19..0000000
--- a/DOC/MAN/pig2vcd.1
+++ /dev/null
@@ -1,246 +0,0 @@
-
-." Process this file with
-." groff -man -Tascii pig2vcd.1
-."
-.TH pig2vcd 1 2012-2020 Linux "pigpio archive"
-.SH NAME
-pig2vd - A utility to convert pigpio notifications to VCD.
-
-.SH SYNOPSIS
-
-pig2vcd </dev/pigpioXX >file.VCD
-.SH DESCRIPTION
-
-
-.ad l
-
-.nh
-pig2vcd is a utility which reads notifications on stdin and writes the
-output as a Value Change Dump (VCD) file on stdout.
-
-.br
-
-.br
-The VCD file can be viewed using GTKWave.
-
-.br
-
-.br
-.SS Notifications
-.br
-
-.br
-Notifications consist of 12 bytes with the following binary format.
-
-.br
-
-.br
-
-.EX
-typedef struct
-.br
-{
-.br
- uint16_t seqno;
-.br
- uint16_t flags;
-.br
- uint32_t tick;
-.br
- uint32_t level;
-.br
-} gpioReport_t;
-.br
-
-.EE
-
-.br
-
-.br
-seqno: starts at 0 each time the handle is opened and then increments by one for each report.
-
-.br
-
-.br
-flags: two flags are defined, PI_NTFY_FLAGS_WDOG and PI_NTFY_FLAGS_ALIVE. If bit 5 is set (PI_NTFY_FLAGS_WDOG) then bits 0-4 of the flags indicate a gpio which has had a watchdog timeout; if bit 6 is set (PI_NTFY_FLAGS_ALIVE) this indicates a keep alive signal on the pipe/socket and is sent once a minute in the absence of other notification activity.
-
-.br
-
-.br
-tick: the number of microseconds since system boot. It wraps around after 1h12m.
-
-.br
-
-.br
-level: indicates the level of each gpio. If bit 1<<x is set then gpio x is high. pig2vcd takes these notifications and outputs a text format VCD.
-
-.br
-
-.br
-.SS VCD format
-.br
-
-.br
-The VCD starts with a header.
-
-.br
-
-.br
-
-.EX
-$date 2013-05-31 18:49:36 $end
-.br
-$version pig2vcd V1 $end
-.br
-$timescale 1 us $end
-.br
-$scope module top $end
-.br
-$var wire 1 A 0 $end
-.br
-$var wire 1 B 1 $end
-.br
-$var wire 1 C 2 $end
-.br
-$var wire 1 D 3 $end
-.br
-$var wire 1 E 4 $end
-.br
-$var wire 1 F 5 $end
-.br
-$var wire 1 G 6 $end
-.br
-$var wire 1 H 7 $end
-.br
-$var wire 1 I 8 $end
-.br
-$var wire 1 J 9 $end
-.br
-$var wire 1 K 10 $end
-.br
-$var wire 1 L 11 $end
-.br
-$var wire 1 M 12 $end
-.br
-$var wire 1 N 13 $end
-.br
-$var wire 1 O 14 $end
-.br
-$var wire 1 P 15 $end
-.br
-$var wire 1 Q 16 $end
-.br
-$var wire 1 R 17 $end
-.br
-$var wire 1 S 18 $end
-.br
-$var wire 1 T 19 $end
-.br
-$var wire 1 U 20 $end
-.br
-$var wire 1 V 21 $end
-.br
-$var wire 1 W 22 $end
-.br
-$var wire 1 X 23 $end
-.br
-$var wire 1 Y 24 $end
-.br
-$var wire 1 Z 25 $end
-.br
-$var wire 1 a 26 $end
-.br
-$var wire 1 b 27 $end
-.br
-$var wire 1 c 28 $end
-.br
-$var wire 1 d 29 $end
-.br
-$var wire 1 e 30 $end
-.br
-$var wire 1 f 31 $end
-.br
-$upscope $end
-.br
-$enddefinitions $end
-.br
-
-.EE
-
-.br
-
-.br
-The header defines gpio identifiers and their name. Each gpio identifier
-must be unique. pig2vcd arbitrarily uses 'A' through 'Z' for gpios 0
-through 25, and 'a' through 'f' for gpios 26 through 31.
-The corresponding names are 0 through 31.
-.br
-
-.br
-
-.br
-The VCD file may be edited to give a frendlier name, e.g. 8 could be
-changed to ENCODER_A if an encoder switch A is connected to gpio 8.
-
-.br
-
-.br
-Following the header pig2vcd takes notifications and outputs a timestamp
-followed by a list of one or more gpios which have changed state.
-The timestamp consists of a '#' followed by the microsecond tick.
-The state lines contain the new state followed by the gpio identifier.
-
-.br
-
-.br
-
-.EX
-#1058747
-.br
-0H
-.br
-0I
-.br
-#1059012
-.br
-1H
-.br
-#1079777
-.br
-1I
-.br
-#1079782
-.br
-0I
-.br
-#1079852
-.br
-1I
-.br
-#1079857
-.br
-0I
-.br
-0H
-.br
-#1165113
-.br
-1H
-.br
-#1165118
-.br
-0H
-.br
-#1165153
-.br
-1H
-.br
-
-.EE
-
-.SH SEE ALSO
-
-pigpiod(1), pigs(1), pigpio(3), pigpiod_if(3), pigpiod_if2(3)
-.SH AUTHOR
-
-joan@abyz.me.uk
diff --git a/DOC/MAN/pigpio.3 b/DOC/MAN/pigpio.3
deleted file mode 100644
index c878cbd..0000000
--- a/DOC/MAN/pigpio.3
+++ /dev/null
@@ -1,11137 +0,0 @@
-
-." Process this file with
-." groff -man -Tascii pigpio.3
-."
-.TH pigpio 3 2012-2020 Linux "pigpio archive"
-.SH NAME
-pigpio - A C library to manipulate the Pi's GPIO.
-
-.SH SYNOPSIS
-
-#include <pigpio.h>
-
-
-gcc -Wall -pthread -o prog prog.c -lpigpio -lrt
-
-sudo ./prog
-.SH DESCRIPTION
-
-
-.ad l
-
-.nh
-
-.br
-
-.br
-pigpio is a C library for the Raspberry which allows control of the GPIO.
-
-.br
-
-.br
-.SS Features
-.br
-
-.br
-o hardware timed PWM on any of GPIO 0-31
-
-.br
-
-.br
-o hardware timed servo pulses on any of GPIO 0-31
-
-.br
-
-.br
-o callbacks when any of GPIO 0-31 change state
-
-.br
-
-.br
-o callbacks at timed intervals
-
-.br
-
-.br
-o reading/writing all of the GPIO in a bank as one operation
-
-.br
-
-.br
-o individually setting GPIO modes, reading and writing
-
-.br
-
-.br
-o notifications when any of GPIO 0-31 change state
-
-.br
-
-.br
-o the construction of output waveforms with microsecond timing
-
-.br
-
-.br
-o rudimentary permission control over GPIO
-
-.br
-
-.br
-o a simple interface to start and stop new threads
-
-.br
-
-.br
-o I2C, SPI, and serial link wrappers
-
-.br
-
-.br
-o creating and running scripts
-
-.br
-
-.br
-.SS GPIO
-.br
-
-.br
-ALL GPIO are identified by their Broadcom number.
-
-.br
-
-.br
-.SS Credits
-.br
-
-.br
-The PWM and servo pulses are timed using the DMA and PWM peripherals.
-
-.br
-
-.br
-This use was inspired by Richard Hirst's servoblaster kernel module.
-
-.br
-
-.br
-.SS Usage
-.br
-
-.br
-Include <pigpio.h> in your source files.
-
-.br
-
-.br
-Assuming your source is in prog.c use the following command to build and
-run the executable.
-
-.br
-
-.br
-
-.EX
-gcc -Wall -pthread -o prog prog.c -lpigpio -lrt
-.br
-sudo ./prog
-.br
-
-.EE
-
-.br
-
-.br
-For examples of usage see the C programs within the pigpio archive file.
-
-.br
-
-.br
-.SS Notes
-.br
-
-.br
-All the functions which return an int return < 0 on error.
-
-.br
-
-.br
-\fBgpioInitialise\fP must be called before all other library functions
-with the following exceptions:
-
-.br
-
-.br
-
-.EX
-\fBgpioCfg*\fP
-.br
-\fBgpioVersion\fP
-.br
-\fBgpioHardwareRevision\fP
-.br
-
-.EE
-
-.br
-
-.br
-If the library is not initialised all but the \fBgpioCfg*\fP,
-\fBgpioVersion\fP, and \fBgpioHardwareRevision\fP functions will
-return error PI_NOT_INITIALISED.
-
-.br
-
-.br
-If the library is initialised the \fBgpioCfg*\fP functions will return
-error PI_INITIALISED.
-
-.br
-
-.br
-
-.SH OVERVIEW
-
-.br
-.SS ESSENTIAL
-.br
-
-.br
-gpioInitialise Initialise library
-.br
-gpioTerminate Stop library
-.br
-.SS BASIC
-.br
-
-.br
-gpioSetMode Set a GPIO mode
-.br
-gpioGetMode Get a GPIO mode
-.br
-
-.br
-gpioSetPullUpDown Set/clear GPIO pull up/down resistor
-.br
-
-.br
-gpioRead Read a GPIO
-.br
-gpioWrite Write a GPIO
-.br
-.SS PWM (overrides servo commands on same GPIO)
-.br
-
-.br
-gpioPWM Start/stop PWM pulses on a GPIO
-.br
-gpioSetPWMfrequency Configure PWM frequency for a GPIO
-.br
-gpioSetPWMrange Configure PWM range for a GPIO
-.br
-
-.br
-gpioGetPWMdutycycle Get dutycycle setting on a GPIO
-.br
-gpioGetPWMfrequency Get configured PWM frequency for a GPIO
-.br
-gpioGetPWMrange Get configured PWM range for a GPIO
-.br
-
-.br
-gpioGetPWMrealRange Get underlying PWM range for a GPIO
-.br
-.SS Servo (overrides PWM commands on same GPIO)
-.br
-
-.br
-gpioServo Start/stop servo pulses on a GPIO
-.br
-
-.br
-gpioGetServoPulsewidth Get pulsewidth setting on a GPIO
-.br
-.SS INTERMEDIATE
-.br
-
-.br
-gpioTrigger Send a trigger pulse to a GPIO
-.br
-
-.br
-gpioSetWatchdog Set a watchdog on a GPIO
-.br
-
-.br
-gpioRead_Bits_0_31 Read all GPIO in bank 1
-.br
-gpioRead_Bits_32_53 Read all GPIO in bank 2
-.br
-
-.br
-gpioWrite_Bits_0_31_Clear Clear selected GPIO in bank 1
-.br
-gpioWrite_Bits_32_53_Clear Clear selected GPIO in bank 2
-.br
-
-.br
-gpioWrite_Bits_0_31_Set Set selected GPIO in bank 1
-.br
-gpioWrite_Bits_32_53_Set Set selected GPIO in bank 2
-.br
-
-.br
-gpioSetAlertFunc Request a GPIO level change callback
-.br
-gpioSetAlertFuncEx Request a GPIO change callback, extended
-.br
-
-.br
-gpioSetTimerFunc Request a regular timed callback
-.br
-gpioSetTimerFuncEx Request a regular timed callback, extended
-.br
-
-.br
-gpioStartThread Start a new thread
-.br
-gpioStopThread Stop a previously started thread
-.br
-.SS ADVANCED
-.br
-
-.br
-gpioNotifyOpen Request a notification handle
-.br
-gpioNotifyClose Close a notification
-.br
-gpioNotifyOpenWithSize Request a notification with sized pipe
-.br
-gpioNotifyBegin Start notifications for selected GPIO
-.br
-gpioNotifyPause Pause notifications
-.br
-
-.br
-gpioHardwareClock Start hardware clock on supported GPIO
-.br
-
-.br
-gpioHardwarePWM Start hardware PWM on supported GPIO
-.br
-
-.br
-gpioGlitchFilter Set a glitch filter on a GPIO
-.br
-gpioNoiseFilter Set a noise filter on a GPIO
-.br
-
-.br
-gpioSetPad Sets a pads drive strength
-.br
-gpioGetPad Gets a pads drive strength
-.br
-
-.br
-shell Executes a shell command
-.br
-
-.br
-gpioSetISRFunc Request a GPIO interrupt callback
-.br
-gpioSetISRFuncEx Request a GPIO interrupt callback, extended
-.br
-
-.br
-gpioSetSignalFunc Request a signal callback
-.br
-gpioSetSignalFuncEx Request a signal callback, extended
-.br
-
-.br
-gpioSetGetSamplesFunc Requests a GPIO samples callback
-.br
-gpioSetGetSamplesFuncEx Requests a GPIO samples callback, extended
-.br
-.SS Custom
-.br
-
-.br
-gpioCustom1 User custom function 1
-.br
-gpioCustom2 User custom function 2
-.br
-.SS Events
-.br
-
-.br
-eventMonitor Sets the events to monitor
-.br
-eventSetFunc Request an event callback
-.br
-eventSetFuncEx Request an event callback, extended
-.br
-
-.br
-eventTrigger Trigger an event
-.br
-.SS Scripts
-.br
-
-.br
-gpioStoreScript Store a script
-.br
-gpioRunScript Run a stored script
-.br
-gpioUpdateScript Set a scripts parameters
-.br
-gpioScriptStatus Get script status and parameters
-.br
-gpioStopScript Stop a running script
-.br
-gpioDeleteScript Delete a stored script
-.br
-.SS I2C
-.br
-
-.br
-i2cOpen Opens an I2C device
-.br
-i2cClose Closes an I2C device
-.br
-
-.br
-i2cWriteQuick SMBus write quick
-.br
-
-.br
-i2cReadByte SMBus read byte
-.br
-i2cWriteByte SMBus write byte
-.br
-
-.br
-i2cReadByteData SMBus read byte data
-.br
-i2cWriteByteData SMBus write byte data
-.br
-
-.br
-i2cReadWordData SMBus read word data
-.br
-i2cWriteWordData SMBus write word data
-.br
-
-.br
-i2cReadBlockData SMBus read block data
-.br
-i2cWriteBlockData SMBus write block data
-.br
-
-.br
-i2cReadI2CBlockData SMBus read I2C block data
-.br
-i2cWriteI2CBlockData SMBus write I2C block data
-.br
-
-.br
-i2cReadDevice Reads the raw I2C device
-.br
-i2cWriteDevice Writes the raw I2C device
-.br
-
-.br
-i2cProcessCall SMBus process call
-.br
-i2cBlockProcessCall SMBus block process call
-.br
-
-.br
-i2cSwitchCombined Sets or clears the combined flag
-.br
-
-.br
-i2cSegments Performs multiple I2C transactions
-.br
-
-.br
-i2cZip Performs multiple I2C transactions
-.br
-.SS I2C BIT BANG
-.br
-
-.br
-bbI2COpen Opens GPIO for bit banging I2C
-.br
-bbI2CClose Closes GPIO for bit banging I2C
-.br
-
-.br
-bbI2CZip Performs bit banged I2C transactions
-.br
-.SS I2C/SPI SLAVE
-.br
-
-.br
-bscXfer I2C/SPI as slave transfer
-.br
-.SS SERIAL
-.br
-
-.br
-serOpen Opens a serial device
-.br
-serClose Closes a serial device
-.br
-
-.br
-serReadByte Reads a byte from a serial device
-.br
-serWriteByte Writes a byte to a serial device
-.br
-
-.br
-serRead Reads bytes from a serial device
-.br
-serWrite Writes bytes to a serial device
-.br
-
-.br
-serDataAvailable Returns number of bytes ready to be read
-.br
-.SS SERIAL BIT BANG (read only)
-.br
-
-.br
-gpioSerialReadOpen Opens a GPIO for bit bang serial reads
-.br
-gpioSerialReadClose Closes a GPIO for bit bang serial reads
-.br
-
-.br
-gpioSerialReadInvert Configures normal/inverted for serial reads
-.br
-
-.br
-gpioSerialRead Reads bit bang serial data from a GPIO
-.br
-.SS SPI
-.br
-
-.br
-spiOpen Opens a SPI device
-.br
-spiClose Closes a SPI device
-.br
-
-.br
-spiRead Reads bytes from a SPI device
-.br
-spiWrite Writes bytes to a SPI device
-.br
-spiXfer Transfers bytes with a SPI device
-.br
-.SS SPI BIT BANG
-.br
-
-.br
-bbSPIOpen Opens GPIO for bit banging SPI
-.br
-bbSPIClose Closes GPIO for bit banging SPI
-.br
-
-.br
-bbSPIXfer Performs bit banged SPI transactions
-.br
-.SS FILES
-.br
-
-.br
-fileOpen Opens a file
-.br
-fileClose Closes a file
-.br
-
-.br
-fileRead Reads bytes from a file
-.br
-fileWrite Writes bytes to a file
-.br
-
-.br
-fileSeek Seeks to a position within a file
-.br
-
-.br
-fileList List files which match a pattern
-.br
-.SS WAVES
-.br
-
-.br
-gpioWaveClear Deletes all waveforms
-.br
-
-.br
-gpioWaveAddNew Starts a new waveform
-.br
-gpioWaveAddGeneric Adds a series of pulses to the waveform
-.br
-gpioWaveAddSerial Adds serial data to the waveform
-.br
-
-.br
-gpioWaveCreate Creates a waveform from added data
-.br
-gpioWaveCreatePad Creates a waveform of fixed size from added data
-.br
-gpioWaveDelete Deletes a waveform
-.br
-
-.br
-gpioWaveTxSend Transmits a waveform
-.br
-
-.br
-gpioWaveChain Transmits a chain of waveforms
-.br
-
-.br
-gpioWaveTxAt Returns the current transmitting waveform
-.br
-
-.br
-gpioWaveTxBusy Checks to see if the waveform has ended
-.br
-
-.br
-gpioWaveTxStop Aborts the current waveform
-.br
-
-.br
-gpioWaveGetCbs Length in CBs of the current waveform
-.br
-gpioWaveGetHighCbs Length of longest waveform so far
-.br
-gpioWaveGetMaxCbs Absolute maximum allowed CBs
-.br
-
-.br
-gpioWaveGetMicros Length in micros of the current waveform
-.br
-gpioWaveGetHighMicros Length of longest waveform so far
-.br
-gpioWaveGetMaxMicros Absolute maximum allowed micros
-.br
-
-.br
-gpioWaveGetPulses Length in pulses of the current waveform
-.br
-gpioWaveGetHighPulses Length of longest waveform so far
-.br
-gpioWaveGetMaxPulses Absolute maximum allowed pulses
-.br
-.SS UTILITIES
-.br
-
-.br
-gpioDelay Delay for a number of microseconds
-.br
-
-.br
-gpioTick Get current tick (microseconds)
-.br
-
-.br
-gpioHardwareRevision Get hardware revision
-.br
-gpioVersion Get the pigpio version
-.br
-
-.br
-getBitInBytes Get the value of a bit
-.br
-putBitInBytes Set the value of a bit
-.br
-
-.br
-gpioTime Get current time
-.br
-gpioSleep Sleep for specified time
-.br
-
-.br
-time_sleep Sleeps for a float number of seconds
-.br
-time_time Float number of seconds since the epoch
-.br
-.SS CONFIGURATION
-.br
-
-.br
-gpioCfgBufferSize Configure the GPIO sample buffer size
-.br
-gpioCfgClock Configure the GPIO sample rate
-.br
-gpioCfgDMAchannel Configure the DMA channel (DEPRECATED)
-.br
-gpioCfgDMAchannels Configure the DMA channels
-.br
-gpioCfgPermissions Configure the GPIO access permissions
-.br
-gpioCfgInterfaces Configure user interfaces
-.br
-gpioCfgSocketPort Configure socket port
-.br
-gpioCfgMemAlloc Configure DMA memory allocation mode
-.br
-gpioCfgNetAddr Configure allowed network addresses
-.br
-
-.br
-gpioCfgInternals Configure misc. internals (DEPRECATED)
-.br
-gpioCfgGetInternals Get internal configuration settings
-.br
-gpioCfgSetInternals Set internal configuration settings
-.br
-.SS EXPERT
-.br
-
-.br
-rawWaveAddSPI Not intended for general use
-.br
-rawWaveAddGeneric Not intended for general use
-.br
-rawWaveCB Not intended for general use
-.br
-rawWaveCBAdr Not intended for general use
-.br
-rawWaveGetOOL Not intended for general use
-.br
-rawWaveSetOOL Not intended for general use
-.br
-rawWaveGetOut Not intended for general use
-.br
-rawWaveSetOut Not intended for general use
-.br
-rawWaveGetIn Not intended for general use
-.br
-rawWaveSetIn Not intended for general use
-.br
-rawWaveInfo Not intended for general use
-.br
-rawDumpWave Not intended for general use
-.br
-rawDumpScript Not intended for general use
-.br
-.SH FUNCTIONS
-
-.IP "\fBint gpioInitialise(void)\fP"
-.IP "" 4
-Initialises the library.
-
-.br
-
-.br
-Returns the pigpio version number if OK, otherwise PI_INIT_FAILED.
-
-.br
-
-.br
-gpioInitialise must be called before using the other library functions
-with the following exceptions:
-
-.br
-
-.br
-
-.EX
-\fBgpioCfg*\fP
-.br
-\fBgpioVersion\fP
-.br
-\fBgpioHardwareRevision\fP
-.br
-
-.EE
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-if (gpioInitialise() < 0)
-.br
-{
-.br
- // pigpio initialisation failed.
-.br
-}
-.br
-else
-.br
-{
-.br
- // pigpio initialised okay.
-.br
-}
-.br
-
-.EE
-
-.IP "\fBvoid gpioTerminate(void)\fP"
-.IP "" 4
-Terminates the library.
-
-.br
-
-.br
-Returns nothing.
-
-.br
-
-.br
-Call before program exit.
-
-.br
-
-.br
-This function resets the used DMA channels, releases memory, and
-terminates any running threads.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-gpioTerminate();
-.br
-
-.EE
-
-.IP "\fBint gpioSetMode(unsigned gpio, unsigned mode)\fP"
-.IP "" 4
-Sets the GPIO mode, typically input or output.
-
-.br
-
-.br
-
-.EX
-gpio: 0-53
-.br
-mode: 0-7
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_GPIO or PI_BAD_MODE.
-
-.br
-
-.br
-Arduino style: pinMode.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-gpioSetMode(17, PI_INPUT); // Set GPIO17 as input.
-.br
-
-.br
-gpioSetMode(18, PI_OUTPUT); // Set GPIO18 as output.
-.br
-
-.br
-gpioSetMode(22,PI_ALT0); // Set GPIO22 to alternative mode 0.
-.br
-
-.EE
-
-.br
-
-.br
-See \fBhttp://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2835/BCM2835-ARM-Peripherals.pdf\fP page 102 for an overview of the modes.
-
-.IP "\fBint gpioGetMode(unsigned gpio)\fP"
-.IP "" 4
-Gets the GPIO mode.
-
-.br
-
-.br
-
-.EX
-gpio: 0-53
-.br
-
-.EE
-
-.br
-
-.br
-Returns the GPIO mode if OK, otherwise PI_BAD_GPIO.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-if (gpioGetMode(17) != PI_ALT0)
-.br
-{
-.br
- gpioSetMode(17, PI_ALT0); // set GPIO17 to ALT0
-.br
-}
-.br
-
-.EE
-
-.IP "\fBint gpioSetPullUpDown(unsigned gpio, unsigned pud)\fP"
-.IP "" 4
-Sets or clears resistor pull ups or downs on the GPIO.
-
-.br
-
-.br
-
-.EX
-gpio: 0-53
-.br
- pud: 0-2
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_GPIO or PI_BAD_PUD.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-gpioSetPullUpDown(17, PI_PUD_UP); // Sets a pull-up.
-.br
-
-.br
-gpioSetPullUpDown(18, PI_PUD_DOWN); // Sets a pull-down.
-.br
-
-.br
-gpioSetPullUpDown(23, PI_PUD_OFF); // Clear any pull-ups/downs.
-.br
-
-.EE
-
-.IP "\fBint gpioRead(unsigned gpio)\fP"
-.IP "" 4
-Reads the GPIO level, on or off.
-
-.br
-
-.br
-
-.EX
-gpio: 0-53
-.br
-
-.EE
-
-.br
-
-.br
-Returns the GPIO level if OK, otherwise PI_BAD_GPIO.
-
-.br
-
-.br
-Arduino style: digitalRead.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-printf("GPIO24 is level %d", gpioRead(24));
-.br
-
-.EE
-
-.IP "\fBint gpioWrite(unsigned gpio, unsigned level)\fP"
-.IP "" 4
-Sets the GPIO level, on or off.
-
-.br
-
-.br
-
-.EX
- gpio: 0-53
-.br
-level: 0-1
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_GPIO or PI_BAD_LEVEL.
-
-.br
-
-.br
-If PWM or servo pulses are active on the GPIO they are switched off.
-
-.br
-
-.br
-Arduino style: digitalWrite
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-gpioWrite(24, 1); // Set GPIO24 high.
-.br
-
-.EE
-
-.IP "\fBint gpioPWM(unsigned user_gpio, unsigned dutycycle)\fP"
-.IP "" 4
-Starts PWM on the GPIO, dutycycle between 0 (off) and range (fully on).
-Range defaults to 255.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31
-.br
-dutycycle: 0-range
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_BAD_DUTYCYCLE.
-
-.br
-
-.br
-Arduino style: analogWrite
-
-.br
-
-.br
-This and the servo functionality use the DMA and PWM or PCM peripherals
-to control and schedule the pulse lengths and dutycycles.
-
-.br
-
-.br
-The \fBgpioSetPWMrange\fP function may be used to change the default
-range of 255.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-gpioPWM(17, 255); // Sets GPIO17 full on.
-.br
-
-.br
-gpioPWM(18, 128); // Sets GPIO18 half on.
-.br
-
-.br
-gpioPWM(23, 0); // Sets GPIO23 full off.
-.br
-
-.EE
-
-.IP "\fBint gpioGetPWMdutycycle(unsigned user_gpio)\fP"
-.IP "" 4
-Returns the PWM dutycycle setting for the GPIO.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31
-.br
-
-.EE
-
-.br
-
-.br
-Returns between 0 (off) and range (fully on) if OK, otherwise
-PI_BAD_USER_GPIO or PI_NOT_PWM_GPIO.
-
-.br
-
-.br
-For normal PWM the dutycycle will be out of the defined range
-for the GPIO (see \fBgpioGetPWMrange\fP).
-
-.br
-
-.br
-If a hardware clock is active on the GPIO the reported dutycycle
-will be 500000 (500k) out of 1000000 (1M).
-
-.br
-
-.br
-If hardware PWM is active on the GPIO the reported dutycycle
-will be out of a 1000000 (1M).
-
-.br
-
-.br
-Normal PWM range defaults to 255.
-
-.IP "\fBint gpioSetPWMrange(unsigned user_gpio, unsigned range)\fP"
-.IP "" 4
-Selects the dutycycle range to be used for the GPIO. Subsequent calls
-to gpioPWM will use a dutycycle between 0 (off) and range (fully on).
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31
-.br
- range: 25-40000
-.br
-
-.EE
-
-.br
-
-.br
-Returns the real range for the given GPIO's frequency if OK,
-otherwise PI_BAD_USER_GPIO or PI_BAD_DUTYRANGE.
-
-.br
-
-.br
-If PWM is currently active on the GPIO its dutycycle will be scaled
-to reflect the new range.
-
-.br
-
-.br
-The real range, the number of steps between fully off and fully
-on for each frequency, is given in the following table.
-
-.br
-
-.br
-
-.EX
- 25, 50, 100, 125, 200, 250, 400, 500, 625,
-.br
- 800, 1000, 1250, 2000, 2500, 4000, 5000, 10000, 20000
-.br
-
-.EE
-
-.br
-
-.br
-The real value set by \fBgpioPWM\fP is (dutycycle * real range) / range.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-gpioSetPWMrange(24, 2000); // Now 2000 is fully on
-.br
- // 1000 is half on
-.br
- // 500 is quarter on, etc.
-.br
-
-.EE
-
-.IP "\fBint gpioGetPWMrange(unsigned user_gpio)\fP"
-.IP "" 4
-Returns the dutycycle range used for the GPIO if OK, otherwise
-PI_BAD_USER_GPIO.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31
-.br
-
-.EE
-
-.br
-
-.br
-If a hardware clock or hardware PWM is active on the GPIO
-the reported range will be 1000000 (1M).
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-r = gpioGetPWMrange(23);
-.br
-
-.EE
-
-.IP "\fBint gpioGetPWMrealRange(unsigned user_gpio)\fP"
-.IP "" 4
-Returns the real range used for the GPIO if OK, otherwise
-PI_BAD_USER_GPIO.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31
-.br
-
-.EE
-
-.br
-
-.br
-If a hardware clock is active on the GPIO the reported real
-range will be 1000000 (1M).
-
-.br
-
-.br
-If hardware PWM is active on the GPIO the reported real range
-will be approximately 250M divided by the set PWM frequency.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-rr = gpioGetPWMrealRange(17);
-.br
-
-.EE
-
-.IP "\fBint gpioSetPWMfrequency(unsigned user_gpio, unsigned frequency)\fP"
-.IP "" 4
-Sets the frequency in hertz to be used for the GPIO.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31
-.br
-frequency: >=0
-.br
-
-.EE
-
-.br
-
-.br
-Returns the numerically closest frequency if OK, otherwise
-PI_BAD_USER_GPIO.
-
-.br
-
-.br
-If PWM is currently active on the GPIO it will be
-switched off and then back on at the new frequency.
-
-.br
-
-.br
-Each GPIO can be independently set to one of 18 different PWM
-frequencies.
-
-.br
-
-.br
-The selectable frequencies depend upon the sample rate which
-may be 1, 2, 4, 5, 8, or 10 microseconds (default 5).
-
-.br
-
-.br
-The frequencies for each sample rate are:
-
-.br
-
-.br
-
-.EX
- Hertz
-.br
-
-.br
- 1: 40000 20000 10000 8000 5000 4000 2500 2000 1600
-.br
- 1250 1000 800 500 400 250 200 100 50
-.br
-
-.br
- 2: 20000 10000 5000 4000 2500 2000 1250 1000 800
-.br
- 625 500 400 250 200 125 100 50 25
-.br
-
-.br
- 4: 10000 5000 2500 2000 1250 1000 625 500 400
-.br
- 313 250 200 125 100 63 50 25 13
-.br
-sample
-.br
- rate
-.br
- (us) 5: 8000 4000 2000 1600 1000 800 500 400 320
-.br
- 250 200 160 100 80 50 40 20 10
-.br
-
-.br
- 8: 5000 2500 1250 1000 625 500 313 250 200
-.br
- 156 125 100 63 50 31 25 13 6
-.br
-
-.br
- 10: 4000 2000 1000 800 500 400 250 200 160
-.br
- 125 100 80 50 40 25 20 10 5
-.br
-
-.EE
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-gpioSetPWMfrequency(23, 0); // Set GPIO23 to lowest frequency.
-.br
-
-.br
-gpioSetPWMfrequency(24, 500); // Set GPIO24 to 500Hz.
-.br
-
-.br
-gpioSetPWMfrequency(25, 100000); // Set GPIO25 to highest frequency.
-.br
-
-.EE
-
-.IP "\fBint gpioGetPWMfrequency(unsigned user_gpio)\fP"
-.IP "" 4
-Returns the frequency (in hertz) used for the GPIO if OK, otherwise
-PI_BAD_USER_GPIO.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31
-.br
-
-.EE
-
-.br
-
-.br
-For normal PWM the frequency will be that defined for the GPIO by
-\fBgpioSetPWMfrequency\fP.
-
-.br
-
-.br
-If a hardware clock is active on the GPIO the reported frequency
-will be that set by \fBgpioHardwareClock\fP.
-
-.br
-
-.br
-If hardware PWM is active on the GPIO the reported frequency
-will be that set by \fBgpioHardwarePWM\fP.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-f = gpioGetPWMfrequency(23); // Get frequency used for GPIO23.
-.br
-
-.EE
-
-.IP "\fBint gpioServo(unsigned user_gpio, unsigned pulsewidth)\fP"
-.IP "" 4
-Starts servo pulses on the GPIO, 0 (off), 500 (most anti-clockwise) to
-2500 (most clockwise).
-
-.br
-
-.br
-
-.EX
- user_gpio: 0-31
-.br
-pulsewidth: 0, 500-2500
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_BAD_PULSEWIDTH.
-
-.br
-
-.br
-The range supported by servos varies and should probably be determined
-by experiment. A value of 1500 should always be safe and represents
-the mid-point of rotation. You can DAMAGE a servo if you command it
-to move beyond its limits.
-
-.br
-
-.br
-The following causes an on pulse of 1500 microseconds duration to be
-transmitted on GPIO 17 at a rate of 50 times per second. This will
-command a servo connected to GPIO 17 to rotate to its mid-point.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-gpioServo(17, 1000); // Move servo to safe position anti-clockwise.
-.br
-
-.br
-gpioServo(23, 1500); // Move servo to centre position.
-.br
-
-.br
-gpioServo(25, 2000); // Move servo to safe position clockwise.
-.br
-
-.EE
-
-.br
-
-.br
-OTHER UPDATE RATES:
-
-.br
-
-.br
-This function updates servos at 50Hz. If you wish to use a different
-update frequency you will have to use the PWM functions.
-
-.br
-
-.br
-
-.EX
-PWM Hz 50 100 200 400 500
-.br
-1E6/Hz 20000 10000 5000 2500 2000
-.br
-
-.EE
-
-.br
-
-.br
-Firstly set the desired PWM frequency using \fBgpioSetPWMfrequency\fP.
-
-.br
-
-.br
-Then set the PWM range using \fBgpioSetPWMrange\fP to 1E6/frequency.
-Doing this allows you to use units of microseconds when setting
-the servo pulsewidth.
-
-.br
-
-.br
-E.g. If you want to update a servo connected to GPIO25 at 400Hz
-
-.br
-
-.br
-
-.EX
-gpioSetPWMfrequency(25, 400);
-.br
-
-.br
-gpioSetPWMrange(25, 2500);
-.br
-
-.EE
-
-.br
-
-.br
-Thereafter use the PWM command to move the servo,
-e.g. gpioPWM(25, 1500) will set a 1500 us pulse.
-
-.IP "\fBint gpioGetServoPulsewidth(unsigned user_gpio)\fP"
-.IP "" 4
-Returns the servo pulsewidth setting for the GPIO.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 (off), 500 (most anti-clockwise) to 2500 (most clockwise)
-if OK, otherwise PI_BAD_USER_GPIO or PI_NOT_SERVO_GPIO.
-
-.IP "\fBint gpioSetAlertFunc(unsigned user_gpio, gpioAlertFunc_t f)\fP"
-.IP "" 4
-Registers a function to be called (a callback) when the specified
-GPIO changes state.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31
-.br
- f: the callback function
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO.
-
-.br
-
-.br
-One callback may be registered per GPIO.
-
-.br
-
-.br
-The callback is passed the GPIO, the new level, and the tick.
-
-.br
-
-.br
-
-.EX
-Parameter Value Meaning
-.br
-
-.br
-GPIO 0-31 The GPIO which has changed state
-.br
-
-.br
-level 0-2 0 = change to low (a falling edge)
-.br
- 1 = change to high (a rising edge)
-.br
- 2 = no level change (a watchdog timeout)
-.br
-
-.br
-tick 32 bit The number of microseconds since boot
-.br
- WARNING: this wraps around from
-.br
- 4294967295 to 0 roughly every 72 minutes
-.br
-
-.EE
-
-.br
-
-.br
-The alert may be cancelled by passing NULL as the function.
-
-.br
-
-.br
-The GPIO are sampled at a rate set when the library is started.
-
-.br
-
-.br
-If a value isn't specifically set the default of 5 us is used.
-
-.br
-
-.br
-The number of samples per second is given in the following table.
-
-.br
-
-.br
-
-.EX
- samples
-.br
- per sec
-.br
-
-.br
- 1 1,000,000
-.br
- 2 500,000
-.br
-sample 4 250,000
-.br
-rate 5 200,000
-.br
-(us) 8 125,000
-.br
- 10 100,000
-.br
-
-.EE
-
-.br
-
-.br
-Level changes shorter than the sample rate may be missed.
-
-.br
-
-.br
-The thread which calls the alert functions is triggered nominally
-1000 times per second. The active alert functions will be called
-once per level change since the last time the thread was activated.
-i.e. The active alert functions will get all level changes but there
-will be a latency.
-
-.br
-
-.br
-If you want to track the level of more than one GPIO do so by
-maintaining the state in the callback. Do not use \fBgpioRead\fP.
-Remember the event that triggered the callback may have
-happened several milliseconds before and the GPIO may have
-changed level many times since then.
-
-.br
-
-.br
-The tick value is the time stamp of the sample in microseconds, see
-\fBgpioTick\fP for more details.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-void aFunction(int gpio, int level, uint32_t tick)
-.br
-{
-.br
- printf("GPIO %d became %d at %d", gpio, level, tick);
-.br
-}
-.br
-
-.br
-// call aFunction whenever GPIO 4 changes state
-.br
-
-.br
-gpioSetAlertFunc(4, aFunction);
-.br
-
-.EE
-
-.IP "\fBint gpioSetAlertFuncEx(unsigned user_gpio, gpioAlertFuncEx_t f, void *userdata)\fP"
-.IP "" 4
-Registers a function to be called (a callback) when the specified
-GPIO changes state.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31
-.br
- f: the callback function
-.br
- userdata: pointer to arbitrary user data
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO.
-
-.br
-
-.br
-One callback may be registered per GPIO.
-
-.br
-
-.br
-The callback is passed the GPIO, the new level, the tick, and
-the userdata pointer.
-
-.br
-
-.br
-
-.EX
-Parameter Value Meaning
-.br
-
-.br
-GPIO 0-31 The GPIO which has changed state
-.br
-
-.br
-level 0-2 0 = change to low (a falling edge)
-.br
- 1 = change to high (a rising edge)
-.br
- 2 = no level change (a watchdog timeout)
-.br
-
-.br
-tick 32 bit The number of microseconds since boot
-.br
- WARNING: this wraps around from
-.br
- 4294967295 to 0 roughly every 72 minutes
-.br
-
-.br
-userdata pointer Pointer to an arbitrary object
-.br
-
-.EE
-
-.br
-
-.br
-See \fBgpioSetAlertFunc\fP for further details.
-
-.br
-
-.br
-Only one of \fBgpioSetAlertFunc\fP or \fBgpioSetAlertFuncEx\fP can be
-registered per GPIO.
-
-.IP "\fBint gpioSetISRFunc(unsigned gpio, unsigned edge, int timeout, gpioISRFunc_t f)\fP"
-.IP "" 4
-Registers a function to be called (a callback) whenever the specified
-GPIO interrupt occurs.
-
-.br
-
-.br
-
-.EX
- gpio: 0-53
-.br
- edge: RISING_EDGE, FALLING_EDGE, or EITHER_EDGE
-.br
-timeout: interrupt timeout in milliseconds (<=0 to cancel)
-.br
- f: the callback function
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_EDGE,
-or PI_BAD_ISR_INIT.
-
-.br
-
-.br
-One function may be registered per GPIO.
-
-.br
-
-.br
-The function is passed the GPIO, the current level, and the
-current tick. The level will be PI_TIMEOUT if the optional
-interrupt timeout expires.
-
-.br
-
-.br
-
-.EX
-Parameter Value Meaning
-.br
-
-.br
-GPIO 0-53 The GPIO which has changed state
-.br
-
-.br
-level 0-2 0 = change to low (a falling edge)
-.br
- 1 = change to high (a rising edge)
-.br
- 2 = no level change (interrupt timeout)
-.br
-
-.br
-tick 32 bit The number of microseconds since boot
-.br
- WARNING: this wraps around from
-.br
- 4294967295 to 0 roughly every 72 minutes
-.br
-
-.EE
-
-.br
-
-.br
-The underlying Linux sysfs GPIO interface is used to provide
-the interrupt services.
-
-.br
-
-.br
-The first time the function is called, with a non-NULL f, the
-GPIO is exported, set to be an input, and set to interrupt
-on the given edge and timeout.
-
-.br
-
-.br
-Subsequent calls, with a non-NULL f, can vary one or more of the
-edge, timeout, or function.
-
-.br
-
-.br
-The ISR may be cancelled by passing a NULL f, in which case the
-GPIO is unexported.
-
-.br
-
-.br
-The tick is that read at the time the process was informed of
-the interrupt. This will be a variable number of microseconds
-after the interrupt occurred. Typically the latency will be of
-the order of 50 microseconds. The latency is not guaranteed
-and will vary with system load.
-
-.br
-
-.br
-The level is that read at the time the process was informed of
-the interrupt, or PI_TIMEOUT if the optional interrupt timeout
-expired. It may not be the same as the expected edge as
-interrupts happening in rapid succession may be missed by the
-kernel (i.e. this mechanism can not be used to capture several
-interrupts only a few microseconds apart).
-
-.IP "\fBint gpioSetISRFuncEx(unsigned gpio, unsigned edge, int timeout, gpioISRFuncEx_t f, void *userdata)\fP"
-.IP "" 4
-Registers a function to be called (a callback) whenever the specified
-GPIO interrupt occurs.
-
-.br
-
-.br
-
-.EX
- gpio: 0-53
-.br
- edge: RISING_EDGE, FALLING_EDGE, or EITHER_EDGE
-.br
- timeout: interrupt timeout in milliseconds (<=0 to cancel)
-.br
- f: the callback function
-.br
-userdata: pointer to arbitrary user data
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_EDGE,
-or PI_BAD_ISR_INIT.
-
-.br
-
-.br
-The function is passed the GPIO, the current level, the
-current tick, and the userdata pointer.
-
-.br
-
-.br
-
-.EX
-Parameter Value Meaning
-.br
-
-.br
-GPIO 0-53 The GPIO which has changed state
-.br
-
-.br
-level 0-2 0 = change to low (a falling edge)
-.br
- 1 = change to high (a rising edge)
-.br
- 2 = no level change (interrupt timeout)
-.br
-
-.br
-tick 32 bit The number of microseconds since boot
-.br
- WARNING: this wraps around from
-.br
- 4294967295 to 0 roughly every 72 minutes
-.br
-
-.br
-userdata pointer Pointer to an arbitrary object
-.br
-
-.EE
-
-.br
-
-.br
-Only one of \fBgpioSetISRFunc\fP or \fBgpioSetISRFuncEx\fP can be
-registered per GPIO.
-
-.br
-
-.br
-See \fBgpioSetISRFunc\fP for further details.
-
-.IP "\fBint gpioNotifyOpen(void)\fP"
-.IP "" 4
-This function requests a free notification handle.
-
-.br
-
-.br
-Returns a handle greater than or equal to zero if OK,
-otherwise PI_NO_HANDLE.
-
-.br
-
-.br
-A notification is a method for being notified of GPIO state changes
-via a pipe or socket.
-
-.br
-
-.br
-Pipe notifications for handle x will be available at the pipe
-named /dev/pigpiox (where x is the handle number). E.g. if the
-function returns 15 then the notifications must be read
-from /dev/pigpio15.
-
-.br
-
-.br
-Socket notifications are returned to the socket which requested the
-handle.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-h = gpioNotifyOpen();
-.br
-
-.br
-if (h >= 0)
-.br
-{
-.br
- sprintf(str, "/dev/pigpio%d", h);
-.br
-
-.br
- fd = open(str, O_RDONLY);
-.br
-
-.br
- if (fd >= 0)
-.br
- {
-.br
- // Okay.
-.br
- }
-.br
- else
-.br
- {
-.br
- // Error.
-.br
- }
-.br
-}
-.br
-else
-.br
-{
-.br
- // Error.
-.br
-}
-.br
-
-.EE
-
-.IP "\fBint gpioNotifyOpenWithSize(int bufSize)\fP"
-.IP "" 4
-This function requests a free notification handle.
-
-.br
-
-.br
-It differs from \fBgpioNotifyOpen\fP in that the pipe size may be
-specified, whereas \fBgpioNotifyOpen\fP uses the default pipe size.
-
-.br
-
-.br
-See \fBgpioNotifyOpen\fP for further details.
-
-.IP "\fBint gpioNotifyBegin(unsigned handle, uint32_t bits)\fP"
-.IP "" 4
-This function starts notifications on a previously opened handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by \fBgpioNotifyOpen\fP
-.br
- bits: a bit mask indicating the GPIO of interest
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE.
-
-.br
-
-.br
-The notification sends state changes for each GPIO whose corresponding
-bit in bits is set.
-
-.br
-
-.br
-Each notification occupies 12 bytes in the fifo and has the
-following structure.
-
-.br
-
-.br
-
-.EX
-typedef struct
-.br
-{
-.br
- uint16_t seqno;
-.br
- uint16_t flags;
-.br
- uint32_t tick;
-.br
- uint32_t level;
-.br
-} gpioReport_t;
-.br
-
-.EE
-
-.br
-
-.br
-seqno: starts at 0 each time the handle is opened and then increments
-by one for each report.
-
-.br
-
-.br
-flags: three flags are defined, PI_NTFY_FLAGS_WDOG,
-PI_NTFY_FLAGS_ALIVE, and PI_NTFY_FLAGS_EVENT.
-
-.br
-
-.br
-If bit 5 is set (PI_NTFY_FLAGS_WDOG) then bits 0-4 of the flags
-indicate a GPIO which has had a watchdog timeout.
-
-.br
-
-.br
-If bit 6 is set (PI_NTFY_FLAGS_ALIVE) this indicates a keep alive
-signal on the pipe/socket and is sent once a minute in the absence
-of other notification activity.
-
-.br
-
-.br
-If bit 7 is set (PI_NTFY_FLAGS_EVENT) then bits 0-4 of the flags
-indicate an event which has been triggered.
-
-.br
-
-.br
-tick: the number of microseconds since system boot. It wraps around
-after 1h12m.
-
-.br
-
-.br
-level: indicates the level of each GPIO. If bit 1<<x is set then
-GPIO x is high.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-// Start notifications for GPIO 1, 4, 6, 7, 10.
-.br
-
-.br
-// 1
-.br
-// 0 76 4 1
-.br
-// (1234 = 0x04D2 = 0b0000010011010010)
-.br
-
-.br
-gpioNotifyBegin(h, 1234);
-.br
-
-.EE
-
-.IP "\fBint gpioNotifyPause(unsigned handle)\fP"
-.IP "" 4
-This function pauses notifications on a previously opened handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by \fBgpioNotifyOpen\fP
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE.
-
-.br
-
-.br
-Notifications for the handle are suspended until \fBgpioNotifyBegin\fP
-is called again.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-gpioNotifyPause(h);
-.br
-
-.EE
-
-.IP "\fBint gpioNotifyClose(unsigned handle)\fP"
-.IP "" 4
-This function stops notifications on a previously opened handle
-and releases the handle for reuse.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by \fBgpioNotifyOpen\fP
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-gpioNotifyClose(h);
-.br
-
-.EE
-
-.IP "\fBint gpioWaveClear(void)\fP"
-.IP "" 4
-This function clears all waveforms and any data added by calls to the
-\fBgpioWaveAdd*\fP functions.
-
-.br
-
-.br
-Returns 0 if OK.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-gpioWaveClear();
-.br
-
-.EE
-
-.IP "\fBint gpioWaveAddNew(void)\fP"
-.IP "" 4
-This function starts a new empty waveform.
-
-.br
-
-.br
-You wouldn't normally need to call this function as it is automatically
-called after a waveform is created with the \fBgpioWaveCreate\fP function.
-
-.br
-
-.br
-Returns 0 if OK.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-gpioWaveAddNew();
-.br
-
-.EE
-
-.IP "\fBint gpioWaveAddGeneric(unsigned numPulses, gpioPulse_t *pulses)\fP"
-.IP "" 4
-This function adds a number of pulses to the current waveform.
-
-.br
-
-.br
-
-.EX
-numPulses: the number of pulses
-.br
- pulses: an array of pulses
-.br
-
-.EE
-
-.br
-
-.br
-Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_TOO_MANY_PULSES.
-
-.br
-
-.br
-The pulses are interleaved in time order within the existing waveform
-(if any).
-
-.br
-
-.br
-Merging allows the waveform to be built in parts, that is the settings
-for GPIO#1 can be added, and then GPIO#2 etc.
-
-.br
-
-.br
-If the added waveform is intended to start after or within the existing
-waveform then the first pulse should consist of a delay.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-// Construct and send a 30 microsecond square wave.
-.br
-
-.br
-gpioSetMode(gpio, PI_OUTPUT);
-.br
-
-.br
-pulse[0].gpioOn = (1<<gpio);
-.br
-pulse[0].gpioOff = 0;
-.br
-pulse[0].usDelay = 15;
-.br
-
-.br
-pulse[1].gpioOn = 0;
-.br
-pulse[1].gpioOff = (1<<gpio);
-.br
-pulse[1].usDelay = 15;
-.br
-
-.br
-gpioWaveAddNew();
-.br
-
-.br
-gpioWaveAddGeneric(2, pulse);
-.br
-
-.br
-wave_id = gpioWaveCreate();
-.br
-
-.br
-if (wave_id >= 0)
-.br
-{
-.br
- gpioWaveTxSend(wave_id, PI_WAVE_MODE_REPEAT);
-.br
-
-.br
- // Transmit for 30 seconds.
-.br
-
-.br
- sleep(30);
-.br
-
-.br
- gpioWaveTxStop();
-.br
-}
-.br
-else
-.br
-{
-.br
- // Wave create failed.
-.br
-}
-.br
-
-.EE
-
-.IP "\fBint gpioWaveAddSerial(unsigned user_gpio, unsigned baud, unsigned data_bits, unsigned stop_bits, unsigned offset, unsigned numBytes, char *str)\fP"
-.IP "" 4
-This function adds a waveform representing serial data to the
-existing waveform (if any). The serial data starts offset
-microseconds from the start of the waveform.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31
-.br
- baud: 50-1000000
-.br
-data_bits: 1-32
-.br
-stop_bits: 2-8
-.br
- offset: >=0
-.br
- numBytes: >=1
-.br
- str: an array of chars (which may contain nulls)
-.br
-
-.EE
-
-.br
-
-.br
-Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_BAD_USER_GPIO, PI_BAD_WAVE_BAUD, PI_BAD_DATABITS,
-PI_BAD_STOPBITS, PI_TOO_MANY_CHARS, PI_BAD_SER_OFFSET,
-or PI_TOO_MANY_PULSES.
-
-.br
-
-.br
-NOTES:
-
-.br
-
-.br
-The serial data is formatted as one start bit, data_bits data bits, and
-stop_bits/2 stop bits.
-
-.br
-
-.br
-It is legal to add serial data streams with different baud rates to
-the same waveform.
-
-.br
-
-.br
-numBytes is the number of bytes of data in str.
-
-.br
-
-.br
-The bytes required for each character depend upon data_bits.
-
-.br
-
-.br
-For data_bits 1-8 there will be one byte per character.
-.br
-For data_bits 9-16 there will be two bytes per character.
-.br
-For data_bits 17-32 there will be four bytes per character.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-#define MSG_LEN 8
-.br
-
-.br
-int i;
-.br
-char *str;
-.br
-char data[MSG_LEN];
-.br
-
-.br
-str = "Hello world!";
-.br
-
-.br
-gpioWaveAddSerial(4, 9600, 8, 2, 0, strlen(str), str);
-.br
-
-.br
-for (i=0; i<MSG_LEN; i++) data[i] = i;
-.br
-
-.br
-// Data added is offset 1 second from the waveform start.
-.br
-gpioWaveAddSerial(4, 9600, 8, 2, 1000000, MSG_LEN, data);
-.br
-
-.EE
-
-.IP "\fBint gpioWaveCreate(void)\fP"
-.IP "" 4
-This function creates a waveform from the data provided by the prior
-calls to the \fBgpioWaveAdd*\fP functions. Upon success a wave id
-greater than or equal to 0 is returned, otherwise PI_EMPTY_WAVEFORM,
-PI_TOO_MANY_CBS, PI_TOO_MANY_OOL, or PI_NO_WAVEFORM_ID.
-
-.br
-
-.br
-The data provided by the \fBgpioWaveAdd*\fP functions is consumed by this
-function.
-
-.br
-
-.br
-As many waveforms may be created as there is space available. The
-wave id is passed to \fBgpioWaveTxSend\fP to specify the waveform to transmit.
-
-.br
-
-.br
-Normal usage would be
-
-.br
-
-.br
-Step 1. \fBgpioWaveClear\fP to clear all waveforms and added data.
-
-.br
-
-.br
-Step 2. \fBgpioWaveAdd*\fP calls to supply the waveform data.
-
-.br
-
-.br
-Step 3. \fBgpioWaveCreate\fP to create the waveform and get a unique id
-
-.br
-
-.br
-Repeat steps 2 and 3 as needed.
-
-.br
-
-.br
-Step 4. \fBgpioWaveTxSend\fP with the id of the waveform to transmit.
-
-.br
-
-.br
-A waveform comprises one of more pulses. Each pulse consists of a
-\fBgpioPulse_t\fP structure.
-
-.br
-
-.br
-
-.EX
-typedef struct
-.br
-{
-.br
- uint32_t gpioOn;
-.br
- uint32_t gpioOff;
-.br
- uint32_t usDelay;
-.br
-} gpioPulse_t;
-.br
-
-.EE
-
-.br
-
-.br
-The fields specify
-
-.br
-
-.br
-1) the GPIO to be switched on at the start of the pulse.
-.br
-2) the GPIO to be switched off at the start of the pulse.
-.br
-3) the delay in microseconds before the next pulse.
-
-.br
-
-.br
-Any or all the fields can be zero. It doesn't make any sense to
-set all the fields to zero (the pulse will be ignored).
-
-.br
-
-.br
-When a waveform is started each pulse is executed in order with the
-specified delay between the pulse and the next.
-
-.br
-
-.br
-Returns the new waveform id if OK, otherwise PI_EMPTY_WAVEFORM,
-PI_NO_WAVEFORM_ID, PI_TOO_MANY_CBS, or PI_TOO_MANY_OOL.
-
-.IP "\fBint gpioWaveCreatePad(int pctCB, int pctBOOL, int pctTOOL)\fP"
-.IP "" 4
-Similar to \fBgpioWaveCreate\fP, this function creates a waveform but pads the consumed
-resources. Padded waves of equal dimension can be re-cycled efficiently allowing
-newly created waves to re-use the resources of deleted waves of the same dimension.
-
-.br
-
-.br
-
-.EX
-pctCB: 0-100, the percent of all DMA control blocks to consume.
-.br
-pctBOOL: 0-100, percent On-Off-Level (OOL) buffer to consume for wave output.
-.br
-pctTOOL: 0-100, the percent of OOL buffer to consume for wave input (flags).
-.br
-
-.EE
-
-.br
-
-.br
-Upon success a wave id greater than or equal to 0 is returned, otherwise
-PI_EMPTY_WAVEFORM, PI_TOO_MANY_CBS, PI_TOO_MANY_OOL, or PI_NO_WAVEFORM_ID.
-
-.br
-
-.br
-Waveform data provided by \fBgpioWaveAdd*\fP and \fBrawWaveAdd*\fP functions are
-consumed by this function.
-
-.br
-
-.br
-A usage would be the creation of two waves where one is filled while the other
-is being transmitted. Each wave is assigned 50% of the resources.
-This buffer structure allows the transmission of infinite wave sequences.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
- // get firstWaveChunk, somehow
-.br
- gpioWaveAddGeneric(firstWaveChunk);
-.br
- wid = gpioWaveCreatePad(50, 50, 0);
-.br
- gpioWaveTxSend(wid, PI_WAVE_MODE_ONE_SHOT);
-.br
- // get nextWaveChunk
-.br
-
-.br
- while (nextWaveChunk) {
-.br
- gpioWaveAddGeneric(nextWaveChunk);
-.br
- nextWid = gpioWaveCreatePad(50, 50, 0);
-.br
- gpioWaveTxSend(nextWid, PI_WAVE_MODE_ONE_SHOT_SYNC);
-.br
- while(gpioWaveTxAt() == wid) time_sleep(0.1);
-.br
- gpioWaveDelete(wid);
-.br
- wid = nextWid;
-.br
- // get nextWaveChunk
-.br
- }
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBint gpioWaveDelete(unsigned wave_id)\fP"
-.IP "" 4
-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
-wave_id: >=0, as returned by \fBgpioWaveCreate\fP
-.br
-
-.EE
-
-.br
-
-.br
-Wave ids are allocated in order, 0, 1, 2, etc.
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_WAVE_ID.
-
-.IP "\fBint gpioWaveTxSend(unsigned wave_id, unsigned wave_mode)\fP"
-.IP "" 4
-This function transmits the waveform with id wave_id. The mode
-determines whether the waveform is sent once or cycles endlessly.
-The SYNC variants wait for the current waveform to reach the
-end of a cycle or finish before starting the new waveform.
-
-.br
-
-.br
-WARNING: bad things may happen if you delete the previous
-waveform before it has been synced to the new waveform.
-
-.br
-
-.br
-NOTE: Any hardware PWM started by \fBgpioHardwarePWM\fP will be cancelled.
-
-.br
-
-.br
-
-.EX
- wave_id: >=0, as returned by \fBgpioWaveCreate\fP
-.br
-wave_mode: PI_WAVE_MODE_ONE_SHOT, PI_WAVE_MODE_REPEAT,
-.br
- PI_WAVE_MODE_ONE_SHOT_SYNC, PI_WAVE_MODE_REPEAT_SYNC
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of DMA control blocks in the waveform if OK,
-otherwise PI_BAD_WAVE_ID, or PI_BAD_WAVE_MODE.
-
-.IP "\fBint gpioWaveChain(char *buf, unsigned bufSize)\fP"
-.IP "" 4
-This function transmits a chain of waveforms.
-
-.br
-
-.br
-NOTE: Any hardware PWM started by \fBgpioHardwarePWM\fP will be cancelled.
-
-.br
-
-.br
-The waves to be transmitted are specified by the contents of buf
-which contains an ordered list of \fBwave_id\fPs and optional command
-codes and related data.
-
-.br
-
-.br
-
-.EX
- buf: pointer to the wave_ids and optional command codes
-.br
-bufSize: the number of bytes in buf
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_CHAIN_NESTING, PI_CHAIN_LOOP_CNT, PI_BAD_CHAIN_LOOP, PI_BAD_CHAIN_CMD, PI_CHAIN_COUNTER,
-PI_BAD_CHAIN_DELAY, PI_CHAIN_TOO_BIG, or PI_BAD_WAVE_ID.
-
-.br
-
-.br
-Each wave is transmitted in the order specified. A wave may
-occur multiple times per chain.
-
-.br
-
-.br
-A blocks of waves may be transmitted multiple times by using
-the loop commands. The block is bracketed by loop start and
-end commands. Loops may be nested.
-
-.br
-
-.br
-Delays between waves may be added with the delay command.
-
-.br
-
-.br
-The following command codes are supported:
-
-.br
-
-.br
-Name Cmd & Data Meaning
-.br
-Loop Start 255 0 Identify start of a wave block
-.br
-Loop Repeat 255 1 x y loop x + y*256 times
-.br
-Delay 255 2 x y delay x + y*256 microseconds
-.br
-Loop Forever 255 3 loop forever
-.br
-
-.br
-
-.br
-If present Loop Forever must be the last entry in the chain.
-
-.br
-
-.br
-The code is currently dimensioned to support a chain with roughly
-600 entries and 20 loop counters.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-#include <stdio.h>
-.br
-#include <pigpio.h>
-.br
-
-.br
-#define WAVES 5
-.br
-#define GPIO 4
-.br
-
-.br
-int main(int argc, char *argv[])
-.br
-{
-.br
- int i, wid[WAVES];
-.br
-
-.br
- if (gpioInitialise()<0) return -1;
-.br
-
-.br
- gpioSetMode(GPIO, PI_OUTPUT);
-.br
-
-.br
- printf("start piscope, press return"); getchar();
-.br
-
-.br
- for (i=0; i<WAVES; i++)
-.br
- {
-.br
- gpioWaveAddGeneric(2, (gpioPulse_t[])
-.br
- {{1<<GPIO, 0, 20},
-.br
- {0, 1<<GPIO, (i+1)*200}});
-.br
-
-.br
- wid[i] = gpioWaveCreate();
-.br
- }
-.br
-
-.br
- gpioWaveChain((char []) {
-.br
- wid[4], wid[3], wid[2], // transmit waves 4+3+2
-.br
- 255, 0, // loop start
-.br
- wid[0], wid[0], wid[0], // transmit waves 0+0+0
-.br
- 255, 0, // loop start
-.br
- wid[0], wid[1], // transmit waves 0+1
-.br
- 255, 2, 0x88, 0x13, // delay 5000us
-.br
- 255, 1, 30, 0, // loop end (repeat 30 times)
-.br
- 255, 0, // loop start
-.br
- wid[2], wid[3], wid[0], // transmit waves 2+3+0
-.br
- wid[3], wid[1], wid[2], // transmit waves 3+1+2
-.br
- 255, 1, 10, 0, // loop end (repeat 10 times)
-.br
- 255, 1, 5, 0, // loop end (repeat 5 times)
-.br
- wid[4], wid[4], wid[4], // transmit waves 4+4+4
-.br
- 255, 2, 0x20, 0x4E, // delay 20000us
-.br
- wid[0], wid[0], wid[0], // transmit waves 0+0+0
-.br
-
-.br
- }, 46);
-.br
-
-.br
- while (gpioWaveTxBusy()) time_sleep(0.1);
-.br
-
-.br
- for (i=0; i<WAVES; i++) gpioWaveDelete(wid[i]);
-.br
-
-.br
- printf("stop piscope, press return"); getchar();
-.br
-
-.br
- gpioTerminate();
-.br
-}
-.br
-
-.EE
-
-.IP "\fBint gpioWaveTxAt(void)\fP"
-.IP "" 4
-This function returns the id of the waveform currently being
-transmitted.
-
-.br
-
-.br
-Returns the waveform id or one of the following special values:
-
-.br
-
-.br
-PI_WAVE_NOT_FOUND (9998) - transmitted wave not found.
-.br
-PI_NO_TX_WAVE (9999) - no wave being transmitted.
-
-.IP "\fBint gpioWaveTxBusy(void)\fP"
-.IP "" 4
-This function checks to see if a waveform is currently being
-transmitted.
-
-.br
-
-.br
-Returns 1 if a waveform is currently being transmitted, otherwise 0.
-
-.IP "\fBint gpioWaveTxStop(void)\fP"
-.IP "" 4
-This function aborts the transmission of the current waveform.
-
-.br
-
-.br
-Returns 0 if OK.
-
-.br
-
-.br
-This function is intended to stop a waveform started in repeat mode.
-
-.IP "\fBint gpioWaveGetMicros(void)\fP"
-.IP "" 4
-This function returns the length in microseconds of the current
-waveform.
-
-.IP "\fBint gpioWaveGetHighMicros(void)\fP"
-.IP "" 4
-This function returns the length in microseconds of the longest waveform
-created since \fBgpioInitialise\fP was called.
-
-.IP "\fBint gpioWaveGetMaxMicros(void)\fP"
-.IP "" 4
-This function returns the maximum possible size of a waveform in
-microseconds.
-
-.IP "\fBint gpioWaveGetPulses(void)\fP"
-.IP "" 4
-This function returns the length in pulses of the current waveform.
-
-.IP "\fBint gpioWaveGetHighPulses(void)\fP"
-.IP "" 4
-This function returns the length in pulses of the longest waveform
-created since \fBgpioInitialise\fP was called.
-
-.IP "\fBint gpioWaveGetMaxPulses(void)\fP"
-.IP "" 4
-This function returns the maximum possible size of a waveform in pulses.
-
-.IP "\fBint gpioWaveGetCbs(void)\fP"
-.IP "" 4
-This function returns the length in DMA control blocks of the current
-waveform.
-
-.IP "\fBint gpioWaveGetHighCbs(void)\fP"
-.IP "" 4
-This function returns the length in DMA control blocks of the longest
-waveform created since \fBgpioInitialise\fP was called.
-
-.IP "\fBint gpioWaveGetMaxCbs(void)\fP"
-.IP "" 4
-This function returns the maximum possible size of a waveform in DMA
-control blocks.
-
-.IP "\fBint gpioSerialReadOpen(unsigned user_gpio, unsigned baud, unsigned data_bits)\fP"
-.IP "" 4
-This function opens a GPIO for bit bang reading of serial data.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31
-.br
- baud: 50-250000
-.br
-data_bits: 1-32
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_WAVE_BAUD,
-PI_BAD_DATABITS, or PI_GPIO_IN_USE.
-
-.br
-
-.br
-The serial data is returned in a cyclic buffer and is read using
-\fBgpioSerialRead\fP.
-
-.br
-
-.br
-It is the caller's responsibility to read data from the cyclic buffer
-in a timely fashion.
-
-.IP "\fBint gpioSerialReadInvert(unsigned user_gpio, unsigned invert)\fP"
-.IP "" 4
-This function configures the level logic for bit bang serial reads.
-
-.br
-
-.br
-Use PI_BB_SER_INVERT to invert the serial logic and PI_BB_SER_NORMAL for
-normal logic. Default is PI_BB_SER_NORMAL.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31
-.br
- invert: 0-1
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_GPIO_IN_USE,
-PI_NOT_SERIAL_GPIO, or PI_BAD_SER_INVERT.
-
-.br
-
-.br
-The GPIO must be opened for bit bang reading of serial data using
-\fBgpioSerialReadOpen\fP prior to calling this function.
-
-.IP "\fBint gpioSerialRead(unsigned user_gpio, void *buf, size_t bufSize)\fP"
-.IP "" 4
-This function copies up to bufSize bytes of data read from the
-bit bang serial cyclic buffer to the buffer starting at buf.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31, previously opened with \fBgpioSerialReadOpen\fP
-.br
- buf: an array to receive the read bytes
-.br
- bufSize: >=0
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes copied if OK, otherwise PI_BAD_USER_GPIO
-or PI_NOT_SERIAL_GPIO.
-
-.br
-
-.br
-The bytes returned for each character depend upon the number of
-data bits \fBdata_bits\fP specified in the \fBgpioSerialReadOpen\fP command.
-
-.br
-
-.br
-For \fBdata_bits\fP 1-8 there will be one byte per character.
-.br
-For \fBdata_bits\fP 9-16 there will be two bytes per character.
-.br
-For \fBdata_bits\fP 17-32 there will be four bytes per character.
-
-.IP "\fBint gpioSerialReadClose(unsigned user_gpio)\fP"
-.IP "" 4
-This function closes a GPIO for bit bang reading of serial data.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31, previously opened with \fBgpioSerialReadOpen\fP
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_SERIAL_GPIO.
-
-.IP "\fBint i2cOpen(unsigned i2cBus, unsigned i2cAddr, unsigned i2cFlags)\fP"
-.IP "" 4
-This returns a handle for the device at the address on the I2C bus.
-
-.br
-
-.br
-
-.EX
- i2cBus: >=0
-.br
- i2cAddr: 0-0x7F
-.br
-i2cFlags: 0
-.br
-
-.EE
-
-.br
-
-.br
-No flags are currently defined. This parameter should be set to zero.
-
-.br
-
-.br
-Physically buses 0 and 1 are available on the Pi. Higher numbered buses
-will be available if a kernel supported bus multiplexor is being used.
-
-.br
-
-.br
-The GPIO used are given in the following table.
-
-.br
-
-.br
- SDA SCL
-.br
-I2C 0 0 1
-.br
-I2C 1 2 3
-.br
-
-.br
-
-.br
-Returns a handle (>=0) if OK, otherwise PI_BAD_I2C_BUS, PI_BAD_I2C_ADDR,
-PI_BAD_FLAGS, PI_NO_HANDLE, or PI_I2C_OPEN_FAILED.
-
-.br
-
-.br
-For the SMBus commands the low level transactions are shown at the end
-of the function description. The following abbreviations are used.
-
-.br
-
-.br
-
-.EX
-S (1 bit) : Start bit
-.br
-P (1 bit) : Stop bit
-.br
-Rd/Wr (1 bit) : Read/Write bit. Rd equals 1, Wr equals 0.
-.br
-A, NA (1 bit) : Accept and not accept bit.
-.br
-.br
-.br
-Addr (7 bits): I2C 7 bit address.
-.br
-i2cReg (8 bits): Command byte, a byte which often selects a register.
-.br
-Data (8 bits): A data byte.
-.br
-Count (8 bits): A byte defining the length of a block operation.
-.br
-
-.br
-[..]: Data sent by the device.
-.br
-
-.EE
-
-.IP "\fBint i2cClose(unsigned handle)\fP"
-.IP "" 4
-This closes the I2C device associated with the handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2cOpen\fP
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE.
-
-.IP "\fBint i2cWriteQuick(unsigned handle, unsigned bit)\fP"
-.IP "" 4
-This sends a single bit (in the Rd/Wr bit) to the device associated
-with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2cOpen\fP
-.br
- bit: 0-1, the value to write
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-Quick command. SMBus 2.0 5.5.1
-
-.EX
-S Addr bit [A] P
-.br
-
-.EE
-
-.IP "\fBint i2cWriteByte(unsigned handle, unsigned bVal)\fP"
-.IP "" 4
-This sends a single byte to the device associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2cOpen\fP
-.br
- bVal: 0-0xFF, the value to write
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-Send byte. SMBus 2.0 5.5.2
-
-.EX
-S Addr Wr [A] bVal [A] P
-.br
-
-.EE
-
-.IP "\fBint i2cReadByte(unsigned handle)\fP"
-.IP "" 4
-This reads a single byte from the device associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2cOpen\fP
-.br
-
-.EE
-
-.br
-
-.br
-Returns the byte read (>=0) if OK, otherwise PI_BAD_HANDLE,
-or PI_I2C_READ_FAILED.
-
-.br
-
-.br
-Receive byte. SMBus 2.0 5.5.3
-
-.EX
-S Addr Rd [A] [Data] NA P
-.br
-
-.EE
-
-.IP "\fBint i2cWriteByteData(unsigned handle, unsigned i2cReg, unsigned bVal)\fP"
-.IP "" 4
-This writes a single byte to the specified register of the device
-associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2cOpen\fP
-.br
-i2cReg: 0-255, the register to write
-.br
- bVal: 0-0xFF, the value to write
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-Write byte. SMBus 2.0 5.5.4
-
-.EX
-S Addr Wr [A] i2cReg [A] bVal [A] P
-.br
-
-.EE
-
-.IP "\fBint i2cWriteWordData(unsigned handle, unsigned i2cReg, unsigned wVal)\fP"
-.IP "" 4
-This writes a single 16 bit word to the specified register of the device
-associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2cOpen\fP
-.br
-i2cReg: 0-255, the register to write
-.br
- wVal: 0-0xFFFF, the value to write
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-Write word. SMBus 2.0 5.5.4
-
-.EX
-S Addr Wr [A] i2cReg [A] wValLow [A] wValHigh [A] P
-.br
-
-.EE
-
-.IP "\fBint i2cReadByteData(unsigned handle, unsigned i2cReg)\fP"
-.IP "" 4
-This reads a single byte from the specified register of the device
-associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2cOpen\fP
-.br
-i2cReg: 0-255, the register to read
-.br
-
-.EE
-
-.br
-
-.br
-Returns the byte read (>=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-
-.br
-
-.br
-Read byte. SMBus 2.0 5.5.5
-
-.EX
-S Addr Wr [A] i2cReg [A] S Addr Rd [A] [Data] NA P
-.br
-
-.EE
-
-.IP "\fBint i2cReadWordData(unsigned handle, unsigned i2cReg)\fP"
-.IP "" 4
-This reads a single 16 bit word from the specified register of the device
-associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2cOpen\fP
-.br
-i2cReg: 0-255, the register to read
-.br
-
-.EE
-
-.br
-
-.br
-Returns the word read (>=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-
-.br
-
-.br
-Read word. SMBus 2.0 5.5.5
-
-.EX
-S Addr Wr [A] i2cReg [A] S Addr Rd [A] [DataLow] A [DataHigh] NA P
-.br
-
-.EE
-
-.IP "\fBint i2cProcessCall(unsigned handle, unsigned i2cReg, unsigned wVal)\fP"
-.IP "" 4
-This writes 16 bits of data to the specified register of the device
-associated with handle and reads 16 bits of data in return.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2cOpen\fP
-.br
-i2cReg: 0-255, the register to write/read
-.br
- wVal: 0-0xFFFF, the value to write
-.br
-
-.EE
-
-.br
-
-.br
-Returns the word read (>=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-
-.br
-
-.br
-Process call. SMBus 2.0 5.5.6
-
-.EX
-S Addr Wr [A] i2cReg [A] wValLow [A] wValHigh [A]
-.br
- S Addr Rd [A] [DataLow] A [DataHigh] NA P
-.br
-
-.EE
-
-.IP "\fBint i2cWriteBlockData(unsigned handle, unsigned i2cReg, char *buf, unsigned count)\fP"
-.IP "" 4
-This writes up to 32 bytes to the specified register of the device
-associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2cOpen\fP
-.br
-i2cReg: 0-255, the register to write
-.br
- buf: an array with the data to send
-.br
- count: 1-32, the number of bytes to write
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-Block write. SMBus 2.0 5.5.7
-
-.EX
-S Addr Wr [A] i2cReg [A] count [A]
-.br
- buf0 [A] buf1 [A] ... [A] bufn [A] P
-.br
-
-.EE
-
-.IP "\fBint i2cReadBlockData(unsigned handle, unsigned i2cReg, char *buf)\fP"
-.IP "" 4
-This reads a block of up to 32 bytes from the specified register of
-the device associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2cOpen\fP
-.br
-i2cReg: 0-255, the register to read
-.br
- buf: an array to receive the read data
-.br
-
-.EE
-
-.br
-
-.br
-The amount of returned data is set by the device.
-
-.br
-
-.br
-Returns the number of bytes read (>=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-
-.br
-
-.br
-Block read. SMBus 2.0 5.5.7
-
-.EX
-S Addr Wr [A] i2cReg [A]
-.br
- S Addr Rd [A] [Count] A [buf0] A [buf1] A ... A [bufn] NA P
-.br
-
-.EE
-
-.IP "\fBint i2cBlockProcessCall(unsigned handle, unsigned i2cReg, char *buf, unsigned count)\fP"
-.IP "" 4
-This writes data bytes to the specified register of the device
-associated with handle and reads a device specified number
-of bytes of data in return.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2cOpen\fP
-.br
-i2cReg: 0-255, the register to write/read
-.br
- buf: an array with the data to send and to receive the read data
-.br
- count: 1-32, the number of bytes to write
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes read (>=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-
-.br
-
-.br
-The SMBus 2.0 documentation states that a minimum of 1 byte may be
-sent and a minimum of 1 byte may be received. The total number of
-bytes sent/received must be 32 or less.
-
-.br
-
-.br
-Block write-block read. SMBus 2.0 5.5.8
-
-.EX
-S Addr Wr [A] i2cReg [A] count [A] buf0 [A] ... bufn [A]
-.br
- S Addr Rd [A] [Count] A [buf0] A ... [bufn] A P
-.br
-
-.EE
-
-.IP "\fBint i2cReadI2CBlockData(unsigned handle, unsigned i2cReg, char *buf, unsigned count)\fP"
-.IP "" 4
-This reads count bytes from the specified register of the device
-associated with handle . The count may be 1-32.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2cOpen\fP
-.br
-i2cReg: 0-255, the register to read
-.br
- buf: an array to receive the read data
-.br
- count: 1-32, the number of bytes to read
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes read (>0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-
-.br
-
-.br
-
-.EX
-S Addr Wr [A] i2cReg [A]
-.br
- S Addr Rd [A] [buf0] A [buf1] A ... A [bufn] NA P
-.br
-
-.EE
-
-.IP "\fBint i2cWriteI2CBlockData(unsigned handle, unsigned i2cReg, char *buf, unsigned count)\fP"
-.IP "" 4
-This writes 1 to 32 bytes to the specified register of the device
-associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2cOpen\fP
-.br
-i2cReg: 0-255, the register to write
-.br
- buf: the data to write
-.br
- count: 1-32, the number of bytes to write
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-
-.EX
-S Addr Wr [A] i2cReg [A] buf0 [A] buf1 [A] ... [A] bufn [A] P
-.br
-
-.EE
-
-.IP "\fBint i2cReadDevice(unsigned handle, char *buf, unsigned count)\fP"
-.IP "" 4
-This reads count bytes from the raw device into buf.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2cOpen\fP
-.br
- buf: an array to receive the read data bytes
-.br
- count: >0, the number of bytes to read
-.br
-
-.EE
-
-.br
-
-.br
-Returns count (>0) if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_READ_FAILED.
-
-.br
-
-.br
-
-.EX
-S Addr Rd [A] [buf0] A [buf1] A ... A [bufn] NA P
-.br
-
-.EE
-
-.IP "\fBint i2cWriteDevice(unsigned handle, char *buf, unsigned count)\fP"
-.IP "" 4
-This writes count bytes from buf to the raw device.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2cOpen\fP
-.br
- buf: an array containing the data bytes to write
-.br
- count: >0, the number of bytes to write
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-
-.EX
-S Addr Wr [A] buf0 [A] buf1 [A] ... [A] bufn [A] P
-.br
-
-.EE
-
-.IP "\fBvoid i2cSwitchCombined(int setting)\fP"
-.IP "" 4
-This sets the I2C (i2c-bcm2708) module "use combined transactions"
-parameter on or off.
-
-.br
-
-.br
-
-.EX
-setting: 0 to set the parameter off, non-zero to set it on
-.br
-
-.EE
-
-.br
-
-.br
-
-.br
-
-.br
-NOTE: when the flag is on a write followed by a read to the same
-slave address will use a repeated start (rather than a stop/start).
-
-.IP "\fBint i2cSegments(unsigned handle, pi_i2c_msg_t *segs, unsigned numSegs)\fP"
-.IP "" 4
-This function executes multiple I2C segments in one transaction by
-calling the I2C_RDWR ioctl.
-
-.br
-
-.br
-
-.EX
- handle: >=0, as returned by a call to \fBi2cOpen\fP
-.br
- segs: an array of I2C segments
-.br
-numSegs: >0, the number of I2C segments
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of segments if OK, otherwise PI_BAD_I2C_SEG.
-
-.IP "\fBint i2cZip(unsigned handle, char *inBuf, unsigned inLen, char *outBuf, unsigned outLen)\fP"
-.IP "" 4
-This function executes a sequence of I2C operations. The
-operations to be performed are specified by the contents of inBuf
-which contains the concatenated command codes and associated data.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2cOpen\fP
-.br
- inBuf: pointer to the concatenated I2C commands, see below
-.br
- inLen: size of command buffer
-.br
-outBuf: pointer to buffer to hold returned data
-.br
-outLen: size of output buffer
-.br
-
-.EE
-
-.br
-
-.br
-Returns >= 0 if OK (the number of bytes read), otherwise
-PI_BAD_HANDLE, PI_BAD_POINTER, PI_BAD_I2C_CMD, PI_BAD_I2C_RLEN.
-PI_BAD_I2C_WLEN, or PI_BAD_I2C_SEG.
-
-.br
-
-.br
-The following command codes are supported:
-
-.br
-
-.br
-Name Cmd & Data Meaning
-.br
-End 0 No more commands
-.br
-Escape 1 Next P is two bytes
-.br
-On 2 Switch combined flag on
-.br
-Off 3 Switch combined flag off
-.br
-Address 4 P Set I2C address to P
-.br
-Flags 5 lsb msb Set I2C flags to lsb + (msb << 8)
-.br
-Read 6 P Read P bytes of data
-.br
-Write 7 P ... Write P bytes of data
-.br
-
-.br
-
-.br
-The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-
-.br
-
-.br
-The address defaults to that associated with the handle.
-The flags default to 0. The address and flags maintain their
-previous value until updated.
-
-.br
-
-.br
-The returned I2C data is stored in consecutive locations of outBuf.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-Set address 0x53, write 0x32, read 6 bytes
-.br
-Set address 0x1E, write 0x03, read 6 bytes
-.br
-Set address 0x68, write 0x1B, read 8 bytes
-.br
-End
-.br
-
-.br
-0x04 0x53 0x07 0x01 0x32 0x06 0x06
-.br
-0x04 0x1E 0x07 0x01 0x03 0x06 0x06
-.br
-0x04 0x68 0x07 0x01 0x1B 0x06 0x08
-.br
-0x00
-.br
-
-.EE
-
-.IP "\fBint bbI2COpen(unsigned SDA, unsigned SCL, unsigned baud)\fP"
-.IP "" 4
-This function selects a pair of GPIO for bit banging I2C at a
-specified baud rate.
-
-.br
-
-.br
-Bit banging I2C allows for certain operations which are not possible
-with the standard I2C driver.
-
-.br
-
-.br
-o baud rates as low as 50
-.br
-o repeated starts
-.br
-o clock stretching
-.br
-o I2C on any pair of spare GPIO
-
-.br
-
-.br
-
-.EX
- SDA: 0-31
-.br
- SCL: 0-31
-.br
-baud: 50-500000
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_I2C_BAUD, or
-PI_GPIO_IN_USE.
-
-.br
-
-.br
-NOTE:
-
-.br
-
-.br
-The GPIO used for SDA and SCL must have pull-ups to 3V3 connected. As
-a guide the hardware pull-ups on pins 3 and 5 are 1k8 in value.
-
-.IP "\fBint bbI2CClose(unsigned SDA)\fP"
-.IP "" 4
-This function stops bit banging I2C on a pair of GPIO previously
-opened with \fBbbI2COpen\fP.
-
-.br
-
-.br
-
-.EX
-SDA: 0-31, the SDA GPIO used in a prior call to \fBbbI2COpen\fP
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_I2C_GPIO.
-
-.IP "\fBint bbI2CZip(unsigned SDA, char *inBuf, unsigned inLen, char *outBuf, unsigned outLen)\fP"
-.IP "" 4
-This function executes a sequence of bit banged I2C operations. The
-operations to be performed are specified by the contents of inBuf
-which contains the concatenated command codes and associated data.
-
-.br
-
-.br
-
-.EX
- SDA: 0-31 (as used in a prior call to \fBbbI2COpen\fP)
-.br
- inBuf: pointer to the concatenated I2C commands, see below
-.br
- inLen: size of command buffer
-.br
-outBuf: pointer to buffer to hold returned data
-.br
-outLen: size of output buffer
-.br
-
-.EE
-
-.br
-
-.br
-Returns >= 0 if OK (the number of bytes read), otherwise
-PI_BAD_USER_GPIO, PI_NOT_I2C_GPIO, PI_BAD_POINTER,
-PI_BAD_I2C_CMD, PI_BAD_I2C_RLEN, PI_BAD_I2C_WLEN,
-PI_I2C_READ_FAILED, or PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-The following command codes are supported:
-
-.br
-
-.br
-Name Cmd & Data Meaning
-.br
-End 0 No more commands
-.br
-Escape 1 Next P is two bytes
-.br
-Start 2 Start condition
-.br
-Stop 3 Stop condition
-.br
-Address 4 P Set I2C address to P
-.br
-Flags 5 lsb msb Set I2C flags to lsb + (msb << 8)
-.br
-Read 6 P Read P bytes of data
-.br
-Write 7 P ... Write P bytes of data
-.br
-
-.br
-
-.br
-The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-
-.br
-
-.br
-The address and flags default to 0. The address and flags maintain
-their previous value until updated.
-
-.br
-
-.br
-No flags are currently defined.
-
-.br
-
-.br
-The returned I2C data is stored in consecutive locations of outBuf.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-Set address 0x53
-.br
-start, write 0x32, (re)start, read 6 bytes, stop
-.br
-Set address 0x1E
-.br
-start, write 0x03, (re)start, read 6 bytes, stop
-.br
-Set address 0x68
-.br
-start, write 0x1B, (re)start, read 8 bytes, stop
-.br
-End
-.br
-
-.br
-0x04 0x53
-.br
-0x02 0x07 0x01 0x32 0x02 0x06 0x06 0x03
-.br
-
-.br
-0x04 0x1E
-.br
-0x02 0x07 0x01 0x03 0x02 0x06 0x06 0x03
-.br
-
-.br
-0x04 0x68
-.br
-0x02 0x07 0x01 0x1B 0x02 0x06 0x08 0x03
-.br
-
-.br
-0x00
-.br
-
-.EE
-
-.IP "\fBint bscXfer(bsc_xfer_t *bsc_xfer)\fP"
-.IP "" 4
-This function provides a low-level interface to the SPI/I2C Slave
-peripheral on the BCM chip.
-
-.br
-
-.br
-This peripheral allows the Pi to act as a hardware slave device
-on an I2C or SPI bus.
-
-.br
-
-.br
-This is not a bit bang version and as such is OS timing
-independent. The bus timing is handled directly by the chip.
-
-.br
-
-.br
-The output process is simple. You simply append data to the FIFO
-buffer on the chip. This works like a queue, you add data to the
-queue and the master removes it.
-
-.br
-
-.br
-I can't get SPI to work properly. I tried with a
-control word of 0x303 and swapped MISO and MOSI.
-
-.br
-
-.br
-The function sets the BSC mode, writes any data in
-the transmit buffer to the BSC transmit FIFO, and
-copies any data in the BSC receive FIFO to the
-receive buffer.
-
-.br
-
-.br
-
-.EX
-bsc_xfer:= a structure defining the transfer
-.br
-
-.br
-typedef struct
-.br
-{
-.br
- uint32_t control; // Write
-.br
- int rxCnt; // Read only
-.br
- char rxBuf[BSC_FIFO_SIZE]; // Read only
-.br
- int txCnt; // Write
-.br
- char txBuf[BSC_FIFO_SIZE]; // Write
-.br
-} bsc_xfer_t;
-.br
-
-.EE
-
-.br
-
-.br
-To start a transfer set control (see below), copy the bytes to
-be added to the transmit FIFO (if any) to txBuf and set txCnt to
-the number of copied bytes.
-
-.br
-
-.br
-Upon return rxCnt will be set to the number of received bytes placed
-in rxBuf.
-
-.br
-
-.br
-Note that the control word sets the BSC mode. The BSC will stay in
-that mode until a different control word is sent.
-
-.br
-
-.br
-GPIO used for models other than those based on the BCM2711.
-
-.br
-
-.br
- SDA SCL MOSI SCLK MISO CE
-.br
-I2C 18 19 - - - -
-.br
-SPI - - 18 19 20 21
-.br
-
-.br
-
-.br
-GPIO used for models based on the BCM2711 (e.g. the Pi4B).
-
-.br
-
-.br
- SDA SCL MOSI SCLK MISO CE
-.br
-I2C 10 11 - - - -
-.br
-SPI - - 10 11 9 8
-.br
-
-.br
-
-.br
-When a zero control word is received the used GPIO will be reset
-to INPUT mode.
-
-.br
-
-.br
-The returned function value is the status of the transfer (see below).
-
-.br
-
-.br
-If there was an error the status will be less than zero
-(and will contain the error code).
-
-.br
-
-.br
-The most significant word of the returned status contains the number
-of bytes actually copied from txBuf to the BSC transmit FIFO (may be
-less than requested if the FIFO already contained untransmitted data).
-
-.br
-
-.br
-control consists of the following bits.
-
-.br
-
-.br
-
-.EX
-22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
-.br
- a a a a a a a - - IT HC TF IR RE TE BK EC ES PL PH I2 SP EN
-.br
-
-.EE
-
-.br
-
-.br
-Bits 0-13 are copied unchanged to the BSC CR register. See
-pages 163-165 of the Broadcom peripherals document for full
-details.
-
-.br
-
-.br
-aaaaaaa defines the I2C slave address (only relevant in I2C mode)
-.br
-IT invert transmit status flags
-.br
-HC enable host control
-.br
-TF enable test FIFO
-.br
-IR invert receive status flags
-.br
-RE enable receive
-.br
-TE enable transmit
-.br
-BK abort operation and clear FIFOs
-.br
-EC send control register as first I2C byte
-.br
-ES send status register as first I2C byte
-.br
-PL set SPI polarity high
-.br
-PH set SPI phase high
-.br
-I2 enable I2C mode
-.br
-SP enable SPI mode
-.br
-EN enable BSC peripheral
-.br
-
-.br
-
-.br
-The returned status has the following format
-
-.br
-
-.br
-
-.EX
-20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
-.br
- S S S S S R R R R R T T T T T RB TE RF TF RE TB
-.br
-
-.EE
-
-.br
-
-.br
-Bits 0-15 are copied unchanged from the BSC FR register. See
-pages 165-166 of the Broadcom peripherals document for full
-details.
-
-.br
-
-.br
-SSSSS number of bytes successfully copied to transmit FIFO
-.br
-RRRRR number of bytes in receieve FIFO
-.br
-TTTTT number of bytes in transmit FIFO
-.br
-RB receive busy
-.br
-TE transmit FIFO empty
-.br
-RF receive FIFO full
-.br
-TF transmit FIFO full
-.br
-RE receive FIFO empty
-.br
-TB transmit busy
-.br
-
-.br
-
-.br
-The following example shows how to configure the BSC peripheral as
-an I2C slave with address 0x13 and send four bytes.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-bsc_xfer_t xfer;
-.br
-
-.br
-xfer.control = (0x13<<16) | 0x305;
-.br
-
-.br
-memcpy(xfer.txBuf, "ABCD", 4);
-.br
-xfer.txCnt = 4;
-.br
-
-.br
-status = bscXfer(&xfer);
-.br
-
-.br
-if (status >= 0)
-.br
-{
-.br
- // process transfer
-.br
-}
-.br
-
-.EE
-
-.IP "\fBint bbSPIOpen(unsigned CS, unsigned MISO, unsigned MOSI, unsigned SCLK, unsigned baud, unsigned spiFlags)\fP"
-.IP "" 4
-This function selects a set of GPIO for bit banging SPI with
-a specified baud rate and mode.
-
-.br
-
-.br
-
-.EX
- CS: 0-31
-.br
- MISO: 0-31
-.br
- MOSI: 0-31
-.br
- SCLK: 0-31
-.br
- baud: 50-250000
-.br
-spiFlags: see below
-.br
-
-.EE
-
-.br
-
-.br
-spiFlags consists of the least significant 22 bits.
-
-.br
-
-.br
-
-.EX
-21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
-.br
- 0 0 0 0 0 0 R T 0 0 0 0 0 0 0 0 0 0 0 p m m
-.br
-
-.EE
-
-.br
-
-.br
-mm defines the SPI mode, defaults to 0
-
-.br
-
-.br
-
-.EX
-Mode CPOL CPHA
-.br
- 0 0 0
-.br
- 1 0 1
-.br
- 2 1 0
-.br
- 3 1 1
-.br
-
-.EE
-
-.br
-
-.br
-p is 0 if CS is active low (default) and 1 for active high.
-
-.br
-
-.br
-T is 1 if the least significant bit is transmitted on MOSI first, the
-default (0) shifts the most significant bit out first.
-
-.br
-
-.br
-R is 1 if the least significant bit is received on MISO first, the
-default (0) receives the most significant bit first.
-
-.br
-
-.br
-The other bits in flags should be set to zero.
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_SPI_BAUD, or
-PI_GPIO_IN_USE.
-
-.br
-
-.br
-If more than one device is connected to the SPI bus (defined by
-SCLK, MOSI, and MISO) each must have its own CS.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-bbSPIOpen(10, MISO, MOSI, SCLK, 10000, 0); // device 1
-.br
-bbSPIOpen(11, MISO, MOSI, SCLK, 20000, 3); // device 2
-.br
-
-.EE
-
-.IP "\fBint bbSPIClose(unsigned CS)\fP"
-.IP "" 4
-This function stops bit banging SPI on a set of GPIO
-opened with \fBbbSPIOpen\fP.
-
-.br
-
-.br
-
-.EX
-CS: 0-31, the CS GPIO used in a prior call to \fBbbSPIOpen\fP
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_SPI_GPIO.
-
-.IP "\fBint bbSPIXfer(unsigned CS, char *inBuf, char *outBuf, unsigned count)\fP"
-.IP "" 4
-This function executes a bit banged SPI transfer.
-
-.br
-
-.br
-
-.EX
- CS: 0-31 (as used in a prior call to \fBbbSPIOpen\fP)
-.br
- inBuf: pointer to buffer to hold data to be sent
-.br
-outBuf: pointer to buffer to hold returned data
-.br
- count: size of data transfer
-.br
-
-.EE
-
-.br
-
-.br
-Returns >= 0 if OK (the number of bytes read), otherwise
-PI_BAD_USER_GPIO, PI_NOT_SPI_GPIO or PI_BAD_POINTER.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-// gcc -Wall -pthread -o bbSPIx_test bbSPIx_test.c -lpigpio
-.br
-// sudo ./bbSPIx_test
-.br
-
-.br
-
-.br
-#include <stdio.h>
-.br
-
-.br
-#include "pigpio.h"
-.br
-
-.br
-#define CE0 5
-.br
-#define CE1 6
-.br
-#define MISO 13
-.br
-#define MOSI 19
-.br
-#define SCLK 12
-.br
-
-.br
-int main(int argc, char *argv[])
-.br
-{
-.br
- int i, count, set_val, read_val;
-.br
- unsigned char inBuf[3];
-.br
- char cmd1[] = {0, 0};
-.br
- char cmd2[] = {12, 0};
-.br
- char cmd3[] = {1, 128, 0};
-.br
-
-.br
- if (gpioInitialise() < 0)
-.br
- {
-.br
- fprintf(stderr, "pigpio initialisation failed.\n");
-.br
- return 1;
-.br
- }
-.br
-
-.br
- bbSPIOpen(CE0, MISO, MOSI, SCLK, 10000, 0); // MCP4251 DAC
-.br
- bbSPIOpen(CE1, MISO, MOSI, SCLK, 20000, 3); // MCP3008 ADC
-.br
-
-.br
- for (i=0; i<256; i++)
-.br
- {
-.br
- cmd1[1] = i;
-.br
-
-.br
- count = bbSPIXfer(CE0, cmd1, (char *)inBuf, 2); // > DAC
-.br
-
-.br
- if (count == 2)
-.br
- {
-.br
- count = bbSPIXfer(CE0, cmd2, (char *)inBuf, 2); // < DAC
-.br
-
-.br
- if (count == 2)
-.br
- {
-.br
- set_val = inBuf[1];
-.br
-
-.br
- count = bbSPIXfer(CE1, cmd3, (char *)inBuf, 3); // < ADC
-.br
-
-.br
- if (count == 3)
-.br
- {
-.br
- read_val = ((inBuf[1]&3)<<8) | inBuf[2];
-.br
- printf("%d %d\n", set_val, read_val);
-.br
- }
-.br
- }
-.br
- }
-.br
- }
-.br
-
-.br
- bbSPIClose(CE0);
-.br
- bbSPIClose(CE1);
-.br
-
-.br
- gpioTerminate();
-.br
-
-.br
- return 0;
-.br
-}
-.br
-
-.EE
-
-.IP "\fBint spiOpen(unsigned spiChan, unsigned baud, unsigned spiFlags)\fP"
-.IP "" 4
-This function returns a handle for the SPI device on the channel.
-Data will be transferred at baud bits per second. The flags may
-be used to modify the default behaviour of 4-wire operation, mode 0,
-active low chip select.
-
-.br
-
-.br
-The Pi has two SPI peripherals: main and auxiliary.
-
-.br
-
-.br
-The main SPI has two chip selects (channels), the auxiliary has
-three.
-
-.br
-
-.br
-The auxiliary SPI is available on all models but the A and B.
-
-.br
-
-.br
-The GPIO used are given in the following table.
-
-.br
-
-.br
- MISO MOSI SCLK CE0 CE1 CE2
-.br
-Main SPI 9 10 11 8 7 -
-.br
-Aux SPI 19 20 21 18 17 16
-.br
-
-.br
-
-.br
-
-.EX
- spiChan: 0-1 (0-2 for the auxiliary SPI)
-.br
- baud: 32K-125M (values above 30M are unlikely to work)
-.br
-spiFlags: see below
-.br
-
-.EE
-
-.br
-
-.br
-Returns a handle (>=0) if OK, otherwise PI_BAD_SPI_CHANNEL,
-PI_BAD_SPI_SPEED, PI_BAD_FLAGS, PI_NO_AUX_SPI, or PI_SPI_OPEN_FAILED.
-
-.br
-
-.br
-spiFlags consists of the least significant 22 bits.
-
-.br
-
-.br
-
-.EX
-21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
-.br
- b b b b b b R T n n n n W A u2 u1 u0 p2 p1 p0 m m
-.br
-
-.EE
-
-.br
-
-.br
-mm defines the SPI mode.
-
-.br
-
-.br
-Warning: modes 1 and 3 do not appear to work on the auxiliary SPI.
-
-.br
-
-.br
-
-.EX
-Mode POL PHA
-.br
- 0 0 0
-.br
- 1 0 1
-.br
- 2 1 0
-.br
- 3 1 1
-.br
-
-.EE
-
-.br
-
-.br
-px is 0 if CEx is active low (default) and 1 for active high.
-
-.br
-
-.br
-ux is 0 if the CEx GPIO is reserved for SPI (default) and 1 otherwise.
-
-.br
-
-.br
-A is 0 for the main SPI, 1 for the auxiliary SPI.
-
-.br
-
-.br
-W is 0 if the device is not 3-wire, 1 if the device is 3-wire. Main
-SPI only.
-
-.br
-
-.br
-nnnn defines the number of bytes (0-15) to write before switching
-the MOSI line to MISO to read data. This field is ignored
-if W is not set. Main SPI only.
-
-.br
-
-.br
-T is 1 if the least significant bit is transmitted on MOSI first, the
-default (0) shifts the most significant bit out first. Auxiliary SPI
-only.
-
-.br
-
-.br
-R is 1 if the least significant bit is received on MISO first, the
-default (0) receives the most significant bit first. Auxiliary SPI
-only.
-
-.br
-
-.br
-bbbbbb defines the word size in bits (0-32). The default (0)
-sets 8 bits per word. Auxiliary SPI only.
-
-.br
-
-.br
-The \fBspiRead\fP, \fBspiWrite\fP, and \fBspiXfer\fP functions
-transfer data packed into 1, 2, or 4 bytes according to
-the word size in bits.
-
-.br
-
-.br
-For bits 1-8 there will be one byte per word.
-.br
-For bits 9-16 there will be two bytes per word.
-.br
-For bits 17-32 there will be four bytes per word.
-
-.br
-
-.br
-Multi-byte transfers are made in least significant byte first order.
-
-.br
-
-.br
-E.g. to transfer 32 11-bit words buf should contain 64 bytes
-and count should be 64.
-
-.br
-
-.br
-E.g. to transfer the 14 bit value 0x1ABC send the bytes 0xBC followed
-by 0x1A.
-
-.br
-
-.br
-The other bits in flags should be set to zero.
-
-.IP "\fBint spiClose(unsigned handle)\fP"
-.IP "" 4
-This functions closes the SPI device identified by the handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBspiOpen\fP
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE.
-
-.IP "\fBint spiRead(unsigned handle, char *buf, unsigned count)\fP"
-.IP "" 4
-This function reads count bytes of data from the SPI
-device associated with the handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBspiOpen\fP
-.br
- buf: an array to receive the read data bytes
-.br
- count: the number of bytes to read
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-
-.IP "\fBint spiWrite(unsigned handle, char *buf, unsigned count)\fP"
-.IP "" 4
-This function writes count bytes of data from buf to the SPI
-device associated with the handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBspiOpen\fP
-.br
- buf: the data bytes to write
-.br
- count: the number of bytes to write
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-
-.IP "\fBint spiXfer(unsigned handle, char *txBuf, char *rxBuf, unsigned count)\fP"
-.IP "" 4
-This function transfers count bytes of data from txBuf to the SPI
-device associated with the handle. Simultaneously count bytes of
-data are read from the device and placed in rxBuf.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBspiOpen\fP
-.br
- txBuf: the data bytes to write
-.br
- rxBuf: the received data bytes
-.br
- count: the number of bytes to transfer
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-
-.IP "\fBint serOpen(char *sertty, unsigned baud, unsigned serFlags)\fP"
-.IP "" 4
-This function opens a serial device at a specified baud rate
-and with specified flags. The device name must start with
-/dev/tty or /dev/serial.
-
-.br
-
-.br
-
-.EX
- sertty: the serial device to open
-.br
- baud: the baud rate in bits per second, see below
-.br
-serFlags: 0
-.br
-
-.EE
-
-.br
-
-.br
-Returns a handle (>=0) if OK, otherwise PI_NO_HANDLE, or
-PI_SER_OPEN_FAILED.
-
-.br
-
-.br
-The baud rate must be one of 50, 75, 110, 134, 150,
-200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
-38400, 57600, 115200, or 230400.
-
-.br
-
-.br
-No flags are currently defined. This parameter should be set to zero.
-
-.IP "\fBint serClose(unsigned handle)\fP"
-.IP "" 4
-This function closes the serial device associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBserOpen\fP
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE.
-
-.IP "\fBint serWriteByte(unsigned handle, unsigned bVal)\fP"
-.IP "" 4
-This function writes bVal to the serial port associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBserOpen\fP
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_SER_WRITE_FAILED.
-
-.IP "\fBint serReadByte(unsigned handle)\fP"
-.IP "" 4
-This function reads a byte from the serial port associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBserOpen\fP
-.br
-
-.EE
-
-.br
-
-.br
-Returns the read byte (>=0) if OK, otherwise PI_BAD_HANDLE,
-PI_SER_READ_NO_DATA, or PI_SER_READ_FAILED.
-
-.br
-
-.br
-If no data is ready PI_SER_READ_NO_DATA is returned.
-
-.IP "\fBint serWrite(unsigned handle, char *buf, unsigned count)\fP"
-.IP "" 4
-This function writes count bytes from buf to the the serial port
-associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBserOpen\fP
-.br
- buf: the array of bytes to write
-.br
- count: the number of bytes to write
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_SER_WRITE_FAILED.
-
-.IP "\fBint serRead(unsigned handle, char *buf, unsigned count)\fP"
-.IP "" 4
-This function reads up count bytes from the the serial port
-associated with handle and writes them to buf.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBserOpen\fP
-.br
- buf: an array to receive the read data
-.br
- count: the maximum number of bytes to read
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes read (>0=) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_SER_READ_NO_DATA.
-
-.br
-
-.br
-If no data is ready zero is returned.
-
-.IP "\fBint serDataAvailable(unsigned handle)\fP"
-.IP "" 4
-This function returns the number of bytes available
-to be read from the device associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBserOpen\fP
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes of data available (>=0) if OK,
-otherwise PI_BAD_HANDLE.
-
-.IP "\fBint gpioTrigger(unsigned user_gpio, unsigned pulseLen, unsigned level)\fP"
-.IP "" 4
-This function sends a trigger pulse to a GPIO. The GPIO is set to
-level for pulseLen microseconds and then reset to not level.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31
-.br
- pulseLen: 1-100
-.br
- level: 0,1
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_LEVEL,
-or PI_BAD_PULSELEN.
-
-.IP "\fBint gpioSetWatchdog(unsigned user_gpio, unsigned timeout)\fP"
-.IP "" 4
-Sets a watchdog for a GPIO.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31
-.br
- timeout: 0-60000
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_BAD_WDOG_TIMEOUT.
-
-.br
-
-.br
-The watchdog is nominally in milliseconds.
-
-.br
-
-.br
-One watchdog may be registered per GPIO.
-
-.br
-
-.br
-The watchdog may be cancelled by setting timeout to 0.
-
-.br
-
-.br
-Until cancelled a timeout will be reported every timeout milliseconds
-after the last GPIO activity.
-
-.br
-
-.br
-In particular:
-
-.br
-
-.br
-1) any registered alert function for the GPIO will be called with
- the level set to PI_TIMEOUT.
-
-.br
-
-.br
-2) any notification for the GPIO will have a report written to the
- fifo with the flags set to indicate a watchdog timeout.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-void aFunction(int gpio, int level, uint32_t tick)
-.br
-{
-.br
- printf("GPIO %d became %d at %d", gpio, level, tick);
-.br
-}
-.br
-
-.br
-// call aFunction whenever GPIO 4 changes state
-.br
-gpioSetAlertFunc(4, aFunction);
-.br
-
-.br
-// or approximately every 5 millis
-.br
-gpioSetWatchdog(4, 5);
-.br
-
-.EE
-
-.IP "\fBint gpioNoiseFilter(unsigned user_gpio, unsigned steady, unsigned active)\fP"
-.IP "" 4
-Sets a noise filter on a GPIO.
-
-.br
-
-.br
-Level changes on the GPIO are ignored until a level which has
-been stable for \fBsteady\fP microseconds is detected. Level changes
-on the GPIO are then reported for \fBactive\fP microseconds after
-which the process repeats.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31
-.br
- steady: 0-300000
-.br
- active: 0-1000000
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
-
-.br
-
-.br
-This filter affects the GPIO samples returned to callbacks set up
-with \fBgpioSetAlertFunc\fP, \fBgpioSetAlertFuncEx\fP, \fBgpioSetGetSamplesFunc\fP,
-and \fBgpioSetGetSamplesFuncEx\fP.
-
-.br
-
-.br
-It does not affect interrupts set up with \fBgpioSetISRFunc\fP,
-\fBgpioSetISRFuncEx\fP, or levels read by \fBgpioRead\fP,
-\fBgpioRead_Bits_0_31\fP, or \fBgpioRead_Bits_32_53\fP.
-
-.br
-
-.br
-Level changes before and after the active period may
-be reported. Your software must be designed to cope with
-such reports.
-
-.IP "\fBint gpioGlitchFilter(unsigned user_gpio, unsigned steady)\fP"
-.IP "" 4
-Sets a glitch filter on a GPIO.
-
-.br
-
-.br
-Level changes on the GPIO are not reported unless the level
-has been stable for at least \fBsteady\fP microseconds. The
-level is then reported. Level changes of less than \fBsteady\fP
-microseconds are ignored.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31
-.br
- steady: 0-300000
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
-
-.br
-
-.br
-This filter affects the GPIO samples returned to callbacks set up
-with \fBgpioSetAlertFunc\fP, \fBgpioSetAlertFuncEx\fP, \fBgpioSetGetSamplesFunc\fP,
-and \fBgpioSetGetSamplesFuncEx\fP.
-
-.br
-
-.br
-It does not affect interrupts set up with \fBgpioSetISRFunc\fP,
-\fBgpioSetISRFuncEx\fP, or levels read by \fBgpioRead\fP,
-\fBgpioRead_Bits_0_31\fP, or \fBgpioRead_Bits_32_53\fP.
-
-.br
-
-.br
-Each (stable) edge will be timestamped \fBsteady\fP microseconds
-after it was first detected.
-
-.IP "\fBint gpioSetGetSamplesFunc(gpioGetSamplesFunc_t f, uint32_t bits)\fP"
-.IP "" 4
-Registers a function to be called (a callback) every millisecond
-with the latest GPIO samples.
-
-.br
-
-.br
-
-.EX
- f: the function to call
-.br
-bits: the GPIO of interest
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK.
-
-.br
-
-.br
-The function is passed a pointer to the samples (an array of
-\fBgpioSample_t\fP), and the number of samples.
-
-.br
-
-.br
-Only one function can be registered.
-
-.br
-
-.br
-The callback may be cancelled by passing NULL as the function.
-
-.br
-
-.br
-The samples returned will be the union of bits, plus any active alerts,
-plus any active notifications.
-
-.br
-
-.br
-e.g. if there are alerts for GPIO 7, 8, and 9, notifications for GPIO
-8, 10, 23, 24, and bits is (1<<23)|(1<<17) then samples for GPIO
-7, 8, 9, 10, 17, 23, and 24 will be reported.
-
-.IP "\fBint gpioSetGetSamplesFuncEx(gpioGetSamplesFuncEx_t f, uint32_t bits, void *userdata)\fP"
-.IP "" 4
-Registers a function to be called (a callback) every millisecond
-with the latest GPIO samples.
-
-.br
-
-.br
-
-.EX
- f: the function to call
-.br
- bits: the GPIO of interest
-.br
-userdata: a pointer to arbitrary user data
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK.
-
-.br
-
-.br
-The function is passed a pointer to the samples (an array of
-\fBgpioSample_t\fP), the number of samples, and the userdata pointer.
-
-.br
-
-.br
-Only one of \fBgpioGetSamplesFunc\fP or \fBgpioGetSamplesFuncEx\fP can be
-registered.
-
-.br
-
-.br
-See \fBgpioSetGetSamplesFunc\fP for further details.
-
-.IP "\fBint gpioSetTimerFunc(unsigned timer, unsigned millis, gpioTimerFunc_t f)\fP"
-.IP "" 4
-Registers a function to be called (a callback) every millis milliseconds.
-
-.br
-
-.br
-
-.EX
- timer: 0-9
-.br
-millis: 10-60000
-.br
- f: the function to call
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_TIMER, PI_BAD_MS, or PI_TIMER_FAILED.
-
-.br
-
-.br
-10 timers are supported numbered 0 to 9.
-
-.br
-
-.br
-One function may be registered per timer.
-
-.br
-
-.br
-The timer may be cancelled by passing NULL as the function.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-void bFunction(void)
-.br
-{
-.br
- printf("two seconds have elapsed");
-.br
-}
-.br
-
-.br
-// call bFunction every 2000 milliseconds
-.br
-gpioSetTimerFunc(0, 2000, bFunction);
-.br
-
-.EE
-
-.IP "\fBint gpioSetTimerFuncEx(unsigned timer, unsigned millis, gpioTimerFuncEx_t f, void *userdata)\fP"
-.IP "" 4
-Registers a function to be called (a callback) every millis milliseconds.
-
-.br
-
-.br
-
-.EX
- timer: 0-9.
-.br
- millis: 10-60000
-.br
- f: the function to call
-.br
-userdata: a pointer to arbitrary user data
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_TIMER, PI_BAD_MS, or PI_TIMER_FAILED.
-
-.br
-
-.br
-The function is passed the userdata pointer.
-
-.br
-
-.br
-Only one of \fBgpioSetTimerFunc\fP or \fBgpioSetTimerFuncEx\fP can be
-registered per timer.
-
-.br
-
-.br
-See \fBgpioSetTimerFunc\fP for further details.
-
-.IP "\fBpthread_t *gpioStartThread(gpioThreadFunc_t f, void *userdata)\fP"
-.IP "" 4
-Starts a new thread of execution with f as the main routine.
-
-.br
-
-.br
-
-.EX
- f: the main function for the new thread
-.br
-userdata: a pointer to arbitrary user data
-.br
-
-.EE
-
-.br
-
-.br
-Returns a pointer to pthread_t if OK, otherwise NULL.
-
-.br
-
-.br
-The function is passed the single argument arg.
-
-.br
-
-.br
-The thread can be cancelled by passing the pointer to pthread_t to
-\fBgpioStopThread\fP.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-#include <stdio.h>
-.br
-#include <pigpio.h>
-.br
-
-.br
-void *myfunc(void *arg)
-.br
-{
-.br
- while (1)
-.br
- {
-.br
- printf("%s", arg);
-.br
- sleep(1);
-.br
- }
-.br
-}
-.br
-
-.br
-int main(int argc, char *argv[])
-.br
-{
-.br
- pthread_t *p1, *p2, *p3;
-.br
-
-.br
- if (gpioInitialise() < 0) return 1;
-.br
-
-.br
- p1 = gpioStartThread(myfunc, "thread 1"); sleep(3);
-.br
-
-.br
- p2 = gpioStartThread(myfunc, "thread 2"); sleep(3);
-.br
-
-.br
- p3 = gpioStartThread(myfunc, "thread 3"); sleep(3);
-.br
-
-.br
- gpioStopThread(p3); sleep(3);
-.br
-
-.br
- gpioStopThread(p2); sleep(3);
-.br
-
-.br
- gpioStopThread(p1); sleep(3);
-.br
-
-.br
- gpioTerminate();
-.br
-}
-.br
-
-.EE
-
-.IP "\fBvoid gpioStopThread(pthread_t *pth)\fP"
-.IP "" 4
-Cancels the thread pointed at by pth.
-
-.br
-
-.br
-
-.EX
-pth: a thread pointer returned by \fBgpioStartThread\fP
-.br
-
-.EE
-
-.br
-
-.br
-No value is returned.
-
-.br
-
-.br
-The thread to be stopped should have been started with \fBgpioStartThread\fP.
-
-.IP "\fBint gpioStoreScript(char *script)\fP"
-.IP "" 4
-This function stores a null terminated script for later execution.
-
-.br
-
-.br
-See \fBhttp://abyz.me.uk/rpi/pigpio/pigs.html#Scripts\fP for details.
-
-.br
-
-.br
-
-.EX
-script: the text of the script
-.br
-
-.EE
-
-.br
-
-.br
-The function returns a script id if the script is valid,
-otherwise PI_BAD_SCRIPT.
-
-.IP "\fBint gpioRunScript(unsigned script_id, unsigned numPar, uint32_t *param)\fP"
-.IP "" 4
-This function runs a stored script.
-
-.br
-
-.br
-
-.EX
-script_id: >=0, as returned by \fBgpioStoreScript\fP
-.br
- numPar: 0-10, the number of parameters
-.br
- param: an array of parameters
-.br
-
-.EE
-
-.br
-
-.br
-The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID, or
-PI_TOO_MANY_PARAM.
-
-.br
-
-.br
-param is an array of up to 10 parameters which may be referenced in
-the script as p0 to p9.
-
-.IP "\fBint gpioRunScript(unsigned script_id, unsigned numPar, uint32_t *param)\fP"
-.IP "" 4
-This function runs a stored script.
-
-.br
-
-.br
-
-.EX
-script_id: >=0, as returned by \fBgpioStoreScript\fP
-.br
- numPar: 0-10, the number of parameters
-.br
- param: an array of parameters
-.br
-
-.EE
-
-.br
-
-.br
-The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID, or
-PI_TOO_MANY_PARAM.
-
-.br
-
-.br
-param is an array of up to 10 parameters which may be referenced in
-the script as p0 to p9.
-
-.IP "\fBint gpioUpdateScript(unsigned script_id, unsigned numPar, uint32_t *param)\fP"
-.IP "" 4
-This function sets the parameters of a script. The script may or
-may not be running. The first numPar parameters of the script are
-overwritten with the new values.
-
-.br
-
-.br
-
-.EX
-script_id: >=0, as returned by \fBgpioStoreScript\fP
-.br
- numPar: 0-10, the number of parameters
-.br
- param: an array of parameters
-.br
-
-.EE
-
-.br
-
-.br
-The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID, or
-PI_TOO_MANY_PARAM.
-
-.br
-
-.br
-param is an array of up to 10 parameters which may be referenced in
-the script as p0 to p9.
-
-.IP "\fBint gpioScriptStatus(unsigned script_id, uint32_t *param)\fP"
-.IP "" 4
-This function returns the run status of a stored script as well as
-the current values of parameters 0 to 9.
-
-.br
-
-.br
-
-.EX
-script_id: >=0, as returned by \fBgpioStoreScript\fP
-.br
- param: an array to hold the returned 10 parameters
-.br
-
-.EE
-
-.br
-
-.br
-The function returns greater than or equal to 0 if OK,
-otherwise PI_BAD_SCRIPT_ID.
-
-.br
-
-.br
-The run status may be
-
-.br
-
-.br
-
-.EX
-PI_SCRIPT_INITING
-.br
-PI_SCRIPT_HALTED
-.br
-PI_SCRIPT_RUNNING
-.br
-PI_SCRIPT_WAITING
-.br
-PI_SCRIPT_FAILED
-.br
-
-.EE
-
-.br
-
-.br
-The current value of script parameters 0 to 9 are returned in param.
-
-.IP "\fBint gpioStopScript(unsigned script_id)\fP"
-.IP "" 4
-This function stops a running script.
-
-.br
-
-.br
-
-.EX
-script_id: >=0, as returned by \fBgpioStoreScript\fP
-.br
-
-.EE
-
-.br
-
-.br
-The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID.
-
-.IP "\fBint gpioDeleteScript(unsigned script_id)\fP"
-.IP "" 4
-This function deletes a stored script.
-
-.br
-
-.br
-
-.EX
-script_id: >=0, as returned by \fBgpioStoreScript\fP
-.br
-
-.EE
-
-.br
-
-.br
-The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID.
-
-.IP "\fBint gpioSetSignalFunc(unsigned signum, gpioSignalFunc_t f)\fP"
-.IP "" 4
-Registers a function to be called (a callback) when a signal occurs.
-
-.br
-
-.br
-
-.EX
-signum: 0-63
-.br
- f: the callback function
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_SIGNUM.
-
-.br
-
-.br
-The function is passed the signal number.
-
-.br
-
-.br
-One function may be registered per signal.
-
-.br
-
-.br
-The callback may be cancelled by passing NULL.
-
-.br
-
-.br
-By default all signals are treated as fatal and cause the library
-to call gpioTerminate and then exit.
-
-.IP "\fBint gpioSetSignalFuncEx(unsigned signum, gpioSignalFuncEx_t f, void *userdata)\fP"
-.IP "" 4
-Registers a function to be called (a callback) when a signal occurs.
-
-.br
-
-.br
-
-.EX
- signum: 0-63
-.br
- f: the callback function
-.br
-userdata: a pointer to arbitrary user data
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_SIGNUM.
-
-.br
-
-.br
-The function is passed the signal number and the userdata pointer.
-
-.br
-
-.br
-Only one of gpioSetSignalFunc or gpioSetSignalFuncEx can be
-registered per signal.
-
-.br
-
-.br
-See gpioSetSignalFunc for further details.
-
-.IP "\fBuint32_t gpioRead_Bits_0_31(void)\fP"
-.IP "" 4
-Returns the current level of GPIO 0-31.
-
-.IP "\fBuint32_t gpioRead_Bits_32_53(void)\fP"
-.IP "" 4
-Returns the current level of GPIO 32-53.
-
-.IP "\fBint gpioWrite_Bits_0_31_Clear(uint32_t bits)\fP"
-.IP "" 4
-Clears GPIO 0-31 if the corresponding bit in bits is set.
-
-.br
-
-.br
-
-.EX
-bits: a bit mask of GPIO to clear
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-// To clear (set to 0) GPIO 4, 7, and 15
-.br
-gpioWrite_Bits_0_31_Clear( (1<<4) | (1<<7) | (1<<15) );
-.br
-
-.EE
-
-.IP "\fBint gpioWrite_Bits_32_53_Clear(uint32_t bits)\fP"
-.IP "" 4
-Clears GPIO 32-53 if the corresponding bit (0-21) in bits is set.
-
-.br
-
-.br
-
-.EX
-bits: a bit mask of GPIO to clear
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK.
-
-.IP "\fBint gpioWrite_Bits_0_31_Set(uint32_t bits)\fP"
-.IP "" 4
-Sets GPIO 0-31 if the corresponding bit in bits is set.
-
-.br
-
-.br
-
-.EX
-bits: a bit mask of GPIO to set
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK.
-
-.IP "\fBint gpioWrite_Bits_32_53_Set(uint32_t bits)\fP"
-.IP "" 4
-Sets GPIO 32-53 if the corresponding bit (0-21) in bits is set.
-
-.br
-
-.br
-
-.EX
-bits: a bit mask of GPIO to set
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-// To set (set to 1) GPIO 32, 40, and 53
-.br
-gpioWrite_Bits_32_53_Set((1<<(32-32)) | (1<<(40-32)) | (1<<(53-32)));
-.br
-
-.EE
-
-.IP "\fBint gpioHardwareClock(unsigned gpio, unsigned clkfreq)\fP"
-.IP "" 4
-Starts a hardware clock on a GPIO at the specified frequency.
-Frequencies above 30MHz are unlikely to work.
-
-.br
-
-.br
-
-.EX
- gpio: see description
-.br
-clkfreq: 0 (off) or 4689-250M (13184-375M for the BCM2711)
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_GPIO, PI_NOT_HCLK_GPIO,
-PI_BAD_HCLK_FREQ,or PI_BAD_HCLK_PASS.
-
-.br
-
-.br
-The same clock is available on multiple GPIO. The latest
-frequency setting will be used by all GPIO which share a clock.
-
-.br
-
-.br
-The GPIO must be one of the following.
-
-.br
-
-.br
-
-.EX
-4 clock 0 All models
-.br
-5 clock 1 All models but A and B (reserved for system use)
-.br
-6 clock 2 All models but A and B
-.br
-20 clock 0 All models but A and B
-.br
-21 clock 1 All models but A and Rev.2 B (reserved for system use)
-.br
-
-.br
-32 clock 0 Compute module only
-.br
-34 clock 0 Compute module only
-.br
-42 clock 1 Compute module only (reserved for system use)
-.br
-43 clock 2 Compute module only
-.br
-44 clock 1 Compute module only (reserved for system use)
-.br
-
-.EE
-
-.br
-
-.br
-Access to clock 1 is protected by a password as its use will likely
-crash the Pi. The password is given by or'ing 0x5A000000 with the
-GPIO number.
-
-.IP "\fBint gpioHardwarePWM(unsigned gpio, unsigned PWMfreq, unsigned PWMduty)\fP"
-.IP "" 4
-Starts hardware PWM on a GPIO at the specified frequency and dutycycle.
-Frequencies above 30MHz are unlikely to work.
-
-.br
-
-.br
-NOTE: Any waveform started by \fBgpioWaveTxSend\fP, or
-\fBgpioWaveChain\fP will be cancelled.
-
-.br
-
-.br
-This function is only valid if the pigpio main clock is PCM. The
-main clock defaults to PCM but may be overridden by a call to
-\fBgpioCfgClock\fP.
-
-.br
-
-.br
-
-.EX
- gpio: see description
-.br
-PWMfreq: 0 (off) or 1-125M (1-187.5M for the BCM2711)
-.br
-PWMduty: 0 (off) to 1000000 (1M)(fully on)
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_GPIO, PI_NOT_HPWM_GPIO,
-PI_BAD_HPWM_DUTY, PI_BAD_HPWM_FREQ, or PI_HPWM_ILLEGAL.
-
-.br
-
-.br
-The same PWM channel is available on multiple GPIO. The latest
-frequency and dutycycle setting will be used by all GPIO which
-share a PWM channel.
-
-.br
-
-.br
-The GPIO must be one of the following.
-
-.br
-
-.br
-
-.EX
-12 PWM channel 0 All models but A and B
-.br
-13 PWM channel 1 All models but A and B
-.br
-18 PWM channel 0 All models
-.br
-19 PWM channel 1 All models but A and B
-.br
-
-.br
-40 PWM channel 0 Compute module only
-.br
-41 PWM channel 1 Compute module only
-.br
-45 PWM channel 1 Compute module only
-.br
-52 PWM channel 0 Compute module only
-.br
-53 PWM channel 1 Compute module only
-.br
-
-.EE
-
-.br
-
-.br
-The actual number of steps beween off and fully on is the
-integral part of 250M/PWMfreq (375M/PWMfreq for the BCM2711).
-
-.br
-
-.br
-The actual frequency set is 250M/steps (375M/steps for the BCM2711).
-
-.br
-
-.br
-There will only be a million steps for a PWMfreq of 250 (375 for
-the BCM2711). Lower frequencies will have more steps and higher
-frequencies will have fewer steps. PWMduty is
-automatically scaled to take this into account.
-
-.IP "\fBint gpioTime(unsigned timetype, int *seconds, int *micros)\fP"
-.IP "" 4
-Updates the seconds and micros variables with the current time.
-
-.br
-
-.br
-
-.EX
-timetype: 0 (relative), 1 (absolute)
-.br
- seconds: a pointer to an int to hold seconds
-.br
- micros: a pointer to an int to hold microseconds
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_TIMETYPE.
-
-.br
-
-.br
-If timetype is PI_TIME_ABSOLUTE updates seconds and micros with the
-number of seconds and microseconds since the epoch (1st January 1970).
-
-.br
-
-.br
-If timetype is PI_TIME_RELATIVE updates seconds and micros with the
-number of seconds and microseconds since the library was initialised.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-int secs, mics;
-.br
-
-.br
-// print the number of seconds since the library was started
-.br
-gpioTime(PI_TIME_RELATIVE, &secs, &mics);
-.br
-printf("library started %d.%03d seconds ago", secs, mics/1000);
-.br
-
-.EE
-
-.IP "\fBint gpioSleep(unsigned timetype, int seconds, int micros)\fP"
-.IP "" 4
-Sleeps for the number of seconds and microseconds specified by seconds
-and micros.
-
-.br
-
-.br
-
-.EX
-timetype: 0 (relative), 1 (absolute)
-.br
- seconds: seconds to sleep
-.br
- micros: microseconds to sleep
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_TIMETYPE, PI_BAD_SECONDS,
-or PI_BAD_MICROS.
-
-.br
-
-.br
-If timetype is PI_TIME_ABSOLUTE the sleep ends when the number of seconds
-and microseconds since the epoch (1st January 1970) has elapsed. System
-clock changes are taken into account.
-
-.br
-
-.br
-If timetype is PI_TIME_RELATIVE the sleep is for the specified number
-of seconds and microseconds. System clock changes do not effect the
-sleep length.
-
-.br
-
-.br
-For short delays (say, 50 microseonds or less) use \fBgpioDelay\fP.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-gpioSleep(PI_TIME_RELATIVE, 2, 500000); // sleep for 2.5 seconds
-.br
-
-.br
-gpioSleep(PI_TIME_RELATIVE, 0, 100000); // sleep for 0.1 seconds
-.br
-
-.br
-gpioSleep(PI_TIME_RELATIVE, 60, 0); // sleep for one minute
-.br
-
-.EE
-
-.IP "\fBuint32_t gpioDelay(uint32_t micros)\fP"
-.IP "" 4
-Delays for at least the number of microseconds specified by micros.
-
-.br
-
-.br
-
-.EX
-micros: the number of microseconds to sleep
-.br
-
-.EE
-
-.br
-
-.br
-Returns the actual length of the delay in microseconds.
-
-.br
-
-.br
-Delays of 100 microseconds or less use busy waits.
-
-.IP "\fBuint32_t gpioTick(void)\fP"
-.IP "" 4
-Returns the current system tick.
-
-.br
-
-.br
-Tick is the number of microseconds since system boot.
-
-.br
-
-.br
-As tick is an unsigned 32 bit quantity it wraps around after
-2^32 microseconds, which is approximately 1 hour 12 minutes.
-
-.br
-
-.br
-You don't need to worry about the wrap around as long as you
-take a tick (uint32_t) from another tick, i.e. the following
-code will always provide the correct difference.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-uint32_t startTick, endTick;
-.br
-int diffTick;
-.br
-
-.br
-startTick = gpioTick();
-.br
-
-.br
-// do some processing
-.br
-
-.br
-endTick = gpioTick();
-.br
-
-.br
-diffTick = endTick - startTick;
-.br
-
-.br
-printf("some processing took %d microseconds", diffTick);
-.br
-
-.EE
-
-.IP "\fBunsigned gpioHardwareRevision(void)\fP"
-.IP "" 4
-Returns the hardware revision.
-
-.br
-
-.br
-If the hardware revision can not be found or is not a valid hexadecimal
-number the function returns 0.
-
-.br
-
-.br
-The hardware revision is the last few characters on the Revision line of
-/proc/cpuinfo.
-
-.br
-
-.br
-The revision number can be used to determine the assignment of GPIO
-to pins (see \fBgpio\fP).
-
-.br
-
-.br
-There are at least three types of board.
-
-.br
-
-.br
-Type 1 boards have hardware revision numbers of 2 and 3.
-
-.br
-
-.br
-Type 2 boards have hardware revision numbers of 4, 5, 6, and 15.
-
-.br
-
-.br
-Type 3 boards have hardware revision numbers of 16 or greater.
-
-.br
-
-.br
-for "Revision : 0002" the function returns 2.
-.br
-for "Revision : 000f" the function returns 15.
-.br
-for "Revision : 000g" the function returns 0.
-
-.IP "\fBunsigned gpioVersion(void)\fP"
-.IP "" 4
-Returns the pigpio version.
-
-.IP "\fBint gpioGetPad(unsigned pad)\fP"
-.IP "" 4
-This function returns the pad drive strength in mA.
-
-.br
-
-.br
-
-.EX
-pad: 0-2, the pad to get
-.br
-
-.EE
-
-.br
-
-.br
-Returns the pad drive strength if OK, otherwise PI_BAD_PAD.
-
-.br
-
-.br
-Pad GPIO
-.br
-0 0-27
-.br
-1 28-45
-.br
-2 46-53
-.br
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-strength = gpioGetPad(1); // get pad 1 strength
-.br
-
-.EE
-
-.IP "\fBint gpioSetPad(unsigned pad, unsigned padStrength)\fP"
-.IP "" 4
-This function sets the pad drive strength in mA.
-
-.br
-
-.br
-
-.EX
- pad: 0-2, the pad to set
-.br
-padStrength: 1-16 mA
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_PAD, or PI_BAD_STRENGTH.
-
-.br
-
-.br
-Pad GPIO
-.br
-0 0-27
-.br
-1 28-45
-.br
-2 46-53
-.br
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-gpioSetPad(0, 16); // set pad 0 strength to 16 mA
-.br
-
-.EE
-
-.IP "\fBint eventMonitor(unsigned handle, uint32_t bits)\fP"
-.IP "" 4
-This function selects the events to be reported on a previously
-opened handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by \fBgpioNotifyOpen\fP
-.br
- bits: a bit mask indicating the events of interest
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE.
-
-.br
-
-.br
-A report is sent each time an event is triggered providing the
-corresponding bit in bits is set.
-
-.br
-
-.br
-See \fBgpioNotifyBegin\fP for the notification format.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-// Start reporting events 3, 6, and 7.
-.br
-
-.br
-// bit 76543210
-.br
-// (0xC8 = 0b11001000)
-.br
-
-.br
-eventMonitor(h, 0xC8);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBint eventSetFunc(unsigned event, eventFunc_t f)\fP"
-.IP "" 4
-Registers a function to be called (a callback) when the specified
-event occurs.
-
-.br
-
-.br
-
-.EX
-event: 0-31
-.br
- f: the callback function
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_EVENT_ID.
-
-.br
-
-.br
-One function may be registered per event.
-
-.br
-
-.br
-The function is passed the event, and the tick.
-
-.br
-
-.br
-The callback may be cancelled by passing NULL as the function.
-
-.IP "\fBint eventSetFuncEx(unsigned event, eventFuncEx_t f, void *userdata)\fP"
-.IP "" 4
-Registers a function to be called (a callback) when the specified
-event occurs.
-
-.br
-
-.br
-
-.EX
- event: 0-31
-.br
- f: the callback function
-.br
-userdata: pointer to arbitrary user data
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_EVENT_ID.
-
-.br
-
-.br
-One function may be registered per event.
-
-.br
-
-.br
-The function is passed the event, the tick, and the ueserdata pointer.
-
-.br
-
-.br
-The callback may be cancelled by passing NULL as the function.
-
-.br
-
-.br
-Only one of \fBeventSetFunc\fP or \fBeventSetFuncEx\fP can be
-registered per event.
-
-.IP "\fBint eventTrigger(unsigned event)\fP"
-.IP "" 4
-This function signals the occurrence of an event.
-
-.br
-
-.br
-
-.EX
-event: 0-31, the event
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_EVENT_ID.
-
-.br
-
-.br
-An event is a signal used to inform one or more consumers
-to start an action. Each consumer which has registered an interest
-in the event (e.g. by calling \fBeventSetFunc\fP) will be informed by
-a callback.
-
-.br
-
-.br
-One event, PI_EVENT_BSC (31) is predefined. This event is
-auto generated on BSC slave activity.
-
-.br
-
-.br
-The meaning of other events is arbitrary.
-
-.br
-
-.br
-Note that other than its id and its tick there is no data associated
-with an event.
-
-.IP "\fBint shell(char *scriptName, char *scriptString)\fP"
-.IP "" 4
-This function uses the system call to execute a shell script
-with the given string as its parameter.
-
-.br
-
-.br
-
-.EX
- scriptName: the name of the script, only alphanumeric characters,
-.br
- '-' and '_' are allowed in the name
-.br
-scriptString: the string to pass to the script
-.br
-
-.EE
-
-.br
-
-.br
-The exit status of the system call is returned if OK, otherwise
-PI_BAD_SHELL_STATUS.
-
-.br
-
-.br
-scriptName must exist in /opt/pigpio/cgi and must be executable.
-
-.br
-
-.br
-The returned exit status is normally 256 times that set by the
-shell script exit function. If the script can't be found 32512 will
-be returned.
-
-.br
-
-.br
-The following table gives some example returned statuses.
-
-.br
-
-.br
-Script exit status Returned system call status
-.br
-1 256
-.br
-5 1280
-.br
-10 2560
-.br
-200 51200
-.br
-script not found 32512
-.br
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-// pass two parameters, hello and world
-.br
-status = shell("scr1", "hello world");
-.br
-
-.br
-// pass three parameters, hello, string with spaces, and world
-.br
-status = shell("scr1", "hello 'string with spaces' world");
-.br
-
-.br
-// pass one parameter, hello string with spaces world
-.br
-status = shell("scr1", "\"hello string with spaces world\"");
-.br
-
-.EE
-
-.IP "\fBint fileOpen(char *file, unsigned mode)\fP"
-.IP "" 4
-This function returns a handle to a file opened in a specified mode.
-
-.br
-
-.br
-
-.EX
-file: the file to open
-.br
-mode: the file open mode
-.br
-
-.EE
-
-.br
-
-.br
-Returns a handle (>=0) if OK, otherwise PI_NO_HANDLE, PI_NO_FILE_ACCESS,
-PI_BAD_FILE_MODE, PI_FILE_OPEN_FAILED, or PI_FILE_IS_A_DIR.
-
-.br
-
-.br
-File
-
-.br
-
-.br
-A file may only be opened if permission is granted by an entry in
-/opt/pigpio/access. This is intended to allow remote access to files
-in a more or less controlled manner.
-
-.br
-
-.br
-Each entry in /opt/pigpio/access takes the form of a file path
-which may contain wildcards followed by a single letter permission.
-The permission may be R for read, W for write, U for read/write,
-and N for no access.
-
-.br
-
-.br
-Where more than one entry matches a file the most specific rule
-applies. If no entry matches a file then access is denied.
-
-.br
-
-.br
-Suppose /opt/pigpio/access contains the following entries
-
-.br
-
-.br
-
-.EX
-/home/* n
-.br
-/home/pi/shared/dir_1/* w
-.br
-/home/pi/shared/dir_2/* r
-.br
-/home/pi/shared/dir_3/* u
-.br
-/home/pi/shared/dir_1/file.txt n
-.br
-
-.EE
-
-.br
-
-.br
-Files may be written in directory dir_1 with the exception
-of file.txt.
-
-.br
-
-.br
-Files may be read in directory dir_2.
-
-.br
-
-.br
-Files may be read and written in directory dir_3.
-
-.br
-
-.br
-If a directory allows read, write, or read/write access then files may
-be created in that directory.
-
-.br
-
-.br
-In an attempt to prevent risky permissions the following paths are
-ignored in /opt/pigpio/access.
-
-.br
-
-.br
-
-.EX
-a path containing ..
-.br
-a path containing only wildcards (*?)
-.br
-a path containing less than two non-wildcard parts
-.br
-
-.EE
-
-.br
-
-.br
-Mode
-
-.br
-
-.br
-The mode may have the following values.
-
-.br
-
-.br
-Macro Value Meaning
-.br
-PI_FILE_READ 1 open file for reading
-.br
-PI_FILE_WRITE 2 open file for writing
-.br
-PI_FILE_RW 3 open file for reading and writing
-.br
-
-.br
-
-.br
-The following values may be or'd into the mode.
-
-.br
-
-.br
-Macro Value Meaning
-.br
-PI_FILE_APPEND 4 Writes append data to the end of the file
-.br
-PI_FILE_CREATE 8 The file is created if it doesn't exist
-.br
-PI_FILE_TRUNC 16 The file is truncated
-.br
-
-.br
-
-.br
-Newly created files are owned by root with permissions owner read and write.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-#include <stdio.h>
-.br
-#include <pigpio.h>
-.br
-
-.br
-int main(int argc, char *argv[])
-.br
-{
-.br
- int handle, c;
-.br
- char buf[60000];
-.br
-
-.br
- if (gpioInitialise() < 0) return 1;
-.br
-
-.br
- // assumes /opt/pigpio/access contains the following line
-.br
- // /ram/*.c r
-.br
-
-.br
- handle = fileOpen("/ram/pigpio.c", PI_FILE_READ);
-.br
-
-.br
- if (handle >= 0)
-.br
- {
-.br
- while ((c=fileRead(handle, buf, sizeof(buf)-1)))
-.br
- {
-.br
- buf[c] = 0;
-.br
- printf("%s", buf);
-.br
- }
-.br
-
-.br
- fileClose(handle);
-.br
- }
-.br
-
-.br
- gpioTerminate();
-.br
-}
-.br
-
-.EE
-
-.IP "\fBint fileClose(unsigned handle)\fP"
-.IP "" 4
-This function closes the file associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBfileOpen\fP
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-fileClose(h);
-.br
-
-.EE
-
-.IP "\fBint fileWrite(unsigned handle, char *buf, unsigned count)\fP"
-.IP "" 4
-This function writes count bytes from buf to the the file
-associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBfileOpen\fP
-.br
- buf: the array of bytes to write
-.br
- count: the number of bytes to write
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM,
-PI_FILE_NOT_WOPEN, or PI_BAD_FILE_WRITE.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-status = fileWrite(h, buf, count);
-.br
-if (status == 0)
-.br
-{
-.br
- // okay
-.br
-}
-.br
-else
-.br
-{
-.br
- // error
-.br
-}
-.br
-
-.EE
-
-.IP "\fBint fileRead(unsigned handle, char *buf, unsigned count)\fP"
-.IP "" 4
-This function reads up to count bytes from the the file
-associated with handle and writes them to buf.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBfileOpen\fP
-.br
- buf: an array to receive the read data
-.br
- count: the maximum number of bytes to read
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes read (>=0) if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, PI_FILE_NOT_ROPEN, or PI_BAD_FILE_WRITE.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-if (fileRead(h, buf, sizeof(buf)) > 0)
-.br
-{
-.br
- // process read data
-.br
-}
-.br
-
-.EE
-
-.IP "\fBint fileSeek(unsigned handle, int32_t seekOffset, int seekFrom)\fP"
-.IP "" 4
-This function seeks to a position within the file associated
-with handle.
-
-.br
-
-.br
-
-.EX
- handle: >=0, as returned by a call to \fBfileOpen\fP
-.br
-seekOffset: the number of bytes to move. Positive offsets
-.br
- move forward, negative offsets backwards.
-.br
- seekFrom: one of PI_FROM_START (0), PI_FROM_CURRENT (1),
-.br
- or PI_FROM_END (2)
-.br
-
-.EE
-
-.br
-
-.br
-Returns the new byte position within the file (>=0) if OK, otherwise PI_BAD_HANDLE, or PI_BAD_FILE_SEEK.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-fileSeek(0, 20, PI_FROM_START); // Seek to start plus 20
-.br
-
-.br
-size = fileSeek(0, 0, PI_FROM_END); // Seek to end, return size
-.br
-
-.br
-pos = fileSeek(0, 0, PI_FROM_CURRENT); // Return current position
-.br
-
-.EE
-
-.IP "\fBint fileList(char *fpat, char *buf, unsigned count)\fP"
-.IP "" 4
-This function returns a list of files which match a pattern. The
-pattern may contain wildcards.
-
-.br
-
-.br
-
-.EX
- fpat: file pattern to match
-.br
- buf: an array to receive the matching file names
-.br
-count: the maximum number of bytes to read
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of returned bytes if OK, otherwise PI_NO_FILE_ACCESS,
-or PI_NO_FILE_MATCH.
-
-.br
-
-.br
-The pattern must match an entry in /opt/pigpio/access. The pattern
-may contain wildcards. See \fBfileOpen\fP.
-
-.br
-
-.br
-NOTE
-
-.br
-
-.br
-The returned value is not the number of files, it is the number
-of bytes in the buffer. The file names are separated by newline
-characters.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-#include <stdio.h>
-.br
-#include <pigpio.h>
-.br
-
-.br
-int main(int argc, char *argv[])
-.br
-{
-.br
- int c;
-.br
- char buf[1000];
-.br
-
-.br
- if (gpioInitialise() < 0) return 1;
-.br
-
-.br
- // assumes /opt/pigpio/access contains the following line
-.br
- // /ram/*.c r
-.br
-
-.br
- c = fileList("/ram/p*.c", buf, sizeof(buf));
-.br
-
-.br
- if (c >= 0)
-.br
- {
-.br
- // terminate string
-.br
- buf[c] = 0;
-.br
- printf("%s", buf);
-.br
- }
-.br
-
-.br
- gpioTerminate();
-.br
-}
-.br
-
-.EE
-
-.IP "\fBint gpioCfgBufferSize(unsigned cfgMillis)\fP"
-.IP "" 4
-Configures pigpio to buffer cfgMillis milliseconds of GPIO samples.
-
-.br
-
-.br
-This function is only effective if called before \fBgpioInitialise\fP.
-
-.br
-
-.br
-
-.EX
-cfgMillis: 100-10000
-.br
-
-.EE
-
-.br
-
-.br
-The default setting is 120 milliseconds.
-
-.br
-
-.br
-The intention is to allow for bursts of data and protection against
-other processes hogging cpu time.
-
-.br
-
-.br
-I haven't seen a process locked out for more than 100 milliseconds.
-
-.br
-
-.br
-Making the buffer bigger uses a LOT of memory at the more frequent
-sampling rates as shown in the following table in MBs.
-
-.br
-
-.br
-
-.EX
- buffer milliseconds
-.br
- 120 250 500 1sec 2sec 4sec 8sec
-.br
-
-.br
- 1 16 31 55 107 --- --- ---
-.br
- 2 10 18 31 55 107 --- ---
-.br
-sample 4 8 12 18 31 55 107 ---
-.br
- rate 5 8 10 14 24 45 87 ---
-.br
- (us) 8 6 8 12 18 31 55 107
-.br
- 10 6 8 10 14 24 45 87
-.br
-
-.EE
-
-.IP "\fBint gpioCfgClock(unsigned cfgMicros, unsigned cfgPeripheral, unsigned cfgSource)\fP"
-.IP "" 4
-Configures pigpio to use a particular sample rate timed by a specified
-peripheral.
-
-.br
-
-.br
-This function is only effective if called before \fBgpioInitialise\fP.
-
-.br
-
-.br
-
-.EX
- cfgMicros: 1, 2, 4, 5, 8, 10
-.br
-cfgPeripheral: 0 (PWM), 1 (PCM)
-.br
- cfgSource: deprecated, value is ignored
-.br
-
-.EE
-
-.br
-
-.br
-The timings are provided by the specified peripheral (PWM or PCM).
-
-.br
-
-.br
-The default setting is 5 microseconds using the PCM peripheral.
-
-.br
-
-.br
-The approximate CPU percentage used for each sample rate is:
-
-.br
-
-.br
-
-.EX
-sample cpu
-.br
- rate %
-.br
-
-.br
- 1 25
-.br
- 2 16
-.br
- 4 11
-.br
- 5 10
-.br
- 8 15
-.br
- 10 14
-.br
-
-.EE
-
-.br
-
-.br
-A sample rate of 5 microseconds seeems to be the sweet spot.
-
-.IP "\fBint gpioCfgDMAchannel(unsigned DMAchannel)\fP"
-.IP "" 4
-Configures pigpio to use the specified DMA channel.
-
-.br
-
-.br
-This function is only effective if called before \fBgpioInitialise\fP.
-
-.br
-
-.br
-
-.EX
-DMAchannel: 0-14
-.br
-
-.EE
-
-.br
-
-.br
-The default setting is to use channel 14.
-
-.IP "\fBint gpioCfgDMAchannels(unsigned primaryChannel, unsigned secondaryChannel)\fP"
-.IP "" 4
-Configures pigpio to use the specified DMA channels.
-
-.br
-
-.br
-This function is only effective if called before \fBgpioInitialise\fP.
-
-.br
-
-.br
-
-.EX
- primaryChannel: 0-14
-.br
-secondaryChannel: 0-14
-.br
-
-.EE
-
-.br
-
-.br
-The default setting depends on whether the Pi has a BCM2711 chip or
-not (currently only the Pi4B has a BCM2711).
-
-.br
-
-.br
-The default setting for a non-BCM2711 is to use channel 14 for the
-primary channel and channel 6 for the secondary channel.
-
-.br
-
-.br
-The default setting for a BCM2711 is to use channel 7 for the
-primary channel and channel 6 for the secondary channel.
-
-.br
-
-.br
-The secondary channel is only used for the transmission of waves.
-
-.br
-
-.br
-If possible use one of channels 0 to 6 for the secondary channel
-(a full channel).
-
-.br
-
-.br
-A full channel only requires one DMA control block regardless of the
-length of a pulse delay. Channels 7 to 14 (lite channels) require
-one DMA control block for each 16383 microseconds of delay. I.e.
-a 10 second pulse delay requires one control block on a full channel
-and 611 control blocks on a lite channel.
-
-.IP "\fBint gpioCfgPermissions(uint64_t updateMask)\fP"
-.IP "" 4
-Configures pigpio to restrict GPIO updates via the socket or pipe
-interfaces to the GPIO specified by the mask. Programs directly
-calling the pigpio library (i.e. linked with -lpigpio are not
-affected). A GPIO update is a write to a GPIO or a GPIO mode
-change or any function which would force such an action.
-
-.br
-
-.br
-This function is only effective if called before \fBgpioInitialise\fP.
-
-.br
-
-.br
-
-.EX
-updateMask: bit (1<<n) is set for each GPIO n which may be updated
-.br
-
-.EE
-
-.br
-
-.br
-The default setting depends upon the Pi model. The user GPIO are
-added to the mask.
-
-.br
-
-.br
-If the board revision is not recognised then GPIO 2-27 are allowed.
-
-.br
-
-.br
-Unknown board PI_DEFAULT_UPDATE_MASK_UNKNOWN 0x0FFFFFFC
-.br
-.br
-Type 1 board PI_DEFAULT_UPDATE_MASK_B1 0x03E6CF93
-.br
-.br
-Type 2 board PI_DEFAULT_UPDATE_MASK_A_B2 0xFBC6CF9C
-.br
-Type 3 board PI_DEFAULT_UPDATE_MASK_R3 0x0FFFFFFC
-.br
-
-.IP "\fBint gpioCfgSocketPort(unsigned port)\fP"
-.IP "" 4
-Configures pigpio to use the specified socket port.
-
-.br
-
-.br
-This function is only effective if called before \fBgpioInitialise\fP.
-
-.br
-
-.br
-
-.EX
-port: 1024-32000
-.br
-
-.EE
-
-.br
-
-.br
-The default setting is to use port 8888.
-
-.IP "\fBint gpioCfgInterfaces(unsigned ifFlags)\fP"
-.IP "" 4
-Configures pigpio support of the fifo and socket interfaces.
-
-.br
-
-.br
-This function is only effective if called before \fBgpioInitialise\fP.
-
-.br
-
-.br
-
-.EX
-ifFlags: 0-7
-.br
-
-.EE
-
-.br
-
-.br
-The default setting (0) is that both interfaces are enabled.
-
-.br
-
-.br
-Or in PI_DISABLE_FIFO_IF to disable the pipe interface.
-
-.br
-
-.br
-Or in PI_DISABLE_SOCK_IF to disable the socket interface.
-
-.br
-
-.br
-Or in PI_LOCALHOST_SOCK_IF to disable remote socket
-access (this means that the socket interface is only
-usable from the local Pi).
-
-.IP "\fBint gpioCfgMemAlloc(unsigned memAllocMode)\fP"
-.IP "" 4
-Selects the method of DMA memory allocation.
-
-.br
-
-.br
-This function is only effective if called before \fBgpioInitialise\fP.
-
-.br
-
-.br
-
-.EX
-memAllocMode: 0-2
-.br
-
-.EE
-
-.br
-
-.br
-There are two methods of DMA memory allocation. The original method
-uses the /proc/self/pagemap file to allocate bus memory. The new
-method uses the mailbox property interface to allocate bus memory.
-
-.br
-
-.br
-Auto will use the mailbox method unless a larger than default buffer
-size is requested with \fBgpioCfgBufferSize\fP.
-
-.IP "\fBint gpioCfgNetAddr(int numSockAddr, uint32_t *sockAddr)\fP"
-.IP "" 4
-Sets the network addresses which are allowed to talk over the
-socket interface.
-
-.br
-
-.br
-This function is only effective if called before \fBgpioInitialise\fP.
-
-.br
-
-.br
-
-.EX
-numSockAddr: 0-256 (0 means all addresses allowed)
-.br
- sockAddr: an array of permitted network addresses.
-.br
-
-.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
-settings.
-
-.IP "\fBint gpioCfgSetInternals(uint32_t cfgVal)\fP"
-.IP "" 4
-This function sets the current library internal configuration
-settings.
-
-.br
-
-.br
-
-.EX
-cfgVal: see source code
-.br
-
-.EE
-
-.IP "\fBint gpioCustom1(unsigned arg1, unsigned arg2, char *argx, unsigned argc)\fP"
-.IP "" 4
-This function is available for user customisation.
-
-.br
-
-.br
-It returns a single integer value.
-
-.br
-
-.br
-
-.EX
-arg1: >=0
-.br
-arg2: >=0
-.br
-argx: extra (byte) arguments
-.br
-argc: number of extra arguments
-.br
-
-.EE
-
-.br
-
-.br
-Returns >= 0 if OK, less than 0 indicates a user defined error.
-
-.IP "\fBint gpioCustom2(unsigned arg1, char *argx, unsigned argc, char *retBuf, unsigned retMax)\fP"
-.IP "" 4
-This function is available for user customisation.
-
-.br
-
-.br
-It differs from gpioCustom1 in that it returns an array of bytes
-rather than just an integer.
-
-.br
-
-.br
-The returned value is an integer indicating the number of returned bytes.
-
-.EX
- arg1: >=0
-.br
- argx: extra (byte) arguments
-.br
- argc: number of extra arguments
-.br
-retBuf: buffer for returned bytes
-.br
-retMax: maximum number of bytes to return
-.br
-
-.EE
-
-.br
-
-.br
-Returns >= 0 if OK, less than 0 indicates a user defined error.
-
-.br
-
-.br
-The number of returned bytes must be retMax or less.
-
-.IP "\fBint rawWaveAddSPI(rawSPI_t *spi, unsigned offset, unsigned spiSS, char *buf, unsigned spiTxBits, unsigned spiBitFirst, unsigned spiBitLast, unsigned spiBits)\fP"
-.IP "" 4
-This function adds a waveform representing SPI data to the
-existing waveform (if any).
-
-.br
-
-.br
-
-.EX
- spi: a pointer to a spi object
-.br
- offset: microseconds from the start of the waveform
-.br
- spiSS: the slave select GPIO
-.br
- buf: the bits to transmit, most significant bit first
-.br
- spiTxBits: the number of bits to write
-.br
-spiBitFirst: the first bit to read
-.br
- spiBitLast: the last bit to read
-.br
- spiBits: the number of bits to transfer
-.br
-
-.EE
-
-.br
-
-.br
-Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_BAD_USER_GPIO, PI_BAD_SER_OFFSET, or PI_TOO_MANY_PULSES.
-
-.br
-
-.br
-Not intended for general use.
-
-.IP "\fBint rawWaveAddGeneric(unsigned numPulses, rawWave_t *pulses)\fP"
-.IP "" 4
-This function adds a number of pulses to the current waveform.
-
-.br
-
-.br
-
-.EX
-numPulses: the number of pulses
-.br
- pulses: the array containing the pulses
-.br
-
-.EE
-
-.br
-
-.br
-Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_TOO_MANY_PULSES.
-
-.br
-
-.br
-The advantage of this function over gpioWaveAddGeneric is that it
-allows the setting of the flags field.
-
-.br
-
-.br
-The pulses are interleaved in time order within the existing waveform
-(if any).
-
-.br
-
-.br
-Merging allows the waveform to be built in parts, that is the settings
-for GPIO#1 can be added, and then GPIO#2 etc.
-
-.br
-
-.br
-If the added waveform is intended to start after or within the existing
-waveform then the first pulse should consist of a delay.
-
-.br
-
-.br
-Not intended for general use.
-
-.IP "\fBunsigned rawWaveCB(void)\fP"
-.IP "" 4
-Returns the number of the cb being currently output.
-
-.br
-
-.br
-Not intended for general use.
-
-.IP "\fBrawCbs_t *rawWaveCBAdr(int cbNum)\fP"
-.IP "" 4
-Return the (Linux) address of contol block cbNum.
-
-.br
-
-.br
-
-.EX
-cbNum: the cb of interest
-.br
-
-.EE
-
-.br
-
-.br
-Not intended for general use.
-
-.IP "\fBuint32_t rawWaveGetOOL(int pos)\fP"
-.IP "" 4
-Gets the OOL parameter stored at pos.
-
-.br
-
-.br
-
-.EX
-pos: the position of interest.
-.br
-
-.EE
-
-.br
-
-.br
-Not intended for general use.
-
-.IP "\fBvoid rawWaveSetOOL(int pos, uint32_t lVal)\fP"
-.IP "" 4
-Sets the OOL parameter stored at pos to value.
-
-.br
-
-.br
-
-.EX
- pos: the position of interest
-.br
-lVal: the value to write
-.br
-
-.EE
-
-.br
-
-.br
-Not intended for general use.
-
-.IP "\fBuint32_t rawWaveGetOut(int pos)\fP"
-.IP "" 4
-Gets the wave output parameter stored at pos.
-
-.br
-
-.br
-DEPRECATED: use rawWaveGetOOL instead.
-
-.br
-
-.br
-
-.EX
-pos: the position of interest.
-.br
-
-.EE
-
-.br
-
-.br
-Not intended for general use.
-
-.IP "\fBvoid rawWaveSetOut(int pos, uint32_t lVal)\fP"
-.IP "" 4
-Sets the wave output parameter stored at pos to value.
-
-.br
-
-.br
-DEPRECATED: use rawWaveSetOOL instead.
-
-.br
-
-.br
-
-.EX
- pos: the position of interest
-.br
-lVal: the value to write
-.br
-
-.EE
-
-.br
-
-.br
-Not intended for general use.
-
-.IP "\fBuint32_t rawWaveGetIn(int pos)\fP"
-.IP "" 4
-Gets the wave input value parameter stored at pos.
-
-.br
-
-.br
-DEPRECATED: use rawWaveGetOOL instead.
-
-.br
-
-.br
-
-.EX
-pos: the position of interest
-.br
-
-.EE
-
-.br
-
-.br
-Not intended for general use.
-
-.IP "\fBvoid rawWaveSetIn(int pos, uint32_t lVal)\fP"
-.IP "" 4
-Sets the wave input value stored at pos to value.
-
-.br
-
-.br
-DEPRECATED: use rawWaveSetOOL instead.
-
-.br
-
-.br
-
-.EX
- pos: the position of interest
-.br
-lVal: the value to write
-.br
-
-.EE
-
-.br
-
-.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
-0 if bitPos is greater than or equal to numBits.
-
-.br
-
-.br
-
-.EX
- bitPos: bit index from the start of buf
-.br
- buf: array of bits
-.br
-numBits: number of valid bits in buf
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBvoid putBitInBytes(int bitPos, char *buf, int bit)\fP"
-.IP "" 4
-Sets the bit bitPos bits from the start of buf to bit.
-
-.br
-
-.br
-
-.EX
-bitPos: bit index from the start of buf
-.br
- buf: array of bits
-.br
- bit: 0-1, value to set
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBdouble time_time(void)\fP"
-.IP "" 4
-Return the current time in seconds since the Epoch.
-
-.IP "\fBvoid time_sleep(double seconds)\fP"
-.IP "" 4
-Delay execution for a given number of seconds
-
-.br
-
-.br
-
-.EX
-seconds: the number of seconds to sleep
-.br
-
-.EE
-
-.IP "\fBvoid rawDumpWave(void)\fP"
-.IP "" 4
-Used to print a readable version of the current waveform to stderr.
-
-.br
-
-.br
-Not intended for general use.
-
-.IP "\fBvoid rawDumpScript(unsigned script_id)\fP"
-.IP "" 4
-Used to print a readable version of a script to stderr.
-
-.br
-
-.br
-
-.EX
-script_id: >=0, a script_id returned by \fBgpioStoreScript\fP
-.br
-
-.EE
-
-.br
-
-.br
-Not intended for general use.
-.SH PARAMETERS
-
-.br
-
-.br
-
-.IP "\fBactive\fP: 0-1000000" 0
-
-.br
-
-.br
-The number of microseconds level changes are reported for once
-a noise filter has been triggered (by \fBsteady\fP microseconds of
-a stable level).
-
-.br
-
-.br
-
-.IP "\fBarg1\fP" 0
-
-.br
-
-.br
-An unsigned argument passed to a user customised function. Its
-meaning is defined by the customiser.
-
-.br
-
-.br
-
-.IP "\fBarg2\fP" 0
-
-.br
-
-.br
-An unsigned argument passed to a user customised function. Its
-meaning is defined by the customiser.
-
-.br
-
-.br
-
-.IP "\fBargc\fP" 0
-The count of bytes passed to a user customised function.
-
-.br
-
-.br
-
-.IP "\fB*argx\fP" 0
-A pointer to an array of bytes passed to a user customised function.
-Its meaning and content is defined by the customiser.
-
-.br
-
-.br
-
-.IP "\fBbaud\fP" 0
-The speed of serial communication (I2C, SPI, serial link, waves) in
-bits per second.
-
-.br
-
-.br
-
-.IP "\fBbit\fP" 0
-A value of 0 or 1.
-
-.br
-
-.br
-
-.IP "\fBbitPos\fP" 0
-A bit position within a byte or word. The least significant bit is
-position 0.
-
-.br
-
-.br
-
-.IP "\fBbits\fP" 0
-A value used to select GPIO. If bit n of bits is set then GPIO n is
-selected.
-
-.br
-
-.br
-A convenient way to set bit n is to or in (1<<n).
-
-.br
-
-.br
-e.g. to select bits 5, 9, 23 you could use (1<<5) | (1<<9) | (1<<23).
-
-.br
-
-.br
-
-.IP "\fB*bsc_xfer\fP" 0
-A pointer to a \fBbsc_xfer_t\fP object used to control a BSC transfer.
-
-.br
-
-.br
-
-.IP "\fBbsc_xfer_t\fP" 0
-
-.br
-
-.br
-
-.EX
-typedef struct
-.br
-{
-.br
- uint32_t control; // Write
-.br
- int rxCnt; // Read only
-.br
- char rxBuf[BSC_FIFO_SIZE]; // Read only
-.br
- int txCnt; // Write
-.br
- char txBuf[BSC_FIFO_SIZE]; // Write
-.br
-} bsc_xfer_t;
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fB*buf\fP" 0
-
-.br
-
-.br
-A buffer to hold data being sent or being received.
-
-.br
-
-.br
-
-.IP "\fBbufSize\fP" 0
-
-.br
-
-.br
-The size in bytes of a buffer.
-
-.br
-
-.br
-
-.IP "\fBbVal\fP: 0-255 (Hex 0x0-0xFF, Octal 0-0377)" 0
-
-.br
-
-.br
-An 8-bit byte value.
-
-.br
-
-.br
-
-.IP "\fBcbNum\fP" 0
-
-.br
-
-.br
-A number identifying a DMA contol block.
-
-.br
-
-.br
-
-.IP "\fBcfgMicros\fP" 0
-
-.br
-
-.br
-The GPIO sample rate in microseconds. The default is 5us, or 200 thousand
-samples per second.
-
-.br
-
-.br
-
-.IP "\fBcfgMillis\fP: 100-10000" 0
-
-.br
-
-.br
-The size of the sample buffer in milliseconds. Generally this should be
-left at the default of 120ms. If you expect intense bursts of signals it
-might be necessary to increase the buffer size.
-
-.br
-
-.br
-
-.IP "\fBcfgPeripheral\fP" 0
-
-.br
-
-.br
-One of the PWM or PCM peripherals used to pace DMA transfers for timing
-purposes.
-
-.br
-
-.br
-
-.IP "\fBcfgSource\fP" 0
-
-.br
-
-.br
-Deprecated.
-
-.br
-
-.br
-
-.IP "\fBcfgVal\fP" 0
-
-.br
-
-.br
-A number specifying the value of a configuration item. See \fBcfgWhat\fP.
-
-.br
-
-.br
-
-.IP "\fBcfgWhat\fP" 0
-
-.br
-
-.br
-A number specifying a configuration item.
-
-.br
-
-.br
-562484977: print enhanced statistics at termination.
-.br
-984762879: set the initial debug level.
-
-.br
-
-.br
-
-.IP "\fBchar\fP" 0
-
-.br
-
-.br
-A single character, an 8 bit quantity able to store 0-255.
-
-.br
-
-.br
-
-.IP "\fBclkfreq\fP: 4689-250M (13184-375M for the BCM2711)" 0
-
-.br
-
-.br
-The hardware clock frequency.
-
-.br
-
-.br
-
-.EX
-PI_HW_CLK_MIN_FREQ 4689
-.br
-PI_HW_CLK_MAX_FREQ 250000000
-.br
-PI_HW_CLK_MAX_FREQ_2711 375000000
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBcount\fP" 0
-The number of bytes to be transferred in an I2C, SPI, or Serial
-command.
-
-.br
-
-.br
-
-.IP "\fBCS\fP" 0
-The GPIO used for the slave select signal when bit banging SPI.
-
-.br
-
-.br
-
-.IP "\fBdata_bits\fP: 1-32" 0
-
-.br
-
-.br
-The number of data bits to be used when adding serial data to a
-waveform.
-
-.br
-
-.br
-
-.EX
-PI_MIN_WAVE_DATABITS 1
-.br
-PI_MAX_WAVE_DATABITS 32
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBDMAchannel\fP: 0-15" 0
-
-.EX
-PI_MIN_DMA_CHANNEL 0
-.br
-PI_MAX_DMA_CHANNEL 15
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBdouble\fP" 0
-
-.br
-
-.br
-A floating point number.
-
-.br
-
-.br
-
-.IP "\fBdutycycle\fP: 0-range" 0
-
-.br
-
-.br
-A number representing the ratio of on time to off time for PWM.
-
-.br
-
-.br
-The number may vary between 0 and range (default 255) where
-0 is off and range is fully on.
-
-.br
-
-.br
-
-.IP "\fBedge\fP: 0-2" 0
-The type of GPIO edge to generate an interrupt. See \fBgpioSetISRFunc\fP
-and \fBgpioSetISRFuncEx\fP.
-
-.br
-
-.br
-
-.EX
-RISING_EDGE 0
-.br
-FALLING_EDGE 1
-.br
-EITHER_EDGE 2
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBevent\fP: 0-31" 0
-An event is a signal used to inform one or more consumers
-to start an action.
-
-.br
-
-.br
-
-.IP "\fBeventFunc_t\fP" 0
-
-.EX
-typedef void (*eventFunc_t) (int event, uint32_t tick);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBeventFuncEx_t\fP" 0
-
-.EX
-typedef void (*eventFuncEx_t)
-.br
- (int event, uint32_t tick, void *userdata);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBf\fP" 0
-
-.br
-
-.br
-A function.
-
-.br
-
-.br
-
-.IP "\fB*file\fP" 0
-A full file path. To be accessible the path must match an entry in
-/opt/pigpio/access.
-
-.br
-
-.br
-
-.IP "\fB*fpat\fP" 0
-A file path which may contain wildcards. To be accessible the path
-must match an entry in /opt/pigpio/access.
-
-.br
-
-.br
-
-.IP "\fBfrequency\fP: >=0" 0
-
-.br
-
-.br
-The number of times a GPIO is swiched on and off per second. This
-can be set per GPIO and may be as little as 5Hz or as much as
-40KHz. The GPIO will be on for a proportion of the time as defined
-by its dutycycle.
-
-.br
-
-.br
-
-.IP "\fBgpio\fP" 0
-
-.br
-
-.br
-A Broadcom numbered GPIO, in the range 0-53.
-
-.br
-
-.br
-There are 54 General Purpose Input Outputs (GPIO) named GPIO0 through
-GPIO53.
-
-.br
-
-.br
-They are split into two banks. Bank 1 consists of GPIO0 through
-GPIO31. Bank 2 consists of GPIO32 through GPIO53.
-
-.br
-
-.br
-All the GPIO which are safe for the user to read and write are in
-bank 1. Not all GPIO in bank 1 are safe though. Type 1 boards
-have 17 safe GPIO. Type 2 boards have 21. Type 3 boards have 26.
-
-.br
-
-.br
-See \fBgpioHardwareRevision\fP.
-
-.br
-
-.br
-The user GPIO are marked with an X in the following table.
-
-.br
-
-.br
-
-.EX
- 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
-.br
-Type 1 X X - - X - - X X X X X - - X X
-.br
-Type 2 - - X X X - - X X X X X - - X X
-.br
-Type 3 X X X X X X X X X X X X X X
-.br
-
-.br
- 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
-.br
-Type 1 - X X - - X X X X X - - - - - -
-.br
-Type 2 - X X - - - X X X X - X X X X X
-.br
-Type 3 X X X X X X X X X X X X - - - -
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBgpioAlertFunc_t\fP" 0
-
-.EX
-typedef void (*gpioAlertFunc_t) (int gpio, int level, uint32_t tick);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBgpioAlertFuncEx_t\fP" 0
-
-.EX
-typedef void (*eventFuncEx_t)
-.br
- (int event, int level, uint32_t tick, void *userdata);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBgpioCfg*\fP" 0
-
-.br
-
-.br
-These functions are only effective if called before \fBgpioInitialise\fP.
-
-.br
-
-.br
-\fBgpioCfgBufferSize\fP
-.br
-\fBgpioCfgClock\fP
-.br
-\fBgpioCfgDMAchannel\fP
-.br
-\fBgpioCfgDMAchannels\fP
-.br
-\fBgpioCfgPermissions\fP
-.br
-\fBgpioCfgInterfaces\fP
-.br
-\fBgpioCfgSocketPort\fP
-.br
-\fBgpioCfgMemAlloc\fP
-
-.br
-
-.br
-
-.IP "\fBgpioGetSamplesFunc_t\fP" 0
-
-.EX
-typedef void (*gpioGetSamplesFunc_t)
-.br
- (const gpioSample_t *samples, int numSamples);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBgpioGetSamplesFuncEx_t\fP" 0
-
-.EX
-typedef void (*gpioGetSamplesFuncEx_t)
-.br
- (const gpioSample_t *samples, int numSamples, void *userdata);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBgpioISRFunc_t\fP" 0
-
-.EX
-typedef void (*gpioISRFunc_t)
-.br
- (int gpio, int level, uint32_t tick);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBgpioISRFuncEx_t\fP" 0
-
-.EX
-typedef void (*gpioISRFuncEx_t)
-.br
- (int gpio, int level, uint32_t tick, void *userdata);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBgpioPulse_t\fP" 0
-
-.EX
-typedef struct
-.br
-{
-.br
- uint32_t gpioOn;
-.br
- uint32_t gpioOff;
-.br
- uint32_t usDelay;
-.br
-} gpioPulse_t;
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBgpioSample_t\fP" 0
-
-.EX
-typedef struct
-.br
-{
-.br
- uint32_t tick;
-.br
- uint32_t level;
-.br
-} gpioSample_t;
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBgpioSignalFunc_t\fP" 0
-
-.EX
-typedef void (*gpioSignalFunc_t) (int signum);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBgpioSignalFuncEx_t\fP" 0
-
-.EX
-typedef void (*gpioSignalFuncEx_t) (int signum, void *userdata);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBgpioThreadFunc_t\fP" 0
-
-.EX
-typedef void *(gpioThreadFunc_t) (void *);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBgpioTimerFunc_t\fP" 0
-
-.EX
-typedef void (*gpioTimerFunc_t) (void);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBgpioTimerFuncEx_t\fP" 0
-
-.EX
-typedef void (*gpioTimerFuncEx_t) (void *userdata);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBgpioWaveAdd*\fP" 0
-
-.br
-
-.br
-One of
-
-.br
-
-.br
-\fBgpioWaveAddNew\fP
-.br
-\fBgpioWaveAddGeneric\fP
-.br
-\fBgpioWaveAddSerial\fP
-
-.br
-
-.br
-
-.IP "\fBhandle\fP: >=0" 0
-
-.br
-
-.br
-A number referencing an object opened by one of
-
-.br
-
-.br
-\fBfileOpen\fP
-.br
-\fBgpioNotifyOpen\fP
-.br
-\fBi2cOpen\fP
-.br
-\fBserOpen\fP
-.br
-\fBspiOpen\fP
-
-.br
-
-.br
-
-.IP "\fBi2cAddr\fP: 0-0x7F" 0
-The address of a device on the I2C bus.
-
-.br
-
-.br
-
-.IP "\fBi2cBus\fP: >=0" 0
-
-.br
-
-.br
-An I2C bus number.
-
-.br
-
-.br
-
-.IP "\fBi2cFlags\fP: 0" 0
-
-.br
-
-.br
-Flags which modify an I2C open command. None are currently defined.
-
-.br
-
-.br
-
-.IP "\fBi2cReg\fP: 0-255" 0
-
-.br
-
-.br
-A register of an I2C device.
-
-.br
-
-.br
-
-.IP "\fBifFlags\fP: 0-3" 0
-
-.EX
-PI_DISABLE_FIFO_IF 1
-.br
-PI_DISABLE_SOCK_IF 2
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fB*inBuf\fP" 0
-A buffer used to pass data to a function.
-
-.br
-
-.br
-
-.IP "\fBinLen\fP" 0
-The number of bytes of data in a buffer.
-
-.br
-
-.br
-
-.IP "\fBint\fP" 0
-A whole number, negative or positive.
-
-.br
-
-.br
-
-.IP "\fBint32_t\fP" 0
-A 32-bit signed value.
-
-.br
-
-.br
-
-.IP "\fBinvert\fP" 0
-A flag used to set normal or inverted bit bang serial data level logic.
-
-.br
-
-.br
-
-.IP "\fBlevel\fP" 0
-The level of a GPIO. Low or High.
-
-.br
-
-.br
-
-.EX
-PI_OFF 0
-.br
-PI_ON 1
-.br
-
-.br
-PI_CLEAR 0
-.br
-PI_SET 1
-.br
-
-.br
-PI_LOW 0
-.br
-PI_HIGH 1
-.br
-
-.EE
-
-.br
-
-.br
-There is one exception. If a watchdog expires on a GPIO the level will be
-reported as PI_TIMEOUT. See \fBgpioSetWatchdog\fP.
-
-.br
-
-.br
-
-.EX
-PI_TIMEOUT 2
-.br
-
-.EE
-
-.br
-
-.br
-
-.br
-
-.br
-
-.IP "\fBlVal\fP: 0-4294967295 (Hex 0x0-0xFFFFFFFF, Octal 0-37777777777)" 0
-
-.br
-
-.br
-A 32-bit word value.
-
-.br
-
-.br
-
-.IP "\fBmemAllocMode\fP: 0-2" 0
-
-.br
-
-.br
-The DMA memory allocation mode.
-
-.br
-
-.br
-
-.EX
-PI_MEM_ALLOC_AUTO 0
-.br
-PI_MEM_ALLOC_PAGEMAP 1
-.br
-PI_MEM_ALLOC_MAILBOX 2
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fB*micros\fP" 0
-
-.br
-
-.br
-A value representing microseconds.
-
-.br
-
-.br
-
-.IP "\fBmicros\fP" 0
-
-.br
-
-.br
-A value representing microseconds.
-
-.br
-
-.br
-
-.IP "\fBmillis\fP" 0
-
-.br
-
-.br
-A value representing milliseconds.
-
-.br
-
-.br
-
-.IP "\fBMISO\fP" 0
-The GPIO used for the MISO signal when bit banging SPI.
-
-.br
-
-.br
-
-.IP "\fBmode\fP" 0
-
-.br
-
-.br
-1. The operational mode of a GPIO, normally INPUT or OUTPUT.
-
-.br
-
-.br
-
-.EX
-PI_INPUT 0
-.br
-PI_OUTPUT 1
-.br
-PI_ALT0 4
-.br
-PI_ALT1 5
-.br
-PI_ALT2 6
-.br
-PI_ALT3 7
-.br
-PI_ALT4 3
-.br
-PI_ALT5 2
-.br
-
-.EE
-
-.br
-
-.br
-2. A file open mode.
-
-.br
-
-.br
-
-.EX
-PI_FILE_READ 1
-.br
-PI_FILE_WRITE 2
-.br
-PI_FILE_RW 3
-.br
-
-.EE
-
-.br
-
-.br
-The following values can be or'd into the mode.
-
-.br
-
-.br
-
-.EX
-PI_FILE_APPEND 4
-.br
-PI_FILE_CREATE 8
-.br
-PI_FILE_TRUNC 16
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBMOSI\fP" 0
-The GPIO used for the MOSI signal when bit banging SPI.
-
-.br
-
-.br
-
-.IP "\fBnumBits\fP" 0
-
-.br
-
-.br
-The number of bits stored in a buffer.
-
-.br
-
-.br
-
-.IP "\fBnumBytes\fP" 0
-The number of bytes used to store characters in a string. Depending
-on the number of bits per character there may be 1, 2, or 4 bytes
-per character.
-
-.br
-
-.br
-
-.IP "\fBnumPar\fP: 0-10" 0
-The number of parameters passed to a script.
-
-.br
-
-.br
-
-.IP "\fBnumPulses\fP" 0
-The number of pulses to be added to a waveform.
-
-.br
-
-.br
-
-.IP "\fBnumSegs\fP" 0
-The number of segments in a combined I2C transaction.
-
-.br
-
-.br
-
-.IP "\fBnumSockAddr\fP" 0
-The number of network addresses allowed to use the socket interface.
-
-.br
-
-.br
-0 means all addresses allowed.
-
-.br
-
-.br
-
-.IP "\fBoffset\fP" 0
-The associated data starts this number of microseconds from the start of
-the waveform.
-
-.br
-
-.br
-
-.IP "\fB*outBuf\fP" 0
-A buffer used to return data from a function.
-
-.br
-
-.br
-
-.IP "\fBoutLen\fP" 0
-The size in bytes of an output buffer.
-
-.br
-
-.br
-
-.IP "\fBpad\fP: 0-2" 0
-A set of GPIO which share common drivers.
-
-.br
-
-.br
-Pad GPIO
-.br
-0 0-27
-.br
-1 28-45
-.br
-2 46-53
-.br
-
-.br
-
-.br
-
-.IP "\fBpadStrength\fP: 1-16" 0
-The mA which may be drawn from each GPIO whilst still guaranteeing the
-high and low levels.
-
-.br
-
-.br
-
-.IP "\fB*param\fP" 0
-An array of script parameters.
-
-.br
-
-.br
-
-.IP "\fBpctBOOL\fP: 0-100" 0
-percent On-Off-Level (OOL) buffer to consume for wave output.
-
-.br
-
-.br
-
-.IP "\fBpctCB\fP: 0-100" 0
-the percent of all DMA control blocks to consume.
-
-.br
-
-.br
-
-.IP "\fBpctTOOL\fP: 0-100" 0
-the percent of OOL buffer to consume for wave input (flags).
-
-.br
-
-.br
-
-.IP "\fBpi_i2c_msg_t\fP" 0
-
-.EX
-typedef struct
-.br
-{
-.br
- uint16_t addr; // slave address
-.br
- uint16_t flags;
-.br
- uint16_t len; // msg length
-.br
- uint8_t *buf; // pointer to msg data
-.br
-} pi_i2c_msg_t;
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBport\fP: 1024-32000" 0
-The port used to bind to the pigpio socket. Defaults to 8888.
-
-.br
-
-.br
-
-.IP "\fBpos\fP" 0
-The position of an item.
-
-.br
-
-.br
-
-.IP "\fBprimaryChannel\fP: 0-15" 0
-The DMA channel used to time the sampling of GPIO and to time servo and
-PWM pulses.
-
-.br
-
-.br
-
-.IP "\fB*pth\fP" 0
-
-.br
-
-.br
-A thread identifier, returned by \fBgpioStartThread\fP.
-
-.br
-
-.br
-
-.IP "\fBpthread_t\fP" 0
-
-.br
-
-.br
-A thread identifier.
-
-.br
-
-.br
-
-.IP "\fBpud\fP: 0-2" 0
-
-.br
-
-.br
-The setting of the pull up/down resistor for a GPIO, which may be off,
-pull-up, or pull-down.
-
-.br
-
-.br
-
-.EX
-PI_PUD_OFF 0
-.br
-PI_PUD_DOWN 1
-.br
-PI_PUD_UP 2
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBpulseLen\fP" 0
-
-.br
-
-.br
-1-100, the length of a trigger pulse in microseconds.
-
-.br
-
-.br
-
-.IP "\fB*pulses\fP" 0
-
-.br
-
-.br
-An array of pulses to be added to a waveform.
-
-.br
-
-.br
-
-.IP "\fBpulsewidth\fP: 0, 500-2500" 0
-
-.EX
-PI_SERVO_OFF 0
-.br
-PI_MIN_SERVO_PULSEWIDTH 500
-.br
-PI_MAX_SERVO_PULSEWIDTH 2500
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBPWMduty\fP: 0-1000000 (1M)" 0
-The hardware PWM dutycycle.
-
-.br
-
-.br
-
-.EX
-PI_HW_PWM_RANGE 1000000
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBPWMfreq\fP: 1-125M (1-187.5M for the BCM2711)" 0
-The hardware PWM frequency.
-
-.br
-
-.br
-
-.EX
-PI_HW_PWM_MIN_FREQ 1
-.br
-PI_HW_PWM_MAX_FREQ 125000000
-.br
-PI_HW_PWM_MAX_FREQ_2711 187500000
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBrange\fP: 25-40000" 0
-
-.EX
-PI_MIN_DUTYCYCLE_RANGE 25
-.br
-PI_MAX_DUTYCYCLE_RANGE 40000
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBrawCbs_t\fP" 0
-
-.EX
-typedef struct // linux/arch/arm/mach-bcm2708/include/mach/dma.h
-.br
-{
-.br
- unsigned long info;
-.br
- unsigned long src;
-.br
- unsigned long dst;
-.br
- unsigned long length;
-.br
- unsigned long stride;
-.br
- unsigned long next;
-.br
- unsigned long pad[2];
-.br
-} rawCbs_t;
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBrawSPI_t\fP" 0
-
-.EX
-typedef struct
-.br
-{
-.br
- int clk; // GPIO for clock
-.br
- int mosi; // GPIO for MOSI
-.br
- int miso; // GPIO for MISO
-.br
- int ss_pol; // slave select off state
-.br
- int ss_us; // delay after slave select
-.br
- int clk_pol; // clock off state
-.br
- int clk_pha; // clock phase
-.br
- int clk_us; // clock micros
-.br
-} rawSPI_t;
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBrawWave_t\fP" 0
-
-.EX
-typedef struct
-.br
-{
-.br
- uint32_t gpioOn;
-.br
- uint32_t gpioOff;
-.br
- uint32_t usDelay;
-.br
- uint32_t flags;
-.br
-} rawWave_t;
-.br
-
-.EE
-
-.br
-
-.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
- uint16_t deleted;
-.br
- uint16_t numCB;
-.br
- uint16_t numBOOL;
-.br
- uint16_t numTOOL;
-.br
-} rawWaveInfo_t;
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fB*retBuf\fP" 0
-
-.br
-
-.br
-A buffer to hold a number of bytes returned to a used customised function,
-
-.br
-
-.br
-
-.IP "\fBretMax\fP" 0
-
-.br
-
-.br
-The maximum number of bytes a user customised function should return.
-
-.br
-
-.br
-
-.IP "\fB*rxBuf\fP" 0
-
-.br
-
-.br
-A pointer to a buffer to receive data.
-
-.br
-
-.br
-
-.IP "\fBSCL\fP" 0
-The user GPIO to use for the clock when bit banging I2C.
-
-.br
-
-.br
-
-.IP "\fBSCLK\fP" 0
-The GPIO used for the SCLK signal when bit banging SPI.
-
-.br
-
-.br
-
-.IP "\fB*script\fP" 0
-A pointer to the text of a script.
-
-.br
-
-.br
-
-.IP "\fBscript_id\fP" 0
-An id of a stored script as returned by \fBgpioStoreScript\fP.
-
-.br
-
-.br
-
-.IP "\fB*scriptName\fP" 0
-The name of a \fBshell\fP script to be executed. The script must be present in
-/opt/pigpio/cgi and must have execute permission.
-
-.br
-
-.br
-
-.IP "\fB*scriptString\fP" 0
-The string to be passed to a \fBshell\fP script to be executed.
-
-.br
-
-.br
-
-.IP "\fBSDA\fP" 0
-The user GPIO to use for data when bit banging I2C.
-
-.br
-
-.br
-
-.IP "\fBsecondaryChannel\fP: 0-6" 0
-
-.br
-
-.br
-The DMA channel used to time output waveforms.
-
-.br
-
-.br
-
-.IP "\fB*seconds\fP" 0
-
-.br
-
-.br
-A pointer to a uint32_t to store the second component of
-a returned time.
-
-.br
-
-.br
-
-.IP "\fBseconds\fP" 0
-The number of seconds.
-
-.br
-
-.br
-
-.IP "\fBseekFrom\fP" 0
-
-.br
-
-.br
-
-.EX
-PI_FROM_START 0
-.br
-PI_FROM_CURRENT 1
-.br
-PI_FROM_END 2
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBseekOffset\fP" 0
-The number of bytes to move forward (positive) or backwards (negative)
-from the seek position (start, current, or end of file).
-
-.br
-
-.br
-
-.IP "\fB*segs\fP" 0
-An array of segments which make up a combined I2C transaction.
-
-.br
-
-.br
-
-.IP "\fBserFlags\fP" 0
-Flags which modify a serial open command. None are currently defined.
-
-.br
-
-.br
-
-.IP "\fB*sertty\fP" 0
-The name of a serial tty device, e.g. /dev/ttyAMA0, /dev/ttyUSB0, /dev/tty1.
-
-.br
-
-.br
-
-.IP "\fBsetting\fP" 0
-A value used to set a flag, 0 for false, non-zero for true.
-
-.br
-
-.br
-
-.IP "\fBsignum\fP: 0-63" 0
-
-.EX
-PI_MIN_SIGNUM 0
-.br
-PI_MAX_SIGNUM 63
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBsize_t\fP" 0
-
-.br
-
-.br
-A standard type used to indicate the size of an object in bytes.
-
-.br
-
-.br
-
-.IP "\fB*sockAddr\fP" 0
-An array of network addresses allowed to use the socket interface encoded
-as 32 bit numbers.
-
-.br
-
-.br
-E.g. address 192.168.1.66 would be encoded as 0x4201a8c0.
-
-.br
-
-.br
-
-.IP "\fB*spi\fP" 0
-A pointer to a \fBrawSPI_t\fP structure.
-
-.br
-
-.br
-
-.IP "\fBspiBitFirst\fP" 0
-GPIO reads are made from spiBitFirst to spiBitLast.
-
-.br
-
-.br
-
-.IP "\fBspiBitLast\fP" 0
-
-.br
-
-.br
-GPIO reads are made from spiBitFirst to spiBitLast.
-
-.br
-
-.br
-
-.IP "\fBspiBits\fP" 0
-The number of bits to transfer in a raw SPI transaction.
-
-.br
-
-.br
-
-.IP "\fBspiChan\fP" 0
-A SPI channel, 0-2.
-
-.br
-
-.br
-
-.IP "\fBspiFlags\fP" 0
-See \fBspiOpen\fP and \fBbbSPIOpen\fP.
-
-.br
-
-.br
-
-.IP "\fBspiSS\fP" 0
-The SPI slave select GPIO in a raw SPI transaction.
-
-.br
-
-.br
-
-.IP "\fBspiTxBits\fP" 0
-The number of bits to transfer dring a raw SPI transaction
-
-.br
-
-.br
-
-.IP "\fBsteady\fP: 0-300000" 0
-
-.br
-
-.br
-The number of microseconds level changes must be stable for
-before reporting the level changed (\fBgpioGlitchFilter\fP) or triggering
-the active part of a noise filter (\fBgpioNoiseFilter\fP).
-
-.br
-
-.br
-
-.IP "\fBstop_bits\fP: 2-8" 0
-The number of (half) stop bits to be used when adding serial data
-to a waveform.
-
-.br
-
-.br
-
-.EX
-PI_MIN_WAVE_HALFSTOPBITS 2
-.br
-PI_MAX_WAVE_HALFSTOPBITS 8
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fB*str\fP" 0
-An array of characters.
-
-.br
-
-.br
-
-.IP "\fBtimeout\fP" 0
-A GPIO level change timeout in milliseconds.
-
-.br
-
-.br
-\fBgpioSetWatchdog\fP
-
-.EX
-PI_MIN_WDOG_TIMEOUT 0
-.br
-PI_MAX_WDOG_TIMEOUT 60000
-.br
-
-.EE
-
-.br
-
-.br
-\fBgpioSetISRFunc\fP and \fBgpioSetISRFuncEx\fP
-
-.EX
-<=0 cancel timeout
-.br
->0 timeout after specified milliseconds
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBtimer\fP" 0
-
-.EX
-PI_MIN_TIMER 0
-.br
-PI_MAX_TIMER 9
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBtimetype\fP" 0
-
-.EX
-PI_TIME_RELATIVE 0
-.br
-PI_TIME_ABSOLUTE 1
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fB*txBuf\fP" 0
-
-.br
-
-.br
-An array of bytes to transmit.
-
-.br
-
-.br
-
-.IP "\fBuint32_t\fP: 0-0-4,294,967,295 (Hex 0x0-0xFFFFFFFF)" 0
-
-.br
-
-.br
-A 32-bit unsigned value.
-
-.br
-
-.br
-
-.IP "\fBuint64_t\fP: 0-(2^64)-1" 0
-
-.br
-
-.br
-A 64-bit unsigned value.
-
-.br
-
-.br
-
-.IP "\fBunsigned\fP" 0
-
-.br
-
-.br
-A whole number >= 0.
-
-.br
-
-.br
-
-.IP "\fBupdateMask\fP" 0
-
-.br
-
-.br
-A 64 bit mask indicating which GPIO may be written to by the user.
-
-.br
-
-.br
-If GPIO#n may be written then bit (1<<n) is set.
-
-.br
-
-.br
-
-.IP "\fBuser_gpio\fP" 0
-
-.br
-
-.br
-0-31, a Broadcom numbered GPIO.
-
-.br
-
-.br
-See \fBgpio\fP.
-
-.br
-
-.br
-
-.IP "\fB*userdata\fP" 0
-A pointer to arbitrary user data. This may be used to identify the instance.
-
-.br
-
-.br
-You must ensure that the pointer is in scope at the time it is processed. If
-it is a pointer to a global this is automatic. Do not pass the address of a
-local variable. If you want to pass a transient object then use the
-following technique.
-
-.br
-
-.br
-In the calling function:
-
-.br
-
-.br
-
-.EX
-user_type *userdata;
-.br
-.br
-.br
-user_type my_userdata;
-.br
-
-.br
-userdata = malloc(sizeof(user_type));
-.br
-.br
-.br
-*userdata = my_userdata;
-.br
-
-.EE
-
-.br
-
-.br
-In the receiving function:
-
-.br
-
-.br
-
-.EX
-user_type my_userdata = *(user_type*)userdata;
-.br
-
-.br
-free(userdata);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBvoid\fP" 0
-
-.br
-
-.br
-Denoting no parameter is required
-
-.br
-
-.br
-
-.IP "\fBwave_id\fP" 0
-
-.br
-
-.br
-A number identifying a waveform created by \fBgpioWaveCreate\fP.
-
-.br
-
-.br
-
-.IP "\fBwave_mode\fP" 0
-
-.br
-
-.br
-The mode determines if the waveform is sent once or cycles
-repeatedly. The SYNC variants wait for the current waveform
-to reach the end of a cycle or finish before starting the new
-waveform.
-
-.br
-
-.br
-
-.EX
-PI_WAVE_MODE_ONE_SHOT 0
-.br
-PI_WAVE_MODE_REPEAT 1
-.br
-PI_WAVE_MODE_ONE_SHOT_SYNC 2
-.br
-PI_WAVE_MODE_REPEAT_SYNC 3
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBwVal\fP: 0-65535 (Hex 0x0-0xFFFF, Octal 0-0177777)" 0
-
-.br
-
-.br
-A 16-bit word value.
-
-.br
-
-.br
-.SH Socket Command Codes
-
-.EX
-
-.br
-#define PI_CMD_MODES 0
-.br
-#define PI_CMD_MODEG 1
-.br
-#define PI_CMD_PUD 2
-.br
-#define PI_CMD_READ 3
-.br
-#define PI_CMD_WRITE 4
-.br
-#define PI_CMD_PWM 5
-.br
-#define PI_CMD_PRS 6
-.br
-#define PI_CMD_PFS 7
-.br
-#define PI_CMD_SERVO 8
-.br
-#define PI_CMD_WDOG 9
-.br
-#define PI_CMD_BR1 10
-.br
-#define PI_CMD_BR2 11
-.br
-#define PI_CMD_BC1 12
-.br
-#define PI_CMD_BC2 13
-.br
-#define PI_CMD_BS1 14
-.br
-#define PI_CMD_BS2 15
-.br
-#define PI_CMD_TICK 16
-.br
-#define PI_CMD_HWVER 17
-.br
-#define PI_CMD_NO 18
-.br
-#define PI_CMD_NB 19
-.br
-#define PI_CMD_NP 20
-.br
-#define PI_CMD_NC 21
-.br
-#define PI_CMD_PRG 22
-.br
-#define PI_CMD_PFG 23
-.br
-#define PI_CMD_PRRG 24
-.br
-#define PI_CMD_HELP 25
-.br
-#define PI_CMD_PIGPV 26
-.br
-#define PI_CMD_WVCLR 27
-.br
-#define PI_CMD_WVAG 28
-.br
-#define PI_CMD_WVAS 29
-.br
-#define PI_CMD_WVGO 30
-.br
-#define PI_CMD_WVGOR 31
-.br
-#define PI_CMD_WVBSY 32
-.br
-#define PI_CMD_WVHLT 33
-.br
-#define PI_CMD_WVSM 34
-.br
-#define PI_CMD_WVSP 35
-.br
-#define PI_CMD_WVSC 36
-.br
-#define PI_CMD_TRIG 37
-.br
-#define PI_CMD_PROC 38
-.br
-#define PI_CMD_PROCD 39
-.br
-#define PI_CMD_PROCR 40
-.br
-#define PI_CMD_PROCS 41
-.br
-#define PI_CMD_SLRO 42
-.br
-#define PI_CMD_SLR 43
-.br
-#define PI_CMD_SLRC 44
-.br
-#define PI_CMD_PROCP 45
-.br
-#define PI_CMD_MICS 46
-.br
-#define PI_CMD_MILS 47
-.br
-#define PI_CMD_PARSE 48
-.br
-#define PI_CMD_WVCRE 49
-.br
-#define PI_CMD_WVDEL 50
-.br
-#define PI_CMD_WVTX 51
-.br
-#define PI_CMD_WVTXR 52
-.br
-#define PI_CMD_WVNEW 53
-.br
-
-.br
-#define PI_CMD_I2CO 54
-.br
-#define PI_CMD_I2CC 55
-.br
-#define PI_CMD_I2CRD 56
-.br
-#define PI_CMD_I2CWD 57
-.br
-#define PI_CMD_I2CWQ 58
-.br
-#define PI_CMD_I2CRS 59
-.br
-#define PI_CMD_I2CWS 60
-.br
-#define PI_CMD_I2CRB 61
-.br
-#define PI_CMD_I2CWB 62
-.br
-#define PI_CMD_I2CRW 63
-.br
-#define PI_CMD_I2CWW 64
-.br
-#define PI_CMD_I2CRK 65
-.br
-#define PI_CMD_I2CWK 66
-.br
-#define PI_CMD_I2CRI 67
-.br
-#define PI_CMD_I2CWI 68
-.br
-#define PI_CMD_I2CPC 69
-.br
-#define PI_CMD_I2CPK 70
-.br
-
-.br
-#define PI_CMD_SPIO 71
-.br
-#define PI_CMD_SPIC 72
-.br
-#define PI_CMD_SPIR 73
-.br
-#define PI_CMD_SPIW 74
-.br
-#define PI_CMD_SPIX 75
-.br
-
-.br
-#define PI_CMD_SERO 76
-.br
-#define PI_CMD_SERC 77
-.br
-#define PI_CMD_SERRB 78
-.br
-#define PI_CMD_SERWB 79
-.br
-#define PI_CMD_SERR 80
-.br
-#define PI_CMD_SERW 81
-.br
-#define PI_CMD_SERDA 82
-.br
-
-.br
-#define PI_CMD_GDC 83
-.br
-#define PI_CMD_GPW 84
-.br
-
-.br
-#define PI_CMD_HC 85
-.br
-#define PI_CMD_HP 86
-.br
-
-.br
-#define PI_CMD_CF1 87
-.br
-#define PI_CMD_CF2 88
-.br
-
-.br
-#define PI_CMD_BI2CC 89
-.br
-#define PI_CMD_BI2CO 90
-.br
-#define PI_CMD_BI2CZ 91
-.br
-
-.br
-#define PI_CMD_I2CZ 92
-.br
-
-.br
-#define PI_CMD_WVCHA 93
-.br
-
-.br
-#define PI_CMD_SLRI 94
-.br
-
-.br
-#define PI_CMD_CGI 95
-.br
-#define PI_CMD_CSI 96
-.br
-
-.br
-#define PI_CMD_FG 97
-.br
-#define PI_CMD_FN 98
-.br
-
-.br
-#define PI_CMD_NOIB 99
-.br
-
-.br
-#define PI_CMD_WVTXM 100
-.br
-#define PI_CMD_WVTAT 101
-.br
-
-.br
-#define PI_CMD_PADS 102
-.br
-#define PI_CMD_PADG 103
-.br
-
-.br
-#define PI_CMD_FO 104
-.br
-#define PI_CMD_FC 105
-.br
-#define PI_CMD_FR 106
-.br
-#define PI_CMD_FW 107
-.br
-#define PI_CMD_FS 108
-.br
-#define PI_CMD_FL 109
-.br
-
-.br
-#define PI_CMD_SHELL 110
-.br
-
-.br
-#define PI_CMD_BSPIC 111
-.br
-#define PI_CMD_BSPIO 112
-.br
-#define PI_CMD_BSPIX 113
-.br
-
-.br
-#define PI_CMD_BSCX 114
-.br
-
-.br
-#define PI_CMD_EVM 115
-.br
-#define PI_CMD_EVT 116
-.br
-
-.br
-#define PI_CMD_PROCU 117
-.br
-#define PI_CMD_WVCAP 118
-.br
-
-.br
-
-.EE
-.SH Error Codes
-
-.EX
-
-.br
-#define PI_INIT_FAILED -1 // gpioInitialise failed
-.br
-#define PI_BAD_USER_GPIO -2 // GPIO not 0-31
-.br
-#define PI_BAD_GPIO -3 // GPIO not 0-53
-.br
-#define PI_BAD_MODE -4 // mode not 0-7
-.br
-#define PI_BAD_LEVEL -5 // level not 0-1
-.br
-#define PI_BAD_PUD -6 // pud not 0-2
-.br
-#define PI_BAD_PULSEWIDTH -7 // pulsewidth not 0 or 500-2500
-.br
-#define PI_BAD_DUTYCYCLE -8 // dutycycle outside set range
-.br
-#define PI_BAD_TIMER -9 // timer not 0-9
-.br
-#define PI_BAD_MS -10 // ms not 10-60000
-.br
-#define PI_BAD_TIMETYPE -11 // timetype not 0-1
-.br
-#define PI_BAD_SECONDS -12 // seconds < 0
-.br
-#define PI_BAD_MICROS -13 // micros not 0-999999
-.br
-#define PI_TIMER_FAILED -14 // gpioSetTimerFunc failed
-.br
-#define PI_BAD_WDOG_TIMEOUT -15 // timeout not 0-60000
-.br
-#define PI_NO_ALERT_FUNC -16 // DEPRECATED
-.br
-#define PI_BAD_CLK_PERIPH -17 // clock peripheral not 0-1
-.br
-#define PI_BAD_CLK_SOURCE -18 // DEPRECATED
-.br
-#define PI_BAD_CLK_MICROS -19 // clock micros not 1, 2, 4, 5, 8, or 10
-.br
-#define PI_BAD_BUF_MILLIS -20 // buf millis not 100-10000
-.br
-#define PI_BAD_DUTYRANGE -21 // dutycycle range not 25-40000
-.br
-#define PI_BAD_DUTY_RANGE -21 // DEPRECATED (use PI_BAD_DUTYRANGE)
-.br
-#define PI_BAD_SIGNUM -22 // signum not 0-63
-.br
-#define PI_BAD_PATHNAME -23 // can't open pathname
-.br
-#define PI_NO_HANDLE -24 // no handle available
-.br
-#define PI_BAD_HANDLE -25 // unknown handle
-.br
-#define PI_BAD_IF_FLAGS -26 // ifFlags > 4
-.br
-#define PI_BAD_CHANNEL -27 // DMA channel not 0-15
-.br
-#define PI_BAD_PRIM_CHANNEL -27 // DMA primary channel not 0-15
-.br
-#define PI_BAD_SOCKET_PORT -28 // socket port not 1024-32000
-.br
-#define PI_BAD_FIFO_COMMAND -29 // unrecognized fifo command
-.br
-#define PI_BAD_SECO_CHANNEL -30 // DMA secondary channel not 0-15
-.br
-#define PI_NOT_INITIALISED -31 // function called before gpioInitialise
-.br
-#define PI_INITIALISED -32 // function called after gpioInitialise
-.br
-#define PI_BAD_WAVE_MODE -33 // waveform mode not 0-3
-.br
-#define PI_BAD_CFG_INTERNAL -34 // bad parameter in gpioCfgInternals call
-.br
-#define PI_BAD_WAVE_BAUD -35 // baud rate not 50-250K(RX)/50-1M(TX)
-.br
-#define PI_TOO_MANY_PULSES -36 // waveform has too many pulses
-.br
-#define PI_TOO_MANY_CHARS -37 // waveform has too many chars
-.br
-#define PI_NOT_SERIAL_GPIO -38 // no bit bang serial read on GPIO
-.br
-#define PI_BAD_SERIAL_STRUC -39 // bad (null) serial structure parameter
-.br
-#define PI_BAD_SERIAL_BUF -40 // bad (null) serial buf parameter
-.br
-#define PI_NOT_PERMITTED -41 // GPIO operation not permitted
-.br
-#define PI_SOME_PERMITTED -42 // one or more GPIO not permitted
-.br
-#define PI_BAD_WVSC_COMMND -43 // bad WVSC subcommand
-.br
-#define PI_BAD_WVSM_COMMND -44 // bad WVSM subcommand
-.br
-#define PI_BAD_WVSP_COMMND -45 // bad WVSP subcommand
-.br
-#define PI_BAD_PULSELEN -46 // trigger pulse length not 1-100
-.br
-#define PI_BAD_SCRIPT -47 // invalid script
-.br
-#define PI_BAD_SCRIPT_ID -48 // unknown script id
-.br
-#define PI_BAD_SER_OFFSET -49 // add serial data offset > 30 minutes
-.br
-#define PI_GPIO_IN_USE -50 // GPIO already in use
-.br
-#define PI_BAD_SERIAL_COUNT -51 // must read at least a byte at a time
-.br
-#define PI_BAD_PARAM_NUM -52 // script parameter id not 0-9
-.br
-#define PI_DUP_TAG -53 // script has duplicate tag
-.br
-#define PI_TOO_MANY_TAGS -54 // script has too many tags
-.br
-#define PI_BAD_SCRIPT_CMD -55 // illegal script command
-.br
-#define PI_BAD_VAR_NUM -56 // script variable id not 0-149
-.br
-#define PI_NO_SCRIPT_ROOM -57 // no more room for scripts
-.br
-#define PI_NO_MEMORY -58 // can't allocate temporary memory
-.br
-#define PI_SOCK_READ_FAILED -59 // socket read failed
-.br
-#define PI_SOCK_WRIT_FAILED -60 // socket write failed
-.br
-#define PI_TOO_MANY_PARAM -61 // too many script parameters (> 10)
-.br
-#define PI_NOT_HALTED -62 // DEPRECATED
-.br
-#define PI_SCRIPT_NOT_READY -62 // script initialising
-.br
-#define PI_BAD_TAG -63 // script has unresolved tag
-.br
-#define PI_BAD_MICS_DELAY -64 // bad MICS delay (too large)
-.br
-#define PI_BAD_MILS_DELAY -65 // bad MILS delay (too large)
-.br
-#define PI_BAD_WAVE_ID -66 // non existent wave id
-.br
-#define PI_TOO_MANY_CBS -67 // No more CBs for waveform
-.br
-#define PI_TOO_MANY_OOL -68 // No more OOL for waveform
-.br
-#define PI_EMPTY_WAVEFORM -69 // attempt to create an empty waveform
-.br
-#define PI_NO_WAVEFORM_ID -70 // no more waveforms
-.br
-#define PI_I2C_OPEN_FAILED -71 // can't open I2C device
-.br
-#define PI_SER_OPEN_FAILED -72 // can't open serial device
-.br
-#define PI_SPI_OPEN_FAILED -73 // can't open SPI device
-.br
-#define PI_BAD_I2C_BUS -74 // bad I2C bus
-.br
-#define PI_BAD_I2C_ADDR -75 // bad I2C address
-.br
-#define PI_BAD_SPI_CHANNEL -76 // bad SPI channel
-.br
-#define PI_BAD_FLAGS -77 // bad i2c/spi/ser open flags
-.br
-#define PI_BAD_SPI_SPEED -78 // bad SPI speed
-.br
-#define PI_BAD_SER_DEVICE -79 // bad serial device name
-.br
-#define PI_BAD_SER_SPEED -80 // bad serial baud rate
-.br
-#define PI_BAD_PARAM -81 // bad i2c/spi/ser parameter
-.br
-#define PI_I2C_WRITE_FAILED -82 // i2c write failed
-.br
-#define PI_I2C_READ_FAILED -83 // i2c read failed
-.br
-#define PI_BAD_SPI_COUNT -84 // bad SPI count
-.br
-#define PI_SER_WRITE_FAILED -85 // ser write failed
-.br
-#define PI_SER_READ_FAILED -86 // ser read failed
-.br
-#define PI_SER_READ_NO_DATA -87 // ser read no data available
-.br
-#define PI_UNKNOWN_COMMAND -88 // unknown command
-.br
-#define PI_SPI_XFER_FAILED -89 // spi xfer/read/write failed
-.br
-#define PI_BAD_POINTER -90 // bad (NULL) pointer
-.br
-#define PI_NO_AUX_SPI -91 // no auxiliary SPI on Pi A or B
-.br
-#define PI_NOT_PWM_GPIO -92 // GPIO is not in use for PWM
-.br
-#define PI_NOT_SERVO_GPIO -93 // GPIO is not in use for servo pulses
-.br
-#define PI_NOT_HCLK_GPIO -94 // GPIO has no hardware clock
-.br
-#define PI_NOT_HPWM_GPIO -95 // GPIO has no hardware PWM
-.br
-#define PI_BAD_HPWM_FREQ -96 // invalid hardware PWM frequency
-.br
-#define PI_BAD_HPWM_DUTY -97 // hardware PWM dutycycle not 0-1M
-.br
-#define PI_BAD_HCLK_FREQ -98 // invalid hardware clock frequency
-.br
-#define PI_BAD_HCLK_PASS -99 // need password to use hardware clock 1
-.br
-#define PI_HPWM_ILLEGAL -100 // illegal, PWM in use for main clock
-.br
-#define PI_BAD_DATABITS -101 // serial data bits not 1-32
-.br
-#define PI_BAD_STOPBITS -102 // serial (half) stop bits not 2-8
-.br
-#define PI_MSG_TOOBIG -103 // socket/pipe message too big
-.br
-#define PI_BAD_MALLOC_MODE -104 // bad memory allocation mode
-.br
-#define PI_TOO_MANY_SEGS -105 // too many I2C transaction segments
-.br
-#define PI_BAD_I2C_SEG -106 // an I2C transaction segment failed
-.br
-#define PI_BAD_SMBUS_CMD -107 // SMBus command not supported by driver
-.br
-#define PI_NOT_I2C_GPIO -108 // no bit bang I2C in progress on GPIO
-.br
-#define PI_BAD_I2C_WLEN -109 // bad I2C write length
-.br
-#define PI_BAD_I2C_RLEN -110 // bad I2C read length
-.br
-#define PI_BAD_I2C_CMD -111 // bad I2C command
-.br
-#define PI_BAD_I2C_BAUD -112 // bad I2C baud rate, not 50-500k
-.br
-#define PI_CHAIN_LOOP_CNT -113 // bad chain loop count
-.br
-#define PI_BAD_CHAIN_LOOP -114 // empty chain loop
-.br
-#define PI_CHAIN_COUNTER -115 // too many chain counters
-.br
-#define PI_BAD_CHAIN_CMD -116 // bad chain command
-.br
-#define PI_BAD_CHAIN_DELAY -117 // bad chain delay micros
-.br
-#define PI_CHAIN_NESTING -118 // chain counters nested too deeply
-.br
-#define PI_CHAIN_TOO_BIG -119 // chain is too long
-.br
-#define PI_DEPRECATED -120 // deprecated function removed
-.br
-#define PI_BAD_SER_INVERT -121 // bit bang serial invert not 0 or 1
-.br
-#define PI_BAD_EDGE -122 // bad ISR edge value, not 0-2
-.br
-#define PI_BAD_ISR_INIT -123 // bad ISR initialisation
-.br
-#define PI_BAD_FOREVER -124 // loop forever must be last command
-.br
-#define PI_BAD_FILTER -125 // bad filter parameter
-.br
-#define PI_BAD_PAD -126 // bad pad number
-.br
-#define PI_BAD_STRENGTH -127 // bad pad drive strength
-.br
-#define PI_FIL_OPEN_FAILED -128 // file open failed
-.br
-#define PI_BAD_FILE_MODE -129 // bad file mode
-.br
-#define PI_BAD_FILE_FLAG -130 // bad file flag
-.br
-#define PI_BAD_FILE_READ -131 // bad file read
-.br
-#define PI_BAD_FILE_WRITE -132 // bad file write
-.br
-#define PI_FILE_NOT_ROPEN -133 // file not open for read
-.br
-#define PI_FILE_NOT_WOPEN -134 // file not open for write
-.br
-#define PI_BAD_FILE_SEEK -135 // bad file seek
-.br
-#define PI_NO_FILE_MATCH -136 // no files match pattern
-.br
-#define PI_NO_FILE_ACCESS -137 // no permission to access file
-.br
-#define PI_FILE_IS_A_DIR -138 // file is a directory
-.br
-#define PI_BAD_SHELL_STATUS -139 // bad shell return status
-.br
-#define PI_BAD_SCRIPT_NAME -140 // bad script name
-.br
-#define PI_BAD_SPI_BAUD -141 // bad SPI baud rate, not 50-500k
-.br
-#define PI_NOT_SPI_GPIO -142 // no bit bang SPI in progress on GPIO
-.br
-#define PI_BAD_EVENT_ID -143 // bad event id
-.br
-#define PI_CMD_INTERRUPTED -144 // Used by Python
-.br
-#define PI_NOT_ON_BCM2711 -145 // not available on BCM2711
-.br
-#define PI_ONLY_ON_BCM2711 -146 // only available on BCM2711
-.br
-
-.br
-#define PI_PIGIF_ERR_0 -2000
-.br
-#define PI_PIGIF_ERR_99 -2099
-.br
-
-.br
-#define PI_CUSTOM_ERR_0 -3000
-.br
-#define PI_CUSTOM_ERR_999 -3999
-.br
-
-.br
-
-.EE
-.SH Defaults
-
-.EX
-
-.br
-#define PI_DEFAULT_BUFFER_MILLIS 120
-.br
-#define PI_DEFAULT_CLK_MICROS 5
-.br
-#define PI_DEFAULT_CLK_PERIPHERAL PI_CLOCK_PCM
-.br
-#define PI_DEFAULT_IF_FLAGS 0
-.br
-#define PI_DEFAULT_FOREGROUND 0
-.br
-#define PI_DEFAULT_DMA_CHANNEL 14
-.br
-#define PI_DEFAULT_DMA_PRIMARY_CHANNEL 14
-.br
-#define PI_DEFAULT_DMA_SECONDARY_CHANNEL 6
-.br
-#define PI_DEFAULT_DMA_PRIMARY_CH_2711 7
-.br
-#define PI_DEFAULT_DMA_SECONDARY_CH_2711 6
-.br
-#define PI_DEFAULT_DMA_NOT_SET 15
-.br
-#define PI_DEFAULT_SOCKET_PORT 8888
-.br
-#define PI_DEFAULT_SOCKET_PORT_STR "8888"
-.br
-#define PI_DEFAULT_SOCKET_ADDR_STR "localhost"
-.br
-#define PI_DEFAULT_UPDATE_MASK_UNKNOWN 0x0000000FFFFFFCLL
-.br
-#define PI_DEFAULT_UPDATE_MASK_B1 0x03E7CF93
-.br
-#define PI_DEFAULT_UPDATE_MASK_A_B2 0xFBC7CF9C
-.br
-#define PI_DEFAULT_UPDATE_MASK_APLUS_BPLUS 0x0080480FFFFFFCLL
-.br
-#define PI_DEFAULT_UPDATE_MASK_ZERO 0x0080000FFFFFFCLL
-.br
-#define PI_DEFAULT_UPDATE_MASK_PI2B 0x0080480FFFFFFCLL
-.br
-#define PI_DEFAULT_UPDATE_MASK_PI3B 0x0000000FFFFFFCLL
-.br
-#define PI_DEFAULT_UPDATE_MASK_PI4B 0x0000000FFFFFFCLL
-.br
-#define PI_DEFAULT_UPDATE_MASK_COMPUTE 0x00FFFFFFFFFFFFLL
-.br
-#define PI_DEFAULT_MEM_ALLOC_MODE PI_MEM_ALLOC_AUTO
-.br
-
-.br
-#define PI_DEFAULT_CFG_INTERNALS 0
-.br
-
-.br
-
-.EE
-
-.SH SEE ALSO
-
-pigpiod(1), pig2vcd(1), pigs(1), pigpiod_if(3), pigpiod_if2(3)
-.SH AUTHOR
-
-joan@abyz.me.uk
diff --git a/DOC/MAN/pigpiod.1 b/DOC/MAN/pigpiod.1
deleted file mode 100644
index 29f8326..0000000
--- a/DOC/MAN/pigpiod.1
+++ /dev/null
@@ -1,273 +0,0 @@
-
-." Process this file with
-." groff -man -Tascii pigpiod.1
-."
-.TH pigpiod 1 2012-2020 Linux "pigpio archive"
-.SH NAME
-pigpiod - A utility to start the pigpio library as a daemon.
-
-.SH SYNOPSIS
-
-sudo pigpiod [OPTION]...
-.SH DESCRIPTION
-
-
-.ad l
-
-.nh
-pigpiod is a utility which launches the pigpio library as a daemon.
-.br
-
-.br
-Once launched the pigpio library runs in the background accepting commands from the pipe and socket interfaces.
-.br
-
-.br
-The pigpiod utility requires sudo privileges to launch the library but thereafter the pipe and socket commands may be issued by normal users.
-.br
-
-.br
-pigpiod accepts the following configuration options
-.br
-
-.br
-.SH OPTIONS
-
-.IP "\fB-a value\fP"
-DMA memory allocation mode.
-0=AUTO, 1=PMAP, 2=MBOX.
-Default AUTO
-.
-.IP "\fB-b value\fP"
-GPIO sample buffer size in milliseconds.
-100-10000.
-Default 120
-.
-.IP "\fB-c value\fP"
-Library internal settings.
-.
-Default 0
-.
-.IP "\fB-d value\fP"
-Primary DMA channel.
-0-14.
-Default 14
-.
-.IP "\fB-e value\fP"
-Secondary DMA channel.
-0-14.
-Default 6. Preferably use one of DMA channels 0 to 6 for the secondary channel
-.
-.IP "\fB-f\fP"
-Disable fifo interface.
-.
-Default enabled
-.
-.IP "\fB-g\fP"
-Run in foreground (do not fork).
-.
-Default disabled
-.
-.IP "\fB-k\fP"
-Disable local and remote socket interface.
-.
-Default enabled
-.
-.IP "\fB-l\fP"
-Disable remote socket interface.
-.
-Default enabled
-.
-.IP "\fB-m\fP"
-Disable alerts (sampling).
-.
-Default enabled
-.
-.IP "\fB-n IP address\fP"
-Allow IP address to use the socket interface.
-Name (e.g. paul) or dotted quad (e.g. 192.168.1.66).
-If the -n option is not used all addresses are allowed (unless overridden by the -k or -l options). Multiple -n options are allowed. If -k has been used -n has no effect. If -l has been used only -n localhost has any effect
-.
-.IP "\fB-p value\fP"
-Socket port.
-1024-32000.
-Default 8888
-.
-.IP "\fB-s value\fP"
-Sample rate.
-1, 2, 4, 5, 8, or 10 microseconds.
-Default 5
-.
-.IP "\fB-t value\fP"
-Clock peripheral.
-0=PWM 1=PCM.
-Default PCM. pigpio uses one or both of PCM and PWM. If PCM is used then PWM is available for audio. If PWM is used then PCM is available for audio. If waves or hardware PWM are used neither PWM nor PCM will be available for audio.
-.
-.IP "\fB-v -V\fP"
-Display pigpio version and exit.
-.
-
-.
-.IP "\fB-x mask\fP"
-GPIO which may be updated.
-A 54 bit mask with (1<<n) set if the user may update GPIO #n.
-Default is the set of user GPIO for the board revision. Use -x -1 to allow all GPIO
-.
-.br
-
-.br
-.SS Example
-.br
-
-.br
-
-.EX
-sudo pigpiod -s 2 -b 200 -f
-.br
-
-.EE
-
-.br
-
-.br
-Launch the pigpio library with a sample rate of 2 microseconds and a 200 millisecond buffer. Disable the fifo interface.
-
-.br
-
-.br
-.SS Permissions
-.br
-
-.br
-pigpio provides a rudimentary permissions system for commands issued via the socket and pipe interfaces.
-
-.br
-
-.br
-All GPIO may be read.
-
-.br
-
-.br
-Only the user GPIO for the board type or those specified by the -x option may be updated.
-
-.br
-
-.br
-
-.EX
-Type 1 boards 0x03E6CF93 (26 pin header)
-.br
-Type 2 boards 0xFBC6CF9C (26 pin + 8 pin header)
-.br
-Type 3 boards 0x0FFFFFFC (40 pin header)
-.br
-
-.EE
-
-.br
-
-.br
-In this context an update includes the following:
-
-.br
-
-.br
-GPIO mode set
-.br
-GPIO pull/up down
-.br
-GPIO write
-.br
-GPIO set PWM (including range and frequency)
-.br
-GPIO set servo
-
-.br
-
-.br
-In addition the bank clear and set commands, and the wave commands will only
-affect updateable GPIO.
-
-.br
-
-.br
-.SS Exceptions
-.br
-
-.br
-The following exceptions are made for particular models.
-
-.br
-
-.br
-.SS Models A and B
-.br
-
-.br
-The green activity LED (GPIO 16) may be written.
-.br
-.SS Models A+ and B+
-.br
-
-.br
-The green activity LED (GPIO 47) may be written.
-.br
-The red power LED (GPIO 35) may be written.
-.br
-The high USB power mode (GPIO 38) may be written.
-.br
-.SS Pi Zero
-.br
-
-.br
-The green activity LED (GPIO 47) may be written.
-.br
-.SS Pi2B
-.br
-
-.br
-The green activity LED (GPIO 47) may be written.
-.br
-The red power LED (GPIO 35) may be written.
-.br
-The high USB power mode (GPIO 38) may be written.
-.br
-.SS Pi3B
-.br
-
-.br
-The green activity LED and the red power LED are not writable.
-.br
-The USB power mode is fixed at 1.2 amps (high power).
-.br
-
-.br
-
-.br
-.SS DMA Channels
-.br
-
-.br
-The secondary channel is only used for the transmission of waves.
-
-.br
-
-.br
-If possible use one of channels 0 to 6 for the secondary channel (a full channel).
-
-.br
-
-.br
-A full channel only requires one DMA control block regardless of the length of a pulse delay. Channels 7 to 14 (lite channels) require one DMA control block for each 16383 microseconds of delay. I.e. a 10 second pulse delay requires one control block on a full channel and 611 control blocks on a lite channel.
-
-.br
-
-.br
-
-.SH SEE ALSO
-
-pig2vcd(1), pigs(1), pigpio(3), pigpiod_if(3), pigpiod_if2(3)
-.SH AUTHOR
-
-joan@abyz.me.uk
diff --git a/DOC/MAN/pigpiod_if.3 b/DOC/MAN/pigpiod_if.3
deleted file mode 100644
index a0ec196..0000000
--- a/DOC/MAN/pigpiod_if.3
+++ /dev/null
@@ -1,5339 +0,0 @@
-
-." Process this file with
-." groff -man -Tascii pigpiod_if.3
-."
-.TH pigpiod_if 3 2012-2020 Linux "pigpio archive"
-.SH NAME
-pigpiod_if - A C library to interface to the pigpio daemon.
-
-.SH SYNOPSIS
-
-#include <pigpiod_if.h>
-
-
-gcc -Wall -pthread -o prog prog.c -lpigpiod_if -lrt
-
- ./prog
-.SH DESCRIPTION
-
-
-.ad l
-
-.nh
-
-.br
-
-.br
-THIS LIBRARY IS DEPRECATED. NEW CODE SHOULD BE WRITTEN TO
-USE THE MORE VERSATILE pigpiod_if2 LIBRARY.
-
-.br
-
-.br
-pigpiod_if is a C library for the Raspberry which allows control
-of the GPIO via the socket interface to the pigpio daemon.
-.br
-
-.br
-
-.br
-.SS Features
-.br
-
-.br
-o hardware timed PWM on any of GPIO 0-31
-
-.br
-
-.br
-o hardware timed servo pulses on any of GPIO 0-31
-
-.br
-
-.br
-o callbacks when any of GPIO 0-31 change state
-
-.br
-
-.br
-o callbacks at timed intervals
-
-.br
-
-.br
-o reading/writing all of the GPIO in a bank as one operation
-
-.br
-
-.br
-o individually setting GPIO modes, reading and writing
-
-.br
-
-.br
-o notifications when any of GPIO 0-31 change state
-
-.br
-
-.br
-o the construction of output waveforms with microsecond timing
-
-.br
-
-.br
-o rudimentary permission control over GPIO
-
-.br
-
-.br
-o a simple interface to start and stop new threads
-
-.br
-
-.br
-o I2C, SPI, and serial link wrappers
-
-.br
-
-.br
-o creating and running scripts on the pigpio daemon
-
-.br
-
-.br
-.SS GPIO
-.br
-
-.br
-ALL GPIO are identified by their Broadcom number.
-
-.br
-
-.br
-.SS Notes
-.br
-
-.br
-The PWM and servo pulses are timed using the DMA and PWM/PCM peripherals.
-
-.br
-
-.br
-.SS Usage
-.br
-
-.br
-Include <pigpiod_if.h> in your source files.
-
-.br
-
-.br
-Assuming your source is in prog.c use the following command to build
-
-.br
-
-.br
-
-.EX
-gcc -Wall -pthread -o prog prog.c -lpigpiod_if -lrt
-.br
-
-.EE
-
-.br
-
-.br
-to run make sure the pigpio daemon is running
-
-.br
-
-.br
-
-.EX
-sudo pigpiod
-.br
-
-.br
- ./prog # sudo is not required to run programs linked to pigpiod_if
-.br
-
-.EE
-
-.br
-
-.br
-For examples see x_pigpiod_if.c within the pigpio archive file.
-
-.br
-
-.br
-.SS Notes
-.br
-
-.br
-All the functions which return an int return < 0 on error
-
-.br
-
-.br
-
-.SH OVERVIEW
-
-.br
-.SS ESSENTIAL
-.br
-
-.br
-pigpio_start Connects to the pigpio daemon
-.br
-pigpio_stop Disconnects from the pigpio daemon
-.br
-.SS BEGINNER
-.br
-
-.br
-set_mode Set a GPIO mode
-.br
-get_mode Get a GPIO mode
-.br
-
-.br
-set_pull_up_down Set/clear GPIO pull up/down resistor
-.br
-
-.br
-gpio_read Read a GPIO
-.br
-gpio_write Write a GPIO
-.br
-
-.br
-set_PWM_dutycycle Start/stop PWM pulses on a GPIO
-.br
-get_PWM_dutycycle Get the PWM dutycycle in use on a GPIO
-.br
-
-.br
-set_servo_pulsewidth Start/stop servo pulses on a GPIO
-.br
-get_servo_pulsewidth Get the servo pulsewidth in use on a GPIO
-.br
-
-.br
-callback Create GPIO level change callback
-.br
-callback_ex Create GPIO level change callback
-.br
-callback_cancel Cancel a callback
-.br
-wait_for_edge Wait for GPIO level change
-.br
-.SS INTERMEDIATE
-.br
-
-.br
-gpio_trigger Send a trigger pulse to a GPIO.
-.br
-
-.br
-set_watchdog Set a watchdog on a GPIO.
-.br
-
-.br
-set_PWM_range Configure PWM range for a GPIO
-.br
-get_PWM_range Get configured PWM range for a GPIO
-.br
-
-.br
-set_PWM_frequency Configure PWM frequency for a GPIO
-.br
-get_PWM_frequency Get configured PWM frequency for a GPIO
-.br
-
-.br
-read_bank_1 Read all GPIO in bank 1
-.br
-read_bank_2 Read all GPIO in bank 2
-.br
-
-.br
-clear_bank_1 Clear selected GPIO in bank 1
-.br
-clear_bank_2 Clear selected GPIO in bank 2
-.br
-
-.br
-set_bank_1 Set selected GPIO in bank 1
-.br
-set_bank_2 Set selected GPIO in bank 2
-.br
-
-.br
-start_thread Start a new thread
-.br
-stop_thread Stop a previously started thread
-.br
-.SS ADVANCED
-.br
-
-.br
-get_PWM_real_range Get underlying PWM range for a GPIO
-.br
-
-.br
-notify_open Request a notification handle
-.br
-notify_begin Start notifications for selected GPIO
-.br
-notify_pause Pause notifications
-.br
-notify_close Close a notification
-.br
-
-.br
-bb_serial_read_open Opens a GPIO for bit bang serial reads
-.br
-bb_serial_read Reads bit bang serial data from a GPIO
-.br
-bb_serial_read_close Closes a GPIO for bit bang serial reads
-.br
-bb_serial_invert Invert serial logic (1 invert, 0 normal)
-.br
-
-.br
-hardware_clock Start hardware clock on supported GPIO
-.br
-hardware_PWM Start hardware PWM on supported GPIO
-.br
-
-.br
-set_glitch_filter Set a glitch filter on a GPIO
-.br
-set_noise_filter Set a noise filter on a GPIO
-.br
-.SS SCRIPTS
-.br
-
-.br
-store_script Store a script
-.br
-run_script Run a stored script
-.br
-script_status Get script status and parameters
-.br
-stop_script Stop a running script
-.br
-delete_script Delete a stored script
-.br
-.SS WAVES
-.br
-
-.br
-wave_clear Deletes all waveforms
-.br
-
-.br
-wave_add_new Starts a new waveform
-.br
-wave_add_generic Adds a series of pulses to the waveform
-.br
-wave_add_serial Adds serial data to the waveform
-.br
-
-.br
-wave_create Creates a waveform from added data
-.br
-wave_delete Deletes one or more waveforms
-.br
-
-.br
-wave_send_once Transmits a waveform once
-.br
-wave_send_repeat Transmits a waveform repeatedly
-.br
-
-.br
-wave_chain Transmits a chain of waveforms
-.br
-
-.br
-wave_tx_busy Checks to see if the waveform has ended
-.br
-wave_tx_stop Aborts the current waveform
-.br
-
-.br
-wave_get_micros Length in microseconds of the current waveform
-.br
-wave_get_high_micros Length of longest waveform so far
-.br
-wave_get_max_micros Absolute maximum allowed micros
-.br
-
-.br
-wave_get_pulses Length in pulses of the current waveform
-.br
-wave_get_high_pulses Length of longest waveform so far
-.br
-wave_get_max_pulses Absolute maximum allowed pulses
-.br
-
-.br
-wave_get_cbs Length in cbs of the current waveform
-.br
-wave_get_high_cbs Length of longest waveform so far
-.br
-wave_get_max_cbs Absolute maximum allowed cbs
-.br
-.SS I2C
-.br
-
-.br
-i2c_open Opens an I2C device
-.br
-i2c_close Closes an I2C device
-.br
-
-.br
-i2c_write_quick smbus write quick
-.br
-i2c_write_byte smbus write byte
-.br
-i2c_read_byte smbus read byte
-.br
-i2c_write_byte_data smbus write byte data
-.br
-i2c_write_word_data smbus write word data
-.br
-i2c_read_byte_data smbus read byte data
-.br
-i2c_read_word_data smbus read word data
-.br
-i2c_process_call smbus process call
-.br
-i2c_write_block_data smbus write block data
-.br
-i2c_read_block_data smbus read block data
-.br
-i2c_block_process_call smbus block process call
-.br
-
-.br
-i2c_write_i2c_block_data smbus write I2C block data
-.br
-i2c_read_i2c_block_data smbus read I2C block data
-.br
-
-.br
-i2c_read_device Reads the raw I2C device
-.br
-i2c_write_device Writes the raw I2C device
-.br
-
-.br
-i2c_zip Performs multiple I2C transactions
-.br
-
-.br
-bb_i2c_open Opens GPIO for bit banging I2C
-.br
-bb_i2c_close Closes GPIO for bit banging I2C
-.br
-bb_i2c_zip Performs multiple bit banged I2C transactions
-.br
-.SS SPI
-.br
-
-.br
-spi_open Opens a SPI device
-.br
-spi_close Closes a SPI device
-.br
-
-.br
-spi_read Reads bytes from a SPI device
-.br
-spi_write Writes bytes to a SPI device
-.br
-spi_xfer Transfers bytes with a SPI device
-.br
-.SS SERIAL
-.br
-
-.br
-serial_open Opens a serial device
-.br
-serial_close Closes a serial device
-.br
-
-.br
-serial_write_byte Writes a byte to a serial device
-.br
-serial_read_byte Reads a byte from a serial device
-.br
-serial_write Writes bytes to a serial device
-.br
-serial_read Reads bytes from a serial device
-.br
-
-.br
-serial_data_available Returns number of bytes ready to be read
-.br
-.SS CUSTOM
-.br
-
-.br
-custom_1 User custom function 1
-.br
-custom_2 User custom function 2
-.br
-.SS UTILITIES
-.br
-
-.br
-get_current_tick Get current tick (microseconds)
-.br
-
-.br
-get_hardware_revision Get hardware revision
-.br
-get_pigpio_version Get the pigpio version
-.br
-pigpiod_if_version Get the pigpiod_if version
-.br
-
-.br
-pigpio_error Get a text description of an error code.
-.br
-
-.br
-time_sleep Sleeps for a float number of seconds
-.br
-time_time Float number of seconds since the epoch
-.br
-.SH FUNCTIONS
-
-.IP "\fBdouble time_time(void)\fP"
-.IP "" 4
-Return the current time in seconds since the Epoch.
-
-.IP "\fBvoid time_sleep(double seconds)\fP"
-.IP "" 4
-Delay execution for a given number of seconds.
-
-.br
-
-.br
-
-.EX
-seconds: the number of seconds to delay.
-.br
-
-.EE
-
-.IP "\fBchar *pigpio_error(int errnum)\fP"
-.IP "" 4
-Return a text description for an error code.
-
-.br
-
-.br
-
-.EX
-errnum: the error code.
-.br
-
-.EE
-
-.IP "\fBunsigned pigpiod_if_version(void)\fP"
-.IP "" 4
-Return the pigpiod_if version.
-
-.IP "\fBpthread_t *start_thread(gpioThreadFunc_t thread_func, void *userdata)\fP"
-.IP "" 4
-Starts a new thread of execution with thread_func as the main routine.
-
-.br
-
-.br
-
-.EX
-thread_func: the main function for the new thread.
-.br
- userdata: a pointer to an arbitrary argument.
-.br
-
-.EE
-
-.br
-
-.br
-Returns a pointer to pthread_t if OK, otherwise NULL.
-
-.br
-
-.br
-The function is passed the single argument userdata.
-
-.br
-
-.br
-The thread can be cancelled by passing the pointer to pthread_t to
-\fBstop_thread\fP.
-
-.IP "\fBvoid stop_thread(pthread_t *pth)\fP"
-.IP "" 4
-Cancels the thread pointed at by pth.
-
-.br
-
-.br
-
-.EX
-pth: the thread to be stopped.
-.br
-
-.EE
-
-.br
-
-.br
-No value is returned.
-
-.br
-
-.br
-The thread to be stopped should have been started with \fBstart_thread\fP.
-
-.IP "\fBint pigpio_start(char *addrStr, char *portStr)\fP"
-.IP "" 4
-Connect to the pigpio daemon. Reserving command and
-notification streams.
-
-.br
-
-.br
-
-.EX
-addrStr: specifies the host or IP address of the Pi running the
-.br
- pigpio daemon. It may be NULL in which case localhost
-.br
- is used unless overridden by the PIGPIO_ADDR environment
-.br
- variable.
-.br
-
-.br
-portStr: specifies the port address used by the Pi running the
-.br
- pigpio daemon. It may be NULL in which case "8888"
-.br
- is used unless overridden by the PIGPIO_PORT environment
-.br
- variable.
-.br
-
-.EE
-
-.IP "\fBvoid pigpio_stop(void)\fP"
-.IP "" 4
-Terminates the connection to the pigpio daemon and releases
-resources used by the library.
-
-.IP "\fBint set_mode(unsigned gpio, unsigned mode)\fP"
-.IP "" 4
-Set the GPIO mode.
-
-.br
-
-.br
-
-.EX
-gpio: 0-53.
-.br
-mode: PI_INPUT, PI_OUTPUT, PI_ALT0, PI_ALT1,
-.br
- PI_ALT2, PI_ALT3, PI_ALT4, PI_ALT5.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_MODE,
-or PI_NOT_PERMITTED.
-
-.IP "\fBint get_mode(unsigned gpio)\fP"
-.IP "" 4
-Get the GPIO mode.
-
-.br
-
-.br
-
-.EX
-gpio: 0-53.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the GPIO mode if OK, otherwise PI_BAD_GPIO.
-
-.IP "\fBint set_pull_up_down(unsigned gpio, unsigned pud)\fP"
-.IP "" 4
-Set or clear the GPIO pull-up/down resistor.
-
-.br
-
-.br
-
-.EX
-gpio: 0-53.
-.br
- pud: PI_PUD_UP, PI_PUD_DOWN, PI_PUD_OFF.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_PUD,
-or PI_NOT_PERMITTED.
-
-.IP "\fBint gpio_read(unsigned gpio)\fP"
-.IP "" 4
-Read the GPIO level.
-
-.br
-
-.br
-
-.EX
-gpio:0-53.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the GPIO level if OK, otherwise PI_BAD_GPIO.
-
-.IP "\fBint gpio_write(unsigned gpio, unsigned level)\fP"
-.IP "" 4
-Write the GPIO level.
-
-.br
-
-.br
-
-.EX
- gpio: 0-53.
-.br
-level: 0, 1.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_LEVEL,
-or PI_NOT_PERMITTED.
-
-.br
-
-.br
-Notes
-
-.br
-
-.br
-If PWM or servo pulses are active on the GPIO they are switched off.
-
-.IP "\fBint set_PWM_dutycycle(unsigned user_gpio, unsigned dutycycle)\fP"
-.IP "" 4
-Start (non-zero dutycycle) or stop (0) PWM pulses on the GPIO.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31.
-.br
-dutycycle: 0-range (range defaults to 255).
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_DUTYCYCLE,
-or PI_NOT_PERMITTED.
-Notes
-
-.br
-
-.br
-The \fBset_PWM_range\fP function may be used to change the
-default range of 255.
-
-.IP "\fBint get_PWM_dutycycle(unsigned user_gpio)\fP"
-.IP "" 4
-Return the PWM dutycycle in use on a GPIO.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_NOT_PWM_GPIO.
-
-.br
-
-.br
-For normal PWM the dutycycle will be out of the defined range
-for the GPIO (see \fBget_PWM_range\fP).
-
-.br
-
-.br
-If a hardware clock is active on the GPIO the reported dutycycle
-will be 500000 (500k) out of 1000000 (1M).
-
-.br
-
-.br
-If hardware PWM is active on the GPIO the reported dutycycle
-will be out of a 1000000 (1M).
-
-.IP "\fBint set_PWM_range(unsigned user_gpio, unsigned range)\fP"
-.IP "" 4
-Set the range of PWM values to be used on the GPIO.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31.
-.br
- range: 25-40000.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_DUTYRANGE,
-or PI_NOT_PERMITTED.
-
-.br
-
-.br
-Notes
-
-.br
-
-.br
-If PWM is currently active on the GPIO its dutycycle will be
-scaled to reflect the new range.
-
-.br
-
-.br
-The real range, the number of steps between fully off and fully on
-for each of the 18 available GPIO frequencies is
-
-.br
-
-.br
-
-.EX
- 25(#1), 50(#2), 100(#3), 125(#4), 200(#5), 250(#6),
-.br
- 400(#7), 500(#8), 625(#9), 800(#10), 1000(#11), 1250(#12),
-.br
-2000(#13), 2500(#14), 4000(#15), 5000(#16), 10000(#17), 20000(#18)
-.br
-
-.EE
-
-.br
-
-.br
-The real value set by set_PWM_range is (dutycycle * real range) / range.
-
-.IP "\fBint get_PWM_range(unsigned user_gpio)\fP"
-.IP "" 4
-Get the range of PWM values being used on the GPIO.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the dutycycle range used for the GPIO if OK,
-otherwise PI_BAD_USER_GPIO.
-
-.br
-
-.br
-If a hardware clock or hardware PWM is active on the GPIO the
-reported range will be 1000000 (1M).
-
-.IP "\fBint get_PWM_real_range(unsigned user_gpio)\fP"
-.IP "" 4
-Get the real underlying range of PWM values being used on the GPIO.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the real range used for the GPIO if OK,
-otherwise PI_BAD_USER_GPIO.
-
-.br
-
-.br
-If a hardware clock is active on the GPIO the reported
-real range will be 1000000 (1M).
-
-.br
-
-.br
-If hardware PWM is active on the GPIO the reported real range
-will be approximately 250M divided by the set PWM frequency.
-
-.br
-
-.br
-
-.IP "\fBint set_PWM_frequency(unsigned user_gpio, unsigned frequency)\fP"
-.IP "" 4
-Set the frequency (in Hz) of the PWM to be used on the GPIO.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31.
-.br
-frequency: >=0 (Hz).
-.br
-
-.EE
-
-.br
-
-.br
-Returns the numerically closest frequency if OK, otherwise
-PI_BAD_USER_GPIO or PI_NOT_PERMITTED.
-
-.br
-
-.br
-If PWM is currently active on the GPIO it will be switched
-off and then back on at the new frequency.
-
-.br
-
-.br
-Each GPIO can be independently set to one of 18 different
-PWM frequencies.
-
-.br
-
-.br
-The selectable frequencies depend upon the sample rate which
-may be 1, 2, 4, 5, 8, or 10 microseconds (default 5). The
-sample rate is set when the pigpio daemon is started.
-
-.br
-
-.br
-The frequencies for each sample rate are:
-
-.br
-
-.br
-
-.EX
- Hertz
-.br
-
-.br
- 1: 40000 20000 10000 8000 5000 4000 2500 2000 1600
-.br
- 1250 1000 800 500 400 250 200 100 50
-.br
-
-.br
- 2: 20000 10000 5000 4000 2500 2000 1250 1000 800
-.br
- 625 500 400 250 200 125 100 50 25
-.br
-
-.br
- 4: 10000 5000 2500 2000 1250 1000 625 500 400
-.br
- 313 250 200 125 100 63 50 25 13
-.br
-sample
-.br
- rate
-.br
- (us) 5: 8000 4000 2000 1600 1000 800 500 400 320
-.br
- 250 200 160 100 80 50 40 20 10
-.br
-
-.br
- 8: 5000 2500 1250 1000 625 500 313 250 200
-.br
- 156 125 100 63 50 31 25 13 6
-.br
-
-.br
- 10: 4000 2000 1000 800 500 400 250 200 160
-.br
- 125 100 80 50 40 25 20 10 5
-.br
-
-.EE
-
-.IP "\fBint get_PWM_frequency(unsigned user_gpio)\fP"
-.IP "" 4
-Get the frequency of PWM being used on the GPIO.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31.
-.br
-
-.EE
-
-.br
-
-.br
-For normal PWM the frequency will be that defined for the GPIO by
-\fBset_PWM_frequency\fP.
-
-.br
-
-.br
-If a hardware clock is active on the GPIO the reported frequency
-will be that set by \fBhardware_clock\fP.
-
-.br
-
-.br
-If hardware PWM is active on the GPIO the reported frequency
-will be that set by \fBhardware_PWM\fP.
-
-.br
-
-.br
-Returns the frequency (in hertz) used for the GPIO if OK,
-otherwise PI_BAD_USER_GPIO.
-
-.IP "\fBint set_servo_pulsewidth(unsigned user_gpio, unsigned pulsewidth)\fP"
-.IP "" 4
-Start (500-2500) or stop (0) servo pulses on the GPIO.
-
-.br
-
-.br
-
-.EX
- user_gpio: 0-31.
-.br
-pulsewidth: 0 (off), 500 (anti-clockwise) - 2500 (clockwise).
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_PULSEWIDTH or
-PI_NOT_PERMITTED.
-
-.br
-
-.br
-The selected pulsewidth will continue to be transmitted until
-changed by a subsequent call to set_servo_pulsewidth.
-
-.br
-
-.br
-The pulsewidths supported by servos varies and should probably be
-determined by experiment. A value of 1500 should always be safe and
-represents the mid-point of rotation.
-
-.br
-
-.br
-You can DAMAGE a servo if you command it to move beyond its limits.
-
-.br
-
-.br
-OTHER UPDATE RATES:
-
-.br
-
-.br
-This function updates servos at 50Hz. If you wish to use a different
-update frequency you will have to use the PWM functions.
-
-.br
-
-.br
-
-.EX
-Update Rate (Hz) 50 100 200 400 500
-.br
-1E6/Hz 20000 10000 5000 2500 2000
-.br
-
-.EE
-
-.br
-
-.br
-Firstly set the desired PWM frequency using \fBset_PWM_frequency\fP.
-
-.br
-
-.br
-Then set the PWM range using \fBset_PWM_range\fP to 1E6/Hz.
-Doing this allows you to use units of microseconds when setting
-the servo pulsewidth.
-
-.br
-
-.br
-E.g. If you want to update a servo connected to GPIO 25 at 400Hz
-
-.br
-
-.br
-
-.EX
-set_PWM_frequency(25, 400);
-.br
-set_PWM_range(25, 2500);
-.br
-
-.EE
-
-.br
-
-.br
-Thereafter use the \fBset_PWM_dutycycle\fP function to move the servo,
-e.g. set_PWM_dutycycle(25, 1500) will set a 1500 us pulse.
-.br
-
-.IP "\fBint get_servo_pulsewidth(unsigned user_gpio)\fP"
-.IP "" 4
-Return the servo pulsewidth in use on a GPIO.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_NOT_SERVO_GPIO.
-
-.IP "\fBint notify_open(void)\fP"
-.IP "" 4
-Get a free notification handle.
-
-.br
-
-.br
-Returns a handle greater than or equal to zero if OK,
-otherwise PI_NO_HANDLE.
-
-.br
-
-.br
-A notification is a method for being notified of GPIO state
-changes via a pipe.
-
-.br
-
-.br
-Pipes are only accessible from the local machine so this function
-serves no purpose if you are using the library from a remote machine.
-The in-built (socket) notifications provided by \fBcallback\fP
-should be used instead.
-
-.br
-
-.br
-Notifications for handle x will be available at the pipe
-named /dev/pigpiox (where x is the handle number).
-E.g. if the function returns 15 then the notifications must be
-read from /dev/pigpio15.
-
-.IP "\fBint notify_begin(unsigned handle, uint32_t bits)\fP"
-.IP "" 4
-Start notifications on a previously opened handle.
-
-.br
-
-.br
-
-.EX
-handle: 0-31 (as returned by \fBnotify_open\fP)
-.br
- bits: a mask indicating the GPIO to be notified.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE.
-
-.br
-
-.br
-The notification sends state changes for each GPIO whose
-corresponding bit in bits is set.
-
-.br
-
-.br
-Each notification occupies 12 bytes in the fifo as follows:
-
-.br
-
-.br
-
-.EX
-typedef struct
-.br
-{
-.br
- uint16_t seqno;
-.br
- uint16_t flags;
-.br
- uint32_t tick;
-.br
- uint32_t level;
-.br
-} gpioReport_t;
-.br
-
-.EE
-
-.br
-
-.br
-seqno: starts at 0 each time the handle is opened and then increments
-by one for each report.
-
-.br
-
-.br
-flags: two flags are defined, PI_NTFY_FLAGS_WDOG and PI_NTFY_FLAGS_ALIVE.
-
-.br
-
-.br
-PI_NTFY_FLAGS_WDOG, if bit 5 is set then bits 0-4 of the flags
-indicate a GPIO which has had a watchdog timeout.
-
-.br
-
-.br
-PI_NTFY_FLAGS_ALIVE, if bit 6 is set this indicates a keep alive
-signal on the pipe/socket and is sent once a minute in the absence
-of other notification activity.
-
-.br
-
-.br
-tick: the number of microseconds since system boot. It wraps around
-after 1h12m.
-
-.br
-
-.br
-level: indicates the level of each GPIO. If bit 1<<x is set then
-GPIO x is high.
-
-.IP "\fBint notify_pause(unsigned handle)\fP"
-.IP "" 4
-Pause notifications on a previously opened handle.
-
-.br
-
-.br
-
-.EX
-handle: 0-31 (as returned by \fBnotify_open\fP)
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE.
-
-.br
-
-.br
-Notifications for the handle are suspended until
-\fBnotify_begin\fP is called again.
-
-.IP "\fBint notify_close(unsigned handle)\fP"
-.IP "" 4
-Stop notifications on a previously opened handle and
-release the handle for reuse.
-
-.br
-
-.br
-
-.EX
-handle: 0-31 (as returned by \fBnotify_open\fP)
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE.
-
-.IP "\fBint set_watchdog(unsigned user_gpio, unsigned timeout)\fP"
-.IP "" 4
-Sets a watchdog for a GPIO.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31.
-.br
- timeout: 0-60000.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO
-or PI_BAD_WDOG_TIMEOUT.
-
-.br
-
-.br
-The watchdog is nominally in milliseconds.
-
-.br
-
-.br
-Only one watchdog may be registered per GPIO.
-
-.br
-
-.br
-The watchdog may be cancelled by setting timeout to 0.
-
-.br
-
-.br
-Once a watchdog has been started callbacks for the GPIO will be
-triggered every timeout interval after the last GPIO activity.
-
-.br
-
-.br
-The callback will receive the special level PI_TIMEOUT.
-
-.IP "\fBint set_glitch_filter(unsigned user_gpio, unsigned steady)\fP"
-.IP "" 4
-Sets a glitch filter on a GPIO.
-
-.br
-
-.br
-Level changes on the GPIO are not reported unless the level
-has been stable for at least \fBsteady\fP microseconds. The
-level is then reported. Level changes of less than \fBsteady\fP
-microseconds are ignored.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31
-.br
- steady: 0-300000
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
-
-.br
-
-.br
-This filter affects the GPIO samples returned to callbacks set up
-with \fBcallback\fP, \fBcallback_ex\fP and \fBwait_for_edge\fP.
-
-.br
-
-.br
-It does not affect levels read by \fBgpio_read\fP,
-\fBread_bank_1\fP, or \fBread_bank_2\fP.
-Each (stable) edge will be timestamped \fBsteady\fP microseconds
-after it was first detected.
-
-.IP "\fBint set_noise_filter(unsigned user_gpio, unsigned steady, unsigned active)\fP"
-.IP "" 4
-Sets a noise filter on a GPIO.
-
-.br
-
-.br
-Level changes on the GPIO are ignored until a level which has
-been stable for \fBsteady\fP microseconds is detected. Level changes
-on the GPIO are then reported for \fBactive\fP microseconds after
-which the process repeats.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31
-.br
- steady: 0-300000
-.br
- active: 0-1000000
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
-
-.br
-
-.br
-This filter affects the GPIO samples returned to callbacks set up
-with \fBcallback\fP, \fBcallback_ex\fP and \fBwait_for_edge\fP.
-
-.br
-
-.br
-It does not affect levels read by \fBgpio_read\fP,
-\fBread_bank_1\fP, or \fBread_bank_2\fP.
-
-.br
-
-.br
-Level changes before and after the active period may
-be reported. Your software must be designed to cope with
-such reports.
-
-.IP "\fBuint32_t read_bank_1(void)\fP"
-.IP "" 4
-Read the levels of the bank 1 GPIO (GPIO 0-31).
-
-.br
-
-.br
-The returned 32 bit integer has a bit set if the corresponding
-GPIO is logic 1. GPIO n has bit value (1<<n).
-
-.IP "\fBuint32_t read_bank_2(void)\fP"
-.IP "" 4
-Read the levels of the bank 2 GPIO (GPIO 32-53).
-
-.br
-
-.br
-The returned 32 bit integer has a bit set if the corresponding
-GPIO is logic 1. GPIO n has bit value (1<<(n-32)).
-
-.IP "\fBint clear_bank_1(uint32_t bits)\fP"
-.IP "" 4
-Clears GPIO 0-31 if the corresponding bit in bits is set.
-
-.br
-
-.br
-
-.EX
-bits: a bit mask with 1 set if the corresponding GPIO is
-.br
- to be cleared.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-
-.br
-
-.br
-A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-
-.IP "\fBint clear_bank_2(uint32_t bits)\fP"
-.IP "" 4
-Clears GPIO 32-53 if the corresponding bit (0-21) in bits is set.
-
-.br
-
-.br
-
-.EX
-bits: a bit mask with 1 set if the corresponding GPIO is
-.br
- to be cleared.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-
-.br
-
-.br
-A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-
-.IP "\fBint set_bank_1(uint32_t bits)\fP"
-.IP "" 4
-Sets GPIO 0-31 if the corresponding bit in bits is set.
-
-.br
-
-.br
-
-.EX
-bits: a bit mask with 1 set if the corresponding GPIO is
-.br
- to be set.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-
-.br
-
-.br
-A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-
-.IP "\fBint set_bank_2(uint32_t bits)\fP"
-.IP "" 4
-Sets GPIO 32-53 if the corresponding bit (0-21) in bits is set.
-
-.br
-
-.br
-
-.EX
-bits: a bit mask with 1 set if the corresponding GPIO is
-.br
- to be set.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-
-.br
-
-.br
-A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-
-.IP "\fBint hardware_clock(unsigned gpio, unsigned clkfreq)\fP"
-.IP "" 4
-Starts a hardware clock on a GPIO at the specified frequency.
-Frequencies above 30MHz are unlikely to work.
-
-.br
-
-.br
-
-.EX
- gpio: see description
-.br
-frequency: 0 (off) or 4689-250000000 (250M)
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_NOT_PERMITTED, PI_BAD_GPIO,
-PI_NOT_HCLK_GPIO, PI_BAD_HCLK_FREQ,or PI_BAD_HCLK_PASS.
-
-.br
-
-.br
-The same clock is available on multiple GPIO. The latest
-frequency setting will be used by all GPIO which share a clock.
-
-.br
-
-.br
-The GPIO must be one of the following.
-
-.br
-
-.br
-
-.EX
-4 clock 0 All models
-.br
-5 clock 1 All models but A and B (reserved for system use)
-.br
-6 clock 2 All models but A and B
-.br
-20 clock 0 All models but A and B
-.br
-21 clock 1 All models but A and Rev.2 B (reserved for system use)
-.br
-
-.br
-32 clock 0 Compute module only
-.br
-34 clock 0 Compute module only
-.br
-42 clock 1 Compute module only (reserved for system use)
-.br
-43 clock 2 Compute module only
-.br
-44 clock 1 Compute module only (reserved for system use)
-.br
-
-.EE
-
-.br
-
-.br
-Access to clock 1 is protected by a password as its use will likely
-crash the Pi. The password is given by or'ing 0x5A000000 with the
-GPIO number.
-
-.IP "\fBint hardware_PWM(unsigned gpio, unsigned PWMfreq, uint32_t PWMduty)\fP"
-.IP "" 4
-Starts hardware PWM on a GPIO at the specified frequency and dutycycle.
-Frequencies above 30MHz are unlikely to work.
-
-.br
-
-.br
-NOTE: Any waveform started by \fBwave_send_once\fP, \fBwave_send_repeat\fP,
-or \fBwave_chain\fP will be cancelled.
-
-.br
-
-.br
-This function is only valid if the pigpio main clock is PCM. The
-main clock defaults to PCM but may be overridden when the pigpio
-daemon is started (option -t).
-
-.br
-
-.br
-
-.EX
- gpio: see descripton
-.br
-PWMfreq: 0 (off) or 1-125000000 (125M)
-.br
-PWMduty: 0 (off) to 1000000 (1M)(fully on)
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_NOT_PERMITTED, PI_BAD_GPIO,
-PI_NOT_HPWM_GPIO, PI_BAD_HPWM_DUTY, PI_BAD_HPWM_FREQ,
-or PI_HPWM_ILLEGAL.
-
-.br
-
-.br
-The same PWM channel is available on multiple GPIO. The latest
-frequency and dutycycle setting will be used by all GPIO which
-share a PWM channel.
-
-.br
-
-.br
-The GPIO must be one of the following.
-
-.br
-
-.br
-
-.EX
-12 PWM channel 0 All models but A and B
-.br
-13 PWM channel 1 All models but A and B
-.br
-18 PWM channel 0 All models
-.br
-19 PWM channel 1 All models but A and B
-.br
-
-.br
-40 PWM channel 0 Compute module only
-.br
-41 PWM channel 1 Compute module only
-.br
-45 PWM channel 1 Compute module only
-.br
-52 PWM channel 0 Compute module only
-.br
-53 PWM channel 1 Compute module only
-.br
-
-.EE
-
-.IP "\fBuint32_t get_current_tick(void)\fP"
-.IP "" 4
-Gets the current system tick.
-
-.br
-
-.br
-Tick is the number of microseconds since system boot.
-
-.br
-
-.br
-As tick is an unsigned 32 bit quantity it wraps around after
-2**32 microseconds, which is approximately 1 hour 12 minutes.
-
-.br
-
-.br
-
-.IP "\fBuint32_t get_hardware_revision(void)\fP"
-.IP "" 4
-Get the Pi's hardware revision number.
-
-.br
-
-.br
-The hardware revision is the last few characters on the Revision line
-of /proc/cpuinfo.
-
-.br
-
-.br
-If the hardware revision can not be found or is not a valid
-hexadecimal number the function returns 0.
-
-.br
-
-.br
-The revision number can be used to determine the assignment of GPIO
-to pins (see \fBgpio\fP).
-
-.br
-
-.br
-There are at least three types of board.
-
-.br
-
-.br
-Type 1 boards have hardware revision numbers of 2 and 3.
-
-.br
-
-.br
-Type 2 boards have hardware revision numbers of 4, 5, 6, and 15.
-
-.br
-
-.br
-Type 3 boards have hardware revision numbers of 16 or greater.
-
-.IP "\fBuint32_t get_pigpio_version(void)\fP"
-.IP "" 4
-Returns the pigpio version.
-
-.IP "\fBint wave_clear(void)\fP"
-.IP "" 4
-This function clears all waveforms and any data added by calls to the
-\fBwave_add_*\fP functions.
-
-.br
-
-.br
-Returns 0 if OK.
-
-.IP "\fBint wave_add_new(void)\fP"
-.IP "" 4
-This function starts a new empty waveform. You wouldn't normally need
-to call this function as it is automatically called after a waveform is
-created with the \fBwave_create\fP function.
-
-.br
-
-.br
-Returns 0 if OK.
-
-.IP "\fBint wave_add_generic(unsigned numPulses, gpioPulse_t *pulses)\fP"
-.IP "" 4
-This function adds a number of pulses to the current waveform.
-
-.br
-
-.br
-
-.EX
-numPulses: the number of pulses.
-.br
- pulses: an array of pulses.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_TOO_MANY_PULSES.
-
-.br
-
-.br
-The pulses are interleaved in time order within the existing waveform
-(if any).
-
-.br
-
-.br
-Merging allows the waveform to be built in parts, that is the settings
-for GPIO#1 can be added, and then GPIO#2 etc.
-
-.br
-
-.br
-If the added waveform is intended to start after or within the existing
-waveform then the first pulse should consist solely of a delay.
-
-.IP "\fBint wave_add_serial(unsigned user_gpio, unsigned baud, unsigned data_bits, unsigned stop_bits, unsigned offset, unsigned numBytes, char *str)\fP"
-.IP "" 4
-This function adds a waveform representing serial data to the
-existing waveform (if any). The serial data starts offset
-microseconds from the start of the waveform.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31.
-.br
- baud: 50-1000000
-.br
-data_bits: number of data bits (1-32)
-.br
-stop_bits: number of stop half bits (2-8)
-.br
- offset: >=0
-.br
- numBytes: >=1
-.br
- str: an array of chars.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_BAD_USER_GPIO, PI_BAD_WAVE_BAUD, PI_BAD_DATABITS,
-PI_BAD_STOP_BITS, PI_TOO_MANY_CHARS, PI_BAD_SER_OFFSET,
-or PI_TOO_MANY_PULSES.
-
-.br
-
-.br
-NOTES:
-
-.br
-
-.br
-The serial data is formatted as one start bit, \fBdata_bits\fP data bits,
-and \fBstop_bits\fP/2 stop bits.
-
-.br
-
-.br
-It is legal to add serial data streams with different baud rates to
-the same waveform.
-
-.br
-
-.br
-\fBnumBytes\fP is the number of bytes of data in str.
-
-.br
-
-.br
-The bytes required for each character depend upon \fBdata_bits\fP.
-
-.br
-
-.br
-For \fBdata_bits\fP 1-8 there will be one byte per character.
-.br
-For \fBdata_bits\fP 9-16 there will be two bytes per character.
-.br
-For \fBdata_bits\fP 17-32 there will be four bytes per character.
-
-.IP "\fBint wave_create(void)\fP"
-.IP "" 4
-This function creates a waveform from the data provided by the prior
-calls to the \fBwave_add_*\fP functions. Upon success a wave id
-greater than or equal to 0 is returned, otherwise PI_EMPTY_WAVEFORM,
-PI_TOO_MANY_CBS, PI_TOO_MANY_OOL, or PI_NO_WAVEFORM_ID.
-
-.br
-
-.br
-The data provided by the \fBwave_add_*\fP functions is consumed by this
-function.
-
-.br
-
-.br
-As many waveforms may be created as there is space available. The
-wave id is passed to \fBwave_send_*\fP to specify the waveform to transmit.
-
-.br
-
-.br
-Normal usage would be
-
-.br
-
-.br
-Step 1. \fBwave_clear\fP to clear all waveforms and added data.
-
-.br
-
-.br
-Step 2. \fBwave_add_*\fP calls to supply the waveform data.
-
-.br
-
-.br
-Step 3. \fBwave_create\fP to create the waveform and get a unique id
-
-.br
-
-.br
-Repeat steps 2 and 3 as needed.
-
-.br
-
-.br
-Step 4. \fBwave_send_*\fP with the id of the waveform to transmit.
-
-.br
-
-.br
-A waveform comprises one or more pulses. Each pulse consists of a
-\fBgpioPulse_t\fP structure.
-
-.br
-
-.br
-
-.EX
-typedef struct
-.br
-{
-.br
- uint32_t gpioOn;
-.br
- uint32_t gpioOff;
-.br
- uint32_t usDelay;
-.br
-} gpioPulse_t;
-.br
-
-.EE
-
-.br
-
-.br
-The fields specify
-
-.br
-
-.br
-1) the GPIO to be switched on at the start of the pulse.
-.br
-2) the GPIO to be switched off at the start of the pulse.
-.br
-3) the delay in microseconds before the next pulse.
-.br
-
-.br
-
-.br
-Any or all the fields can be zero. It doesn't make any sense to
-set all the fields to zero (the pulse will be ignored).
-
-.br
-
-.br
-When a waveform is started each pulse is executed in order with the
-specified delay between the pulse and the next.
-
-.br
-
-.br
-Returns the new waveform id if OK, otherwise PI_EMPTY_WAVEFORM,
-PI_NO_WAVEFORM_ID, PI_TOO_MANY_CBS, or PI_TOO_MANY_OOL.
-
-.IP "\fBint wave_delete(unsigned wave_id)\fP"
-.IP "" 4
-This function deletes the waveform with id wave_id.
-
-.br
-
-.br
-
-.EX
-wave_id: >=0, as returned by \fBwave_create\fP.
-.br
-
-.EE
-
-.br
-
-.br
-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.
-
-.IP "\fBint wave_send_once(unsigned wave_id)\fP"
-.IP "" 4
-This function transmits the waveform with id wave_id. The waveform
-is sent once.
-
-.br
-
-.br
-NOTE: Any hardware PWM started by \fBhardware_PWM\fP will be cancelled.
-
-.br
-
-.br
-
-.EX
-wave_id: >=0, as returned by \fBwave_create\fP.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of DMA control blocks in the waveform if OK,
-otherwise PI_BAD_WAVE_ID, or PI_BAD_WAVE_MODE.
-
-.IP "\fBint wave_send_repeat(unsigned wave_id)\fP"
-.IP "" 4
-This function transmits the waveform with id wave_id. The waveform
-cycles until cancelled (either by the sending of a new waveform or
-by \fBwave_tx_stop\fP).
-
-.br
-
-.br
-NOTE: Any hardware PWM started by \fBhardware_PWM\fP will be cancelled.
-
-.br
-
-.br
-
-.EX
-wave_id: >=0, as returned by \fBwave_create\fP.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of DMA control blocks in the waveform if OK,
-otherwise PI_BAD_WAVE_ID, or PI_BAD_WAVE_MODE.
-
-.IP "\fBint wave_chain(char *buf, unsigned bufSize)\fP"
-.IP "" 4
-This function transmits a chain of waveforms.
-
-.br
-
-.br
-NOTE: Any hardware PWM started by \fBhardware_PWM\fP will be cancelled.
-
-.br
-
-.br
-The waves to be transmitted are specified by the contents of buf
-which contains an ordered list of \fBwave_id\fPs and optional command
-codes and related data.
-
-.br
-
-.br
-
-.EX
- buf: pointer to the wave_ids and optional command codes
-.br
-bufSize: the number of bytes in buf
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_CHAIN_NESTING, PI_CHAIN_LOOP_CNT, PI_BAD_CHAIN_LOOP, PI_BAD_CHAIN_CMD, PI_CHAIN_COUNTER,
-PI_BAD_CHAIN_DELAY, PI_CHAIN_TOO_BIG, or PI_BAD_WAVE_ID.
-
-.br
-
-.br
-Each wave is transmitted in the order specified. A wave may
-occur multiple times per chain.
-
-.br
-
-.br
-A blocks of waves may be transmitted multiple times by using
-the loop commands. The block is bracketed by loop start and
-end commands. Loops may be nested.
-
-.br
-
-.br
-Delays between waves may be added with the delay command.
-
-.br
-
-.br
-The following command codes are supported:
-
-.br
-
-.br
-Name Cmd & Data Meaning
-.br
-Loop Start 255 0 Identify start of a wave block
-.br
-Loop Repeat 255 1 x y loop x + y*256 times
-.br
-Delay 255 2 x y delay x + y*256 microseconds
-.br
-Loop Forever 255 3 loop forever
-.br
-
-.br
-
-.br
-If present Loop Forever must be the last entry in the chain.
-
-.br
-
-.br
-The code is currently dimensioned to support a chain with roughly
-600 entries and 20 loop counters.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-#include <stdio.h>
-.br
-#include <pigpiod_if.h>
-.br
-
-.br
-#define WAVES 5
-.br
-#define GPIO 4
-.br
-
-.br
-int main(int argc, char *argv[])
-.br
-{
-.br
- int i, wid[WAVES];
-.br
-
-.br
- if (pigpio_start(0, 0)<0) return -1;
-.br
-
-.br
- set_mode(GPIO, PI_OUTPUT);
-.br
-
-.br
- for (i=0; i<WAVES; i++)
-.br
- {
-.br
- wave_add_generic(2, (gpioPulse_t[])
-.br
- {{1<<GPIO, 0, 20},
-.br
- {0, 1<<GPIO, (i+1)*200}});
-.br
-
-.br
- wid[i] = wave_create();
-.br
- }
-.br
-
-.br
- wave_chain((char []) {
-.br
- wid[4], wid[3], wid[2], // transmit waves 4+3+2
-.br
- 255, 0, // loop start
-.br
- wid[0], wid[0], wid[0], // transmit waves 0+0+0
-.br
- 255, 0, // loop start
-.br
- wid[0], wid[1], // transmit waves 0+1
-.br
- 255, 2, 0x88, 0x13, // delay 5000us
-.br
- 255, 1, 30, 0, // loop end (repeat 30 times)
-.br
- 255, 0, // loop start
-.br
- wid[2], wid[3], wid[0], // transmit waves 2+3+0
-.br
- wid[3], wid[1], wid[2], // transmit waves 3+1+2
-.br
- 255, 1, 10, 0, // loop end (repeat 10 times)
-.br
- 255, 1, 5, 0, // loop end (repeat 5 times)
-.br
- wid[4], wid[4], wid[4], // transmit waves 4+4+4
-.br
- 255, 2, 0x20, 0x4E, // delay 20000us
-.br
- wid[0], wid[0], wid[0], // transmit waves 0+0+0
-.br
-
-.br
- }, 46);
-.br
-
-.br
- while (wave_tx_busy()) time_sleep(0.1);
-.br
-
-.br
- for (i=0; i<WAVES; i++) wave_delete(wid[i]);
-.br
-
-.br
- pigpio_stop();
-.br
-}
-.br
-
-.EE
-
-.IP "\fBint wave_tx_busy(void)\fP"
-.IP "" 4
-This function checks to see if a waveform is currently being
-transmitted.
-
-.br
-
-.br
-Returns 1 if a waveform is currently being transmitted, otherwise 0.
-
-.IP "\fBint wave_tx_stop(void)\fP"
-.IP "" 4
-This function stops the transmission of the current waveform.
-
-.br
-
-.br
-Returns 0 if OK.
-
-.br
-
-.br
-This function is intended to stop a waveform started with the repeat mode.
-
-.IP "\fBint wave_get_micros(void)\fP"
-.IP "" 4
-This function returns the length in microseconds of the current
-waveform.
-
-.IP "\fBint wave_get_high_micros(void)\fP"
-.IP "" 4
-This function returns the length in microseconds of the longest waveform
-created since the pigpio daemon was started.
-
-.IP "\fBint wave_get_max_micros(void)\fP"
-.IP "" 4
-This function returns the maximum possible size of a waveform in
-.br
-microseconds.
-
-.IP "\fBint wave_get_pulses(void)\fP"
-.IP "" 4
-This function returns the length in pulses of the current waveform.
-
-.IP "\fBint wave_get_high_pulses(void)\fP"
-.IP "" 4
-This function returns the length in pulses of the longest waveform
-created since the pigpio daemon was started.
-
-.IP "\fBint wave_get_max_pulses(void)\fP"
-.IP "" 4
-This function returns the maximum possible size of a waveform in pulses.
-
-.IP "\fBint wave_get_cbs(void)\fP"
-.IP "" 4
-This function returns the length in DMA control blocks of the current
-waveform.
-
-.IP "\fBint wave_get_high_cbs(void)\fP"
-.IP "" 4
-This function returns the length in DMA control blocks of the longest
-waveform created since the pigpio daemon was started.
-
-.IP "\fBint wave_get_max_cbs(void)\fP"
-.IP "" 4
-This function returns the maximum possible size of a waveform in DMA
-control blocks.
-
-.IP "\fBint gpio_trigger(unsigned user_gpio, unsigned pulseLen, unsigned level)\fP"
-.IP "" 4
-This function sends a trigger pulse to a GPIO. The GPIO is set to
-level for pulseLen microseconds and then reset to not level.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31.
-.br
- pulseLen: 1-100.
-.br
- level: 0,1.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_LEVEL,
-PI_BAD_PULSELEN, or PI_NOT_PERMITTED.
-
-.IP "\fBint store_script(char *script)\fP"
-.IP "" 4
-This function stores a script for later execution.
-
-.br
-
-.br
-See \fBhttp://abyz.me.uk/rpi/pigpio/pigs.html#Scripts\fP for details.
-
-.br
-
-.br
-
-.EX
-script: the text of the script.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns a script id if the script is valid,
-otherwise PI_BAD_SCRIPT.
-
-.IP "\fBint run_script(unsigned script_id, unsigned numPar, uint32_t *param)\fP"
-.IP "" 4
-This function runs a stored script.
-
-.br
-
-.br
-
-.EX
-script_id: >=0, as returned by \fBstore_script\fP.
-.br
- numPar: 0-10, the number of parameters.
-.br
- param: an array of parameters.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID, or
-PI_TOO_MANY_PARAM
-
-.br
-
-.br
-param is an array of up to 10 parameters which may be referenced in
-the script as p0 to p9.
-
-.IP "\fBint script_status(unsigned script_id, uint32_t *param)\fP"
-.IP "" 4
-This function returns the run status of a stored script as well
-as the current values of parameters 0 to 9.
-
-.br
-
-.br
-
-.EX
-script_id: >=0, as returned by \fBstore_script\fP.
-.br
- param: an array to hold the returned 10 parameters.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns greater than or equal to 0 if OK,
-otherwise PI_BAD_SCRIPT_ID.
-
-.br
-
-.br
-The run status may be
-
-.br
-
-.br
-
-.EX
-PI_SCRIPT_INITING
-.br
-PI_SCRIPT_HALTED
-.br
-PI_SCRIPT_RUNNING
-.br
-PI_SCRIPT_WAITING
-.br
-PI_SCRIPT_FAILED
-.br
-
-.EE
-
-.br
-
-.br
-The current value of script parameters 0 to 9 are returned in param.
-
-.IP "\fBint stop_script(unsigned script_id)\fP"
-.IP "" 4
-This function stops a running script.
-
-.br
-
-.br
-
-.EX
-script_id: >=0, as returned by \fBstore_script\fP.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID.
-
-.IP "\fBint delete_script(unsigned script_id)\fP"
-.IP "" 4
-This function deletes a stored script.
-
-.br
-
-.br
-
-.EX
-script_id: >=0, as returned by \fBstore_script\fP.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID.
-
-.IP "\fBint bb_serial_read_open(unsigned user_gpio, unsigned baud, unsigned data_bits)\fP"
-.IP "" 4
-This function opens a GPIO for bit bang reading of serial data.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31.
-.br
- baud: 50-250000
-.br
-data_bits: 1-32
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_WAVE_BAUD,
-or PI_GPIO_IN_USE.
-
-.br
-
-.br
-The serial data is returned in a cyclic buffer and is read using
-bb_serial_read.
-
-.br
-
-.br
-It is the caller's responsibility to read data from the cyclic buffer
-in a timely fashion.
-
-.IP "\fBint bb_serial_read(unsigned user_gpio, void *buf, size_t bufSize)\fP"
-.IP "" 4
-This function copies up to bufSize bytes of data read from the
-bit bang serial cyclic buffer to the buffer starting at buf.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31, previously opened with \fBbb_serial_read_open\fP.
-.br
- buf: an array to receive the read bytes.
-.br
- bufSize: >=0
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes copied if OK, otherwise PI_BAD_USER_GPIO
-or PI_NOT_SERIAL_GPIO.
-
-.br
-
-.br
-The bytes returned for each character depend upon the number of
-data bits \fBdata_bits\fP specified in the \fBbb_serial_read_open\fP command.
-
-.br
-
-.br
-For \fBdata_bits\fP 1-8 there will be one byte per character.
-.br
-For \fBdata_bits\fP 9-16 there will be two bytes per character.
-.br
-For \fBdata_bits\fP 17-32 there will be four bytes per character.
-
-.IP "\fBint bb_serial_read_close(unsigned user_gpio)\fP"
-.IP "" 4
-This function closes a GPIO for bit bang reading of serial data.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31, previously opened with \fBbb_serial_read_open\fP.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_SERIAL_GPIO.
-
-.IP "\fBint bb_serial_invert(unsigned user_gpio, unsigned invert)\fP"
-.IP "" 4
-This function inverts serial logic for big bang serial reads.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31, previously opened with \fBbb_serial_read_open\fP.
-.br
- invert: 0-1, 1 invert, 0 normal.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_NOT_SERIAL_GPIO or PI_BAD_SER_INVERT.
-
-.IP "\fBint i2c_open(unsigned i2c_bus, unsigned i2c_addr, unsigned i2c_flags)\fP"
-.IP "" 4
-This returns a handle for the device at address i2c_addr on bus i2c_bus.
-
-.br
-
-.br
-
-.EX
- i2c_bus: >=0.
-.br
- i2c_addr: 0-0x7F.
-.br
-i2c_flags: 0.
-.br
-
-.EE
-
-.br
-
-.br
-No flags are currently defined. This parameter should be set to zero.
-
-.br
-
-.br
-Physically buses 0 and 1 are available on the Pi. Higher numbered buses
-will be available if a kernel supported bus multiplexor is being used.
-
-.br
-
-.br
-The GPIO used are given in the following table.
-
-.br
-
-.br
- SDA SCL
-.br
-I2C 0 0 1
-.br
-I2C 1 2 3
-.br
-
-.br
-
-.br
-Returns a handle (>=0) if OK, otherwise PI_BAD_I2C_BUS, PI_BAD_I2C_ADDR,
-PI_BAD_FLAGS, PI_NO_HANDLE, or PI_I2C_OPEN_FAILED.
-
-.br
-
-.br
-For the SMBus commands the low level transactions are shown at the end
-of the function description. The following abbreviations are used.
-
-.br
-
-.br
-
-.EX
-S (1 bit) : Start bit
-.br
-P (1 bit) : Stop bit
-.br
-Rd/Wr (1 bit) : Read/Write bit. Rd equals 1, Wr equals 0.
-.br
-A, NA (1 bit) : Accept and not accept bit.
-.br
-.br
-.br
-Addr (7 bits): I2C 7 bit address.
-.br
-Comm (8 bits): Command byte, a data byte which often selects a register.
-.br
-Data (8 bits): A data byte.
-.br
-Count (8 bits): A data byte containing the length of a block operation.
-.br
-
-.br
-[..]: Data sent by the device.
-.br
-
-.EE
-
-.IP "\fBint i2c_close(unsigned handle)\fP"
-.IP "" 4
-This closes the I2C device associated with the handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE.
-
-.IP "\fBint i2c_write_quick(unsigned handle, unsigned bit)\fP"
-.IP "" 4
-This sends a single bit (in the Rd/Wr bit) to the device associated
-with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
- bit: 0-1, the value to write.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-Quick command. SMBus 2.0 5.5.1
-
-.EX
-S Addr Rd/Wr [A] P
-.br
-
-.EE
-
-.IP "\fBint i2c_write_byte(unsigned handle, unsigned bVal)\fP"
-.IP "" 4
-This sends a single byte to the device associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
- bVal: 0-0xFF, the value to write.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-Send byte. SMBus 2.0 5.5.2
-
-.EX
-S Addr Wr [A] Data [A] P
-.br
-
-.EE
-
-.IP "\fBint i2c_read_byte(unsigned handle)\fP"
-.IP "" 4
-This reads a single byte from the device associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the byte read (>=0) if OK, otherwise PI_BAD_HANDLE,
-or PI_I2C_READ_FAILED.
-
-.br
-
-.br
-Receive byte. SMBus 2.0 5.5.3
-
-.EX
-S Addr Rd [A] [Data] NA P
-.br
-
-.EE
-
-.IP "\fBint i2c_write_byte_data(unsigned handle, unsigned i2c_reg, unsigned bVal)\fP"
-.IP "" 4
-This writes a single byte to the specified register of the device
-associated with handle.
-
-.br
-
-.br
-
-.EX
- handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-i2c_reg: 0-255, the register to write.
-.br
- bVal: 0-0xFF, the value to write.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-Write byte. SMBus 2.0 5.5.4
-
-.EX
-S Addr Wr [A] Comm [A] Data [A] P
-.br
-
-.EE
-
-.IP "\fBint i2c_write_word_data(unsigned handle, unsigned i2c_reg, unsigned wVal)\fP"
-.IP "" 4
-This writes a single 16 bit word to the specified register of the device
-associated with handle.
-
-.br
-
-.br
-
-.EX
- handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-i2c_reg: 0-255, the register to write.
-.br
- wVal: 0-0xFFFF, the value to write.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-Write word. SMBus 2.0 5.5.4
-
-.EX
-S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] P
-.br
-
-.EE
-
-.IP "\fBint i2c_read_byte_data(unsigned handle, unsigned i2c_reg)\fP"
-.IP "" 4
-This reads a single byte from the specified register of the device
-associated with handle.
-
-.br
-
-.br
-
-.EX
- handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-i2c_reg: 0-255, the register to read.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the byte read (>=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-
-.br
-
-.br
-Read byte. SMBus 2.0 5.5.5
-
-.EX
-S Addr Wr [A] Comm [A] S Addr Rd [A] [Data] NA P
-.br
-
-.EE
-
-.IP "\fBint i2c_read_word_data(unsigned handle, unsigned i2c_reg)\fP"
-.IP "" 4
-This reads a single 16 bit word from the specified register of the device
-associated with handle.
-
-.br
-
-.br
-
-.EX
- handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-i2c_reg: 0-255, the register to read.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the word read (>=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-
-.br
-
-.br
-Read word. SMBus 2.0 5.5.5
-
-.EX
-S Addr Wr [A] Comm [A] S Addr Rd [A] [DataLow] A [DataHigh] NA P
-.br
-
-.EE
-
-.IP "\fBint i2c_process_call(unsigned handle, unsigned i2c_reg, unsigned wVal)\fP"
-.IP "" 4
-This writes 16 bits of data to the specified register of the device
-associated with handle and and reads 16 bits of data in return.
-
-.br
-
-.br
-
-.EX
- handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-i2c_reg: 0-255, the register to write/read.
-.br
- wVal: 0-0xFFFF, the value to write.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the word read (>=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-
-.br
-
-.br
-Process call. SMBus 2.0 5.5.6
-
-.EX
-S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A]
-.br
- S Addr Rd [A] [DataLow] A [DataHigh] NA P
-.br
-
-.EE
-
-.IP "\fBint i2c_write_block_data(unsigned handle, unsigned i2c_reg, char *buf, unsigned count)\fP"
-.IP "" 4
-This writes up to 32 bytes to the specified register of the device
-associated with handle.
-
-.br
-
-.br
-
-.EX
- handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-i2c_reg: 0-255, the register to write.
-.br
- buf: an array with the data to send.
-.br
- count: 1-32, the number of bytes to write.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-Block write. SMBus 2.0 5.5.7
-
-.EX
-S Addr Wr [A] Comm [A] Count [A] Data [A] Data [A] ... [A] Data [A] P
-.br
-
-.EE
-
-.IP "\fBint i2c_read_block_data(unsigned handle, unsigned i2c_reg, char *buf)\fP"
-.IP "" 4
-This reads a block of up to 32 bytes from the specified register of
-the device associated with handle.
-
-.br
-
-.br
-
-.EX
- handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-i2c_reg: 0-255, the register to read.
-.br
- buf: an array to receive the read data.
-.br
-
-.EE
-
-.br
-
-.br
-The amount of returned data is set by the device.
-
-.br
-
-.br
-Returns the number of bytes read (>=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-
-.br
-
-.br
-Block read. SMBus 2.0 5.5.7
-
-.EX
-S Addr Wr [A] Comm [A]
-.br
- S Addr Rd [A] [Count] A [Data] A [Data] A ... A [Data] NA P
-.br
-
-.EE
-
-.IP "\fBint i2c_block_process_call(unsigned handle, unsigned i2c_reg, char *buf, unsigned count)\fP"
-.IP "" 4
-This writes data bytes to the specified register of the device
-associated with handle and reads a device specified number
-of bytes of data in return.
-
-.br
-
-.br
-
-.EX
- handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-i2c_reg: 0-255, the register to write/read.
-.br
- buf: an array with the data to send and to receive the read data.
-.br
- count: 1-32, the number of bytes to write.
-.br
-
-.EE
-
-.br
-
-.br
-
-.br
-
-.br
-Returns the number of bytes read (>=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-
-.br
-
-.br
-The smbus 2.0 documentation states that a minimum of 1 byte may be
-sent and a minimum of 1 byte may be received. The total number of
-bytes sent/received must be 32 or less.
-
-.br
-
-.br
-Block write-block read. SMBus 2.0 5.5.8
-
-.EX
-S Addr Wr [A] Comm [A] Count [A] Data [A] ...
-.br
- S Addr Rd [A] [Count] A [Data] ... A P
-.br
-
-.EE
-
-.IP "\fBint i2c_read_i2c_block_data(unsigned handle, unsigned i2c_reg, char *buf, unsigned count)\fP"
-.IP "" 4
-This reads count bytes from the specified register of the device
-associated with handle . The count may be 1-32.
-
-.br
-
-.br
-
-.EX
- handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-i2c_reg: 0-255, the register to read.
-.br
- buf: an array to receive the read data.
-.br
- count: 1-32, the number of bytes to read.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes read (>0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-
-.br
-
-.br
-
-.EX
-S Addr Wr [A] Comm [A]
-.br
- S Addr Rd [A] [Data] A [Data] A ... A [Data] NA P
-.br
-
-.EE
-
-.IP "\fBint i2c_write_i2c_block_data(unsigned handle, unsigned i2c_reg, char *buf, unsigned count)\fP"
-.IP "" 4
-This writes 1 to 32 bytes to the specified register of the device
-associated with handle.
-
-.br
-
-.br
-
-.EX
- handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-i2c_reg: 0-255, the register to write.
-.br
- buf: the data to write.
-.br
- count: 1-32, the number of bytes to write.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-
-.EX
-S Addr Wr [A] Comm [A] Data [A] Data [A] ... [A] Data [A] P
-.br
-
-.EE
-
-.IP "\fBint i2c_read_device(unsigned handle, char *buf, unsigned count)\fP"
-.IP "" 4
-This reads count bytes from the raw device into buf.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
- buf: an array to receive the read data bytes.
-.br
- count: >0, the number of bytes to read.
-.br
-
-.EE
-
-.br
-
-.br
-Returns count (>0) if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_READ_FAILED.
-
-.IP "\fBint i2c_write_device(unsigned handle, char *buf, unsigned count)\fP"
-.IP "" 4
-This writes count bytes from buf to the raw device.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
- buf: an array containing the data bytes to write.
-.br
- count: >0, the number of bytes to write.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-
-.IP "\fBint i2c_zip(unsigned handle, char *inBuf, unsigned inLen, char *outBuf, unsigned outLen)\fP"
-.IP "" 4
-This function executes a sequence of I2C operations. The
-operations to be performed are specified by the contents of inBuf
-which contains the concatenated command codes and associated data.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBi2cOpen\fP
-.br
- inBuf: pointer to the concatenated I2C commands, see below
-.br
- inLen: size of command buffer
-.br
-outBuf: pointer to buffer to hold returned data
-.br
-outLen: size of output buffer
-.br
-
-.EE
-
-.br
-
-.br
-Returns >= 0 if OK (the number of bytes read), otherwise
-PI_BAD_HANDLE, PI_BAD_POINTER, PI_BAD_I2C_CMD, PI_BAD_I2C_RLEN.
-PI_BAD_I2C_WLEN, or PI_BAD_I2C_SEG.
-
-.br
-
-.br
-The following command codes are supported:
-
-.br
-
-.br
-Name Cmd & Data Meaning
-.br
-End 0 No more commands
-.br
-Escape 1 Next P is two bytes
-.br
-On 2 Switch combined flag on
-.br
-Off 3 Switch combined flag off
-.br
-Address 4 P Set I2C address to P
-.br
-Flags 5 lsb msb Set I2C flags to lsb + (msb << 8)
-.br
-Read 6 P Read P bytes of data
-.br
-Write 7 P ... Write P bytes of data
-.br
-
-.br
-
-.br
-The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-
-.br
-
-.br
-The address defaults to that associated with the handle.
-The flags default to 0. The address and flags maintain their
-previous value until updated.
-
-.br
-
-.br
-The returned I2C data is stored in consecutive locations of outBuf.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-Set address 0x53, write 0x32, read 6 bytes
-.br
-Set address 0x1E, write 0x03, read 6 bytes
-.br
-Set address 0x68, write 0x1B, read 8 bytes
-.br
-End
-.br
-
-.br
-0x04 0x53 0x07 0x01 0x32 0x06 0x06
-.br
-0x04 0x1E 0x07 0x01 0x03 0x06 0x06
-.br
-0x04 0x68 0x07 0x01 0x1B 0x06 0x08
-.br
-0x00
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBint bb_i2c_open(unsigned SDA, unsigned SCL, unsigned baud)\fP"
-.IP "" 4
-This function selects a pair of GPIO for bit banging I2C at a
-specified baud rate.
-
-.br
-
-.br
-Bit banging I2C allows for certain operations which are not possible
-with the standard I2C driver.
-
-.br
-
-.br
-o baud rates as low as 50
-.br
-o repeated starts
-.br
-o clock stretching
-.br
-o I2C on any pair of spare GPIO
-
-.br
-
-.br
-
-.EX
- SDA: 0-31
-.br
- SCL: 0-31
-.br
-baud: 50-500000
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_I2C_BAUD, or
-PI_GPIO_IN_USE.
-
-.br
-
-.br
-NOTE:
-
-.br
-
-.br
-The GPIO used for SDA and SCL must have pull-ups to 3V3 connected. As
-a guide the hardware pull-ups on pins 3 and 5 are 1k8 in value.
-
-.IP "\fBint bb_i2c_close(unsigned SDA)\fP"
-.IP "" 4
-This function stops bit banging I2C on a pair of GPIO previously
-opened with \fBbb_i2c_open\fP.
-
-.br
-
-.br
-
-.EX
-SDA: 0-31, the SDA GPIO used in a prior call to \fBbb_i2c_open\fP
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_I2C_GPIO.
-
-.IP "\fBint bb_i2c_zip(unsigned SDA, char *inBuf, unsigned inLen, char *outBuf, unsigned outLen)\fP"
-.IP "" 4
-This function executes a sequence of bit banged I2C operations. The
-operations to be performed are specified by the contents of inBuf
-which contains the concatenated command codes and associated data.
-
-.br
-
-.br
-
-.EX
- SDA: 0-31 (as used in a prior call to \fBbb_i2c_open\fP)
-.br
- inBuf: pointer to the concatenated I2C commands, see below
-.br
- inLen: size of command buffer
-.br
-outBuf: pointer to buffer to hold returned data
-.br
-outLen: size of output buffer
-.br
-
-.EE
-
-.br
-
-.br
-Returns >= 0 if OK (the number of bytes read), otherwise
-PI_BAD_USER_GPIO, PI_NOT_I2C_GPIO, PI_BAD_POINTER,
-PI_BAD_I2C_CMD, PI_BAD_I2C_RLEN, PI_BAD_I2C_WLEN,
-PI_I2C_READ_FAILED, or PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-The following command codes are supported:
-
-.br
-
-.br
-Name Cmd & Data Meaning
-.br
-End 0 No more commands
-.br
-Escape 1 Next P is two bytes
-.br
-Start 2 Start condition
-.br
-Stop 3 Stop condition
-.br
-Address 4 P Set I2C address to P
-.br
-Flags 5 lsb msb Set I2C flags to lsb + (msb << 8)
-.br
-Read 6 P Read P bytes of data
-.br
-Write 7 P ... Write P bytes of data
-.br
-
-.br
-
-.br
-The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-
-.br
-
-.br
-The address and flags default to 0. The address and flags maintain
-their previous value until updated.
-
-.br
-
-.br
-No flags are currently defined.
-
-.br
-
-.br
-The returned I2C data is stored in consecutive locations of outBuf.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-Set address 0x53
-.br
-start, write 0x32, (re)start, read 6 bytes, stop
-.br
-Set address 0x1E
-.br
-start, write 0x03, (re)start, read 6 bytes, stop
-.br
-Set address 0x68
-.br
-start, write 0x1B, (re)start, read 8 bytes, stop
-.br
-End
-.br
-
-.br
-0x04 0x53
-.br
-0x02 0x07 0x01 0x32 0x02 0x06 0x06 0x03
-.br
-
-.br
-0x04 0x1E
-.br
-0x02 0x07 0x01 0x03 0x02 0x06 0x06 0x03
-.br
-
-.br
-0x04 0x68
-.br
-0x02 0x07 0x01 0x1B 0x02 0x06 0x08 0x03
-.br
-
-.br
-0x00
-.br
-
-.EE
-
-.IP "\fBint spi_open(unsigned spi_channel, unsigned baud, unsigned spi_flags)\fP"
-.IP "" 4
-This function returns a handle for the SPI device on the channel.
-Data will be transferred at baud bits per second. The flags may
-be used to modify the default behaviour of 4-wire operation, mode 0,
-active low chip select.
-
-.br
-
-.br
-The Pi has two SPI peripherals: main and auxiliary.
-
-.br
-
-.br
-The main SPI has two chip selects (channels), the auxiliary has
-three.
-
-.br
-
-.br
-The auxiliary SPI is available on all models but the A and B.
-
-.br
-
-.br
-The GPIO used are given in the following table.
-
-.br
-
-.br
- MISO MOSI SCLK CE0 CE1 CE2
-.br
-Main SPI 9 10 11 8 7 -
-.br
-Aux SPI 19 20 21 18 17 16
-.br
-
-.br
-
-.br
-
-.EX
-spi_channel: 0-1 (0-2 for the auxiliary SPI).
-.br
- baud: 32K-125M (values above 30M are unlikely to work).
-.br
- spi_flags: see below.
-.br
-
-.EE
-
-.br
-
-.br
-Returns a handle (>=0) if OK, otherwise PI_BAD_SPI_CHANNEL,
-PI_BAD_SPI_SPEED, PI_BAD_FLAGS, PI_NO_AUX_SPI, or PI_SPI_OPEN_FAILED.
-
-.br
-
-.br
-spi_flags consists of the least significant 22 bits.
-
-.br
-
-.br
-
-.EX
-21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
-.br
- b b b b b b R T n n n n W A u2 u1 u0 p2 p1 p0 m m
-.br
-
-.EE
-
-.br
-
-.br
-mm defines the SPI mode.
-
-.br
-
-.br
-Warning: modes 1 and 3 do not appear to work on the auxiliary SPI.
-
-.br
-
-.br
-
-.EX
-Mode POL PHA
-.br
- 0 0 0
-.br
- 1 0 1
-.br
- 2 1 0
-.br
- 3 1 1
-.br
-
-.EE
-
-.br
-
-.br
-px is 0 if CEx is active low (default) and 1 for active high.
-
-.br
-
-.br
-ux is 0 if the CEx GPIO is reserved for SPI (default) and 1 otherwise.
-
-.br
-
-.br
-A is 0 for the main SPI, 1 for the auxiliary SPI.
-
-.br
-
-.br
-W is 0 if the device is not 3-wire, 1 if the device is 3-wire. Main
-SPI only.
-
-.br
-
-.br
-nnnn defines the number of bytes (0-15) to write before switching
-the MOSI line to MISO to read data. This field is ignored
-if W is not set. Main SPI only.
-
-.br
-
-.br
-T is 1 if the least significant bit is transmitted on MOSI first, the
-default (0) shifts the most significant bit out first. Auxiliary SPI
-only.
-
-.br
-
-.br
-R is 1 if the least significant bit is received on MISO first, the
-default (0) receives the most significant bit first. Auxiliary SPI
-only.
-
-.br
-
-.br
-bbbbbb defines the word size in bits (0-32). The default (0)
-sets 8 bits per word. Auxiliary SPI only.
-
-.br
-
-.br
-The \fBspi_read\fP, \fBspi_write\fP, and \fBspi_xfer\fP functions
-transfer data packed into 1, 2, or 4 bytes according to
-the word size in bits.
-
-.br
-
-.br
-For bits 1-8 there will be one byte per word.
-.br
-For bits 9-16 there will be two bytes per word.
-.br
-For bits 17-32 there will be four bytes per word.
-
-.br
-
-.br
-Multi-byte transfers are made in least significant byte first order.
-
-.br
-
-.br
-E.g. to transfer 32 11-bit words buf should contain 64 bytes
-and count should be 64.
-
-.br
-
-.br
-E.g. to transfer the 14 bit value 0x1ABC send the bytes 0xBC followed
-by 0x1A.
-
-.br
-
-.br
-The other bits in flags should be set to zero.
-
-.IP "\fBint spi_close(unsigned handle)\fP"
-.IP "" 4
-This functions closes the SPI device identified by the handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBspi_open\fP.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE.
-
-.IP "\fBint spi_read(unsigned handle, char *buf, unsigned count)\fP"
-.IP "" 4
-This function reads count bytes of data from the SPI
-device associated with the handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBspi_open\fP.
-.br
- buf: an array to receive the read data bytes.
-.br
- count: the number of bytes to read.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-
-.IP "\fBint spi_write(unsigned handle, char *buf, unsigned count)\fP"
-.IP "" 4
-This function writes count bytes of data from buf to the SPI
-device associated with the handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBspi_open\fP.
-.br
- buf: the data bytes to write.
-.br
- count: the number of bytes to write.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-
-.IP "\fBint spi_xfer(unsigned handle, char *txBuf, char *rxBuf, unsigned count)\fP"
-.IP "" 4
-This function transfers count bytes of data from txBuf to the SPI
-device associated with the handle. Simultaneously count bytes of
-data are read from the device and placed in rxBuf.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBspi_open\fP.
-.br
- txBuf: the data bytes to write.
-.br
- rxBuf: the received data bytes.
-.br
- count: the number of bytes to transfer.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-
-.IP "\fBint serial_open(char *ser_tty, unsigned baud, unsigned ser_flags)\fP"
-.IP "" 4
-This function opens a serial device at a specified baud rate
-with specified flags. The device name must start with
-/dev/tty or /dev/serial.
-
-.br
-
-.br
-
-.EX
- ser_tty: the serial device to open.
-.br
- baud: the baud rate in bits per second, see below.
-.br
-ser_flags: 0.
-.br
-
-.EE
-
-.br
-
-.br
-Returns a handle (>=0) if OK, otherwise PI_NO_HANDLE, or
-PI_SER_OPEN_FAILED.
-
-.br
-
-.br
-The baud rate must be one of 50, 75, 110, 134, 150,
-200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
-38400, 57600, 115200, or 230400.
-
-.br
-
-.br
-No flags are currently defined. This parameter should be set to zero.
-
-.IP "\fBint serial_close(unsigned handle)\fP"
-.IP "" 4
-This function closes the serial device associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBserial_open\fP.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE.
-
-.IP "\fBint serial_write_byte(unsigned handle, unsigned bVal)\fP"
-.IP "" 4
-This function writes bVal to the serial port associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBserial_open\fP.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_SER_WRITE_FAILED.
-
-.IP "\fBint serial_read_byte(unsigned handle)\fP"
-.IP "" 4
-This function reads a byte from the serial port associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBserial_open\fP.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the read byte (>=0) if OK, otherwise PI_BAD_HANDLE,
-PI_SER_READ_NO_DATA, or PI_SER_READ_FAILED.
-
-.br
-
-.br
-If no data is ready PI_SER_READ_NO_DATA is returned.
-
-.IP "\fBint serial_write(unsigned handle, char *buf, unsigned count)\fP"
-.IP "" 4
-This function writes count bytes from buf to the the serial port
-associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBserial_open\fP.
-.br
- buf: the array of bytes to write.
-.br
- count: the number of bytes to write.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_SER_WRITE_FAILED.
-
-.IP "\fBint serial_read(unsigned handle, char *buf, unsigned count)\fP"
-.IP "" 4
-This function reads up to count bytes from the the serial port
-associated with handle and writes them to buf.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBserial_open\fP.
-.br
- buf: an array to receive the read data.
-.br
- count: the maximum number of bytes to read.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes read (>0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, PI_SER_READ_NO_DATA, or PI_SER_WRITE_FAILED.
-
-.br
-
-.br
-If no data is ready zero is returned.
-
-.IP "\fBint serial_data_available(unsigned handle)\fP"
-.IP "" 4
-Returns the number of bytes available to be read from the
-device associated with handle.
-
-.br
-
-.br
-
-.EX
-handle: >=0, as returned by a call to \fBserial_open\fP.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes of data available (>=0) if OK,
-otherwise PI_BAD_HANDLE.
-
-.IP "\fBint custom_1(unsigned arg1, unsigned arg2, char *argx, unsigned argc)\fP"
-.IP "" 4
-This function is available for user customisation.
-
-.br
-
-.br
-It returns a single integer value.
-
-.br
-
-.br
-
-.EX
-arg1: >=0
-.br
-arg2: >=0
-.br
-argx: extra (byte) arguments
-.br
-argc: number of extra arguments
-.br
-
-.EE
-
-.br
-
-.br
-Returns >= 0 if OK, less than 0 indicates a user defined error.
-
-.IP "\fBint custom_2(unsigned arg1, char *argx, unsigned argc, char *retBuf, unsigned retMax)\fP"
-.IP "" 4
-This function is available for user customisation.
-
-.br
-
-.br
-It differs from custom_1 in that it returns an array of bytes
-rather than just an integer.
-
-.br
-
-.br
-The return value is an integer indicating the number of returned bytes.
-
-.EX
- arg1: >=0
-.br
- argc: extra (byte) arguments
-.br
- count: number of extra arguments
-.br
-retBuf: buffer for returned data
-.br
-retMax: maximum number of bytes to return
-.br
-
-.EE
-
-.br
-
-.br
-Returns >= 0 if OK, less than 0 indicates a user defined error.
-
-.br
-
-.br
-Note, the number of returned bytes will be retMax or less.
-
-.IP "\fBint callback(unsigned user_gpio, unsigned edge, CBFunc_t f)\fP"
-.IP "" 4
-This function initialises a new callback.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31.
-.br
- edge: RISING_EDGE, FALLING_EDGE, or EITHER_EDGE.
-.br
- f: the callback function.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns a callback id if OK, otherwise pigif_bad_malloc,
-pigif_duplicate_callback, or pigif_bad_callback.
-
-.br
-
-.br
-The callback is called with the GPIO, edge, and tick, whenever the
-GPIO has the identified edge.
-
-.br
-
-.br
-
-.EX
-Parameter Value Meaning
-.br
-
-.br
-GPIO 0-31 The GPIO which has changed state
-.br
-
-.br
-edge 0-2 0 = change to low (a falling edge)
-.br
- 1 = change to high (a rising edge)
-.br
- 2 = no level change (a watchdog timeout)
-.br
-
-.br
-tick 32 bit The number of microseconds since boot
-.br
- WARNING: this wraps around from
-.br
- 4294967295 to 0 roughly every 72 minutes
-.br
-
-.EE
-
-.IP "\fBint callback_ex(unsigned user_gpio, unsigned edge, CBFuncEx_t f, void *userdata)\fP"
-.IP "" 4
-This function initialises a new callback.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31.
-.br
- edge: RISING_EDGE, FALLING_EDGE, or EITHER_EDGE.
-.br
- f: the callback function.
-.br
- userdata: a pointer to arbitrary user data.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns a callback id if OK, otherwise pigif_bad_malloc,
-pigif_duplicate_callback, or pigif_bad_callback.
-
-.br
-
-.br
-The callback is called with the GPIO, edge, tick, and user, whenever
-the GPIO has the identified edge.
-
-.br
-
-.br
-
-.EX
-Parameter Value Meaning
-.br
-
-.br
-GPIO 0-31 The GPIO which has changed state
-.br
-
-.br
-edge 0-2 0 = change to low (a falling edge)
-.br
- 1 = change to high (a rising edge)
-.br
- 2 = no level change (a watchdog timeout)
-.br
-
-.br
-tick 32 bit The number of microseconds since boot
-.br
- WARNING: this wraps around from
-.br
- 4294967295 to 0 roughly every 72 minutes
-.br
-
-.br
-userdata pointer Pointer to an arbitrary object
-.br
-
-.EE
-
-.IP "\fBint callback_cancel(unsigned callback_id)\fP"
-.IP "" 4
-This function cancels a callback identified by its id.
-
-.br
-
-.br
-
-.EX
-callback_id: >=0, as returned by a call to \fBcallback\fP or \fBcallback_ex\fP.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns 0 if OK, otherwise pigif_callback_not_found.
-
-.IP "\fBint wait_for_edge(unsigned user_gpio, unsigned edge, double timeout)\fP"
-.IP "" 4
-This function waits for edge on the GPIO for up to timeout
-seconds.
-
-.br
-
-.br
-
-.EX
-user_gpio: 0-31.
-.br
- edge: RISING_EDGE, FALLING_EDGE, or EITHER_EDGE.
-.br
- timeout: >=0.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns 1 if the edge occurred, otherwise 0.
-
-.br
-
-.br
-The function returns when the edge occurs or after the timeout.
-.SH PARAMETERS
-
-.br
-
-.br
-
-.IP "\fBactive\fP: 0-1000000" 0
-
-.br
-
-.br
-The number of microseconds level changes are reported for once
-a noise filter has been triggered (by \fBsteady\fP microseconds of
-a stable level).
-
-.br
-
-.br
-
-.IP "\fB*addrStr\fP" 0
-A string specifying the host or IP address of the Pi running
-the pigpio daemon. It may be NULL in which case localhost
-is used unless overridden by the PIGPIO_ADDR environment
-variable.
-
-.br
-
-.br
-
-.IP "\fBarg1\fP" 0
-An unsigned argument passed to a user customised function. Its
-meaning is defined by the customiser.
-
-.br
-
-.br
-
-.IP "\fBarg2\fP" 0
-An unsigned argument passed to a user customised function. Its
-meaning is defined by the customiser.
-
-.br
-
-.br
-
-.IP "\fBargc\fP" 0
-The count of bytes passed to a user customised function.
-
-.br
-
-.br
-
-.IP "\fB*argx\fP" 0
-A pointer to an array of bytes passed to a user customised function.
-Its meaning and content is defined by the customiser.
-
-.br
-
-.br
-
-.IP "\fBbaud\fP" 0
-The speed of serial communication (I2C, SPI, serial link, waves) in
-bits per second.
-
-.br
-
-.br
-
-.IP "\fBbit\fP" 0
-A value of 0 or 1.
-
-.br
-
-.br
-
-.IP "\fBbits\fP" 0
-A value used to select GPIO. If bit n of bits is set then GPIO n is
-selected.
-
-.br
-
-.br
-A convenient way to set bit n is to or in (1<<n).
-
-.br
-
-.br
-e.g. to select bits 5, 9, 23 you could use (1<<5) | (1<<9) | (1<<23).
-
-.br
-
-.br
-
-.IP "\fB*buf\fP" 0
-A buffer to hold data being sent or being received.
-
-.br
-
-.br
-
-.IP "\fBbufSize\fP" 0
-The size in bytes of a buffer.
-
-.br
-
-.br
-
-.br
-
-.br
-
-.IP "\fBbVal\fP: 0-255 (Hex 0x0-0xFF, Octal 0-0377)" 0
-An 8-bit byte value.
-
-.br
-
-.br
-
-.IP "\fBcallback_id\fP" 0
-A >=0, as returned by a call to \fBcallback\fP or \fBcallback_ex\fP. This is
-passed to \fBcallback_cancel\fP to cancel the callback.
-
-.br
-
-.br
-
-.IP "\fBCBFunc_t\fP" 0
-
-.EX
-typedef void (*CBFunc_t)
-.br
- (unsigned user_gpio, unsigned level, uint32_t tick);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBCBFuncEx_t\fP" 0
-
-.EX
-typedef void (*CBFuncEx_t)
-.br
- (unsigned user_gpio, unsigned level, uint32_t tick, void * user);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBchar\fP" 0
-A single character, an 8 bit quantity able to store 0-255.
-
-.br
-
-.br
-
-.IP "\fBclkfreq\fP: 4689-250000000 (250M)" 0
-The hardware clock frequency.
-
-.br
-
-.br
-
-.IP "\fBcount\fP" 0
-The number of bytes to be transferred in an I2C, SPI, or Serial
-command.
-
-.br
-
-.br
-
-.IP "\fBdata_bits\fP: 1-32" 0
-The number of data bits in each character of serial data.
-
-.br
-
-.br
-
-.EX
-#define PI_MIN_WAVE_DATABITS 1
-.br
-#define PI_MAX_WAVE_DATABITS 32
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBdouble\fP" 0
-A floating point number.
-
-.br
-
-.br
-
-.IP "\fBdutycycle\fP: 0-range" 0
-A number representing the ratio of on time to off time for PWM.
-
-.br
-
-.br
-The number may vary between 0 and range (default 255) where
-0 is off and range is fully on.
-
-.br
-
-.br
-
-.IP "\fBedge\fP" 0
-Used to identify a GPIO level transition of interest. A rising edge is
-a level change from 0 to 1. A falling edge is a level change from 1 to 0.
-
-.br
-
-.br
-
-.EX
-RISING_EDGE 0
-.br
-FALLING_EDGE 1
-.br
-EITHER_EDGE. 2
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBerrnum\fP" 0
-A negative number indicating a function call failed and the nature
-of the error.
-
-.br
-
-.br
-
-.IP "\fBf\fP" 0
-A function.
-
-.br
-
-.br
-
-.IP "\fBfrequency\fP: >=0" 0
-The number of times a GPIO is swiched on and off per second. This
-can be set per GPIO and may be as little as 5Hz or as much as
-40KHz. The GPIO will be on for a proportion of the time as defined
-by its dutycycle.
-
-.br
-
-.br
-
-.br
-
-.br
-
-.IP "\fBgpio\fP" 0
-A Broadcom numbered GPIO, in the range 0-53.
-
-.br
-
-.br
-There are 54 General Purpose Input Outputs (GPIO) named gpio0 through
-gpio53.
-
-.br
-
-.br
-They are split into two banks. Bank 1 consists of gpio0 through
-gpio31. Bank 2 consists of gpio32 through gpio53.
-
-.br
-
-.br
-All the GPIO which are safe for the user to read and write are in
-bank 1. Not all GPIO in bank 1 are safe though. Type 1 boards
-have 17 safe GPIO. Type 2 boards have 21. Type 3 boards have 26.
-
-.br
-
-.br
-See \fBget_hardware_revision\fP.
-
-.br
-
-.br
-The user GPIO are marked with an X in the following table.
-
-.br
-
-.br
-
-.EX
- 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
-.br
-Type 1 X X - - X - - X X X X X - - X X
-.br
-Type 2 - - X X X - - X X X X X - - X X
-.br
-Type 3 X X X X X X X X X X X X X X
-.br
-
-.br
- 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
-.br
-Type 1 - X X - - X X X X X - - - - - -
-.br
-Type 2 - X X - - - X X X X - X X X X X
-.br
-Type 3 X X X X X X X X X X X X - - - -
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBgpioPulse_t\fP" 0
-
-.EX
-typedef struct
-.br
-{
-.br
-uint32_t gpioOn;
-.br
-uint32_t gpioOff;
-.br
-uint32_t usDelay;
-.br
-} gpioPulse_t;
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBgpioThreadFunc_t\fP" 0
-
-.EX
-typedef void *(gpioThreadFunc_t) (void *);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBhandle\fP: >=0" 0
-A number referencing an object opened by one of \fBi2c_open\fP, \fBnotify_open\fP,
-\fBserial_open\fP, and \fBspi_open\fP.
-
-.br
-
-.br
-
-.IP "\fBi2c_addr\fP: 0-0x7F" 0
-The address of a device on the I2C bus.
-
-.br
-
-.br
-
-.IP "\fBi2c_bus\fP: >=0" 0
-An I2C bus number.
-
-.br
-
-.br
-
-.IP "\fBi2c_flags\fP: 0" 0
-Flags which modify an I2C open command. None are currently defined.
-
-.br
-
-.br
-
-.IP "\fBi2c_reg\fP: 0-255" 0
-A register of an I2C device.
-
-.br
-
-.br
-
-.IP "\fB*inBuf\fP" 0
-A buffer used to pass data to a function.
-
-.br
-
-.br
-
-.IP "\fBinLen\fP" 0
-The number of bytes of data in a buffer.
-
-.br
-
-.br
-
-.IP "\fBint\fP" 0
-A whole number, negative or positive.
-
-.br
-
-.br
-
-.IP "\fBinvert\fP" 0
-A flag used to set normal or inverted bit bang serial data level logic.
-
-.br
-
-.br
-
-.IP "\fBlevel\fP" 0
-The level of a GPIO. Low or High.
-
-.br
-
-.br
-
-.EX
-PI_OFF 0
-.br
-PI_ON 1
-.br
-
-.br
-PI_CLEAR 0
-.br
-PI_SET 1
-.br
-
-.br
-PI_LOW 0
-.br
-PI_HIGH 1
-.br
-
-.EE
-
-.br
-
-.br
-There is one exception. If a watchdog expires on a GPIO the level will be
-reported as PI_TIMEOUT. See \fBset_watchdog\fP.
-
-.br
-
-.br
-
-.EX
-PI_TIMEOUT 2
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBmode\fP: 0-7" 0
-The operational mode of a GPIO, normally INPUT or OUTPUT.
-
-.br
-
-.br
-
-.EX
-PI_INPUT 0
-.br
-PI_OUTPUT 1
-.br
-PI_ALT0 4
-.br
-PI_ALT1 5
-.br
-PI_ALT2 6
-.br
-PI_ALT3 7
-.br
-PI_ALT4 3
-.br
-PI_ALT5 2
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBnumBytes\fP" 0
-The number of bytes used to store characters in a string. Depending
-on the number of bits per character there may be 1, 2, or 4 bytes
-per character.
-
-.br
-
-.br
-
-.IP "\fBnumPar\fP: 0-10" 0
-The number of parameters passed to a script.
-
-.br
-
-.br
-
-.IP "\fBnumPulses\fP" 0
-The number of pulses to be added to a waveform.
-
-.br
-
-.br
-
-.IP "\fBoffset\fP" 0
-The associated data starts this number of microseconds from the start of
-the waveform.
-
-.br
-
-.br
-
-.IP "\fB*outBuf\fP" 0
-A buffer used to return data from a function.
-
-.br
-
-.br
-
-.IP "\fBoutLen\fP" 0
-The size in bytes of an output buffer.
-
-.br
-
-.br
-
-.IP "\fB*param\fP" 0
-An array of script parameters.
-
-.br
-
-.br
-
-.IP "\fB*portStr\fP" 0
-A string specifying the port address used by the Pi running
-the pigpio daemon. It may be NULL in which case "8888"
-is used unless overridden by the PIGPIO_PORT environment
-variable.
-
-.br
-
-.br
-
-.IP "\fB*pth\fP" 0
-A thread identifier, returned by \fBstart_thread\fP.
-
-.br
-
-.br
-
-.br
-
-.br
-
-.IP "\fBpthread_t\fP" 0
-A thread identifier.
-
-.br
-
-.br
-
-.IP "\fBpud\fP: 0-2" 0
-The setting of the pull up/down resistor for a GPIO, which may be off,
-pull-up, or pull-down.
-
-.EX
-PI_PUD_OFF 0
-.br
-PI_PUD_DOWN 1
-.br
-PI_PUD_UP 2
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBpulseLen\fP" 0
-1-100, the length of a trigger pulse in microseconds.
-
-.br
-
-.br
-
-.IP "\fB*pulses\fP" 0
-An array of pulses to be added to a waveform.
-
-.br
-
-.br
-
-.IP "\fBpulsewidth\fP: 0, 500-2500" 0
-
-.EX
-PI_SERVO_OFF 0
-.br
-PI_MIN_SERVO_PULSEWIDTH 500
-.br
-PI_MAX_SERVO_PULSEWIDTH 2500
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBPWMduty\fP: 0-1000000 (1M)" 0
-The hardware PWM dutycycle.
-
-.br
-
-.br
-
-.EX
-#define PI_HW_PWM_RANGE 1000000
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBPWMfreq\fP: 1-125000000 (125M)" 0
-The hardware PWM frequency.
-
-.br
-
-.br
-
-.EX
-#define PI_HW_PWM_MIN_FREQ 1
-.br
-#define PI_HW_PWM_MAX_FREQ 125000000
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBrange\fP: 25-40000" 0
-The permissible dutycycle values are 0-range.
-
-.EX
-PI_MIN_DUTYCYCLE_RANGE 25
-.br
-PI_MAX_DUTYCYCLE_RANGE 40000
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fB*retBuf\fP" 0
-A buffer to hold a number of bytes returned to a used customised function,
-
-.br
-
-.br
-
-.IP "\fBretMax\fP" 0
-The maximum number of bytes a user customised function should return.
-
-.br
-
-.br
-
-.br
-
-.br
-
-.IP "\fB*rxBuf\fP" 0
-A pointer to a buffer to receive data.
-
-.br
-
-.br
-
-.IP "\fBSCL\fP" 0
-The user GPIO to use for the clock when bit banging I2C.
-
-.br
-
-.br
-
-.IP "\fB*script\fP" 0
-A pointer to the text of a script.
-
-.br
-
-.br
-
-.IP "\fBscript_id\fP" 0
-An id of a stored script as returned by \fBstore_script\fP.
-
-.br
-
-.br
-
-.IP "\fBSDA\fP" 0
-The user GPIO to use for data when bit banging I2C.
-
-.br
-
-.br
-
-.IP "\fBseconds\fP" 0
-The number of seconds.
-
-.br
-
-.br
-
-.IP "\fBser_flags\fP" 0
-Flags which modify a serial open command. None are currently defined.
-
-.br
-
-.br
-
-.IP "\fB*ser_tty\fP" 0
-The name of a serial tty device, e.g. /dev/ttyAMA0, /dev/ttyUSB0, /dev/tty1.
-
-.br
-
-.br
-
-.IP "\fBsize_t\fP" 0
-A standard type used to indicate the size of an object in bytes.
-
-.br
-
-.br
-
-.IP "\fBspi_channel\fP" 0
-A SPI channel, 0-2.
-
-.br
-
-.br
-
-.IP "\fBspi_flags\fP" 0
-See \fBspi_open\fP.
-
-.br
-
-.br
-
-.IP "\fBsteady\fP: 0-300000" 0
-
-.br
-
-.br
-The number of microseconds level changes must be stable for
-before reporting the level changed (\fBset_glitch_filter\fP) or triggering
-the active part of a noise filter (\fBset_noise_filter\fP).
-
-.br
-
-.br
-
-.IP "\fBstop_bits\fP: 2-8" 0
-The number of (half) stop bits to be used when adding serial data
-to a waveform.
-
-.br
-
-.br
-
-.EX
-#define PI_MIN_WAVE_HALFSTOPBITS 2
-.br
-#define PI_MAX_WAVE_HALFSTOPBITS 8
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fB*str\fP" 0
- An array of characters.
-
-.br
-
-.br
-
-.IP "\fBthread_func\fP" 0
-A function of type gpioThreadFunc_t used as the main function of a
-thread.
-
-.br
-
-.br
-
-.IP "\fBtimeout\fP" 0
-A GPIO watchdog timeout in milliseconds.
-
-.EX
-PI_MIN_WDOG_TIMEOUT 0
-.br
-PI_MAX_WDOG_TIMEOUT 60000
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fB*txBuf\fP" 0
-An array of bytes to transmit.
-
-.br
-
-.br
-
-.IP "\fBuint32_t\fP: 0-0-4,294,967,295 (Hex 0x0-0xFFFFFFFF)" 0
-A 32-bit unsigned value.
-
-.br
-
-.br
-
-.IP "\fBunsigned\fP" 0
-A whole number >= 0.
-
-.br
-
-.br
-
-.IP "\fBuser_gpio\fP" 0
-0-31, a Broadcom numbered GPIO.
-
-.br
-
-.br
-See \fBgpio\fP.
-
-.br
-
-.br
-
-.IP "\fB*userdata\fP" 0
-A pointer to arbitrary user data. This may be used to identify the instance.
-
-.br
-
-.br
-
-.IP "\fBvoid\fP" 0
-Denoting no parameter is required
-
-.br
-
-.br
-
-.IP "\fBwave_add_*\fP" 0
-One of \fBwave_add_new\fP, \fBwave_add_generic\fP, \fBwave_add_serial\fP.
-
-.br
-
-.br
-
-.IP "\fBwave_id\fP" 0
-A number representing a waveform created by \fBwave_create\fP.
-
-.br
-
-.br
-
-.IP "\fBwave_send_*\fP" 0
-One of \fBwave_send_once\fP, \fBwave_send_repeat\fP.
-
-.br
-
-.br
-
-.IP "\fBwVal\fP: 0-65535 (Hex 0x0-0xFFFF, Octal 0-0177777)" 0
-A 16-bit word value.
-
-.br
-
-.br
-.SH pigpiod_if Error Codes
-
-.EX
-
-.br
-typedef enum
-.br
-{
-.br
- pigif_bad_send = -2000,
-.br
- pigif_bad_recv = -2001,
-.br
- pigif_bad_getaddrinfo = -2002,
-.br
- pigif_bad_connect = -2003,
-.br
- pigif_bad_socket = -2004,
-.br
- pigif_bad_noib = -2005,
-.br
- pigif_duplicate_callback = -2006,
-.br
- pigif_bad_malloc = -2007,
-.br
- pigif_bad_callback = -2008,
-.br
- pigif_notify_failed = -2009,
-.br
- pigif_callback_not_found = -2010,
-.br
-} pigifError_t;
-.br
-
-.br
-
-.EE
-
-.SH SEE ALSO
-
-pigpiod(1), pig2vcd(1), pigs(1), pigpio(3), pigpiod_if2(3)
-.SH AUTHOR
-
-joan@abyz.me.uk
diff --git a/DOC/MAN/pigpiod_if2.3 b/DOC/MAN/pigpiod_if2.3
deleted file mode 100644
index f07de8d..0000000
--- a/DOC/MAN/pigpiod_if2.3
+++ /dev/null
@@ -1,8057 +0,0 @@
-
-." Process this file with
-." groff -man -Tascii pigpiod_if2.3
-."
-.TH pigpiod_if2 3 2012-2020 Linux "pigpio archive"
-.SH NAME
-pigpiod_if2 - A C library to interface to the pigpio daemon.
-
-.SH SYNOPSIS
-
-#include <pigpiod_if2.h>
-
-
-gcc -Wall -pthread -o prog prog.c -lpigpiod_if2 -lrt
-
- ./prog
-.SH DESCRIPTION
-
-
-.ad l
-
-.nh
-
-.br
-
-.br
-pigpiod_if2 is a C library for the Raspberry which allows control
-of the GPIO via the socket interface to the pigpio daemon.
-.br
-
-.br
-
-.br
-.SS Features
-.br
-
-.br
-o hardware timed PWM on any of GPIO 0-31
-
-.br
-
-.br
-o hardware timed servo pulses on any of GPIO 0-31
-
-.br
-
-.br
-o callbacks when any of GPIO 0-31 change state
-
-.br
-
-.br
-o callbacks at timed intervals
-
-.br
-
-.br
-o reading/writing all of the GPIO in a bank as one operation
-
-.br
-
-.br
-o individually setting GPIO modes, reading and writing
-
-.br
-
-.br
-o notifications when any of GPIO 0-31 change state
-
-.br
-
-.br
-o the construction of output waveforms with microsecond timing
-
-.br
-
-.br
-o rudimentary permission control over GPIO
-
-.br
-
-.br
-o a simple interface to start and stop new threads
-
-.br
-
-.br
-o I2C, SPI, and serial link wrappers
-
-.br
-
-.br
-o creating and running scripts on the pigpio daemon
-
-.br
-
-.br
-.SS GPIO
-.br
-
-.br
-ALL GPIO are identified by their Broadcom number.
-
-.br
-
-.br
-.SS Notes
-.br
-
-.br
-The PWM and servo pulses are timed using the DMA and PWM/PCM peripherals.
-
-.br
-
-.br
-.SS Usage
-.br
-
-.br
-Include <pigpiod_if2.h> in your source files.
-
-.br
-
-.br
-Assuming your source is in prog.c use the following command to build
-
-.br
-
-.br
-
-.EX
-gcc -Wall -pthread -o prog prog.c -lpigpiod_if2 -lrt
-.br
-
-.EE
-
-.br
-
-.br
-to run make sure the pigpio daemon is running
-
-.br
-
-.br
-
-.EX
-sudo pigpiod
-.br
-
-.br
- ./prog # sudo is not required to run programs linked to pigpiod_if2
-.br
-
-.EE
-
-.br
-
-.br
-For examples see x_pigpiod_if2.c within the pigpio archive file.
-
-.br
-
-.br
-.SS Notes
-.br
-
-.br
-All the functions which return an int return < 0 on error
-
-.br
-
-.br
-
-.SH OVERVIEW
-
-.br
-.SS ESSENTIAL
-.br
-
-.br
-pigpio_start Connects to a pigpio daemon
-.br
-pigpio_stop Disconnects from a pigpio daemon
-.br
-.SS BASIC
-.br
-
-.br
-set_mode Set a GPIO mode
-.br
-get_mode Get a GPIO mode
-.br
-
-.br
-set_pull_up_down Set/clear GPIO pull up/down resistor
-.br
-
-.br
-gpio_read Read a GPIO
-.br
-gpio_write Write a GPIO
-.br
-.SS PWM (overrides servo commands on same GPIO)
-.br
-
-.br
-set_PWM_dutycycle Start/stop PWM pulses on a GPIO
-.br
-set_PWM_frequency Configure PWM frequency for a GPIO
-.br
-set_PWM_range Configure PWM range for a GPIO
-.br
-
-.br
-get_PWM_dutycycle Get the PWM dutycycle in use on a GPIO
-.br
-get_PWM_frequency Get configured PWM frequency for a GPIO
-.br
-get_PWM_range Get configured PWM range for a GPIO
-.br
-
-.br
-get_PWM_real_range Get underlying PWM range for a GPIO
-.br
-.SS Servo (overrides PWM commands on same GPIO)
-.br
-
-.br
-set_servo_pulsewidth Start/stop servo pulses on a GPIO
-.br
-
-.br
-get_servo_pulsewidth Get the servo pulsewidth in use on a GPIO
-.br
-.SS INTERMEDIATE
-.br
-
-.br
-gpio_trigger Send a trigger pulse to a GPIO.
-.br
-
-.br
-set_watchdog Set a watchdog on a GPIO.
-.br
-
-.br
-read_bank_1 Read all GPIO in bank 1
-.br
-read_bank_2 Read all GPIO in bank 2
-.br
-
-.br
-clear_bank_1 Clear selected GPIO in bank 1
-.br
-clear_bank_2 Clear selected GPIO in bank 2
-.br
-
-.br
-set_bank_1 Set selected GPIO in bank 1
-.br
-set_bank_2 Set selected GPIO in bank 2
-.br
-
-.br
-callback Create GPIO level change callback
-.br
-callback_ex Create GPIO level change callback, extended
-.br
-
-.br
-callback_cancel Cancel a callback
-.br
-
-.br
-wait_for_edge Wait for GPIO level change
-.br
-
-.br
-start_thread Start a new thread
-.br
-stop_thread Stop a previously started thread
-.br
-.SS ADVANCED
-.br
-
-.br
-notify_open Request a notification handle
-.br
-notify_begin Start notifications for selected GPIO
-.br
-notify_pause Pause notifications
-.br
-notify_close Close a notification
-.br
-
-.br
-hardware_clock Start hardware clock on supported GPIO
-.br
-
-.br
-hardware_PWM Start hardware PWM on supported GPIO
-.br
-
-.br
-set_glitch_filter Set a glitch filter on a GPIO
-.br
-set_noise_filter Set a noise filter on a GPIO
-.br
-
-.br
-set_pad_strength Sets a pads drive strength
-.br
-get_pad_strength Gets a pads drive strength
-.br
-
-.br
-shell_ Executes a shell command
-.br
-.SS Custom
-.br
-
-.br
-custom_1 User custom function 1
-.br
-custom_2 User custom function 2
-.br
-.SS Events
-.br
-
-.br
-event_callback Sets a callback for an event
-.br
-event_callback_ex Sets a callback for an event, extended
-.br
-
-.br
-event_callback_cancel Cancel an event callback
-.br
-
-.br
-event_trigger Triggers an event
-.br
-
-.br
-wait_for_event Wait for an event
-.br
-.SS Scripts
-.br
-
-.br
-store_script Store a script
-.br
-run_script Run a stored script
-.br
-update_script Set a scripts parameters
-.br
-script_status Get script status and parameters
-.br
-stop_script Stop a running script
-.br
-delete_script Delete a stored script
-.br
-.SS I2C
-.br
-
-.br
-i2c_open Opens an I2C device
-.br
-i2c_close Closes an I2C device
-.br
-
-.br
-i2c_write_quick smbus write quick
-.br
-
-.br
-i2c_read_byte smbus read byte
-.br
-i2c_write_byte smbus write byte
-.br
-
-.br
-i2c_read_byte_data smbus read byte data
-.br
-i2c_write_byte_data smbus write byte data
-.br
-
-.br
-i2c_read_word_data smbus read word data
-.br
-i2c_write_word_data smbus write word data
-.br
-
-.br
-i2c_read_block_data smbus read block data
-.br
-i2c_write_block_data smbus write block data
-.br
-
-.br
-i2c_read_i2c_block_data smbus read I2C block data
-.br
-i2c_write_i2c_block_data smbus write I2C block data
-.br
-
-.br
-i2c_read_device Reads the raw I2C device
-.br
-i2c_write_device Writes the raw I2C device
-.br
-
-.br
-i2c_process_call smbus process call
-.br
-i2c_block_process_call smbus block process call
-.br
-
-.br
-i2c_zip Performs multiple I2C transactions
-.br
-.SS I2C BIT BANG
-.br
-
-.br
-bb_i2c_open Opens GPIO for bit banging I2C
-.br
-bb_i2c_close Closes GPIO for bit banging I2C
-.br
-
-.br
-bb_i2c_zip Performs bit banged I2C transactions
-.br
-.SS I2C/SPI SLAVE
-.br
-
-.br
-bsc_xfer I2C/SPI as slave transfer
-.br
-bsc_i2c I2C as slave transfer
-.br
-.SS SERIAL
-.br
-
-.br
-serial_open Opens a serial device
-.br
-serial_close Closes a serial device
-.br
-
-.br
-serial_read_byte Reads a byte from a serial device
-.br
-serial_write_byte Writes a byte to a serial device
-.br
-
-.br
-serial_read Reads bytes from a serial device
-.br
-serial_write Writes bytes to a serial device
-.br
-
-.br
-serial_data_available Returns number of bytes ready to be read
-.br
-.SS SERIAL BIT BANG (read only)
-.br
-
-.br
-bb_serial_read_open Opens a GPIO for bit bang serial reads
-.br
-bb_serial_read_close Closes a GPIO for bit bang serial reads
-.br
-
-.br
-bb_serial_invert Invert serial logic (1 invert, 0 normal)
-.br
-
-.br
-bb_serial_read Reads bit bang serial data from a GPIO
-.br
-.SS SPI
-.br
-
-.br
-spi_open Opens a SPI device
-.br
-spi_close Closes a SPI device
-.br
-
-.br
-spi_read Reads bytes from a SPI device
-.br
-spi_write Writes bytes to a SPI device
-.br
-spi_xfer Transfers bytes with a SPI device
-.br
-.SS SPI BIT BANG
-.br
-
-.br
-bb_spi_open Opens GPIO for bit banging SPI
-.br
-bb_spi_close Closes GPIO for bit banging SPI
-.br
-
-.br
-bb_spi_xfer Transfers bytes with bit banging SPI
-.br
-.SS FILES
-.br
-
-.br
-file_open Opens a file
-.br
-file_close Closes a file
-.br
-
-.br
-file_read Reads bytes from a file
-.br
-file_write Writes bytes to a file
-.br
-
-.br
-file_seek Seeks to a position within a file
-.br
-
-.br
-file_list List files which match a pattern
-.br
-.SS WAVES
-.br
-
-.br
-wave_clear Deletes all waveforms
-.br
-
-.br
-wave_add_new Starts a new waveform
-.br
-wave_add_generic Adds a series of pulses to the waveform
-.br
-wave_add_serial Adds serial data to the waveform
-.br
-
-.br
-wave_create Creates a waveform from added data
-.br
-wave_create_and_pad Creates a waveform of fixed size from added data
-.br
-wave_delete Deletes one or more waveforms
-.br
-
-.br
-wave_send_once Transmits a waveform once
-.br
-wave_send_repeat Transmits a waveform repeatedly
-.br
-wave_send_using_mode Transmits a waveform in the chosen mode
-.br
-
-.br
-wave_chain Transmits a chain of waveforms
-.br
-
-.br
-wave_tx_at Returns the current transmitting waveform
-.br
-
-.br
-wave_tx_busy Checks to see if the waveform has ended
-.br
-
-.br
-wave_tx_stop Aborts the current waveform
-.br
-
-.br
-wave_get_cbs Length in cbs of the current waveform
-.br
-wave_get_high_cbs Length of longest waveform so far
-.br
-wave_get_max_cbs Absolute maximum allowed cbs
-.br
-
-.br
-wave_get_micros Length in micros of the current waveform
-.br
-wave_get_high_micros Length of longest waveform so far
-.br
-wave_get_max_micros Absolute maximum allowed micros
-.br
-
-.br
-wave_get_pulses Length in pulses of the current waveform
-.br
-wave_get_high_pulses Length of longest waveform so far
-.br
-wave_get_max_pulses Absolute maximum allowed pulses
-.br
-.SS UTILITIES
-.br
-
-.br
-get_current_tick Get current tick (microseconds)
-.br
-
-.br
-get_hardware_revision Get hardware revision
-.br
-get_pigpio_version Get the pigpio version
-.br
-pigpiod_if_version Get the pigpiod_if2 version
-.br
-
-.br
-pigpio_error Get a text description of an error code.
-.br
-
-.br
-time_sleep Sleeps for a float number of seconds
-.br
-time_time Float number of seconds since the epoch
-.br
-.SH FUNCTIONS
-
-.IP "\fBdouble time_time(void)\fP"
-.IP "" 4
-Return the current time in seconds since the Epoch.
-
-.IP "\fBvoid time_sleep(double seconds)\fP"
-.IP "" 4
-Delay execution for a given number of seconds.
-
-.br
-
-.br
-
-.EX
-seconds: the number of seconds to delay.
-.br
-
-.EE
-
-.IP "\fBchar *pigpio_error(int errnum)\fP"
-.IP "" 4
-Return a text description for an error code.
-
-.br
-
-.br
-
-.EX
-errnum: the error code.
-.br
-
-.EE
-
-.IP "\fBunsigned pigpiod_if_version(void)\fP"
-.IP "" 4
-Return the pigpiod_if2 version.
-
-.IP "\fBpthread_t *start_thread(gpioThreadFunc_t thread_func, void *userdata)\fP"
-.IP "" 4
-Starts a new thread of execution with thread_func as the main routine.
-
-.br
-
-.br
-
-.EX
-thread_func: the main function for the new thread.
-.br
- userdata: a pointer to an arbitrary argument.
-.br
-
-.EE
-
-.br
-
-.br
-Returns a pointer to pthread_t if OK, otherwise NULL.
-
-.br
-
-.br
-The function is passed the single argument userdata.
-
-.br
-
-.br
-The thread can be cancelled by passing the pointer to pthread_t to
-\fBstop_thread\fP.
-
-.IP "\fBvoid stop_thread(pthread_t *pth)\fP"
-.IP "" 4
-Cancels the thread pointed at by pth.
-
-.br
-
-.br
-
-.EX
-pth: the thread to be stopped.
-.br
-
-.EE
-
-.br
-
-.br
-No value is returned.
-
-.br
-
-.br
-The thread to be stopped should have been started with \fBstart_thread\fP.
-
-.IP "\fBint pigpio_start(char *addrStr, char *portStr)\fP"
-.IP "" 4
-Connect to the pigpio daemon. Reserving command and
-notification streams.
-
-.br
-
-.br
-
-.EX
-addrStr: specifies the host or IP address of the Pi running the
-.br
- pigpio daemon. It may be NULL in which case localhost
-.br
- is used unless overridden by the PIGPIO_ADDR environment
-.br
- variable.
-.br
-
-.br
-portStr: specifies the port address used by the Pi running the
-.br
- pigpio daemon. It may be NULL in which case "8888"
-.br
- is used unless overridden by the PIGPIO_PORT environment
-.br
- variable.
-.br
-
-.EE
-
-.br
-
-.br
-Returns an integer value greater than or equal to zero if OK.
-
-.br
-
-.br
-This value is passed to the GPIO routines to specify the Pi
-to be operated on.
-
-.IP "\fBvoid pigpio_stop(int pi)\fP"
-.IP "" 4
-Terminates the connection to a pigpio daemon and releases
-resources used by the library.
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-
-.EE
-
-.IP "\fBint set_mode(int pi, unsigned gpio, unsigned mode)\fP"
-.IP "" 4
-Set the GPIO mode.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-gpio: 0-53.
-.br
-mode: PI_INPUT, PI_OUTPUT, PI_ALT0, PI_ALT1,
-.br
- PI_ALT2, PI_ALT3, PI_ALT4, PI_ALT5.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_MODE,
-or PI_NOT_PERMITTED.
-
-.IP "\fBint get_mode(int pi, unsigned gpio)\fP"
-.IP "" 4
-Get the GPIO mode.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-gpio: 0-53.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the GPIO mode if OK, otherwise PI_BAD_GPIO.
-
-.IP "\fBint set_pull_up_down(int pi, unsigned gpio, unsigned pud)\fP"
-.IP "" 4
-Set or clear the GPIO pull-up/down resistor.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-gpio: 0-53.
-.br
- pud: PI_PUD_UP, PI_PUD_DOWN, PI_PUD_OFF.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_PUD,
-or PI_NOT_PERMITTED.
-
-.IP "\fBint gpio_read(int pi, unsigned gpio)\fP"
-.IP "" 4
-Read the GPIO level.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-gpio:0-53.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the GPIO level if OK, otherwise PI_BAD_GPIO.
-
-.IP "\fBint gpio_write(int pi, unsigned gpio, unsigned level)\fP"
-.IP "" 4
-Write the GPIO level.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- gpio: 0-53.
-.br
-level: 0, 1.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_LEVEL,
-or PI_NOT_PERMITTED.
-
-.br
-
-.br
-Notes
-
-.br
-
-.br
-If PWM or servo pulses are active on the GPIO they are switched off.
-
-.IP "\fBint set_PWM_dutycycle(int pi, unsigned user_gpio, unsigned dutycycle)\fP"
-.IP "" 4
-Start (non-zero dutycycle) or stop (0) PWM pulses on the GPIO.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-user_gpio: 0-31.
-.br
-dutycycle: 0-range (range defaults to 255).
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_DUTYCYCLE,
-or PI_NOT_PERMITTED.
-Notes
-
-.br
-
-.br
-The \fBset_PWM_range\fP function may be used to change the
-default range of 255.
-
-.IP "\fBint get_PWM_dutycycle(int pi, unsigned user_gpio)\fP"
-.IP "" 4
-Return the PWM dutycycle in use on a GPIO.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-user_gpio: 0-31.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_NOT_PWM_GPIO.
-
-.br
-
-.br
-For normal PWM the dutycycle will be out of the defined range
-for the GPIO (see \fBget_PWM_range\fP).
-
-.br
-
-.br
-If a hardware clock is active on the GPIO the reported dutycycle
-will be 500000 (500k) out of 1000000 (1M).
-
-.br
-
-.br
-If hardware PWM is active on the GPIO the reported dutycycle
-will be out of a 1000000 (1M).
-
-.IP "\fBint set_PWM_range(int pi, unsigned user_gpio, unsigned range)\fP"
-.IP "" 4
-Set the range of PWM values to be used on the GPIO.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-user_gpio: 0-31.
-.br
- range: 25-40000.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_DUTYRANGE,
-or PI_NOT_PERMITTED.
-
-.br
-
-.br
-Notes
-
-.br
-
-.br
-If PWM is currently active on the GPIO its dutycycle will be
-scaled to reflect the new range.
-
-.br
-
-.br
-The real range, the number of steps between fully off and fully on
-for each of the 18 available GPIO frequencies is
-
-.br
-
-.br
-
-.EX
- 25(#1), 50(#2), 100(#3), 125(#4), 200(#5), 250(#6),
-.br
- 400(#7), 500(#8), 625(#9), 800(#10), 1000(#11), 1250(#12),
-.br
-2000(#13), 2500(#14), 4000(#15), 5000(#16), 10000(#17), 20000(#18)
-.br
-
-.EE
-
-.br
-
-.br
-The real value set by set_PWM_range is (dutycycle * real range) / range.
-
-.IP "\fBint get_PWM_range(int pi, unsigned user_gpio)\fP"
-.IP "" 4
-Get the range of PWM values being used on the GPIO.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-user_gpio: 0-31.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the dutycycle range used for the GPIO if OK,
-otherwise PI_BAD_USER_GPIO.
-
-.br
-
-.br
-If a hardware clock or hardware PWM is active on the GPIO the
-reported range will be 1000000 (1M).
-
-.IP "\fBint get_PWM_real_range(int pi, unsigned user_gpio)\fP"
-.IP "" 4
-Get the real underlying range of PWM values being used on the GPIO.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-user_gpio: 0-31.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the real range used for the GPIO if OK,
-otherwise PI_BAD_USER_GPIO.
-
-.br
-
-.br
-If a hardware clock is active on the GPIO the reported
-real range will be 1000000 (1M).
-
-.br
-
-.br
-If hardware PWM is active on the GPIO the reported real range
-will be approximately 250M divided by the set PWM frequency.
-
-.br
-
-.br
-
-.IP "\fBint set_PWM_frequency(int pi, unsigned user_gpio, unsigned frequency)\fP"
-.IP "" 4
-Set the frequency (in Hz) of the PWM to be used on the GPIO.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-user_gpio: 0-31.
-.br
-frequency: >=0 (Hz).
-.br
-
-.EE
-
-.br
-
-.br
-Returns the numerically closest frequency if OK, otherwise
-PI_BAD_USER_GPIO or PI_NOT_PERMITTED.
-
-.br
-
-.br
-If PWM is currently active on the GPIO it will be switched
-off and then back on at the new frequency.
-
-.br
-
-.br
-Each GPIO can be independently set to one of 18 different
-PWM frequencies.
-
-.br
-
-.br
-The selectable frequencies depend upon the sample rate which
-may be 1, 2, 4, 5, 8, or 10 microseconds (default 5). The
-sample rate is set when the pigpio daemon is started.
-
-.br
-
-.br
-The frequencies for each sample rate are:
-
-.br
-
-.br
-
-.EX
- Hertz
-.br
-
-.br
- 1: 40000 20000 10000 8000 5000 4000 2500 2000 1600
-.br
- 1250 1000 800 500 400 250 200 100 50
-.br
-
-.br
- 2: 20000 10000 5000 4000 2500 2000 1250 1000 800
-.br
- 625 500 400 250 200 125 100 50 25
-.br
-
-.br
- 4: 10000 5000 2500 2000 1250 1000 625 500 400
-.br
- 313 250 200 125 100 63 50 25 13
-.br
-sample
-.br
- rate
-.br
- (us) 5: 8000 4000 2000 1600 1000 800 500 400 320
-.br
- 250 200 160 100 80 50 40 20 10
-.br
-
-.br
- 8: 5000 2500 1250 1000 625 500 313 250 200
-.br
- 156 125 100 63 50 31 25 13 6
-.br
-
-.br
- 10: 4000 2000 1000 800 500 400 250 200 160
-.br
- 125 100 80 50 40 25 20 10 5
-.br
-
-.EE
-
-.IP "\fBint get_PWM_frequency(int pi, unsigned user_gpio)\fP"
-.IP "" 4
-Get the frequency of PWM being used on the GPIO.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-user_gpio: 0-31.
-.br
-
-.EE
-
-.br
-
-.br
-For normal PWM the frequency will be that defined for the GPIO by
-\fBset_PWM_frequency\fP.
-
-.br
-
-.br
-If a hardware clock is active on the GPIO the reported frequency
-will be that set by \fBhardware_clock\fP.
-
-.br
-
-.br
-If hardware PWM is active on the GPIO the reported frequency
-will be that set by \fBhardware_PWM\fP.
-
-.br
-
-.br
-Returns the frequency (in hertz) used for the GPIO if OK,
-otherwise PI_BAD_USER_GPIO.
-
-.IP "\fBint set_servo_pulsewidth(int pi, unsigned user_gpio, unsigned pulsewidth)\fP"
-.IP "" 4
-Start (500-2500) or stop (0) servo pulses on the GPIO.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- user_gpio: 0-31.
-.br
-pulsewidth: 0 (off), 500 (anti-clockwise) - 2500 (clockwise).
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_PULSEWIDTH or
-PI_NOT_PERMITTED.
-
-.br
-
-.br
-The selected pulsewidth will continue to be transmitted until
-changed by a subsequent call to set_servo_pulsewidth.
-
-.br
-
-.br
-The pulsewidths supported by servos varies and should probably be
-determined by experiment. A value of 1500 should always be safe and
-represents the mid-point of rotation.
-
-.br
-
-.br
-You can DAMAGE a servo if you command it to move beyond its limits.
-
-.br
-
-.br
-OTHER UPDATE RATES:
-
-.br
-
-.br
-This function updates servos at 50Hz. If you wish to use a different
-update frequency you will have to use the PWM functions.
-
-.br
-
-.br
-
-.EX
-Update Rate (Hz) 50 100 200 400 500
-.br
-1E6/Hz 20000 10000 5000 2500 2000
-.br
-
-.EE
-
-.br
-
-.br
-Firstly set the desired PWM frequency using \fBset_PWM_frequency\fP.
-
-.br
-
-.br
-Then set the PWM range using \fBset_PWM_range\fP to 1E6/Hz.
-Doing this allows you to use units of microseconds when setting
-the servo pulsewidth.
-
-.br
-
-.br
-E.g. If you want to update a servo connected to GPIO 25 at 400Hz
-
-.br
-
-.br
-
-.EX
-set_PWM_frequency(25, 400);
-.br
-set_PWM_range(25, 2500);
-.br
-
-.EE
-
-.br
-
-.br
-Thereafter use the \fBset_PWM_dutycycle\fP function to move the servo,
-e.g. set_PWM_dutycycle(25, 1500) will set a 1500 us pulse.
-.br
-
-.IP "\fBint get_servo_pulsewidth(int pi, unsigned user_gpio)\fP"
-.IP "" 4
-Return the servo pulsewidth in use on a GPIO.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-user_gpio: 0-31.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_NOT_SERVO_GPIO.
-
-.IP "\fBint notify_open(int pi)\fP"
-.IP "" 4
-Get a free notification handle.
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-
-.EE
-
-.br
-
-.br
-Returns a handle greater than or equal to zero if OK,
-otherwise PI_NO_HANDLE.
-
-.br
-
-.br
-A notification is a method for being notified of GPIO state
-changes via a pipe.
-
-.br
-
-.br
-Pipes are only accessible from the local machine so this function
-serves no purpose if you are using the library from a remote machine.
-The in-built (socket) notifications provided by \fBcallback\fP
-should be used instead.
-
-.br
-
-.br
-Notifications for handle x will be available at the pipe
-named /dev/pigpiox (where x is the handle number).
-E.g. if the function returns 15 then the notifications must be
-read from /dev/pigpio15.
-
-.IP "\fBint notify_begin(int pi, unsigned handle, uint32_t bits)\fP"
-.IP "" 4
-Start notifications on a previously opened handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: 0-31 (as returned by \fBnotify_open\fP)
-.br
- bits: a mask indicating the GPIO to be notified.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE.
-
-.br
-
-.br
-The notification sends state changes for each GPIO whose
-corresponding bit in bits is set.
-
-.br
-
-.br
-Each notification occupies 12 bytes in the fifo as follows:
-
-.br
-
-.br
-
-.EX
-typedef struct
-.br
-{
-.br
- uint16_t seqno;
-.br
- uint16_t flags;
-.br
- uint32_t tick;
-.br
- uint32_t level;
-.br
-} gpioReport_t;
-.br
-
-.EE
-
-.br
-
-.br
-seqno: starts at 0 each time the handle is opened and then increments
-by one for each report.
-
-.br
-
-.br
-flags: three flags are defined, PI_NTFY_FLAGS_WDOG,
-PI_NTFY_FLAGS_ALIVE, and PI_NTFY_FLAGS_EVENT.
-
-.br
-
-.br
-If bit 5 is set (PI_NTFY_FLAGS_WDOG) then bits 0-4 of the flags
-indicate a GPIO which has had a watchdog timeout.
-
-.br
-
-.br
-If bit 6 is set (PI_NTFY_FLAGS_ALIVE) this indicates a keep alive
-signal on the pipe/socket and is sent once a minute in the absence
-of other notification activity.
-
-.br
-
-.br
-If bit 7 is set (PI_NTFY_FLAGS_EVENT) then bits 0-4 of the flags
-indicate an event which has been triggered.
-
-.br
-
-.br
-tick: the number of microseconds since system boot. It wraps around
-after 1h12m.
-
-.br
-
-.br
-level: indicates the level of each GPIO. If bit 1<<x is set then
-GPIO x is high.
-
-.IP "\fBint notify_pause(int pi, unsigned handle)\fP"
-.IP "" 4
-Pause notifications on a previously opened handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: 0-31 (as returned by \fBnotify_open\fP)
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE.
-
-.br
-
-.br
-Notifications for the handle are suspended until
-\fBnotify_begin\fP is called again.
-
-.IP "\fBint notify_close(int pi, unsigned handle)\fP"
-.IP "" 4
-Stop notifications on a previously opened handle and
-release the handle for reuse.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: 0-31 (as returned by \fBnotify_open\fP)
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE.
-
-.IP "\fBint set_watchdog(int pi, unsigned user_gpio, unsigned timeout)\fP"
-.IP "" 4
-Sets a watchdog for a GPIO.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-user_gpio: 0-31.
-.br
- timeout: 0-60000.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO
-or PI_BAD_WDOG_TIMEOUT.
-
-.br
-
-.br
-The watchdog is nominally in milliseconds.
-
-.br
-
-.br
-Only one watchdog may be registered per GPIO.
-
-.br
-
-.br
-The watchdog may be cancelled by setting timeout to 0.
-
-.br
-
-.br
-Once a watchdog has been started callbacks for the GPIO will be
-triggered every timeout interval after the last GPIO activity.
-
-.br
-
-.br
-The callback will receive the special level PI_TIMEOUT.
-
-.IP "\fBint set_glitch_filter(int pi, unsigned user_gpio, unsigned steady)\fP"
-.IP "" 4
-Sets a glitch filter on a GPIO.
-
-.br
-
-.br
-Level changes on the GPIO are not reported unless the level
-has been stable for at least \fBsteady\fP microseconds. The
-level is then reported. Level changes of less than
-\fBsteady\fP microseconds are ignored.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-user_gpio: 0-31
-.br
- steady: 0-300000
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
-
-.br
-
-.br
-This filter affects the GPIO samples returned to callbacks set up
-with \fBcallback\fP, \fBcallback_ex\fP and \fBwait_for_edge\fP.
-
-.br
-
-.br
-It does not affect levels read by \fBgpio_read\fP,
-\fBread_bank_1\fP, or \fBread_bank_2\fP.
-
-.br
-
-.br
-Each (stable) edge will be timestamped \fBsteady\fP microseconds
-after it was first detected.
-
-.IP "\fBint set_noise_filter(int pi, unsigned user_gpio, unsigned steady, unsigned active)\fP"
-.IP "" 4
-Sets a noise filter on a GPIO.
-
-.br
-
-.br
-Level changes on the GPIO are ignored until a level which has
-been stable for \fBsteady\fP microseconds is detected. Level changes
-on the GPIO are then reported for \fBactive\fP microseconds after
-which the process repeats.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-user_gpio: 0-31
-.br
- steady: 0-300000
-.br
- active: 0-1000000
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
-
-.br
-
-.br
-This filter affects the GPIO samples returned to callbacks set up
-with \fBcallback\fP, \fBcallback_ex\fP and \fBwait_for_edge\fP.
-
-.br
-
-.br
-It does not affect levels read by \fBgpio_read\fP,
-\fBread_bank_1\fP, or \fBread_bank_2\fP.
-
-.br
-
-.br
-Level changes before and after the active period may
-be reported. Your software must be designed to cope with
-such reports.
-
-.IP "\fBuint32_t read_bank_1(int pi)\fP"
-.IP "" 4
-Read the levels of the bank 1 GPIO (GPIO 0-31).
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-
-.EE
-
-.br
-
-.br
-The returned 32 bit integer has a bit set if the corresponding
-GPIO is logic 1. GPIO n has bit value (1<<n).
-
-.IP "\fBuint32_t read_bank_2(int pi)\fP"
-.IP "" 4
-Read the levels of the bank 2 GPIO (GPIO 32-53).
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-
-.EE
-
-.br
-
-.br
-The returned 32 bit integer has a bit set if the corresponding
-GPIO is logic 1. GPIO n has bit value (1<<(n-32)).
-
-.IP "\fBint clear_bank_1(int pi, uint32_t bits)\fP"
-.IP "" 4
-Clears GPIO 0-31 if the corresponding bit in bits is set.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-bits: a bit mask with 1 set if the corresponding GPIO is
-.br
- to be cleared.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-
-.br
-
-.br
-A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-
-.IP "\fBint clear_bank_2(int pi, uint32_t bits)\fP"
-.IP "" 4
-Clears GPIO 32-53 if the corresponding bit (0-21) in bits is set.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-bits: a bit mask with 1 set if the corresponding GPIO is
-.br
- to be cleared.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-
-.br
-
-.br
-A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-
-.IP "\fBint set_bank_1(int pi, uint32_t bits)\fP"
-.IP "" 4
-Sets GPIO 0-31 if the corresponding bit in bits is set.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-bits: a bit mask with 1 set if the corresponding GPIO is
-.br
- to be set.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-
-.br
-
-.br
-A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-
-.IP "\fBint set_bank_2(int pi, uint32_t bits)\fP"
-.IP "" 4
-Sets GPIO 32-53 if the corresponding bit (0-21) in bits is set.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-bits: a bit mask with 1 set if the corresponding GPIO is
-.br
- to be set.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-
-.br
-
-.br
-A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-
-.IP "\fBint hardware_clock(int pi, unsigned gpio, unsigned clkfreq)\fP"
-.IP "" 4
-Starts a hardware clock on a GPIO at the specified frequency.
-Frequencies above 30MHz are unlikely to work.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- gpio: see description
-.br
-frequency: 0 (off) or 4689-250M (13184-375M for the BCM2711)
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_NOT_PERMITTED, PI_BAD_GPIO,
-PI_NOT_HCLK_GPIO, PI_BAD_HCLK_FREQ,or PI_BAD_HCLK_PASS.
-
-.br
-
-.br
-The same clock is available on multiple GPIO. The latest
-frequency setting will be used by all GPIO which share a clock.
-
-.br
-
-.br
-The GPIO must be one of the following.
-
-.br
-
-.br
-
-.EX
-4 clock 0 All models
-.br
-5 clock 1 All models but A and B (reserved for system use)
-.br
-6 clock 2 All models but A and B
-.br
-20 clock 0 All models but A and B
-.br
-21 clock 1 All models but A and Rev.2 B (reserved for system use)
-.br
-
-.br
-32 clock 0 Compute module only
-.br
-34 clock 0 Compute module only
-.br
-42 clock 1 Compute module only (reserved for system use)
-.br
-43 clock 2 Compute module only
-.br
-44 clock 1 Compute module only (reserved for system use)
-.br
-
-.EE
-
-.br
-
-.br
-Access to clock 1 is protected by a password as its use will likely
-crash the Pi. The password is given by or'ing 0x5A000000 with the
-GPIO number.
-
-.IP "\fBint hardware_PWM(int pi, unsigned gpio, unsigned PWMfreq, uint32_t PWMduty)\fP"
-.IP "" 4
-Starts hardware PWM on a GPIO at the specified frequency and dutycycle.
-Frequencies above 30MHz are unlikely to work.
-
-.br
-
-.br
-NOTE: Any waveform started by \fBwave_send_*\fP or \fBwave_chain\fP
-will be cancelled.
-
-.br
-
-.br
-This function is only valid if the pigpio main clock is PCM. The
-main clock defaults to PCM but may be overridden when the pigpio
-daemon is started (option -t).
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- gpio: see descripton
-.br
-PWMfreq: 0 (off) or 1-125M (1-187.5M for the BCM2711)
-.br
-PWMduty: 0 (off) to 1000000 (1M)(fully on)
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_NOT_PERMITTED, PI_BAD_GPIO,
-PI_NOT_HPWM_GPIO, PI_BAD_HPWM_DUTY, PI_BAD_HPWM_FREQ,
-or PI_HPWM_ILLEGAL.
-
-.br
-
-.br
-The same PWM channel is available on multiple GPIO. The latest
-frequency and dutycycle setting will be used by all GPIO which
-share a PWM channel.
-
-.br
-
-.br
-The GPIO must be one of the following.
-
-.br
-
-.br
-
-.EX
-12 PWM channel 0 All models but A and B
-.br
-13 PWM channel 1 All models but A and B
-.br
-18 PWM channel 0 All models
-.br
-19 PWM channel 1 All models but A and B
-.br
-
-.br
-40 PWM channel 0 Compute module only
-.br
-41 PWM channel 1 Compute module only
-.br
-45 PWM channel 1 Compute module only
-.br
-52 PWM channel 0 Compute module only
-.br
-53 PWM channel 1 Compute module only
-.br
-
-.EE
-
-.br
-
-.br
-The actual number of steps beween off and fully on is the
-integral part of 250M/PWMfreq (375M/PWMfreq for the BCM2711).
-
-.br
-
-.br
-The actual frequency set is 250M/steps (375M/steps for the BCM2711).
-
-.br
-
-.br
-There will only be a million steps for a PWMfreq of 250 (375 for
-the BCM2711). Lower frequencies will have more steps and higher
-frequencies will have fewer steps. PWMduty is
-automatically scaled to take this into account.
-
-.IP "\fBuint32_t get_current_tick(int pi)\fP"
-.IP "" 4
-Gets the current system tick.
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-
-.EE
-
-.br
-
-.br
-Tick is the number of microseconds since system boot.
-
-.br
-
-.br
-As tick is an unsigned 32 bit quantity it wraps around after
-2**32 microseconds, which is approximately 1 hour 12 minutes.
-
-.br
-
-.br
-
-.IP "\fBuint32_t get_hardware_revision(int pi)\fP"
-.IP "" 4
-Get the Pi's hardware revision number.
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-
-.EE
-
-.br
-
-.br
-The hardware revision is the last few characters on the Revision line
-of /proc/cpuinfo.
-
-.br
-
-.br
-If the hardware revision can not be found or is not a valid
-hexadecimal number the function returns 0.
-
-.br
-
-.br
-The revision number can be used to determine the assignment of GPIO
-to pins (see \fBgpio\fP).
-
-.br
-
-.br
-There are at least three types of board.
-
-.br
-
-.br
-Type 1 boards have hardware revision numbers of 2 and 3.
-
-.br
-
-.br
-Type 2 boards have hardware revision numbers of 4, 5, 6, and 15.
-
-.br
-
-.br
-Type 3 boards have hardware revision numbers of 16 or greater.
-
-.IP "\fBuint32_t get_pigpio_version(int pi)\fP"
-.IP "" 4
-Returns the pigpio version.
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-
-.EE
-
-.IP "\fBint wave_clear(int pi)\fP"
-.IP "" 4
-This function clears all waveforms and any data added by calls to the
-\fBwave_add_*\fP functions.
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK.
-
-.IP "\fBint wave_add_new(int pi)\fP"
-.IP "" 4
-This function starts a new empty waveform. You wouldn't normally need
-to call this function as it is automatically called after a waveform is
-created with the \fBwave_create\fP function.
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK.
-
-.IP "\fBint wave_add_generic(int pi, unsigned numPulses, gpioPulse_t *pulses)\fP"
-.IP "" 4
-This function adds a number of pulses to the current waveform.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-numPulses: the number of pulses.
-.br
- pulses: an array of pulses.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_TOO_MANY_PULSES.
-
-.br
-
-.br
-The pulses are interleaved in time order within the existing waveform
-(if any).
-
-.br
-
-.br
-Merging allows the waveform to be built in parts, that is the settings
-for GPIO#1 can be added, and then GPIO#2 etc.
-
-.br
-
-.br
-If the added waveform is intended to start after or within the existing
-waveform then the first pulse should consist solely of a delay.
-
-.IP "\fBint wave_add_serial(int pi, unsigned user_gpio, unsigned baud, unsigned data_bits, unsigned stop_bits, unsigned offset, unsigned numBytes, char *str)\fP"
-.IP "" 4
-This function adds a waveform representing serial data to the
-existing waveform (if any). The serial data starts offset
-microseconds from the start of the waveform.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-user_gpio: 0-31.
-.br
- baud: 50-1000000
-.br
-data_bits: number of data bits (1-32)
-.br
-stop_bits: number of stop half bits (2-8)
-.br
- offset: >=0
-.br
- numBytes: >=1
-.br
- str: an array of chars.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_BAD_USER_GPIO, PI_BAD_WAVE_BAUD, PI_BAD_DATABITS,
-PI_BAD_STOP_BITS, PI_TOO_MANY_CHARS, PI_BAD_SER_OFFSET,
-or PI_TOO_MANY_PULSES.
-
-.br
-
-.br
-NOTES:
-
-.br
-
-.br
-The serial data is formatted as one start bit, \fBdata_bits\fP data bits,
-and \fBstop_bits\fP/2 stop bits.
-
-.br
-
-.br
-It is legal to add serial data streams with different baud rates to
-the same waveform.
-
-.br
-
-.br
-\fBnumBytes\fP is the number of bytes of data in str.
-
-.br
-
-.br
-The bytes required for each character depend upon \fBdata_bits\fP.
-
-.br
-
-.br
-For \fBdata_bits\fP 1-8 there will be one byte per character.
-.br
-For \fBdata_bits\fP 9-16 there will be two bytes per character.
-.br
-For \fBdata_bits\fP 17-32 there will be four bytes per character.
-
-.IP "\fBint wave_create(int pi)\fP"
-.IP "" 4
-This function creates a waveform from the data provided by the prior
-calls to the \fBwave_add_*\fP functions. Upon success a wave id
-greater than or equal to 0 is returned, otherwise PI_EMPTY_WAVEFORM,
-PI_TOO_MANY_CBS, PI_TOO_MANY_OOL, or PI_NO_WAVEFORM_ID.
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-
-.EE
-
-.br
-
-.br
-The data provided by the \fBwave_add_*\fP functions is consumed by this
-function.
-
-.br
-
-.br
-As many waveforms may be created as there is space available. The
-wave id is passed to \fBwave_send_*\fP to specify the waveform to transmit.
-
-.br
-
-.br
-Normal usage would be
-
-.br
-
-.br
-Step 1. \fBwave_clear\fP to clear all waveforms and added data.
-
-.br
-
-.br
-Step 2. \fBwave_add_*\fP calls to supply the waveform data.
-
-.br
-
-.br
-Step 3. \fBwave_create\fP to create the waveform and get a unique id
-
-.br
-
-.br
-Repeat steps 2 and 3 as needed.
-
-.br
-
-.br
-Step 4. \fBwave_send_*\fP with the id of the waveform to transmit.
-
-.br
-
-.br
-A waveform comprises one or more pulses. Each pulse consists of a
-\fBgpioPulse_t\fP structure.
-
-.br
-
-.br
-
-.EX
-typedef struct
-.br
-{
-.br
- uint32_t gpioOn;
-.br
- uint32_t gpioOff;
-.br
- uint32_t usDelay;
-.br
-} gpioPulse_t;
-.br
-
-.EE
-
-.br
-
-.br
-The fields specify
-
-.br
-
-.br
-1) the GPIO to be switched on at the start of the pulse.
-.br
-2) the GPIO to be switched off at the start of the pulse.
-.br
-3) the delay in microseconds before the next pulse.
-.br
-
-.br
-
-.br
-Any or all the fields can be zero. It doesn't make any sense to
-set all the fields to zero (the pulse will be ignored).
-
-.br
-
-.br
-When a waveform is started each pulse is executed in order with the
-specified delay between the pulse and the next.
-
-.br
-
-.br
-Returns the new waveform id if OK, otherwise PI_EMPTY_WAVEFORM,
-PI_NO_WAVEFORM_ID, PI_TOO_MANY_CBS, or PI_TOO_MANY_OOL.
-
-.IP "\fBint wave_create_and_pad(int pi, int percent)\fP"
-.IP "" 4
-This function creates a waveform like \fBwave_create\fP but pads the consumed
-resources. Where percent gives the percentage of the resources to use (in terms
-of the theoretical maximum, not the current amount free). This allows the reuse
-.br
-of deleted waves while a transmission is active.
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-percent: 0-100, size of waveform as percentage of maximum available.
-.br
-
-.EE
-
-.br
-
-.br
-The data provided by the \fBwave_add_*\fP functions are consumed by this
-function.
-
-.br
-
-.br
-As many waveforms may be created as there is space available. The
-wave id is passed to \fBwave_send_*\fP to specify the waveform to transmit.
-
-.br
-
-.br
-A usage would be the creation of two waves where one is filled while the other
-is being transmitted. Each wave is assigned 50% of the resources.
-This buffer structure allows the transmission of infinite wave sequences.
-
-.br
-
-.br
-Normal usage:
-
-.br
-
-.br
-Step 1. \fBwave_clear\fP to clear all waveforms and added data.
-
-.br
-
-.br
-Step 2. \fBwave_add_*\fP calls to supply the waveform data.
-
-.br
-
-.br
-Step 3. \fBwave_create_and_pad\fP to create a waveform of uniform size.
-
-.br
-
-.br
-Step 4. \fBwave_send_*\fP with the id of the waveform to transmit.
-
-.br
-
-.br
-Repeat steps 2-4 as needed.
-
-.br
-
-.br
-Step 5. Any wave id can now be deleted and another wave of the same size
- can be created in its place.
-
-.br
-
-.br
-Returns the new waveform id if OK, otherwise PI_EMPTY_WAVEFORM,
-PI_NO_WAVEFORM_ID, PI_TOO_MANY_CBS, or PI_TOO_MANY_OOL.
-
-.IP "\fBint wave_delete(int pi, unsigned wave_id)\fP"
-.IP "" 4
-This function deletes the waveform with id wave_id.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-wave_id: >=0, as returned by \fBwave_create\fP.
-.br
-
-.EE
-
-.br
-
-.br
-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.
-
-.IP "\fBint wave_send_once(int pi, unsigned wave_id)\fP"
-.IP "" 4
-This function transmits the waveform with id wave_id. The waveform
-is sent once.
-
-.br
-
-.br
-NOTE: Any hardware PWM started by \fBhardware_PWM\fP will be cancelled.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-wave_id: >=0, as returned by \fBwave_create\fP.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of DMA control blocks in the waveform if OK,
-otherwise PI_BAD_WAVE_ID, or PI_BAD_WAVE_MODE.
-
-.IP "\fBint wave_send_repeat(int pi, unsigned wave_id)\fP"
-.IP "" 4
-This function transmits the waveform with id wave_id. The waveform
-cycles until cancelled (either by the sending of a new waveform or
-by \fBwave_tx_stop\fP).
-
-.br
-
-.br
-NOTE: Any hardware PWM started by \fBhardware_PWM\fP will be cancelled.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-wave_id: >=0, as returned by \fBwave_create\fP.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of DMA control blocks in the waveform if OK,
-otherwise PI_BAD_WAVE_ID, or PI_BAD_WAVE_MODE.
-
-.IP "\fBint wave_send_using_mode(int pi, unsigned wave_id, unsigned mode)\fP"
-.IP "" 4
-Transmits the waveform with id wave_id using mode mode.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-wave_id: >=0, as returned by \fBwave_create\fP.
-.br
- mode: PI_WAVE_MODE_ONE_SHOT, PI_WAVE_MODE_REPEAT,
-.br
- PI_WAVE_MODE_ONE_SHOT_SYNC, or PI_WAVE_MODE_REPEAT_SYNC.
-.br
-
-.EE
-
-.br
-
-.br
-PI_WAVE_MODE_ONE_SHOT: same as \fBwave_send_once\fP.
-
-.br
-
-.br
-PI_WAVE_MODE_REPEAT same as \fBwave_send_repeat\fP.
-
-.br
-
-.br
-PI_WAVE_MODE_ONE_SHOT_SYNC same as \fBwave_send_once\fP but tries
-to sync with the previous waveform.
-
-.br
-
-.br
-PI_WAVE_MODE_REPEAT_SYNC same as \fBwave_send_repeat\fP but tries
-to sync with the previous waveform.
-
-.br
-
-.br
-WARNING: bad things may happen if you delete the previous
-waveform before it has been synced to the new waveform.
-
-.br
-
-.br
-NOTE: Any hardware PWM started by \fBhardware_PWM\fP will be cancelled.
-
-.br
-
-.br
-Returns the number of DMA control blocks in the waveform if OK,
-otherwise PI_BAD_WAVE_ID, or PI_BAD_WAVE_MODE.
-
-.IP "\fBint wave_chain(int pi, char *buf, unsigned bufSize)\fP"
-.IP "" 4
-This function transmits a chain of waveforms.
-
-.br
-
-.br
-NOTE: Any hardware PWM started by \fBhardware_PWM\fP will be cancelled.
-
-.br
-
-.br
-The waves to be transmitted are specified by the contents of buf
-which contains an ordered list of \fBwave_id\fPs and optional command
-codes and related data.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- buf: pointer to the wave_ids and optional command codes
-.br
-bufSize: the number of bytes in buf
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_CHAIN_NESTING, PI_CHAIN_LOOP_CNT, PI_BAD_CHAIN_LOOP, PI_BAD_CHAIN_CMD, PI_CHAIN_COUNTER,
-PI_BAD_CHAIN_DELAY, PI_CHAIN_TOO_BIG, or PI_BAD_WAVE_ID.
-
-.br
-
-.br
-Each wave is transmitted in the order specified. A wave may
-occur multiple times per chain.
-
-.br
-
-.br
-A blocks of waves may be transmitted multiple times by using
-the loop commands. The block is bracketed by loop start and
-end commands. Loops may be nested.
-
-.br
-
-.br
-Delays between waves may be added with the delay command.
-
-.br
-
-.br
-The following command codes are supported:
-
-.br
-
-.br
-Name Cmd & Data Meaning
-.br
-Loop Start 255 0 Identify start of a wave block
-.br
-Loop Repeat 255 1 x y loop x + y*256 times
-.br
-Delay 255 2 x y delay x + y*256 microseconds
-.br
-Loop Forever 255 3 loop forever
-.br
-
-.br
-
-.br
-If present Loop Forever must be the last entry in the chain.
-
-.br
-
-.br
-The code is currently dimensioned to support a chain with roughly
-600 entries and 20 loop counters.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-#include <stdio.h>
-.br
-#include <pigpiod_if2.h>
-.br
-
-.br
-#define WAVES 5
-.br
-#define GPIO 4
-.br
-
-.br
-int main(int argc, char *argv[])
-.br
-{
-.br
- int i, pi, wid[WAVES];
-.br
-
-.br
- pi = pigpio_start(0, 0);
-.br
- if (pi<0) return -1;
-.br
-
-.br
- set_mode(pi, GPIO, PI_OUTPUT);
-.br
-
-.br
- for (i=0; i<WAVES; i++)
-.br
- {
-.br
- wave_add_generic(pi, 2, (gpioPulse_t[])
-.br
- {{1<<GPIO, 0, 20},
-.br
- {0, 1<<GPIO, (i+1)*200}});
-.br
-
-.br
- wid[i] = wave_create(pi);
-.br
- }
-.br
-
-.br
- wave_chain(pi, (char []) {
-.br
- wid[4], wid[3], wid[2], // transmit waves 4+3+2
-.br
- 255, 0, // loop start
-.br
- wid[0], wid[0], wid[0], // transmit waves 0+0+0
-.br
- 255, 0, // loop start
-.br
- wid[0], wid[1], // transmit waves 0+1
-.br
- 255, 2, 0x88, 0x13, // delay 5000us
-.br
- 255, 1, 30, 0, // loop end (repeat 30 times)
-.br
- 255, 0, // loop start
-.br
- wid[2], wid[3], wid[0], // transmit waves 2+3+0
-.br
- wid[3], wid[1], wid[2], // transmit waves 3+1+2
-.br
- 255, 1, 10, 0, // loop end (repeat 10 times)
-.br
- 255, 1, 5, 0, // loop end (repeat 5 times)
-.br
- wid[4], wid[4], wid[4], // transmit waves 4+4+4
-.br
- 255, 2, 0x20, 0x4E, // delay 20000us
-.br
- wid[0], wid[0], wid[0], // transmit waves 0+0+0
-.br
-
-.br
- }, 46);
-.br
-
-.br
- while (wave_tx_busy(pi)) time_sleep(0.1);
-.br
-
-.br
- for (i=0; i<WAVES; i++) wave_delete(pi, wid[i]);
-.br
-
-.br
- pigpio_stop(pi);
-.br
-}
-.br
-
-.EE
-
-.IP "\fBint wave_tx_at(int pi)\fP"
-.IP "" 4
-This function returns the id of the waveform currently being
-transmitted.
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-
-.EE
-
-.br
-
-.br
-Returns the waveform id or one of the following special values:
-
-.br
-
-.br
-PI_WAVE_NOT_FOUND (9998) - transmitted wave not found.
-.br
-PI_NO_TX_WAVE (9999) - no wave being transmitted.
-
-.IP "\fBint wave_tx_busy(int pi)\fP"
-.IP "" 4
-This function checks to see if a waveform is currently being
-transmitted.
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-
-.EE
-
-.br
-
-.br
-Returns 1 if a waveform is currently being transmitted, otherwise 0.
-
-.IP "\fBint wave_tx_stop(int pi)\fP"
-.IP "" 4
-This function stops the transmission of the current waveform.
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK.
-
-.br
-
-.br
-This function is intended to stop a waveform started with the repeat mode.
-
-.IP "\fBint wave_get_micros(int pi)\fP"
-.IP "" 4
-This function returns the length in microseconds of the current
-waveform.
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-
-.EE
-
-.IP "\fBint wave_get_high_micros(int pi)\fP"
-.IP "" 4
-This function returns the length in microseconds of the longest waveform
-created since the pigpio daemon was started.
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-
-.EE
-
-.IP "\fBint wave_get_max_micros(int pi)\fP"
-.IP "" 4
-This function returns the maximum possible size of a waveform in
-.br
-microseconds.
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-
-.EE
-
-.IP "\fBint wave_get_pulses(int pi)\fP"
-.IP "" 4
-This function returns the length in pulses of the current waveform.
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-
-.EE
-
-.IP "\fBint wave_get_high_pulses(int pi)\fP"
-.IP "" 4
-This function returns the length in pulses of the longest waveform
-created since the pigpio daemon was started.
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-
-.EE
-
-.IP "\fBint wave_get_max_pulses(int pi)\fP"
-.IP "" 4
-This function returns the maximum possible size of a waveform in pulses.
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-
-.EE
-
-.IP "\fBint wave_get_cbs(int pi)\fP"
-.IP "" 4
-This function returns the length in DMA control blocks of the current
-waveform.
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-
-.EE
-
-.IP "\fBint wave_get_high_cbs(int pi)\fP"
-.IP "" 4
-This function returns the length in DMA control blocks of the longest
-waveform created since the pigpio daemon was started.
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-
-.EE
-
-.IP "\fBint wave_get_max_cbs(int pi)\fP"
-.IP "" 4
-This function returns the maximum possible size of a waveform in DMA
-control blocks.
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-
-.EE
-
-.IP "\fBint gpio_trigger(int pi, unsigned user_gpio, unsigned pulseLen, unsigned level)\fP"
-.IP "" 4
-This function sends a trigger pulse to a GPIO. The GPIO is set to
-level for pulseLen microseconds and then reset to not level.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-user_gpio: 0-31.
-.br
- pulseLen: 1-100.
-.br
- level: 0,1.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_LEVEL,
-PI_BAD_PULSELEN, or PI_NOT_PERMITTED.
-
-.IP "\fBint store_script(int pi, char *script)\fP"
-.IP "" 4
-This function stores a script for later execution.
-
-.br
-
-.br
-See \fBhttp://abyz.me.uk/rpi/pigpio/pigs.html#Scripts\fP for details.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-script: the text of the script.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns a script id if the script is valid,
-otherwise PI_BAD_SCRIPT.
-
-.IP "\fBint run_script(int pi, unsigned script_id, unsigned numPar, uint32_t *param)\fP"
-.IP "" 4
-This function runs a stored script.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-script_id: >=0, as returned by \fBstore_script\fP.
-.br
- numPar: 0-10, the number of parameters.
-.br
- param: an array of parameters.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID, or
-PI_TOO_MANY_PARAM
-
-.br
-
-.br
-param is an array of up to 10 parameters which may be referenced in
-the script as p0 to p9.
-
-.IP "\fBint update_script(int pi, unsigned script_id, unsigned numPar, uint32_t *param)\fP"
-.IP "" 4
-This function sets the parameters of a script. The script may or
-may not be running. The first numPar parameters of the script are
-overwritten with the new values.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-script_id: >=0, as returned by \fBstore_script\fP.
-.br
- numPar: 0-10, the number of parameters.
-.br
- param: an array of parameters.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID, or
-PI_TOO_MANY_PARAM.
-
-.br
-
-.br
-param is an array of up to 10 parameters which may be referenced in
-the script as p0 to p9.
-
-.IP "\fBint script_status(int pi, unsigned script_id, uint32_t *param)\fP"
-.IP "" 4
-This function returns the run status of a stored script as well
-as the current values of parameters 0 to 9.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-script_id: >=0, as returned by \fBstore_script\fP.
-.br
- param: an array to hold the returned 10 parameters.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns greater than or equal to 0 if OK,
-otherwise PI_BAD_SCRIPT_ID.
-
-.br
-
-.br
-The run status may be
-
-.br
-
-.br
-
-.EX
-PI_SCRIPT_INITING
-.br
-PI_SCRIPT_HALTED
-.br
-PI_SCRIPT_RUNNING
-.br
-PI_SCRIPT_WAITING
-.br
-PI_SCRIPT_FAILED
-.br
-
-.EE
-
-.br
-
-.br
-The current value of script parameters 0 to 9 are returned in param.
-
-.IP "\fBint stop_script(int pi, unsigned script_id)\fP"
-.IP "" 4
-This function stops a running script.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-script_id: >=0, as returned by \fBstore_script\fP.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID.
-
-.IP "\fBint delete_script(int pi, unsigned script_id)\fP"
-.IP "" 4
-This function deletes a stored script.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-script_id: >=0, as returned by \fBstore_script\fP.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID.
-
-.IP "\fBint bb_serial_read_open(int pi, unsigned user_gpio, unsigned baud, unsigned data_bits)\fP"
-.IP "" 4
-This function opens a GPIO for bit bang reading of serial data.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-user_gpio: 0-31.
-.br
- baud: 50-250000
-.br
-data_bits: 1-32
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_WAVE_BAUD,
-or PI_GPIO_IN_USE.
-
-.br
-
-.br
-The serial data is returned in a cyclic buffer and is read using
-bb_serial_read.
-
-.br
-
-.br
-It is the caller's responsibility to read data from the cyclic buffer
-in a timely fashion.
-
-.IP "\fBint bb_serial_read(int pi, unsigned user_gpio, void *buf, size_t bufSize)\fP"
-.IP "" 4
-This function copies up to bufSize bytes of data read from the
-bit bang serial cyclic buffer to the buffer starting at buf.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-user_gpio: 0-31, previously opened with \fBbb_serial_read_open\fP.
-.br
- buf: an array to receive the read bytes.
-.br
- bufSize: >=0
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes copied if OK, otherwise PI_BAD_USER_GPIO
-or PI_NOT_SERIAL_GPIO.
-
-.br
-
-.br
-The bytes returned for each character depend upon the number of
-data bits \fBdata_bits\fP specified in the \fBbb_serial_read_open\fP command.
-
-.br
-
-.br
-For \fBdata_bits\fP 1-8 there will be one byte per character.
-.br
-For \fBdata_bits\fP 9-16 there will be two bytes per character.
-.br
-For \fBdata_bits\fP 17-32 there will be four bytes per character.
-
-.IP "\fBint bb_serial_read_close(int pi, unsigned user_gpio)\fP"
-.IP "" 4
-This function closes a GPIO for bit bang reading of serial data.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-user_gpio: 0-31, previously opened with \fBbb_serial_read_open\fP.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_SERIAL_GPIO.
-
-.IP "\fBint bb_serial_invert(int pi, unsigned user_gpio, unsigned invert)\fP"
-.IP "" 4
-This function inverts serial logic for big bang serial reads.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-user_gpio: 0-31, previously opened with \fBbb_serial_read_open\fP.
-.br
- invert: 0-1, 1 invert, 0 normal.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_NOT_SERIAL_GPIO or PI_BAD_SER_INVERT.
-
-.IP "\fBint i2c_open(int pi, unsigned i2c_bus, unsigned i2c_addr, unsigned i2c_flags)\fP"
-.IP "" 4
-This returns a handle for the device at address i2c_addr on bus i2c_bus.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- i2c_bus: >=0.
-.br
- i2c_addr: 0-0x7F.
-.br
-i2c_flags: 0.
-.br
-
-.EE
-
-.br
-
-.br
-No flags are currently defined. This parameter should be set to zero.
-
-.br
-
-.br
-Physically buses 0 and 1 are available on the Pi. Higher numbered buses
-will be available if a kernel supported bus multiplexor is being used.
-
-.br
-
-.br
-The GPIO used are given in the following table.
-
-.br
-
-.br
- SDA SCL
-.br
-I2C 0 0 1
-.br
-I2C 1 2 3
-.br
-
-.br
-
-.br
-Returns a handle (>=0) if OK, otherwise PI_BAD_I2C_BUS, PI_BAD_I2C_ADDR,
-PI_BAD_FLAGS, PI_NO_HANDLE, or PI_I2C_OPEN_FAILED.
-
-.br
-
-.br
-For the SMBus commands the low level transactions are shown at the end
-of the function description. The following abbreviations are used.
-
-.br
-
-.br
-
-.EX
-S (1 bit) : Start bit
-.br
-P (1 bit) : Stop bit
-.br
-Rd/Wr (1 bit) : Read/Write bit. Rd equals 1, Wr equals 0.
-.br
-A, NA (1 bit) : Accept and not accept bit.
-.br
-.br
-.br
-Addr (7 bits): I2C 7 bit address.
-.br
-i2c_reg (8 bits): A byte which often selects a register.
-.br
-Data (8 bits): A data byte.
-.br
-Count (8 bits): A byte defining the length of a block operation.
-.br
-
-.br
-[..]: Data sent by the device.
-.br
-
-.EE
-
-.IP "\fBint i2c_close(int pi, unsigned handle)\fP"
-.IP "" 4
-This closes the I2C device associated with the handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE.
-
-.IP "\fBint i2c_write_quick(int pi, unsigned handle, unsigned bit)\fP"
-.IP "" 4
-This sends a single bit (in the Rd/Wr bit) to the device associated
-with handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
- bit: 0-1, the value to write.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-Quick command. SMBus 2.0 5.5.1
-
-.EX
-S Addr bit [A] P
-.br
-
-.EE
-
-.IP "\fBint i2c_write_byte(int pi, unsigned handle, unsigned bVal)\fP"
-.IP "" 4
-This sends a single byte to the device associated with handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
- bVal: 0-0xFF, the value to write.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-Send byte. SMBus 2.0 5.5.2
-
-.EX
-S Addr Wr [A] bVal [A] P
-.br
-
-.EE
-
-.IP "\fBint i2c_read_byte(int pi, unsigned handle)\fP"
-.IP "" 4
-This reads a single byte from the device associated with handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the byte read (>=0) if OK, otherwise PI_BAD_HANDLE,
-or PI_I2C_READ_FAILED.
-
-.br
-
-.br
-Receive byte. SMBus 2.0 5.5.3
-
-.EX
-S Addr Rd [A] [Data] NA P
-.br
-
-.EE
-
-.IP "\fBint i2c_write_byte_data(int pi, unsigned handle, unsigned i2c_reg, unsigned bVal)\fP"
-.IP "" 4
-This writes a single byte to the specified register of the device
-associated with handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-i2c_reg: 0-255, the register to write.
-.br
- bVal: 0-0xFF, the value to write.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-Write byte. SMBus 2.0 5.5.4
-
-.EX
-S Addr Wr [A] i2c_reg [A] bVal [A] P
-.br
-
-.EE
-
-.IP "\fBint i2c_write_word_data(int pi, unsigned handle, unsigned i2c_reg, unsigned wVal)\fP"
-.IP "" 4
-This writes a single 16 bit word to the specified register of the device
-associated with handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-i2c_reg: 0-255, the register to write.
-.br
- wVal: 0-0xFFFF, the value to write.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-Write word. SMBus 2.0 5.5.4
-
-.EX
-S Addr Wr [A] i2c_reg [A] wval_Low [A] wVal_High [A] P
-.br
-
-.EE
-
-.IP "\fBint i2c_read_byte_data(int pi, unsigned handle, unsigned i2c_reg)\fP"
-.IP "" 4
-This reads a single byte from the specified register of the device
-associated with handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-i2c_reg: 0-255, the register to read.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the byte read (>=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-
-.br
-
-.br
-Read byte. SMBus 2.0 5.5.5
-
-.EX
-S Addr Wr [A] i2c_reg [A] S Addr Rd [A] [Data] NA P
-.br
-
-.EE
-
-.IP "\fBint i2c_read_word_data(int pi, unsigned handle, unsigned i2c_reg)\fP"
-.IP "" 4
-This reads a single 16 bit word from the specified register of the device
-associated with handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-i2c_reg: 0-255, the register to read.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the word read (>=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-
-.br
-
-.br
-Read word. SMBus 2.0 5.5.5
-
-.EX
-S Addr Wr [A] i2c_reg [A]
-.br
- S Addr Rd [A] [DataLow] A [DataHigh] NA P
-.br
-
-.EE
-
-.IP "\fBint i2c_process_call(int pi, unsigned handle, unsigned i2c_reg, unsigned wVal)\fP"
-.IP "" 4
-This writes 16 bits of data to the specified register of the device
-associated with handle and and reads 16 bits of data in return.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-i2c_reg: 0-255, the register to write/read.
-.br
- wVal: 0-0xFFFF, the value to write.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the word read (>=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-
-.br
-
-.br
-Process call. SMBus 2.0 5.5.6
-
-.EX
-S Addr Wr [A] i2c_reg [A] wVal_Low [A] wVal_High [A]
-.br
- S Addr Rd [A] [DataLow] A [DataHigh] NA P
-.br
-
-.EE
-
-.IP "\fBint i2c_write_block_data(int pi, unsigned handle, unsigned i2c_reg, char *buf, unsigned count)\fP"
-.IP "" 4
-This writes up to 32 bytes to the specified register of the device
-associated with handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-i2c_reg: 0-255, the register to write.
-.br
- buf: an array with the data to send.
-.br
- count: 1-32, the number of bytes to write.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-Block write. SMBus 2.0 5.5.7
-
-.EX
-S Addr Wr [A] i2c_reg [A] count [A] buf0 [A] buf1 [A] ...
-.br
- [A] bufn [A] P
-.br
-
-.EE
-
-.IP "\fBint i2c_read_block_data(int pi, unsigned handle, unsigned i2c_reg, char *buf)\fP"
-.IP "" 4
-This reads a block of up to 32 bytes from the specified register of
-the device associated with handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-i2c_reg: 0-255, the register to read.
-.br
- buf: an array to receive the read data.
-.br
-
-.EE
-
-.br
-
-.br
-The amount of returned data is set by the device.
-
-.br
-
-.br
-Returns the number of bytes read (>=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-
-.br
-
-.br
-Block read. SMBus 2.0 5.5.7
-
-.EX
-S Addr Wr [A] i2c_reg [A]
-.br
- S Addr Rd [A] [Count] A [buf0] A [buf1] A ... A [bufn] NA P
-.br
-
-.EE
-
-.IP "\fBint i2c_block_process_call(int pi, unsigned handle, unsigned i2c_reg, char *buf, unsigned count)\fP"
-.IP "" 4
-This writes data bytes to the specified register of the device
-associated with handle and reads a device specified number
-of bytes of data in return.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-i2c_reg: 0-255, the register to write/read.
-.br
- buf: an array with the data to send and to receive the read data.
-.br
- count: 1-32, the number of bytes to write.
-.br
-
-.EE
-
-.br
-
-.br
-
-.br
-
-.br
-Returns the number of bytes read (>=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-
-.br
-
-.br
-The smbus 2.0 documentation states that a minimum of 1 byte may be
-sent and a minimum of 1 byte may be received. The total number of
-bytes sent/received must be 32 or less.
-
-.br
-
-.br
-Block write-block read. SMBus 2.0 5.5.8
-
-.EX
-S Addr Wr [A] i2c_reg [A] count [A] buf0 [A] ...
-.br
- S Addr Rd [A] [Count] A [Data] ... A P
-.br
-
-.EE
-
-.IP "\fBint i2c_read_i2c_block_data(int pi, unsigned handle, unsigned i2c_reg, char *buf, unsigned count)\fP"
-.IP "" 4
-This reads count bytes from the specified register of the device
-associated with handle . The count may be 1-32.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-i2c_reg: 0-255, the register to read.
-.br
- buf: an array to receive the read data.
-.br
- count: 1-32, the number of bytes to read.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes read (>0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-
-.br
-
-.br
-
-.EX
-S Addr Wr [A] i2c_reg [A]
-.br
- S Addr Rd [A] [buf0] A [buf1] A ... A [bufn] NA P
-.br
-
-.EE
-
-.IP "\fBint i2c_write_i2c_block_data(int pi, unsigned handle, unsigned i2c_reg, char *buf, unsigned count)\fP"
-.IP "" 4
-This writes 1 to 32 bytes to the specified register of the device
-associated with handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
-i2c_reg: 0-255, the register to write.
-.br
- buf: the data to write.
-.br
- count: 1-32, the number of bytes to write.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-
-.EX
-S Addr Wr [A] i2c_reg [A] buf0 [A] buf1 [A] ... [A] bufn [A] P
-.br
-
-.EE
-
-.IP "\fBint i2c_read_device(int pi, unsigned handle, char *buf, unsigned count)\fP"
-.IP "" 4
-This reads count bytes from the raw device into buf.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
- buf: an array to receive the read data bytes.
-.br
- count: >0, the number of bytes to read.
-.br
-
-.EE
-
-.br
-
-.br
-Returns count (>0) if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_READ_FAILED.
-
-.br
-
-.br
-
-.EX
-S Addr Rd [A] [buf0] A [buf1] A ... A [bufn] NA P
-.br
-
-.EE
-
-.IP "\fBint i2c_write_device(int pi, unsigned handle, char *buf, unsigned count)\fP"
-.IP "" 4
-This writes count bytes from buf to the raw device.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: >=0, as returned by a call to \fBi2c_open\fP.
-.br
- buf: an array containing the data bytes to write.
-.br
- count: >0, the number of bytes to write.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-
-.EX
-S Addr Wr [A] buf0 [A] buf1 [A] ... [A] bufn [A] P
-.br
-
-.EE
-
-.IP "\fBint i2c_zip(int pi, unsigned handle, char *inBuf, unsigned inLen, char *outBuf, unsigned outLen)\fP"
-.IP "" 4
-This function executes a sequence of I2C operations. The
-operations to be performed are specified by the contents of inBuf
-which contains the concatenated command codes and associated data.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: >=0, as returned by a call to \fBi2cOpen\fP
-.br
- inBuf: pointer to the concatenated I2C commands, see below
-.br
- inLen: size of command buffer
-.br
-outBuf: pointer to buffer to hold returned data
-.br
-outLen: size of output buffer
-.br
-
-.EE
-
-.br
-
-.br
-Returns >= 0 if OK (the number of bytes read), otherwise
-PI_BAD_HANDLE, PI_BAD_POINTER, PI_BAD_I2C_CMD, PI_BAD_I2C_RLEN.
-PI_BAD_I2C_WLEN, or PI_BAD_I2C_SEG.
-
-.br
-
-.br
-The following command codes are supported:
-
-.br
-
-.br
-Name Cmd & Data Meaning
-.br
-End 0 No more commands
-.br
-Escape 1 Next P is two bytes
-.br
-On 2 Switch combined flag on
-.br
-Off 3 Switch combined flag off
-.br
-Address 4 P Set I2C address to P
-.br
-Flags 5 lsb msb Set I2C flags to lsb + (msb << 8)
-.br
-Read 6 P Read P bytes of data
-.br
-Write 7 P ... Write P bytes of data
-.br
-
-.br
-
-.br
-The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-
-.br
-
-.br
-The address defaults to that associated with the handle.
-The flags default to 0. The address and flags maintain their
-previous value until updated.
-
-.br
-
-.br
-The returned I2C data is stored in consecutive locations of outBuf.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-Set address 0x53, write 0x32, read 6 bytes
-.br
-Set address 0x1E, write 0x03, read 6 bytes
-.br
-Set address 0x68, write 0x1B, read 8 bytes
-.br
-End
-.br
-
-.br
-0x04 0x53 0x07 0x01 0x32 0x06 0x06
-.br
-0x04 0x1E 0x07 0x01 0x03 0x06 0x06
-.br
-0x04 0x68 0x07 0x01 0x1B 0x06 0x08
-.br
-0x00
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBint bb_i2c_open(int pi, unsigned SDA, unsigned SCL, unsigned baud)\fP"
-.IP "" 4
-This function selects a pair of GPIO for bit banging I2C at a
-specified baud rate.
-
-.br
-
-.br
-Bit banging I2C allows for certain operations which are not possible
-with the standard I2C driver.
-
-.br
-
-.br
-o baud rates as low as 50
-.br
-o repeated starts
-.br
-o clock stretching
-.br
-o I2C on any pair of spare GPIO
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- SDA: 0-31
-.br
- SCL: 0-31
-.br
-baud: 50-500000
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_I2C_BAUD, or
-PI_GPIO_IN_USE.
-
-.br
-
-.br
-NOTE:
-
-.br
-
-.br
-The GPIO used for SDA and SCL must have pull-ups to 3V3 connected. As
-a guide the hardware pull-ups on pins 3 and 5 are 1k8 in value.
-
-.IP "\fBint bb_i2c_close(int pi, unsigned SDA)\fP"
-.IP "" 4
-This function stops bit banging I2C on a pair of GPIO previously
-opened with \fBbb_i2c_open\fP.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-SDA: 0-31, the SDA GPIO used in a prior call to \fBbb_i2c_open\fP
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_I2C_GPIO.
-
-.IP "\fBint bb_i2c_zip(int pi, unsigned SDA, char *inBuf, unsigned inLen, char *outBuf, unsigned outLen)\fP"
-.IP "" 4
-This function executes a sequence of bit banged I2C operations. The
-operations to be performed are specified by the contents of inBuf
-which contains the concatenated command codes and associated data.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- SDA: 0-31 (as used in a prior call to \fBbb_i2c_open\fP)
-.br
- inBuf: pointer to the concatenated I2C commands, see below
-.br
- inLen: size of command buffer
-.br
-outBuf: pointer to buffer to hold returned data
-.br
-outLen: size of output buffer
-.br
-
-.EE
-
-.br
-
-.br
-Returns >= 0 if OK (the number of bytes read), otherwise
-PI_BAD_USER_GPIO, PI_NOT_I2C_GPIO, PI_BAD_POINTER,
-PI_BAD_I2C_CMD, PI_BAD_I2C_RLEN, PI_BAD_I2C_WLEN,
-PI_I2C_READ_FAILED, or PI_I2C_WRITE_FAILED.
-
-.br
-
-.br
-The following command codes are supported:
-
-.br
-
-.br
-Name Cmd & Data Meaning
-.br
-End 0 No more commands
-.br
-Escape 1 Next P is two bytes
-.br
-Start 2 Start condition
-.br
-Stop 3 Stop condition
-.br
-Address 4 P Set I2C address to P
-.br
-Flags 5 lsb msb Set I2C flags to lsb + (msb << 8)
-.br
-Read 6 P Read P bytes of data
-.br
-Write 7 P ... Write P bytes of data
-.br
-
-.br
-
-.br
-The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-
-.br
-
-.br
-The address and flags default to 0. The address and flags maintain
-their previous value until updated.
-
-.br
-
-.br
-No flags are currently defined.
-
-.br
-
-.br
-The returned I2C data is stored in consecutive locations of outBuf.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-Set address 0x53
-.br
-start, write 0x32, (re)start, read 6 bytes, stop
-.br
-Set address 0x1E
-.br
-start, write 0x03, (re)start, read 6 bytes, stop
-.br
-Set address 0x68
-.br
-start, write 0x1B, (re)start, read 8 bytes, stop
-.br
-End
-.br
-
-.br
-0x04 0x53
-.br
-0x02 0x07 0x01 0x32 0x02 0x06 0x06 0x03
-.br
-
-.br
-0x04 0x1E
-.br
-0x02 0x07 0x01 0x03 0x02 0x06 0x06 0x03
-.br
-
-.br
-0x04 0x68
-.br
-0x02 0x07 0x01 0x1B 0x02 0x06 0x08 0x03
-.br
-
-.br
-0x00
-.br
-
-.EE
-
-.IP "\fBint bb_spi_open(int pi, unsigned CS, unsigned MISO, unsigned MOSI, unsigned SCLK, unsigned baud, unsigned spi_flags)\fP"
-.IP "" 4
-This function selects a set of GPIO for bit banging SPI at a
-specified baud rate.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- CS: 0-31
-.br
- MISO: 0-31
-.br
- MOSI: 0-31
-.br
- SCLK: 0-31
-.br
- baud: 50-250000
-.br
-spi_flags: see below
-.br
-
-.EE
-
-.br
-
-.br
-spi_flags consists of the least significant 22 bits.
-
-.br
-
-.br
-
-.EX
-21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
-.br
- 0 0 0 0 0 0 R T 0 0 0 0 0 0 0 0 0 0 0 p m m
-.br
-
-.EE
-
-.br
-
-.br
-mm defines the SPI mode, defaults to 0
-
-.br
-
-.br
-
-.EX
-Mode CPOL CPHA
-.br
- 0 0 0
-.br
- 1 0 1
-.br
- 2 1 0
-.br
- 3 1 1
-.br
-
-.EE
-
-.br
-
-.br
-p is 0 if CS is active low (default) and 1 for active high.
-
-.br
-
-.br
-T is 1 if the least significant bit is transmitted on MOSI first, the
-default (0) shifts the most significant bit out first.
-
-.br
-
-.br
-R is 1 if the least significant bit is received on MISO first, the
-default (0) receives the most significant bit first.
-
-.br
-
-.br
-The other bits in flags should be set to zero.
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_SPI_BAUD, or
-PI_GPIO_IN_USE.
-
-.br
-
-.br
-If more than one device is connected to the SPI bus (defined by
-SCLK, MOSI, and MISO) each must have its own CS.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-bb_spi_open(pi,10, MISO, MOSI, SCLK, 10000, 0); // device 1
-.br
-bb_spi_open(pi,11, MISO, MOSI, SCLK, 20000, 3); // device 2
-.br
-
-.EE
-
-.IP "\fBint bb_spi_close(int pi, unsigned CS)\fP"
-.IP "" 4
-This function stops bit banging SPI on a set of GPIO
-opened with \fBbbSPIOpen\fP.
-
-.br
-
-.br
-
-.EX
-pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-CS: 0-31, the CS GPIO used in a prior call to \fBbb_spi_open\fP
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_SPI_GPIO.
-
-.IP "\fBint bb_spi_xfer(int pi, unsigned CS, char *txBuf, char *rxBuf, unsigned count)\fP"
-.IP "" 4
-This function executes a bit banged SPI transfer.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- CS: 0-31 (as used in a prior call to \fBbb_spi_open\fP)
-.br
-txBuf: pointer to buffer to hold data to be sent
-.br
-rxBuf: pointer to buffer to hold returned data
-.br
-count: size of data transfer
-.br
-
-.EE
-
-.br
-
-.br
-Returns >= 0 if OK (the number of bytes read), otherwise
-PI_BAD_USER_GPIO, PI_NOT_SPI_GPIO or PI_BAD_POINTER.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-// gcc -Wall -pthread -o bb_spi_x_test bb_spi_x_test.c -lpigpiod_if2
-.br
-// ./bb_spi_x_test
-.br
-
-.br
-#include <stdio.h>
-.br
-
-.br
-#include "pigpiod_if2.h"
-.br
-
-.br
-#define CE0 5
-.br
-#define CE1 6
-.br
-#define MISO 13
-.br
-#define MOSI 19
-.br
-#define SCLK 12
-.br
-
-.br
-int main(int argc, char *argv[])
-.br
-{
-.br
- int i, pi, count, set_val, read_val;
-.br
- unsigned char inBuf[3];
-.br
- char cmd1[] = {0, 0};
-.br
- char cmd2[] = {12, 0};
-.br
- char cmd3[] = {1, 128, 0};
-.br
-
-.br
- if ((pi = pigpio_start(0, 0)) < 0)
-.br
- {
-.br
- fprintf(stderr, "pigpio initialisation failed (%d).\n", pi);
-.br
- return 1;
-.br
- }
-.br
-
-.br
- bb_spi_open(pi, CE0, MISO, MOSI, SCLK, 10000, 0); // MCP4251 DAC
-.br
- bb_spi_open(pi, CE1, MISO, MOSI, SCLK, 20000, 3); // MCP3008 ADC
-.br
-
-.br
- for (i=0; i<256; i++)
-.br
- {
-.br
- cmd1[1] = i;
-.br
-
-.br
- count = bb_spi_xfer(pi, CE0, cmd1, (char *)inBuf, 2); // > DAC
-.br
-
-.br
- if (count == 2)
-.br
- {
-.br
- count = bb_spi_xfer(pi, CE0, cmd2, (char *)inBuf, 2); // < DAC
-.br
-
-.br
- if (count == 2)
-.br
- {
-.br
- set_val = inBuf[1];
-.br
-
-.br
- count = bb_spi_xfer(pi, CE1, cmd3, (char *)inBuf, 3); // < ADC
-.br
-
-.br
- if (count == 3)
-.br
- {
-.br
- read_val = ((inBuf[1]&3)<<8) | inBuf[2];
-.br
- printf("%d %d\n", set_val, read_val);
-.br
- }
-.br
- }
-.br
- }
-.br
- }
-.br
-
-.br
- bb_spi_close(pi, CE0);
-.br
- bb_spi_close(pi, CE1);
-.br
-
-.br
- pigpio_stop(pi);
-.br
-}
-.br
-
-.EE
-
-.IP "\fBint spi_open(int pi, unsigned spi_channel, unsigned baud, unsigned spi_flags)\fP"
-.IP "" 4
-This function returns a handle for the SPI device on the channel.
-Data will be transferred at baud bits per second. The flags may
-be used to modify the default behaviour of 4-wire operation, mode 0,
-active low chip select.
-
-.br
-
-.br
-The Pi has two SPI peripherals: main and auxiliary.
-
-.br
-
-.br
-The main SPI has two chip selects (channels), the auxiliary has
-three.
-
-.br
-
-.br
-The auxiliary SPI is available on all models but the A and B.
-
-.br
-
-.br
-The GPIO used are given in the following table.
-
-.br
-
-.br
- MISO MOSI SCLK CE0 CE1 CE2
-.br
-Main SPI 9 10 11 8 7 -
-.br
-Aux SPI 19 20 21 18 17 16
-.br
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-spi_channel: 0-1 (0-2 for the auxiliary SPI).
-.br
- baud: 32K-125M (values above 30M are unlikely to work).
-.br
- spi_flags: see below.
-.br
-
-.EE
-
-.br
-
-.br
-Returns a handle (>=0) if OK, otherwise PI_BAD_SPI_CHANNEL,
-PI_BAD_SPI_SPEED, PI_BAD_FLAGS, PI_NO_AUX_SPI, or PI_SPI_OPEN_FAILED.
-
-.br
-
-.br
-spi_flags consists of the least significant 22 bits.
-
-.br
-
-.br
-
-.EX
-21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
-.br
- b b b b b b R T n n n n W A u2 u1 u0 p2 p1 p0 m m
-.br
-
-.EE
-
-.br
-
-.br
-mm defines the SPI mode.
-
-.br
-
-.br
-Warning: modes 1 and 3 do not appear to work on the auxiliary SPI.
-
-.br
-
-.br
-
-.EX
-Mode POL PHA
-.br
- 0 0 0
-.br
- 1 0 1
-.br
- 2 1 0
-.br
- 3 1 1
-.br
-
-.EE
-
-.br
-
-.br
-px is 0 if CEx is active low (default) and 1 for active high.
-
-.br
-
-.br
-ux is 0 if the CEx GPIO is reserved for SPI (default) and 1 otherwise.
-
-.br
-
-.br
-A is 0 for the main SPI, 1 for the auxiliary SPI.
-
-.br
-
-.br
-W is 0 if the device is not 3-wire, 1 if the device is 3-wire. Main
-SPI only.
-
-.br
-
-.br
-nnnn defines the number of bytes (0-15) to write before switching
-the MOSI line to MISO to read data. This field is ignored
-if W is not set. Main SPI only.
-
-.br
-
-.br
-T is 1 if the least significant bit is transmitted on MOSI first, the
-default (0) shifts the most significant bit out first. Auxiliary SPI
-only.
-
-.br
-
-.br
-R is 1 if the least significant bit is received on MISO first, the
-default (0) receives the most significant bit first. Auxiliary SPI
-only.
-
-.br
-
-.br
-bbbbbb defines the word size in bits (0-32). The default (0)
-sets 8 bits per word. Auxiliary SPI only.
-
-.br
-
-.br
-The \fBspi_read\fP, \fBspi_write\fP, and \fBspi_xfer\fP functions
-transfer data packed into 1, 2, or 4 bytes according to
-the word size in bits.
-
-.br
-
-.br
-For bits 1-8 there will be one byte per character.
-.br
-For bits 9-16 there will be two bytes per character.
-.br
-For bits 17-32 there will be four bytes per character.
-
-.br
-
-.br
-Multi-byte transfers are made in least significant byte first order.
-
-.br
-
-.br
-E.g. to transfer 32 11-bit words buf should contain 64 bytes
-and count should be 64.
-
-.br
-
-.br
-E.g. to transfer the 14 bit value 0x1ABC send the bytes 0xBC followed
-by 0x1A.
-
-.br
-
-.br
-The other bits in flags should be set to zero.
-
-.IP "\fBint spi_close(int pi, unsigned handle)\fP"
-.IP "" 4
-This functions closes the SPI device identified by the handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: >=0, as returned by a call to \fBspi_open\fP.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE.
-
-.IP "\fBint spi_read(int pi, unsigned handle, char *buf, unsigned count)\fP"
-.IP "" 4
-This function reads count bytes of data from the SPI
-device associated with the handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: >=0, as returned by a call to \fBspi_open\fP.
-.br
- buf: an array to receive the read data bytes.
-.br
- count: the number of bytes to read.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-
-.IP "\fBint spi_write(int pi, unsigned handle, char *buf, unsigned count)\fP"
-.IP "" 4
-This function writes count bytes of data from buf to the SPI
-device associated with the handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: >=0, as returned by a call to \fBspi_open\fP.
-.br
- buf: the data bytes to write.
-.br
- count: the number of bytes to write.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-
-.IP "\fBint spi_xfer(int pi, unsigned handle, char *txBuf, char *rxBuf, unsigned count)\fP"
-.IP "" 4
-This function transfers count bytes of data from txBuf to the SPI
-device associated with the handle. Simultaneously count bytes of
-data are read from the device and placed in rxBuf.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: >=0, as returned by a call to \fBspi_open\fP.
-.br
- txBuf: the data bytes to write.
-.br
- rxBuf: the received data bytes.
-.br
- count: the number of bytes to transfer.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-
-.IP "\fBint serial_open(int pi, char *ser_tty, unsigned baud, unsigned ser_flags)\fP"
-.IP "" 4
-This function opens a serial device at a specified baud rate
-with specified flags. The device name must start with
-/dev/tty or /dev/serial.
-
-.br
-
-.br
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- ser_tty: the serial device to open.
-.br
- baud: the baud rate in bits per second, see below.
-.br
-ser_flags: 0.
-.br
-
-.EE
-
-.br
-
-.br
-Returns a handle (>=0) if OK, otherwise PI_NO_HANDLE, or
-PI_SER_OPEN_FAILED.
-
-.br
-
-.br
-The baud rate must be one of 50, 75, 110, 134, 150,
-200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
-38400, 57600, 115200, or 230400.
-
-.br
-
-.br
-No flags are currently defined. This parameter should be set to zero.
-
-.IP "\fBint serial_close(int pi, unsigned handle)\fP"
-.IP "" 4
-This function closes the serial device associated with handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: >=0, as returned by a call to \fBserial_open\fP.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE.
-
-.IP "\fBint serial_write_byte(int pi, unsigned handle, unsigned bVal)\fP"
-.IP "" 4
-This function writes bVal to the serial port associated with handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: >=0, as returned by a call to \fBserial_open\fP.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_SER_WRITE_FAILED.
-
-.IP "\fBint serial_read_byte(int pi, unsigned handle)\fP"
-.IP "" 4
-This function reads a byte from the serial port associated with handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: >=0, as returned by a call to \fBserial_open\fP.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the read byte (>=0) if OK, otherwise PI_BAD_HANDLE,
-PI_SER_READ_NO_DATA, or PI_SER_READ_FAILED.
-
-.br
-
-.br
-If no data is ready PI_SER_READ_NO_DATA is returned.
-
-.IP "\fBint serial_write(int pi, unsigned handle, char *buf, unsigned count)\fP"
-.IP "" 4
-This function writes count bytes from buf to the the serial port
-associated with handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: >=0, as returned by a call to \fBserial_open\fP.
-.br
- buf: the array of bytes to write.
-.br
- count: the number of bytes to write.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_SER_WRITE_FAILED.
-
-.IP "\fBint serial_read(int pi, unsigned handle, char *buf, unsigned count)\fP"
-.IP "" 4
-This function reads up to count bytes from the the serial port
-associated with handle and writes them to buf.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: >=0, as returned by a call to \fBserial_open\fP.
-.br
- buf: an array to receive the read data.
-.br
- count: the maximum number of bytes to read.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes read (>=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, PI_SER_READ_NO_DATA, or PI_SER_WRITE_FAILED.
-
-.br
-
-.br
-If no data is ready zero is returned.
-
-.IP "\fBint serial_data_available(int pi, unsigned handle)\fP"
-.IP "" 4
-Returns the number of bytes available to be read from the
-device associated with handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: >=0, as returned by a call to \fBserial_open\fP.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes of data available (>=0) if OK,
-otherwise PI_BAD_HANDLE.
-
-.IP "\fBint custom_1(int pi, unsigned arg1, unsigned arg2, char *argx, unsigned argc)\fP"
-.IP "" 4
-This function is available for user customisation.
-
-.br
-
-.br
-It returns a single integer value.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-arg1: >=0
-.br
-arg2: >=0
-.br
-argx: extra (byte) arguments
-.br
-argc: number of extra arguments
-.br
-
-.EE
-
-.br
-
-.br
-Returns >= 0 if OK, less than 0 indicates a user defined error.
-
-.IP "\fBint custom_2(int pi, unsigned arg1, char *argx, unsigned argc, char *retBuf, unsigned retMax)\fP"
-.IP "" 4
-This function is available for user customisation.
-
-.br
-
-.br
-It differs from custom_1 in that it returns an array of bytes
-rather than just an integer.
-
-.br
-
-.br
-The return value is an integer indicating the number of returned bytes.
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- arg1: >=0
-.br
- argc: extra (byte) arguments
-.br
- count: number of extra arguments
-.br
-retBuf: buffer for returned data
-.br
-retMax: maximum number of bytes to return
-.br
-
-.EE
-
-.br
-
-.br
-Returns >= 0 if OK, less than 0 indicates a user defined error.
-
-.br
-
-.br
-Note, the number of returned bytes will be retMax or less.
-
-.IP "\fBint get_pad_strength(int pi, unsigned pad)\fP"
-.IP "" 4
-This function returns the pad drive strength in mA.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-pad: 0-2, the pad to get.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the pad drive strength if OK, otherwise PI_BAD_PAD.
-
-.br
-
-.br
-Pad GPIO
-.br
-0 0-27
-.br
-1 28-45
-.br
-2 46-53
-.br
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-strength = get_pad_strength(pi, 0); // get pad 0 strength
-.br
-
-.EE
-
-.IP "\fBint set_pad_strength(int pi, unsigned pad, unsigned padStrength)\fP"
-.IP "" 4
-This function sets the pad drive strength in mA.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- pad: 0-2, the pad to set.
-.br
-padStrength: 1-16 mA.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_PAD, or PI_BAD_STRENGTH.
-
-.br
-
-.br
-Pad GPIO
-.br
-0 0-27
-.br
-1 28-45
-.br
-2 46-53
-.br
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-set_pad_strength(pi, 0, 10); // set pad 0 strength to 10 mA
-.br
-
-.EE
-
-.IP "\fBint shell_(int pi, char *scriptName, char *scriptString)\fP"
-.IP "" 4
-This function uses the system call to execute a shell script
-with the given string as its parameter.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- scriptName: the name of the script, only alphanumeric characters,
-.br
- '-' and '_' are allowed in the name.
-.br
-scriptString: the string to pass to the script.
-.br
-
-.EE
-
-.br
-
-.br
-The exit status of the system call is returned if OK, otherwise
-PI_BAD_SHELL_STATUS.
-
-.br
-
-.br
-scriptName must exist in /opt/pigpio/cgi and must be executable.
-
-.br
-
-.br
-The returned exit status is normally 256 times that set by the
-shell script exit function. If the script can't be found 32512 will
-be returned.
-
-.br
-
-.br
-The following table gives some example returned statuses.
-
-.br
-
-.br
-Script exit status Returned system call status
-.br
-1 256
-.br
-5 1280
-.br
-10 2560
-.br
-200 51200
-.br
-script not found 32512
-.br
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-// pass two parameters, hello and world
-.br
-status = shell_(pi, "scr1", "hello world");
-.br
-
-.br
-// pass three parameters, hello, string with spaces, and world
-.br
-status = shell_(pi, "scr1", "hello 'string with spaces' world");
-.br
-
-.br
-// pass one parameter, hello string with spaces world
-.br
-status = shell_(pi, "scr1", "\"hello string with spaces world\"");
-.br
-
-.EE
-
-.IP "\fBint file_open(int pi, char *file, unsigned mode)\fP"
-.IP "" 4
-This function returns a handle to a file opened in a specified mode.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-file: the file to open.
-.br
-mode: the file open mode.
-.br
-
-.EE
-
-.br
-
-.br
-Returns a handle (>=0) if OK, otherwise PI_NO_HANDLE, PI_NO_FILE_ACCESS,
-PI_BAD_FILE_MODE, PI_FILE_OPEN_FAILED, or PI_FILE_IS_A_DIR.
-
-.br
-
-.br
-File
-
-.br
-
-.br
-A file may only be opened if permission is granted by an entry in
-/opt/pigpio/access. This is intended to allow remote access to files
-in a more or less controlled manner.
-
-.br
-
-.br
-Each entry in /opt/pigpio/access takes the form of a file path
-which may contain wildcards followed by a single letter permission.
-The permission may be R for read, W for write, U for read/write,
-and N for no access.
-
-.br
-
-.br
-Where more than one entry matches a file the most specific rule
-applies. If no entry matches a file then access is denied.
-
-.br
-
-.br
-Suppose /opt/pigpio/access contains the following entries
-
-.br
-
-.br
-
-.EX
-/home/* n
-.br
-/home/pi/shared/dir_1/* w
-.br
-/home/pi/shared/dir_2/* r
-.br
-/home/pi/shared/dir_3/* u
-.br
-/home/pi/shared/dir_1/file.txt n
-.br
-
-.EE
-
-.br
-
-.br
-Files may be written in directory dir_1 with the exception
-of file.txt.
-
-.br
-
-.br
-Files may be read in directory dir_2.
-
-.br
-
-.br
-Files may be read and written in directory dir_3.
-
-.br
-
-.br
-If a directory allows read, write, or read/write access then files may
-be created in that directory.
-
-.br
-
-.br
-In an attempt to prevent risky permissions the following paths are
-ignored in /opt/pigpio/access.
-
-.br
-
-.br
-
-.EX
-a path containing ..
-.br
-a path containing only wildcards (*?)
-.br
-a path containing less than two non-wildcard parts
-.br
-
-.EE
-
-.br
-
-.br
-Mode
-
-.br
-
-.br
-The mode may have the following values.
-
-.br
-
-.br
-Macro Value Meaning
-.br
-PI_FILE_READ 1 open file for reading
-.br
-PI_FILE_WRITE 2 open file for writing
-.br
-PI_FILE_RW 3 open file for reading and writing
-.br
-
-.br
-
-.br
-The following values may be or'd into the mode.
-
-.br
-
-.br
-Macro Value Meaning
-.br
-PI_FILE_APPEND 4 Writes append data to the end of the file
-.br
-PI_FILE_CREATE 8 The file is created if it doesn't exist
-.br
-PI_FILE_TRUNC 16 The file is truncated
-.br
-
-.br
-
-.br
-Newly created files are owned by root with permissions owner read and write.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-#include <stdio.h>
-.br
-#include <pigpiod_if2.h>
-.br
-
-.br
-int main(int argc, char *argv[])
-.br
-{
-.br
- int pi, handle, c;
-.br
- char buf[60000];
-.br
-
-.br
- pi = pigpio_start(NULL, NULL);
-.br
-
-.br
- if (pi < 0) return 1;
-.br
-
-.br
- // assumes /opt/pigpio/access contains the following line
-.br
- // /ram/*.c r
-.br
-
-.br
- handle = file_open(pi, "/ram/pigpio.c", PI_FILE_READ);
-.br
-
-.br
- if (handle >= 0)
-.br
- {
-.br
- while ((c=file_read(pi, handle, buf, sizeof(buf)-1)))
-.br
- {
-.br
- buf[c] = 0;
-.br
- printf("%s", buf);
-.br
- }
-.br
-
-.br
- file_close(pi, handle);
-.br
- }
-.br
-
-.br
- pigpio_stop(pi);
-.br
-}
-.br
-
-.EE
-
-.IP "\fBint file_close(int pi, unsigned handle)\fP"
-.IP "" 4
-This function closes the file associated with handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: >=0 (as returned by \fBfile_open\fP).
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-file_close(pi, handle);
-.br
-
-.EE
-
-.IP "\fBint file_write(int pi, unsigned handle, char *buf, unsigned count)\fP"
-.IP "" 4
-This function writes count bytes from buf to the the file
-associated with handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: >=0 (as returned by \fBfile_open\fP).
-.br
- buf: the array of bytes to write.
-.br
- count: the number of bytes to write.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM,
-PI_FILE_NOT_WOPEN, or PI_BAD_FILE_WRITE.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-if (file_write(pi, handle, buf, 100) == 0)
-.br
-{
-.br
- // file written okay
-.br
-}
-.br
-else
-.br
-{
-.br
- // error
-.br
-}
-.br
-
-.EE
-
-.IP "\fBint file_read(int pi, unsigned handle, char *buf, unsigned count)\fP"
-.IP "" 4
-This function reads up to count bytes from the the file
-associated with handle and writes them to buf.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-handle: >=0 (as returned by \fBfile_open\fP).
-.br
- buf: an array to receive the read data.
-.br
- count: the maximum number of bytes to read.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of bytes read (>0) if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, PI_FILE_NOT_ROPEN, or PI_BAD_FILE_WRITE.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
- bytes = file_read(pi, handle, buf, sizeof(buf));
-.br
-
-.br
- if (bytes >= 0)
-.br
- {
-.br
- // process read data
-.br
- }
-.br
-
-.EE
-
-.IP "\fBint file_seek(int pi, unsigned handle, int32_t seekOffset, int seekFrom)\fP"
-.IP "" 4
-This function seeks to a position within the file associated
-with handle.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- handle: >=0 (as returned by \fBfile_open\fP).
-.br
-seekOffset: the number of bytes to move. Positive offsets
-.br
- move forward, negative offsets backwards.
-.br
- seekFrom: one of PI_FROM_START (0), PI_FROM_CURRENT (1),
-.br
- or PI_FROM_END (2).
-.br
-
-.EE
-
-.br
-
-.br
-Returns the new byte position within the file (>=0) if OK, otherwise PI_BAD_HANDLE, or PI_BAD_FILE_SEEK.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-file_seek(pi, handle, 123, PI_FROM_START); // Start plus 123
-.br
-
-.br
-size = file_seek(pi, handle, 0, PI_FROM_END); // End, return size
-.br
-
-.br
-pos = file_seek(pi, handle, 0, PI_FROM_CURRENT); // Current position
-.br
-
-.EE
-
-.IP "\fBint file_list(int pi, char *fpat, char *buf, unsigned count)\fP"
-.IP "" 4
-This function returns a list of files which match a pattern.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- fpat: file pattern to match.
-.br
- buf: an array to receive the matching file names.
-.br
-count: the maximum number of bytes to read.
-.br
-
-.EE
-
-.br
-
-.br
-Returns the number of returned bytes if OK, otherwise PI_NO_FILE_ACCESS,
-or PI_NO_FILE_MATCH.
-
-.br
-
-.br
-The pattern must match an entry in /opt/pigpio/access. The pattern
-may contain wildcards. See \fBfile_open\fP.
-
-.br
-
-.br
-NOTE
-
-.br
-
-.br
-The returned value is not the number of files, it is the number
-of bytes in the buffer. The file names are separated by newline
-characters.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-#include <stdio.h>
-.br
-#include <pigpiod_if2.h>
-.br
-
-.br
-int main(int argc, char *argv[])
-.br
-{
-.br
- int pi, handle, c;
-.br
- char buf[60000];
-.br
-
-.br
- pi = pigpio_start(NULL, NULL);
-.br
-
-.br
- if (pi < 0) return 1;
-.br
-
-.br
- // assumes /opt/pigpio/access contains the following line
-.br
- // /ram/*.c r
-.br
-
-.br
- c = file_list(pi, "/ram/p*.c", buf, sizeof(buf));
-.br
-
-.br
- if (c >= 0)
-.br
- {
-.br
- buf[c] = 0;
-.br
- printf("%s", buf);
-.br
- }
-.br
-
-.br
- pigpio_stop(pi);
-.br
-}
-.br
-
-.EE
-
-.IP "\fBint callback(int pi, unsigned user_gpio, unsigned edge, CBFunc_t f)\fP"
-.IP "" 4
-This function initialises a new callback.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-user_gpio: 0-31.
-.br
- edge: RISING_EDGE, FALLING_EDGE, or EITHER_EDGE.
-.br
- f: the callback function.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns a callback id if OK, otherwise pigif_bad_malloc,
-pigif_duplicate_callback, or pigif_bad_callback.
-
-.br
-
-.br
-The callback is called with the GPIO, edge, and tick, whenever the
-GPIO has the identified edge.
-
-.br
-
-.br
-
-.EX
-Parameter Value Meaning
-.br
-
-.br
-GPIO 0-31 The GPIO which has changed state
-.br
-
-.br
-edge 0-2 0 = change to low (a falling edge)
-.br
- 1 = change to high (a rising edge)
-.br
- 2 = no level change (a watchdog timeout)
-.br
-
-.br
-tick 32 bit The number of microseconds since boot
-.br
- WARNING: this wraps around from
-.br
- 4294967295 to 0 roughly every 72 minutes
-.br
-
-.EE
-
-.br
-
-.br
-The GPIO are sampled at a rate set when the pigpio daemon
-is started (default 5 us).
-
-.br
-
-.br
-The number of samples per second is given in the following table.
-
-.br
-
-.br
-
-.EX
- samples
-.br
- per sec
-.br
-
-.br
- 1 1,000,000
-.br
- 2 500,000
-.br
-sample 4 250,000
-.br
-rate 5 200,000
-.br
-(us) 8 125,000
-.br
- 10 100,000
-.br
-
-.EE
-
-.br
-
-.br
-GPIO level changes shorter than the sample rate may be missed.
-
-.br
-
-.br
-The daemon software which generates the callbacks is triggered
-1000 times per second. The callbacks will be called once per
-level change since the last time they were called.
-i.e. The callbacks will get all level changes but there will
-be a latency.
-
-.br
-
-.br
-If you want to track the level of more than one GPIO do so by
-maintaining the state in the callback. Do not use \fBgpio_read\fP.
-Remember the event that triggered the callback may have
-happened several milliseconds before and the GPIO may have
-changed level many times since then.
-
-.IP "\fBint callback_ex(int pi, unsigned user_gpio, unsigned edge, CBFuncEx_t f, void *userdata)\fP"
-.IP "" 4
-This function initialises a new callback.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-user_gpio: 0-31.
-.br
- edge: RISING_EDGE, FALLING_EDGE, or EITHER_EDGE.
-.br
- f: the callback function.
-.br
- userdata: a pointer to arbitrary user data.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns a callback id if OK, otherwise pigif_bad_malloc,
-pigif_duplicate_callback, or pigif_bad_callback.
-
-.br
-
-.br
-The callback is called with the GPIO, edge, tick, and the userdata
-pointer, whenever the GPIO has the identified edge.
-
-.br
-
-.br
-
-.EX
-Parameter Value Meaning
-.br
-
-.br
-GPIO 0-31 The GPIO which has changed state
-.br
-
-.br
-edge 0-2 0 = change to low (a falling edge)
-.br
- 1 = change to high (a rising edge)
-.br
- 2 = no level change (a watchdog timeout)
-.br
-
-.br
-tick 32 bit The number of microseconds since boot
-.br
- WARNING: this wraps around from
-.br
- 4294967295 to 0 roughly every 72 minutes
-.br
-
-.br
-userdata pointer Pointer to an arbitrary object
-.br
-
-.EE
-
-.IP "\fBint callback_cancel(unsigned callback_id)\fP"
-.IP "" 4
-This function cancels a callback identified by its id.
-
-.br
-
-.br
-
-.EX
-callback_id: >=0, as returned by a call to \fBcallback\fP or \fBcallback_ex\fP.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns 0 if OK, otherwise pigif_callback_not_found.
-
-.IP "\fBint wait_for_edge(int pi, unsigned user_gpio, unsigned edge, double timeout)\fP"
-.IP "" 4
-This function waits for an edge on the GPIO for up to timeout
-seconds.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-user_gpio: 0-31.
-.br
- edge: RISING_EDGE, FALLING_EDGE, or EITHER_EDGE.
-.br
- timeout: >=0.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns when the edge occurs or after the timeout.
-
-.br
-
-.br
-Do not use this function for precise timing purposes,
-the edge is only checked 20 times a second. Whenever
-you need to know the accurate time of GPIO events use
-a \fBcallback\fP function.
-
-.br
-
-.br
-The function returns 1 if the edge occurred, otherwise 0.
-
-.IP "\fBint bsc_xfer(int pi, bsc_xfer_t *bscxfer)\fP"
-.IP "" 4
-This function provides a low-level interface to the SPI/I2C Slave
-peripheral on the BCM chip.
-
-.br
-
-.br
-This peripheral allows the Pi to act as a hardware slave device
-on an I2C or SPI bus.
-
-.br
-
-.br
-This is not a bit bang version and as such is OS timing
-independent. The bus timing is handled directly by the chip.
-
-.br
-
-.br
-The output process is simple. You simply append data to the FIFO
-buffer on the chip. This works like a queue, you add data to the
-queue and the master removes it.
-
-.br
-
-.br
-I can't get SPI to work properly. I tried with a
-control word of 0x303 and swapped MISO and MOSI.
-
-.br
-
-.br
-The function sets the BSC mode, writes any data in
-the transmit buffer to the BSC transmit FIFO, and
-copies any data in the BSC receive FIFO to the
-receive buffer.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-bscxfer: a structure defining the transfer.
-.br
-
-.br
-typedef struct
-.br
-{
-.br
- uint32_t control; // Write
-.br
- int rxCnt; // Read only
-.br
- char rxBuf[BSC_FIFO_SIZE]; // Read only
-.br
- int txCnt; // Write
-.br
- char txBuf[BSC_FIFO_SIZE]; // Write
-.br
-} bsc_xfer_t;
-.br
-
-.EE
-
-.br
-
-.br
-To start a transfer set control (see below), copy the bytes to
-be added to the transmit FIFO (if any) to txBuf and set txCnt to
-the number of copied bytes.
-
-.br
-
-.br
-Upon return rxCnt will be set to the number of received bytes placed
-in rxBuf.
-
-.br
-
-.br
-The returned function value is the status of the transfer (see below).
-
-.br
-
-.br
-If there was an error the status will be less than zero
-(and will contain the error code).
-
-.br
-
-.br
-The most significant word of the returned status contains the number
-of bytes actually copied from txBuf to the BSC transmit FIFO (may be
-less than requested if the FIFO already contained untransmitted data).
-
-.br
-
-.br
-Note that the control word sets the BSC mode. The BSC will stay in
-that mode until a different control word is sent.
-
-.br
-
-.br
-GPIO used for models other than those based on the BCM2711.
-
-.br
-
-.br
- SDA SCL MOSI SCLK MISO CE
-.br
-I2C 18 19 - - - -
-.br
-SPI - - 18 19 20 21
-.br
-
-.br
-
-.br
-GPIO used for models based on the BCM2711 (e.g. the Pi4B).
-
-.br
-
-.br
- SDA SCL MOSI SCLK MISO CE
-.br
-I2C 10 11 - - - -
-.br
-SPI - - 10 11 9 8
-.br
-
-.br
-
-.br
-When a zero control word is received the used GPIO will be reset
-to INPUT mode.
-
-.br
-
-.br
-control consists of the following bits.
-
-.br
-
-.br
-
-.EX
-22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
-.br
- a a a a a a a - - IT HC TF IR RE TE BK EC ES PL PH I2 SP EN
-.br
-
-.EE
-
-.br
-
-.br
-Bits 0-13 are copied unchanged to the BSC CR register. See
-pages 163-165 of the Broadcom peripherals document for full
-details.
-
-.br
-
-.br
-aaaaaaa defines the I2C slave address (only relevant in I2C mode)
-.br
-IT invert transmit status flags
-.br
-HC enable host control
-.br
-TF enable test FIFO
-.br
-IR invert receive status flags
-.br
-RE enable receive
-.br
-TE enable transmit
-.br
-BK abort operation and clear FIFOs
-.br
-EC send control register as first I2C byte
-.br
-ES send status register as first I2C byte
-.br
-PL set SPI polarity high
-.br
-PH set SPI phase high
-.br
-I2 enable I2C mode
-.br
-SP enable SPI mode
-.br
-EN enable BSC peripheral
-.br
-
-.br
-
-.br
-The returned status has the following format
-
-.br
-
-.br
-
-.EX
-20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
-.br
- S S S S S R R R R R T T T T T RB TE RF TF RE TB
-.br
-
-.EE
-
-.br
-
-.br
-Bits 0-15 are copied unchanged from the BSC FR register. See
-pages 165-166 of the Broadcom peripherals document for full
-details.
-
-.br
-
-.br
-SSSSS number of bytes successfully copied to transmit FIFO
-.br
-RRRRR number of bytes in receieve FIFO
-.br
-TTTTT number of bytes in transmit FIFO
-.br
-RB receive busy
-.br
-TE transmit FIFO empty
-.br
-RF receive FIFO full
-.br
-TF transmit FIFO full
-.br
-RE receive FIFO empty
-.br
-TB transmit busy
-.br
-
-.br
-
-.br
-The following example shows how to configure the BSC peripheral as
-an I2C slave with address 0x13 and send four bytes.
-
-.br
-
-.br
-\fBExample\fP
-.br
-
-.EX
-bsc_xfer_t xfer;
-.br
-
-.br
-xfer.control = (0x13<<16) | 0x305;
-.br
-
-.br
-memcpy(xfer.txBuf, "ABCD", 4);
-.br
-xfer.txCnt = 4;
-.br
-
-.br
-status = bsc_xfer(pi, &xfer);
-.br
-
-.br
-if (status >= 0)
-.br
-{
-.br
- // process transfer
-.br
-}
-.br
-
-.EE
-
-.IP "\fBint bsc_i2c(int pi, int i2c_addr, bsc_xfer_t *bscxfer)\fP"
-.IP "" 4
-This function allows the Pi to act as a slave I2C device.
-
-.br
-
-.br
-This function is not available on the BCM2711 (e.g.as
-used in the Pi4B).
-
-.br
-
-.br
-The data bytes (if any) are written to the BSC transmit
-FIFO and the bytes in the BSC receive FIFO are returned.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-i2c_addr: 0-0x7F.
-.br
- bscxfer: a structure defining the transfer.
-.br
-
-.br
-typedef struct
-.br
-{
-.br
- uint32_t control; // N/A
-.br
- int rxCnt; // Read only
-.br
- char rxBuf[BSC_FIFO_SIZE]; // Read only
-.br
- int txCnt; // Write
-.br
- char txBuf[BSC_FIFO_SIZE]; // Write
-.br
-} bsc_xfer_t;
-.br
-
-.EE
-
-.br
-
-.br
-txCnt is set to the number of bytes to be transmitted, possibly
-zero. The data itself should be copied to txBuf.
-
-.br
-
-.br
-Any received data will be written to rxBuf with rxCnt set.
-
-.br
-
-.br
-See \fBbsc_xfer\fP for details of the returned status value.
-
-.br
-
-.br
-If there was an error the status will be less than zero
-(and will contain the error code).
-
-.br
-
-.br
-Note that an i2c_address of 0 may be used to close
-the BSC device and reassign the used GPIO as inputs.
-
-.IP "\fBint event_callback(int pi, unsigned event, evtCBFunc_t f)\fP"
-.IP "" 4
-This function initialises an event callback.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-event: 0-31.
-.br
- f: the callback function.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns a callback id if OK, otherwise pigif_bad_malloc,
-pigif_duplicate_callback, or pigif_bad_callback.
-
-.br
-
-.br
-The callback is called with the event id, and tick, whenever the
-event occurs.
-
-.IP "\fBint event_callback_ex(int pi, unsigned event, evtCBFuncEx_t f, void *userdata)\fP"
-.IP "" 4
-This function initialises an event callback.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- event: 0-31.
-.br
- f: the callback function.
-.br
-userdata: a pointer to arbitrary user data.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns a callback id if OK, otherwise pigif_bad_malloc,
-pigif_duplicate_callback, or pigif_bad_callback.
-
-.br
-
-.br
-The callback is called with the event id, the tick, and the userdata
-pointer whenever the event occurs.
-
-.IP "\fBint event_callback_cancel(unsigned callback_id)\fP"
-.IP "" 4
-This function cancels an event callback identified by its id.
-
-.br
-
-.br
-
-.EX
-callback_id: >=0, as returned by a call to \fBevent_callback\fP or
-.br
-\fBevent_callback_ex\fP.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns 0 if OK, otherwise pigif_callback_not_found.
-
-.IP "\fBint wait_for_event(int pi, unsigned event, double timeout)\fP"
-.IP "" 4
-This function waits for an event for up to timeout seconds.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
- event: 0-31.
-.br
-timeout: >=0.
-.br
-
-.EE
-
-.br
-
-.br
-The function returns when the event occurs or after the timeout.
-
-.br
-
-.br
-The function returns 1 if the event occurred, otherwise 0.
-
-.IP "\fBint event_trigger(int pi, unsigned event)\fP"
-.IP "" 4
-This function signals the occurrence of an event.
-
-.br
-
-.br
-
-.EX
- pi: >=0 (as returned by \fBpigpio_start\fP).
-.br
-event: 0-31.
-.br
-
-.EE
-
-.br
-
-.br
-Returns 0 if OK, otherwise PI_BAD_EVENT_ID.
-
-.br
-
-.br
-An event is a signal used to inform one or more consumers
-to start an action. Each consumer which has registered an interest
-in the event (e.g. by calling \fBevent_callback\fP) will be informed by
-a callback.
-
-.br
-
-.br
-One event, PI_EVENT_BSC (31) is predefined. This event is
-auto generated on BSC slave activity.
-
-.br
-
-.br
-The meaning of other events is arbitrary.
-
-.br
-
-.br
-Note that other than its id and its tick there is no data associated
-with an event.
-.SH PARAMETERS
-
-.br
-
-.br
-
-.IP "\fBactive\fP: 0-1000000" 0
-
-.br
-
-.br
-The number of microseconds level changes are reported for once
-a noise filter has been triggered (by \fBsteady\fP microseconds of
-a stable level).
-
-.br
-
-.br
-
-.IP "\fB*addrStr\fP" 0
-A string specifying the host or IP address of the Pi running
-the pigpio daemon. It may be NULL in which case localhost
-is used unless overridden by the PIGPIO_ADDR environment
-variable.
-
-.br
-
-.br
-
-.IP "\fBarg1\fP" 0
-An unsigned argument passed to a user customised function. Its
-meaning is defined by the customiser.
-
-.br
-
-.br
-
-.IP "\fBarg2\fP" 0
-An unsigned argument passed to a user customised function. Its
-meaning is defined by the customiser.
-
-.br
-
-.br
-
-.IP "\fBargc\fP" 0
-The count of bytes passed to a user customised function.
-
-.br
-
-.br
-
-.IP "\fB*argx\fP" 0
-A pointer to an array of bytes passed to a user customised function.
-Its meaning and content is defined by the customiser.
-
-.br
-
-.br
-
-.IP "\fBbaud\fP" 0
-The speed of serial communication (I2C, SPI, serial link, waves) in
-bits per second.
-
-.br
-
-.br
-
-.IP "\fBbit\fP" 0
-A value of 0 or 1.
-
-.br
-
-.br
-
-.IP "\fBbits\fP" 0
-A value used to select GPIO. If bit n of bits is set then GPIO n is
-selected.
-
-.br
-
-.br
-A convenient way to set bit n is to or in (1<<n).
-
-.br
-
-.br
-e.g. to select bits 5, 9, 23 you could use (1<<5) | (1<<9) | (1<<23).
-
-.br
-
-.br
-
-.IP "\fBbsc_xfer_t\fP" 0
-
-.br
-
-.br
-
-.EX
-typedef struct
-.br
-{
-.br
- uint32_t control; // Write
-.br
- int rxCnt; // Read only
-.br
- char rxBuf[BSC_FIFO_SIZE]; // Read only
-.br
- int txCnt; // Write
-.br
- char txBuf[BSC_FIFO_SIZE]; // Write
-.br
-} bsc_xfer_t;
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fB*bscxfer\fP" 0
-A pointer to a \fBbsc_xfer_t\fP object used to control a BSC transfer.
-
-.br
-
-.br
-
-.IP "\fB*buf\fP" 0
-A buffer to hold data being sent or being received.
-
-.br
-
-.br
-
-.IP "\fBbufSize\fP" 0
-The size in bytes of a buffer.
-
-.br
-
-.br
-
-.br
-
-.br
-
-.IP "\fBbVal\fP: 0-255 (Hex 0x0-0xFF, Octal 0-0377)" 0
-An 8-bit byte value.
-
-.br
-
-.br
-
-.IP "\fBcallback_id\fP" 0
-A value >=0, as returned by a call to a callback function, one of
-
-.br
-
-.br
-\fBcallback\fP
-.br
-\fBcallback_ex\fP
-.br
-\fBevent_callback\fP
-.br
-\fBevent_callback_ex\fP
-
-.br
-
-.br
-The id is passed to \fBcallback_cancel\fP or \fBevent_callback_cancel\fP
-to cancel the callback.
-
-.br
-
-.br
-
-.IP "\fBCBFunc_t\fP" 0
-
-.EX
-typedef void (*CBFunc_t)
-.br
- (int pi, unsigned user_gpio, unsigned level, uint32_t tick);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBCBFuncEx_t\fP" 0
-
-.EX
-typedef void (*CBFuncEx_t)
-.br
- (int pi, unsigned user_gpio, unsigned level, uint32_t tick, void * userdata);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBchar\fP" 0
-A single character, an 8 bit quantity able to store 0-255.
-
-.br
-
-.br
-
-.IP "\fBclkfreq\fP: 4689-250M (13184-375M for the BCM2711)" 0
-The hardware clock frequency.
-
-.br
-
-.br
-
-.IP "\fBcount\fP" 0
-The number of bytes to be transferred in a file, I2C, SPI, or serial
-command.
-
-.br
-
-.br
-
-.IP "\fBCS\fP" 0
-The GPIO used for the slave select signal when bit banging SPI.
-
-.br
-
-.br
-
-.IP "\fBdata_bits\fP: 1-32" 0
-The number of data bits in each character of serial data.
-
-.br
-
-.br
-
-.EX
-#define PI_MIN_WAVE_DATABITS 1
-.br
-#define PI_MAX_WAVE_DATABITS 32
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBdouble\fP" 0
-A floating point number.
-
-.br
-
-.br
-
-.IP "\fBdutycycle\fP: 0-range" 0
-A number representing the ratio of on time to off time for PWM.
-
-.br
-
-.br
-The number may vary between 0 and range (default 255) where
-0 is off and range is fully on.
-
-.br
-
-.br
-
-.IP "\fBedge\fP" 0
-Used to identify a GPIO level transition of interest. A rising edge is
-a level change from 0 to 1. A falling edge is a level change from 1 to 0.
-
-.br
-
-.br
-
-.EX
-RISING_EDGE 0
-.br
-FALLING_EDGE 1
-.br
-EITHER_EDGE. 2
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBerrnum\fP" 0
-A negative number indicating a function call failed and the nature
-of the error.
-
-.br
-
-.br
-
-.IP "\fBevent\fP: 0-31" 0
-An event is a signal used to inform one or more consumers
-to start an action.
-
-.br
-
-.br
-
-.IP "\fBevtCBFunc_t\fP" 0
-
-.br
-
-.br
-
-.EX
-typedef void (*evtCBFunc_t)
-.br
- (int pi, unsigned event, uint32_t tick);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBevtCBFuncEx_t\fP" 0
-
-.br
-
-.br
-
-.EX
-typedef void (*evtCBFuncEx_t)
-.br
- (int pi, unsigned event, uint32_t tick, void *userdata);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBf\fP" 0
-A function.
-
-.br
-
-.br
-
-.IP "\fB*file\fP" 0
-A full file path. To be accessible the path must match an entry in
-/opt/pigpio/access.
-
-.br
-
-.br
-
-.IP "\fB*fpat\fP" 0
-A file path which may contain wildcards. To be accessible the path
-must match an entry in /opt/pigpio/access.
-
-.br
-
-.br
-
-.IP "\fBfrequency\fP: >=0" 0
-The number of times a GPIO is swiched on and off per second. This
-can be set per GPIO and may be as little as 5Hz or as much as
-40KHz. The GPIO will be on for a proportion of the time as defined
-by its dutycycle.
-
-.br
-
-.br
-
-.IP "\fBgpio\fP" 0
-A Broadcom numbered GPIO, in the range 0-53.
-
-.br
-
-.br
-There are 54 General Purpose Input Outputs (GPIO) named GPIO0 through
-GPIO53.
-
-.br
-
-.br
-They are split into two banks. Bank 1 consists of GPIO0 through
-GPIO31. Bank 2 consists of GPIO32 through GPIO53.
-
-.br
-
-.br
-All the GPIO which are safe for the user to read and write are in
-bank 1. Not all GPIO in bank 1 are safe though. Type 1 boards
-have 17 safe GPIO. Type 2 boards have 21. Type 3 boards have 26.
-
-.br
-
-.br
-See \fBget_hardware_revision\fP.
-
-.br
-
-.br
-The user GPIO are marked with an X in the following table.
-
-.br
-
-.br
-
-.EX
- 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
-.br
-Type 1 X X - - X - - X X X X X - - X X
-.br
-Type 2 - - X X X - - X X X X X - - X X
-.br
-Type 3 X X X X X X X X X X X X X X
-.br
-
-.br
- 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
-.br
-Type 1 - X X - - X X X X X - - - - - -
-.br
-Type 2 - X X - - - X X X X - X X X X X
-.br
-Type 3 X X X X X X X X X X X X - - - -
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBgpioPulse_t\fP" 0
-
-.EX
-typedef struct
-.br
-{
-.br
- uint32_t gpioOn;
-.br
- uint32_t gpioOff;
-.br
- uint32_t usDelay;
-.br
-} gpioPulse_t;
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBgpioThreadFunc_t\fP" 0
-
-.EX
-typedef void *(gpioThreadFunc_t) (void *);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBhandle\fP: >=0" 0
-A number referencing an object opened by one of
-
-.br
-
-.br
-\fBfile_open\fP
-.br
-\fBi2c_open\fP
-.br
-\fBnotify_open\fP
-.br
-\fBserial_open\fP
-.br
-\fBspi_open\fP
-
-.br
-
-.br
-
-.IP "\fBi2c_addr\fP: 0-0x7F" 0
-The address of a device on the I2C bus.
-
-.br
-
-.br
-
-.IP "\fBi2c_bus\fP: >=0" 0
-An I2C bus number.
-
-.br
-
-.br
-
-.IP "\fBi2c_flags\fP: 0" 0
-Flags which modify an I2C open command. None are currently defined.
-
-.br
-
-.br
-
-.IP "\fBi2c_reg\fP: 0-255" 0
-A register of an I2C device.
-
-.br
-
-.br
-
-.IP "\fB*inBuf\fP" 0
-A buffer used to pass data to a function.
-
-.br
-
-.br
-
-.IP "\fBinLen\fP" 0
-The number of bytes of data in a buffer.
-
-.br
-
-.br
-
-.IP "\fBint\fP" 0
-A whole number, negative or positive.
-
-.br
-
-.br
-
-.IP "\fBint32_t\fP" 0
-A 32-bit signed value.
-
-.br
-
-.br
-
-.IP "\fBinvert\fP" 0
-A flag used to set normal or inverted bit bang serial data level logic.
-
-.br
-
-.br
-
-.IP "\fBlevel\fP" 0
-The level of a GPIO. Low or High.
-
-.br
-
-.br
-
-.EX
-PI_OFF 0
-.br
-PI_ON 1
-.br
-
-.br
-PI_CLEAR 0
-.br
-PI_SET 1
-.br
-
-.br
-PI_LOW 0
-.br
-PI_HIGH 1
-.br
-
-.EE
-
-.br
-
-.br
-There is one exception. If a watchdog expires on a GPIO the level will be
-reported as PI_TIMEOUT. See \fBset_watchdog\fP.
-
-.br
-
-.br
-
-.EX
-PI_TIMEOUT 2
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBMISO\fP" 0
-The GPIO used for the MISO signal when bit banging SPI.
-
-.br
-
-.br
-
-.IP "\fBmode\fP" 0
-1. The operational mode of a GPIO, normally INPUT or OUTPUT.
-
-.br
-
-.br
-
-.EX
-PI_INPUT 0
-.br
-PI_OUTPUT 1
-.br
-PI_ALT0 4
-.br
-PI_ALT1 5
-.br
-PI_ALT2 6
-.br
-PI_ALT3 7
-.br
-PI_ALT4 3
-.br
-PI_ALT5 2
-.br
-
-.EE
-
-.br
-
-.br
-2. The mode of waveform transmission.
-
-.br
-
-.br
-
-.EX
-PI_WAVE_MODE_ONE_SHOT 0
-.br
-PI_WAVE_MODE_REPEAT 1
-.br
-PI_WAVE_MODE_ONE_SHOT_SYNC 2
-.br
-PI_WAVE_MODE_REPEAT_SYNC 3
-.br
-
-.EE
-
-.br
-
-.br
-3. A file open mode.
-
-.br
-
-.br
-
-.EX
-PI_FILE_READ 1
-.br
-PI_FILE_WRITE 2
-.br
-PI_FILE_RW 3
-.br
-
-.EE
-
-.br
-
-.br
-The following values can be or'd into the mode.
-
-.br
-
-.br
-
-.EX
-PI_FILE_APPEND 4
-.br
-PI_FILE_CREATE 8
-.br
-PI_FILE_TRUNC 16
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBMOSI\fP" 0
-The GPIO used for the MOSI signal when bit banging SPI.
-
-.br
-
-.br
-
-.IP "\fBnumBytes\fP" 0
-The number of bytes used to store characters in a string. Depending
-on the number of bits per character there may be 1, 2, or 4 bytes
-per character.
-
-.br
-
-.br
-
-.IP "\fBnumPar\fP: 0-10" 0
-The number of parameters passed to a script.
-
-.br
-
-.br
-
-.IP "\fBnumPulses\fP" 0
-The number of pulses to be added to a waveform.
-
-.br
-
-.br
-
-.IP "\fBoffset\fP" 0
-The associated data starts this number of microseconds from the start of
-the waveform.
-
-.br
-
-.br
-
-.IP "\fB*outBuf\fP" 0
-A buffer used to return data from a function.
-
-.br
-
-.br
-
-.IP "\fBoutLen\fP" 0
-The size in bytes of an output buffer.
-
-.br
-
-.br
-
-.IP "\fBpad\fP: 0-2" 0
-A set of GPIO which share common drivers.
-
-.br
-
-.br
-Pad GPIO
-.br
-0 0-27
-.br
-1 28-45
-.br
-2 46-53
-.br
-
-.br
-
-.br
-
-.IP "\fBpadStrength\fP: 1-16" 0
-The mA which may be drawn from each GPIO whilst still guaranteeing the
-high and low levels.
-
-.br
-
-.br
-
-.IP "\fB*param\fP" 0
-An array of script parameters.
-
-.br
-
-.br
-
-.IP "\fBpercent\fP: 0-100" 0
-The size of waveform as percentage of maximum available.
-
-.br
-
-.br
-
-.IP "\fBpi\fP" 0
-An integer defining a connected Pi. The value is returned by
-\fBpigpio_start\fP upon success.
-
-.br
-
-.br
-
-.IP "\fB*portStr\fP" 0
-A string specifying the port address used by the Pi running
-the pigpio daemon. It may be NULL in which case "8888"
-is used unless overridden by the PIGPIO_PORT environment
-variable.
-
-.br
-
-.br
-
-.IP "\fB*pth\fP" 0
-A thread identifier, returned by \fBstart_thread\fP.
-
-.br
-
-.br
-
-.br
-
-.br
-
-.IP "\fBpthread_t\fP" 0
-A thread identifier.
-
-.br
-
-.br
-
-.IP "\fBpud\fP: 0-2" 0
-The setting of the pull up/down resistor for a GPIO, which may be off,
-pull-up, or pull-down.
-
-.EX
-PI_PUD_OFF 0
-.br
-PI_PUD_DOWN 1
-.br
-PI_PUD_UP 2
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBpulseLen\fP" 0
-1-100, the length of a trigger pulse in microseconds.
-
-.br
-
-.br
-
-.IP "\fB*pulses\fP" 0
-An array of pulses to be added to a waveform.
-
-.br
-
-.br
-
-.IP "\fBpulsewidth\fP: 0, 500-2500" 0
-
-.EX
-PI_SERVO_OFF 0
-.br
-PI_MIN_SERVO_PULSEWIDTH 500
-.br
-PI_MAX_SERVO_PULSEWIDTH 2500
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBPWMduty\fP: 0-1000000 (1M)" 0
-The hardware PWM dutycycle.
-
-.br
-
-.br
-
-.EX
-#define PI_HW_PWM_RANGE 1000000
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBPWMfreq\fP: 1-125M (1-187.5M for the BCM2711)" 0
-The hardware PWM frequency.
-
-.br
-
-.br
-
-.EX
-#define PI_HW_PWM_MIN_FREQ 1
-.br
-#define PI_HW_PWM_MAX_FREQ 125000000
-.br
-#define PI_HW_PWM_MAX_FREQ_2711 187500000
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBrange\fP: 25-40000" 0
-The permissible dutycycle values are 0-range.
-
-.br
-
-.br
-
-.EX
-PI_MIN_DUTYCYCLE_RANGE 25
-.br
-PI_MAX_DUTYCYCLE_RANGE 40000
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fB*retBuf\fP" 0
-A buffer to hold a number of bytes returned to a used customised function,
-
-.br
-
-.br
-
-.IP "\fBretMax\fP" 0
-The maximum number of bytes a user customised function should return.
-
-.br
-
-.br
-
-.br
-
-.br
-
-.IP "\fB*rxBuf\fP" 0
-A pointer to a buffer to receive data.
-
-.br
-
-.br
-
-.IP "\fBSCL\fP" 0
-The user GPIO to use for the clock when bit banging I2C.
-
-.br
-
-.br
-
-.IP "\fBSCLK\fP" 0
-The GPIO used for the SCLK signal when bit banging SPI.
-
-.br
-
-.br
-
-.IP "\fB*script\fP" 0
-A pointer to the text of a script.
-
-.br
-
-.br
-
-.IP "\fBscript_id\fP" 0
-An id of a stored script as returned by \fBstore_script\fP.
-
-.br
-
-.br
-
-.IP "\fB*scriptName\fP" 0
-The name of a \fBshell_\fP script to be executed. The script must be present in
-/opt/pigpio/cgi and must have execute permission.
-
-.br
-
-.br
-
-.IP "\fB*scriptString\fP" 0
-The string to be passed to a \fBshell_\fP script to be executed.
-
-.br
-
-.br
-
-.IP "\fBSDA\fP" 0
-The user GPIO to use for data when bit banging I2C.
-
-.br
-
-.br
-
-.IP "\fBseconds\fP" 0
-The number of seconds.
-
-.br
-
-.br
-
-.IP "\fBseekFrom\fP" 0
-
-.br
-
-.br
-
-.EX
-PI_FROM_START 0
-.br
-PI_FROM_CURRENT 1
-.br
-PI_FROM_END 2
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBseekOffset\fP" 0
-The number of bytes to move forward (positive) or backwards (negative)
-from the seek position (start, current, or end of file).
-
-.br
-
-.br
-
-.IP "\fBser_flags\fP" 0
-Flags which modify a serial open command. None are currently defined.
-
-.br
-
-.br
-
-.IP "\fB*ser_tty\fP" 0
-The name of a serial tty device, e.g. /dev/ttyAMA0, /dev/ttyUSB0, /dev/tty1.
-
-.br
-
-.br
-
-.IP "\fBsize_t\fP" 0
-A standard type used to indicate the size of an object in bytes.
-
-.br
-
-.br
-
-.IP "\fBspi_channel\fP" 0
-A SPI channel, 0-2.
-
-.br
-
-.br
-
-.IP "\fBspi_flags\fP" 0
-See \fBspi_open\fP and \fBbb_spi_open\fP.
-
-.br
-
-.br
-
-.IP "\fBsteady\fP: 0-300000" 0
-
-.br
-
-.br
-The number of microseconds level changes must be stable for
-before reporting the level changed (\fBset_glitch_filter\fP) or triggering
-the active part of a noise filter (\fBset_noise_filter\fP).
-
-.br
-
-.br
-
-.IP "\fBstop_bits\fP: 2-8" 0
-The number of (half) stop bits to be used when adding serial data
-to a waveform.
-
-.br
-
-.br
-
-.EX
-#define PI_MIN_WAVE_HALFSTOPBITS 2
-.br
-#define PI_MAX_WAVE_HALFSTOPBITS 8
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fB*str\fP" 0
- An array of characters.
-
-.br
-
-.br
-
-.IP "\fBthread_func\fP" 0
-A function of type gpioThreadFunc_t used as the main function of a
-thread.
-
-.br
-
-.br
-
-.IP "\fBtimeout\fP" 0
-A GPIO watchdog timeout in milliseconds.
-
-.br
-
-.br
-
-.EX
-PI_MIN_WDOG_TIMEOUT 0
-.br
-PI_MAX_WDOG_TIMEOUT 60000
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fB*txBuf\fP" 0
-An array of bytes to transmit.
-
-.br
-
-.br
-
-.IP "\fBuint32_t\fP: 0-0-4,294,967,295 (Hex 0x0-0xFFFFFFFF)" 0
-A 32-bit unsigned value.
-
-.br
-
-.br
-
-.IP "\fBunsigned\fP" 0
-A whole number >= 0.
-
-.br
-
-.br
-
-.IP "\fBuser_gpio\fP" 0
-0-31, a Broadcom numbered GPIO.
-
-.br
-
-.br
-See \fBgpio\fP.
-
-.br
-
-.br
-
-.IP "\fB*userdata\fP" 0
-
-.br
-
-.br
-A pointer to arbitrary user data. This may be used to identify the instance.
-
-.br
-
-.br
-You must ensure that the pointer is in scope at the time it is processed. If
-it is a pointer to a global this is automatic. Do not pass the address of a
-local variable. If you want to pass a transient object then use the
-following technique.
-
-.br
-
-.br
-In the calling function:
-
-.br
-
-.br
-
-.EX
-user_type *userdata;
-.br
-.br
-.br
-user_type my_userdata;
-.br
-
-.br
-userdata = malloc(sizeof(user_type));
-.br
-.br
-.br
-*userdata = my_userdata;
-.br
-
-.EE
-
-.br
-
-.br
-In the receiving function:
-
-.br
-
-.br
-
-.EX
-user_type my_userdata = *(user_type*)userdata;
-.br
-
-.br
-free(userdata);
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBvoid\fP" 0
-Denoting no parameter is required
-
-.br
-
-.br
-
-.IP "\fBwave_add_*\fP" 0
-One of
-
-.br
-
-.br
-\fBwave_add_new\fP
-.br
-\fBwave_add_generic\fP
-.br
-\fBwave_add_serial\fP
-
-.br
-
-.br
-
-.IP "\fBwave_id\fP" 0
-A number representing a waveform created by \fBwave_create\fP.
-
-.br
-
-.br
-
-.IP "\fBwave_send_*\fP" 0
-One of
-
-.br
-
-.br
-\fBwave_send_once\fP
-.br
-\fBwave_send_repeat\fP
-
-.br
-
-.br
-
-.IP "\fBwVal\fP: 0-65535 (Hex 0x0-0xFFFF, Octal 0-0177777)" 0
-A 16-bit word value.
-
-.br
-
-.br
-.SH pigpiod_if2 Error Codes
-
-.EX
-
-.br
-typedef enum
-.br
-{
-.br
- pigif_bad_send = -2000,
-.br
- pigif_bad_recv = -2001,
-.br
- pigif_bad_getaddrinfo = -2002,
-.br
- pigif_bad_connect = -2003,
-.br
- pigif_bad_socket = -2004,
-.br
- pigif_bad_noib = -2005,
-.br
- pigif_duplicate_callback = -2006,
-.br
- pigif_bad_malloc = -2007,
-.br
- pigif_bad_callback = -2008,
-.br
- pigif_notify_failed = -2009,
-.br
- pigif_callback_not_found = -2010,
-.br
- pigif_unconnected_pi = -2011,
-.br
- pigif_too_many_pis = -2012,
-.br
-} pigifError_t;
-.br
-
-.br
-
-.EE
-
-.SH SEE ALSO
-
-pigpiod(1), pig2vcd(1), pigs(1), pigpio(3), pigpiod_if(3)
-.SH AUTHOR
-
-joan@abyz.me.uk
diff --git a/DOC/MAN/pigs.1 b/DOC/MAN/pigs.1
deleted file mode 100644
index 9b6192c..0000000
--- a/DOC/MAN/pigs.1
+++ /dev/null
@@ -1,6331 +0,0 @@
-
-." Process this file with
-." groff -man -Tascii foo.1
-."
-.TH pigs 1 2012-2020 Linux "pigpio archive"
-.SH NAME
-pigs - command line socket access to the pigpio daemon.
-
-/dev/pigpio - command line pipe access to the pigpio daemon.
-
-.SH SYNOPSIS
-
-.B sudo pigpiod
-
-then
-
-.B pigs {command}+
-
-or
-
-.B "echo {command}+ >/dev/pigpio"
-
-.SH DESCRIPTION
-
-.ad l
-
-.nh
-
-
-.br
-The socket and pipe interfaces allow control of the Pi's GPIO by
-passing messages to the running pigpio library.
-
-.br
-The normal way to start the pigpio library would be as a daemon during boot.
-
-.br
-
-.EX
-sudo pigpiod
-.br
-
-.EE
-
-.br
-.SS Features
-.br
-o hardware timed PWM on any of GPIO 0-31
-
-.br
-o hardware timed servo pulses on any of GPIO 0-31
-
-.br
-o reading/writing all of the GPIO in a bank as one operation
-
-.br
-o individually setting GPIO modes, reading and writing
-
-.br
-o notifications when any of GPIO 0-31 change state
-
-.br
-o the construction of output waveforms with microsecond timing
-
-.br
-o I2C, SPI, and serial link wrappers
-
-.br
-o creating and running scripts on the pigpio daemon
-
-.br
-.SS GPIO
-.br
-ALL GPIO are identified by their Broadcom number.
-
-.br
-.SS Usage
-.br
-pigs is a program and internally uses the socket interface to pigpio
-whereas /dev/pigpio uses the pipe interface.
-
-.br
-pigs and the pipe interface share the same commands and are invoked in
-a similar fashion from the command line.
-
-.br
-The pigpio library must be running, either by running a program linked
-with the library or starting the pigpio daemon (sudo pigpiod).
-
-.br
-pigs {command}+
-
-.br
-echo "{command}+" >/dev/pigpio
-
-.br
-pigs will show the result of the command on screen.
-
-.br
-The pigs process returns an exit status (which can be displayed with
-the command echo $?).
-
-.br
-
-.EX
-PIGS_OK 0
-.br
-PIGS_CONNECT_ERR 255
-.br
-PIGS_OPTION_ERR 254
-.br
-PIGS_SCRIPT_ERR 253
-.br
-.br
-.br
-
-.EE
-
-.br
-The results of /dev/pigpio commands need to be read from /dev/pigout,
-e.g. cat /dev/pigout (try cat /dev/pigout& so that all subsequent
-results are shown on screen).
-
-.br
-In both cases if an error was detected a message will have been written
-to /dev/pigerr (try cat /dev/pigerr&). This is likely to be more
-informative than the message returned by pigs or the error code
-returned by the pipe interface.
-
-.br
-Several commands may be entered on a line. If present PROC and PARSE must
-be the last command on a line.
-
-.br
-E.g.
-
-.br
-
-.EX
-pigs w 22 1 mils 1000 w 22 0
-.br
-
-.EE
-
-.br
-is equivalent to
-
-.br
-
-.EX
-pigs w 22 1
-.br
-pigs mils 1000
-.br
-pigs w 22 0
-.br
-
-.EE
-
-.br
-and
-
-.br
-
-.EX
-echo "m 4 w w 4 0 mils 250 m 4 r r 4" >/dev/pigpio
-.br
-
-.EE
-
-.br
-is equivalent to
-
-.br
-
-.EX
-echo "m 4 w" >/dev/pigpio
-.br
-echo "w 4 0" >/dev/pigpio
-.br
-echo "mils 250" >/dev/pigpio
-.br
-echo "m 4 r" >/dev/pigpio
-.br
-echo "r 4" >/dev/pigpio
-.br
-
-.EE
-
-.br
-.SS Notes
-.br
-The examples from now on will show the pigs interface but the same
-commands will also work on the pipe interface.
-
-.br
-pigs does not show the status of successful commands unless the
-command itself returns data. The status (0) will be returned to
-pigs but will be discarded.
-
-.br
-The status/data of each command sent to the pipe interface should
-be read from /dev/pigout.
-
-.br
-When a command takes a number as a parameter it may be entered as hex
-(precede by 0x), octal (precede by 0), or decimal.
-
-.br
-E.g. 23 is 23 decimal, 0x100 is 256 decimal, 070 is 56 decimal.
-
-.br
-Some commands can return a variable number of data bytes. By
-default this data is displayed as decimal. The pigs -a option
-can be used to force the display as ASCII and the pigs -x
-option can be used to force the display as hex.
-
-.br
-E.g. assuming the transmitted serial data is the letters ABCDEONM
-
-.br
-
-.EX
-$ pigs slr 4 100
-.br
-8 65 66 67 68 69 79 78 77
-.br
-
-.br
-$ pigs -a slr 4 100
-.br
-8 ABCDEONM
-.br
-
-.br
-$ pigs -x slr 4 100
-.br
-8 41 42 43 44 45 4f 4e 4d
-.br
-
-.EE
-
-.br
-
-.SH OVERVIEW
-.SS BASIC
-.B M/MODES g m
-Set GPIO mode
-.P
-.B MG/MODEG g
-Get GPIO mode
-.P
-.B PUD g p
-Set GPIO pull up/down
-.P
-.B R/READ g
-Read GPIO level
-.P
-.B W/WRITE g L
-Write GPIO level
-.P
-.SS PWM (overrides servo commands on same GPIO)
-.B P/PWM u v
-Set GPIO PWM value
-.P
-.B PFS u v
-Set GPIO PWM frequency
-.P
-.B PRS u v
-Set GPIO PWM range
-.P
-.B GDC u
-Get GPIO PWM dutycycle
-.P
-.B PFG u
-Get GPIO PWM frequency
-.P
-.B PRG u
-Get GPIO PWM range
-.P
-.B PRRG u
-Get GPIO PWM real range
-.P
-.SS Servo (overrides PWM commands on same GPIO)
-.B S/SERVO u v
-Set GPIO servo pulsewidth
-.P
-.B GPW u
-Get GPIO servo pulsewidth
-.P
-.SS INTERMEDIATE
-.B TRIG u pl L
-Send a trigger pulse
-.P
-.B WDOG u v
-Set GPIO watchdog
-.P
-.B BR1
-Read bank 1 GPIO
-.P
-.B BR2
-Read bank 2 GPIO
-.P
-.B BC1 bits
-Clear specified GPIO in bank 1
-.P
-.B BC2 bits
-Clear specified GPIO in bank 2
-.P
-.B BS1 bits
-Set specified GPIO in bank 1
-.P
-.B BS2 bits
-Set specified GPIO in bank 2
-.P
-.SS ADVANCED
-.B NO
-Request a notification
-.P
-.B NC h
-Close notification
-.P
-.B NB h bits
-Start notification
-.P
-.B NP h
-Pause notification
-.P
-.B HC g cf
-Set hardware clock frequency
-.P
-.B HP g pf pdc
-Set hardware PWM frequency and dutycycle
-.P
-.B FG u stdy
-Set a glitch filter on a GPIO
-.P
-.B FN u stdy actv
-Set a noise filter on a GPIO
-.P
-.B PADS pad padma
-Set pad drive strength
-.P
-.B PADG pad
-Get pad drive strength
-.P
-.B SHELL name str
-Execute a shell command
-.P
-.SS Custom
-.B CF1 uvs
-Custom function 1
-.P
-.B CF2 uvs
-Custom function 2
-.P
-.SS Events
-.B EVM h bits
-Set events to monitor
-.P
-.B EVT event
-Trigger event
-.P
-.SS Scripts
-.B PROC t
-Store script
-.P
-.B PROCR sid pars
-Run script
-.P
-.B PROCU sid pars
-Set script parameters
-.P
-.B PROCP sid
-Get script status and parameters
-.P
-.B PROCS sid
-Stop script
-.P
-.B PROCD sid
-Delete script
-.P
-.B PARSE t
-Validate script
-.P
-.SS I2C
-.B I2CO ib id if
-Open I2C bus and device with flags
-.P
-.B I2CC h
-Close I2C handle
-.P
-.B I2CWQ h bit
-smb Write Quick: write bit
-.P
-.B I2CRS h
-smb Read Byte: read byte
-.P
-.B I2CWS h bv
-smb Write Byte: write byte
-.P
-.B I2CRB h r
-smb Read Byte Data: read byte from register
-.P
-.B I2CWB h r bv
-smb Write Byte Data: write byte to register
-.P
-.B I2CRW h r
-smb Read Word Data: read word from register
-.P
-.B I2CWW h r wv
-smb Write Word Data: write word to register
-.P
-.B I2CRK h r
-smb Read Block Data: read data from register
-.P
-.B I2CWK h r bvs
-smb Write Block Data: write data to register
-.P
-.B I2CWI h r bvs
-smb Write I2C Block Data
-.P
-.B I2CRI h r num
-smb Read I2C Block Data: read bytes from register
-.P
-.B I2CRD h num
-i2c Read device
-.P
-.B I2CWD h bvs
-i2c Write device
-.P
-.B I2CPC h r wv
-smb Process Call: exchange register with word
-.P
-.B I2CPK h r bvs
-smb Block Process Call: exchange data bytes with register
-.P
-.B I2CZ h bvs
-Performs multiple I2C transactions
-.P
-.SS I2C BIT BANG
-.B BI2CO sda scl b
-Open bit bang I2C
-.P
-.B BI2CC sda
-Close bit bang I2C
-.P
-.B BI2CZ sda bvs
-I2C bit bang multiple transactions
-.P
-.SS I2C/SPI SLAVE
-.B BSCX bctl bvs
-BSC I2C/SPI transfer
-.P
-.SS SERIAL
-.B SERO dev b sef
-Open serial device dev at baud b with flags
-.P
-.B SERC h
-Close serial handle
-.P
-.B SERRB
-Read byte from serial handle
-.P
-.B SERWB h bv
-Write byte to serial handle
-.P
-.B SERR h num
-Read bytes from serial handle
-.P
-.B SERW h bvs
-Write bytes to serial handle
-.P
-.B SERDA h
-Check for serial data ready to read
-.P
-.SS SERIAL BIT BANG (read only)
-.B SLRO u b db
-Open GPIO for bit bang serial data
-.P
-.B SLRC u
-Close GPIO for bit bang serial data
-.P
-.B SLRI u v
-Sets bit bang serial data logic levels
-.P
-.B SLR u num
-Read bit bang serial data from GPIO
-.P
-.SS SPI
-.B SPIO c b spf
-SPI open channel at baud b with flags
-.P
-.B SPIC h
-SPI close handle
-.P
-.B SPIR h num
-SPI read bytes from handle
-.P
-.B SPIW h bvs
-SPI write bytes to handle
-.P
-.B SPIX h bvs
-SPI transfer bytes to handle
-.P
-.SS SPI BIT BANG
-.B BSPIO cs miso mosi sclk b spf
-Open bit bang SPI
-.P
-.B BSPIC cs
-Close bit bang SPI
-.P
-.B BSPIX cs bvs
-SPI bit bang transfer
-.P
-.SS FILES
-.B FO file mode
-Open a file in mode
-.P
-.B FC h
-Close file handle
-.P
-.B FR h num
-Read bytes from file handle
-.P
-.B FW h bvs
-Write bytes to file handle
-.P
-.B FS h num from
-Seek to file handle position
-.P
-.B FL pat num
-List files which match pattern
-.P
-.SS WAVES
-.B WVCLR
-Clear all waveforms
-.P
-.B WVNEW
-Initialise a new waveform
-.P
-.B WVAG trips
-Add generic pulses to waveform
-.P
-.B WVAS u b db sb o bvs
-Add serial data to waveform
-.P
-.B WVCRE
-Create a waveform
-.P
-.B WVCAP
-Create a waveform of fixed size
-.P
-.B WVDEL wid
-Delete selected waveform
-.P
-.B WVTX wid
-Transmits waveform once
-.P
-.B WVTXM wid wmde
-Transmits waveform using mode
-.P
-.B WVTXR wid
-Transmits waveform repeatedly
-.P
-.B WVCHA bvs
-Transmits a chain of waveforms
-.P
-.B WVTAT
-Returns the current transmitting waveform
-.P
-.B WVBSY
-Check if waveform is being transmitted
-.P
-.B WVHLT
-Stop waveform
-.P
-.B WVSC ws
-Get waveform DMA CB stats
-.P
-.B WVSM ws
-Get waveform time stats
-.P
-.B WVSP ws
-Get waveform pulse stats
-.P
-.SS UTILITIES
-.B H/HELP
-Display command help
-.P
-.B HWVER
-Get hardware version
-.P
-.B MICS v
-Microseconds delay
-.P
-.B MILS v
-Milliseconds delay
-.P
-.B PIGPV
-Get pigpio library version
-.P
-.B T/TICK
-Get current tick
-.P
-.SS CONFIGURATION
-.B CGI
-Configuration get internals
-.P
-.B CSI v
-Configuration set internals
-.P
-
-.SH COMMANDS
-
-.br
-
-.IP "\fBBC1 bits\fP - Clear specified GPIO in bank 1"
-.IP "" 4
-This command clears (sets low) the GPIO specified by \fBbits\fP in bank 1.
-Bank 1 consists of GPIO 0-31.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs bc1 0x400010 # clear GPIO 4 (1<<4) and 22 (1<<22)
-.br
-
-.br
-$ pigs bc1 32 # clear GPIO 5 (1<<5)
-.br
--42
-.br
-ERROR: no permission to update one or more GPIO
-.br
-
-.EE
-
-.br
-
-.IP "\fBBC2 bits\fP - Clear specified GPIO in bank 2"
-.IP "" 4
-This command clears (sets low) the GPIO specified by \fBbits\fP in bank 2.
-Bank 2 consists of GPIO 32-53.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs bc2 0x8000 # clear GPIO 47 (activity LED on A+/B+/Pi2/Pi3)
-.br
-
-.br
-$ pigs bc2 1 # clear GPIO 32 (first in bank 2)
-.br
--42
-.br
-ERROR: no permission to update one or more GPIO
-.br
-
-.EE
-
-.br
-
-.IP "\fBBI2CC sda\fP - Close bit bang I2C"
-.IP "" 4
-This command signals that bit banging I2C on \fBsda\fP (and \fBscl\fP) is no
-longer required.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs bi2cc 5
-.br
-
-.EE
-
-.br
-
-.IP "\fBBI2CO sda scl b\fP - Open bit bang I2C"
-.IP "" 4
-This command signals that GPIO \fBsda\fP and \fBscl\fP are to be used
-for bit banging I2C at \fBb\fP baud.
-
-.br
-Bit banging I2C allows for certain operations which are not possible
-with the standard I2C driver.
-
-.br
-o baud rates as low as 50
-.br
-o repeated starts
-.br
-o clock stretching
-.br
-o I2C on any pair of spare GPIO
-
-.br
-The baud rate may be between 50 and 500000 bits per second.
-
-.br
-The GPIO used for SDA and SCL must have pull-ups to 3V3 connected. As
-a guide the hardware pull-ups on pins 3 and 5 are 1k8 in value.
-
-.br
-
-.IP "\fBBI2CZ sda bvs\fP - I2C bit bang multiple transactions"
-.IP "" 4
-This function executes a sequence of bit banged I2C operations. The
-operations to be performed are specified by the contents of \fBbvs\fP
-which contains the concatenated command codes and associated data.
-
-.br
-The following command codes are supported:
-
-.br
-
-.EX
-Name Cmd & Data Meaning
-End 0 No more commands
-Escape 1 Next P is two bytes
-Start 2 Start condition
-Stop 3 Stop condition
-Address 4 P Set I2C address to P
-Flags 5 lsb msb Set I2C flags to lsb + (msb << 8)
-Read 6 P Read P bytes of data
-Write 7 P ... Write P bytes of data
-
-.EE
-
-.br
-The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-
-.br
-The address and flags default to 0. The address and flags maintain
-their previous value until updated.
-
-.br
-No flags are currently defined.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-Set address 0x53
-.br
-start, write 0x32, (re)start, read 6 bytes, stop
-.br
-Set address 0x1E
-.br
-start, write 0x03, (re)start, read 6 bytes, stop
-.br
-Set address 0x68
-.br
-start, write 0x1B, (re)start, read 8 bytes, stop
-.br
-End
-.br
-
-.br
-0x04 0x53
-.br
-0x02 0x07 0x01 0x32 0x02 0x06 0x06 0x03
-.br
-
-.br
-0x04 0x1E
-.br
-0x02 0x07 0x01 0x03 0x02 0x06 0x06 0x03
-.br
-
-.br
-0x04 0x68
-.br
-0x02 0x07 0x01 0x1B 0x02 0x06 0x08 0x03
-.br
-
-.br
-0x00
-.br
-
-.EE
-
-.br
-
-.IP "\fBBR1 \fP - Read bank 1 GPIO"
-.IP "" 4
-This command read GPIO 0-31 (bank 1) and returns the levels as a
-32-bit hexadecimal value.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs br1
-.br
-1001C1CF
-.br
-
-.EE
-
-.br
-
-.IP "\fBBR2 \fP - Read bank 2 GPIO"
-.IP "" 4
-This command read GPIO 32-53 (bank 2) and returns the levels as a
-32-bit hexadecimal value.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs br2
-.br
-003F0000
-.br
-
-.EE
-
-.br
-
-.IP "\fBBS1 bits\fP - Set specified GPIO in bank 1"
-.IP "" 4
-This command sets (sets high) the GPIO specified by \fBbits\fP in bank 1.
-Bank 1 consists of GPIO 0-31.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs bs1 16 # set GPIO 4 (1<<4)
-.br
-
-.br
-$ pigs bs1 1 # set GPIO 1 (1<<0)
-.br
--42
-.br
-ERROR: no permission to update one or more GPIO
-.br
-
-.EE
-
-.br
-
-.IP "\fBBS2 bits\fP - Set specified GPIO in bank 2"
-.IP "" 4
-This command sets (sets high) the GPIO specified by \fBbits\fP in bank 2.
-Bank 2 consists of GPIO 32-53.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs bs2 0x40 # set GPIO 38 (enable high current mode A+/B+/Pi2/Pi3)
-.br
-
-.br
-$ pigs bs2 1 # set GPIO 32 (first in bank 2)
-.br
--42
-.br
-ERROR: no permission to update one or more GPIO
-.br
-
-.EE
-
-.br
-
-.IP "\fBBSCX bctl bvs\fP - BSC I2C/SPI transfer"
-.IP "" 4
-
-.br
-This command performs a BSC I2C/SPI slave transfer as defined by
-\fBbctl\fP with data \fBbvs\fP.
-
-.br
-This function provides a low-level interface to the SPI/I2C Slave
-peripheral on the BCM chip.
-
-.br
-This peripheral allows the Pi to act as a hardware slave device
-on an I2C or SPI bus.
-
-.br
-This is not a bit bang version and as such is OS timing
-independent. The bus timing is handled directly by the chip.
-
-.br
-The output process is simple. You simply append data to the FIFO
-buffer on the chip. This works like a queue, you add data to the
-queue and the master removes it.
-
-.br
-I can't get SPI to work properly. I tried with a
-control word of 0x303 and swapped MISO and MOSI.
-
-.br
-The command sets the BSC mode and writes any data \fBbvs\fP
-to the BSC transmit FIFO. It returns the data count (at least 1
-for the status word), the status word, followed by any data bytes
-read from the BSC receive FIFO.
-
-.br
-Note that the control word sets the BSC mode. The BSC will stay in
-that mode until a different control word is sent.
-
-.br
-For I2C use a control word of (I2C address << 16) + 0x305.
-
-.br
-E.g. to talk as I2C slave with address 0x13 use 0x130305.
-
-.br
-GPIO used for models other than those based on the BCM2711.
-
-.br
-
-.EX
- SDA SCL MOSI SCLK MISO CE
-I2C 18 19 - - - -
-SPI - - 18 19 20 21
-
-.EE
-
-.br
-GPIO used for models based on the BCM2711 (e.g. the Pi4B).
-
-.br
-
-.EX
- SDA SCL MOSI SCLK MISO CE
-I2C 10 11 - - - -
-SPI - - 10 11 9 8
-
-.EE
-
-.br
-When a zero control word is received the used GPIO will be reset
-to INPUT mode.
-
-.br
-The control word consists of the following bits.
-
-.br
-
-.EX
-22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
-.br
- a a a a a a a - - IT HC TF IR RE TE BK EC ES PL PH I2 SP EN
-.br
-
-.EE
-
-.br
-Bits 0-13 are copied unchanged to the BSC CR register. See
-pages 163-165 of the Broadcom peripherals document for full
-details.
-
-.br
-
-.EX
-aaaaaaa defines the I2C slave address (only relevant in I2C mode)
-IT invert transmit status flags
-HC enable host control
-TF enable test FIFO
-IR invert receive status flags
-RE enable receive
-TE enable transmit
-BK abort operation and clear FIFOs
-EC send control register as first I2C byte
-ES send status register as first I2C byte
-PL set SPI polarity high
-PH set SPI phase high
-I2 enable I2C mode
-SP enable SPI mode
-EN enable BSC peripheral
-
-.EE
-
-.br
-The returned status has the following format
-
-.br
-
-.EX
-20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
-.br
- S S S S S R R R R R T T T T T RB TE RF TF RE TB
-.br
-
-.EE
-
-.br
-Bits 0-15 are copied unchanged from the BSC FR register. See
-pages 165-166 of the Broadcom peripherals document for full
-details.
-
-.br
-
-.EX
-SSSSS number of bytes successfully copied to transmit FIFO
-RRRRR number of bytes in receieve FIFO
-TTTTT number of bytes in transmit FIFO
-RB receive busy
-TE transmit FIFO empty
-RF receive FIFO full
-TF transmit FIFO full
-RE receive FIFO empty
-TB transmit busy
-
-.EE
-
-.br
-This example assumes that GPIO 2/3 are connected to GPIO 18/19
-(GPIO 10/11 on the BCM2711).
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs bscx 0x130305 # start BSC as I2C slave 0x13
-.br
-1 18
-.br
-
-.br
-$ i2cdetect -y 1
-.br
- 0 1 2 3 4 5 6 7 8 9 a b c d e f
-.br
-00: -- -- -- -- -- -- -- -- -- -- -- -- --
-.br
-10: -- -- -- 13 -- -- -- -- -- -- -- -- -- -- -- --
-.br
-20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-.br
-30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-.br
-40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-.br
-50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-.br
-60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-.br
-70: -- -- -- -- -- -- -- --
-.br
-
-.br
-$ pigs i2co 1 0x13 0 # get handle for device 0x13 on bus 1
-.br
-0
-.br
-
-.br
-$ pigs i2cwd 0 90 87 51 9 23 # write 5 bytes
-.br
-
-.br
-$ pigs bscx 0x130305 # check for data
-.br
-6 18 90 87 51 9 23
-.br
-
-.br
-$ pigs bscx 0x130305 11 13 15 17 # check for data and send 4 bytes
-.br
-1 262338
-.br
-
-.br
-$ pigs i2crd 0 4 # read 4 bytes
-.br
-4 11 13 15 17
-.br
-
-.br
-$ pigs i2cwd 0 90 87 51 9 23 # write 5 bytes
-.br
-$ pigs bscx 0x130305 11 13 15 17 # check for data and send 4 bytes
-.br
-6 262338 90 87 51 9 23
-.br
-
-.br
-$ pigs i2crd 0 4
-.br
-4 11 13 15 17
-.br
-
-.br
-$ pigs bscx 0x130305 22 33 44 55 66
-.br
-1 327938
-.br
-$ pigs i2crd 0 5
-.br
-5 22 33 44 55 66
-.br
-
-.EE
-
-.br
-
-.IP "\fBBSPIC cs\fP - Close bit bang SPI"
-.IP "" 4
-
-.br
-This command stops bit banging SPI on a set of GPIO
-opened with \fBBSPIO\fP.
-
-.br
-The set of GPIO is specifed by \fBcs\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs bspic 10
-.br
-
-.br
-$ pigs bspic 10
-.br
--142
-.br
-ERROR: no bit bang SPI in progress on GPIO
-.br
-
-.EE
-
-.br
-
-.IP "\fBBSPIO cs miso mosi sclk b spf\fP - Open bit bang SPI"
-.IP "" 4
-
-.br
-This command starts bit banging SPI on a group of GPIO with slave
-select \fBcs\fP, MISO \fBmiso\fP, MOSI \fBmosi\fP, and clock \fBsclk\fP.
-
-.br
-Data will be transferred at baud \fBb\fP bits per second (which may
-be set in the range 50-250000).
-
-.br
-The flags \fBspf\fP may be used to modify the default behaviour of
-mode 0, active low chip select.
-
-.br
-The flags consists of the least significant 22 bits.
-
-.br
-
-.EX
-21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
-.br
- 0 0 0 0 0 0 R T 0 0 0 0 0 0 0 0 0 0 0 p m m
-.br
-
-.EE
-
-.br
-mm defines the SPI mode.
-
-.br
-
-.EX
-Mode POL PHA
-.br
- 0 0 0
-.br
- 1 0 1
-.br
- 2 1 0
-.br
- 3 1 1
-.br
-
-.EE
-
-.br
-p is 0 if CS is active low (default) and 1 for active high.
-
-.br
-T is 1 if the least significant bit is transmitted on MOSI first, the
-default (0) shifts the most significant bit out first.
-
-.br
-R is 1 if the least significant bit is received on MISO first, the
-default (0) receives the most significant bit first.
-
-.br
-The other bits in flags should be set to zero.
-
-.br
-Upon success 0 is returned. On error a negative status code
-will be returned.
-
-.br
-If more than one device is connected to the SPI bus (defined by
-SCLK, MOSI, and MISO) each must have its own CS.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs bspio 9 11 12 13 50000 0
-.br
-
-.br
-$ pigs bspio 10 11 12 13 50000 0
-.br
-
-.br
-$ pigs bspio 29 19 20 21 50000 0 # GPIO 29 not avaialble on this Pi
-.br
--41
-.br
-ERROR: no permission to update GPIO
-.br
-
-.EE
-
-.br
-
-.IP "\fBBSPIX cs bvs\fP - SPI bit bang transfer"
-.IP "" 4
-
-.br
-This command writes bytes \fBbvs\fP to the bit bang SPI device
-associated with slave select \fBcs\fP. It returns the same
-number of bytes read from the device.
-
-.br
-Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs bspio 5 13 19 12 10000 0 # MCP4251 DAC
-.br
-$ pigs bspio 6 13 19 12 20000 3 # MCP3008 ADC
-.br
-
-.br
-$ pigs bspix 5 0 16 # set DAC to 16
-.br
-2 255 255
-.br
-
-.br
-$ pigs bspix 5 12 0 # read back DAC
-.br
-2 254 16
-.br
-
-.br
-$ pigs bspix 6 1 128 0 # read ADC input 0
-.br
-3 0 3 184 # 952
-.br
-
-.br
-$ pigs bspix 5 0 240 # set DAC to 240
-.br
-2 255 255
-.br
-
-.br
-$ pigs bspix 5 12 0 # read back DAC
-.br
-2 254 240
-.br
-
-.br
-$ pigs bspix 6 1 128 0 # read ADC input 0
-.br
-3 0 0 63 # 63
-.br
-
-.br
-$ pigs bspix 5 0 128 # set DAC to 128
-.br
-2 255 255
-.br
-
-.br
-$ pigs bspix 5 12 0 # read back DAC
-.br
-2 254 128
-.br
-
-.br
-$ pigs bspix 6 1 128 0 # read ADC input 0
-.br
-3 0 1 255 # 511
-.br
-
-.br
-$ pigs bspic 5 # close SPI CS 5
-.br
-$ pigs bspic 6 # close SPI CS 6
-.br
-
-.br
-$ pigs bspic 5 # try to close SPI CS 5 again
-.br
--142
-.br
-ERROR: no bit bang SPI in progress on GPIO
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBCF1 uvs\fP - Custom function 1"
-.IP "" 4
-
-.br
-This command calls a user customised function. The meaning of
-any paramaters and the returned value is defined by the
-customiser.
-
-.br
-
-.IP "\fBCF2 uvs\fP - Custom function 2"
-.IP "" 4
-
-.br
-This command calls a user customised function. The meaning of
-any paramaters and the returned value is defined by the
-customiser.
-
-.br
-
-.IP "\fBCGI \fP - Configuration get internals"
-.IP "" 4
-This command returns the value of the internal library
-configuration settings.
-
-.br
-
-.IP "\fBCSI v\fP - Configuration set internals"
-.IP "" 4
-This command sets the value of the internal library
-configuration settings to \fBv\fP.
-
-.br
-
-.IP "\fBEVM h bits\fP - Set events to monitor"
-.IP "" 4
-This command starts event reporting on handle \fBh\fP (returned by
-a prior call to \fBNO\fP).
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-The notification gets reports for each event specified by \fBbits\fP.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs evm 0 -1 # Shorthand for events 0-31.
-.br
-$ pigs evm 0 0xf0 # Get notifications for events 4-7.
-.br
-
-.br
-$ pigs evm 1 0xf
-.br
--25
-.br
-ERROR: unknown handle
-.br
-
-.EE
-
-.br
-
-.IP "\fBEVT event\fP - Trigger event"
-.IP "" 4
-This command triggers event \fBevent\fP.
-
-.br
-One event, number 31, is predefined. This event is
-auto generated on BSC slave activity.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs evt 12
-.br
-$ pigs evt 5
-.br
-
-.br
-$ pigs evt 32
-.br
--143
-.br
-ERROR: bad event id
-.br
-
-.EE
-
-.br
-
-.IP "\fBFC h\fP - Close file handle"
-.IP "" 4
-This command closes a file handle \fBh\fP previously opened with \fBFO\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs fc 0 # First close okay.
-.br
-
-.br
-$ pigs fc 0 # Second fails.
-.br
--25
-.br
-ERROR: unknown handle
-.br
-
-.EE
-
-.br
-
-.IP "\fBFG u stdy\fP - Set a glitch filter on a GPIO"
-.IP "" 4
-
-.br
-Level changes on the GPIO \fBu\fP are not reported unless the level
-has been stable for at least \fBstdy\fP microseconds. The
-level is then reported. Level changes of less than \fBstdy\fP
-microseconds are ignored.
-
-.br
-The filter only affects callbacks (including pipe notifications).
-
-.br
-The \fBR/READ\fP, \fBBR1\fP, and \fBBR2\fP commands are not affected.
-
-.br
-Note, each (stable) edge will be timestamped \fBstdy\fP microseconds
-after it was first detected.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs fg 4 250
-.br
-
-.br
-$ pigs fg 4 1000000
-.br
--125
-.br
-ERROR: bad filter parameter
-.br
-
-.EE
-
-.br
-
-.IP "\fBFL pat num\fP - List files which match pattern"
-.IP "" 4
-This command returns a list of the files matching \fBpat\fP. Up
-to \fBnum\fP bytes may be returned.
-
-.br
-Upon success the count of returned bytes followed by the matching
-files is returned. On error a negative status code will be returned.
-
-.br
-A newline (0x0a) character separates each file name.
-
-.br
-Only files which have a matching entry in /opt/pigpio/access may
-be listed.
-
-.br
-Suppose /opt/pigpio/access contains
-
-.br
-/sys/bus/w1/devices/28*/w1_slave r
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs -a fl "/sys/bus/w1/devices/28*/w1_slave" 5000
-.br
-90 /sys/bus/w1/devices/28-000005d34cd2/w1_slave
-.br
-/sys/bus/w1/devices/28-001414abbeff/w1_slave
-.br
-
-.br
-$ pigs -a fl "/sys/bus/*" 5000
-.br
-ERROR: no permission to access file
-.br
--137
-.br
-
-.EE
-
-.br
-
-.IP "\fBFN u stdy actv\fP - Set a noise filter on a GPIO"
-.IP "" 4
-
-.br
-Level changes on the GPIO \fBu\fP are ignored until a level which has
-been stable for \fBstdy\fP microseconds is detected. Level
-changes on the GPIO are then reported for \fBactv\fP microseconds
-after which the process repeats.
-
-.br
-The filter only affects callbacks (including pipe notifications).
-
-.br
-The \fBR/READ\fP, \fBBR1\fP, and \fBBR2\fP commands are not affected.
-
-.br
-Note, level changes before and after the active period may
-be reported. Your software must be designed to cope with
-such reports.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs fn 7 250 1000
-.br
-
-.br
-$ pigs fn 7 2500000 1000
-.br
--125
-.br
-ERROR: bad filter parameter
-.br
-
-.EE
-
-.br
-
-.IP "\fBFO file mode\fP - Open a file in mode"
-.IP "" 4
-This function returns a handle to a file \fBfile\fP opened
-in a specified mode \fBmode\fP.
-
-.br
-Upon success a handle (>=0) is returned. On error a negative status code
-will be returned.
-
-.br
-File
-
-.br
-A file may only be opened if permission is granted by an entry in
-/opt/pigpio/access. This is intended to allow remote access to files
-in a more or less controlled manner.
-
-.br
-Each entry in /opt/pigpio/access takes the form of a file path
-which may contain wildcards followed by a single letter permission.
-The permission may be R for read, W for write, U for read/write,
-and N for no access.
-
-.br
-Where more than one entry matches a file the most specific rule
-applies. If no entry matches a file then access is denied.
-
-.br
-Suppose /opt/pigpio/access contains the following entries
-
-.br
-
-.EX
-/home/* n
-.br
-/home/pi/shared/dir_1/* w
-.br
-/home/pi/shared/dir_2/* r
-.br
-/home/pi/shared/dir_3/* u
-.br
-/home/pi/shared/dir_1/file.txt n
-.br
-
-.EE
-
-.br
-Files may be written in directory dir_1 with the exception
-of file.txt.
-
-.br
-Files may be read in directory dir_2.
-
-.br
-Files may be read and written in directory dir_3.
-
-.br
-If a directory allows read, write, or read/write access then files may
-be created in that directory.
-
-.br
-In an attempt to prevent risky permissions the following paths are
-ignored in /opt/pigpio/access.
-
-.br
-
-.EX
-a path containing ..
-.br
-a path containing only wildcards (*?)
-.br
-a path containing less than two non-wildcard parts
-.br
-
-.EE
-
-.br
-Mode
-
-.br
-The mode may have the following values.
-
-.br
-
-.EX
- Value Meaning
-READ 1 open file for reading
-WRITE 2 open file for writing
-RW 3 open file for reading and writing
-
-.EE
-
-.br
-The following values may be or'd into the mode.
-
-.br
-
-.EX
- Value Meaning
-APPEND 4 All writes append data to the end of the file
-CREATE 8 The file is created if it doesn't exist
-TRUNC 16 The file is truncated
-
-.EE
-
-.br
-Newly created files are owned by root with permissions owner read and write.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ ls /ram/*.c
-.br
-/ram/command.c /ram/pigpiod.c /ram/pigs.c
-.br
-/ram/x_pigpiod_if.c /ram/pig2vcd.c /ram/pigpiod_if2.c
-.br
-/ram/x_pigpio.c /ram/x_repeat.c /ram/pigpio.c
-.br
-/ram/pigpiod_if.c /ram/x_pigpiod_if2.c
-.br
-
-.br
-# assumes /opt/pigpio/access contains the following line
-.br
-# /ram/*.c r
-.br
-
-.br
-$ pigs fo /ram/pigpio.c 1
-.br
-0
-.br
-
-.br
-$ pigs fo /ram/new.c 1
-.br
--128
-.br
-ERROR: file open failed
-.br
-
-.br
-$ pigs fo /ram/new.c 9
-.br
-1
-.br
-
-.br
-$ ls /ram/*.c -l
-.br
--rw-r--r-- 1 joan joan 42923 Jul 10 11:22 /ram/command.c
-.br
--rw------- 1 root root 0 Jul 10 16:54 /ram/new.c
-.br
--rw-r--r-- 1 joan joan 2971 Jul 10 11:22 /ram/pig2vcd.c
-.br
--rw------- 1 joan joan 296235 Jul 10 11:22 /ram/pigpio.c
-.br
--rw-r--r-- 1 joan joan 9266 Jul 10 11:22 /ram/pigpiod.c
-.br
--rw-r--r-- 1 joan joan 37331 Jul 10 11:22 /ram/pigpiod_if2.c
-.br
--rw-r--r-- 1 joan joan 33088 Jul 10 11:22 /ram/pigpiod_if.c
-.br
--rw-r--r-- 1 joan joan 7990 Jul 10 11:22 /ram/pigs.c
-.br
--rw-r--r-- 1 joan joan 19970 Jul 10 11:22 /ram/x_pigpio.c
-.br
--rw-r--r-- 1 joan joan 20804 Jul 10 11:22 /ram/x_pigpiod_if2.c
-.br
--rw-r--r-- 1 joan joan 19844 Jul 10 11:22 /ram/x_pigpiod_if.c
-.br
--rw-r--r-- 1 joan joan 19907 Jul 10 11:22 /ram/x_repeat.c
-.br
-
-.EE
-
-.br
-
-.IP "\fBFR h num\fP - Read bytes from file handle"
-.IP "" 4
-This command returns up to \fBnum\fP bytes of data read from the
-file associated with handle \fBh\fP.
-
-.br
-Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs fr 0 10
-.br
-5 48 49 128 144 255
-.br
-
-.br
-$ pigs fr 0 10
-.br
-0
-.br
-
-.EE
-
-.br
-
-.IP "\fBFS h num from\fP - Seek to file handle position"
-.IP "" 4
-This command seeks to a position within the file associated
-with handle \fBh\fP.
-
-.br
-The number of bytes to move is \fBnum\fP. Positive offsets
-move forward, negative offsets backwards. The move start
-position is determined by \fBfrom\fP as follows.
-
-.br
-
-.EX
- From
-0 start
-1 current position
-2 end
-
-.EE
-
-.br
-Upon success the new byte position within the file (>=0) is
-returned. On error a negative status code will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs fs 0 200 0 # Seek to start of file plus 200
-.br
-200
-.br
-
-.br
-$ pigs fs 0 0 1 # Return current position
-.br
-200
-.br
-
-.br
-$ pigs fs 0 0 2 # Seek to end of file, return size
-.br
-296235
-.br
-
-.EE
-
-.br
-
-.IP "\fBFW h bvs\fP - Write bytes to file handle"
-.IP "" 4
-This command writes bytes \fBbvs\fP to the file
-associated with handle \fBh\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs fw 0 23 45 67 89
-.br
-
-.EE
-
-.br
-
-.IP "\fBGDC u\fP - Get GPIO PWM dutycycle"
-.IP "" 4
-
-.br
-This command returns the PWM dutycycle in use on GPIO \fBu\fP.
-
-.br
-Upon success the dutycycle is returned. On error a negative
-status code will be returned.
-
-.br
-For normal PWM the dutycycle will be out of the defined range
-for the GPIO (see \fBPRG\fP).
-
-.br
-If a hardware clock is active on the GPIO the reported
-dutycycle will be 500000 (500k) out of 1000000 (1M).
-
-.br
-If hardware PWM is active on the GPIO the reported dutycycle
-will be out of a 1000000 (1M).
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs p 4 129
-.br
-$ pigs gdc 4
-.br
-129
-.br
-
-.br
-pigs gdc 5
-.br
--92
-.br
-ERROR: GPIO is not in use for PWM
-.br
-
-.EE
-
-.br
-
-.IP "\fBGPW u\fP - Get GPIO servo pulsewidth"
-.IP "" 4
-
-.br
-This command returns the servo pulsewidth in use on GPIO \fBu\fP.
-
-.br
-Upon success the servo pulsewidth is returned. On error a negative
-status code will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs s 4 1235
-.br
-$ pigs gpw 4
-.br
-1235
-.br
-
-.br
-$ pigs gpw 9
-.br
--93
-.br
-ERROR: GPIO is not in use for servo pulses
-.br
-
-.EE
-
-.br
-
-.IP "\fBH/HELP \fP - Display command help"
-.IP "" 4
-This command displays a brief list of the commands and their parameters.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs h
-.br
-
-.br
-$ pigs help
-.br
-
-.EE
-
-.br
-
-.IP "\fBHC g cf\fP - Set hardware clock frequency"
-.IP "" 4
-This command sets the hardware clock associated with GPIO \fBg\fP to
-frequency \fBcf\fP. Frequencies above 30MHz are unlikely to work.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs hc 4 5000 # start a 5 KHz clock on GPIO 4 (clock 0)
-.br
-
-.br
-$ pigs hc 5 5000000 # start a 5 MHz clcok on GPIO 5 (clock 1)
-.br
--99
-.br
-ERROR: need password to use hardware clock 1
-.br
-
-.EE
-
-.br
-The same clock is available on multiple GPIO. The latest
-frequency setting will be used by all GPIO which share a clock.
-
-.br
-The GPIO must be one of the following.
-
-.br
-
-.EX
-4 clock 0 All models
-5 clock 1 All models but A and B (reserved for system use)
-6 clock 2 All models but A and B
-20 clock 0 All models but A and B
-21 clock 1 All models but A and B Rev.2 (reserved for system use)
-
-.EE
-
-.br
-
-.EX
-32 clock 0 Compute module only
-34 clock 0 Compute module only
-42 clock 1 Compute module only (reserved for system use)
-43 clock 2 Compute module only
-44 clock 1 Compute module only (reserved for system use)
-
-.EE
-
-.br
-Access to clock 1 is protected by a password as its use will
-likely crash the Pi. The password is given by or'ing 0x5A000000
-with the GPIO number.
-
-.br
-
-.IP "\fBHP g pf pdc\fP - Set hardware PWM frequency and dutycycle"
-.IP "" 4
-This command sets the hardware PWM associated with GPIO \fBg\fP to
-frequency \fBpf\fP with dutycycle \fBpdc\fP. Frequencies above 30MHz
-are unlikely to work.
-
-.br
-NOTE: Any waveform started by \fBWVTX\fP, \fBWVTXR\fP, or \fBWVCHA\fP
-will be cancelled.
-
-.br
-This function is only valid if the pigpio main clock is PCM. The
-main clock defaults to PCM but may be overridden when the pigpio
-daemon is started (option -t).
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-.EX
-$ pigs hp 18 100 800000 # 80% dutycycle
-.br
-
-.br
-$ pigs hp 19 100 200000 # 20% dutycycle
-.br
-
-.br
-$ pigs hp 19 400000000 100000
-.br
--96
-.br
-ERROR: invalid hardware PWM frequency
-.br
-
-.EE
-
-.br
-The same PWM channel is available on multiple GPIO. The latest
-frequency and dutycycle setting will be used by all GPIO which
-share a PWM channel.
-
-.br
-The GPIO must be one of the following.
-
-.br
-
-.EX
-12 PWM channel 0 All models but A and B
-13 PWM channel 1 All models but A and B
-18 PWM channel 0 All models
-19 PWM channel 1 All models but A and B
-
-.EE
-
-.br
-
-.EX
-40 PWM channel 0 Compute module only
-41 PWM channel 1 Compute module only
-45 PWM channel 1 Compute module only
-52 PWM channel 0 Compute module only
-53 PWM channel 1 Compute module only
-
-.EE
-
-.br
-The actual number of steps beween off and fully on is the
-integral part of 250M/\fBpf\fP (375M/\fBpf\fP for the BCM2711).
-
-.br
-The actual frequency set is 250M/steps (375M/steps for the BCM2711).
-
-.br
-There will only be a million steps for a \fBpf\fP of 250 (375 for
-the BCM2711). Lower frequencies will have more steps and higher
-frequencies will have fewer steps. \fBpdc\fP is
-automatically scaled to take this into account.
-
-.br
-
-.IP "\fBHWVER \fP - Get hardware version"
-.IP "" 4
-This command returns the hardware revision of the Pi.
-
-.br
-The hardware revision is found in the last 4 characters on the revision
-line of /proc/cpuinfo.
-
-.br
-If the hardware revision can not be found or is not a valid hexadecimal
-number the command returns 0.
-
-.br
-The revision number can be used to determine the assignment of GPIO
-to pins (see \fBg\fP).
-
-.br
-There are currently three types of board.
-
-.br
-Type 1 boards have hardware revision numbers of 2 and 3.
-
-.br
-Type 2 boards have hardware revision numbers of 4, 5, 6, and 15.
-
-.br
-Type 3 boards have hardware revision numbers of 16 or greater.
-
-.br
-for "Revision : 0002" the command returns 2.
-
-.br
-for "Revision : 000f" the command returns 15.
-
-.br
-for "Revision : 000g" the command returns 0.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs hwver # On a B+
-.br
-16
-.br
-
-.EE
-
-.br
-
-.IP "\fBI2CC h\fP - Close I2C handle"
-.IP "" 4
-This command closes an I2C handle \fBh\fP previously opened with \fBI2CO\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs i2cc 0 # First close okay.
-.br
-
-.br
-$ pigs i2cc 0 # Second fails.
-.br
--25
-.br
-ERROR: unknown handle
-.br
-
-.EE
-
-.br
-
-.IP "\fBI2CO ib id if\fP - Open I2C bus and device with flags"
-.IP "" 4
-This command returns a handle to access device \fBid\fP on I2C bus \fBib\fP.
-The device is opened with flags \fBif\fP.
-
-.br
-Physically buses 0 and 1 are available on the Pi. Higher
-numbered buses will be available if a kernel supported bus
-multiplexor is being used.
-
-.br
-The GPIO used are given in the following table.
-
-.br
-
-.EX
- SDA SCL
-I2C 0 0 1
-I2C 1 2 3
-
-.EE
-
-.br
-No flags are currently defined. The parameter \fBif\fP should be 0.
-
-.br
-Upon success the next free handle (>=0) is returned. On error a
-negative status code will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs i2co 1 0x70 0 # Bus 1, device 0x70, flags 0.
-.br
-0
-.br
-
-.br
-$ pigs i2co 1 0x53 0 # Bus 1, device 0x53, flags 0.
-.br
-1
-.br
-
-.EE
-
-.br
-
-.IP "\fBI2CPC h r wv\fP - smb Process Call: exchange register with word"
-.IP "" 4
-This command writes \fBwv\fP to register \fBr\fP of the I2C device
-associated with handle \fBh\fP and returns a 16-bit word read from the
-device.
-
-.br
-Upon success a value between 0 and 65535 will be returned. On error
-a negative status code will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs i2cpc 0 37 43210
-.br
-39933
-.br
-
-.br
-$ pigs i2cpc 0 256 43210
-.br
-ERROR: bad i2c/spi/ser parameter
-.br
--81
-.br
-
-.EE
-
-.br
-
-.IP "\fBI2CPK h r bvs\fP - smb Block Process Call: exchange data bytes with register"
-.IP "" 4
-
-.br
-This command writes the data bytes \fBbvs\fP to register \fBr\fP of the I2C device
-associated with handle \fBh\fP and returns a device specific number of bytes.
-
-.br
-Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs i2cpk 0 0 0x11 0x12
-.br
-6 0 0 0 0 0 0
-.br
-
-.EE
-
-.br
-
-.IP "\fBI2CRB h r\fP - smb Read Byte Data: read byte from register"
-.IP "" 4
-
-.br
-This command returns a single byte read from register \fBr\fP of the I2C device
-associated with handle \fBh\fP.
-
-.br
-Upon success a value between 0 and 255 will be returned. On error
-a negative status code will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs i2crb 0 0
-.br
-6
-.br
-
-.EE
-
-.br
-
-.IP "\fBI2CRD h num\fP - i2c Read device"
-.IP "" 4
-
-.br
-This command returns \fBnum\fP bytes read from the I2C device associated with
-handle \fBh\fP.
-
-.br
-Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-
-.br
-This command operates on the raw I2C device. The maximum value of the
-parameter \fBnum\fP is dependent on the I2C drivers and the device
-itself. pigs imposes a limit of about 8000 bytes.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs i2crd 0 16
-.br
-16 6 24 0 0 0 0 0 0 0 0 0 0 0 0 32 78
-.br
-
-.EE
-
-.br
-
-.IP "\fBI2CRI h r num\fP - smb Read I2C Block Data: read bytes from register"
-.IP "" 4
-
-.br
-This command returns \fBnum\fP bytes from register \fBr\fP of the I2C device
-associated with handle \fBh\fP.
-
-.br
-Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-
-.br
-The parameter \fBnum\fP may be 1-32.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs i2cri 0 0 16
-.br
-16 237 155 155 155 155 155 155 155 155 155 155 155 155 155 155 155
-.br
-
-.EE
-
-.br
-
-.IP "\fBI2CRK h r\fP - smb Read Block Data: read data from register"
-.IP "" 4
-
-.br
-This command returns between 1 and 32 bytes read from register \fBr\fP of
-the I2C device associated with handle \fBh\fP.
-
-.br
-Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-
-.br
-The number of bytes of returned data is specific to the device and
-register.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs i2crk 0 0
-.br
-6 0 0 0 0 0 0
-.br
-
-.br
-$ pigs i2crk 0 1
-.br
-24 0 0 0 0 0 0 0 0 0 0 0 0 120 222 105 215 128 87 195 217 0 0 0 0
-.br
-
-.EE
-
-.br
-
-.IP "\fBI2CRS h\fP - smb Read Byte: read byte"
-.IP "" 4
-
-.br
-This command returns a single byte read from the I2C device
-associated with handle \fBh\fP.
-
-.br
-Upon success a value between 0 and 255 will be returned. On error
-a negative status code will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs i2crs 0
-.br
-0
-.br
-
-.EE
-
-.br
-
-.IP "\fBI2CRW h r\fP - smb Read Word Data: read word from register"
-.IP "" 4
-
-.br
-This command returns a single 16 bit word read from register \fBr\fP of
-the I2C device associated with handle \fBh\fP.
-
-.br
-Upon success a value between 0 and 65535 will be returned. On error
-a negative status code will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs i2crw 0 0
-.br
-6150
-.br
-
-.EE
-
-.br
-
-.IP "\fBI2CWB h r bv\fP - smb Write Byte Data: write byte to register"
-.IP "" 4
-
-.br
-This command writes a single byte \fBbv\fP to register \fBr\fP of the
-I2C device associated with handle \fBh\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs i2cwb 0 10 0x54
-.br
-
-.EE
-
-.br
-
-.IP "\fBI2CWD h bvs\fP - i2c Write device"
-.IP "" 4
-
-.br
-This command writes a block of bytes \fBbvs\fP to the I2C device
-associated with handle \fBh\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-The number of bytes which may be written in one transaction is
-dependent on the I2C drivers and the device itself. pigs imposes
-a limit of about 500 bytes.
-
-.br
-This command operates on the raw I2C device.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs i2cwd 0 0x01 0x02 0x03 0x04
-.br
-
-.EE
-
-.br
-
-.IP "\fBI2CWI h r bvs\fP - smb Write I2C Block Data"
-.IP "" 4
-
-.br
-This command writes between 1 and 32 bytes \fBbvs\fP to register \fBr\fP of
-the I2C device associated with handle \fBh\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs i2cwi 0 4 0x01 0x04 0xc0
-.br
-
-.EE
-
-.br
-
-.IP "\fBI2CWK h r bvs\fP - smb Write Block Data: write data to register"
-.IP "" 4
-
-.br
-This command writes between 1 and 32 bytes \fBbvs\fP to register \fBr\fP of
-the I2C device associated with handle \fBh\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-pigs i2cwk 0 4 0x01 0x04 0xc0
-.br
-
-.EE
-
-.br
-
-.IP "\fBI2CWQ h bit\fP - smb Write Quick: write bit"
-.IP "" 4
-
-.br
-This command writes a single \fBbit\fP to the I2C device associated
-with handle \fBh\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs i2cwq 0 1
-.br
-
-.EE
-
-.br
-
-.IP "\fBI2CWS h bv\fP - smb Write Byte: write byte"
-.IP "" 4
-
-.br
-This command writes a single byte \fBbv\fP to the I2C device associated
-with handle \fBh\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs i2cws 0 0x12
-.br
-
-.br
-$ pigs i2cws 0 0xff
-.br
--82
-.br
-ERROR: I2C write failed
-.br
-
-.EE
-
-.br
-
-.IP "\fBI2CWW h r wv\fP - smb Write Word Data: write word to register"
-.IP "" 4
-
-.br
-This command writes a single 16 bit word \fBwv\fP to register \fBr\fP of
-the I2C device associated with handle \fBh\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs i2cww 0 0 0xffff
-.br
-
-.EE
-
-.br
-
-.IP "\fBI2CZ h bvs\fP - Performs multiple I2C transactions"
-.IP "" 4
-This command executes a sequence of I2C operations. The
-operations to be performed are specified by the contents of \fBbvs\fP
-which contains the concatenated command codes and associated data.
-
-.br
-The following command codes are supported:
-
-.br
-
-.EX
-Name Cmd & Data Meaning
-End 0 No more commands
-Escape 1 Next P is two bytes
-On 2 Switch combined flag on
-Off 3 Switch combined flag off
-Address 4 P Set I2C address to P
-Flags 5 lsb msb Set I2C flags to lsb + (msb << 8)
-Read 6 P Read P bytes of data
-Write 7 P ... Write P bytes of data
-
-.EE
-
-.br
-The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-
-.br
-The address defaults to that associated with the handle \fBh\fP.
-The flags default to 0. The address and flags maintain their
-previous value until updated.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-Set address 0x53, write 0x32, read 6 bytes
-.br
-Set address 0x1E, write 0x03, read 6 bytes
-.br
-Set address 0x68, write 0x1B, read 8 bytes
-.br
-End
-.br
-
-.br
-0x04 0x53 0x07 0x01 0x32 0x06 0x06
-.br
-0x04 0x1E 0x07 0x01 0x03 0x06 0x06
-.br
-0x04 0x68 0x07 0x01 0x1B 0x06 0x08
-.br
-0x00
-.br
-
-.EE
-
-.br
-
-.br
-
-.IP "\fBM/MODES g m\fP - Set GPIO mode"
-.IP "" 4
-
-.br
-This command sets GPIO \fBg\fP to mode \fBm\fP, typically input (read)
-or output (write).
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-Each GPIO can be configured to be in one of 8 different modes. The modes
-are named Input, Output, ALT0, ALT1, ALT2, ALT3, ALT4, and ALT5.
-
-.br
-To set the mode use the code for the mode.
-
-.br
-
-.EX
-Mode Input Output ALT0 ALT1 ALT2 ALT3 ALT4 ALT5
-Code R W 0 1 2 3 4 5
-
-.EE
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs m 4 r # Input (read)
-.br
-$ pigs m 4 w # Output (write)
-.br
-$ pigs m 4 0 # ALT 0
-.br
-$ pigs m 4 5 # ALT 5
-.br
-
-.EE
-
-.br
-
-.IP "\fBMG/MODEG g\fP - Get GPIO mode"
-.IP "" 4
-
-.br
-This command returns the current mode of GPIO \fBg\fP.
-
-.br
-Upon success the value of the GPIO mode is returned.
-On error a negative status code will be returned.
-
-.br
-
-.EX
-Value 0 1 2 3 4 5 6 7
-Mode Input Output ALT5 ALT4 ALT0 ALT1 ALT2 ALT3
-
-.EE
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs mg 4
-.br
-1
-.br
-
-.EE
-
-.br
-
-.IP "\fBMICS v\fP - Microseconds delay"
-.IP "" 4
-This command delays execution for \fBv\fP microseconds.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-The main use of this command is expected to be within \fBScripts\fP.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs mics 20 # Delay 20 microseconds.
-.br
-$ pigs mics 1000000 # Delay 1 second.
-.br
-
-.br
-$ pigs mics 2000000
-.br
--64
-.br
-ERROR: bad MICS delay (too large)
-.br
-
-.EE
-
-.br
-
-.IP "\fBMILS v\fP - Milliseconds delay"
-.IP "" 4
-
-.br
-This command delays execution for \fBv\fP milliseconds.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs mils 2000 # Delay 2 seconds.
-.br
-
-.br
-$ pigs mils 61000
-.br
--65
-.br
-ERROR: bad MILS delay (too large)
-.br
-
-.EE
-
-.br
-
-.IP "\fBNB h bits\fP - Start notification"
-.IP "" 4
-
-.br
-This command starts notifications on handle \fBh\fP returned by
-a prior call to \fBNO\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-The notification gets state changes for each GPIO specified by \fBbits\fP.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs nb 0 -1 # Shorthand for GPIO 0-31.
-.br
-$ pigs nb 0 0xf0 # Get notifications for GPIO 4-7.
-.br
-
-.br
-$ pigs nb 1 0xf
-.br
--25
-.br
-ERROR: unknown handle
-.br
-
-.EE
-
-.br
-
-.IP "\fBNC h\fP - Close notification"
-.IP "" 4
-
-.br
-This command stops notifications on handle \fBh\fP returned by
-a prior call to \fBNO\fP and releases the handle for reuse.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs nc 0 # First call succeeds.
-.br
-
-.br
-$ pigs nc 1 # Second call fails.
-.br
--25
-.br
-ERROR: unknown handle
-.br
-
-.EE
-
-.br
-
-.IP "\fBNO \fP - Request a notification"
-.IP "" 4
-
-.br
-This command requests a free notification handle.
-
-.br
-A notification is a method for being notified of GPIO state changes via a pipe.
-
-.br
-Upon success the command returns a handle greater than or equal to zero.
-On error a negative status code will be returned.
-
-.br
-Notifications for handle x will be available at the pipe named /dev/pigpiox
-(where x is the handle number).
-
-.br
-E.g. if the command returns 15 then the notifications must be read
-from /dev/pigpio15.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs no
-.br
-0
-.br
-
-.EE
-
-.br
-
-.IP "\fBNP h\fP - Pause notification"
-.IP "" 4
-
-.br
-This command pauses notifications on handle \fBh\fP returned by
-a prior call to \fBNO\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-Notifications for the handle are suspended until a new \fBNB\fP command
-is given for the handle.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs np 0
-.br
-
-.EE
-
-.br
-
-.IP "\fBP/PWM u v\fP - Set GPIO PWM value"
-.IP "" 4
-
-.br
-This command starts PWM on GPIO \fBu\fP with dutycycle \fBv\fP. The dutycycle
-varies from 0 (off) to range (fully on). The range defaults to 255.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-This and the servo functionality use the DMA and PWM or PCM peripherals
-to control and schedule the pulsewidths and dutycycles.
-
-.br
-The \fBPRS\fP command may be used to change the default range of 255.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs p 4 64 # Start PWM on GPIO 4 with 25% dutycycle
-.br
-$ pigs p 4 128 # 50%
-.br
-$ pigs p 4 192 # 75%
-.br
-$ pigs p 4 255 # 100%
-.br
-
-.EE
-
-.br
-
-.IP "\fBPADG pad\fP - Get pad drive strength"
-.IP "" 4
-
-.br
-This command gets the \fBpad\fP drive strength \fBpadma\fP in mA.
-
-.br
-Returns the pad drive strength if OK. On error a negative status code
-will be returned.
-
-.br
-
-.EX
-Pad GPIO
-0 0-27
-1 28-45
-2 46-53
-
-.EE
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs padg 0
-.br
-8
-.br
-$ pigs pads 0 16
-.br
-$ pigs padg 0
-.br
-16
-.br
-pigs padg 3
-.br
--126
-.br
-ERROR: bad pad number
-.br
-
-.EE
-
-.br
-
-.IP "\fBPADS pad padma\fP - Set pad drive strength"
-.IP "" 4
-
-.br
-This command sets the \fBpad\fP drive strength \fBpadma\fP in mA.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-.EX
-Pad GPIO
-0 0-27
-1 28-45
-2 46-53
-
-.EE
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs pads 0 16
-.br
-$ pigs padg 0
-.br
-16
-.br
-$ pigs pads 0 17
-.br
--127
-.br
-ERROR: bad pad drive strength
-.br
-
-.EE
-
-.br
-
-.IP "\fBPARSE t\fP - Validate script"
-.IP "" 4
-
-.br
-Validates the text \fBt\fP of a script without storing the script.
-
-.br
-Upon success nothing is returned. On error a list of detected
-script errors will be given.
-
-.br
-See \fBScripts\fP.
-
-.br
-This command may be used to find script syntax faults.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs parse tag 100 w 22 1 mils 200 w 22 0 mils 800 jmp 100
-.br
-
-.br
-$ pigs parse tag 0 w 22 1 mills 50 w 22 0 dcr p10 jp 99
-.br
-Unknown command: mills
-.br
-Unknown command: 50
-.br
-Bad parameter to dcr
-.br
-Can't resolve tag 99
-.br
-
-.EE
-
-.br
-
-.IP "\fBPFG u\fP - Get GPIO PWM frequency"
-.IP "" 4
-
-.br
-This command returns the PWM frequency in Hz used for GPIO \fBu\fP.
-
-.br
-Upon success the PWM frequency is returned. On error a negative
-status code will be returned.
-
-.br
-For normal PWM the frequency will be that defined for the GPIO
-by \fBPFS\fP.
-
-.br
-If a hardware clock is active on the GPIO the reported frequency
-will be that set by \fBHC\fP.
-
-.br
-If hardware PWM is active on the GPIO the reported frequency
-will be that set by \fBHP\fP.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs pfg 4
-.br
-800
-.br
-
-.br
-$ pigs pfg 34
-.br
-ERROR: GPIO not 0-31
-.br
--2
-.br
-
-.EE
-
-.br
-
-.IP "\fBPFS u v\fP - Set GPIO PWM frequency"
-.IP "" 4
-This command sets the PWM frequency \fBv\fP to be used for GPIO \fBu\fP.
-
-.br
-The numerically closest frequency to \fBv\fP will be selected.
-
-.br
-Upon success the new frequency is returned. On error a negative status code
-will be returned.
-
-.br
-If PWM is currently active on the GPIO it will be
-switched off and then back on at the new frequency.
-
-.br
-Each GPIO can be independently set to one of 18 different PWM
-frequencies.
-
-.br
-The selectable frequencies depend upon the sample rate which
-may be 1, 2, 4, 5, 8, or 10 microseconds (default 5). The
-sample rate is set when the pigpio daemon is started.
-
-.br
-The frequencies for each sample rate are:
-
-.br
-
-.EX
- Hertz
-.br
-
-.br
- 1: 40000 20000 10000 8000 5000 4000 2500 2000 1600
-.br
- 1250 1000 800 500 400 250 200 100 50
-.br
-
-.br
- 2: 20000 10000 5000 4000 2500 2000 1250 1000 800
-.br
- 625 500 400 250 200 125 100 50 25
-.br
-
-.br
- 4: 10000 5000 2500 2000 1250 1000 625 500 400
-.br
- 313 250 200 125 100 63 50 25 13
-.br
-sample
-.br
- rate
-.br
- (us) 5: 8000 4000 2000 1600 1000 800 500 400 320
-.br
- 250 200 160 100 80 50 40 20 10
-.br
-
-.br
- 8: 5000 2500 1250 1000 625 500 313 250 200
-.br
- 156 125 100 63 50 31 25 13 6
-.br
-
-.br
- 10: 4000 2000 1000 800 500 400 250 200 160
-.br
- 125 100 80 50 40 25 20 10 5
-.br
-
-.EE
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-pigs pfs 4 0 # 0 selects the lowest frequency.
-.br
-10
-.br
-
-.br
-$ pigs pfs 4 1000 # Set 1000Hz PWM.
-.br
-1000
-.br
-
-.br
-$ pigs pfs 4 100000 # Very big number selects the highest frequency.
-.br
-8000
-.br
-
-.EE
-
-.br
-
-.IP "\fBPIGPV \fP - Get pigpio library version"
-.IP "" 4
-
-.br
-This command returns the pigpio library version.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs pigpv
-.br
-17
-.br
-
-.EE
-
-.br
-
-.IP "\fBPRG u\fP - Get GPIO PWM range"
-.IP "" 4
-
-.br
-This command returns the dutycycle range for GPIO \fBu\fP.
-
-.br
-Upon success the range is returned. On error a negative status code
-will be returned.
-
-.br
-If a hardware clock or hardware PWM is active on the GPIO the reported
-range will be 1000000 (1M).
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs prg 4
-.br
-255
-.br
-
-.EE
-
-.br
-
-.IP "\fBPROC t\fP - Store script"
-.IP "" 4
-
-.br
-This command stores a script \fBt\fP for later execution.
-
-.br
-If the script is valid a script id (>=0) is returned which is passed
-to the other script commands. On error a negative status code
-will be returned.
-
-.br
-See \fBScripts\fP.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs proc tag 123 w 4 0 mils 200 w 4 1 mils 300 dcr p0 jp 123
-.br
-0
-.br
-
-.br
-$ pigs proc tag 123 w 4 0 mils 5 w 4 1 mils 5 jmp 12
-.br
-ERROR: script has unresolved tag
-.br
--63
-.br
-
-.EE
-
-.br
-
-.IP "\fBPROCD sid\fP - Delete script"
-.IP "" 4
-
-.br
-This command deletes script \fBsid\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-See \fBScripts\fP.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs procd 1
-.br
-
-.br
-$ pigs procd 1
-.br
-ERROR: unknown script id
-.br
--48
-.br
-
-.EE
-
-.br
-
-.IP "\fBPROCP sid\fP - Get script status and parameters"
-.IP "" 4
-
-.br
-This command returns the status of script \fBsid\fP as well as the
-current value of its 10 parameters.
-
-.br
-Upon success the script status and parameters are returned.
-On error a negative status code will be returned.
-
-.br
-The script status may be one of
-
-.br
-
-.EX
-0 being initialised
-1 halted
-2 running
-3 waiting
-4 failed
-
-.EE
-
-.br
-See \fBScripts\fP.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs procp 0
-.br
-1 0 0 0 0 0 0 0 0 0 0
-.br
-
-.EE
-
-.br
-
-.IP "\fBPROCR sid pars\fP - Run script"
-.IP "" 4
-
-.br
-This command runs stored script \fBsid\fP passing it up to 10 optional
-parameters.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-See \fBScripts\fP.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs proc tag 123 w 4 0 mils 200 w 4 1 mils 300 dcr p0 jp 123
-.br
-0
-.br
-
-.br
-$ pigs procr 0 50 # Run script 0 with parameter 0 of 50.
-.br
-
-.br
-$ pigs procp 0
-.br
-2 44 0 0 0 0 0 0 0 0 0
-.br
-$ pigs procp 0
-.br
-2 37 0 0 0 0 0 0 0 0 0
-.br
-$ pigs procp 0
-.br
-2 10 0 0 0 0 0 0 0 0 0
-.br
-$ pigs procp 0
-.br
-2 5 0 0 0 0 0 0 0 0 0
-.br
-$ pigs procp 0
-.br
-2 2 0 0 0 0 0 0 0 0 0
-.br
-$ pigs procp 0
-.br
-1 -1 0 0 0 0 0 0 0 0 0
-.br
-
-.EE
-
-.br
-
-.IP "\fBPROCS sid\fP - Stop script"
-.IP "" 4
-
-.br
-This command stops a running script \fBsid\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-See \fBScripts\fP.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs procs 0
-.br
-
-.br
-$ pigs procs 1
-.br
--48
-.br
-ERROR: unknown script id
-.br
-
-.EE
-
-.br
-
-.IP "\fBPROCU sid pars\fP - Set script parameters"
-.IP "" 4
-
-.br
-This command sets the parameters of a stored script \fBsid\fP passing
-it up to 10 parameters.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-See \fBScripts\fP.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs proc tag 0 hp 18 p0 p1 mils 1000 jmp 0
-.br
-0
-.br
-$ pigs procu 0 50 500000
-.br
-$ pigs procr 0
-.br
-$ pigs procu 0 100
-.br
-$ pigs procu 0 200
-.br
-$ pigs procu 0 200 100000
-.br
-
-.EE
-
-.br
-
-.IP "\fBPRRG u\fP - Get GPIO PWM real range"
-.IP "" 4
-
-.br
-This command returns the real underlying range used by GPIO \fBu\fP.
-
-.br
-If a hardware clock is active on the GPIO the reported
-real range will be 1000000 (1M).
-
-.br
-If hardware PWM is active on the GPIO the reported real range
-will be approximately 250M divided by the set PWM frequency.
-
-.br
-On error a negative status code will be returned.
-
-.br
-See \fBPRS\fP.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs prrg 17
-.br
-250
-.br
-
-.br
-$ pigs pfs 17 0
-.br
-10
-.br
-$ pigs prrg 17
-.br
-20000
-.br
-
-.br
-$ pigs pfs 17 100000
-.br
-8000
-.br
-$ pigs prrg 17
-.br
-25
-.br
-
-.EE
-
-.br
-
-.IP "\fBPRS u v\fP - Set GPIO PWM range"
-.IP "" 4
-
-.br
-This command sets the dutycycle range \fBv\fP to be used for GPIO \fBu\fP.
-Subsequent uses of command \fBP/PWM\fP will use a dutycycle between 0 (off)
-and \fBv\fP (fully on).
-
-.br
-Upon success the real underlying range used by the GPIO is returned.
-On error a negative status code will be returned.
-
-.br
-If PWM is currently active on the GPIO its dutycycle will be scaled to
-reflect the new range.
-
-.br
-The real range, the number of steps between fully off and fully on
-for each frequency, is given in the following table.
-
-.br
-
-.EX
- #1 #2 #3 #4 #5 #6 #7 #8 #9
- 25 50 100 125 200 250 400 500 625
-
-#10 #11 #12 #13 #14 #15 #16 #17 #18
-800 1000 1250 2000 2500 4000 5000 10000 20000
-
-.EE
-
-.br
-The real value set by \fBPRS\fP is (dutycycle * real range) / range.
-
-.br
-See \fBPRRG\fP
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs prs 18 1000
-.br
-250
-.br
-
-.EE
-
-.br
-
-.IP "\fBPUD g p\fP - Set GPIO pull up/down"
-.IP "" 4
-
-.br
-This command sets the internal pull/up down for GPIO \fBg\fP to mode \fBp\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-The mode may be pull-down (D), pull-up (U), or off (O).
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs pud 4 d # Set pull-down on GPIO 4.
-.br
-$ pigs pud 4 u # Set pull-up on GPIO 4.
-.br
-$ pigs pud 4 o # No pull-up/down on GPIO 4.
-.br
-
-.EE
-
-.br
-
-.IP "\fBR/READ g\fP - Read GPIO level"
-.IP "" 4
-
-.br
-This reads the current level of GPIO \fBg\fP.
-
-.br
-Upon success the current level is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs r 17 # Get level of GPIO 17.
-.br
-0
-.br
-
-.br
-$ pigs r 4 # Get level of GPIO 4.
-.br
-1
-.br
-
-.EE
-
-.br
-
-.IP "\fBS/SERVO u v\fP - Set GPIO servo pulsewidth"
-.IP "" 4
-
-.br
-This command starts servo pulses of \fBv\fP microseconds on GPIO \fBu\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-The servo pulsewidth may be 0 (off), 500 (most anti-clockwise)
-to 2500 (most clockwise).
-
-.br
-The range supported by servos varies and should probably be determined
-by experiment. Generally values between 1000-2000 should be safe.
-A value of 1500 should always be safe and represents
-the mid-point of rotation.
-
-.br
-You can DAMAGE a servo if you command it to move beyond its limits.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs SERVO 17 1500
-.br
-
-.EE
-
-.br
-This example causes an on pulse of 1500 microseconds duration to be
-transmitted on GPIO 17 at a rate of 50 times per second.
-
-.br
-This will command a servo connected to GPIO 17 to rotate to its mid-point.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-pigs s 17 0 # Switch servo pulses off.
-.br
-
-.EE
-
-.br
-
-.IP "\fBSERC h\fP - Close serial handle"
-.IP "" 4
-
-.br
-This command closes a serial handle \fBh\fP previously opened with \fBSERO\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs serc 0 # First close okay.
-.br
-
-.br
-$ pigs serc 0 # Second close gives error.
-.br
--25
-.br
-ERROR: unknown handle
-.br
-
-.EE
-
-.br
-
-.IP "\fBSERDA h\fP - Check for serial data ready to read"
-.IP "" 4
-
-.br
-This command returns the number of bytes of data available
-to be read from the serial device associated with handle \fBh\fP.
-
-.br
-Upon success the count of bytes available to be read is
-returned (which may be 0). On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs serda 0
-.br
-0
-.br
-
-.EE
-
-.br
-
-.IP "\fBSERO dev b sef\fP - Open serial device dev at baud b with flags"
-.IP "" 4
-
-.br
-This command opens the serial \fBdev\fP at \fBb\fP bits per second.
-
-.br
-No flags are currently defined. \fBsef\fP should be set to zero.
-
-.br
-Upon success a handle (>=0) is returned. On error a negative status code
-will be returned.
-
-.br
-The device name must start with /dev/tty or /dev/serial.
-
-.br
-
-.br
-The baud rate must be one of 50, 75, 110, 134, 150,
-200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
-38400, 57600, 115200, or 230400.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs sero /dev/ttyAMA0 9600 0
-.br
-0
-.br
-
-.br
-$ pigs sero /dev/tty1 38400 0
-.br
-1
-.br
-
-.EE
-
-.br
-
-.IP "\fBSERR h num\fP - Read bytes from serial handle"
-.IP "" 4
-
-.br
-This command returns up to \fBnum\fP bytes of data read from the
-serial device associated with handle \fBh\fP.
-
-.br
-Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs serr 0 10
-.br
-5 48 49 128 144 255
-.br
-
-.br
-$ pigs serr 0 10
-.br
-0
-.br
-
-.EE
-
-.br
-
-.IP "\fBSERRB \fP - Read byte from serial handle"
-.IP "" 4
-
-.br
-This command returns a byte of data read from the serial
-device associated with handle \fBh\fP.
-
-.br
-Upon success a number between 0 and 255 is returned.
-On error a negative status code will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs serrb 0
-.br
-23
-.br
-$ pigs serrb 0
-.br
-45
-.br
-
-.EE
-
-.br
-
-.IP "\fBSERW h bvs\fP - Write bytes to serial handle"
-.IP "" 4
-
-.br
-This command writes bytes \fBbvs\fP to the serial device
-associated with handle \fBh\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs serw 0 23 45 67 89
-.br
-
-.EE
-
-.br
-
-.IP "\fBSERWB h bv\fP - Write byte to serial handle"
-.IP "" 4
-
-.br
-This command writes a single byte \fBbv\fP to the serial device
-associated with handle \fBh\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs serwb 0 23
-.br
-$ pigs serwb 0 0xf0
-.br
-
-.EE
-
-.br
-
-.IP "\fBSHELL name str\fP - Execute a shell command"
-.IP "" 4
-
-.br
-This command uses the system call to execute a shell script \fBname\fP
-with the given string \fBstr\fP as its parameter.
-
-.br
-The exit status of the system call is returned if OK, otherwise
-PI_BAD_SHELL_STATUS.
-
-.br
-\fBname\fP must exist in /opt/pigpio/cgi and must be executable.
-
-.br
-The returned exit status is normally 256 times that set
-by the shell script exit function. If the script can't
-be found 32512 will be returned.
-
-.br
-The following table gives some example returned statuses.
-
-.br
-
-.EX
-Script exit status Returned system call status
-1 256
-5 1280
-10 2560
-200 51200
-script not found 32512
-
-.EE
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-# pass two parameters, hello and world
-.br
-$ pigs shell scr1 hello world
-.br
-256
-.br
-
-.br
-# pass three parameters, hello, string with spaces, and world
-.br
-$ pigs shell scr1 "hello 'string with spaces' world"
-.br
-256
-.br
-
-.br
-# pass one parameter, hello string with spaces world
-.br
-$ pigs shell scr1 "\"hello string with spaces world\""
-.br
-256
-.br
-
-.br
-# non-existent script
-.br
-$ pigs shell scr78 par1
-.br
-32512
-.br
-
-.EE
-
-.br
-
-.IP "\fBSLR u num\fP - Read bit bang serial data from GPIO"
-.IP "" 4
-
-.br
-This command returns up to \fBnum\fP bytes of bit bang serial data
-read from GPIO \fBu\fP.
-
-.br
-Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-
-.br
-The GPIO \fBu\fP should have been initialised with the \fBSLRO\fP command.
-
-.br
-The bytes returned for each character depend upon the number of
-data bits \fBdb\fP specified in the \fBSLRO\fP command.
-
-.br
-For \fBdb\fP 1-8 there will be one byte per character.
-.br
-For \fBdb\fP 9-16 there will be two bytes per character.
-.br
-For \fBdb\fP 17-32 there will be four bytes per character.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs slr 15 20
-.br
-6 1 0 23 45 89 0
-.br
-
-.EE
-
-.br
-
-.IP "\fBSLRC u\fP - Close GPIO for bit bang serial data"
-.IP "" 4
-
-.br
-This command closes GPIO \fBu\fP for reading bit bang serial data.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs slrc 23
-.br
-
-.br
-$ pigs slrc 23
-.br
--38
-.br
-ERROR: no serial read in progress on GPIO
-.br
-
-.EE
-
-.br
-
-.IP "\fBSLRI u v\fP - Sets bit bang serial data logic levels"
-.IP "" 4
-
-.br
-This command sets the logic level for reading bit bang serial data
-on GPIO \fBu\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-The invert parameter \fBv\fP is 1 for inverted signal, 0 for normal.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs slri 17 1 # invert logic on GPIO 17
-.br
-
-.br
-$ pigs slri 23 0 # use normal logic on GPIO 23
-.br
-
-.EE
-
-.br
-
-.IP "\fBSLRO u b db\fP - Open GPIO for bit bang serial data"
-.IP "" 4
-
-.br
-This command opens GPIO \fBu\fP for reading bit bang serial data
-at \fBb\fP baud and \fBdb\fP data bits.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-The baud rate may be between 50 and 250000 bits per second.
-
-.br
-The received data is held in a cyclic buffer.
-
-.br
-It is the user's responsibility to read the data (with \fBSLR\fP)
-in a timely fashion.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs slro 23 19200 8
-.br
-
-.br
-$ pigs slro 23 19200 8
-.br
--50
-.br
-ERROR: GPIO already in use
-.br
-
-.EE
-
-.br
-
-.IP "\fBSPIC h\fP - SPI close handle"
-.IP "" 4
-
-.br
-This command closes the SPI handle \fBh\fP returned by a prior
-call to \fBSPIO\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs spic 1
-.br
-
-.br
-$ pigs spic 1
-.br
--25
-.br
-ERROR: unknown handle
-.br
-
-.EE
-
-.br
-
-.IP "\fBSPIO c b spf\fP - SPI open channel at baud b with flags"
-.IP "" 4
-
-.br
-This command returns a handle to a SPI device on channel \fBc\fP.
-
-.br
-Data will be transferred at \fBb\fP bits per second. The flags \fBspf\fP
-may be used to modify the default behaviour of 4-wire operation,
-mode 0, active low chip select.
-
-.br
-Speeds between 32kbps and 125Mbps are allowed. Speeds above 30Mbps
-are unlikely to work.
-
-.br
-The Pi has two SPI peripherals: main and auxiliary.
-
-.br
-The main SPI has two chip selects (channels), the auxiliary has
-three.
-
-.br
-The auxiliary SPI is available on all models but the A and B.
-
-.br
-The GPIO used are given in the following table.
-
-.br
-
-.EX
- MISO MOSI SCLK CE0 CE1 CE2
-Main SPI 9 10 11 8 7 -
-Aux SPI 19 20 21 18 17 16
-
-.EE
-
-.br
-The flags consists of the least significant 22 bits.
-
-.br
-
-.EX
-21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
-.br
- b b b b b b R T n n n n W A u2 u1 u0 p2 p1 p0 m m
-.br
-
-.EE
-
-.br
-mm defines the SPI mode.
-
-.br
-Warning: modes 1 and 3 do not appear to work on the auxiliary SPI.
-
-.br
-
-.EX
-Mode POL PHA
-.br
- 0 0 0
-.br
- 1 0 1
-.br
- 2 1 0
-.br
- 3 1 1
-.br
-
-.EE
-
-.br
-px is 0 if CEx is active low (default) and 1 for active high.
-
-.br
-ux is 0 if the CEx GPIO is reserved for SPI (default) and 1 otherwise.
-
-.br
-A is 0 for the main SPI, 1 for the auxiliary SPI.
-
-.br
-W is 0 if the device is not 3-wire, 1 if the device is 3-wire. Main
-SPI only.
-
-.br
-nnnn defines the number of bytes (0-15) to write before switching
-the MOSI line to MISO to read data. This field is ignored
-if W is not set. Main SPI only.
-
-.br
-T is 1 if the least significant bit is transmitted on MOSI first, the
-default (0) shifts the most significant bit out first. Auxiliary SPI
-only.
-
-.br
-R is 1 if the least significant bit is received on MISO first, the
-default (0) receives the most significant bit first. Auxiliary SPI
-only.
-
-.br
-bbbbbb defines the word size in bits (0-32). The default (0)
-sets 8 bits per word. Auxiliary SPI only.
-
-.br
-The \fBSPIR\fP, \fBSPIW\fP, and \fBSPIX\fP commands transfer data
-packed into 1, 2, or 4 bytes according to the word size in bits.
-
-.br
-For bits 1-8 there will be one byte per character.
-.br
-For bits 9-16 there will be two bytes per character.
-.br
-For bits 17-32 there will be four bytes per character.
-
-.br
-Multi-byte transfers are made in least significant byte first order.
-
-.br
-E.g. to transfer 32 11-bit words 64 bytes need to be sent.
-
-.br
-E.g. to transfer the 14 bit value 0x1ABC send the bytes 0xBC followed
-by 0x1A.
-
-.br
-The other bits in flags should be set to zero.
-
-.br
-Upon success a handle (>=0) is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs spio 0 100000 3 # Open channel 0 at 100kbps in mode 3.
-.br
-0
-.br
-
-.br
-$ pigs spio 0 32000 256 # Open channel 0 of auxiliary spi at 32kbps.
-.br
-1
-.br
-
-.EE
-
-.br
-
-.IP "\fBSPIR h num\fP - SPI read bytes from handle"
-.IP "" 4
-
-.br
-This command returns \fBnum\fP bytes read from the SPI device
-associated with handle \fBh\fP.
-
-.br
-Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs spir 0 10 # Read 10 bytes from the SPI device.
-.br
-10 0 0 0 0 0 0 0 0 0 0
-.br
-
-.EE
-
-.br
-
-.IP "\fBSPIW h bvs\fP - SPI write bytes to handle"
-.IP "" 4
-
-.br
-This command writes bytes \fBbvs\fP to the SPI device
-associated with handle \fBh\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs spiw 0 0x22 0x33 0xcc 0xff
-.br
-
-.EE
-
-.br
-
-.IP "\fBSPIX h bvs\fP - SPI transfer bytes to handle"
-.IP "" 4
-
-.br
-This command writes bytes \fBbvs\fP to the SPI device
-associated with handle \fBh\fP. It returns the same
-number of bytes read from the device.
-
-.br
-Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs spix 0 0x22 0x33 0xcc 0xff
-.br
-4 0 0 0 0
-.br
-
-.EE
-
-.br
-
-.IP "\fBT/TICK \fP - Get current tick"
-.IP "" 4
-
-.br
-This command returns the current system tick.
-
-.br
-Tick is the number of microseconds since system boot.
-
-.br
-As tick is an unsigned 32 bit quantity it wraps around after 2^32 microseconds,
-which is approximately 1 hour 12 minutes.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs t mils 1000 t
-.br
-3691823946
-.br
-3692833987
-.br
-
-.EE
-
-.br
-
-.IP "\fBTRIG u pl L\fP - Send a trigger pulse"
-.IP "" 4
-
-.br
-This command sends a trigger pulse of \fBpl\fP microseconds at level \fBL\fP
-to GPIO \fBu\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-The GPIO is set to not level at the end of the pulse.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs trig 4 10 1
-.br
-
-.br
-$ pigs trig 4 51 1
-.br
--46
-.br
-ERROR: trigger pulse > 50 microseconds
-.br
-
-.EE
-
-.br
-
-.IP "\fBW/WRITE g L\fP - Write GPIO level"
-.IP "" 4
-
-.br
-This command sets GPIO \fBg\fP to level \fBL\fP. The level may be 0
-(low, off, clear) or 1 (high, on, set).
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs w 23 0
-.br
-$ pigs w 23 1
-.br
-
-.br
-$ pigs w 23 2
-.br
--5
-.br
-ERROR: level not 0-1
-.br
-
-.EE
-
-.br
-
-.IP "\fBWDOG u v\fP - Set GPIO watchdog"
-.IP "" 4
-
-.br
-This command sets a watchdog of \fBv\fP milliseconds on GPIO \fBu\fP.
-
-.br
-Upon success nothing is returned. On error a negative status code
-will be returned.
-
-.br
-The watchdog is nominally in milliseconds.
-
-.br
-One watchdog may be registered per GPIO.
-
-.br
-The watchdog may be cancelled by setting timeout to 0.
-
-.br
-Once a watchdog has been started monitors of the GPIO
-will be triggered every timeout interval after the last
-GPIO activity. The watchdog expiry will be indicated by
-a special TIMEOUT value.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs wdog 23 90000
-.br
--15
-.br
-ERROR: timeout not 0-60000
-.br
-
-.br
-$ pigs wdog 23 9000
-.br
-
-.EE
-
-.br
-This example causes a report to be written to any notification pipes
-listening on GPIO 23 whenever GPIO 23 changes state or approximately
-every 9000 ms.
-
-.br
-
-.IP "\fBWVAG trips\fP - Add generic pulses to waveform"
-.IP "" 4
-
-.br
-This command adds 1 one or more triplets \fBtrips\fP of GPIO on, GPIO off,
-delay to the existing waveform (if any).
-
-.br
-Upon success the total number of pulses in the waveform so far is
-returned. On error a negative status code will be returned.
-
-.br
-The triplets will be added at the start of the existing waveform. If
-they are to start offset from the start then the first triplet should
-consist solely of a delay i.e. 0 0 offset.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs wvag 0x10 0x80 1000 0x80 0x10 9000
-.br
-2
-.br
-
-.br
-$ pigs wvag 0 0 10000 0x10 0x80 1000 0x80 0x10 9000
-.br
-4
-.br
-
-.EE
-
-.br
-
-.IP "\fBWVAS u b db sb o bvs\fP - Add serial data to waveform"
-.IP "" 4
-
-.br
-This command adds a waveform representing serial data \fBbvs\fP to
-GPIO \fBu\fP at \fBb\fP baud to the existing waveform (if any).
-The serial data starts \fBo\fP microseconds from the start of the
-waveform.
-
-.br
-Upon success the total number of pulses in the waveform so far is
-returned. On error a negative status code will be returned.
-
-.br
-The serial data is formatted as one start bit, \fBdb\fP data bits, and
-\fBsb\fP/2 stop bits.
-
-.br
-The baud rate may be between 50 and 1000000 bits per second.
-
-.br
-It is legal to add serial data streams with different baud rates to
-the same waveform.
-
-.br
-The bytes required for each character depend upon \fBdb\fP.
-
-.br
-For \fBdb\fP 1-8 there will be one byte per character.
-.br
-For \fBdb\fP 9-16 there will be two bytes per character.
-.br
-For \fBdb\fP 17-32 there will be four bytes per character.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs wvas 4 9600 8 2 0 0x30 0x31 0x32 0x33
-.br
-23
-.br
-
-.br
-$ pigs wvas 7 38400 8 2 0 0x41 0x42
-.br
-35
-.br
-
-.EE
-
-.br
-
-.IP "\fBWVTAT \fP - Returns the current transmitting waveform"
-.IP "" 4
-
-.br
-This command returns the id of the waveform currently
-being transmitted.
-
-.br
-Returns the waveform id or one of the following special
-values:
-
-.br
-9998 - transmitted wave not found
-.br
-9999 - no wave being transmitted
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs wvtat
-.br
-9999
-.br
-
-.EE
-
-.br
-
-.IP "\fBWVBSY \fP - Check if waveform is being transmitted"
-.IP "" 4
-
-.br
-This command checks to see if a waveform is currently being transmitted.
-
-.br
-Returns 1 if a waveform is currently being transmitted, otherwise 0.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs wvbsy
-.br
-0
-.br
-
-.EE
-
-.br
-
-.IP "\fBWVCHA bvs\fP - Transmits a chain of waveforms"
-.IP "" 4
-
-.br
-This command transmits a chain of waveforms.
-
-.br
-NOTE: Any hardware PWM started by \fBHP\fP will
-be cancelled.
-
-.br
-The waves to be transmitted are specified by the contents of
-\fBbvs\fP which contains an ordered list of wave_ids and optional
-command codes and related data.
-
-.br
-Upon success 0 is returned. On error a negative status code
-will be returned.
-
-.br
-Each wave is transmitted in the order specified. A wave may
-occur multiple times per chain.
-
-.br
-A blocks of waves may be transmitted multiple times by using
-the loop commands. The block is bracketed by loop start and
-end commands. Loops may be nested.
-
-.br
-Delays between waves may be added with the delay command.
-
-.br
-The following command codes are supported:
-
-.br
-
-.EX
-Name Cmd & Data Meaning
-Loop Start 255 0 Identify start of a wave block
-Loop Repeat 255 1 x y loop x + y*256 times
-Delay 255 2 x y delay x + y*256 microseconds
-Loop Forever 255 3 loop forever
-
-.EE
-
-.br
-If present Loop Forever must be the last entry in the chain.
-
-.br
-The code is currently dimensioned to support a chain with roughly
-600 entries and 20 loop counters.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-#!/bin/bash
-.br
-
-.br
-GPIO=4
-.br
-WAVES=5
-.br
-
-.br
-pigs m $GPIO w
-.br
-
-.br
-for ((i=0; i<$WAVES; i++))
-.br
-do
-.br
- pigs wvag $((1<<GPIO)) 0 20 0 $((1<<GPIO)) $(((i+1)*200))
-.br
- w[i]=$(pigs wvcre)
-.br
-done
-.br
-
-.br
-# transmit waves 4+3+2
-.br
-# loop start
-.br
-# transmit waves 0+0+0
-.br
-# loop start
-.br
-# transmit waves 0+1
-.br
-# delay 5000us
-.br
-# loop end (repeat 30 times)
-.br
-# loop start
-.br
-# transmit waves 2+3+0
-.br
-# transmit waves 3+1+2
-.br
-# loop end (repeat 10 times)
-.br
-# loop end (repeat 5 times)
-.br
-# transmit waves 4+4+4
-.br
-# delay 20000us
-.br
-# transmit waves 0+0+0
-.br
-
-.br
-pigs wvcha \
-.br
- ${w[4]} ${w[3]} ${w[2]} \
-.br
- 255 0 \
-.br
- ${w[0]} ${w[0]} ${w[0]} \
-.br
- 255 0 \
-.br
- ${w[0]} ${w[1]} \
-.br
- 255 2 0x88 0x13 \
-.br
- 255 1 30 0 \
-.br
- 255 0 \
-.br
- ${w[2]} ${w[3]} ${w[0]} \
-.br
- ${w[3]} ${w[1]} ${w[2]} \
-.br
- 255 1 10 0 \
-.br
- 255 1 5 0 \
-.br
- ${w[4]} ${w[4]} ${w[4]} \
-.br
- 255 2 0x20 0x4E \
-.br
- ${w[0]} ${w[0]} ${w[0]}
-.br
-
-.br
-while [[ $(pigs wvbsy) -eq 1 ]]; do sleep 0.1; done
-.br
-
-.br
-for ((i=0; i<$WAVES; i++)); do echo ${w[i]}; pigs wvdel ${w[i]}; done
-.br
-
-.EE
-
-.br
-
-.IP "\fBWVCLR \fP - Clear all waveforms"
-.IP "" 4
-
-.br
-This command clears all waveforms.
-
-.br
-Nothing is returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs wvclr
-.br
-
-.EE
-
-.br
-
-.IP "\fBWVCRE \fP - Create a waveform"
-.IP "" 4
-
-.br
-This command creates a waveform from the data provided by the prior
-calls to the \fBWVAG\fP and \fBWVAS\fP commands.
-
-.br
-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 is
-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.
-
-.br
-Normal usage would be
-
-.br
-Step 1. \fBWVCLR\fP to clear all waveforms and added data.
-
-.br
-Step 2. \fBWVAG\fP/\fBWVAS\fP calls to supply the waveform data.
-
-.br
-Step 3. \fBWVCRE\fP to create the waveform and get a unique id.
-
-.br
-Repeat steps 2 and 3 as needed.
-
-.br
-Step 4. \fBWVTX\fP or \fBWVTXR\fP with the id of the waveform to transmit.
-
-.br
-A waveform comprises of one or more pulses.
-
-.br
-A pulse specifies
-
-.br
-1) the GPIO to be switched on at the start of the pulse.
-.br
-2) the GPIO to be switched off at the start of the pulse.
-.br
-3) the delay in microseconds before the next pulse.
-
-.br
-Any or all the fields can be zero. It doesn't make any sense to
-set all the fields to zero (the pulse will be ignored).
-
-.br
-When a waveform is started each pulse is executed in order with
-the specified delay between the pulse and the next.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs wvas 4 9600 0 23 45 67 89 90
-.br
-37
-.br
-$ pigs wvcre
-.br
-0
-.br
-
-.br
-$ pigs wvcre
-.br
--69
-.br
-ERROR: attempt to create an empty waveform
-.br
-
-.EE
-
-.br
-
-.IP "\fBWVCAP \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.
-
-.br
-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.
-
-.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.
-
-.br
-Normal usage would be
-
-.br
-Step 1. \fBWVCLR\fP to clear all waveforms and added data.
-
-.br
-Step 2. \fBWVAG\fP/\fBWVAS\fP calls to supply the waveform data.
-
-.br
-Step 3. \fBWVCAP\fP to create a waveform of a uniform size.
-
-.br
-Step 4. \fBWVTX\fP or \fBWVTXR\fP with the id of the waveform to transmit.
-
-.br
-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.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-# Create a wave that consumes 50% of the total resource:
-.br
-
-.br
-$ pigs wvag 16 0 5000000 0 16 5000000
-.br
-2
-.br
-$ pigs wvcap 50
-.br
-0
-.br
-$ pigs wvtx 0
-.br
-11918
-.br
-
-.EE
-
-.br
-
-.IP "\fBWVDEL wid\fP - Delete selected waveform"
-.IP "" 4
-
-.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.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs wvdel 0
-.br
-
-.br
-$ pigs wvdel 0
-.br
--66
-.br
-ERROR: non existent wave id
-.br
-
-.EE
-
-.br
-
-.IP "\fBWVHLT \fP - Stop waveform"
-.IP "" 4
-
-.br
-This command aborts the transmission of the current waveform.
-
-.br
-Nothing is returned.
-
-.br
-This command is intended to stop a waveform started in the repeat mode.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs wvhlt
-.br
-
-.EE
-
-.br
-
-.IP "\fBWVNEW \fP - Initialise a new waveform"
-.IP "" 4
-
-.br
-This clears any existing waveform data ready for the creation of a new
-waveform.
-
-.br
-Nothing is returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs wvnew
-.br
-
-.EE
-
-.br
-
-.IP "\fBWVSC ws\fP - Get waveform DMA CB stats"
-.IP "" 4
-
-.br
-The statistic requested by \fBws\fP is returned.
-
-.br
-\fBws\fP identifies the subcommand as follows.
-
-.br
-0 Get Cbs
-.br
-1 Get High Cbs
-.br
-2 Get Max Cbs
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs wvas 4 9600 0 23 45 67 89 90
-.br
-37
-.br
-
-.br
-$ pigs wvsc 0
-.br
-74
-.br
-$ pigs wvsc 1
-.br
-74
-.br
-$ pigs wvsc 2
-.br
-25016
-.br
-
-.EE
-
-.br
-
-.IP "\fBWVSM ws\fP - Get waveform time stats"
-.IP "" 4
-
-.br
-The statistic requested by \fBws\fP is returned.
-
-.br
-\fBws\fP identifies the subcommand as follows.
-
-.br
-0 Get Micros
-.br
-1 Get High Micros
-.br
-2 Get Max Micros
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs wvsm 0
-.br
-5314
-.br
-$ pigs wvsm 1
-.br
-5314
-.br
-$ pigs wvsm 2
-.br
-1800000000
-.br
-
-.EE
-
-.br
-
-.IP "\fBWVSP ws\fP - Get waveform pulse stats"
-.IP "" 4
-
-.br
-The statistic requested by \fBws\fP is returned.
-
-.br
-\fBws\fP identifies the subcommand as follows.
-
-.br
-0 Get Pulses
-.br
-1 Get High Pulses
-.br
-2 Get Max Pulses
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs wvsp 0
-.br
-37
-.br
-$ pigs wvsp 1
-.br
-37
-.br
-$ pigs wvsp 2
-.br
-12000
-.br
-
-.EE
-
-.br
-
-.IP "\fBWVTX wid\fP - Transmits waveform once"
-.IP "" 4
-
-.br
-This command transmits the waveform with id \fBwid\fP once.
-
-.br
-NOTE: Any hardware PWM started by \fBHP\fP will be cancelled.
-
-.br
-Upon success the number of DMA control blocks in the waveform is returned.
-On error a negative status code will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs wvtx 1
-.br
-75
-.br
-
-.br
-$ pigs wvtx 2
-.br
--66
-.br
-ERROR: non existent wave id
-.br
-
-.EE
-
-.br
-
-.IP "\fBWVTXM wid wmde\fP - Transmits waveform using mode"
-.IP "" 4
-
-.br
-This command transmits the waveform with id \fBwid\fP using mode \fBwmde\fP.
-
-.br
-The mode may be send once (0), send repeatedly (1), send once but
-first sync with previous wave (2), or send repeatedly but first
-sync with previous wave (3).
-
-.br
-WARNING: bad things may happen if you delete the previous
-waveform before it has been synced to the new waveform.
-
-.br
-NOTE: Any hardware PWM started by \fBHP\fP will be cancelled.
-
-.br
-Upon success the number of DMA control blocks in the waveform is returned.
-On error a negative status code will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs wvtxm 1 3
-.br
-75
-.br
-
-.br
-$ pigs wvtxm 2 0
-.br
--66
-.br
-ERROR: non existent wave id
-.br
-
-.EE
-
-.br
-
-.IP "\fBWVTXR wid\fP - Transmits waveform repeatedly"
-.IP "" 4
-
-.br
-This command transmits the waveform with id \fBwid\fP repeatedly.
-
-.br
-NOTE: Any hardware PWM started by \fBHP\fP will be cancelled.
-
-.br
-Upon success the number of DMA control blocks in the waveform is returned.
-On error a negative status code will be returned.
-
-.br
-
-\fBExample\fP
-.br
-
-.EX
-$ pigs wvtxr 1
-.br
-75
-.br
-
-.br
-$ pigs wvtxr 2
-.br
--66
-.br
-ERROR: non existent wave id
-.br
-
-.EE
-
-.br
-
-.SH PARAMETERS
-
-.br
-
-.IP "\fBactv\fP - 0-1000000" 0
-
-.br
-The number of microseconds level changes are reported for once
-a noise filter has been triggered (by \fBstdy\fP microseconds of
-a stable level).
-
-.br
-
-.IP "\fBb\fP - baud" 0
-The command expects the baud rate in bits per second for
-the transmission of serial data (I2C/SPI/serial link, waves).
-
-.br
-
-.IP "\fBbctl\fP - BSC control word" 0
-The command expects a BSC control word, see \fBBSCX\fP.
-
-.br
-
-.IP "\fBbit\fP - bit value (0-1)" 0
-The command expects 0 or 1.
-
-.br
-
-.IP "\fBbits\fP - a bit mask" 0
-A mask is used to select one or more GPIO. A GPIO is selected
-if bit (1<<GPIO) is set in the mask.
-
-.br
-E.g. a mask of 6 (binary 110) select GPIO 1 and 2, a mask of
-0x103 (binary 100000011) selects GPIO 0, 1, and 8.
-
-.br
-
-.IP "\fBbv\fP - a byte value (0-255)" 0
-The command expects a byte value.
-
-.br
-
-.IP "\fBbvs\fP - byte values (0-255)" 0
-The command expects one or more byte values.
-
-.br
-
-.IP "\fBc\fP - SPI channel (0-1)" 0
-The command expects a SPI channel.
-
-.br
-
-.IP "\fBcf\fP - hardware clock frequency (4689-250M, 13184-375M for the BCM2711)" 0
-The command expects a frequency.
-
-.br
-
-.IP "\fBcs\fP - GPIO (0-31)" 0
-The GPIO used for the slave select signal when bit banging SPI.
-
-.br
-
-.IP "\fBdb\fP - serial data bits (1-32)" 0
-The command expects the number of data bits per serial character.
-
-.br
-
-.IP "\fBdev\fP - a tty serial device (/dev/tty* or /dev/serial*)" 0
-The command expects the name of a tty serial device, e.g.
-
-.br
-
-.EX
-/dev/ttyAMA0
-.br
-/dev/ttyUSB0
-.br
-/dev/tty0
-.br
-/dev/serial0
-.br
-
-.EE
-
-.br
-
-.IP "\fBevent\fP - 0-31" 0
-An event is a signal used to inform one or more consumers
-to start an action.
-
-.br
-
-.IP "\fBfile\fP - a file name" 0
-The file name must match an entry in /opt/pigpio/access.
-
-.br
-
-.IP "\fBfrom\fP - 0-2" 0
-Position to seek from \fBFS\fP.
-
-.br
-
-.EX
- From
-0 start
-1 current position
-2 end
-
-.EE
-
-.br
-
-.IP "\fBg\fP - GPIO (0-53)" 0
-The command expects a GPIO.
-
-.br
-There are 54 General Purpose Input Outputs (GPIO) named gpio0 through gpio53.
-
-.br
-They are split into two banks. Bank 1 consists of gpio0 through gpio31.
-Bank 2 consists of gpio32 through gpio53.
-
-.br
-All the GPIO which are safe for the user to read and write are in bank 1.
-Not all GPIO in bank 1 are safe though. Type 1 boards have 17 safe GPIO.
-Type 2 boards have 21. Type 3 boards have 26.
-
-.br
-See \fBHWVER\fP.
-
-.br
-The user GPIO are marked with an X in the following table.
-
-.br
-
-.EX
- 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
-Type 1 X X - - X - - X X X X X - - X X
-Type 2 - - X X X - - X X X X X - - X X
-Type 3 X X X X X X X X X X X X X X
-
- 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
-Type 1 - X X - - X X X X X - - - - - -
-Type 2 - X X - - - X X X X - X X X X X
-Type 3 X X X X X X X X X X X X - - - -
-
-.EE
-
-.br
-You are not prevented from writing to unsafe GPIO. The consequences
-of doing so range from no effect, to a crash, or corrupted data.
-
-.br
-
-.IP "\fBh\fP - handle (>=0)" 0
-The command expects a handle.
-
-.br
-A handle is a number referencing an object opened by one of \fBFO\fP,
-\fBI2CO\fP, \fBNO\fP, \fBSERO\fP, \fBSPIO\fP.
-
-.br
-
-.IP "\fBib\fP - I2C bus (>=0)" 0
-The command expects an I2C bus number.
-
-.br
-
-.IP "\fBid\fP - I2C device (0-0x7F)" 0
-The command expects the address of an I2C device.
-
-.br
-
-.IP "\fBif\fP - I2C flags (0)" 0
-The command expects an I2C flags value. No flags are currently defined.
-
-.br
-
-.IP "\fBL\fP - level (0-1)" 0
-The command expects a GPIO level.
-
-.br
-
-.IP "\fBm\fP - mode (RW540123)" 0
-The command expects a mode character.
-
-.br
-Each GPIO can be configured to be in one of 8 different modes. The modes
-are named Input, Output, ALT0, ALT1, ALT2, ALT3, ALT4, and ALT5.
-
-.br
-To set the mode use the code for the mode.
-
-.br
-The value is returned by the mode get command.
-
-.br
-
-.EX
-Mode Input Output ALT0 ALT1 ALT2 ALT3 ALT4 ALT5
-Code R W 0 1 2 3 4 5
-Value 0 1 4 5 6 7 3 2
-
-.EE
-
-.br
-
-.IP "\fBmiso\fP - GPIO (0-31)" 0
-The GPIO used for the MISO signal when bit banging SPI.
-
-.br
-
-.IP "\fBmode\fP - file open mode" 0
-One of the following values.
-
-.br
-
-.EX
- Value Meaning
-READ 1 open file for reading
-WRITE 2 open file for writing
-RW 3 open file for reading and writing
-
-.EE
-
-.br
-The following values can be or'd into the mode.
-
-.br
-
-.EX
- Value Meaning
-APPEND 4 All writes append data to the end of the file
-CREATE 8 The file is created if it doesn't exist
-TRUNC 16 The file is truncated
-
-.EE
-
-.br
-
-.IP "\fBmosi\fP - GPIO (0-31)" 0
-The GPIO used for the MOSI signal when bit banging SPI.
-
-.br
-
-.IP "\fBname\fP - the name of a script" 0
-Only alphanumeric characters, '-' and '_' are allowed in the name.
-
-.br
-
-.IP "\fBnum\fP - maximum number of bytes to return (1-)" 0
-The command expects the maximum number of bytes to return.
-
-.br
-For the I2C and SPI commands the requested number of bytes will always
-be returned.
-
-.br
-For the serial and file commands the smaller of the number of
-bytes available to be read (which may be zero) and \fBnum\fP bytes
-will be returned.
-
-.br
-
-.IP "\fBo\fP - offset (>=0)" 0
-Serial data is stored offset microseconds from the start of the waveform.
-
-.br
-
-.IP "\fBp\fP - PUD (ODU)" 0
-The command expects a PUD character.
-
-.br
-Each GPIO can be configured to use or not use an internal pull up or
-pull down resistor. This is useful to provide a default state for inputs.
-
-.br
-A pull up will default the input to 1 (high).
-
-.br
-A pull down will default the input to 0 (low).
-
-.br
-To set the pull up down state use the command character for the state.
-
-.br
-
-.EX
-Pull Up Down Off Pull Down Pull Up
-Command Character O D U
-
-.EE
-
-.br
-There is no mechanism to read the pull up down state.
-
-.br
-
-.IP "\fBpad\fP - 0-2" 0
-A set of GPIO which share common drivers.
-
-.br
-
-.EX
-Pad GPIO
-0 0-27
-1 28-45
-2 46-53
-
-.EE
-
-.br
-
-.IP "\fBpadma\fP - 1-16" 0
-The mA which may be drawn from each GPIO whilst still guaranteeing the
-high and low levels.
-
-.br
-
-.IP "\fBpars\fP - script parameters" 0
-The command expects 0 to 10 numbers as parameters to be passed to the script.
-
-.br
-
-.IP "\fBpat\fP - a file name pattern" 0
-A file path which may contain wildcards. To be accessible the path
-must match an entry in /opt/pigpio/access.
-
-.br
-
-.IP "\fBpdc\fP - hardware PWM dutycycle (0-1000000)" 0
-The command expects a dutycycle.
-
-.br
-
-.IP "\fBpf\fP - hardware PWM frequency (1-125M, 1-187.5M for the BCM2711)" 0
-The command expects a frequency.
-
-.br
-
-.IP "\fBpl\fP - pulse length (1-100)" 0
-The command expects a pulse length in microseconds.
-
-.br
-
-.IP "\fBr\fP - register (0-255)" 0
-The command expects an I2C register number.
-
-.br
-
-.IP "\fBsb\fP - serial stop (half) bits (2-8)" 0
-The command expects the number of stop (half) bits per serial character.
-
-.br
-
-.IP "\fBscl\fP - user GPIO (0-31)" 0
-The command expects the number of the GPIO to be used for SCL
-when bit banging I2C.
-
-.br
-
-.IP "\fBsclk\fP - user GPIO (0-31)" 0
-The GPIO used for the SCLK signal when bit banging SPI.
-
-.br
-
-.IP "\fBsda\fP - user GPIO (0-31)" 0
-The command expects the number of the GPIO to be used for SDA
-when bit banging I2C.
-
-.br
-
-.IP "\fBsef\fP - serial flags (32 bits)" 0
-The command expects a flag value. No serial flags are currently defined.
-
-.br
-
-.IP "\fBsid\fP - script id (>= 0)" 0
-The command expects a script id as returned by a call to \fBPROC\fP.
-
-.br
-
-.IP "\fBspf\fP - SPI flags (32 bits)" 0
-See \fBSPIO\fP and \fBBSPIO\fP.
-
-.br
-
-.IP "\fBstdy\fP - 0-300000" 0
-
-.br
-The number of microseconds level changes must be stable for
-before reporting the level changed (\fBFG\fP) or triggering
-the active part of a noise filter (\fBFN\fP).
-
-.br
-
-.IP "\fBstr\fP - a string" 0
-The command expects a string.
-
-.br
-
-.IP "\fBt\fP - a string" 0
-The command expects a string.
-
-.br
-
-.IP "\fBtrips\fP - triplets" 0
-The command expects 1 or more triplets of GPIO on, GPIO off, delay.
-
-.br
-E.g. 0x400000 0 100000 0 0x400000 900000 defines two pulses as follows
-
-.br
-
-.EX
- GPIO on GPIO off delay
-0x400000 (GPIO 22) 0 (None) 100000 (1/10th s)
- 0 (None) 0x400000 (GPIO 22) 900000 (9/10th s)
-
-.EE
-
-.br
-
-.IP "\fBu\fP - user GPIO (0-31)" 0
-The command expects the number of a user GPIO.
-
-.br
-A number of commands are restricted to GPIO in bank 1,
-in particular the PWM commands, the servo command,
-the watchdog command, and the notification command.
-
-.br
-It is your responsibility to ensure that the PWM and servo commands
-are only used on safe GPIO.
-
-.br
-See \fBg\fP
-
-.br
-
-.IP "\fBuvs\fP - values" 0
-The command expects an arbitrary number of >=0 values (possibly none).
-Any after the first two must be <= 255.
-
-.br
-
-.IP "\fBv\fP - value" 0
-The command expects a number.
-
-.br
-
-.IP "\fBwid\fP - wave id (>=0)" 0
-The command expects a wave id.
-
-.br
-When a waveform is created it is given an id (0, 1, 2, ...).
-
-.br
-
-.IP "\fBwmde\fP - mode (0-3)" 0
-The command expects a wave transmission mode.
-
-.br
-0 = send once
-.br
-1 = send repeatedly
-.br
-2 = send once but first sync with previous wave
-.br
-3 = send repeatedly but first sync with previous wave
-.br
-
-.br
-
-.IP "\fBws\fP - wave stats sucommand (0-2)" 0
-The command expects a subcommand.
-
-.br
-0 = current value.
-.br
-1 = highest value so far.
-.br
-2 = maximum possible value.
-
-.br
-
-.IP "\fBwv\fP - word value (0-65535)" 0
-The command expects a word value.
-
-.br
-
-.SH SCRIPTS
-
-.br
-Scripts are programs to be stored and executed by the pigpio daemon.
-They are intended to mitigate any performance problems associated with
-the pigpio daemon server/client model.
-
-.br
-.SS Example
-.br
-A trivial example might be useful. Suppose you want to toggle a GPIO
-on and off as fast as possible.
-
-.br
-From the command line you could write
-
-.br
-
-.EX
-for ((i=0; i<1000;i++)); do pigs w 22 1 w 22 0; done
-.br
-
-.EE
-
-.br
-Timing that you will see it takes about 14 seconds, or roughly
-70 toggles per second.
-
-.br
-Using the pigpio Python module you could use code such as
-
-.br
-
-.EX
-#!/usr/bin/env python
-.br
-
-.br
-import time
-.br
-
-.br
-import pigpio
-.br
-
-.br
-PIN=4
-.br
-
-.br
-TOGGLE=10000
-.br
-
-.br
-pi = pigpio.pi() # Connect to local Pi.
-.br
-
-.br
-s = time.time()
-.br
-
-.br
-for i in range(TOGGLE):
-.br
- pi.write(PIN, 1)
-.br
- pi.write(PIN, 0)
-.br
-
-.br
-e = time.time()
-.br
-
-.br
-print("pigpio did {} toggles per second".format(int(TOGGLE/(e-s))))
-.br
-
-.br
-pi.stop()
-.br
-
-.EE
-
-.br
-Timing that shows a speed improvement to roughly 800 toggles per second.
-
-.br
-Now let's use a script.
-
-.br
-
-.EX
-pigs proc tag 999 w 22 1 w 22 0 dcr p0 jp 999
-.br
-
-.EE
-
-.br
-Ignore the details for now.
-
-.br
-Let's time the script running.
-
-.br
-Again, ignore the details for now.
-
-.br
-
-.EX
-time (pigs procr 0 10000000; while a=$(pigs procp 0); [[ ${a::1} -eq 2 ]];\
-.br
- do sleep 0.2; done)
-.br
-
-.EE
-
-.br
-The script takes roughly 12 seconds to complete, or 800,000 toggles per second.
-
-.br
-That is the advantage of a stored script.
-
-.br
-Some details.
-
-.br
-
-.EX
-pigs proc tag 999 w 22 1 w 22 0 dcr p0 jp 999
-.br
-
-.EE
-
-.br
-proc introduces a script. Everything after proc is part of the script.
-.br
-tag 999 names the current position in the script.
-.br
-w 22 1 writes 1 to GPIO 22.
-.br
-w 22 0 writes 0 to GPIO 22.
-.br
-dcr p0 decrements parameter 0.
-.br
-jp 999 jumps to tag 999 if the result is positive.
-
-.br
-
-.EX
-time (pigs procr 0 10000000; while a=$(pigs procp 0); [[ ${a::1} -eq 2 ]];\
-.br
- do sleep 0.2; done)
-.br
-
-.EE
-
-.br
-pigs procr 0 10000000 starts script 0 with parameter 0 of 10 million.
-
-.br
-The rest is bash apart from
-
-.br
-pigs procp 0 asks for the status and parameters of script 0.
-The status will be 2 while the script is running and 1 when it is complete.
-
-.br
-.SS Virtual machine
-.br
-A script runs within a virtual machine with
-
-.br
-a 32 bit accumulator A.
-.br
-a flags register F.
-.br
-a program counter PC.
-
-.br
-Each script has
-
-.br
-10 parameters named 0 through 9.
-.br
-150 variables named 0 through 149.
-.br
-50 labels which are named by any unique number.
-
-.br
-.SS Commands
-.br
-Many pigpio commands may be used within a script. However
-some commands do not work within the script model as designed and
-are not permitted.
-
-.br
-The following commands are not permitted within a script:
-
-.br
-File - FL FO FR FW
-
-.br
-I2C - BI2CZ I2CPK I2CRD I2CRI I2CRK I2CWD I2CWI I2CWK I2CZ
-
-.br
-Misc - BSCX CF1 CF2 SHELL
-
-.br
-Script control - PARSE PROC PROCD PROCP PROCR PROCS PROCU
-
-.br
-Serial - SERO SERR SERW SLR
-
-.br
-SPI - BSPIO BSPIX SPIR SPIW SPIX
-
-.br
-Waves - WVAG WVAS WVCHA WVGO WVGOR
-
-.br
-The following commands are only permitted within a script:
-
-.br
-
-.EX
-Command Description Definition
-ADD x Add x to accumulator A+=x; F=A
-AND x And x with accumulator A&=x; F=A
-CALL L Call subroutine at tag L push(PC+1); PC=L
-CMP x Compare x with accumulator F=A-x
-DCR y Decrement register --*y; F=*y
-DCRA Decrement accumulator --A; F=A
-DIV x Divide x into accumulator A/=x; F=A
-EVTWT Wait for an event to occur A=wait(x); F=A
-HALT Halt Halt
-INR y Increment register ++*y; F=*y
-INRA Increment accumulator ++A; F=A
-JM L Jump if minus to tag L if (F<0) PC=L
-JMP L Jump to tag L PC=L
-JNZ L Jump if non-zero to tag L if (F) PC=L
-JP L Jump if positive to tag L if (F>=0) PC=L
-JZ L Jump if zero to tag L if (!F) PC=L
-LD y x Load register with x *y=x
-LDA x Load accumulator with x A=x
-MLT x Multiply x with accumulator A*=x; F=A
-MOD x Modulus x with accumulator A%=x; F=A
-OR x Or x with accumulator A|=x; F=A
-POP y Pop register y=pop()
-POPA Pop accumulator A=pop()
-PUSH y Push register push(y)
-PUSHA Push accumulator push(A)
-RET Return from subroutine PC=pop()
-RL y x Rotate left register x bits *y<<=x; F=*y
-RLA x Rotate left accumulator x bits A<<=x; F=A
-RR y x Rotate right register x bits *y>>=x; F=*y
-RRA x Rotate right accumulator x bits A>>=x; F=A
-STA y Store accumulator in register y=A
-SUB x Subtract x from accumulator A-=x; F=A
-SYS str Run external script (/opt/pigpio/cgi/str) system(str); F=A
-TAG L Label the current script position N/A
-WAIT x Wait for a GPIO in x to change state A=wait(x); F=A
-X y1 y2 Exchange contents of registers y1 and y2 t=*y1;*y1=*y2;*y2=t
-XA y Exchange contents of accumulator and register t=A;A=*y;*y=t
-XOR x Xor x with accumulator A^=x; F=A
-
-.EE
-
-.br
-x may be a constant, a parameter (p0-p9), or a variable (v0-v149).
-
-.br
-y may be a parameter (p0-p9), or a variable (v0-v149). If p or v isn't
-specified y is assumed to be a variable.
-
-.br
-The EVTWT command parameter is a bit-mask with 1 set for events of interest.
-
-.br
-The WAIT command parameter is a bit-mask with 1 set for GPIO of interest.
-
-.br
-The SYS script receives two unsigned parameters: the accumulator A and
-the current GPIO levels.
-
-.br
-
-.SH SEE ALSO
-
-pigpiod(1), pig2vcd(1), pigpio(3), pigpiod_if(3), pigpiod_if2(3)
-.SH AUTHOR
-
-joan@abyz.me.uk
diff --git a/DOC/dbase/pigpio.sqlite b/DOC/dbase/pigpio.sqlite
index 22ceb98..6ac1161 100644
--- a/DOC/dbase/pigpio.sqlite
+++ b/DOC/dbase/pigpio.sqlite
Binary files differ
diff --git a/DOC/dbase/pigpio.sqlite.2020-04-29-16-40-23 b/DOC/dbase/pigpio.sqlite.2020-04-29-16-40-23
deleted file mode 100644
index 0820b48..0000000
--- a/DOC/dbase/pigpio.sqlite.2020-04-29-16-40-23
+++ /dev/null
Binary files differ
diff --git a/DOC/dbase/pigpio.sqlite.2020-04-29-20-52-04 b/DOC/dbase/pigpio.sqlite.2020-04-29-20-52-04
deleted file mode 100644
index 93b1db0..0000000
--- a/DOC/dbase/pigpio.sqlite.2020-04-29-20-52-04
+++ /dev/null
Binary files differ
diff --git a/DOC/dbase/pigpio.sqlite.2020-04-29-21-11-13 b/DOC/dbase/pigpio.sqlite.2020-04-29-21-11-13
deleted file mode 100644
index d89cd8f..0000000
--- a/DOC/dbase/pigpio.sqlite.2020-04-29-21-11-13
+++ /dev/null
Binary files differ
diff --git a/DOC/dbase/pigpio.sqlite.2020-04-29-22-41-24 b/DOC/dbase/pigpio.sqlite.2020-04-29-22-41-24
deleted file mode 100644
index 79a4182..0000000
--- a/DOC/dbase/pigpio.sqlite.2020-04-29-22-41-24
+++ /dev/null
Binary files differ
diff --git a/DOC/dbase/pigpio.sqlite.2020-04-29-23-09-20 b/DOC/dbase/pigpio.sqlite.2020-04-29-23-09-20
deleted file mode 100644
index 07931f1..0000000
--- a/DOC/dbase/pigpio.sqlite.2020-04-29-23-09-20
+++ /dev/null
Binary files differ
diff --git a/DOC/dbase/pigpio.sqlite.2020-04-29-23-19-32 b/DOC/dbase/pigpio.sqlite.2020-04-29-23-19-32
deleted file mode 100644
index c9ca6e2..0000000
--- a/DOC/dbase/pigpio.sqlite.2020-04-29-23-19-32
+++ /dev/null
Binary files differ
diff --git a/DOC/dbase/pigpio.sqlite.2020-04-29-23-23-35 b/DOC/dbase/pigpio.sqlite.2020-04-29-23-23-35
deleted file mode 100644
index 1630297..0000000
--- a/DOC/dbase/pigpio.sqlite.2020-04-29-23-23-35
+++ /dev/null
Binary files differ
diff --git a/DOC/dbase/pigpio.sqlite.2020-04-29-23-24-27 b/DOC/dbase/pigpio.sqlite.2020-04-29-23-24-27
deleted file mode 100644
index 840f6a8..0000000
--- a/DOC/dbase/pigpio.sqlite.2020-04-29-23-24-27
+++ /dev/null
Binary files differ
diff --git a/DOC/dbase/pigpio.sqlite.2020-04-29-23-26-47 b/DOC/dbase/pigpio.sqlite.2020-04-29-23-26-47
deleted file mode 100644
index ef77c96..0000000
--- a/DOC/dbase/pigpio.sqlite.2020-04-29-23-26-47
+++ /dev/null
Binary files differ
diff --git a/DOC/dbase/pigpio.sqlite.2020-04-29-23-29-09 b/DOC/dbase/pigpio.sqlite.2020-04-29-23-29-09
deleted file mode 100644
index 125a0fc..0000000
--- a/DOC/dbase/pigpio.sqlite.2020-04-29-23-29-09
+++ /dev/null
Binary files differ
diff --git a/DOC/dbase/pigpio.sqlite.2020-04-29-23-32-20 b/DOC/dbase/pigpio.sqlite.2020-04-29-23-32-20
deleted file mode 100644
index 70b41cd..0000000
--- a/DOC/dbase/pigpio.sqlite.2020-04-29-23-32-20
+++ /dev/null
Binary files differ
diff --git a/DOC/dbase/pigpio.sqlite.2020-04-30-08-51-48 b/DOC/dbase/pigpio.sqlite.2020-04-30-08-51-48
deleted file mode 100644
index 98a0cb1..0000000
--- a/DOC/dbase/pigpio.sqlite.2020-04-30-08-51-48
+++ /dev/null
Binary files differ
diff --git a/DOC/dbase/pigpio.sqlite.2020-04-30-08-59-05 b/DOC/dbase/pigpio.sqlite.2020-04-30-08-59-05
deleted file mode 100644
index d763ce9..0000000
--- a/DOC/dbase/pigpio.sqlite.2020-04-30-08-59-05
+++ /dev/null
Binary files differ
diff --git a/DOC/dbase/pigpio.sqlite.2020-04-30-09-37-19 b/DOC/dbase/pigpio.sqlite.2020-04-30-09-37-19
deleted file mode 100644
index 23be3f5..0000000
--- a/DOC/dbase/pigpio.sqlite.2020-04-30-09-37-19
+++ /dev/null
Binary files differ
diff --git a/DOC/dbase/pigpio.sqlite.2020-04-30-09-44-25 b/DOC/dbase/pigpio.sqlite.2020-04-30-09-44-25
deleted file mode 100644
index 1dc038e..0000000
--- a/DOC/dbase/pigpio.sqlite.2020-04-30-09-44-25
+++ /dev/null
Binary files differ
diff --git a/DOC/dbase/pigpio.sqlite.2020-04-30-09-45-49 b/DOC/dbase/pigpio.sqlite.2020-04-30-09-45-49
deleted file mode 100644
index 03f11ba..0000000
--- a/DOC/dbase/pigpio.sqlite.2020-04-30-09-45-49
+++ /dev/null
Binary files differ
diff --git a/DOC/dbase/pigpio.sqlite.2020-04-30-09-48-51 b/DOC/dbase/pigpio.sqlite.2020-04-30-09-48-51
deleted file mode 100644
index d37369e..0000000
--- a/DOC/dbase/pigpio.sqlite.2020-04-30-09-48-51
+++ /dev/null
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/tmp/body/cif.body b/DOC/tmp/body/cif.body
deleted file mode 100644
index f20d1c4..0000000
--- a/DOC/tmp/body/cif.body
+++ /dev/null
@@ -1,1824 +0,0 @@
-<br><br>pigpio is a C library for the Raspberry which allows control of the GPIO.
-<h3>Features</h3>o hardware timed PWM on any of GPIO 0-31
-<br><br>o hardware timed servo pulses on any of GPIO 0-31
-<br><br>o callbacks when any of GPIO 0-31 change state
-<br><br>o callbacks at timed intervals
-<br><br>o reading/writing all of the GPIO in a bank as one operation
-<br><br>o individually setting GPIO modes, reading and writing
-<br><br>o notifications when any of GPIO 0-31 change state
-<br><br>o the construction of output waveforms with microsecond timing
-<br><br>o rudimentary permission control over GPIO
-<br><br>o a simple interface to start and stop new threads
-<br><br>o I2C, SPI, and serial link wrappers
-<br><br>o creating and running scripts
-<h3>GPIO</h3>ALL GPIO are identified by their Broadcom number.
-<h3>Credits</h3>The PWM and servo pulses are timed using the DMA and PWM peripherals.
-<br><br>This use was inspired by Richard Hirst's servoblaster kernel module.
-<h3>Usage</h3>Include &lt;pigpio.h&gt; in your source files.
-<br><br>Assuming your source is in prog.c use the following command to build and
-run the executable.
-<br><br><code>gcc&nbsp;-Wall&nbsp;-pthread&nbsp;-o&nbsp;prog&nbsp;prog.c&nbsp;-lpigpio&nbsp;-lrt<br>sudo&nbsp;./prog<br></code><br><br>For examples of usage see the C programs within the pigpio archive file.
-<h3>Notes</h3>All the functions which return an int return &lt; 0 on error.
-<br><br><a href="#gpioInitialise">gpioInitialise</a> must be called before all other library functions
-with the following exceptions:
-<br><br><code><a href="#gpioCfg*">gpioCfg*</a><br><a href="#gpioVersion">gpioVersion</a><br><a href="#gpioHardwareRevision">gpioHardwareRevision</a><br></code><br><br>If the library is not initialised all but the <a href="#gpioCfg*">gpioCfg*</a>,
-<a href="#gpioVersion">gpioVersion</a>, and <a href="#gpioHardwareRevision">gpioHardwareRevision</a> functions will
-return error PI_NOT_INITIALISED.
-<br><br>If the library is initialised the <a href="#gpioCfg*">gpioCfg*</a> functions will return
-error PI_INITIALISED.
-<h2>OVERVIEW</h2><table border="0" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td></td></tr><tr><td><b>ESSENTIAL
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioInitialise">gpioInitialise</a></td><td> Initialise library
-</td></tr><tr><td><a href="#gpioTerminate">gpioTerminate</a></td><td> Stop library
-</td></tr><tr><td></td><td></td></tr><tr><td><b>BASIC
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSetMode">gpioSetMode</a></td><td> Set a GPIO mode
-</td></tr><tr><td><a href="#gpioGetMode">gpioGetMode</a></td><td> Get a GPIO mode
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSetPullUpDown">gpioSetPullUpDown</a></td><td> Set/clear GPIO pull up/down resistor
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioRead">gpioRead</a></td><td> Read a GPIO
-</td></tr><tr><td><a href="#gpioWrite">gpioWrite</a></td><td> Write a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>PWM (overrides servo commands on same GPIO)
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioPWM">gpioPWM</a></td><td> Start/stop PWM pulses on a GPIO
-</td></tr><tr><td><a href="#gpioSetPWMfrequency">gpioSetPWMfrequency</a></td><td> Configure PWM frequency for a GPIO
-</td></tr><tr><td><a href="#gpioSetPWMrange">gpioSetPWMrange</a></td><td> Configure PWM range for a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioGetPWMdutycycle">gpioGetPWMdutycycle</a></td><td> Get dutycycle setting on a GPIO
-</td></tr><tr><td><a href="#gpioGetPWMfrequency">gpioGetPWMfrequency</a></td><td> Get configured PWM frequency for a GPIO
-</td></tr><tr><td><a href="#gpioGetPWMrange">gpioGetPWMrange</a></td><td> Get configured PWM range for a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioGetPWMrealRange">gpioGetPWMrealRange</a></td><td> Get underlying PWM range for a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Servo (overrides PWM commands on same GPIO)
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioServo">gpioServo</a></td><td> Start/stop servo pulses on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioGetServoPulsewidth">gpioGetServoPulsewidth</a></td><td> Get pulsewidth setting on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>INTERMEDIATE
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioTrigger">gpioTrigger</a></td><td> Send a trigger pulse to a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSetWatchdog">gpioSetWatchdog</a></td><td> Set a watchdog on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioRead_Bits_0_31">gpioRead_Bits_0_31</a></td><td> Read all GPIO in bank 1
-</td></tr><tr><td><a href="#gpioRead_Bits_32_53">gpioRead_Bits_32_53</a></td><td> Read all GPIO in bank 2
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWrite_Bits_0_31_Clear">gpioWrite_Bits_0_31_Clear</a></td><td> Clear selected GPIO in bank 1
-</td></tr><tr><td><a href="#gpioWrite_Bits_32_53_Clear">gpioWrite_Bits_32_53_Clear</a></td><td>Clear selected GPIO in bank 2
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWrite_Bits_0_31_Set">gpioWrite_Bits_0_31_Set</a></td><td> Set selected GPIO in bank 1
-</td></tr><tr><td><a href="#gpioWrite_Bits_32_53_Set">gpioWrite_Bits_32_53_Set</a></td><td> Set selected GPIO in bank 2
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSetAlertFunc">gpioSetAlertFunc</a></td><td> Request a GPIO level change callback
-</td></tr><tr><td><a href="#gpioSetAlertFuncEx">gpioSetAlertFuncEx</a></td><td> Request a GPIO change callback, extended
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSetTimerFunc">gpioSetTimerFunc</a></td><td> Request a regular timed callback
-</td></tr><tr><td><a href="#gpioSetTimerFuncEx">gpioSetTimerFuncEx</a></td><td> Request a regular timed callback, extended
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioStartThread">gpioStartThread</a></td><td> Start a new thread
-</td></tr><tr><td><a href="#gpioStopThread">gpioStopThread</a></td><td> Stop a previously started thread
-</td></tr><tr><td></td><td></td></tr><tr><td><b>ADVANCED
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioNotifyOpen">gpioNotifyOpen</a></td><td> Request a notification handle
-</td></tr><tr><td><a href="#gpioNotifyClose">gpioNotifyClose</a></td><td> Close a notification
-</td></tr><tr><td><a href="#gpioNotifyOpenWithSize">gpioNotifyOpenWithSize</a></td><td> Request a notification with sized pipe
-</td></tr><tr><td><a href="#gpioNotifyBegin">gpioNotifyBegin</a></td><td> Start notifications for selected GPIO
-</td></tr><tr><td><a href="#gpioNotifyPause">gpioNotifyPause</a></td><td> Pause notifications
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioHardwareClock">gpioHardwareClock</a></td><td> Start hardware clock on supported GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioHardwarePWM">gpioHardwarePWM</a></td><td> Start hardware PWM on supported GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioGlitchFilter">gpioGlitchFilter</a></td><td> Set a glitch filter on a GPIO
-</td></tr><tr><td><a href="#gpioNoiseFilter">gpioNoiseFilter</a></td><td> Set a noise filter on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSetPad">gpioSetPad</a></td><td> Sets a pads drive strength
-</td></tr><tr><td><a href="#gpioGetPad">gpioGetPad</a></td><td> Gets a pads drive strength
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#shell">shell</a></td><td> Executes a shell command
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSetISRFunc">gpioSetISRFunc</a></td><td> Request a GPIO interrupt callback
-</td></tr><tr><td><a href="#gpioSetISRFuncEx">gpioSetISRFuncEx</a></td><td> Request a GPIO interrupt callback, extended
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSetSignalFunc">gpioSetSignalFunc</a></td><td> Request a signal callback
-</td></tr><tr><td><a href="#gpioSetSignalFuncEx">gpioSetSignalFuncEx</a></td><td> Request a signal callback, extended
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSetGetSamplesFunc">gpioSetGetSamplesFunc</a></td><td> Requests a GPIO samples callback
-</td></tr><tr><td><a href="#gpioSetGetSamplesFuncEx">gpioSetGetSamplesFuncEx</a></td><td> Requests a GPIO samples callback, extended
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Custom
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioCustom1">gpioCustom1</a></td><td> User custom function 1
-</td></tr><tr><td><a href="#gpioCustom2">gpioCustom2</a></td><td> User custom function 2
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Events
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#eventMonitor">eventMonitor</a></td><td> Sets the events to monitor
-</td></tr><tr><td><a href="#eventSetFunc">eventSetFunc</a></td><td> Request an event callback
-</td></tr><tr><td><a href="#eventSetFuncEx">eventSetFuncEx</a></td><td> Request an event callback, extended
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#eventTrigger">eventTrigger</a></td><td> Trigger an event
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Scripts
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioStoreScript">gpioStoreScript</a></td><td> Store a script
-</td></tr><tr><td><a href="#gpioRunScript">gpioRunScript</a></td><td> Run a stored script
-</td></tr><tr><td><a href="#gpioUpdateScript">gpioUpdateScript</a></td><td> Set a scripts parameters
-</td></tr><tr><td><a href="#gpioScriptStatus">gpioScriptStatus</a></td><td> Get script status and parameters
-</td></tr><tr><td><a href="#gpioStopScript">gpioStopScript</a></td><td> Stop a running script
-</td></tr><tr><td><a href="#gpioDeleteScript">gpioDeleteScript</a></td><td> Delete a stored script
-</td></tr><tr><td></td><td></td></tr><tr><td><b>I2C
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cOpen">i2cOpen</a></td><td> Opens an I2C device
-</td></tr><tr><td><a href="#i2cClose">i2cClose</a></td><td> Closes an I2C device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cWriteQuick">i2cWriteQuick</a></td><td> SMBus write quick
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cReadByte">i2cReadByte</a></td><td> SMBus read byte
-</td></tr><tr><td><a href="#i2cWriteByte">i2cWriteByte</a></td><td> SMBus write byte
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cReadByteData">i2cReadByteData</a></td><td> SMBus read byte data
-</td></tr><tr><td><a href="#i2cWriteByteData">i2cWriteByteData</a></td><td> SMBus write byte data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cReadWordData">i2cReadWordData</a></td><td> SMBus read word data
-</td></tr><tr><td><a href="#i2cWriteWordData">i2cWriteWordData</a></td><td> SMBus write word data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cReadBlockData">i2cReadBlockData</a></td><td> SMBus read block data
-</td></tr><tr><td><a href="#i2cWriteBlockData">i2cWriteBlockData</a></td><td> SMBus write block data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cReadI2CBlockData">i2cReadI2CBlockData</a></td><td> SMBus read I2C block data
-</td></tr><tr><td><a href="#i2cWriteI2CBlockData">i2cWriteI2CBlockData</a></td><td> SMBus write I2C block data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cReadDevice">i2cReadDevice</a></td><td> Reads the raw I2C device
-</td></tr><tr><td><a href="#i2cWriteDevice">i2cWriteDevice</a></td><td> Writes the raw I2C device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cProcessCall">i2cProcessCall</a></td><td> SMBus process call
-</td></tr><tr><td><a href="#i2cBlockProcessCall">i2cBlockProcessCall</a></td><td> SMBus block process call
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cSwitchCombined">i2cSwitchCombined</a></td><td> Sets or clears the combined flag
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cSegments">i2cSegments</a></td><td> Performs multiple I2C transactions
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2cZip">i2cZip</a></td><td> Performs multiple I2C transactions
-</td></tr><tr><td></td><td></td></tr><tr><td><b>I2C BIT BANG
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#bbI2COpen">bbI2COpen</a></td><td> Opens GPIO for bit banging I2C
-</td></tr><tr><td><a href="#bbI2CClose">bbI2CClose</a></td><td> Closes GPIO for bit banging I2C
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#bbI2CZip">bbI2CZip</a></td><td> Performs bit banged I2C transactions
-</td></tr><tr><td></td><td></td></tr><tr><td><b>I2C/SPI SLAVE
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#bscXfer">bscXfer</a></td><td> I2C/SPI as slave transfer
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SERIAL
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#serOpen">serOpen</a></td><td> Opens a serial device
-</td></tr><tr><td><a href="#serClose">serClose</a></td><td> Closes a serial device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#serReadByte">serReadByte</a></td><td> Reads a byte from a serial device
-</td></tr><tr><td><a href="#serWriteByte">serWriteByte</a></td><td> Writes a byte to a serial device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#serRead">serRead</a></td><td> Reads bytes from a serial device
-</td></tr><tr><td><a href="#serWrite">serWrite</a></td><td> Writes bytes to a serial device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#serDataAvailable">serDataAvailable</a></td><td> Returns number of bytes ready to be read
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SERIAL BIT BANG (read only)
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSerialReadOpen">gpioSerialReadOpen</a></td><td> Opens a GPIO for bit bang serial reads
-</td></tr><tr><td><a href="#gpioSerialReadClose">gpioSerialReadClose</a></td><td> Closes a GPIO for bit bang serial reads
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSerialReadInvert">gpioSerialReadInvert</a></td><td> Configures normal/inverted for serial reads
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioSerialRead">gpioSerialRead</a></td><td> Reads bit bang serial data from a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SPI
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#spiOpen">spiOpen</a></td><td> Opens a SPI device
-</td></tr><tr><td><a href="#spiClose">spiClose</a></td><td> Closes a SPI device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#spiRead">spiRead</a></td><td> Reads bytes from a SPI device
-</td></tr><tr><td><a href="#spiWrite">spiWrite</a></td><td> Writes bytes to a SPI device
-</td></tr><tr><td><a href="#spiXfer">spiXfer</a></td><td> Transfers bytes with a SPI device
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SPI BIT BANG
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#bbSPIOpen">bbSPIOpen</a></td><td> Opens GPIO for bit banging SPI
-</td></tr><tr><td><a href="#bbSPIClose">bbSPIClose</a></td><td> Closes GPIO for bit banging SPI
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#bbSPIXfer">bbSPIXfer</a></td><td> Performs bit banged SPI transactions
-</td></tr><tr><td></td><td></td></tr><tr><td><b>FILES
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#fileOpen">fileOpen</a></td><td> Opens a file
-</td></tr><tr><td><a href="#fileClose">fileClose</a></td><td> Closes a file
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#fileRead">fileRead</a></td><td> Reads bytes from a file
-</td></tr><tr><td><a href="#fileWrite">fileWrite</a></td><td> Writes bytes to a file
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#fileSeek">fileSeek</a></td><td> Seeks to a position within a file
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#fileList">fileList</a></td><td> List files which match a pattern
-</td></tr><tr><td></td><td></td></tr><tr><td><b>WAVES
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWaveClear">gpioWaveClear</a></td><td> Deletes all waveforms
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWaveAddNew">gpioWaveAddNew</a></td><td> Starts a new waveform
-</td></tr><tr><td><a href="#gpioWaveAddGeneric">gpioWaveAddGeneric</a></td><td> Adds a series of pulses to the waveform
-</td></tr><tr><td><a href="#gpioWaveAddSerial">gpioWaveAddSerial</a></td><td> Adds serial data to the waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWaveCreate">gpioWaveCreate</a></td><td> Creates a waveform from added data
-</td></tr><tr><td><a href="#gpioWaveCreatePad">gpioWaveCreatePad</a></td><td> Creates a waveform of fixed size from added data
-</td></tr><tr><td><a href="#gpioWaveDelete">gpioWaveDelete</a></td><td> Deletes a waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWaveTxSend">gpioWaveTxSend</a></td><td> Transmits a waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWaveChain">gpioWaveChain</a></td><td> Transmits a chain of waveforms
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWaveTxAt">gpioWaveTxAt</a></td><td> Returns the current transmitting waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWaveTxBusy">gpioWaveTxBusy</a></td><td> Checks to see if the waveform has ended
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWaveTxStop">gpioWaveTxStop</a></td><td> Aborts the current waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWaveGetCbs">gpioWaveGetCbs</a></td><td> Length in CBs of the current waveform
-</td></tr><tr><td><a href="#gpioWaveGetHighCbs">gpioWaveGetHighCbs</a></td><td> Length of longest waveform so far
-</td></tr><tr><td><a href="#gpioWaveGetMaxCbs">gpioWaveGetMaxCbs</a></td><td> Absolute maximum allowed CBs
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWaveGetMicros">gpioWaveGetMicros</a></td><td> Length in micros of the current waveform
-</td></tr><tr><td><a href="#gpioWaveGetHighMicros">gpioWaveGetHighMicros</a></td><td> Length of longest waveform so far
-</td></tr><tr><td><a href="#gpioWaveGetMaxMicros">gpioWaveGetMaxMicros</a></td><td> Absolute maximum allowed micros
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioWaveGetPulses">gpioWaveGetPulses</a></td><td> Length in pulses of the current waveform
-</td></tr><tr><td><a href="#gpioWaveGetHighPulses">gpioWaveGetHighPulses</a></td><td> Length of longest waveform so far
-</td></tr><tr><td><a href="#gpioWaveGetMaxPulses">gpioWaveGetMaxPulses</a></td><td> Absolute maximum allowed pulses
-</td></tr><tr><td></td><td></td></tr><tr><td><b>UTILITIES
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioDelay">gpioDelay</a></td><td> Delay for a number of microseconds
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioTick">gpioTick</a></td><td> Get current tick (microseconds)
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioHardwareRevision">gpioHardwareRevision</a></td><td> Get hardware revision
-</td></tr><tr><td><a href="#gpioVersion">gpioVersion</a></td><td> Get the pigpio version
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#getBitInBytes">getBitInBytes</a></td><td> Get the value of a bit
-</td></tr><tr><td><a href="#putBitInBytes">putBitInBytes</a></td><td> Set the value of a bit
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioTime">gpioTime</a></td><td> Get current time
-</td></tr><tr><td><a href="#gpioSleep">gpioSleep</a></td><td> Sleep for specified time
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#time_sleep">time_sleep</a></td><td> Sleeps for a float number of seconds
-</td></tr><tr><td><a href="#time_time">time_time</a></td><td> Float number of seconds since the epoch
-</td></tr><tr><td></td><td></td></tr><tr><td><b>CONFIGURATION
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioCfgBufferSize">gpioCfgBufferSize</a></td><td> Configure the GPIO sample buffer size
-</td></tr><tr><td><a href="#gpioCfgClock">gpioCfgClock</a></td><td> Configure the GPIO sample rate
-</td></tr><tr><td><a href="#gpioCfgDMAchannel">gpioCfgDMAchannel</a></td><td> Configure the DMA channel (DEPRECATED)
-</td></tr><tr><td><a href="#gpioCfgDMAchannels">gpioCfgDMAchannels</a></td><td> Configure the DMA channels
-</td></tr><tr><td><a href="#gpioCfgPermissions">gpioCfgPermissions</a></td><td> Configure the GPIO access permissions
-</td></tr><tr><td><a href="#gpioCfgInterfaces">gpioCfgInterfaces</a></td><td> Configure user interfaces
-</td></tr><tr><td><a href="#gpioCfgSocketPort">gpioCfgSocketPort</a></td><td> Configure socket port
-</td></tr><tr><td><a href="#gpioCfgMemAlloc">gpioCfgMemAlloc</a></td><td> Configure DMA memory allocation mode
-</td></tr><tr><td><a href="#gpioCfgNetAddr">gpioCfgNetAddr</a></td><td> Configure allowed network addresses
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpioCfgInternals">gpioCfgInternals</a></td><td> Configure misc. internals (DEPRECATED)
-</td></tr><tr><td><a href="#gpioCfgGetInternals">gpioCfgGetInternals</a></td><td> Get internal configuration settings
-</td></tr><tr><td><a href="#gpioCfgSetInternals">gpioCfgSetInternals</a></td><td> Set internal configuration settings
-</td></tr><tr><td></td><td></td></tr><tr><td><b>EXPERT
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#rawWaveAddSPI">rawWaveAddSPI</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawWaveAddGeneric">rawWaveAddGeneric</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawWaveCB">rawWaveCB</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawWaveCBAdr">rawWaveCBAdr</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawWaveGetOOL">rawWaveGetOOL</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawWaveSetOOL">rawWaveSetOOL</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawWaveGetOut">rawWaveGetOut</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawWaveSetOut">rawWaveSetOut</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawWaveGetIn">rawWaveGetIn</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawWaveSetIn">rawWaveSetIn</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawWaveInfo">rawWaveInfo</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawDumpWave">rawDumpWave</a></td><td> Not intended for general use
-</td></tr><tr><td><a href="#rawDumpScript">rawDumpScript</a></td><td> Not intended for general use
-</td></tr><tr><td></td><td></td></tr></tbody></table><h2>FUNCTIONS</h2><h3><a name="gpioInitialise"></a><a href="#int"><small>int</small></a> gpioInitialise<small>(void)</small></h3>
-Initialises the library.
-<br><br>Returns the pigpio version number if OK, otherwise PI_INIT_FAILED.
-<br><br>gpioInitialise must be called before using the other library functions
-with the following exceptions:
-<br><br><code><a href="#gpioCfg*">gpioCfg*</a><br><a href="#gpioVersion">gpioVersion</a><br><a href="#gpioHardwareRevision">gpioHardwareRevision</a><br></code><br><br><b><small>Example</small></b><br><br><code>if&nbsp;(gpioInitialise()&nbsp;&lt;&nbsp;0)<br>{<br>&nbsp;&nbsp;&nbsp;//&nbsp;pigpio&nbsp;initialisation&nbsp;failed.<br>}<br>else<br>{<br>&nbsp;&nbsp;&nbsp;//&nbsp;pigpio&nbsp;initialised&nbsp;okay.<br>}<br></code><h3><a name="gpioTerminate"></a><a href="#void"><small>void</small></a> gpioTerminate<small>(void)</small></h3>
-Terminates the library.
-<br><br>Returns nothing.
-<br><br>Call before program exit.
-<br><br>This function resets the used DMA channels, releases memory, and
-terminates any running threads.
-<br><br><b><small>Example</small></b><br><br><code>gpioTerminate();<br></code><h3><a name="gpioSetMode"></a><a href="#int"><small>int</small></a> gpioSetMode<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#mode">mode</a>)</small></h3>
-Sets the GPIO mode, typically input or output.
-<br><br><code>gpio:&nbsp;0-53<br>mode:&nbsp;0-7<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO or PI_BAD_MODE.
-<br><br>Arduino style: pinMode.
-<br><br><b><small>Example</small></b><br><br><code>gpioSetMode(17,&nbsp;PI_INPUT);&nbsp;&nbsp;//&nbsp;Set&nbsp;GPIO17&nbsp;as&nbsp;input.<br><br>gpioSetMode(18,&nbsp;PI_OUTPUT);&nbsp;//&nbsp;Set&nbsp;GPIO18&nbsp;as&nbsp;output.<br><br>gpioSetMode(22,PI_ALT0);&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Set&nbsp;GPIO22&nbsp;to&nbsp;alternative&nbsp;mode&nbsp;0.<br></code><br><br>See <a href="http://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2835/BCM2835-ARM-Peripherals.pdf">http://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2835/BCM2835-ARM-Peripherals.pdf</a> page 102 for an overview of the modes.
-<h3><a name="gpioGetMode"></a><a href="#int"><small>int</small></a> gpioGetMode<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>)</small></h3>
-Gets the GPIO mode.
-<br><br><code>gpio:&nbsp;0-53<br></code><br><br>Returns the GPIO mode if OK, otherwise PI_BAD_GPIO.
-<br><br><b><small>Example</small></b><br><br><code>if&nbsp;(gpioGetMode(17)&nbsp;!=&nbsp;PI_ALT0)<br>{<br>&nbsp;&nbsp;&nbsp;gpioSetMode(17,&nbsp;PI_ALT0);&nbsp;&nbsp;//&nbsp;set&nbsp;GPIO17&nbsp;to&nbsp;ALT0<br>}<br></code><h3><a name="gpioSetPullUpDown"></a><a href="#int"><small>int</small></a> gpioSetPullUpDown<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#pud">pud</a>)</small></h3>
-Sets or clears resistor pull ups or downs on the GPIO.
-<br><br><code>gpio:&nbsp;0-53<br>&nbsp;pud:&nbsp;0-2<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO or PI_BAD_PUD.
-<br><br><b><small>Example</small></b><br><br><code>gpioSetPullUpDown(17,&nbsp;PI_PUD_UP);&nbsp;&nbsp;&nbsp;//&nbsp;Sets&nbsp;a&nbsp;pull-up.<br><br>gpioSetPullUpDown(18,&nbsp;PI_PUD_DOWN);&nbsp;//&nbsp;Sets&nbsp;a&nbsp;pull-down.<br><br>gpioSetPullUpDown(23,&nbsp;PI_PUD_OFF);&nbsp;&nbsp;//&nbsp;Clear&nbsp;any&nbsp;pull-ups/downs.<br></code><h3><a name="gpioRead"></a><a href="#int"><small>int</small></a> gpioRead<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>)</small></h3>
-Reads the GPIO level, on or off.
-<br><br><code>gpio:&nbsp;0-53<br></code><br><br>Returns the GPIO level if OK, otherwise PI_BAD_GPIO.
-<br><br>Arduino style: digitalRead.
-<br><br><b><small>Example</small></b><br><br><code>printf("GPIO24&nbsp;is&nbsp;level&nbsp;%d",&nbsp;gpioRead(24));<br></code><h3><a name="gpioWrite"></a><a href="#int"><small>int</small></a> gpioWrite<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#level">level</a>)</small></h3>
-Sets the GPIO level, on or off.
-<br><br><code>&nbsp;gpio:&nbsp;0-53<br>level:&nbsp;0-1<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO or PI_BAD_LEVEL.
-<br><br>If PWM or servo pulses are active on the GPIO they are switched off.
-<br><br>Arduino style: digitalWrite
-<br><br><b><small>Example</small></b><br><br><code>gpioWrite(24,&nbsp;1);&nbsp;//&nbsp;Set&nbsp;GPIO24&nbsp;high.<br></code><h3><a name="gpioPWM"></a><a href="#int"><small>int</small></a> gpioPWM<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#dutycycle">dutycycle</a>)</small></h3>
-Starts PWM on the GPIO, dutycycle between 0 (off) and range (fully on).
-Range defaults to 255.
-<br><br><code>user_gpio:&nbsp;0-31<br>dutycycle:&nbsp;0-range<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_BAD_DUTYCYCLE.
-<br><br>Arduino style: analogWrite
-<br><br>This and the servo functionality use the DMA and PWM or PCM peripherals
-to control and schedule the pulse lengths and dutycycles.
-<br><br>The <a href="#gpioSetPWMrange">gpioSetPWMrange</a> function may be used to change the default
-range of 255.
-<br><br><b><small>Example</small></b><br><br><code>gpioPWM(17,&nbsp;255);&nbsp;//&nbsp;Sets&nbsp;GPIO17&nbsp;full&nbsp;on.<br><br>gpioPWM(18,&nbsp;128);&nbsp;//&nbsp;Sets&nbsp;GPIO18&nbsp;half&nbsp;on.<br><br>gpioPWM(23,&nbsp;0);&nbsp;&nbsp;&nbsp;//&nbsp;Sets&nbsp;GPIO23&nbsp;full&nbsp;off.<br></code><h3><a name="gpioGetPWMdutycycle"></a><a href="#int"><small>int</small></a> gpioGetPWMdutycycle<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Returns the PWM dutycycle setting for the GPIO.
-<br><br><code>user_gpio:&nbsp;0-31<br></code><br><br>Returns between 0 (off) and range (fully on) if OK, otherwise
-PI_BAD_USER_GPIO or PI_NOT_PWM_GPIO.
-<br><br>For normal PWM the dutycycle will be out of the defined range
-for the GPIO (see <a href="#gpioGetPWMrange">gpioGetPWMrange</a>).
-<br><br>If a hardware clock is active on the GPIO the reported dutycycle
-will be 500000 (500k) out of 1000000 (1M).
-<br><br>If hardware PWM is active on the GPIO the reported dutycycle
-will be out of a 1000000 (1M).
-<br><br>Normal PWM range defaults to 255.
-<h3><a name="gpioSetPWMrange"></a><a href="#int"><small>int</small></a> gpioSetPWMrange<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#range">range</a>)</small></h3>
-Selects the dutycycle range to be used for the GPIO. Subsequent calls
-to gpioPWM will use a dutycycle between 0 (off) and range (fully on).
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;range:&nbsp;25-40000<br></code><br><br>Returns the real range for the given GPIO's frequency if OK,
-otherwise PI_BAD_USER_GPIO or PI_BAD_DUTYRANGE.
-<br><br>If PWM is currently active on the GPIO its dutycycle will be scaled
-to reflect the new range.
-<br><br>The real range, the number of steps between fully off and fully
-on for each frequency, is given in the following table.
-<br><br><code>&nbsp;&nbsp;25,&nbsp;&nbsp;&nbsp;50,&nbsp;&nbsp;100,&nbsp;&nbsp;125,&nbsp;&nbsp;200,&nbsp;&nbsp;250,&nbsp;&nbsp;400,&nbsp;&nbsp;&nbsp;500,&nbsp;&nbsp;&nbsp;625,<br>&nbsp;800,&nbsp;1000,&nbsp;1250,&nbsp;2000,&nbsp;2500,&nbsp;4000,&nbsp;5000,&nbsp;10000,&nbsp;20000<br></code><br><br>The real value set by <a href="#gpioPWM">gpioPWM</a> is (dutycycle * real range) / range.
-<br><br><b><small>Example</small></b><br><br><code>gpioSetPWMrange(24,&nbsp;2000);&nbsp;//&nbsp;Now&nbsp;2000&nbsp;is&nbsp;fully&nbsp;on<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1000&nbsp;is&nbsp;half&nbsp;on<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;500&nbsp;is&nbsp;quarter&nbsp;on,&nbsp;etc.<br></code><h3><a name="gpioGetPWMrange"></a><a href="#int"><small>int</small></a> gpioGetPWMrange<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Returns the dutycycle range used for the GPIO if OK, otherwise
-PI_BAD_USER_GPIO.
-<br><br><code>user_gpio:&nbsp;0-31<br></code><br><br>If a hardware clock or hardware PWM is active on the GPIO
-the reported range will be 1000000 (1M).
-<br><br><b><small>Example</small></b><br><br><code>r&nbsp;=&nbsp;gpioGetPWMrange(23);<br></code><h3><a name="gpioGetPWMrealRange"></a><a href="#int"><small>int</small></a> gpioGetPWMrealRange<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Returns the real range used for the GPIO if OK, otherwise
-PI_BAD_USER_GPIO.
-<br><br><code>user_gpio:&nbsp;0-31<br></code><br><br>If a hardware clock is active on the GPIO the reported real
-range will be 1000000 (1M).
-<br><br>If hardware PWM is active on the GPIO the reported real range
-will be approximately 250M divided by the set PWM frequency.
-<br><br><b><small>Example</small></b><br><br><code>rr&nbsp;=&nbsp;gpioGetPWMrealRange(17);<br></code><h3><a name="gpioSetPWMfrequency"></a><a href="#int"><small>int</small></a> gpioSetPWMfrequency<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#frequency">frequency</a>)</small></h3>
-Sets the frequency in hertz to be used for the GPIO.
-<br><br><code>user_gpio:&nbsp;0-31<br>frequency:&nbsp;&gt;=0<br></code><br><br>Returns the numerically closest frequency if OK, otherwise
-PI_BAD_USER_GPIO.
-<br><br>If PWM is currently active on the GPIO it will be
-switched off and then back on at the new frequency.
-<br><br>Each GPIO can be independently set to one of 18 different PWM
-frequencies.
-<br><br>The selectable frequencies depend upon the sample rate which
-may be 1, 2, 4, 5, 8, or 10 microseconds (default 5).
-<br><br>The frequencies for each sample rate are:
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hertz<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1:&nbsp;40000&nbsp;20000&nbsp;10000&nbsp;8000&nbsp;5000&nbsp;4000&nbsp;2500&nbsp;2000&nbsp;1600<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1250&nbsp;&nbsp;1000&nbsp;&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;50<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2:&nbsp;20000&nbsp;10000&nbsp;&nbsp;5000&nbsp;4000&nbsp;2500&nbsp;2000&nbsp;1250&nbsp;1000&nbsp;&nbsp;800<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;625&nbsp;&nbsp;&nbsp;500&nbsp;&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;125&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;25<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4:&nbsp;10000&nbsp;&nbsp;5000&nbsp;&nbsp;2500&nbsp;2000&nbsp;1250&nbsp;1000&nbsp;&nbsp;625&nbsp;&nbsp;500&nbsp;&nbsp;400<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;313&nbsp;&nbsp;&nbsp;250&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;125&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;63&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;13<br>sample<br>&nbsp;rate<br>&nbsp;(us)&nbsp;&nbsp;5:&nbsp;&nbsp;8000&nbsp;&nbsp;4000&nbsp;&nbsp;2000&nbsp;1600&nbsp;1000&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;320<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;250&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;&nbsp;160&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;80&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;&nbsp;20&nbsp;&nbsp;&nbsp;10<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8:&nbsp;&nbsp;5000&nbsp;&nbsp;2500&nbsp;&nbsp;1250&nbsp;1000&nbsp;&nbsp;625&nbsp;&nbsp;500&nbsp;&nbsp;313&nbsp;&nbsp;250&nbsp;&nbsp;200<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;156&nbsp;&nbsp;&nbsp;125&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;63&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;31&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;13&nbsp;&nbsp;&nbsp;&nbsp;6<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10:&nbsp;&nbsp;4000&nbsp;&nbsp;2000&nbsp;&nbsp;1000&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;160<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;125&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;&nbsp;80&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;20&nbsp;&nbsp;&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;5<br></code><br><br><b><small>Example</small></b><br><br><code>gpioSetPWMfrequency(23,&nbsp;0);&nbsp;//&nbsp;Set&nbsp;GPIO23&nbsp;to&nbsp;lowest&nbsp;frequency.<br><br>gpioSetPWMfrequency(24,&nbsp;500);&nbsp;//&nbsp;Set&nbsp;GPIO24&nbsp;to&nbsp;500Hz.<br><br>gpioSetPWMfrequency(25,&nbsp;100000);&nbsp;//&nbsp;Set&nbsp;GPIO25&nbsp;to&nbsp;highest&nbsp;frequency.<br></code><h3><a name="gpioGetPWMfrequency"></a><a href="#int"><small>int</small></a> gpioGetPWMfrequency<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Returns the frequency (in hertz) used for the GPIO if OK, otherwise
-PI_BAD_USER_GPIO.
-<br><br><code>user_gpio:&nbsp;0-31<br></code><br><br>For normal PWM the frequency will be that defined for the GPIO by
-<a href="#gpioSetPWMfrequency">gpioSetPWMfrequency</a>.
-<br><br>If a hardware clock is active on the GPIO the reported frequency
-will be that set by <a href="#gpioHardwareClock">gpioHardwareClock</a>.
-<br><br>If hardware PWM is active on the GPIO the reported frequency
-will be that set by <a href="#gpioHardwarePWM">gpioHardwarePWM</a>.
-<br><br><b><small>Example</small></b><br><br><code>f&nbsp;=&nbsp;gpioGetPWMfrequency(23);&nbsp;//&nbsp;Get&nbsp;frequency&nbsp;used&nbsp;for&nbsp;GPIO23.<br></code><h3><a name="gpioServo"></a><a href="#int"><small>int</small></a> gpioServo<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#pulsewidth">pulsewidth</a>)</small></h3>
-Starts servo pulses on the GPIO, 0 (off), 500 (most anti-clockwise) to
-2500 (most clockwise).
-<br><br><code>&nbsp;user_gpio:&nbsp;0-31<br>pulsewidth:&nbsp;0,&nbsp;500-2500<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_BAD_PULSEWIDTH.
-<br><br>The range supported by servos varies and should probably be determined
-by experiment. A value of 1500 should always be safe and represents
-the mid-point of rotation. You can DAMAGE a servo if you command it
-to move beyond its limits.
-<br><br>The following causes an on pulse of 1500 microseconds duration to be
-transmitted on GPIO 17 at a rate of 50 times per second. This will
-command a servo connected to GPIO 17 to rotate to its mid-point.
-<br><br><b><small>Example</small></b><br><br><code>gpioServo(17,&nbsp;1000);&nbsp;//&nbsp;Move&nbsp;servo&nbsp;to&nbsp;safe&nbsp;position&nbsp;anti-clockwise.<br><br>gpioServo(23,&nbsp;1500);&nbsp;//&nbsp;Move&nbsp;servo&nbsp;to&nbsp;centre&nbsp;position.<br><br>gpioServo(25,&nbsp;2000);&nbsp;//&nbsp;Move&nbsp;servo&nbsp;to&nbsp;safe&nbsp;position&nbsp;clockwise.<br></code><br><br>OTHER UPDATE RATES:
-<br><br>This function updates servos at 50Hz. If you wish to use a different
-update frequency you will have to use the PWM functions.
-<br><br><code>PWM&nbsp;Hz&nbsp;&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;200&nbsp;&nbsp;400&nbsp;&nbsp;500<br>1E6/Hz&nbsp;20000&nbsp;10000&nbsp;5000&nbsp;2500&nbsp;2000<br></code><br><br>Firstly set the desired PWM frequency using <a href="#gpioSetPWMfrequency">gpioSetPWMfrequency</a>.
-<br><br>Then set the PWM range using <a href="#gpioSetPWMrange">gpioSetPWMrange</a> to 1E6/frequency.
-Doing this allows you to use units of microseconds when setting
-the servo pulsewidth.
-<br><br>E.g. If you want to update a servo connected to GPIO25 at 400Hz
-<br><br><code>gpioSetPWMfrequency(25,&nbsp;400);<br><br>gpioSetPWMrange(25,&nbsp;2500);<br></code><br><br>Thereafter use the PWM command to move the servo,
-e.g. gpioPWM(25, 1500) will set a 1500 us pulse.
-<h3><a name="gpioGetServoPulsewidth"></a><a href="#int"><small>int</small></a> gpioGetServoPulsewidth<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Returns the servo pulsewidth setting for the GPIO.
-<br><br><code>user_gpio:&nbsp;0-31<br></code><br><br>Returns 0 (off), 500 (most anti-clockwise) to 2500 (most clockwise)
-if OK, otherwise PI_BAD_USER_GPIO or PI_NOT_SERVO_GPIO.
-<h3><a name="gpioSetAlertFunc"></a><a href="#int"><small>int</small></a> gpioSetAlertFunc<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#gpioAlertFunc_t">gpioAlertFunc_t</a> <a href="#f">f</a>)</small></h3>
-Registers a function to be called (a callback) when the specified
-GPIO changes state.
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO.
-<br><br>One callback may be registered per GPIO.
-<br><br>The callback is passed the GPIO, the new level, and the tick.
-<br><br><code>Parameter&nbsp;&nbsp;&nbsp;Value&nbsp;&nbsp;&nbsp;&nbsp;Meaning<br><br>GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-31&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;GPIO&nbsp;which&nbsp;has&nbsp;changed&nbsp;state<br><br>level&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;=&nbsp;change&nbsp;to&nbsp;low&nbsp;(a&nbsp;falling&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&nbsp;change&nbsp;to&nbsp;high&nbsp;(a&nbsp;rising&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;=&nbsp;no&nbsp;level&nbsp;change&nbsp;(a&nbsp;watchdog&nbsp;timeout)<br><br>tick&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32&nbsp;bit&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;microseconds&nbsp;since&nbsp;boot<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WARNING:&nbsp;this&nbsp;wraps&nbsp;around&nbsp;from<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4294967295&nbsp;to&nbsp;0&nbsp;roughly&nbsp;every&nbsp;72&nbsp;minutes<br></code><br><br>The alert may be cancelled by passing NULL as the function.
-<br><br>The GPIO are sampled at a rate set when the library is started.
-<br><br>If a value isn't specifically set the default of 5 us is used.
-<br><br>The number of samples per second is given in the following table.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;samples<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;per&nbsp;sec<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;1,000,000<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;500,000<br>sample&nbsp;&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;250,000<br>rate&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;200,000<br>(us)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8&nbsp;&nbsp;&nbsp;&nbsp;125,000<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;100,000<br></code><br><br>Level changes shorter than the sample rate may be missed.
-<br><br>The thread which calls the alert functions is triggered nominally
-1000 times per second. The active alert functions will be called
-once per level change since the last time the thread was activated.
-i.e. The active alert functions will get all level changes but there
-will be a latency.
-<br><br>If you want to track the level of more than one GPIO do so by
-maintaining the state in the callback. Do not use <a href="#gpioRead">gpioRead</a>.
-Remember the event that triggered the callback may have
-happened several milliseconds before and the GPIO may have
-changed level many times since then.
-<br><br>The tick value is the time stamp of the sample in microseconds, see
-<a href="#gpioTick">gpioTick</a> for more details.
-<br><br><b><small>Example</small></b><br><br><code>void&nbsp;aFunction(int&nbsp;gpio,&nbsp;int&nbsp;level,&nbsp;uint32_t&nbsp;tick)<br>{<br>&nbsp;&nbsp;&nbsp;printf("GPIO&nbsp;%d&nbsp;became&nbsp;%d&nbsp;at&nbsp;%d",&nbsp;gpio,&nbsp;level,&nbsp;tick);<br>}<br><br>//&nbsp;call&nbsp;aFunction&nbsp;whenever&nbsp;GPIO&nbsp;4&nbsp;changes&nbsp;state<br><br>gpioSetAlertFunc(4,&nbsp;aFunction);<br></code><h3><a name="gpioSetAlertFuncEx"></a><a href="#int"><small>int</small></a> gpioSetAlertFuncEx<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#gpioAlertFuncEx_t">gpioAlertFuncEx_t</a> <a href="#f">f</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-Registers a function to be called (a callback) when the specified
-GPIO changes state.
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function<br>&nbsp;userdata:&nbsp;pointer&nbsp;to&nbsp;arbitrary&nbsp;user&nbsp;data<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO.
-<br><br>One callback may be registered per GPIO.
-<br><br>The callback is passed the GPIO, the new level, the tick, and
-the userdata pointer.
-<br><br><code>Parameter&nbsp;&nbsp;&nbsp;Value&nbsp;&nbsp;&nbsp;&nbsp;Meaning<br><br>GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-31&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;GPIO&nbsp;which&nbsp;has&nbsp;changed&nbsp;state<br><br>level&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;=&nbsp;change&nbsp;to&nbsp;low&nbsp;(a&nbsp;falling&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&nbsp;change&nbsp;to&nbsp;high&nbsp;(a&nbsp;rising&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;=&nbsp;no&nbsp;level&nbsp;change&nbsp;(a&nbsp;watchdog&nbsp;timeout)<br><br>tick&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32&nbsp;bit&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;microseconds&nbsp;since&nbsp;boot<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WARNING:&nbsp;this&nbsp;wraps&nbsp;around&nbsp;from<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4294967295&nbsp;to&nbsp;0&nbsp;roughly&nbsp;every&nbsp;72&nbsp;minutes<br><br>userdata&nbsp;&nbsp;&nbsp;&nbsp;pointer&nbsp;&nbsp;Pointer&nbsp;to&nbsp;an&nbsp;arbitrary&nbsp;object<br></code><br><br>See <a href="#gpioSetAlertFunc">gpioSetAlertFunc</a> for further details.
-<br><br>Only one of <a href="#gpioSetAlertFunc">gpioSetAlertFunc</a> or <a href="#gpioSetAlertFuncEx">gpioSetAlertFuncEx</a> can be
-registered per GPIO.
-<h3><a name="gpioSetISRFunc"></a><a href="#int"><small>int</small></a> gpioSetISRFunc<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#edge">edge</a>, <a href="#int">int</a> <a href="#timeout">timeout</a>, <a href="#gpioISRFunc_t">gpioISRFunc_t</a> <a href="#f">f</a>)</small></h3>
-Registers a function to be called (a callback) whenever the specified
-GPIO interrupt occurs.
-<br><br><code>&nbsp;&nbsp;&nbsp;gpio:&nbsp;0-53<br>&nbsp;&nbsp;&nbsp;edge:&nbsp;RISING_EDGE,&nbsp;FALLING_EDGE,&nbsp;or&nbsp;EITHER_EDGE<br>timeout:&nbsp;interrupt&nbsp;timeout&nbsp;in&nbsp;milliseconds&nbsp;(&lt;=0&nbsp;to&nbsp;cancel)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_EDGE,
-or PI_BAD_ISR_INIT.
-<br><br>One function may be registered per GPIO.
-<br><br>The function is passed the GPIO, the current level, and the
-current tick. The level will be PI_TIMEOUT if the optional
-interrupt timeout expires.
-<br><br><code>Parameter&nbsp;&nbsp;&nbsp;Value&nbsp;&nbsp;&nbsp;&nbsp;Meaning<br><br>GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-53&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;GPIO&nbsp;which&nbsp;has&nbsp;changed&nbsp;state<br><br>level&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;=&nbsp;change&nbsp;to&nbsp;low&nbsp;(a&nbsp;falling&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&nbsp;change&nbsp;to&nbsp;high&nbsp;(a&nbsp;rising&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;=&nbsp;no&nbsp;level&nbsp;change&nbsp;(interrupt&nbsp;timeout)<br><br>tick&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32&nbsp;bit&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;microseconds&nbsp;since&nbsp;boot<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WARNING:&nbsp;this&nbsp;wraps&nbsp;around&nbsp;from<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4294967295&nbsp;to&nbsp;0&nbsp;roughly&nbsp;every&nbsp;72&nbsp;minutes<br></code><br><br>The underlying Linux sysfs GPIO interface is used to provide
-the interrupt services.
-<br><br>The first time the function is called, with a non-NULL f, the
-GPIO is exported, set to be an input, and set to interrupt
-on the given edge and timeout.
-<br><br>Subsequent calls, with a non-NULL f, can vary one or more of the
-edge, timeout, or function.
-<br><br>The ISR may be cancelled by passing a NULL f, in which case the
-GPIO is unexported.
-<br><br>The tick is that read at the time the process was informed of
-the interrupt. This will be a variable number of microseconds
-after the interrupt occurred. Typically the latency will be of
-the order of 50 microseconds. The latency is not guaranteed
-and will vary with system load.
-<br><br>The level is that read at the time the process was informed of
-the interrupt, or PI_TIMEOUT if the optional interrupt timeout
-expired. It may not be the same as the expected edge as
-interrupts happening in rapid succession may be missed by the
-kernel (i.e. this mechanism can not be used to capture several
-interrupts only a few microseconds apart).
-<h3><a name="gpioSetISRFuncEx"></a><a href="#int"><small>int</small></a> gpioSetISRFuncEx<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#edge">edge</a>, <a href="#int">int</a> <a href="#timeout">timeout</a>, <a href="#gpioISRFuncEx_t">gpioISRFuncEx_t</a> <a href="#f">f</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-Registers a function to be called (a callback) whenever the specified
-GPIO interrupt occurs.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;gpio:&nbsp;0-53<br>&nbsp;&nbsp;&nbsp;&nbsp;edge:&nbsp;RISING_EDGE,&nbsp;FALLING_EDGE,&nbsp;or&nbsp;EITHER_EDGE<br>&nbsp;timeout:&nbsp;interrupt&nbsp;timeout&nbsp;in&nbsp;milliseconds&nbsp;(&lt;=0&nbsp;to&nbsp;cancel)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function<br>userdata:&nbsp;pointer&nbsp;to&nbsp;arbitrary&nbsp;user&nbsp;data<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_EDGE,
-or PI_BAD_ISR_INIT.
-<br><br>The function is passed the GPIO, the current level, the
-current tick, and the userdata pointer.
-<br><br><code>Parameter&nbsp;&nbsp;&nbsp;Value&nbsp;&nbsp;&nbsp;&nbsp;Meaning<br><br>GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-53&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;GPIO&nbsp;which&nbsp;has&nbsp;changed&nbsp;state<br><br>level&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;=&nbsp;change&nbsp;to&nbsp;low&nbsp;(a&nbsp;falling&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&nbsp;change&nbsp;to&nbsp;high&nbsp;(a&nbsp;rising&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;=&nbsp;no&nbsp;level&nbsp;change&nbsp;(interrupt&nbsp;timeout)<br><br>tick&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32&nbsp;bit&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;microseconds&nbsp;since&nbsp;boot<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WARNING:&nbsp;this&nbsp;wraps&nbsp;around&nbsp;from<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4294967295&nbsp;to&nbsp;0&nbsp;roughly&nbsp;every&nbsp;72&nbsp;minutes<br><br>userdata&nbsp;&nbsp;&nbsp;&nbsp;pointer&nbsp;&nbsp;Pointer&nbsp;to&nbsp;an&nbsp;arbitrary&nbsp;object<br></code><br><br>Only one of <a href="#gpioSetISRFunc">gpioSetISRFunc</a> or <a href="#gpioSetISRFuncEx">gpioSetISRFuncEx</a> can be
-registered per GPIO.
-<br><br>See <a href="#gpioSetISRFunc">gpioSetISRFunc</a> for further details.
-<h3><a name="gpioNotifyOpen"></a><a href="#int"><small>int</small></a> gpioNotifyOpen<small>(void)</small></h3>
-This function requests a free notification handle.
-<br><br>Returns a handle greater than or equal to zero if OK,
-otherwise PI_NO_HANDLE.
-<br><br>A notification is a method for being notified of GPIO state changes
-via a pipe or socket.
-<br><br>Pipe notifications for handle x will be available at the pipe
-named /dev/pigpiox (where x is the handle number). E.g. if the
-function returns 15 then the notifications must be read
-from /dev/pigpio15.
-<br><br>Socket notifications are returned to the socket which requested the
-handle.
-<br><br><b><small>Example</small></b><br><br><code>h&nbsp;=&nbsp;gpioNotifyOpen();<br><br>if&nbsp;(h&nbsp;&gt;=&nbsp;0)<br>{<br>&nbsp;&nbsp;&nbsp;sprintf(str,&nbsp;"/dev/pigpio%d",&nbsp;h);<br><br>&nbsp;&nbsp;&nbsp;fd&nbsp;=&nbsp;open(str,&nbsp;O_RDONLY);<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(fd&nbsp;&gt;=&nbsp;0)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Okay.<br>&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;else<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Error.<br>&nbsp;&nbsp;&nbsp;}<br>}<br>else<br>{<br>&nbsp;&nbsp;&nbsp;//&nbsp;Error.<br>}<br></code><h3><a name="gpioNotifyOpenWithSize"></a><a href="#int"><small>int</small></a> gpioNotifyOpenWithSize<small>(<a href="#int">int</a> <a href="#bufSize">bufSize</a>)</small></h3>
-This function requests a free notification handle.
-<br><br>It differs from <a href="#gpioNotifyOpen">gpioNotifyOpen</a> in that the pipe size may be
-specified, whereas <a href="#gpioNotifyOpen">gpioNotifyOpen</a> uses the default pipe size.
-<br><br>See <a href="#gpioNotifyOpen">gpioNotifyOpen</a> for further details.
-<h3><a name="gpioNotifyBegin"></a><a href="#int"><small>int</small></a> gpioNotifyBegin<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-This function starts notifications on a previously opened handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioNotifyOpen">gpioNotifyOpen</a><br>&nbsp;&nbsp;bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;indicating&nbsp;the&nbsp;GPIO&nbsp;of&nbsp;interest<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<br><br>The notification sends state changes for each GPIO whose corresponding
-bit in bits is set.
-<br><br>Each notification occupies 12 bytes in the fifo and has the
-following structure.
-<br><br><code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;seqno;<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;flags;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;tick;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;level;<br>}&nbsp;gpioReport_t;<br></code><br><br>seqno: starts at 0 each time the handle is opened and then increments
-by one for each report.
-<br><br>flags: three flags are defined, PI_NTFY_FLAGS_WDOG,
-PI_NTFY_FLAGS_ALIVE, and PI_NTFY_FLAGS_EVENT.
-<br><br>If bit 5 is set (PI_NTFY_FLAGS_WDOG) then bits 0-4 of the flags
-indicate a GPIO which has had a watchdog timeout.
-<br><br>If bit 6 is set (PI_NTFY_FLAGS_ALIVE) this indicates a keep alive
-signal on the pipe/socket and is sent once a minute in the absence
-of other notification activity.
-<br><br>If bit 7 is set (PI_NTFY_FLAGS_EVENT) then bits 0-4 of the flags
-indicate an event which has been triggered.
-<br><br>tick: the number of microseconds since system boot. It wraps around
-after 1h12m.
-<br><br>level: indicates the level of each GPIO. If bit 1&lt;&lt;x is set then
-GPIO x is high.
-<br><br><b><small>Example</small></b><br><br><code>//&nbsp;Start&nbsp;notifications&nbsp;for&nbsp;GPIO&nbsp;1,&nbsp;4,&nbsp;6,&nbsp;7,&nbsp;10.<br><br>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1<br>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;76&nbsp;4&nbsp;&nbsp;1<br>//&nbsp;(1234&nbsp;=&nbsp;0x04D2&nbsp;=&nbsp;0b0000010011010010)<br><br>gpioNotifyBegin(h,&nbsp;1234);<br></code><h3><a name="gpioNotifyPause"></a><a href="#int"><small>int</small></a> gpioNotifyPause<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This function pauses notifications on a previously opened handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioNotifyOpen">gpioNotifyOpen</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<br><br>Notifications for the handle are suspended until <a href="#gpioNotifyBegin">gpioNotifyBegin</a>
-is called again.
-<br><br><b><small>Example</small></b><br><br><code>gpioNotifyPause(h);<br></code><h3><a name="gpioNotifyClose"></a><a href="#int"><small>int</small></a> gpioNotifyClose<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This function stops notifications on a previously opened handle
-and releases the handle for reuse.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioNotifyOpen">gpioNotifyOpen</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<br><br><b><small>Example</small></b><br><br><code>gpioNotifyClose(h);<br></code><h3><a name="gpioWaveClear"></a><a href="#int"><small>int</small></a> gpioWaveClear<small>(void)</small></h3>
-This function clears all waveforms and any data added by calls to the
-<a href="#gpioWaveAdd*">gpioWaveAdd*</a> functions.
-<br><br>Returns 0 if OK.
-<br><br><b><small>Example</small></b><br><br><code>gpioWaveClear();<br></code><h3><a name="gpioWaveAddNew"></a><a href="#int"><small>int</small></a> gpioWaveAddNew<small>(void)</small></h3>
-This function starts a new empty waveform.
-<br><br>You wouldn't normally need to call this function as it is automatically
-called after a waveform is created with the <a href="#gpioWaveCreate">gpioWaveCreate</a> function.
-<br><br>Returns 0 if OK.
-<br><br><b><small>Example</small></b><br><br><code>gpioWaveAddNew();<br></code><h3><a name="gpioWaveAddGeneric"></a><a href="#int"><small>int</small></a> gpioWaveAddGeneric<small>(<a href="#unsigned">unsigned</a> <a href="#numPulses">numPulses</a>, <a href="#gpioPulse_t">gpioPulse_t</a> <a href="#*pulses">*pulses</a>)</small></h3>
-This function adds a number of pulses to the current waveform.
-<br><br><code>numPulses:&nbsp;the&nbsp;number&nbsp;of&nbsp;pulses<br>&nbsp;&nbsp;&nbsp;pulses:&nbsp;an&nbsp;array&nbsp;of&nbsp;pulses<br></code><br><br>Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_TOO_MANY_PULSES.
-<br><br>The pulses are interleaved in time order within the existing waveform
-(if any).
-<br><br>Merging allows the waveform to be built in parts, that is the settings
-for GPIO#1 can be added, and then GPIO#2 etc.
-<br><br>If the added waveform is intended to start after or within the existing
-waveform then the first pulse should consist of a delay.
-<br><br><b><small>Example</small></b><br><br><code>//&nbsp;Construct&nbsp;and&nbsp;send&nbsp;a&nbsp;30&nbsp;microsecond&nbsp;square&nbsp;wave.<br><br>gpioSetMode(gpio,&nbsp;PI_OUTPUT);<br><br>pulse[0].gpioOn&nbsp;=&nbsp;(1&lt;&lt;gpio);<br>pulse[0].gpioOff&nbsp;=&nbsp;0;<br>pulse[0].usDelay&nbsp;=&nbsp;15;<br><br>pulse[1].gpioOn&nbsp;=&nbsp;0;<br>pulse[1].gpioOff&nbsp;=&nbsp;(1&lt;&lt;gpio);<br>pulse[1].usDelay&nbsp;=&nbsp;15;<br><br>gpioWaveAddNew();<br><br>gpioWaveAddGeneric(2,&nbsp;pulse);<br><br>wave_id&nbsp;=&nbsp;gpioWaveCreate();<br><br>if&nbsp;(wave_id&nbsp;&gt;=&nbsp;0)<br>{<br>&nbsp;&nbsp;&nbsp;gpioWaveTxSend(wave_id,&nbsp;PI_WAVE_MODE_REPEAT);<br><br>&nbsp;&nbsp;&nbsp;//&nbsp;Transmit&nbsp;for&nbsp;30&nbsp;seconds.<br><br>&nbsp;&nbsp;&nbsp;sleep(30);<br><br>&nbsp;&nbsp;&nbsp;gpioWaveTxStop();<br>}<br>else<br>{<br>&nbsp;&nbsp;&nbsp;//&nbsp;Wave&nbsp;create&nbsp;failed.<br>}<br></code><h3><a name="gpioWaveAddSerial"></a><a href="#int"><small>int</small></a> gpioWaveAddSerial<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#data_bits">data_bits</a>, <a href="#unsigned">unsigned</a> <a href="#stop_bits">stop_bits</a>, <a href="#unsigned">unsigned</a> <a href="#offset">offset</a>, <a href="#unsigned">unsigned</a> <a href="#numBytes">numBytes</a>, <a href="#char">char</a> <a href="#*str">*str</a>)</small></h3>
-This function adds a waveform representing serial data to the
-existing waveform (if any). The serial data starts offset
-microseconds from the start of the waveform.
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;50-1000000<br>data_bits:&nbsp;1-32<br>stop_bits:&nbsp;2-8<br>&nbsp;&nbsp;&nbsp;offset:&nbsp;&gt;=0<br>&nbsp;numBytes:&nbsp;&gt;=1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str:&nbsp;an&nbsp;array&nbsp;of&nbsp;chars&nbsp;(which&nbsp;may&nbsp;contain&nbsp;nulls)<br></code><br><br>Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_BAD_USER_GPIO, PI_BAD_WAVE_BAUD, PI_BAD_DATABITS,
-PI_BAD_STOPBITS, PI_TOO_MANY_CHARS, PI_BAD_SER_OFFSET,
-or PI_TOO_MANY_PULSES.
-<br><br>NOTES:
-<br><br>The serial data is formatted as one start bit, data_bits data bits, and
-stop_bits/2 stop bits.
-<br><br>It is legal to add serial data streams with different baud rates to
-the same waveform.
-<br><br>numBytes is the number of bytes of data in str.
-<br><br>The bytes required for each character depend upon data_bits.
-<br><br>For data_bits 1-8 there will be one byte per character.<br>
-For data_bits 9-16 there will be two bytes per character.<br>
-For data_bits 17-32 there will be four bytes per character.
-<br><br><b><small>Example</small></b><br><br><code>#define&nbsp;MSG_LEN&nbsp;8<br><br>int&nbsp;i;<br>char&nbsp;*str;<br>char&nbsp;data[MSG_LEN];<br><br>str&nbsp;=&nbsp;"Hello&nbsp;world!";<br><br>gpioWaveAddSerial(4,&nbsp;9600,&nbsp;8,&nbsp;2,&nbsp;0,&nbsp;strlen(str),&nbsp;str);<br><br>for&nbsp;(i=0;&nbsp;i&lt;MSG_LEN;&nbsp;i++)&nbsp;data[i]&nbsp;=&nbsp;i;<br><br>//&nbsp;Data&nbsp;added&nbsp;is&nbsp;offset&nbsp;1&nbsp;second&nbsp;from&nbsp;the&nbsp;waveform&nbsp;start.<br>gpioWaveAddSerial(4,&nbsp;9600,&nbsp;8,&nbsp;2,&nbsp;1000000,&nbsp;MSG_LEN,&nbsp;data);<br></code><h3><a name="gpioWaveCreate"></a><a href="#int"><small>int</small></a> gpioWaveCreate<small>(void)</small></h3>
-This function creates a waveform from the data provided by the prior
-calls to the <a href="#gpioWaveAdd*">gpioWaveAdd*</a> functions. Upon success a wave id
-greater than or equal to 0 is returned, otherwise PI_EMPTY_WAVEFORM,
-PI_TOO_MANY_CBS, PI_TOO_MANY_OOL, or PI_NO_WAVEFORM_ID.
-<br><br>The data provided by the <a href="#gpioWaveAdd*">gpioWaveAdd*</a> functions is consumed by this
-function.
-<br><br>As many waveforms may be created as there is space available. The
-wave id is passed to <a href="#gpioWaveTxSend">gpioWaveTxSend</a> to specify the waveform to transmit.
-<br><br>Normal usage would be
-<br><br>Step 1. <a href="#gpioWaveClear">gpioWaveClear</a> to clear all waveforms and added data.
-<br><br>Step 2. <a href="#gpioWaveAdd*">gpioWaveAdd*</a> calls to supply the waveform data.
-<br><br>Step 3. <a href="#gpioWaveCreate">gpioWaveCreate</a> to create the waveform and get a unique id
-<br><br>Repeat steps 2 and 3 as needed.
-<br><br>Step 4. <a href="#gpioWaveTxSend">gpioWaveTxSend</a> with the id of the waveform to transmit.
-<br><br>A waveform comprises one of more pulses. Each pulse consists of a
-<a href="#gpioPulse_t">gpioPulse_t</a> structure.
-<br><br><code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOn;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOff;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;usDelay;<br>}&nbsp;gpioPulse_t;<br></code><br><br>The fields specify
-<br><br>1) the GPIO to be switched on at the start of the pulse.<br>
-2) the GPIO to be switched off at the start of the pulse.<br>
-3) the delay in microseconds before the next pulse.
-<br><br>Any or all the fields can be zero. It doesn't make any sense to
-set all the fields to zero (the pulse will be ignored).
-<br><br>When a waveform is started each pulse is executed in order with the
-specified delay between the pulse and the next.
-<br><br>Returns the new waveform id if OK, otherwise PI_EMPTY_WAVEFORM,
-PI_NO_WAVEFORM_ID, PI_TOO_MANY_CBS, or PI_TOO_MANY_OOL.
-<h3><a name="gpioWaveCreatePad"></a><a href="#int"><small>int</small></a> gpioWaveCreatePad<small>(<a href="#int">int</a> <a href="#pctCB">pctCB</a>, <a href="#int">int</a> <a href="#pctBOOL">pctBOOL</a>, <a href="#int">int</a> <a href="#pctTOOL">pctTOOL</a>)</small></h3>
-Similar to <a href="#gpioWaveCreate">gpioWaveCreate</a>, this function creates a waveform but pads the consumed
-resources. Padded waves of equal dimension can be re-cycled efficiently allowing
-newly created waves to re-use the resources of deleted waves of the same dimension.
-<br><br><code>pctCB:&nbsp;0-100,&nbsp;the&nbsp;percent&nbsp;of&nbsp;all&nbsp;DMA&nbsp;control&nbsp;blocks&nbsp;to&nbsp;consume.<br>pctBOOL:&nbsp;0-100,&nbsp;percent&nbsp;On-Off-Level&nbsp;(OOL)&nbsp;buffer&nbsp;to&nbsp;consume&nbsp;for&nbsp;wave&nbsp;output.<br>pctTOOL:&nbsp;0-100,&nbsp;the&nbsp;percent&nbsp;of&nbsp;OOL&nbsp;buffer&nbsp;to&nbsp;consume&nbsp;for&nbsp;wave&nbsp;input&nbsp;(flags).<br></code><br><br>Upon success a wave id greater than or equal to 0 is returned, otherwise
-PI_EMPTY_WAVEFORM, PI_TOO_MANY_CBS, PI_TOO_MANY_OOL, or PI_NO_WAVEFORM_ID.
-<br><br>Waveform data provided by <a href="#gpioWaveAdd*">gpioWaveAdd*</a> and <a href="#rawWaveAdd*">rawWaveAdd*</a> functions are
-consumed by this function.
-<br><br>A usage would be the creation of two waves where one is filled while the other
-is being transmitted. Each wave is assigned 50% of the resources.
-This buffer structure allows the transmission of infinite wave sequences.
-<br><br><b><small>Example</small></b><br><br><code>&nbsp;&nbsp;//&nbsp;get&nbsp;firstWaveChunk,&nbsp;somehow<br>&nbsp;&nbsp;gpioWaveAddGeneric(firstWaveChunk);<br>&nbsp;&nbsp;wid&nbsp;=&nbsp;gpioWaveCreatePad(50,&nbsp;50,&nbsp;0);<br>&nbsp;&nbsp;gpioWaveTxSend(wid,&nbsp;PI_WAVE_MODE_ONE_SHOT);<br>&nbsp;&nbsp;//&nbsp;get&nbsp;nextWaveChunk<br><br>&nbsp;&nbsp;while&nbsp;(nextWaveChunk)&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gpioWaveAddGeneric(nextWaveChunk);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nextWid&nbsp;=&nbsp;gpioWaveCreatePad(50,&nbsp;50,&nbsp;0);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gpioWaveTxSend(nextWid,&nbsp;PI_WAVE_MODE_ONE_SHOT_SYNC);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while(gpioWaveTxAt()&nbsp;==&nbsp;wid)&nbsp;time_sleep(0.1);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gpioWaveDelete(wid);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid&nbsp;=&nbsp;nextWid;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;get&nbsp;nextWaveChunk<br>&nbsp;&nbsp;}<br></code><h3><a name="gpioWaveDelete"></a><a href="#int"><small>int</small></a> gpioWaveDelete<small>(<a href="#unsigned">unsigned</a> <a href="#wave_id">wave_id</a>)</small></h3>
-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><code>wave_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioWaveCreate">gpioWaveCreate</a><br></code><br><br>Wave ids are allocated in order, 0, 1, 2, etc.
-<br><br>Returns 0 if OK, otherwise PI_BAD_WAVE_ID.
-<h3><a name="gpioWaveTxSend"></a><a href="#int"><small>int</small></a> gpioWaveTxSend<small>(<a href="#unsigned">unsigned</a> <a href="#wave_id">wave_id</a>, <a href="#unsigned">unsigned</a> <a href="#wave_mode">wave_mode</a>)</small></h3>
-This function transmits the waveform with id wave_id. The mode
-determines whether the waveform is sent once or cycles endlessly.
-The SYNC variants wait for the current waveform to reach the
-end of a cycle or finish before starting the new waveform.
-<br><br>WARNING: bad things may happen if you delete the previous
-waveform before it has been synced to the new waveform.
-<br><br>NOTE: Any hardware PWM started by <a href="#gpioHardwarePWM">gpioHardwarePWM</a> will be cancelled.
-<br><br><code>&nbsp;&nbsp;wave_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioWaveCreate">gpioWaveCreate</a><br>wave_mode:&nbsp;PI_WAVE_MODE_ONE_SHOT,&nbsp;PI_WAVE_MODE_REPEAT,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PI_WAVE_MODE_ONE_SHOT_SYNC,&nbsp;PI_WAVE_MODE_REPEAT_SYNC<br></code><br><br>Returns the number of DMA control blocks in the waveform if OK,
-otherwise PI_BAD_WAVE_ID, or PI_BAD_WAVE_MODE.
-<h3><a name="gpioWaveChain"></a><a href="#int"><small>int</small></a> gpioWaveChain<small>(<a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#bufSize">bufSize</a>)</small></h3>
-This function transmits a chain of waveforms.
-<br><br>NOTE: Any hardware PWM started by <a href="#gpioHardwarePWM">gpioHardwarePWM</a> will be cancelled.
-<br><br>The waves to be transmitted are specified by the contents of buf
-which contains an ordered list of <a href="#wave_id">wave_id</a>s and optional command
-codes and related data.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;pointer&nbsp;to&nbsp;the&nbsp;wave_ids&nbsp;and&nbsp;optional&nbsp;command&nbsp;codes<br>bufSize:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;in&nbsp;buf<br></code><br><br>Returns 0 if OK, otherwise PI_CHAIN_NESTING, PI_CHAIN_LOOP_CNT, PI_BAD_CHAIN_LOOP, PI_BAD_CHAIN_CMD, PI_CHAIN_COUNTER,
-PI_BAD_CHAIN_DELAY, PI_CHAIN_TOO_BIG, or PI_BAD_WAVE_ID.
-<br><br>Each wave is transmitted in the order specified. A wave may
-occur multiple times per chain.
-<br><br>A blocks of waves may be transmitted multiple times by using
-the loop commands. The block is bracketed by loop start and
-end commands. Loops may be nested.
-<br><br>Delays between waves may be added with the delay command.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>Loop Start</td><td>255 0</td><td>Identify start of a wave block</td></tr><tr><td>Loop Repeat</td><td>255 1 x y</td><td>loop x + y*256 times</td></tr><tr><td>Delay</td><td>255 2 x y</td><td>delay x + y*256 microseconds</td></tr><tr><td>Loop Forever</td><td>255 3</td><td>loop forever</td></tr></tbody></table><br><br>If present Loop Forever must be the last entry in the chain.
-<br><br>The code is currently dimensioned to support a chain with roughly
-600 entries and 20 loop counters.
-<br><br><b><small>Example</small></b><br><br><code>#include&nbsp;&lt;stdio.h&gt;<br>#include&nbsp;&lt;pigpio.h&gt;<br><br>#define&nbsp;WAVES&nbsp;5<br>#define&nbsp;GPIO&nbsp;4<br><br>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;*argv[])<br>{<br>&nbsp;&nbsp;&nbsp;int&nbsp;i,&nbsp;wid[WAVES];<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(gpioInitialise()&lt;0)&nbsp;return&nbsp;-1;<br><br>&nbsp;&nbsp;&nbsp;gpioSetMode(GPIO,&nbsp;PI_OUTPUT);<br><br>&nbsp;&nbsp;&nbsp;printf("start&nbsp;piscope,&nbsp;press&nbsp;return");&nbsp;getchar();<br><br>&nbsp;&nbsp;&nbsp;for&nbsp;(i=0;&nbsp;i&lt;WAVES;&nbsp;i++)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gpioWaveAddGeneric(2,&nbsp;(gpioPulse_t[])<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{1&lt;&lt;GPIO,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;20},<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{0,&nbsp;1&lt;&lt;GPIO,&nbsp;(i+1)*200}});<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[i]&nbsp;=&nbsp;gpioWaveCreate();<br>&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;gpioWaveChain((char&nbsp;[])&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[4],&nbsp;wid[3],&nbsp;wid[2],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;4+3+2<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[0],&nbsp;wid[0],&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;0+0+0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[1],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;0+1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;2,&nbsp;0x88,&nbsp;0x13,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;delay&nbsp;5000us<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;30,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;30&nbsp;times)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[2],&nbsp;wid[3],&nbsp;wid[0],&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;2+3+0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[3],&nbsp;wid[1],&nbsp;wid[2],&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;3+1+2<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;10,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;10&nbsp;times)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;5,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;5&nbsp;times)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[4],&nbsp;wid[4],&nbsp;wid[4],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;4+4+4<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;2,&nbsp;0x20,&nbsp;0x4E,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;delay&nbsp;20000us<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[0],&nbsp;wid[0],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;0+0+0<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},&nbsp;46);<br><br>&nbsp;&nbsp;&nbsp;while&nbsp;(gpioWaveTxBusy())&nbsp;time_sleep(0.1);<br><br>&nbsp;&nbsp;&nbsp;for&nbsp;(i=0;&nbsp;i&lt;WAVES;&nbsp;i++)&nbsp;gpioWaveDelete(wid[i]);<br><br>&nbsp;&nbsp;&nbsp;printf("stop&nbsp;piscope,&nbsp;press&nbsp;return");&nbsp;getchar();<br><br>&nbsp;&nbsp;&nbsp;gpioTerminate();<br>}<br></code><h3><a name="gpioWaveTxAt"></a><a href="#int"><small>int</small></a> gpioWaveTxAt<small>(void)</small></h3>
-This function returns the id of the waveform currently being
-transmitted.
-<br><br>Returns the waveform id or one of the following special values:
-<br><br>PI_WAVE_NOT_FOUND (9998) - transmitted wave not found.<br>
-PI_NO_TX_WAVE (9999) - no wave being transmitted.
-<h3><a name="gpioWaveTxBusy"></a><a href="#int"><small>int</small></a> gpioWaveTxBusy<small>(void)</small></h3>
-This function checks to see if a waveform is currently being
-transmitted.
-<br><br>Returns 1 if a waveform is currently being transmitted, otherwise 0.
-<h3><a name="gpioWaveTxStop"></a><a href="#int"><small>int</small></a> gpioWaveTxStop<small>(void)</small></h3>
-This function aborts the transmission of the current waveform.
-<br><br>Returns 0 if OK.
-<br><br>This function is intended to stop a waveform started in repeat mode.
-<h3><a name="gpioWaveGetMicros"></a><a href="#int"><small>int</small></a> gpioWaveGetMicros<small>(void)</small></h3>
-This function returns the length in microseconds of the current
-waveform.
-<h3><a name="gpioWaveGetHighMicros"></a><a href="#int"><small>int</small></a> gpioWaveGetHighMicros<small>(void)</small></h3>
-This function returns the length in microseconds of the longest waveform
-created since <a href="#gpioInitialise">gpioInitialise</a> was called.
-<h3><a name="gpioWaveGetMaxMicros"></a><a href="#int"><small>int</small></a> gpioWaveGetMaxMicros<small>(void)</small></h3>
-This function returns the maximum possible size of a waveform in
-microseconds.
-<h3><a name="gpioWaveGetPulses"></a><a href="#int"><small>int</small></a> gpioWaveGetPulses<small>(void)</small></h3>
-This function returns the length in pulses of the current waveform.
-<h3><a name="gpioWaveGetHighPulses"></a><a href="#int"><small>int</small></a> gpioWaveGetHighPulses<small>(void)</small></h3>
-This function returns the length in pulses of the longest waveform
-created since <a href="#gpioInitialise">gpioInitialise</a> was called.
-<h3><a name="gpioWaveGetMaxPulses"></a><a href="#int"><small>int</small></a> gpioWaveGetMaxPulses<small>(void)</small></h3>
-This function returns the maximum possible size of a waveform in pulses.
-<h3><a name="gpioWaveGetCbs"></a><a href="#int"><small>int</small></a> gpioWaveGetCbs<small>(void)</small></h3>
-This function returns the length in DMA control blocks of the current
-waveform.
-<h3><a name="gpioWaveGetHighCbs"></a><a href="#int"><small>int</small></a> gpioWaveGetHighCbs<small>(void)</small></h3>
-This function returns the length in DMA control blocks of the longest
-waveform created since <a href="#gpioInitialise">gpioInitialise</a> was called.
-<h3><a name="gpioWaveGetMaxCbs"></a><a href="#int"><small>int</small></a> gpioWaveGetMaxCbs<small>(void)</small></h3>
-This function returns the maximum possible size of a waveform in DMA
-control blocks.
-<h3><a name="gpioSerialReadOpen"></a><a href="#int"><small>int</small></a> gpioSerialReadOpen<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#data_bits">data_bits</a>)</small></h3>
-This function opens a GPIO for bit bang reading of serial data.
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;50-250000<br>data_bits:&nbsp;1-32<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_WAVE_BAUD,
-PI_BAD_DATABITS, or PI_GPIO_IN_USE.
-<br><br>The serial data is returned in a cyclic buffer and is read using
-<a href="#gpioSerialRead">gpioSerialRead</a>.
-<br><br>It is the caller's responsibility to read data from the cyclic buffer
-in a timely fashion.
-<h3><a name="gpioSerialReadInvert"></a><a href="#int"><small>int</small></a> gpioSerialReadInvert<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#invert">invert</a>)</small></h3>
-This function configures the level logic for bit bang serial reads.
-<br><br>Use PI_BB_SER_INVERT to invert the serial logic and PI_BB_SER_NORMAL for
-normal logic. Default is PI_BB_SER_NORMAL.
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;invert:&nbsp;0-1<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_GPIO_IN_USE,
-PI_NOT_SERIAL_GPIO, or PI_BAD_SER_INVERT.
-<br><br>The GPIO must be opened for bit bang reading of serial data using
-<a href="#gpioSerialReadOpen">gpioSerialReadOpen</a> prior to calling this function.
-<h3><a name="gpioSerialRead"></a><a href="#int"><small>int</small></a> gpioSerialRead<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#void">void</a> <a href="#*buf">*buf</a>, <a href="#size_t">size_t</a> <a href="#bufSize">bufSize</a>)</small></h3>
-This function copies up to bufSize bytes of data read from the
-bit bang serial cyclic buffer to the buffer starting at buf.
-<br><br><code>user_gpio:&nbsp;0-31,&nbsp;previously&nbsp;opened&nbsp;with&nbsp;<a href="#gpioSerialReadOpen">gpioSerialReadOpen</a><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;bytes<br>&nbsp;&nbsp;bufSize:&nbsp;&gt;=0<br></code><br><br>Returns the number of bytes copied if OK, otherwise PI_BAD_USER_GPIO
-or PI_NOT_SERIAL_GPIO.
-<br><br>The bytes returned for each character depend upon the number of
-data bits <a href="#data_bits">data_bits</a> specified in the <a href="#gpioSerialReadOpen">gpioSerialReadOpen</a> command.
-<br><br>For <a href="#data_bits">data_bits</a> 1-8 there will be one byte per character.<br>
-For <a href="#data_bits">data_bits</a> 9-16 there will be two bytes per character.<br>
-For <a href="#data_bits">data_bits</a> 17-32 there will be four bytes per character.
-<h3><a name="gpioSerialReadClose"></a><a href="#int"><small>int</small></a> gpioSerialReadClose<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-This function closes a GPIO for bit bang reading of serial data.
-<br><br><code>user_gpio:&nbsp;0-31,&nbsp;previously&nbsp;opened&nbsp;with&nbsp;<a href="#gpioSerialReadOpen">gpioSerialReadOpen</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_SERIAL_GPIO.
-<h3><a name="i2cOpen"></a><a href="#int"><small>int</small></a> i2cOpen<small>(<a href="#unsigned">unsigned</a> <a href="#i2cBus">i2cBus</a>, <a href="#unsigned">unsigned</a> <a href="#i2cAddr">i2cAddr</a>, <a href="#unsigned">unsigned</a> <a href="#i2cFlags">i2cFlags</a>)</small></h3>
-This returns a handle for the device at the address on the I2C bus.
-<br><br><code>&nbsp;&nbsp;i2cBus:&nbsp;&gt;=0<br>&nbsp;i2cAddr:&nbsp;0-0x7F<br>i2cFlags:&nbsp;0<br></code><br><br>No flags are currently defined. This parameter should be set to zero.
-<br><br>Physically buses 0 and 1 are available on the Pi. Higher numbered buses
-will be available if a kernel supported bus multiplexor is being used.
-<br><br>The GPIO used are given in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td></tr><tr><td>I2C 0</td><td>0</td><td>1</td></tr><tr><td>I2C 1</td><td>2</td><td>3</td></tr></tbody></table><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_BAD_I2C_BUS, PI_BAD_I2C_ADDR,
-PI_BAD_FLAGS, PI_NO_HANDLE, or PI_I2C_OPEN_FAILED.
-<br><br>For the SMBus commands the low level transactions are shown at the end
-of the function description. The following abbreviations are used.
-<br><br><code>S&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Start&nbsp;bit<br>P&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Stop&nbsp;bit<br>Rd/Wr&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Read/Write&nbsp;bit.&nbsp;Rd&nbsp;equals&nbsp;1,&nbsp;Wr&nbsp;equals&nbsp;0.<br>A,&nbsp;NA&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Accept&nbsp;and&nbsp;not&nbsp;accept&nbsp;bit.<br><br>Addr&nbsp;&nbsp;&nbsp;(7&nbsp;bits):&nbsp;I2C&nbsp;7&nbsp;bit&nbsp;address.<br>i2cReg&nbsp;(8&nbsp;bits):&nbsp;Command&nbsp;byte,&nbsp;a&nbsp;byte&nbsp;which&nbsp;often&nbsp;selects&nbsp;a&nbsp;register.<br>Data&nbsp;&nbsp;&nbsp;(8&nbsp;bits):&nbsp;A&nbsp;data&nbsp;byte.<br>Count&nbsp;&nbsp;(8&nbsp;bits):&nbsp;A&nbsp;byte&nbsp;defining&nbsp;the&nbsp;length&nbsp;of&nbsp;a&nbsp;block&nbsp;operation.<br><br>[..]:&nbsp;Data&nbsp;sent&nbsp;by&nbsp;the&nbsp;device.<br></code><h3><a name="i2cClose"></a><a href="#int"><small>int</small></a> i2cClose<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This closes the I2C device associated with the handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<h3><a name="i2cWriteQuick"></a><a href="#int"><small>int</small></a> i2cWriteQuick<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#bit">bit</a>)</small></h3>
-This sends a single bit (in the Rd/Wr bit) to the device associated
-with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>&nbsp;&nbsp;&nbsp;bit:&nbsp;0-1,&nbsp;the&nbsp;value&nbsp;to&nbsp;write<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Quick command. SMBus 2.0 5.5.1
-<code>S&nbsp;Addr&nbsp;bit&nbsp;[A]&nbsp;P<br></code><h3><a name="i2cWriteByte"></a><a href="#int"><small>int</small></a> i2cWriteByte<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#bVal">bVal</a>)</small></h3>
-This sends a single byte to the device associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>&nbsp;&nbsp;bVal:&nbsp;0-0xFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Send byte. SMBus 2.0 5.5.2
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;bVal&nbsp;[A]&nbsp;P<br></code><h3><a name="i2cReadByte"></a><a href="#int"><small>int</small></a> i2cReadByte<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This reads a single byte from the device associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br></code><br><br>Returns the byte read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-or PI_I2C_READ_FAILED.
-<br><br>Receive byte. SMBus 2.0 5.5.3
-<code>S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><h3><a name="i2cWriteByteData"></a><a href="#int"><small>int</small></a> i2cWriteByteData<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2cReg">i2cReg</a>, <a href="#unsigned">unsigned</a> <a href="#bVal">bVal</a>)</small></h3>
-This writes a single byte to the specified register of the device
-associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>i2cReg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write<br>&nbsp;&nbsp;bVal:&nbsp;0-0xFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Write byte. SMBus 2.0 5.5.4
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2cReg&nbsp;[A]&nbsp;bVal&nbsp;[A]&nbsp;P<br></code><h3><a name="i2cWriteWordData"></a><a href="#int"><small>int</small></a> i2cWriteWordData<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2cReg">i2cReg</a>, <a href="#unsigned">unsigned</a> <a href="#wVal">wVal</a>)</small></h3>
-This writes a single 16 bit word to the specified register of the device
-associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>i2cReg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write<br>&nbsp;&nbsp;wVal:&nbsp;0-0xFFFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Write word. SMBus 2.0 5.5.4
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2cReg&nbsp;[A]&nbsp;wValLow&nbsp;[A]&nbsp;wValHigh&nbsp;[A]&nbsp;P<br></code><h3><a name="i2cReadByteData"></a><a href="#int"><small>int</small></a> i2cReadByteData<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2cReg">i2cReg</a>)</small></h3>
-This reads a single byte from the specified register of the device
-associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>i2cReg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read<br></code><br><br>Returns the byte read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Read byte. SMBus 2.0 5.5.5
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2cReg&nbsp;[A]&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><h3><a name="i2cReadWordData"></a><a href="#int"><small>int</small></a> i2cReadWordData<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2cReg">i2cReg</a>)</small></h3>
-This reads a single 16 bit word from the specified register of the device
-associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>i2cReg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read<br></code><br><br>Returns the word read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Read word. SMBus 2.0 5.5.5
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2cReg&nbsp;[A]&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[DataLow]&nbsp;A&nbsp;[DataHigh]&nbsp;NA&nbsp;P<br></code><h3><a name="i2cProcessCall"></a><a href="#int"><small>int</small></a> i2cProcessCall<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2cReg">i2cReg</a>, <a href="#unsigned">unsigned</a> <a href="#wVal">wVal</a>)</small></h3>
-This writes 16 bits of data to the specified register of the device
-associated with handle and reads 16 bits of data in return.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>i2cReg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write/read<br>&nbsp;&nbsp;wVal:&nbsp;0-0xFFFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write<br></code><br><br>Returns the word read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Process call. SMBus 2.0 5.5.6
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2cReg&nbsp;[A]&nbsp;wValLow&nbsp;[A]&nbsp;wValHigh&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[DataLow]&nbsp;A&nbsp;[DataHigh]&nbsp;NA&nbsp;P<br></code><h3><a name="i2cWriteBlockData"></a><a href="#int"><small>int</small></a> i2cWriteBlockData<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2cReg">i2cReg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes up to 32 bytes to the specified register of the device
-associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>i2cReg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;with&nbsp;the&nbsp;data&nbsp;to&nbsp;send<br>&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Block write. SMBus 2.0 5.5.7
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2cReg&nbsp;[A]&nbsp;count&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;buf0&nbsp;[A]&nbsp;buf1&nbsp;[A]&nbsp;...&nbsp;[A]&nbsp;bufn&nbsp;[A]&nbsp;P<br></code><h3><a name="i2cReadBlockData"></a><a href="#int"><small>int</small></a> i2cReadBlockData<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2cReg">i2cReg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>)</small></h3>
-This reads a block of up to 32 bytes from the specified register of
-the device associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>i2cReg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data<br></code><br><br>The amount of returned data is set by the device.
-<br><br>Returns the number of bytes read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Block read. SMBus 2.0 5.5.7
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2cReg&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Count]&nbsp;A&nbsp;[buf0]&nbsp;A&nbsp;[buf1]&nbsp;A&nbsp;...&nbsp;A&nbsp;[bufn]&nbsp;NA&nbsp;P<br></code><h3><a name="i2cBlockProcessCall"></a><a href="#int"><small>int</small></a> i2cBlockProcessCall<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2cReg">i2cReg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes data bytes to the specified register of the device
-associated with handle and reads a device specified number
-of bytes of data in return.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>i2cReg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write/read<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;with&nbsp;the&nbsp;data&nbsp;to&nbsp;send&nbsp;and&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data<br>&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write<br></code><br><br>Returns the number of bytes read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>The SMBus 2.0 documentation states that a minimum of 1 byte may be
-sent and a minimum of 1 byte may be received. The total number of
-bytes sent/received must be 32 or less.
-<br><br>Block write-block read. SMBus 2.0 5.5.8
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2cReg&nbsp;[A]&nbsp;count&nbsp;[A]&nbsp;buf0&nbsp;[A]&nbsp;...&nbsp;bufn&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Count]&nbsp;A&nbsp;[buf0]&nbsp;A&nbsp;...&nbsp;[bufn]&nbsp;A&nbsp;P<br></code><h3><a name="i2cReadI2CBlockData"></a><a href="#int"><small>int</small></a> i2cReadI2CBlockData<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2cReg">i2cReg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This reads count bytes from the specified register of the device
-associated with handle . The count may be 1-32.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>i2cReg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data<br>&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read<br></code><br><br>Returns the number of bytes read (&gt;0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br><code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2cReg&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[buf0]&nbsp;A&nbsp;[buf1]&nbsp;A&nbsp;...&nbsp;A&nbsp;[bufn]&nbsp;NA&nbsp;P<br></code><h3><a name="i2cWriteI2CBlockData"></a><a href="#int"><small>int</small></a> i2cWriteI2CBlockData<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2cReg">i2cReg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes 1 to 32 bytes to the specified register of the device
-associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>i2cReg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;data&nbsp;to&nbsp;write<br>&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br><code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2cReg&nbsp;[A]&nbsp;buf0&nbsp;[A]&nbsp;buf1&nbsp;[A]&nbsp;...&nbsp;[A]&nbsp;bufn&nbsp;[A]&nbsp;P<br></code><h3><a name="i2cReadDevice"></a><a href="#int"><small>int</small></a> i2cReadDevice<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This reads count bytes from the raw device into buf.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data&nbsp;bytes<br>&nbsp;count:&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read<br></code><br><br>Returns count (&gt;0) if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_READ_FAILED.
-<br><br><code>S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[buf0]&nbsp;A&nbsp;[buf1]&nbsp;A&nbsp;...&nbsp;A&nbsp;[bufn]&nbsp;NA&nbsp;P<br></code><h3><a name="i2cWriteDevice"></a><a href="#int"><small>int</small></a> i2cWriteDevice<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes count bytes from buf to the raw device.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;containing&nbsp;the&nbsp;data&nbsp;bytes&nbsp;to&nbsp;write<br>&nbsp;count:&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br><code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;buf0&nbsp;[A]&nbsp;buf1&nbsp;[A]&nbsp;...&nbsp;[A]&nbsp;bufn&nbsp;[A]&nbsp;P<br></code><h3><a name="i2cSwitchCombined"></a><a href="#void"><small>void</small></a> i2cSwitchCombined<small>(<a href="#int">int</a> <a href="#setting">setting</a>)</small></h3>
-This sets the I2C (i2c-bcm2708) module "use combined transactions"
-parameter on or off.
-<br><br><code>setting:&nbsp;0&nbsp;to&nbsp;set&nbsp;the&nbsp;parameter&nbsp;off,&nbsp;non-zero&nbsp;to&nbsp;set&nbsp;it&nbsp;on<br></code><br><br>NOTE: when the flag is on a write followed by a read to the same
-slave address will use a repeated start (rather than a stop/start).
-<h3><a name="i2cSegments"></a><a href="#int"><small>int</small></a> i2cSegments<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#pi_i2c_msg_t">pi_i2c_msg_t</a> <a href="#*segs">*segs</a>, <a href="#unsigned">unsigned</a> <a href="#numSegs">numSegs</a>)</small></h3>
-This function executes multiple I2C segments in one transaction by
-calling the I2C_RDWR ioctl.
-<br><br><code>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>&nbsp;&nbsp;&nbsp;segs:&nbsp;an&nbsp;array&nbsp;of&nbsp;I2C&nbsp;segments<br>numSegs:&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;I2C&nbsp;segments<br></code><br><br>Returns the number of segments if OK, otherwise PI_BAD_I2C_SEG.
-<h3><a name="i2cZip"></a><a href="#int"><small>int</small></a> i2cZip<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*inBuf">*inBuf</a>, <a href="#unsigned">unsigned</a> <a href="#inLen">inLen</a>, <a href="#char">char</a> <a href="#*outBuf">*outBuf</a>, <a href="#unsigned">unsigned</a> <a href="#outLen">outLen</a>)</small></h3>
-This function executes a sequence of I2C operations. The
-operations to be performed are specified by the contents of inBuf
-which contains the concatenated command codes and associated data.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>&nbsp;inBuf:&nbsp;pointer&nbsp;to&nbsp;the&nbsp;concatenated&nbsp;I2C&nbsp;commands,&nbsp;see&nbsp;below<br>&nbsp;inLen:&nbsp;size&nbsp;of&nbsp;command&nbsp;buffer<br>outBuf:&nbsp;pointer&nbsp;to&nbsp;buffer&nbsp;to&nbsp;hold&nbsp;returned&nbsp;data<br>outLen:&nbsp;size&nbsp;of&nbsp;output&nbsp;buffer<br></code><br><br>Returns &gt;= 0 if OK (the number of bytes read), otherwise
-PI_BAD_HANDLE, PI_BAD_POINTER, PI_BAD_I2C_CMD, PI_BAD_I2C_RLEN.
-PI_BAD_I2C_WLEN, or PI_BAD_I2C_SEG.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>End</td><td>0</td><td>No more commands</td></tr><tr><td>Escape</td><td>1</td><td>Next P is two bytes</td></tr><tr><td>On</td><td>2</td><td>Switch combined flag on</td></tr><tr><td>Off</td><td>3</td><td>Switch combined flag off</td></tr><tr><td>Address</td><td>4 P</td><td>Set I2C address to P</td></tr><tr><td>Flags</td><td>5 lsb msb</td><td>Set I2C flags to lsb + (msb &lt;&lt; 8)</td></tr><tr><td>Read</td><td>6 P</td><td>Read P bytes of data</td></tr><tr><td>Write</td><td>7 P ...</td><td>Write P bytes of data</td></tr></tbody></table><br><br>The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-<br><br>The address defaults to that associated with the handle.
-The flags default to 0. The address and flags maintain their
-previous value until updated.
-<br><br>The returned I2C data is stored in consecutive locations of outBuf.
-<br><br><b><small>Example</small></b><br><br><code>Set&nbsp;address&nbsp;0x53,&nbsp;write&nbsp;0x32,&nbsp;read&nbsp;6&nbsp;bytes<br>Set&nbsp;address&nbsp;0x1E,&nbsp;write&nbsp;0x03,&nbsp;read&nbsp;6&nbsp;bytes<br>Set&nbsp;address&nbsp;0x68,&nbsp;write&nbsp;0x1B,&nbsp;read&nbsp;8&nbsp;bytes<br>End<br><br>0x04&nbsp;0x53&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x32&nbsp;&nbsp;&nbsp;0x06&nbsp;0x06<br>0x04&nbsp;0x1E&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x03&nbsp;&nbsp;&nbsp;0x06&nbsp;0x06<br>0x04&nbsp;0x68&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x1B&nbsp;&nbsp;&nbsp;0x06&nbsp;0x08<br>0x00<br></code><h3><a name="bbI2COpen"></a><a href="#int"><small>int</small></a> bbI2COpen<small>(<a href="#unsigned">unsigned</a> <a href="#SDA">SDA</a>, <a href="#unsigned">unsigned</a> <a href="#SCL">SCL</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>)</small></h3>
-This function selects a pair of GPIO for bit banging I2C at a
-specified baud rate.
-<br><br>Bit banging I2C allows for certain operations which are not possible
-with the standard I2C driver.
-<br><br>o baud rates as low as 50<br>
-o repeated starts<br>
-o clock stretching<br>
-o I2C on any pair of spare GPIO
-<br><br><code>&nbsp;SDA:&nbsp;0-31<br>&nbsp;SCL:&nbsp;0-31<br>baud:&nbsp;50-500000<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_I2C_BAUD, or
-PI_GPIO_IN_USE.
-<br><br>NOTE:
-<br><br>The GPIO used for SDA and SCL must have pull-ups to 3V3 connected. As
-a guide the hardware pull-ups on pins 3 and 5 are 1k8 in value.
-<h3><a name="bbI2CClose"></a><a href="#int"><small>int</small></a> bbI2CClose<small>(<a href="#unsigned">unsigned</a> <a href="#SDA">SDA</a>)</small></h3>
-This function stops bit banging I2C on a pair of GPIO previously
-opened with <a href="#bbI2COpen">bbI2COpen</a>.
-<br><br><code>SDA:&nbsp;0-31,&nbsp;the&nbsp;SDA&nbsp;GPIO&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bbI2COpen">bbI2COpen</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_I2C_GPIO.
-<h3><a name="bbI2CZip"></a><a href="#int"><small>int</small></a> bbI2CZip<small>(<a href="#unsigned">unsigned</a> <a href="#SDA">SDA</a>, <a href="#char">char</a> <a href="#*inBuf">*inBuf</a>, <a href="#unsigned">unsigned</a> <a href="#inLen">inLen</a>, <a href="#char">char</a> <a href="#*outBuf">*outBuf</a>, <a href="#unsigned">unsigned</a> <a href="#outLen">outLen</a>)</small></h3>
-This function executes a sequence of bit banged I2C operations. The
-operations to be performed are specified by the contents of inBuf
-which contains the concatenated command codes and associated data.
-<br><br><code>&nbsp;&nbsp;&nbsp;SDA:&nbsp;0-31&nbsp;(as&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bbI2COpen">bbI2COpen</a>)<br>&nbsp;inBuf:&nbsp;pointer&nbsp;to&nbsp;the&nbsp;concatenated&nbsp;I2C&nbsp;commands,&nbsp;see&nbsp;below<br>&nbsp;inLen:&nbsp;size&nbsp;of&nbsp;command&nbsp;buffer<br>outBuf:&nbsp;pointer&nbsp;to&nbsp;buffer&nbsp;to&nbsp;hold&nbsp;returned&nbsp;data<br>outLen:&nbsp;size&nbsp;of&nbsp;output&nbsp;buffer<br></code><br><br>Returns &gt;= 0 if OK (the number of bytes read), otherwise
-PI_BAD_USER_GPIO, PI_NOT_I2C_GPIO, PI_BAD_POINTER,
-PI_BAD_I2C_CMD, PI_BAD_I2C_RLEN, PI_BAD_I2C_WLEN,
-PI_I2C_READ_FAILED, or PI_I2C_WRITE_FAILED.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>End</td><td>0</td><td>No more commands</td></tr><tr><td>Escape</td><td>1</td><td>Next P is two bytes</td></tr><tr><td>Start</td><td>2</td><td>Start condition</td></tr><tr><td>Stop</td><td>3</td><td>Stop condition</td></tr><tr><td>Address</td><td>4 P</td><td>Set I2C address to P</td></tr><tr><td>Flags</td><td>5 lsb msb</td><td>Set I2C flags to lsb + (msb &lt;&lt; 8)</td></tr><tr><td>Read</td><td>6 P</td><td>Read P bytes of data</td></tr><tr><td>Write</td><td>7 P ...</td><td>Write P bytes of data</td></tr></tbody></table><br><br>The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-<br><br>The address and flags default to 0. The address and flags maintain
-their previous value until updated.
-<br><br>No flags are currently defined.
-<br><br>The returned I2C data is stored in consecutive locations of outBuf.
-<br><br><b><small>Example</small></b><br><br><code>Set&nbsp;address&nbsp;0x53<br>start,&nbsp;write&nbsp;0x32,&nbsp;(re)start,&nbsp;read&nbsp;6&nbsp;bytes,&nbsp;stop<br>Set&nbsp;address&nbsp;0x1E<br>start,&nbsp;write&nbsp;0x03,&nbsp;(re)start,&nbsp;read&nbsp;6&nbsp;bytes,&nbsp;stop<br>Set&nbsp;address&nbsp;0x68<br>start,&nbsp;write&nbsp;0x1B,&nbsp;(re)start,&nbsp;read&nbsp;8&nbsp;bytes,&nbsp;stop<br>End<br><br>0x04&nbsp;0x53<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x32&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x06&nbsp;0x03<br><br>0x04&nbsp;0x1E<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x03&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x06&nbsp;0x03<br><br>0x04&nbsp;0x68<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x1B&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x08&nbsp;0x03<br><br>0x00<br></code><h3><a name="bscXfer"></a><a href="#int"><small>int</small></a> bscXfer<small>(<a href="#bsc_xfer_t">bsc_xfer_t</a> <a href="#*bsc_xfer">*bsc_xfer</a>)</small></h3>
-This function provides a low-level interface to the SPI/I2C Slave
-peripheral on the BCM chip.
-<br><br>This peripheral allows the Pi to act as a hardware slave device
-on an I2C or SPI bus.
-<br><br>This is not a bit bang version and as such is OS timing
-independent. The bus timing is handled directly by the chip.
-<br><br>The output process is simple. You simply append data to the FIFO
-buffer on the chip. This works like a queue, you add data to the
-queue and the master removes it.
-<br><br>I can't get SPI to work properly. I tried with a
-control word of 0x303 and swapped MISO and MOSI.
-<br><br>The function sets the BSC mode, writes any data in
-the transmit buffer to the BSC transmit FIFO, and
-copies any data in the BSC receive FIFO to the
-receive buffer.
-<br><br><code>bsc_xfer:=&nbsp;a&nbsp;structure&nbsp;defining&nbsp;the&nbsp;transfer<br><br>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;control;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Write<br>&nbsp;&nbsp;&nbsp;int&nbsp;rxCnt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Read&nbsp;only<br>&nbsp;&nbsp;&nbsp;char&nbsp;rxBuf[BSC_FIFO_SIZE];&nbsp;//&nbsp;Read&nbsp;only<br>&nbsp;&nbsp;&nbsp;int&nbsp;txCnt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Write<br>&nbsp;&nbsp;&nbsp;char&nbsp;txBuf[BSC_FIFO_SIZE];&nbsp;//&nbsp;Write<br>}&nbsp;bsc_xfer_t;<br></code><br><br>To start a transfer set control (see below), copy the bytes to
-be added to the transmit FIFO (if any) to txBuf and set txCnt to
-the number of copied bytes.
-<br><br>Upon return rxCnt will be set to the number of received bytes placed
-in rxBuf.
-<br><br>Note that the control word sets the BSC mode. The BSC will stay in
-that mode until a different control word is sent.
-<br><br>GPIO used for models other than those based on the BCM2711.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td><td>MOSI</td><td>SCLK</td><td>MISO</td><td>CE</td></tr><tr><td>I2C</td><td>18</td><td>19</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>SPI</td><td>-</td><td>-</td><td>18</td><td>19</td><td>20</td><td>21</td></tr></tbody></table><br><br>GPIO used for models based on the BCM2711 (e.g. the Pi4B).
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td><td>MOSI</td><td>SCLK</td><td>MISO</td><td>CE</td></tr><tr><td>I2C</td><td>10</td><td>11</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>SPI</td><td>-</td><td>-</td><td>10</td><td>11</td><td>9</td><td>8</td></tr></tbody></table><br><br>When a zero control word is received the used GPIO will be reset
-to INPUT mode.
-<br><br>The returned function value is the status of the transfer (see below).
-<br><br>If there was an error the status will be less than zero
-(and will contain the error code).
-<br><br>The most significant word of the returned status contains the number
-of bytes actually copied from txBuf to the BSC transmit FIFO (may be
-less than requested if the FIFO already contained untransmitted data).
-<br><br>control consists of the following bits.
-<br><br><code>22&nbsp;21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;IT&nbsp;HC&nbsp;TF&nbsp;IR&nbsp;RE&nbsp;TE&nbsp;BK&nbsp;EC&nbsp;ES&nbsp;PL&nbsp;PH&nbsp;I2&nbsp;SP&nbsp;EN<br></code><br><br>Bits 0-13 are copied unchanged to the BSC CR register. See
-pages 163-165 of the Broadcom peripherals document for full
-details.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>aaaaaaa</td><td>defines the I2C slave address (only relevant in I2C mode)</td></tr><tr><td>IT</td><td>invert transmit status flags</td></tr><tr><td>HC</td><td>enable host control</td></tr><tr><td>TF</td><td>enable test FIFO</td></tr><tr><td>IR</td><td>invert receive status flags</td></tr><tr><td>RE</td><td>enable receive</td></tr><tr><td>TE</td><td>enable transmit</td></tr><tr><td>BK</td><td>abort operation and clear FIFOs</td></tr><tr><td>EC</td><td>send control register as first I2C byte</td></tr><tr><td>ES</td><td>send status register as first I2C byte</td></tr><tr><td>PL</td><td>set SPI polarity high</td></tr><tr><td>PH</td><td>set SPI phase high</td></tr><tr><td>I2</td><td>enable I2C mode</td></tr><tr><td>SP</td><td>enable SPI mode</td></tr><tr><td>EN</td><td>enable BSC peripheral</td></tr></tbody></table><br><br>The returned status has the following format
-<br><br><code>20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;RB&nbsp;TE&nbsp;RF&nbsp;TF&nbsp;RE&nbsp;TB<br></code><br><br>Bits 0-15 are copied unchanged from the BSC FR register. See
-pages 165-166 of the Broadcom peripherals document for full
-details.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>SSSSS</td><td>number of bytes successfully copied to transmit FIFO</td></tr><tr><td>RRRRR</td><td>number of bytes in receieve FIFO</td></tr><tr><td>TTTTT</td><td>number of bytes in transmit FIFO</td></tr><tr><td>RB</td><td>receive busy</td></tr><tr><td>TE</td><td>transmit FIFO empty</td></tr><tr><td>RF</td><td>receive FIFO full</td></tr><tr><td>TF</td><td>transmit FIFO full</td></tr><tr><td>RE</td><td>receive FIFO empty</td></tr><tr><td>TB</td><td>transmit busy</td></tr></tbody></table><br><br>The following example shows how to configure the BSC peripheral as
-an I2C slave with address 0x13 and send four bytes.
-<br><br><b><small>Example</small></b><br><br><code>bsc_xfer_t&nbsp;xfer;<br><br>xfer.control&nbsp;=&nbsp;(0x13&lt;&lt;16)&nbsp;|&nbsp;0x305;<br><br>memcpy(xfer.txBuf,&nbsp;"ABCD",&nbsp;4);<br>xfer.txCnt&nbsp;=&nbsp;4;<br><br>status&nbsp;=&nbsp;bscXfer(&xfer);<br><br>if&nbsp;(status&nbsp;&gt;=&nbsp;0)<br>{<br>&nbsp;&nbsp;&nbsp;//&nbsp;process&nbsp;transfer<br>}<br></code><h3><a name="bbSPIOpen"></a><a href="#int"><small>int</small></a> bbSPIOpen<small>(<a href="#unsigned">unsigned</a> <a href="#CS">CS</a>, <a href="#unsigned">unsigned</a> <a href="#MISO">MISO</a>, <a href="#unsigned">unsigned</a> <a href="#MOSI">MOSI</a>, <a href="#unsigned">unsigned</a> <a href="#SCLK">SCLK</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#spiFlags">spiFlags</a>)</small></h3>
-This function selects a set of GPIO for bit banging SPI with
-a specified baud rate and mode.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CS:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;MISO:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;MOSI:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;SCLK:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;50-250000<br>spiFlags:&nbsp;see&nbsp;below<br></code><br><br>spiFlags consists of the least significant 22 bits.
-<br><br><code>21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;p&nbsp;&nbsp;m&nbsp;&nbsp;m<br></code><br><br>mm defines the SPI mode, defaults to 0
-<br><br><code>Mode&nbsp;CPOL&nbsp;CPHA<br>&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0<br>&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;1<br>&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;0<br>&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;1<br></code><br><br>p is 0 if CS is active low (default) and 1 for active high.
-<br><br>T is 1 if the least significant bit is transmitted on MOSI first, the
-default (0) shifts the most significant bit out first.
-<br><br>R is 1 if the least significant bit is received on MISO first, the
-default (0) receives the most significant bit first.
-<br><br>The other bits in flags should be set to zero.
-<br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_SPI_BAUD, or
-PI_GPIO_IN_USE.
-<br><br>If more than one device is connected to the SPI bus (defined by
-SCLK, MOSI, and MISO) each must have its own CS.
-<br><br><b><small>Example</small></b><br><br><code>bbSPIOpen(10,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;10000,&nbsp;0);&nbsp;//&nbsp;device&nbsp;1<br>bbSPIOpen(11,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;20000,&nbsp;3);&nbsp;//&nbsp;device&nbsp;2<br></code><h3><a name="bbSPIClose"></a><a href="#int"><small>int</small></a> bbSPIClose<small>(<a href="#unsigned">unsigned</a> <a href="#CS">CS</a>)</small></h3>
-This function stops bit banging SPI on a set of GPIO
-opened with <a href="#bbSPIOpen">bbSPIOpen</a>.
-<br><br><code>CS:&nbsp;0-31,&nbsp;the&nbsp;CS&nbsp;GPIO&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bbSPIOpen">bbSPIOpen</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_SPI_GPIO.
-<h3><a name="bbSPIXfer"></a><a href="#int"><small>int</small></a> bbSPIXfer<small>(<a href="#unsigned">unsigned</a> <a href="#CS">CS</a>, <a href="#char">char</a> <a href="#*inBuf">*inBuf</a>, <a href="#char">char</a> <a href="#*outBuf">*outBuf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function executes a bit banged SPI transfer.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;CS:&nbsp;0-31&nbsp;(as&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bbSPIOpen">bbSPIOpen</a>)<br>&nbsp;inBuf:&nbsp;pointer&nbsp;to&nbsp;buffer&nbsp;to&nbsp;hold&nbsp;data&nbsp;to&nbsp;be&nbsp;sent<br>outBuf:&nbsp;pointer&nbsp;to&nbsp;buffer&nbsp;to&nbsp;hold&nbsp;returned&nbsp;data<br>&nbsp;count:&nbsp;size&nbsp;of&nbsp;data&nbsp;transfer<br></code><br><br>Returns &gt;= 0 if OK (the number of bytes read), otherwise
-PI_BAD_USER_GPIO, PI_NOT_SPI_GPIO or PI_BAD_POINTER.
-<br><br><b><small>Example</small></b><br><br><code>//&nbsp;gcc&nbsp;-Wall&nbsp;-pthread&nbsp;-o&nbsp;bbSPIx_test&nbsp;bbSPIx_test.c&nbsp;-lpigpio<br>//&nbsp;sudo&nbsp;./bbSPIx_test<br><br>#include&nbsp;&lt;stdio.h&gt;<br><br>#include&nbsp;"pigpio.h"<br><br>#define&nbsp;CE0&nbsp;5<br>#define&nbsp;CE1&nbsp;6<br>#define&nbsp;MISO&nbsp;13<br>#define&nbsp;MOSI&nbsp;19<br>#define&nbsp;SCLK&nbsp;12<br><br>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;*argv[])<br>{<br>&nbsp;&nbsp;&nbsp;int&nbsp;i,&nbsp;count,&nbsp;set_val,&nbsp;read_val;<br>&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;inBuf[3];<br>&nbsp;&nbsp;&nbsp;char&nbsp;cmd1[]&nbsp;=&nbsp;{0,&nbsp;0};<br>&nbsp;&nbsp;&nbsp;char&nbsp;cmd2[]&nbsp;=&nbsp;{12,&nbsp;0};<br>&nbsp;&nbsp;&nbsp;char&nbsp;cmd3[]&nbsp;=&nbsp;{1,&nbsp;128,&nbsp;0};<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(gpioInitialise()&nbsp;&lt;&nbsp;0)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fprintf(stderr,&nbsp;"pigpio&nbsp;initialisation&nbsp;failed.\n");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;1;<br>&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;bbSPIOpen(CE0,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;10000,&nbsp;0);&nbsp;//&nbsp;MCP4251&nbsp;DAC<br>&nbsp;&nbsp;&nbsp;bbSPIOpen(CE1,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;20000,&nbsp;3);&nbsp;//&nbsp;MCP3008&nbsp;ADC<br><br>&nbsp;&nbsp;&nbsp;for&nbsp;(i=0;&nbsp;i&lt;256;&nbsp;i++)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cmd1[1]&nbsp;=&nbsp;i;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count&nbsp;=&nbsp;bbSPIXfer(CE0,&nbsp;cmd1,&nbsp;(char&nbsp;*)inBuf,&nbsp;2);&nbsp;//&nbsp;&gt;&nbsp;DAC<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(count&nbsp;==&nbsp;2)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count&nbsp;=&nbsp;bbSPIXfer(CE0,&nbsp;cmd2,&nbsp;(char&nbsp;*)inBuf,&nbsp;2);&nbsp;//&nbsp;&lt;&nbsp;DAC<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(count&nbsp;==&nbsp;2)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set_val&nbsp;=&nbsp;inBuf[1];<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count&nbsp;=&nbsp;bbSPIXfer(CE1,&nbsp;cmd3,&nbsp;(char&nbsp;*)inBuf,&nbsp;3);&nbsp;//&nbsp;&lt;&nbsp;ADC<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(count&nbsp;==&nbsp;3)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;read_val&nbsp;=&nbsp;((inBuf[1]&3)&lt;&lt;8)&nbsp;|&nbsp;inBuf[2];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("%d&nbsp;%d\n",&nbsp;set_val,&nbsp;read_val);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;bbSPIClose(CE0);<br>&nbsp;&nbsp;&nbsp;bbSPIClose(CE1);<br><br>&nbsp;&nbsp;&nbsp;gpioTerminate();<br><br>&nbsp;&nbsp;&nbsp;return&nbsp;0;<br>}<br></code><h3><a name="spiOpen"></a><a href="#int"><small>int</small></a> spiOpen<small>(<a href="#unsigned">unsigned</a> <a href="#spiChan">spiChan</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#spiFlags">spiFlags</a>)</small></h3>
-This function returns a handle for the SPI device on the channel.
-Data will be transferred at baud bits per second. The flags may
-be used to modify the default behaviour of 4-wire operation, mode 0,
-active low chip select.
-<br><br>The Pi has two SPI peripherals: main and auxiliary.
-<br><br>The main SPI has two chip selects (channels), the auxiliary has
-three.
-<br><br>The auxiliary SPI is available on all models but the A and B.
-<br><br>The GPIO used are given in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>MISO</td><td>MOSI</td><td>SCLK</td><td>CE0</td><td>CE1</td><td>CE2</td></tr><tr><td>Main SPI</td><td>9</td><td>10</td><td>11</td><td>8</td><td>7</td><td>-</td></tr><tr><td>Aux SPI</td><td>19</td><td>20</td><td>21</td><td>18</td><td>17</td><td>16</td></tr></tbody></table><br><br><code>&nbsp;spiChan:&nbsp;0-1&nbsp;(0-2&nbsp;for&nbsp;the&nbsp;auxiliary&nbsp;SPI)<br>&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;32K-125M&nbsp;(values&nbsp;above&nbsp;30M&nbsp;are&nbsp;unlikely&nbsp;to&nbsp;work)<br>spiFlags:&nbsp;see&nbsp;below<br></code><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_BAD_SPI_CHANNEL,
-PI_BAD_SPI_SPEED, PI_BAD_FLAGS, PI_NO_AUX_SPI, or PI_SPI_OPEN_FAILED.
-<br><br>spiFlags consists of the least significant 22 bits.
-<br><br><code>21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;W&nbsp;&nbsp;A&nbsp;u2&nbsp;u1&nbsp;u0&nbsp;p2&nbsp;p1&nbsp;p0&nbsp;&nbsp;m&nbsp;&nbsp;m<br></code><br><br>mm defines the SPI mode.
-<br><br>Warning: modes 1 and 3 do not appear to work on the auxiliary SPI.
-<br><br><code>Mode&nbsp;POL&nbsp;PHA<br>&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;0<br>&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;1<br>&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;0<br>&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;1<br></code><br><br>px is 0 if CEx is active low (default) and 1 for active high.
-<br><br>ux is 0 if the CEx GPIO is reserved for SPI (default) and 1 otherwise.
-<br><br>A is 0 for the main SPI, 1 for the auxiliary SPI.
-<br><br>W is 0 if the device is not 3-wire, 1 if the device is 3-wire. Main
-SPI only.
-<br><br>nnnn defines the number of bytes (0-15) to write before switching
-the MOSI line to MISO to read data. This field is ignored
-if W is not set. Main SPI only.
-<br><br>T is 1 if the least significant bit is transmitted on MOSI first, the
-default (0) shifts the most significant bit out first. Auxiliary SPI
-only.
-<br><br>R is 1 if the least significant bit is received on MISO first, the
-default (0) receives the most significant bit first. Auxiliary SPI
-only.
-<br><br>bbbbbb defines the word size in bits (0-32). The default (0)
-sets 8 bits per word. Auxiliary SPI only.
-<br><br>The <a href="#spiRead">spiRead</a>, <a href="#spiWrite">spiWrite</a>, and <a href="#spiXfer">spiXfer</a> functions
-transfer data packed into 1, 2, or 4 bytes according to
-the word size in bits.
-<br><br>For bits 1-8 there will be one byte per word.<br>
-For bits 9-16 there will be two bytes per word.<br>
-For bits 17-32 there will be four bytes per word.
-<br><br>Multi-byte transfers are made in least significant byte first order.
-<br><br>E.g. to transfer 32 11-bit words buf should contain 64 bytes
-and count should be 64.
-<br><br>E.g. to transfer the 14 bit value 0x1ABC send the bytes 0xBC followed
-by 0x1A.
-<br><br>The other bits in flags should be set to zero.
-<h3><a name="spiClose"></a><a href="#int"><small>int</small></a> spiClose<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This functions closes the SPI device identified by the handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spiOpen">spiOpen</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<h3><a name="spiRead"></a><a href="#int"><small>int</small></a> spiRead<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function reads count bytes of data from the SPI
-device associated with the handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spiOpen">spiOpen</a><br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data&nbsp;bytes<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read<br></code><br><br>Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-<h3><a name="spiWrite"></a><a href="#int"><small>int</small></a> spiWrite<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function writes count bytes of data from buf to the SPI
-device associated with the handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spiOpen">spiOpen</a><br>&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;data&nbsp;bytes&nbsp;to&nbsp;write<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write<br></code><br><br>Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-<h3><a name="spiXfer"></a><a href="#int"><small>int</small></a> spiXfer<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*txBuf">*txBuf</a>, <a href="#char">char</a> <a href="#*rxBuf">*rxBuf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function transfers count bytes of data from txBuf to the SPI
-device associated with the handle. Simultaneously count bytes of
-data are read from the device and placed in rxBuf.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spiOpen">spiOpen</a><br>&nbsp;txBuf:&nbsp;the&nbsp;data&nbsp;bytes&nbsp;to&nbsp;write<br>&nbsp;rxBuf:&nbsp;the&nbsp;received&nbsp;data&nbsp;bytes<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;transfer<br></code><br><br>Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-<h3><a name="serOpen"></a><a href="#int"><small>int</small></a> serOpen<small>(<a href="#char">char</a> <a href="#*sertty">*sertty</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#serFlags">serFlags</a>)</small></h3>
-This function opens a serial device at a specified baud rate
-and with specified flags. The device name must start with
-/dev/tty or /dev/serial.
-<br><br><code>&nbsp;&nbsp;sertty:&nbsp;the&nbsp;serial&nbsp;device&nbsp;to&nbsp;open<br>&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;the&nbsp;baud&nbsp;rate&nbsp;in&nbsp;bits&nbsp;per&nbsp;second,&nbsp;see&nbsp;below<br>serFlags:&nbsp;0<br></code><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_NO_HANDLE, or
-PI_SER_OPEN_FAILED.
-<br><br>The baud rate must be one of 50, 75, 110, 134, 150,
-200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
-38400, 57600, 115200, or 230400.
-<br><br>No flags are currently defined. This parameter should be set to zero.
-<h3><a name="serClose"></a><a href="#int"><small>int</small></a> serClose<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This function closes the serial device associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serOpen">serOpen</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<h3><a name="serWriteByte"></a><a href="#int"><small>int</small></a> serWriteByte<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#bVal">bVal</a>)</small></h3>
-This function writes bVal to the serial port associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serOpen">serOpen</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_SER_WRITE_FAILED.
-<h3><a name="serReadByte"></a><a href="#int"><small>int</small></a> serReadByte<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This function reads a byte from the serial port associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serOpen">serOpen</a><br></code><br><br>Returns the read byte (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_SER_READ_NO_DATA, or PI_SER_READ_FAILED.
-<br><br>If no data is ready PI_SER_READ_NO_DATA is returned.
-<h3><a name="serWrite"></a><a href="#int"><small>int</small></a> serWrite<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function writes count bytes from buf to the the serial port
-associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serOpen">serOpen</a><br>&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;array&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_SER_WRITE_FAILED.
-<h3><a name="serRead"></a><a href="#int"><small>int</small></a> serRead<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function reads up count bytes from the the serial port
-associated with handle and writes them to buf.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serOpen">serOpen</a><br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data<br>&nbsp;count:&nbsp;the&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read<br></code><br><br>Returns the number of bytes read (&gt;0=) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_SER_READ_NO_DATA.
-<br><br>If no data is ready zero is returned.
-<h3><a name="serDataAvailable"></a><a href="#int"><small>int</small></a> serDataAvailable<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This function returns the number of bytes available
-to be read from the device associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serOpen">serOpen</a><br></code><br><br>Returns the number of bytes of data available (&gt;=0) if OK,
-otherwise PI_BAD_HANDLE.
-<h3><a name="gpioTrigger"></a><a href="#int"><small>int</small></a> gpioTrigger<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#pulseLen">pulseLen</a>, <a href="#unsigned">unsigned</a> <a href="#level">level</a>)</small></h3>
-This function sends a trigger pulse to a GPIO. The GPIO is set to
-level for pulseLen microseconds and then reset to not level.
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;pulseLen:&nbsp;1-100<br>&nbsp;&nbsp;&nbsp;&nbsp;level:&nbsp;0,1<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_LEVEL,
-or PI_BAD_PULSELEN.
-<h3><a name="gpioSetWatchdog"></a><a href="#int"><small>int</small></a> gpioSetWatchdog<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#timeout">timeout</a>)</small></h3>
-Sets a watchdog for a GPIO.
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;timeout:&nbsp;0-60000<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_BAD_WDOG_TIMEOUT.
-<br><br>The watchdog is nominally in milliseconds.
-<br><br>One watchdog may be registered per GPIO.
-<br><br>The watchdog may be cancelled by setting timeout to 0.
-<br><br>Until cancelled a timeout will be reported every timeout milliseconds
-after the last GPIO activity.
-<br><br>In particular:
-<br><br>1) any registered alert function for the GPIO will be called with
- the level set to PI_TIMEOUT.
-<br><br>2) any notification for the GPIO will have a report written to the
- fifo with the flags set to indicate a watchdog timeout.
-<br><br><b><small>Example</small></b><br><br><code>void&nbsp;aFunction(int&nbsp;gpio,&nbsp;int&nbsp;level,&nbsp;uint32_t&nbsp;tick)<br>{<br>&nbsp;&nbsp;&nbsp;printf("GPIO&nbsp;%d&nbsp;became&nbsp;%d&nbsp;at&nbsp;%d",&nbsp;gpio,&nbsp;level,&nbsp;tick);<br>}<br><br>//&nbsp;call&nbsp;aFunction&nbsp;whenever&nbsp;GPIO&nbsp;4&nbsp;changes&nbsp;state<br>gpioSetAlertFunc(4,&nbsp;aFunction);<br><br>//&nbsp;&nbsp;or&nbsp;approximately&nbsp;every&nbsp;5&nbsp;millis<br>gpioSetWatchdog(4,&nbsp;5);<br></code><h3><a name="gpioNoiseFilter"></a><a href="#int"><small>int</small></a> gpioNoiseFilter<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#steady">steady</a>, <a href="#unsigned">unsigned</a> <a href="#active">active</a>)</small></h3>
-Sets a noise filter on a GPIO.
-<br><br>Level changes on the GPIO are ignored until a level which has
-been stable for <a href="#steady">steady</a> microseconds is detected. Level changes
-on the GPIO are then reported for <a href="#active">active</a> microseconds after
-which the process repeats.
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;steady:&nbsp;0-300000<br>&nbsp;&nbsp;&nbsp;active:&nbsp;0-1000000<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
-<br><br>This filter affects the GPIO samples returned to callbacks set up
-with <a href="#gpioSetAlertFunc">gpioSetAlertFunc</a>, <a href="#gpioSetAlertFuncEx">gpioSetAlertFuncEx</a>, <a href="#gpioSetGetSamplesFunc">gpioSetGetSamplesFunc</a>,
-and <a href="#gpioSetGetSamplesFuncEx">gpioSetGetSamplesFuncEx</a>.
-<br><br>It does not affect interrupts set up with <a href="#gpioSetISRFunc">gpioSetISRFunc</a>,
-<a href="#gpioSetISRFuncEx">gpioSetISRFuncEx</a>, or levels read by <a href="#gpioRead">gpioRead</a>,
-<a href="#gpioRead_Bits_0_31">gpioRead_Bits_0_31</a>, or <a href="#gpioRead_Bits_32_53">gpioRead_Bits_32_53</a>.
-<br><br>Level changes before and after the active period may
-be reported. Your software must be designed to cope with
-such reports.
-<h3><a name="gpioGlitchFilter"></a><a href="#int"><small>int</small></a> gpioGlitchFilter<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#steady">steady</a>)</small></h3>
-Sets a glitch filter on a GPIO.
-<br><br>Level changes on the GPIO are not reported unless the level
-has been stable for at least <a href="#steady">steady</a> microseconds. The
-level is then reported. Level changes of less than <a href="#steady">steady</a>
-microseconds are ignored.
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;steady:&nbsp;0-300000<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
-<br><br>This filter affects the GPIO samples returned to callbacks set up
-with <a href="#gpioSetAlertFunc">gpioSetAlertFunc</a>, <a href="#gpioSetAlertFuncEx">gpioSetAlertFuncEx</a>, <a href="#gpioSetGetSamplesFunc">gpioSetGetSamplesFunc</a>,
-and <a href="#gpioSetGetSamplesFuncEx">gpioSetGetSamplesFuncEx</a>.
-<br><br>It does not affect interrupts set up with <a href="#gpioSetISRFunc">gpioSetISRFunc</a>,
-<a href="#gpioSetISRFuncEx">gpioSetISRFuncEx</a>, or levels read by <a href="#gpioRead">gpioRead</a>,
-<a href="#gpioRead_Bits_0_31">gpioRead_Bits_0_31</a>, or <a href="#gpioRead_Bits_32_53">gpioRead_Bits_32_53</a>.
-<br><br>Each (stable) edge will be timestamped <a href="#steady">steady</a> microseconds
-after it was first detected.
-<h3><a name="gpioSetGetSamplesFunc"></a><a href="#int"><small>int</small></a> gpioSetGetSamplesFunc<small>(<a href="#gpioGetSamplesFunc_t">gpioGetSamplesFunc_t</a> <a href="#f">f</a>, <a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Registers a function to be called (a callback) every millisecond
-with the latest GPIO samples.
-<br><br><code>&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;function&nbsp;to&nbsp;call<br>bits:&nbsp;the&nbsp;GPIO&nbsp;of&nbsp;interest<br></code><br><br>Returns 0 if OK.
-<br><br>The function is passed a pointer to the samples (an array of
-<a href="#gpioSample_t">gpioSample_t</a>), and the number of samples.
-<br><br>Only one function can be registered.
-<br><br>The callback may be cancelled by passing NULL as the function.
-<br><br>The samples returned will be the union of bits, plus any active alerts,
-plus any active notifications.
-<br><br>e.g. if there are alerts for GPIO 7, 8, and 9, notifications for GPIO
-8, 10, 23, 24, and bits is (1&lt;&lt;23)|(1&lt;&lt;17) then samples for GPIO
-7, 8, 9, 10, 17, 23, and 24 will be reported.
-<h3><a name="gpioSetGetSamplesFuncEx"></a><a href="#int"><small>int</small></a> gpioSetGetSamplesFuncEx<small>(<a href="#gpioGetSamplesFuncEx_t">gpioGetSamplesFuncEx_t</a> <a href="#f">f</a>, <a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-Registers a function to be called (a callback) every millisecond
-with the latest GPIO samples.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;function&nbsp;to&nbsp;call<br>&nbsp;&nbsp;&nbsp;&nbsp;bits:&nbsp;the&nbsp;GPIO&nbsp;of&nbsp;interest<br>userdata:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;arbitrary&nbsp;user&nbsp;data<br></code><br><br>Returns 0 if OK.
-<br><br>The function is passed a pointer to the samples (an array of
-<a href="#gpioSample_t">gpioSample_t</a>), the number of samples, and the userdata pointer.
-<br><br>Only one of <a href="#gpioGetSamplesFunc">gpioGetSamplesFunc</a> or <a href="#gpioGetSamplesFuncEx">gpioGetSamplesFuncEx</a> can be
-registered.
-<br><br>See <a href="#gpioSetGetSamplesFunc">gpioSetGetSamplesFunc</a> for further details.
-<h3><a name="gpioSetTimerFunc"></a><a href="#int"><small>int</small></a> gpioSetTimerFunc<small>(<a href="#unsigned">unsigned</a> <a href="#timer">timer</a>, <a href="#unsigned">unsigned</a> <a href="#millis">millis</a>, <a href="#gpioTimerFunc_t">gpioTimerFunc_t</a> <a href="#f">f</a>)</small></h3>
-Registers a function to be called (a callback) every millis milliseconds.
-<br><br><code>&nbsp;timer:&nbsp;0-9<br>millis:&nbsp;10-60000<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;function&nbsp;to&nbsp;call<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_TIMER, PI_BAD_MS, or PI_TIMER_FAILED.
-<br><br>10 timers are supported numbered 0 to 9.
-<br><br>One function may be registered per timer.
-<br><br>The timer may be cancelled by passing NULL as the function.
-<br><br><b><small>Example</small></b><br><br><code>void&nbsp;bFunction(void)<br>{<br>&nbsp;&nbsp;&nbsp;printf("two&nbsp;seconds&nbsp;have&nbsp;elapsed");<br>}<br><br>//&nbsp;call&nbsp;bFunction&nbsp;every&nbsp;2000&nbsp;milliseconds<br>gpioSetTimerFunc(0,&nbsp;2000,&nbsp;bFunction);<br></code><h3><a name="gpioSetTimerFuncEx"></a><a href="#int"><small>int</small></a> gpioSetTimerFuncEx<small>(<a href="#unsigned">unsigned</a> <a href="#timer">timer</a>, <a href="#unsigned">unsigned</a> <a href="#millis">millis</a>, <a href="#gpioTimerFuncEx_t">gpioTimerFuncEx_t</a> <a href="#f">f</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-Registers a function to be called (a callback) every millis milliseconds.
-<br><br><code>&nbsp;&nbsp;&nbsp;timer:&nbsp;0-9.<br>&nbsp;&nbsp;millis:&nbsp;10-60000<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;function&nbsp;to&nbsp;call<br>userdata:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;arbitrary&nbsp;user&nbsp;data<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_TIMER, PI_BAD_MS, or PI_TIMER_FAILED.
-<br><br>The function is passed the userdata pointer.
-<br><br>Only one of <a href="#gpioSetTimerFunc">gpioSetTimerFunc</a> or <a href="#gpioSetTimerFuncEx">gpioSetTimerFuncEx</a> can be
-registered per timer.
-<br><br>See <a href="#gpioSetTimerFunc">gpioSetTimerFunc</a> for further details.
-<h3><a name="gpioStartThread"></a><a href="#pthread_t"><small>pthread_t</small></a> *gpioStartThread<small>(<a href="#gpioThreadFunc_t">gpioThreadFunc_t</a> <a href="#f">f</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-Starts a new thread of execution with f as the main routine.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;main&nbsp;function&nbsp;for&nbsp;the&nbsp;new&nbsp;thread<br>userdata:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;arbitrary&nbsp;user&nbsp;data<br></code><br><br>Returns a pointer to pthread_t if OK, otherwise NULL.
-<br><br>The function is passed the single argument arg.
-<br><br>The thread can be cancelled by passing the pointer to pthread_t to
-<a href="#gpioStopThread">gpioStopThread</a>.
-<br><br><b><small>Example</small></b><br><br><code>#include&nbsp;&lt;stdio.h&gt;<br>#include&nbsp;&lt;pigpio.h&gt;<br><br>void&nbsp;*myfunc(void&nbsp;*arg)<br>{<br>&nbsp;&nbsp;&nbsp;while&nbsp;(1)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("%s",&nbsp;arg);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sleep(1);<br>&nbsp;&nbsp;&nbsp;}<br>}<br><br>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;*argv[])<br>{<br>&nbsp;&nbsp;&nbsp;pthread_t&nbsp;*p1,&nbsp;*p2,&nbsp;*p3;<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(gpioInitialise()&nbsp;&lt;&nbsp;0)&nbsp;return&nbsp;1;<br><br>&nbsp;&nbsp;&nbsp;p1&nbsp;=&nbsp;gpioStartThread(myfunc,&nbsp;"thread&nbsp;1");&nbsp;sleep(3);<br><br>&nbsp;&nbsp;&nbsp;p2&nbsp;=&nbsp;gpioStartThread(myfunc,&nbsp;"thread&nbsp;2");&nbsp;sleep(3);<br><br>&nbsp;&nbsp;&nbsp;p3&nbsp;=&nbsp;gpioStartThread(myfunc,&nbsp;"thread&nbsp;3");&nbsp;sleep(3);<br><br>&nbsp;&nbsp;&nbsp;gpioStopThread(p3);&nbsp;sleep(3);<br><br>&nbsp;&nbsp;&nbsp;gpioStopThread(p2);&nbsp;sleep(3);<br><br>&nbsp;&nbsp;&nbsp;gpioStopThread(p1);&nbsp;sleep(3);<br><br>&nbsp;&nbsp;&nbsp;gpioTerminate();<br>}<br></code><h3><a name="gpioStopThread"></a><a href="#void"><small>void</small></a> gpioStopThread<small>(<a href="#pthread_t">pthread_t</a> <a href="#*pth">*pth</a>)</small></h3>
-Cancels the thread pointed at by pth.
-<br><br><code>pth:&nbsp;a&nbsp;thread&nbsp;pointer&nbsp;returned&nbsp;by&nbsp;<a href="#gpioStartThread">gpioStartThread</a><br></code><br><br>No value is returned.
-<br><br>The thread to be stopped should have been started with <a href="#gpioStartThread">gpioStartThread</a>.
-<h3><a name="gpioStoreScript"></a><a href="#int"><small>int</small></a> gpioStoreScript<small>(<a href="#char">char</a> <a href="#*script">*script</a>)</small></h3>
-This function stores a null terminated script for later execution.
-<br><br>See <a href="http://abyz.me.uk/rpi/pigpio/pigs.html#Scripts">http://abyz.me.uk/rpi/pigpio/pigs.html#Scripts</a> for details.
-<br><br><code>script:&nbsp;the&nbsp;text&nbsp;of&nbsp;the&nbsp;script<br></code><br><br>The function returns a script id if the script is valid,
-otherwise PI_BAD_SCRIPT.
-<h3><a name="gpioRunScript"></a><a href="#int"><small>int</small></a> gpioRunScript<small>(<a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>, <a href="#unsigned">unsigned</a> <a href="#numPar">numPar</a>, <a href="#uint32_t">uint32_t</a> <a href="#*param">*param</a>)</small></h3>
-This function runs a stored script.
-<br><br><code>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioStoreScript">gpioStoreScript</a><br>&nbsp;&nbsp;&nbsp;numPar:&nbsp;0-10,&nbsp;the&nbsp;number&nbsp;of&nbsp;parameters<br>&nbsp;&nbsp;&nbsp;&nbsp;param:&nbsp;an&nbsp;array&nbsp;of&nbsp;parameters<br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID, or
-PI_TOO_MANY_PARAM.
-<br><br>param is an array of up to 10 parameters which may be referenced in
-the script as p0 to p9.
-<h3><a name="gpioRunScript"></a><a href="#int"><small>int</small></a> gpioRunScript<small>(<a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>, <a href="#unsigned">unsigned</a> <a href="#numPar">numPar</a>, <a href="#uint32_t">uint32_t</a> <a href="#*param">*param</a>)</small></h3>
-This function runs a stored script.
-<br><br><code>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioStoreScript">gpioStoreScript</a><br>&nbsp;&nbsp;&nbsp;numPar:&nbsp;0-10,&nbsp;the&nbsp;number&nbsp;of&nbsp;parameters<br>&nbsp;&nbsp;&nbsp;&nbsp;param:&nbsp;an&nbsp;array&nbsp;of&nbsp;parameters<br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID, or
-PI_TOO_MANY_PARAM.
-<br><br>param is an array of up to 10 parameters which may be referenced in
-the script as p0 to p9.
-<h3><a name="gpioUpdateScript"></a><a href="#int"><small>int</small></a> gpioUpdateScript<small>(<a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>, <a href="#unsigned">unsigned</a> <a href="#numPar">numPar</a>, <a href="#uint32_t">uint32_t</a> <a href="#*param">*param</a>)</small></h3>
-This function sets the parameters of a script. The script may or
-may not be running. The first numPar parameters of the script are
-overwritten with the new values.
-<br><br><code>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioStoreScript">gpioStoreScript</a><br>&nbsp;&nbsp;&nbsp;numPar:&nbsp;0-10,&nbsp;the&nbsp;number&nbsp;of&nbsp;parameters<br>&nbsp;&nbsp;&nbsp;&nbsp;param:&nbsp;an&nbsp;array&nbsp;of&nbsp;parameters<br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID, or
-PI_TOO_MANY_PARAM.
-<br><br>param is an array of up to 10 parameters which may be referenced in
-the script as p0 to p9.
-<h3><a name="gpioScriptStatus"></a><a href="#int"><small>int</small></a> gpioScriptStatus<small>(<a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>, <a href="#uint32_t">uint32_t</a> <a href="#*param">*param</a>)</small></h3>
-This function returns the run status of a stored script as well as
-the current values of parameters 0 to 9.
-<br><br><code>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioStoreScript">gpioStoreScript</a><br>&nbsp;&nbsp;&nbsp;&nbsp;param:&nbsp;an&nbsp;array&nbsp;to&nbsp;hold&nbsp;the&nbsp;returned&nbsp;10&nbsp;parameters<br></code><br><br>The function returns greater than or equal to 0 if OK,
-otherwise PI_BAD_SCRIPT_ID.
-<br><br>The run status may be
-<br><br><code>PI_SCRIPT_INITING<br>PI_SCRIPT_HALTED<br>PI_SCRIPT_RUNNING<br>PI_SCRIPT_WAITING<br>PI_SCRIPT_FAILED<br></code><br><br>The current value of script parameters 0 to 9 are returned in param.
-<h3><a name="gpioStopScript"></a><a href="#int"><small>int</small></a> gpioStopScript<small>(<a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>)</small></h3>
-This function stops a running script.
-<br><br><code>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioStoreScript">gpioStoreScript</a><br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID.
-<h3><a name="gpioDeleteScript"></a><a href="#int"><small>int</small></a> gpioDeleteScript<small>(<a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>)</small></h3>
-This function deletes a stored script.
-<br><br><code>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioStoreScript">gpioStoreScript</a><br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID.
-<h3><a name="gpioSetSignalFunc"></a><a href="#int"><small>int</small></a> gpioSetSignalFunc<small>(<a href="#unsigned">unsigned</a> <a href="#signum">signum</a>, <a href="#gpioSignalFunc_t">gpioSignalFunc_t</a> <a href="#f">f</a>)</small></h3>
-Registers a function to be called (a callback) when a signal occurs.
-<br><br><code>signum:&nbsp;0-63<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_SIGNUM.
-<br><br>The function is passed the signal number.
-<br><br>One function may be registered per signal.
-<br><br>The callback may be cancelled by passing NULL.
-<br><br>By default all signals are treated as fatal and cause the library
-to call gpioTerminate and then exit.
-<h3><a name="gpioSetSignalFuncEx"></a><a href="#int"><small>int</small></a> gpioSetSignalFuncEx<small>(<a href="#unsigned">unsigned</a> <a href="#signum">signum</a>, <a href="#gpioSignalFuncEx_t">gpioSignalFuncEx_t</a> <a href="#f">f</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-Registers a function to be called (a callback) when a signal occurs.
-<br><br><code>&nbsp;&nbsp;signum:&nbsp;0-63<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function<br>userdata:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;arbitrary&nbsp;user&nbsp;data<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_SIGNUM.
-<br><br>The function is passed the signal number and the userdata pointer.
-<br><br>Only one of gpioSetSignalFunc or gpioSetSignalFuncEx can be
-registered per signal.
-<br><br>See gpioSetSignalFunc for further details.
-<h3><a name="gpioRead_Bits_0_31"></a><a href="#uint32_t"><small>uint32_t</small></a> gpioRead_Bits_0_31<small>(void)</small></h3>
-Returns the current level of GPIO 0-31.
-<h3><a name="gpioRead_Bits_32_53"></a><a href="#uint32_t"><small>uint32_t</small></a> gpioRead_Bits_32_53<small>(void)</small></h3>
-Returns the current level of GPIO 32-53.
-<h3><a name="gpioWrite_Bits_0_31_Clear"></a><a href="#int"><small>int</small></a> gpioWrite_Bits_0_31_Clear<small>(<a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Clears GPIO 0-31 if the corresponding bit in bits is set.
-<br><br><code>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;of&nbsp;GPIO&nbsp;to&nbsp;clear<br></code><br><br>Returns 0 if OK.
-<br><br><b><small>Example</small></b><br><br><code>//&nbsp;To&nbsp;clear&nbsp;(set&nbsp;to&nbsp;0)&nbsp;GPIO&nbsp;4,&nbsp;7,&nbsp;and&nbsp;15<br>gpioWrite_Bits_0_31_Clear(&nbsp;(1&lt;&lt;4)&nbsp;|&nbsp;(1&lt;&lt;7)&nbsp;|&nbsp;(1&lt;&lt;15)&nbsp;);<br></code><h3><a name="gpioWrite_Bits_32_53_Clear"></a><a href="#int"><small>int</small></a> gpioWrite_Bits_32_53_Clear<small>(<a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Clears GPIO 32-53 if the corresponding bit (0-21) in bits is set.
-<br><br><code>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;of&nbsp;GPIO&nbsp;to&nbsp;clear<br></code><br><br>Returns 0 if OK.
-<h3><a name="gpioWrite_Bits_0_31_Set"></a><a href="#int"><small>int</small></a> gpioWrite_Bits_0_31_Set<small>(<a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Sets GPIO 0-31 if the corresponding bit in bits is set.
-<br><br><code>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;of&nbsp;GPIO&nbsp;to&nbsp;set<br></code><br><br>Returns 0 if OK.
-<h3><a name="gpioWrite_Bits_32_53_Set"></a><a href="#int"><small>int</small></a> gpioWrite_Bits_32_53_Set<small>(<a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Sets GPIO 32-53 if the corresponding bit (0-21) in bits is set.
-<br><br><code>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;of&nbsp;GPIO&nbsp;to&nbsp;set<br></code><br><br>Returns 0 if OK.
-<br><br><b><small>Example</small></b><br><br><code>//&nbsp;To&nbsp;set&nbsp;(set&nbsp;to&nbsp;1)&nbsp;GPIO&nbsp;32,&nbsp;40,&nbsp;and&nbsp;53<br>gpioWrite_Bits_32_53_Set((1&lt;&lt;(32-32))&nbsp;|&nbsp;(1&lt;&lt;(40-32))&nbsp;|&nbsp;(1&lt;&lt;(53-32)));<br></code><h3><a name="gpioHardwareClock"></a><a href="#int"><small>int</small></a> gpioHardwareClock<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#clkfreq">clkfreq</a>)</small></h3>
-Starts a hardware clock on a GPIO at the specified frequency.
-Frequencies above 30MHz are unlikely to work.
-<br><br><code>&nbsp;&nbsp;&nbsp;gpio:&nbsp;see&nbsp;description<br>clkfreq:&nbsp;0&nbsp;(off)&nbsp;or&nbsp;4689-250M&nbsp;(13184-375M&nbsp;for&nbsp;the&nbsp;BCM2711)<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO, PI_NOT_HCLK_GPIO,
-PI_BAD_HCLK_FREQ,or PI_BAD_HCLK_PASS.
-<br><br>The same clock is available on multiple GPIO. The latest
-frequency setting will be used by all GPIO which share a clock.
-<br><br>The GPIO must be one of the following.
-<br><br><code>4&nbsp;&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;All&nbsp;models<br>5&nbsp;&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br>6&nbsp;&nbsp;&nbsp;clock&nbsp;2&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>20&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>21&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;Rev.2&nbsp;B&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br><br>32&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>34&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>42&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br>43&nbsp;&nbsp;clock&nbsp;2&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>44&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br></code><br><br>Access to clock 1 is protected by a password as its use will likely
-crash the Pi. The password is given by or'ing 0x5A000000 with the
-GPIO number.
-<h3><a name="gpioHardwarePWM"></a><a href="#int"><small>int</small></a> gpioHardwarePWM<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#PWMfreq">PWMfreq</a>, <a href="#unsigned">unsigned</a> <a href="#PWMduty">PWMduty</a>)</small></h3>
-Starts hardware PWM on a GPIO at the specified frequency and dutycycle.
-Frequencies above 30MHz are unlikely to work.
-<br><br>NOTE: Any waveform started by <a href="#gpioWaveTxSend">gpioWaveTxSend</a>, or
-<a href="#gpioWaveChain">gpioWaveChain</a> will be cancelled.
-<br><br>This function is only valid if the pigpio main clock is PCM. The
-main clock defaults to PCM but may be overridden by a call to
-<a href="#gpioCfgClock">gpioCfgClock</a>.
-<br><br><code>&nbsp;&nbsp;&nbsp;gpio:&nbsp;see&nbsp;description<br>PWMfreq:&nbsp;0&nbsp;(off)&nbsp;or&nbsp;1-125M&nbsp;(1-187.5M&nbsp;for&nbsp;the&nbsp;BCM2711)<br>PWMduty:&nbsp;0&nbsp;(off)&nbsp;to&nbsp;1000000&nbsp;(1M)(fully&nbsp;on)<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO, PI_NOT_HPWM_GPIO,
-PI_BAD_HPWM_DUTY, PI_BAD_HPWM_FREQ, or PI_HPWM_ILLEGAL.
-<br><br>The same PWM channel is available on multiple GPIO. The latest
-frequency and dutycycle setting will be used by all GPIO which
-share a PWM channel.
-<br><br>The GPIO must be one of the following.
-<br><br><code>12&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>13&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>18&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;All&nbsp;models<br>19&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br><br>40&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>41&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>45&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>52&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>53&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br></code><br><br>The actual number of steps beween off and fully on is the
-integral part of 250M/PWMfreq (375M/PWMfreq for the BCM2711).
-<br><br>The actual frequency set is 250M/steps (375M/steps for the BCM2711).
-<br><br>There will only be a million steps for a PWMfreq of 250 (375 for
-the BCM2711). Lower frequencies will have more steps and higher
-frequencies will have fewer steps. PWMduty is
-automatically scaled to take this into account.
-<h3><a name="gpioTime"></a><a href="#int"><small>int</small></a> gpioTime<small>(<a href="#unsigned">unsigned</a> <a href="#timetype">timetype</a>, <a href="#int">int</a> <a href="#*seconds">*seconds</a>, <a href="#int">int</a> <a href="#*micros">*micros</a>)</small></h3>
-Updates the seconds and micros variables with the current time.
-<br><br><code>timetype:&nbsp;0&nbsp;(relative),&nbsp;1&nbsp;(absolute)<br>&nbsp;seconds:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;an&nbsp;int&nbsp;to&nbsp;hold&nbsp;seconds<br>&nbsp;&nbsp;micros:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;an&nbsp;int&nbsp;to&nbsp;hold&nbsp;microseconds<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_TIMETYPE.
-<br><br>If timetype is PI_TIME_ABSOLUTE updates seconds and micros with the
-number of seconds and microseconds since the epoch (1st January 1970).
-<br><br>If timetype is PI_TIME_RELATIVE updates seconds and micros with the
-number of seconds and microseconds since the library was initialised.
-<br><br><b><small>Example</small></b><br><br><code>int&nbsp;secs,&nbsp;mics;<br><br>//&nbsp;print&nbsp;the&nbsp;number&nbsp;of&nbsp;seconds&nbsp;since&nbsp;the&nbsp;library&nbsp;was&nbsp;started<br>gpioTime(PI_TIME_RELATIVE,&nbsp;&secs,&nbsp;&mics);<br>printf("library&nbsp;started&nbsp;%d.%03d&nbsp;seconds&nbsp;ago",&nbsp;secs,&nbsp;mics/1000);<br></code><h3><a name="gpioSleep"></a><a href="#int"><small>int</small></a> gpioSleep<small>(<a href="#unsigned">unsigned</a> <a href="#timetype">timetype</a>, <a href="#int">int</a> <a href="#seconds">seconds</a>, <a href="#int">int</a> <a href="#micros">micros</a>)</small></h3>
-Sleeps for the number of seconds and microseconds specified by seconds
-and micros.
-<br><br><code>timetype:&nbsp;0&nbsp;(relative),&nbsp;1&nbsp;(absolute)<br>&nbsp;seconds:&nbsp;seconds&nbsp;to&nbsp;sleep<br>&nbsp;&nbsp;micros:&nbsp;microseconds&nbsp;to&nbsp;sleep<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_TIMETYPE, PI_BAD_SECONDS,
-or PI_BAD_MICROS.
-<br><br>If timetype is PI_TIME_ABSOLUTE the sleep ends when the number of seconds
-and microseconds since the epoch (1st January 1970) has elapsed. System
-clock changes are taken into account.
-<br><br>If timetype is PI_TIME_RELATIVE the sleep is for the specified number
-of seconds and microseconds. System clock changes do not effect the
-sleep length.
-<br><br>For short delays (say, 50 microseonds or less) use <a href="#gpioDelay">gpioDelay</a>.
-<br><br><b><small>Example</small></b><br><br><code>gpioSleep(PI_TIME_RELATIVE,&nbsp;2,&nbsp;500000);&nbsp;//&nbsp;sleep&nbsp;for&nbsp;2.5&nbsp;seconds<br><br>gpioSleep(PI_TIME_RELATIVE,&nbsp;0,&nbsp;100000);&nbsp;//&nbsp;sleep&nbsp;for&nbsp;0.1&nbsp;seconds<br><br>gpioSleep(PI_TIME_RELATIVE,&nbsp;60,&nbsp;0);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;sleep&nbsp;for&nbsp;one&nbsp;minute<br></code><h3><a name="gpioDelay"></a><a href="#uint32_t"><small>uint32_t</small></a> gpioDelay<small>(<a href="#uint32_t">uint32_t</a> <a href="#micros">micros</a>)</small></h3>
-Delays for at least the number of microseconds specified by micros.
-<br><br><code>micros:&nbsp;the&nbsp;number&nbsp;of&nbsp;microseconds&nbsp;to&nbsp;sleep<br></code><br><br>Returns the actual length of the delay in microseconds.
-<br><br>Delays of 100 microseconds or less use busy waits.
-<h3><a name="gpioTick"></a><a href="#uint32_t"><small>uint32_t</small></a> gpioTick<small>(void)</small></h3>
-Returns the current system tick.
-<br><br>Tick is the number of microseconds since system boot.
-<br><br>As tick is an unsigned 32 bit quantity it wraps around after
-2^32 microseconds, which is approximately 1 hour 12 minutes.
-<br><br>You don't need to worry about the wrap around as long as you
-take a tick (uint32_t) from another tick, i.e. the following
-code will always provide the correct difference.
-<br><br><b><small>Example</small></b><br><br><code>uint32_t&nbsp;startTick,&nbsp;endTick;<br>int&nbsp;diffTick;<br><br>startTick&nbsp;=&nbsp;gpioTick();<br><br>//&nbsp;do&nbsp;some&nbsp;processing<br><br>endTick&nbsp;=&nbsp;gpioTick();<br><br>diffTick&nbsp;=&nbsp;endTick&nbsp;-&nbsp;startTick;<br><br>printf("some&nbsp;processing&nbsp;took&nbsp;%d&nbsp;microseconds",&nbsp;diffTick);<br></code><h3><a name="gpioHardwareRevision"></a><a href="#unsigned"><small>unsigned</small></a> gpioHardwareRevision<small>(void)</small></h3>
-Returns the hardware revision.
-<br><br>If the hardware revision can not be found or is not a valid hexadecimal
-number the function returns 0.
-<br><br>The hardware revision is the last few characters on the Revision line of
-/proc/cpuinfo.
-<br><br>The revision number can be used to determine the assignment of GPIO
-to pins (see <a href="#gpio">gpio</a>).
-<br><br>There are at least three types of board.
-<br><br>Type 1 boards have hardware revision numbers of 2 and 3.
-<br><br>Type 2 boards have hardware revision numbers of 4, 5, 6, and 15.
-<br><br>Type 3 boards have hardware revision numbers of 16 or greater.
-<br><br>for "Revision : 0002" the function returns 2.<br>
-for "Revision : 000f" the function returns 15.<br>
-for "Revision : 000g" the function returns 0.
-<h3><a name="gpioVersion"></a><a href="#unsigned"><small>unsigned</small></a> gpioVersion<small>(void)</small></h3>
-Returns the pigpio version.
-<h3><a name="gpioGetPad"></a><a href="#int"><small>int</small></a> gpioGetPad<small>(<a href="#unsigned">unsigned</a> <a href="#pad">pad</a>)</small></h3>
-This function returns the pad drive strength in mA.
-<br><br><code>pad:&nbsp;0-2,&nbsp;the&nbsp;pad&nbsp;to&nbsp;get<br></code><br><br>Returns the pad drive strength if OK, otherwise PI_BAD_PAD.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>strength&nbsp;=&nbsp;gpioGetPad(1);&nbsp;//&nbsp;get&nbsp;pad&nbsp;1&nbsp;strength<br></code><h3><a name="gpioSetPad"></a><a href="#int"><small>int</small></a> gpioSetPad<small>(<a href="#unsigned">unsigned</a> <a href="#pad">pad</a>, <a href="#unsigned">unsigned</a> <a href="#padStrength">padStrength</a>)</small></h3>
-This function sets the pad drive strength in mA.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pad:&nbsp;0-2,&nbsp;the&nbsp;pad&nbsp;to&nbsp;set<br>padStrength:&nbsp;1-16&nbsp;mA<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_PAD, or PI_BAD_STRENGTH.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>gpioSetPad(0,&nbsp;16);&nbsp;//&nbsp;set&nbsp;pad&nbsp;0&nbsp;strength&nbsp;to&nbsp;16&nbsp;mA<br></code><h3><a name="eventMonitor"></a><a href="#int"><small>int</small></a> eventMonitor<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-This function selects the events to be reported on a previously
-opened handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#gpioNotifyOpen">gpioNotifyOpen</a><br>&nbsp;&nbsp;bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;indicating&nbsp;the&nbsp;events&nbsp;of&nbsp;interest<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<br><br>A report is sent each time an event is triggered providing the
-corresponding bit in bits is set.
-<br><br>See <a href="#gpioNotifyBegin">gpioNotifyBegin</a> for the notification format.
-<br><br><b><small>Example</small></b><br><br><code>//&nbsp;Start&nbsp;reporting&nbsp;events&nbsp;3,&nbsp;6,&nbsp;and&nbsp;7.<br><br>//&nbsp;&nbsp;bit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;76543210<br>//&nbsp;(0xC8&nbsp;=&nbsp;0b11001000)<br><br>eventMonitor(h,&nbsp;0xC8);<br></code><h3><a name="eventSetFunc"></a><a href="#int"><small>int</small></a> eventSetFunc<small>(<a href="#unsigned">unsigned</a> <a href="#event">event</a>, <a href="#eventFunc_t">eventFunc_t</a> <a href="#f">f</a>)</small></h3>
-Registers a function to be called (a callback) when the specified
-event occurs.
-<br><br><code>event:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_EVENT_ID.
-<br><br>One function may be registered per event.
-<br><br>The function is passed the event, and the tick.
-<br><br>The callback may be cancelled by passing NULL as the function.
-<h3><a name="eventSetFuncEx"></a><a href="#int"><small>int</small></a> eventSetFuncEx<small>(<a href="#unsigned">unsigned</a> <a href="#event">event</a>, <a href="#eventFuncEx_t">eventFuncEx_t</a> <a href="#f">f</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-Registers a function to be called (a callback) when the specified
-event occurs.
-<br><br><code>&nbsp;&nbsp;&nbsp;event:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function<br>userdata:&nbsp;pointer&nbsp;to&nbsp;arbitrary&nbsp;user&nbsp;data<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_EVENT_ID.
-<br><br>One function may be registered per event.
-<br><br>The function is passed the event, the tick, and the ueserdata pointer.
-<br><br>The callback may be cancelled by passing NULL as the function.
-<br><br>Only one of <a href="#eventSetFunc">eventSetFunc</a> or <a href="#eventSetFuncEx">eventSetFuncEx</a> can be
-registered per event.
-<h3><a name="eventTrigger"></a><a href="#int"><small>int</small></a> eventTrigger<small>(<a href="#unsigned">unsigned</a> <a href="#event">event</a>)</small></h3>
-This function signals the occurrence of an event.
-<br><br><code>event:&nbsp;0-31,&nbsp;the&nbsp;event<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_EVENT_ID.
-<br><br>An event is a signal used to inform one or more consumers
-to start an action. Each consumer which has registered an interest
-in the event (e.g. by calling <a href="#eventSetFunc">eventSetFunc</a>) will be informed by
-a callback.
-<br><br>One event, PI_EVENT_BSC (31) is predefined. This event is
-auto generated on BSC slave activity.
-<br><br>The meaning of other events is arbitrary.
-<br><br>Note that other than its id and its tick there is no data associated
-with an event.
-<h3><a name="shell"></a><a href="#int"><small>int</small></a> shell<small>(<a href="#char">char</a> <a href="#*scriptName">*scriptName</a>, <a href="#char">char</a> <a href="#*scriptString">*scriptString</a>)</small></h3>
-This function uses the system call to execute a shell script
-with the given string as its parameter.
-<br><br><code>&nbsp;&nbsp;scriptName:&nbsp;the&nbsp;name&nbsp;of&nbsp;the&nbsp;script,&nbsp;only&nbsp;alphanumeric&nbsp;characters,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'-'&nbsp;and&nbsp;'_'&nbsp;are&nbsp;allowed&nbsp;in&nbsp;the&nbsp;name<br>scriptString:&nbsp;the&nbsp;string&nbsp;to&nbsp;pass&nbsp;to&nbsp;the&nbsp;script<br></code><br><br>The exit status of the system call is returned if OK, otherwise
-PI_BAD_SHELL_STATUS.
-<br><br>scriptName must exist in /opt/pigpio/cgi and must be executable.
-<br><br>The returned exit status is normally 256 times that set by the
-shell script exit function. If the script can't be found 32512 will
-be returned.
-<br><br>The following table gives some example returned statuses.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Script exit status</td><td>Returned system call status</td></tr><tr><td>1</td><td>256</td></tr><tr><td>5</td><td>1280</td></tr><tr><td>10</td><td>2560</td></tr><tr><td>200</td><td>51200</td></tr><tr><td>script not found</td><td>32512</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>//&nbsp;pass&nbsp;two&nbsp;parameters,&nbsp;hello&nbsp;and&nbsp;world<br>status&nbsp;=&nbsp;shell("scr1",&nbsp;"hello&nbsp;world");<br><br>//&nbsp;pass&nbsp;three&nbsp;parameters,&nbsp;hello,&nbsp;string&nbsp;with&nbsp;spaces,&nbsp;and&nbsp;world<br>status&nbsp;=&nbsp;shell("scr1",&nbsp;"hello&nbsp;'string&nbsp;with&nbsp;spaces'&nbsp;world");<br><br>//&nbsp;pass&nbsp;one&nbsp;parameter,&nbsp;hello&nbsp;string&nbsp;with&nbsp;spaces&nbsp;world<br>status&nbsp;=&nbsp;shell("scr1",&nbsp;"\"hello&nbsp;string&nbsp;with&nbsp;spaces&nbsp;world\"");<br></code><h3><a name="fileOpen"></a><a href="#int"><small>int</small></a> fileOpen<small>(<a href="#char">char</a> <a href="#*file">*file</a>, <a href="#unsigned">unsigned</a> <a href="#mode">mode</a>)</small></h3>
-This function returns a handle to a file opened in a specified mode.
-<br><br><code>file:&nbsp;the&nbsp;file&nbsp;to&nbsp;open<br>mode:&nbsp;the&nbsp;file&nbsp;open&nbsp;mode<br></code><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_NO_HANDLE, PI_NO_FILE_ACCESS,
-PI_BAD_FILE_MODE, PI_FILE_OPEN_FAILED, or PI_FILE_IS_A_DIR.
-<br><br>File
-<br><br>A file may only be opened if permission is granted by an entry in
-/opt/pigpio/access. This is intended to allow remote access to files
-in a more or less controlled manner.
-<br><br>Each entry in /opt/pigpio/access takes the form of a file path
-which may contain wildcards followed by a single letter permission.
-The permission may be R for read, W for write, U for read/write,
-and N for no access.
-<br><br>Where more than one entry matches a file the most specific rule
-applies. If no entry matches a file then access is denied.
-<br><br>Suppose /opt/pigpio/access contains the following entries
-<br><br><code>/home/*&nbsp;n<br>/home/pi/shared/dir_1/*&nbsp;w<br>/home/pi/shared/dir_2/*&nbsp;r<br>/home/pi/shared/dir_3/*&nbsp;u<br>/home/pi/shared/dir_1/file.txt&nbsp;n<br></code><br><br>Files may be written in directory dir_1 with the exception
-of file.txt.
-<br><br>Files may be read in directory dir_2.
-<br><br>Files may be read and written in directory dir_3.
-<br><br>If a directory allows read, write, or read/write access then files may
-be created in that directory.
-<br><br>In an attempt to prevent risky permissions the following paths are
-ignored in /opt/pigpio/access.
-<br><br><code>a&nbsp;path&nbsp;containing&nbsp;..<br>a&nbsp;path&nbsp;containing&nbsp;only&nbsp;wildcards&nbsp;(*?)<br>a&nbsp;path&nbsp;containing&nbsp;less&nbsp;than&nbsp;two&nbsp;non-wildcard&nbsp;parts<br></code><br><br>Mode
-<br><br>The mode may have the following values.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Macro</td><td>Value</td><td>Meaning</td></tr><tr><td>PI_FILE_READ</td><td>1</td><td>open file for reading</td></tr><tr><td>PI_FILE_WRITE</td><td>2</td><td>open file for writing</td></tr><tr><td>PI_FILE_RW</td><td>3</td><td>open file for reading and writing</td></tr></tbody></table><br><br>The following values may be or'd into the mode.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Macro</td><td>Value</td><td>Meaning</td></tr><tr><td>PI_FILE_APPEND</td><td>4</td><td>Writes append data to the end of the file</td></tr><tr><td>PI_FILE_CREATE</td><td>8</td><td>The file is created if it doesn't exist</td></tr><tr><td>PI_FILE_TRUNC</td><td>16</td><td>The file is truncated</td></tr></tbody></table><br><br>Newly created files are owned by root with permissions owner read and write.
-<br><br><b><small>Example</small></b><br><br><code>#include&nbsp;&lt;stdio.h&gt;<br>#include&nbsp;&lt;pigpio.h&gt;<br><br>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;*argv[])<br>{<br>&nbsp;&nbsp;&nbsp;int&nbsp;handle,&nbsp;c;<br>&nbsp;&nbsp;&nbsp;char&nbsp;buf[60000];<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(gpioInitialise()&nbsp;&lt;&nbsp;0)&nbsp;return&nbsp;1;<br><br>&nbsp;&nbsp;&nbsp;//&nbsp;assumes&nbsp;/opt/pigpio/access&nbsp;contains&nbsp;the&nbsp;following&nbsp;line<br>&nbsp;&nbsp;&nbsp;//&nbsp;/ram/*.c&nbsp;r<br><br>&nbsp;&nbsp;&nbsp;handle&nbsp;=&nbsp;fileOpen("/ram/pigpio.c",&nbsp;PI_FILE_READ);<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(handle&nbsp;&gt;=&nbsp;0)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;((c=fileRead(handle,&nbsp;buf,&nbsp;sizeof(buf)-1)))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf[c]&nbsp;=&nbsp;0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("%s",&nbsp;buf);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fileClose(handle);<br>&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;gpioTerminate();<br>}<br></code><h3><a name="fileClose"></a><a href="#int"><small>int</small></a> fileClose<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This function closes the file associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#fileOpen">fileOpen</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<br><br><b><small>Example</small></b><br><br><code>fileClose(h);<br></code><h3><a name="fileWrite"></a><a href="#int"><small>int</small></a> fileWrite<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function writes count bytes from buf to the the file
-associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#fileOpen">fileOpen</a><br>&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;array&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM,
-PI_FILE_NOT_WOPEN, or PI_BAD_FILE_WRITE.
-<br><br><b><small>Example</small></b><br><br><code>status&nbsp;=&nbsp;fileWrite(h,&nbsp;buf,&nbsp;count);<br>if&nbsp;(status&nbsp;==&nbsp;0)<br>{<br>&nbsp;&nbsp;&nbsp;//&nbsp;okay<br>}<br>else<br>{<br>&nbsp;&nbsp;&nbsp;//&nbsp;error<br>}<br></code><h3><a name="fileRead"></a><a href="#int"><small>int</small></a> fileRead<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function reads up to count bytes from the the file
-associated with handle and writes them to buf.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#fileOpen">fileOpen</a><br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data<br>&nbsp;count:&nbsp;the&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read<br></code><br><br>Returns the number of bytes read (&gt;=0) if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, PI_FILE_NOT_ROPEN, or PI_BAD_FILE_WRITE.
-<br><br><b><small>Example</small></b><br><br><code>if&nbsp;(fileRead(h,&nbsp;buf,&nbsp;sizeof(buf))&nbsp;&gt;&nbsp;0)<br>{<br>&nbsp;&nbsp;&nbsp;//&nbsp;process&nbsp;read&nbsp;data<br>}<br></code><h3><a name="fileSeek"></a><a href="#int"><small>int</small></a> fileSeek<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#int32_t">int32_t</a> <a href="#seekOffset">seekOffset</a>, <a href="#int">int</a> <a href="#seekFrom">seekFrom</a>)</small></h3>
-This function seeks to a position within the file associated
-with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#fileOpen">fileOpen</a><br>seekOffset:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;move.&nbsp;&nbsp;Positive&nbsp;offsets<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;move&nbsp;forward,&nbsp;negative&nbsp;offsets&nbsp;backwards.<br>&nbsp;&nbsp;seekFrom:&nbsp;one&nbsp;of&nbsp;PI_FROM_START&nbsp;(0),&nbsp;PI_FROM_CURRENT&nbsp;(1),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or&nbsp;PI_FROM_END&nbsp;(2)<br></code><br><br>Returns the new byte position within the file (&gt;=0) if OK, otherwise PI_BAD_HANDLE, or PI_BAD_FILE_SEEK.
-<br><br><b><small>Example</small></b><br><br><code>fileSeek(0,&nbsp;20,&nbsp;PI_FROM_START);&nbsp;//&nbsp;Seek&nbsp;to&nbsp;start&nbsp;plus&nbsp;20<br><br>size&nbsp;=&nbsp;fileSeek(0,&nbsp;0,&nbsp;PI_FROM_END);&nbsp;//&nbsp;Seek&nbsp;to&nbsp;end,&nbsp;return&nbsp;size<br><br>pos&nbsp;=&nbsp;fileSeek(0,&nbsp;0,&nbsp;PI_FROM_CURRENT);&nbsp;//&nbsp;Return&nbsp;current&nbsp;position<br></code><h3><a name="fileList"></a><a href="#int"><small>int</small></a> fileList<small>(<a href="#char">char</a> <a href="#*fpat">*fpat</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function returns a list of files which match a pattern. The
-pattern may contain wildcards.
-<br><br><code>&nbsp;fpat:&nbsp;file&nbsp;pattern&nbsp;to&nbsp;match<br>&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;matching&nbsp;file&nbsp;names<br>count:&nbsp;the&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read<br></code><br><br>Returns the number of returned bytes if OK, otherwise PI_NO_FILE_ACCESS,
-or PI_NO_FILE_MATCH.
-<br><br>The pattern must match an entry in /opt/pigpio/access. The pattern
-may contain wildcards. See <a href="#fileOpen">fileOpen</a>.
-<br><br>NOTE
-<br><br>The returned value is not the number of files, it is the number
-of bytes in the buffer. The file names are separated by newline
-characters.
-<br><br><b><small>Example</small></b><br><br><code>#include&nbsp;&lt;stdio.h&gt;<br>#include&nbsp;&lt;pigpio.h&gt;<br><br>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;*argv[])<br>{<br>&nbsp;&nbsp;&nbsp;int&nbsp;c;<br>&nbsp;&nbsp;&nbsp;char&nbsp;buf[1000];<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(gpioInitialise()&nbsp;&lt;&nbsp;0)&nbsp;return&nbsp;1;<br><br>&nbsp;&nbsp;&nbsp;//&nbsp;assumes&nbsp;/opt/pigpio/access&nbsp;contains&nbsp;the&nbsp;following&nbsp;line<br>&nbsp;&nbsp;&nbsp;//&nbsp;/ram/*.c&nbsp;r<br><br>&nbsp;&nbsp;&nbsp;c&nbsp;=&nbsp;fileList("/ram/p*.c",&nbsp;buf,&nbsp;sizeof(buf));<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(c&nbsp;&gt;=&nbsp;0)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;terminate&nbsp;string<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf[c]&nbsp;=&nbsp;0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("%s",&nbsp;buf);<br>&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;gpioTerminate();<br>}<br></code><h3><a name="gpioCfgBufferSize"></a><a href="#int"><small>int</small></a> gpioCfgBufferSize<small>(<a href="#unsigned">unsigned</a> <a href="#cfgMillis">cfgMillis</a>)</small></h3>
-Configures pigpio to buffer cfgMillis milliseconds of GPIO samples.
-<br><br>This function is only effective if called before <a href="#gpioInitialise">gpioInitialise</a>.
-<br><br><code>cfgMillis:&nbsp;100-10000<br></code><br><br>The default setting is 120 milliseconds.
-<br><br>The intention is to allow for bursts of data and protection against
-other processes hogging cpu time.
-<br><br>I haven't seen a process locked out for more than 100 milliseconds.
-<br><br>Making the buffer bigger uses a LOT of memory at the more frequent
-sampling rates as shown in the following table in MBs.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buffer&nbsp;milliseconds<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;120&nbsp;250&nbsp;500&nbsp;1sec&nbsp;2sec&nbsp;4sec&nbsp;8sec<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16&nbsp;&nbsp;31&nbsp;&nbsp;55&nbsp;&nbsp;107&nbsp;&nbsp;---&nbsp;&nbsp;---&nbsp;&nbsp;---<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10&nbsp;&nbsp;18&nbsp;&nbsp;31&nbsp;&nbsp;&nbsp;55&nbsp;&nbsp;107&nbsp;&nbsp;---&nbsp;&nbsp;---<br>sample&nbsp;&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8&nbsp;&nbsp;12&nbsp;&nbsp;18&nbsp;&nbsp;&nbsp;31&nbsp;&nbsp;&nbsp;55&nbsp;&nbsp;107&nbsp;&nbsp;---<br>&nbsp;rate&nbsp;&nbsp;&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8&nbsp;&nbsp;10&nbsp;&nbsp;14&nbsp;&nbsp;&nbsp;24&nbsp;&nbsp;&nbsp;45&nbsp;&nbsp;&nbsp;87&nbsp;&nbsp;---<br>&nbsp;(us)&nbsp;&nbsp;&nbsp;&nbsp;8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6&nbsp;&nbsp;&nbsp;8&nbsp;&nbsp;12&nbsp;&nbsp;&nbsp;18&nbsp;&nbsp;&nbsp;31&nbsp;&nbsp;&nbsp;55&nbsp;&nbsp;107<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6&nbsp;&nbsp;&nbsp;8&nbsp;&nbsp;10&nbsp;&nbsp;&nbsp;14&nbsp;&nbsp;&nbsp;24&nbsp;&nbsp;&nbsp;45&nbsp;&nbsp;&nbsp;87<br></code><h3><a name="gpioCfgClock"></a><a href="#int"><small>int</small></a> gpioCfgClock<small>(<a href="#unsigned">unsigned</a> <a href="#cfgMicros">cfgMicros</a>, <a href="#unsigned">unsigned</a> <a href="#cfgPeripheral">cfgPeripheral</a>, <a href="#unsigned">unsigned</a> <a href="#cfgSource">cfgSource</a>)</small></h3>
-Configures pigpio to use a particular sample rate timed by a specified
-peripheral.
-<br><br>This function is only effective if called before <a href="#gpioInitialise">gpioInitialise</a>.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;cfgMicros:&nbsp;1,&nbsp;2,&nbsp;4,&nbsp;5,&nbsp;8,&nbsp;10<br>cfgPeripheral:&nbsp;0&nbsp;(PWM),&nbsp;1&nbsp;(PCM)<br>&nbsp;&nbsp;&nbsp;&nbsp;cfgSource:&nbsp;deprecated,&nbsp;value&nbsp;is&nbsp;ignored<br></code><br><br>The timings are provided by the specified peripheral (PWM or PCM).
-<br><br>The default setting is 5 microseconds using the PCM peripheral.
-<br><br>The approximate CPU percentage used for each sample rate is:
-<br><br><code>sample&nbsp;&nbsp;cpu<br>&nbsp;rate&nbsp;&nbsp;&nbsp;&nbsp;%<br><br>&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;25<br>&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16<br>&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;11<br>&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10<br>&nbsp;&nbsp;8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;15<br>&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;14<br></code><br><br>A sample rate of 5 microseconds seeems to be the sweet spot.
-<h3><a name="gpioCfgDMAchannel"></a><a href="#int"><small>int</small></a> gpioCfgDMAchannel<small>(<a href="#unsigned">unsigned</a> <a href="#DMAchannel">DMAchannel</a>)</small></h3>
-Configures pigpio to use the specified DMA channel.
-<br><br>This function is only effective if called before <a href="#gpioInitialise">gpioInitialise</a>.
-<br><br><code>DMAchannel:&nbsp;0-14<br></code><br><br>The default setting is to use channel 14.
-<h3><a name="gpioCfgDMAchannels"></a><a href="#int"><small>int</small></a> gpioCfgDMAchannels<small>(<a href="#unsigned">unsigned</a> <a href="#primaryChannel">primaryChannel</a>, <a href="#unsigned">unsigned</a> <a href="#secondaryChannel">secondaryChannel</a>)</small></h3>
-Configures pigpio to use the specified DMA channels.
-<br><br>This function is only effective if called before <a href="#gpioInitialise">gpioInitialise</a>.
-<br><br><code>&nbsp;&nbsp;primaryChannel:&nbsp;0-14<br>secondaryChannel:&nbsp;0-14<br></code><br><br>The default setting depends on whether the Pi has a BCM2711 chip or
-not (currently only the Pi4B has a BCM2711).
-<br><br>The default setting for a non-BCM2711 is to use channel 14 for the
-primary channel and channel 6 for the secondary channel.
-<br><br>The default setting for a BCM2711 is to use channel 7 for the
-primary channel and channel 6 for the secondary channel.
-<br><br>The secondary channel is only used for the transmission of waves.
-<br><br>If possible use one of channels 0 to 6 for the secondary channel
-(a full channel).
-<br><br>A full channel only requires one DMA control block regardless of the
-length of a pulse delay. Channels 7 to 14 (lite channels) require
-one DMA control block for each 16383 microseconds of delay. I.e.
-a 10 second pulse delay requires one control block on a full channel
-and 611 control blocks on a lite channel.
-<h3><a name="gpioCfgPermissions"></a><a href="#int"><small>int</small></a> gpioCfgPermissions<small>(<a href="#uint64_t">uint64_t</a> <a href="#updateMask">updateMask</a>)</small></h3>
-Configures pigpio to restrict GPIO updates via the socket or pipe
-interfaces to the GPIO specified by the mask. Programs directly
-calling the pigpio library (i.e. linked with -lpigpio are not
-affected). A GPIO update is a write to a GPIO or a GPIO mode
-change or any function which would force such an action.
-<br><br>This function is only effective if called before <a href="#gpioInitialise">gpioInitialise</a>.
-<br><br><code>updateMask:&nbsp;bit&nbsp;(1&lt;&lt;n)&nbsp;is&nbsp;set&nbsp;for&nbsp;each&nbsp;GPIO&nbsp;n&nbsp;which&nbsp;may&nbsp;be&nbsp;updated<br></code><br><br>The default setting depends upon the Pi model. The user GPIO are
-added to the mask.
-<br><br>If the board revision is not recognised then GPIO 2-27 are allowed.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Unknown board</td><td>PI_DEFAULT_UPDATE_MASK_UNKNOWN</td><td>0x0FFFFFFC<br></td></tr><tr><td>Type 1 board</td><td>PI_DEFAULT_UPDATE_MASK_B1</td><td>0x03E6CF93<br></td></tr><tr><td>Type 2 board</td><td>PI_DEFAULT_UPDATE_MASK_A_B2</td><td>0xFBC6CF9C</td></tr><tr><td>Type 3 board</td><td>PI_DEFAULT_UPDATE_MASK_R3</td><td>0x0FFFFFFC</td></tr></tbody></table><h3><a name="gpioCfgSocketPort"></a><a href="#int"><small>int</small></a> gpioCfgSocketPort<small>(<a href="#unsigned">unsigned</a> <a href="#port">port</a>)</small></h3>
-Configures pigpio to use the specified socket port.
-<br><br>This function is only effective if called before <a href="#gpioInitialise">gpioInitialise</a>.
-<br><br><code>port:&nbsp;1024-32000<br></code><br><br>The default setting is to use port 8888.
-<h3><a name="gpioCfgInterfaces"></a><a href="#int"><small>int</small></a> gpioCfgInterfaces<small>(<a href="#unsigned">unsigned</a> <a href="#ifFlags">ifFlags</a>)</small></h3>
-Configures pigpio support of the fifo and socket interfaces.
-<br><br>This function is only effective if called before <a href="#gpioInitialise">gpioInitialise</a>.
-<br><br><code>ifFlags:&nbsp;0-7<br></code><br><br>The default setting (0) is that both interfaces are enabled.
-<br><br>Or in PI_DISABLE_FIFO_IF to disable the pipe interface.
-<br><br>Or in PI_DISABLE_SOCK_IF to disable the socket interface.
-<br><br>Or in PI_LOCALHOST_SOCK_IF to disable remote socket
-access (this means that the socket interface is only
-usable from the local Pi).
-<h3><a name="gpioCfgMemAlloc"></a><a href="#int"><small>int</small></a> gpioCfgMemAlloc<small>(<a href="#unsigned">unsigned</a> <a href="#memAllocMode">memAllocMode</a>)</small></h3>
-Selects the method of DMA memory allocation.
-<br><br>This function is only effective if called before <a href="#gpioInitialise">gpioInitialise</a>.
-<br><br><code>memAllocMode:&nbsp;0-2<br></code><br><br>There are two methods of DMA memory allocation. The original method
-uses the /proc/self/pagemap file to allocate bus memory. The new
-method uses the mailbox property interface to allocate bus memory.
-<br><br>Auto will use the mailbox method unless a larger than default buffer
-size is requested with <a href="#gpioCfgBufferSize">gpioCfgBufferSize</a>.
-<h3><a name="gpioCfgNetAddr"></a><a href="#int"><small>int</small></a> gpioCfgNetAddr<small>(<a href="#int">int</a> <a href="#numSockAddr">numSockAddr</a>, <a href="#uint32_t">uint32_t</a> <a href="#*sockAddr">*sockAddr</a>)</small></h3>
-Sets the network addresses which are allowed to talk over the
-socket interface.
-<br><br>This function is only effective if called before <a href="#gpioInitialise">gpioInitialise</a>.
-<br><br><code>numSockAddr:&nbsp;0-256&nbsp;(0&nbsp;means&nbsp;all&nbsp;addresses&nbsp;allowed)<br>&nbsp;&nbsp;&nbsp;sockAddr:&nbsp;an&nbsp;array&nbsp;of&nbsp;permitted&nbsp;network&nbsp;addresses.<br></code><h3><a name="gpioCfgInternals"></a><a href="#int"><small>int</small></a> gpioCfgInternals<small>(<a href="#unsigned">unsigned</a> <a href="#cfgWhat">cfgWhat</a>, <a href="#unsigned">unsigned</a> <a href="#cfgVal">cfgVal</a>)</small></h3>
-Used to tune internal settings.
-<br><br><code>cfgWhat:&nbsp;see&nbsp;source&nbsp;code<br>&nbsp;cfgVal:&nbsp;see&nbsp;source&nbsp;code<br></code><h3><a name="gpioCfgGetInternals"></a><a href="#uint32_t"><small>uint32_t</small></a> gpioCfgGetInternals<small>(void)</small></h3>
-This function returns the current library internal configuration
-settings.
-<h3><a name="gpioCfgSetInternals"></a><a href="#int"><small>int</small></a> gpioCfgSetInternals<small>(<a href="#uint32_t">uint32_t</a> <a href="#cfgVal">cfgVal</a>)</small></h3>
-This function sets the current library internal configuration
-settings.
-<br><br><code>cfgVal:&nbsp;see&nbsp;source&nbsp;code<br></code><h3><a name="gpioCustom1"></a><a href="#int"><small>int</small></a> gpioCustom1<small>(<a href="#unsigned">unsigned</a> <a href="#arg1">arg1</a>, <a href="#unsigned">unsigned</a> <a href="#arg2">arg2</a>, <a href="#char">char</a> <a href="#*argx">*argx</a>, <a href="#unsigned">unsigned</a> <a href="#argc">argc</a>)</small></h3>
-This function is available for user customisation.
-<br><br>It returns a single integer value.
-<br><br><code>arg1:&nbsp;&gt;=0<br>arg2:&nbsp;&gt;=0<br>argx:&nbsp;extra&nbsp;(byte)&nbsp;arguments<br>argc:&nbsp;number&nbsp;of&nbsp;extra&nbsp;arguments<br></code><br><br>Returns &gt;= 0 if OK, less than 0 indicates a user defined error.
-<h3><a name="gpioCustom2"></a><a href="#int"><small>int</small></a> gpioCustom2<small>(<a href="#unsigned">unsigned</a> <a href="#arg1">arg1</a>, <a href="#char">char</a> <a href="#*argx">*argx</a>, <a href="#unsigned">unsigned</a> <a href="#argc">argc</a>, <a href="#char">char</a> <a href="#*retBuf">*retBuf</a>, <a href="#unsigned">unsigned</a> <a href="#retMax">retMax</a>)</small></h3>
-This function is available for user customisation.
-<br><br>It differs from gpioCustom1 in that it returns an array of bytes
-rather than just an integer.
-<br><br>The returned value is an integer indicating the number of returned bytes.
-<code>&nbsp;&nbsp;arg1:&nbsp;&gt;=0<br>&nbsp;&nbsp;argx:&nbsp;extra&nbsp;(byte)&nbsp;arguments<br>&nbsp;&nbsp;argc:&nbsp;number&nbsp;of&nbsp;extra&nbsp;arguments<br>retBuf:&nbsp;buffer&nbsp;for&nbsp;returned&nbsp;bytes<br>retMax:&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;return<br></code><br><br>Returns &gt;= 0 if OK, less than 0 indicates a user defined error.
-<br><br>The number of returned bytes must be retMax or less.
-<h3><a name="rawWaveAddSPI"></a><a href="#int"><small>int</small></a> rawWaveAddSPI<small>(<a href="#rawSPI_t">rawSPI_t</a> <a href="#*spi">*spi</a>, <a href="#unsigned">unsigned</a> <a href="#offset">offset</a>, <a href="#unsigned">unsigned</a> <a href="#spiSS">spiSS</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#spiTxBits">spiTxBits</a>, <a href="#unsigned">unsigned</a> <a href="#spiBitFirst">spiBitFirst</a>, <a href="#unsigned">unsigned</a> <a href="#spiBitLast">spiBitLast</a>, <a href="#unsigned">unsigned</a> <a href="#spiBits">spiBits</a>)</small></h3>
-This function adds a waveform representing SPI data to the
-existing waveform (if any).
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;spi:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;a&nbsp;spi&nbsp;object<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;offset:&nbsp;microseconds&nbsp;from&nbsp;the&nbsp;start&nbsp;of&nbsp;the&nbsp;waveform<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;spiSS:&nbsp;the&nbsp;slave&nbsp;select&nbsp;GPIO<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;bits&nbsp;to&nbsp;transmit,&nbsp;most&nbsp;significant&nbsp;bit&nbsp;first<br>&nbsp;&nbsp;spiTxBits:&nbsp;the&nbsp;number&nbsp;of&nbsp;bits&nbsp;to&nbsp;write<br>spiBitFirst:&nbsp;the&nbsp;first&nbsp;bit&nbsp;to&nbsp;read<br>&nbsp;spiBitLast:&nbsp;the&nbsp;last&nbsp;bit&nbsp;to&nbsp;read<br>&nbsp;&nbsp;&nbsp;&nbsp;spiBits:&nbsp;the&nbsp;number&nbsp;of&nbsp;bits&nbsp;to&nbsp;transfer<br></code><br><br>Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_BAD_USER_GPIO, PI_BAD_SER_OFFSET, or PI_TOO_MANY_PULSES.
-<br><br>Not intended for general use.
-<h3><a name="rawWaveAddGeneric"></a><a href="#int"><small>int</small></a> rawWaveAddGeneric<small>(<a href="#unsigned">unsigned</a> <a href="#numPulses">numPulses</a>, <a href="#rawWave_t">rawWave_t</a> <a href="#*pulses">*pulses</a>)</small></h3>
-This function adds a number of pulses to the current waveform.
-<br><br><code>numPulses:&nbsp;the&nbsp;number&nbsp;of&nbsp;pulses<br>&nbsp;&nbsp;&nbsp;pulses:&nbsp;the&nbsp;array&nbsp;containing&nbsp;the&nbsp;pulses<br></code><br><br>Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_TOO_MANY_PULSES.
-<br><br>The advantage of this function over gpioWaveAddGeneric is that it
-allows the setting of the flags field.
-<br><br>The pulses are interleaved in time order within the existing waveform
-(if any).
-<br><br>Merging allows the waveform to be built in parts, that is the settings
-for GPIO#1 can be added, and then GPIO#2 etc.
-<br><br>If the added waveform is intended to start after or within the existing
-waveform then the first pulse should consist of a delay.
-<br><br>Not intended for general use.
-<h3><a name="rawWaveCB"></a><a href="#unsigned"><small>unsigned</small></a> rawWaveCB<small>(void)</small></h3>
-Returns the number of the cb being currently output.
-<br><br>Not intended for general use.
-<h3><a name="rawWaveCBAdr"></a><a href="#rawCbs_t"><small>rawCbs_t</small></a> *rawWaveCBAdr<small>(<a href="#int">int</a> <a href="#cbNum">cbNum</a>)</small></h3>
-Return the (Linux) address of contol block cbNum.
-<br><br><code>cbNum:&nbsp;the&nbsp;cb&nbsp;of&nbsp;interest<br></code><br><br>Not intended for general use.
-<h3><a name="rawWaveGetOOL"></a><a href="#uint32_t"><small>uint32_t</small></a> rawWaveGetOOL<small>(<a href="#int">int</a> <a href="#pos">pos</a>)</small></h3>
-Gets the OOL parameter stored at pos.
-<br><br><code>pos:&nbsp;the&nbsp;position&nbsp;of&nbsp;interest.<br></code><br><br>Not intended for general use.
-<h3><a name="rawWaveSetOOL"></a><a href="#void"><small>void</small></a> rawWaveSetOOL<small>(<a href="#int">int</a> <a href="#pos">pos</a>, <a href="#uint32_t">uint32_t</a> <a href="#lVal">lVal</a>)</small></h3>
-Sets the OOL parameter stored at pos to value.
-<br><br><code>&nbsp;pos:&nbsp;the&nbsp;position&nbsp;of&nbsp;interest<br>lVal:&nbsp;the&nbsp;value&nbsp;to&nbsp;write<br></code><br><br>Not intended for general use.
-<h3><a name="rawWaveGetOut"></a><a href="#uint32_t"><small>uint32_t</small></a> rawWaveGetOut<small>(<a href="#int">int</a> <a href="#pos">pos</a>)</small></h3>
-Gets the wave output parameter stored at pos.
-<br><br>DEPRECATED: use rawWaveGetOOL instead.
-<br><br><code>pos:&nbsp;the&nbsp;position&nbsp;of&nbsp;interest.<br></code><br><br>Not intended for general use.
-<h3><a name="rawWaveSetOut"></a><a href="#void"><small>void</small></a> rawWaveSetOut<small>(<a href="#int">int</a> <a href="#pos">pos</a>, <a href="#uint32_t">uint32_t</a> <a href="#lVal">lVal</a>)</small></h3>
-Sets the wave output parameter stored at pos to value.
-<br><br>DEPRECATED: use rawWaveSetOOL instead.
-<br><br><code>&nbsp;pos:&nbsp;the&nbsp;position&nbsp;of&nbsp;interest<br>lVal:&nbsp;the&nbsp;value&nbsp;to&nbsp;write<br></code><br><br>Not intended for general use.
-<h3><a name="rawWaveGetIn"></a><a href="#uint32_t"><small>uint32_t</small></a> rawWaveGetIn<small>(<a href="#int">int</a> <a href="#pos">pos</a>)</small></h3>
-Gets the wave input value parameter stored at pos.
-<br><br>DEPRECATED: use rawWaveGetOOL instead.
-<br><br><code>pos:&nbsp;the&nbsp;position&nbsp;of&nbsp;interest<br></code><br><br>Not intended for general use.
-<h3><a name="rawWaveSetIn"></a><a href="#void"><small>void</small></a> rawWaveSetIn<small>(<a href="#int">int</a> <a href="#pos">pos</a>, <a href="#uint32_t">uint32_t</a> <a href="#lVal">lVal</a>)</small></h3>
-Sets the wave input value stored at pos to value.
-<br><br>DEPRECATED: use rawWaveSetOOL instead.
-<br><br><code>&nbsp;pos:&nbsp;the&nbsp;position&nbsp;of&nbsp;interest<br>lVal:&nbsp;the&nbsp;value&nbsp;to&nbsp;write<br></code><br><br>Not intended for general use.
-<h3><a name="rawWaveInfo"></a><a href="#rawWaveInfo_t"><small>rawWaveInfo_t</small></a> rawWaveInfo<small>(<a href="#int">int</a> <a href="#wave_id">wave_id</a>)</small></h3>
-Gets details about the wave with id wave_id.
-<br><br><code>wave_id:&nbsp;the&nbsp;wave&nbsp;of&nbsp;interest<br></code><br><br>Not intended for general use.
-<h3><a name="getBitInBytes"></a><a href="#int"><small>int</small></a> getBitInBytes<small>(<a href="#int">int</a> <a href="#bitPos">bitPos</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#int">int</a> <a href="#numBits">numBits</a>)</small></h3>
-Returns the value of the bit bitPos bits from the start of buf. Returns
-0 if bitPos is greater than or equal to numBits.
-<br><br><code>&nbsp;bitPos:&nbsp;bit&nbsp;index&nbsp;from&nbsp;the&nbsp;start&nbsp;of&nbsp;buf<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;array&nbsp;of&nbsp;bits<br>numBits:&nbsp;number&nbsp;of&nbsp;valid&nbsp;bits&nbsp;in&nbsp;buf<br></code><h3><a name="putBitInBytes"></a><a href="#void"><small>void</small></a> putBitInBytes<small>(<a href="#int">int</a> <a href="#bitPos">bitPos</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#int">int</a> <a href="#bit">bit</a>)</small></h3>
-Sets the bit bitPos bits from the start of buf to bit.
-<br><br><code>bitPos:&nbsp;bit&nbsp;index&nbsp;from&nbsp;the&nbsp;start&nbsp;of&nbsp;buf<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;array&nbsp;of&nbsp;bits<br>&nbsp;&nbsp;&nbsp;bit:&nbsp;0-1,&nbsp;value&nbsp;to&nbsp;set<br></code><h3><a name="time_time"></a><a href="#double"><small>double</small></a> time_time<small>(void)</small></h3>
-Return the current time in seconds since the Epoch.
-<h3><a name="time_sleep"></a><a href="#void"><small>void</small></a> time_sleep<small>(<a href="#double">double</a> <a href="#seconds">seconds</a>)</small></h3>
-Delay execution for a given number of seconds
-<br><br><code>seconds:&nbsp;the&nbsp;number&nbsp;of&nbsp;seconds&nbsp;to&nbsp;sleep<br></code><h3><a name="rawDumpWave"></a><a href="#void"><small>void</small></a> rawDumpWave<small>(void)</small></h3>
-Used to print a readable version of the current waveform to stderr.
-<br><br>Not intended for general use.
-<h3><a name="rawDumpScript"></a><a href="#void"><small>void</small></a> rawDumpScript<small>(<a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>)</small></h3>
-Used to print a readable version of a script to stderr.
-<br><br><code>script_id:&nbsp;&gt;=0,&nbsp;a&nbsp;script_id&nbsp;returned&nbsp;by&nbsp;<a href="#gpioStoreScript">gpioStoreScript</a><br></code><br><br>Not intended for general use.
-<h2>PARAMETERS</h2><h3><a name="active">active</a>: 0-1000000</h3>
-The number of microseconds level changes are reported for once
-a noise filter has been triggered (by <a href="#steady">steady</a> microseconds of
-a stable level).
-<h3><a name="arg1">arg1</a></h3>
-An unsigned argument passed to a user customised function. Its
-meaning is defined by the customiser.
-<h3><a name="arg2">arg2</a></h3>
-An unsigned argument passed to a user customised function. Its
-meaning is defined by the customiser.
-<h3><a name="argc">argc</a></h3>
-The count of bytes passed to a user customised function.
-<h3><a name="*argx">*argx</a></h3>
-A pointer to an array of bytes passed to a user customised function.
-Its meaning and content is defined by the customiser.
-<h3><a name="baud">baud</a></h3>
-The speed of serial communication (I2C, SPI, serial link, waves) in
-bits per second.
-<h3><a name="bit">bit</a></h3>
-A value of 0 or 1.
-<h3><a name="bitPos">bitPos</a></h3>
-A bit position within a byte or word. The least significant bit is
-position 0.
-<h3><a name="bits">bits</a></h3>
-A value used to select GPIO. If bit n of bits is set then GPIO n is
-selected.
-<br><br>A convenient way to set bit n is to or in (1&lt;&lt;n).
-<br><br>e.g. to select bits 5, 9, 23 you could use (1&lt;&lt;5) | (1&lt;&lt;9) | (1&lt;&lt;23).
-<h3><a name="*bsc_xfer">*bsc_xfer</a></h3>
-A pointer to a <a href="#bsc_xfer_t">bsc_xfer_t</a> object used to control a BSC transfer.
-<h3><a name="bsc_xfer_t">bsc_xfer_t</a></h3>
-<code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;control;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Write<br>&nbsp;&nbsp;&nbsp;int&nbsp;rxCnt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Read&nbsp;only<br>&nbsp;&nbsp;&nbsp;char&nbsp;rxBuf[BSC_FIFO_SIZE];&nbsp;//&nbsp;Read&nbsp;only<br>&nbsp;&nbsp;&nbsp;int&nbsp;txCnt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Write<br>&nbsp;&nbsp;&nbsp;char&nbsp;txBuf[BSC_FIFO_SIZE];&nbsp;//&nbsp;Write<br>}&nbsp;bsc_xfer_t;<br></code><h3><a name="*buf">*buf</a></h3>
-A buffer to hold data being sent or being received.
-<h3><a name="bufSize">bufSize</a></h3>
-The size in bytes of a buffer.
-<h3><a name="bVal">bVal</a>: 0-255 (Hex 0x0-0xFF, Octal 0-0377)</h3>
-An 8-bit byte value.
-<h3><a name="cbNum">cbNum</a></h3>
-A number identifying a DMA contol block.
-<h3><a name="cfgMicros">cfgMicros</a></h3>
-The GPIO sample rate in microseconds. The default is 5us, or 200 thousand
-samples per second.
-<h3><a name="cfgMillis">cfgMillis</a>: 100-10000</h3>
-The size of the sample buffer in milliseconds. Generally this should be
-left at the default of 120ms. If you expect intense bursts of signals it
-might be necessary to increase the buffer size.
-<h3><a name="cfgPeripheral">cfgPeripheral</a></h3>
-One of the PWM or PCM peripherals used to pace DMA transfers for timing
-purposes.
-<h3><a name="cfgSource">cfgSource</a></h3>
-Deprecated.
-<h3><a name="cfgVal">cfgVal</a></h3>
-A number specifying the value of a configuration item. See <a href="#cfgWhat">cfgWhat</a>.
-<h3><a name="cfgWhat">cfgWhat</a></h3>
-A number specifying a configuration item.
-<br><br>562484977: print enhanced statistics at termination.<br>
-984762879: set the initial debug level.
-<h3><a name="char">char</a></h3>
-A single character, an 8 bit quantity able to store 0-255.
-<h3><a name="clkfreq">clkfreq</a>: 4689-250M (13184-375M for the BCM2711)</h3>
-The hardware clock frequency.
-<br><br><code>PI_HW_CLK_MIN_FREQ&nbsp;4689<br>PI_HW_CLK_MAX_FREQ&nbsp;250000000<br>PI_HW_CLK_MAX_FREQ_2711&nbsp;375000000<br></code><h3><a name="count">count</a></h3>
-The number of bytes to be transferred in an I2C, SPI, or Serial
-command.
-<h3><a name="CS">CS</a></h3>
-The GPIO used for the slave select signal when bit banging SPI.
-<h3><a name="data_bits">data_bits</a>: 1-32</h3>
-The number of data bits to be used when adding serial data to a
-waveform.
-<br><br><code>PI_MIN_WAVE_DATABITS&nbsp;1<br>PI_MAX_WAVE_DATABITS&nbsp;32<br></code><h3><a name="DMAchannel">DMAchannel</a>: 0-15</h3>
-<code>PI_MIN_DMA_CHANNEL&nbsp;0<br>PI_MAX_DMA_CHANNEL&nbsp;15<br></code><h3><a name="double">double</a></h3>
-A floating point number.
-<h3><a name="dutycycle">dutycycle</a>: 0-range</h3>
-A number representing the ratio of on time to off time for PWM.
-<br><br>The number may vary between 0 and range (default 255) where
-0 is off and range is fully on.
-<h3><a name="edge">edge</a>: 0-2</h3>
-The type of GPIO edge to generate an interrupt. See <a href="#gpioSetISRFunc">gpioSetISRFunc</a>
-and <a href="#gpioSetISRFuncEx">gpioSetISRFuncEx</a>.
-<br><br><code>RISING_EDGE&nbsp;0<br>FALLING_EDGE&nbsp;1<br>EITHER_EDGE&nbsp;2<br></code><h3><a name="event">event</a>: 0-31</h3>
-An event is a signal used to inform one or more consumers
-to start an action.
-<h3><a name="eventFunc_t">eventFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*eventFunc_t)&nbsp;(int&nbsp;event,&nbsp;uint32_t&nbsp;tick);<br></code><h3><a name="eventFuncEx_t">eventFuncEx_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*eventFuncEx_t)<br>&nbsp;&nbsp;&nbsp;(int&nbsp;event,&nbsp;uint32_t&nbsp;tick,&nbsp;void&nbsp;*userdata);<br></code><h3><a name="f">f</a></h3>
-A function.
-<h3><a name="*file">*file</a></h3>
-A full file path. To be accessible the path must match an entry in
-/opt/pigpio/access.
-<h3><a name="*fpat">*fpat</a></h3>
-A file path which may contain wildcards. To be accessible the path
-must match an entry in /opt/pigpio/access.
-<h3><a name="frequency">frequency</a>: &gt;=0</h3>
-The number of times a GPIO is swiched on and off per second. This
-can be set per GPIO and may be as little as 5Hz or as much as
-40KHz. The GPIO will be on for a proportion of the time as defined
-by its dutycycle.
-<h3><a name="gpio">gpio</a></h3>
-A Broadcom numbered GPIO, in the range 0-53.
-<br><br>There are 54 General Purpose Input Outputs (GPIO) named GPIO0 through
-GPIO53.
-<br><br>They are split into two banks. Bank 1 consists of GPIO0 through
-GPIO31. Bank 2 consists of GPIO32 through GPIO53.
-<br><br>All the GPIO which are safe for the user to read and write are in
-bank 1. Not all GPIO in bank 1 are safe though. Type 1 boards
-have 17 safe GPIO. Type 2 boards have 21. Type 3 boards have 26.
-<br><br>See <a href="#gpioHardwareRevision">gpioHardwareRevision</a>.
-<br><br>The user GPIO are marked with an X in the following table.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;1&nbsp;&nbsp;2&nbsp;&nbsp;3&nbsp;&nbsp;4&nbsp;&nbsp;5&nbsp;&nbsp;6&nbsp;&nbsp;7&nbsp;&nbsp;8&nbsp;&nbsp;9&nbsp;10&nbsp;11&nbsp;12&nbsp;13&nbsp;14&nbsp;15<br>Type&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16&nbsp;17&nbsp;18&nbsp;19&nbsp;20&nbsp;21&nbsp;22&nbsp;23&nbsp;24&nbsp;25&nbsp;26&nbsp;27&nbsp;28&nbsp;29&nbsp;30&nbsp;31<br>Type&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-<br>Type&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-<br></code><h3><a name="gpioAlertFunc_t">gpioAlertFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*gpioAlertFunc_t)&nbsp;(int&nbsp;gpio,&nbsp;int&nbsp;level,&nbsp;uint32_t&nbsp;tick);<br></code><h3><a name="gpioAlertFuncEx_t">gpioAlertFuncEx_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*eventFuncEx_t)<br>&nbsp;&nbsp;&nbsp;(int&nbsp;event,&nbsp;int&nbsp;level,&nbsp;uint32_t&nbsp;tick,&nbsp;void&nbsp;*userdata);<br></code><h3><a name="gpioCfg*">gpioCfg*</a></h3>
-These functions are only effective if called before <a href="#gpioInitialise">gpioInitialise</a>.
-<br><br><a href="#gpioCfgBufferSize">gpioCfgBufferSize</a><br>
-<a href="#gpioCfgClock">gpioCfgClock</a><br>
-<a href="#gpioCfgDMAchannel">gpioCfgDMAchannel</a><br>
-<a href="#gpioCfgDMAchannels">gpioCfgDMAchannels</a><br>
-<a href="#gpioCfgPermissions">gpioCfgPermissions</a><br>
-<a href="#gpioCfgInterfaces">gpioCfgInterfaces</a><br>
-<a href="#gpioCfgSocketPort">gpioCfgSocketPort</a><br>
-<a href="#gpioCfgMemAlloc">gpioCfgMemAlloc</a>
-<h3><a name="gpioGetSamplesFunc_t">gpioGetSamplesFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*gpioGetSamplesFunc_t)<br>&nbsp;&nbsp;&nbsp;(const&nbsp;gpioSample_t&nbsp;*samples,&nbsp;int&nbsp;numSamples);<br></code><h3><a name="gpioGetSamplesFuncEx_t">gpioGetSamplesFuncEx_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*gpioGetSamplesFuncEx_t)<br>&nbsp;&nbsp;&nbsp;(const&nbsp;gpioSample_t&nbsp;*samples,&nbsp;int&nbsp;numSamples,&nbsp;void&nbsp;*userdata);<br></code><h3><a name="gpioISRFunc_t">gpioISRFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*gpioISRFunc_t)<br>&nbsp;&nbsp;&nbsp;(int&nbsp;gpio,&nbsp;int&nbsp;level,&nbsp;uint32_t&nbsp;tick);<br></code><h3><a name="gpioISRFuncEx_t">gpioISRFuncEx_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*gpioISRFuncEx_t)<br>&nbsp;&nbsp;&nbsp;(int&nbsp;gpio,&nbsp;int&nbsp;level,&nbsp;uint32_t&nbsp;tick,&nbsp;void&nbsp;*userdata);<br></code><h3><a name="gpioPulse_t">gpioPulse_t</a></h3>
-<code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOn;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOff;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;usDelay;<br>}&nbsp;gpioPulse_t;<br></code><h3><a name="gpioSample_t">gpioSample_t</a></h3>
-<code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;tick;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;level;<br>}&nbsp;gpioSample_t;<br></code><h3><a name="gpioSignalFunc_t">gpioSignalFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*gpioSignalFunc_t)&nbsp;(int&nbsp;signum);<br></code><h3><a name="gpioSignalFuncEx_t">gpioSignalFuncEx_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*gpioSignalFuncEx_t)&nbsp;(int&nbsp;signum,&nbsp;void&nbsp;*userdata);<br></code><h3><a name="gpioThreadFunc_t">gpioThreadFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;*(gpioThreadFunc_t)&nbsp;(void&nbsp;*);<br></code><h3><a name="gpioTimerFunc_t">gpioTimerFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*gpioTimerFunc_t)&nbsp;(void);<br></code><h3><a name="gpioTimerFuncEx_t">gpioTimerFuncEx_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*gpioTimerFuncEx_t)&nbsp;(void&nbsp;*userdata);<br></code><h3><a name="gpioWaveAdd*">gpioWaveAdd*</a></h3>
-One of
-<br><br><a href="#gpioWaveAddNew">gpioWaveAddNew</a><br>
-<a href="#gpioWaveAddGeneric">gpioWaveAddGeneric</a><br>
-<a href="#gpioWaveAddSerial">gpioWaveAddSerial</a>
-<h3><a name="handle">handle</a>: &gt;=0</h3>
-A number referencing an object opened by one of
-<br><br><a href="#fileOpen">fileOpen</a><br>
-<a href="#gpioNotifyOpen">gpioNotifyOpen</a><br>
-<a href="#i2cOpen">i2cOpen</a><br>
-<a href="#serOpen">serOpen</a><br>
-<a href="#spiOpen">spiOpen</a>
-<h3><a name="i2cAddr">i2cAddr</a>: 0-0x7F</h3>
-The address of a device on the I2C bus.
-<h3><a name="i2cBus">i2cBus</a>: &gt;=0</h3>
-An I2C bus number.
-<h3><a name="i2cFlags">i2cFlags</a>: 0</h3>
-Flags which modify an I2C open command. None are currently defined.
-<h3><a name="i2cReg">i2cReg</a>: 0-255</h3>
-A register of an I2C device.
-<h3><a name="ifFlags">ifFlags</a>: 0-3</h3>
-<code>PI_DISABLE_FIFO_IF&nbsp;1<br>PI_DISABLE_SOCK_IF&nbsp;2<br></code><h3><a name="*inBuf">*inBuf</a></h3>
-A buffer used to pass data to a function.
-<h3><a name="inLen">inLen</a></h3>
-The number of bytes of data in a buffer.
-<h3><a name="int">int</a></h3>
-A whole number, negative or positive.
-<h3><a name="int32_t">int32_t</a></h3>
-A 32-bit signed value.
-<h3><a name="invert">invert</a></h3>
-A flag used to set normal or inverted bit bang serial data level logic.
-<h3><a name="level">level</a></h3>
-The level of a GPIO. Low or High.
-<br><br><code>PI_OFF&nbsp;0<br>PI_ON&nbsp;1<br><br>PI_CLEAR&nbsp;0<br>PI_SET&nbsp;1<br><br>PI_LOW&nbsp;0<br>PI_HIGH&nbsp;1<br></code><br><br>There is one exception. If a watchdog expires on a GPIO the level will be
-reported as PI_TIMEOUT. See <a href="#gpioSetWatchdog">gpioSetWatchdog</a>.
-<br><br><code>PI_TIMEOUT&nbsp;2<br></code><h3><a name="lVal">lVal</a>: 0-4294967295 (Hex 0x0-0xFFFFFFFF, Octal 0-37777777777)</h3>
-A 32-bit word value.
-<h3><a name="memAllocMode">memAllocMode</a>: 0-2</h3>
-The DMA memory allocation mode.
-<br><br><code>PI_MEM_ALLOC_AUTO&nbsp;&nbsp;&nbsp;&nbsp;0<br>PI_MEM_ALLOC_PAGEMAP&nbsp;1<br>PI_MEM_ALLOC_MAILBOX&nbsp;2<br></code><h3><a name="*micros">*micros</a></h3>
-A value representing microseconds.
-<h3><a name="micros">micros</a></h3>
-A value representing microseconds.
-<h3><a name="millis">millis</a></h3>
-A value representing milliseconds.
-<h3><a name="MISO">MISO</a></h3>
-The GPIO used for the MISO signal when bit banging SPI.
-<h3><a name="mode">mode</a></h3>
-1. The operational mode of a GPIO, normally INPUT or OUTPUT.
-<br><br><code>PI_INPUT&nbsp;0<br>PI_OUTPUT&nbsp;1<br>PI_ALT0&nbsp;4<br>PI_ALT1&nbsp;5<br>PI_ALT2&nbsp;6<br>PI_ALT3&nbsp;7<br>PI_ALT4&nbsp;3<br>PI_ALT5&nbsp;2<br></code><br><br>2. A file open mode.
-<br><br><code>PI_FILE_READ&nbsp;&nbsp;1<br>PI_FILE_WRITE&nbsp;2<br>PI_FILE_RW&nbsp;&nbsp;&nbsp;&nbsp;3<br></code><br><br>The following values can be or'd into the mode.
-<br><br><code>PI_FILE_APPEND&nbsp;4<br>PI_FILE_CREATE&nbsp;8<br>PI_FILE_TRUNC&nbsp;&nbsp;16<br></code><h3><a name="MOSI">MOSI</a></h3>
-The GPIO used for the MOSI signal when bit banging SPI.
-<h3><a name="numBits">numBits</a></h3>
-The number of bits stored in a buffer.
-<h3><a name="numBytes">numBytes</a></h3>
-The number of bytes used to store characters in a string. Depending
-on the number of bits per character there may be 1, 2, or 4 bytes
-per character.
-<h3><a name="numPar">numPar</a>: 0-10</h3>
-The number of parameters passed to a script.
-<h3><a name="numPulses">numPulses</a></h3>
-The number of pulses to be added to a waveform.
-<h3><a name="numSegs">numSegs</a></h3>
-The number of segments in a combined I2C transaction.
-<h3><a name="numSockAddr">numSockAddr</a></h3>
-The number of network addresses allowed to use the socket interface.
-<br><br>0 means all addresses allowed.
-<h3><a name="offset">offset</a></h3>
-The associated data starts this number of microseconds from the start of
-the waveform.
-<h3><a name="*outBuf">*outBuf</a></h3>
-A buffer used to return data from a function.
-<h3><a name="outLen">outLen</a></h3>
-The size in bytes of an output buffer.
-<h3><a name="pad">pad</a>: 0-2</h3>
-A set of GPIO which share common drivers.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><h3><a name="padStrength">padStrength</a>: 1-16</h3>
-The mA which may be drawn from each GPIO whilst still guaranteeing the
-high and low levels.
-<h3><a name="*param">*param</a></h3>
-An array of script parameters.
-<h3><a name="pctBOOL">pctBOOL</a>: 0-100</h3>
-percent On-Off-Level (OOL) buffer to consume for wave output.
-<h3><a name="pctCB">pctCB</a>: 0-100</h3>
-the percent of all DMA control blocks to consume.
-<h3><a name="pctTOOL">pctTOOL</a>: 0-100</h3>
-the percent of OOL buffer to consume for wave input (flags).
-<h3><a name="pi_i2c_msg_t">pi_i2c_msg_t</a></h3>
-<code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;addr;&nbsp;&nbsp;//&nbsp;slave&nbsp;address<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;flags;<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;len;&nbsp;&nbsp;&nbsp;//&nbsp;msg&nbsp;length<br>&nbsp;&nbsp;&nbsp;uint8_t&nbsp;&nbsp;*buf;&nbsp;&nbsp;//&nbsp;pointer&nbsp;to&nbsp;msg&nbsp;data<br>}&nbsp;pi_i2c_msg_t;<br></code><h3><a name="port">port</a>: 1024-32000</h3>
-The port used to bind to the pigpio socket. Defaults to 8888.
-<h3><a name="pos">pos</a></h3>
-The position of an item.
-<h3><a name="primaryChannel">primaryChannel</a>: 0-15</h3>
-The DMA channel used to time the sampling of GPIO and to time servo and
-PWM pulses.
-<h3><a name="*pth">*pth</a></h3>
-A thread identifier, returned by <a href="#gpioStartThread">gpioStartThread</a>.
-<h3><a name="pthread_t">pthread_t</a></h3>
-A thread identifier.
-<h3><a name="pud">pud</a>: 0-2</h3>
-The setting of the pull up/down resistor for a GPIO, which may be off,
-pull-up, or pull-down.
-<br><br><code>PI_PUD_OFF&nbsp;0<br>PI_PUD_DOWN&nbsp;1<br>PI_PUD_UP&nbsp;2<br></code><h3><a name="pulseLen">pulseLen</a></h3>
-1-100, the length of a trigger pulse in microseconds.
-<h3><a name="*pulses">*pulses</a></h3>
-An array of pulses to be added to a waveform.
-<h3><a name="pulsewidth">pulsewidth</a>: 0, 500-2500</h3>
-<code>PI_SERVO_OFF&nbsp;0<br>PI_MIN_SERVO_PULSEWIDTH&nbsp;500<br>PI_MAX_SERVO_PULSEWIDTH&nbsp;2500<br></code><h3><a name="PWMduty">PWMduty</a>: 0-1000000 (1M)</h3>
-The hardware PWM dutycycle.
-<br><br><code>PI_HW_PWM_RANGE&nbsp;1000000<br></code><h3><a name="PWMfreq">PWMfreq</a>: 1-125M (1-187.5M for the BCM2711)</h3>
-The hardware PWM frequency.
-<br><br><code>PI_HW_PWM_MIN_FREQ&nbsp;1<br>PI_HW_PWM_MAX_FREQ&nbsp;125000000<br>PI_HW_PWM_MAX_FREQ_2711&nbsp;187500000<br></code><h3><a name="range">range</a>: 25-40000</h3>
-<code>PI_MIN_DUTYCYCLE_RANGE&nbsp;25<br>PI_MAX_DUTYCYCLE_RANGE&nbsp;40000<br></code><h3><a name="rawCbs_t">rawCbs_t</a></h3>
-<code>typedef&nbsp;struct&nbsp;//&nbsp;linux/arch/arm/mach-bcm2708/include/mach/dma.h<br>{<br>&nbsp;&nbsp;&nbsp;unsigned&nbsp;long&nbsp;info;<br>&nbsp;&nbsp;&nbsp;unsigned&nbsp;long&nbsp;src;<br>&nbsp;&nbsp;&nbsp;unsigned&nbsp;long&nbsp;dst;<br>&nbsp;&nbsp;&nbsp;unsigned&nbsp;long&nbsp;length;<br>&nbsp;&nbsp;&nbsp;unsigned&nbsp;long&nbsp;stride;<br>&nbsp;&nbsp;&nbsp;unsigned&nbsp;long&nbsp;next;<br>&nbsp;&nbsp;&nbsp;unsigned&nbsp;long&nbsp;pad[2];<br>}&nbsp;rawCbs_t;<br></code><h3><a name="rawSPI_t">rawSPI_t</a></h3>
-<code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;int&nbsp;clk;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;GPIO&nbsp;for&nbsp;clock<br>&nbsp;&nbsp;&nbsp;int&nbsp;mosi;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;GPIO&nbsp;for&nbsp;MOSI<br>&nbsp;&nbsp;&nbsp;int&nbsp;miso;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;GPIO&nbsp;for&nbsp;MISO<br>&nbsp;&nbsp;&nbsp;int&nbsp;ss_pol;&nbsp;&nbsp;//&nbsp;slave&nbsp;select&nbsp;off&nbsp;state<br>&nbsp;&nbsp;&nbsp;int&nbsp;ss_us;&nbsp;&nbsp;&nbsp;//&nbsp;delay&nbsp;after&nbsp;slave&nbsp;select<br>&nbsp;&nbsp;&nbsp;int&nbsp;clk_pol;&nbsp;//&nbsp;clock&nbsp;off&nbsp;state<br>&nbsp;&nbsp;&nbsp;int&nbsp;clk_pha;&nbsp;//&nbsp;clock&nbsp;phase<br>&nbsp;&nbsp;&nbsp;int&nbsp;clk_us;&nbsp;&nbsp;//&nbsp;clock&nbsp;micros<br>}&nbsp;rawSPI_t;<br></code><h3><a name="rawWave_t">rawWave_t</a></h3>
-<code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOn;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOff;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;usDelay;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;flags;<br>}&nbsp;rawWave_t;<br></code><h3><a name="rawWaveInfo_t">rawWaveInfo_t</a></h3>
-<code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;botCB;&nbsp;&nbsp;//&nbsp;first&nbsp;CB&nbsp;used&nbsp;by&nbsp;wave<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;topCB;&nbsp;&nbsp;//&nbsp;last&nbsp;CB&nbsp;used&nbsp;by&nbsp;wave<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;botOOL;&nbsp;//&nbsp;last&nbsp;OOL&nbsp;used&nbsp;by&nbsp;wave<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;topOOL;&nbsp;//&nbsp;first&nbsp;OOL&nbsp;used&nbsp;by&nbsp;wave<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;deleted;<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;numCB;<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;numBOOL;<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;numTOOL;<br>}&nbsp;rawWaveInfo_t;<br></code><h3><a name="*retBuf">*retBuf</a></h3>
-A buffer to hold a number of bytes returned to a used customised function,
-<h3><a name="retMax">retMax</a></h3>
-The maximum number of bytes a user customised function should return.
-<h3><a name="*rxBuf">*rxBuf</a></h3>
-A pointer to a buffer to receive data.
-<h3><a name="SCL">SCL</a></h3>
-The user GPIO to use for the clock when bit banging I2C.
-<h3><a name="SCLK">SCLK</a></h3>
-The GPIO used for the SCLK signal when bit banging SPI.
-<h3><a name="*script">*script</a></h3>
-A pointer to the text of a script.
-<h3><a name="script_id">script_id</a></h3>
-An id of a stored script as returned by <a href="#gpioStoreScript">gpioStoreScript</a>.
-<h3><a name="*scriptName">*scriptName</a></h3>
-The name of a <a href="#shell">shell</a> script to be executed. The script must be present in
-/opt/pigpio/cgi and must have execute permission.
-<h3><a name="*scriptString">*scriptString</a></h3>
-The string to be passed to a <a href="#shell">shell</a> script to be executed.
-<h3><a name="SDA">SDA</a></h3>
-The user GPIO to use for data when bit banging I2C.
-<h3><a name="secondaryChannel">secondaryChannel</a>: 0-6</h3>
-The DMA channel used to time output waveforms.
-<h3><a name="*seconds">*seconds</a></h3>
-A pointer to a uint32_t to store the second component of
-a returned time.
-<h3><a name="seconds">seconds</a></h3>
-The number of seconds.
-<h3><a name="seekFrom">seekFrom</a></h3>
-<code>PI_FROM_START&nbsp;&nbsp;&nbsp;0<br>PI_FROM_CURRENT&nbsp;1<br>PI_FROM_END&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2<br></code><h3><a name="seekOffset">seekOffset</a></h3>
-The number of bytes to move forward (positive) or backwards (negative)
-from the seek position (start, current, or end of file).
-<h3><a name="*segs">*segs</a></h3>
-An array of segments which make up a combined I2C transaction.
-<h3><a name="serFlags">serFlags</a></h3>
-Flags which modify a serial open command. None are currently defined.
-<h3><a name="*sertty">*sertty</a></h3>
-The name of a serial tty device, e.g. /dev/ttyAMA0, /dev/ttyUSB0, /dev/tty1.
-<h3><a name="setting">setting</a></h3>
-A value used to set a flag, 0 for false, non-zero for true.
-<h3><a name="signum">signum</a>: 0-63</h3>
-<code>PI_MIN_SIGNUM&nbsp;0<br>PI_MAX_SIGNUM&nbsp;63<br></code><h3><a name="size_t">size_t</a></h3>
-A standard type used to indicate the size of an object in bytes.
-<h3><a name="*sockAddr">*sockAddr</a></h3>
-An array of network addresses allowed to use the socket interface encoded
-as 32 bit numbers.
-<br><br>E.g. address 192.168.1.66 would be encoded as 0x4201a8c0.
-<h3><a name="*spi">*spi</a></h3>
-A pointer to a <a href="#rawSPI_t">rawSPI_t</a> structure.
-<h3><a name="spiBitFirst">spiBitFirst</a></h3>
-GPIO reads are made from spiBitFirst to spiBitLast.
-<h3><a name="spiBitLast">spiBitLast</a></h3>
-GPIO reads are made from spiBitFirst to spiBitLast.
-<h3><a name="spiBits">spiBits</a></h3>
-The number of bits to transfer in a raw SPI transaction.
-<h3><a name="spiChan">spiChan</a></h3>
-A SPI channel, 0-2.
-<h3><a name="spiFlags">spiFlags</a></h3>
-See <a href="#spiOpen">spiOpen</a> and <a href="#bbSPIOpen">bbSPIOpen</a>.
-<h3><a name="spiSS">spiSS</a></h3>
-The SPI slave select GPIO in a raw SPI transaction.
-<h3><a name="spiTxBits">spiTxBits</a></h3>
-The number of bits to transfer dring a raw SPI transaction
-<h3><a name="steady">steady</a>: 0-300000</h3>
-The number of microseconds level changes must be stable for
-before reporting the level changed (<a href="#gpioGlitchFilter">gpioGlitchFilter</a>) or triggering
-the active part of a noise filter (<a href="#gpioNoiseFilter">gpioNoiseFilter</a>).
-<h3><a name="stop_bits">stop_bits</a>: 2-8</h3>
-The number of (half) stop bits to be used when adding serial data
-to a waveform.
-<br><br><code>PI_MIN_WAVE_HALFSTOPBITS&nbsp;2<br>PI_MAX_WAVE_HALFSTOPBITS&nbsp;8<br></code><h3><a name="*str">*str</a></h3>
-An array of characters.
-<h3><a name="timeout">timeout</a></h3>
-A GPIO level change timeout in milliseconds.
-<br><br><a href="#gpioSetWatchdog">gpioSetWatchdog</a>
-<code>PI_MIN_WDOG_TIMEOUT&nbsp;0<br>PI_MAX_WDOG_TIMEOUT&nbsp;60000<br></code><br><br><a href="#gpioSetISRFunc">gpioSetISRFunc</a> and <a href="#gpioSetISRFuncEx">gpioSetISRFuncEx</a>
-<code>&lt;=0&nbsp;cancel&nbsp;timeout<br>&gt;0&nbsp;timeout&nbsp;after&nbsp;specified&nbsp;milliseconds<br></code><h3><a name="timer">timer</a></h3>
-<code>PI_MIN_TIMER&nbsp;0<br>PI_MAX_TIMER&nbsp;9<br></code><h3><a name="timetype">timetype</a></h3>
-<code>PI_TIME_RELATIVE&nbsp;0<br>PI_TIME_ABSOLUTE&nbsp;1<br></code><h3><a name="*txBuf">*txBuf</a></h3>
-An array of bytes to transmit.
-<h3><a name="uint32_t">uint32_t</a>: 0-0-4,294,967,295 (Hex 0x0-0xFFFFFFFF)</h3>
-A 32-bit unsigned value.
-<h3><a name="uint64_t">uint64_t</a>: 0-(2^64)-1</h3>
-A 64-bit unsigned value.
-<h3><a name="unsigned">unsigned</a></h3>
-A whole number &gt;= 0.
-<h3><a name="updateMask">updateMask</a></h3>
-A 64 bit mask indicating which GPIO may be written to by the user.
-<br><br>If GPIO#n may be written then bit (1&lt;&lt;n) is set.
-<h3><a name="user_gpio">user_gpio</a></h3>
-0-31, a Broadcom numbered GPIO.
-<br><br>See <a href="#gpio">gpio</a>.
-<h3><a name="*userdata">*userdata</a></h3>
-A pointer to arbitrary user data. This may be used to identify the instance.
-<br><br>You must ensure that the pointer is in scope at the time it is processed. If
-it is a pointer to a global this is automatic. Do not pass the address of a
-local variable. If you want to pass a transient object then use the
-following technique.
-<br><br>In the calling function:
-<br><br><code>user_type&nbsp;*userdata;<br><br>user_type&nbsp;my_userdata;<br><br>userdata&nbsp;=&nbsp;malloc(sizeof(user_type));<br><br>*userdata&nbsp;=&nbsp;my_userdata;<br></code><br><br>In the receiving function:
-<br><br><code>user_type&nbsp;my_userdata&nbsp;=&nbsp;*(user_type*)userdata;<br><br>free(userdata);<br></code><h3><a name="void">void</a></h3>
-Denoting no parameter is required
-<h3><a name="wave_id">wave_id</a></h3>
-A number identifying a waveform created by <a href="#gpioWaveCreate">gpioWaveCreate</a>.
-<h3><a name="wave_mode">wave_mode</a></h3>
-The mode determines if the waveform is sent once or cycles
-repeatedly. The SYNC variants wait for the current waveform
-to reach the end of a cycle or finish before starting the new
-waveform.
-<br><br><code>PI_WAVE_MODE_ONE_SHOT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0<br>PI_WAVE_MODE_REPEAT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1<br>PI_WAVE_MODE_ONE_SHOT_SYNC&nbsp;2<br>PI_WAVE_MODE_REPEAT_SYNC&nbsp;&nbsp;&nbsp;3<br></code><h3><a name="wVal">wVal</a>: 0-65535 (Hex 0x0-0xFFFF, Octal 0-0177777)</h3>
-A 16-bit word value.
-<h2>Socket Command Codes</h2><code><br>#define&nbsp;PI_CMD_MODES&nbsp;&nbsp;0<br>#define&nbsp;PI_CMD_MODEG&nbsp;&nbsp;1<br>#define&nbsp;PI_CMD_PUD&nbsp;&nbsp;&nbsp;&nbsp;2<br>#define&nbsp;PI_CMD_READ&nbsp;&nbsp;&nbsp;3<br>#define&nbsp;PI_CMD_WRITE&nbsp;&nbsp;4<br>#define&nbsp;PI_CMD_PWM&nbsp;&nbsp;&nbsp;&nbsp;5<br>#define&nbsp;PI_CMD_PRS&nbsp;&nbsp;&nbsp;&nbsp;6<br>#define&nbsp;PI_CMD_PFS&nbsp;&nbsp;&nbsp;&nbsp;7<br>#define&nbsp;PI_CMD_SERVO&nbsp;&nbsp;8<br>#define&nbsp;PI_CMD_WDOG&nbsp;&nbsp;&nbsp;9<br>#define&nbsp;PI_CMD_BR1&nbsp;&nbsp;&nbsp;10<br>#define&nbsp;PI_CMD_BR2&nbsp;&nbsp;&nbsp;11<br>#define&nbsp;PI_CMD_BC1&nbsp;&nbsp;&nbsp;12<br>#define&nbsp;PI_CMD_BC2&nbsp;&nbsp;&nbsp;13<br>#define&nbsp;PI_CMD_BS1&nbsp;&nbsp;&nbsp;14<br>#define&nbsp;PI_CMD_BS2&nbsp;&nbsp;&nbsp;15<br>#define&nbsp;PI_CMD_TICK&nbsp;&nbsp;16<br>#define&nbsp;PI_CMD_HWVER&nbsp;17<br>#define&nbsp;PI_CMD_NO&nbsp;&nbsp;&nbsp;&nbsp;18<br>#define&nbsp;PI_CMD_NB&nbsp;&nbsp;&nbsp;&nbsp;19<br>#define&nbsp;PI_CMD_NP&nbsp;&nbsp;&nbsp;&nbsp;20<br>#define&nbsp;PI_CMD_NC&nbsp;&nbsp;&nbsp;&nbsp;21<br>#define&nbsp;PI_CMD_PRG&nbsp;&nbsp;&nbsp;22<br>#define&nbsp;PI_CMD_PFG&nbsp;&nbsp;&nbsp;23<br>#define&nbsp;PI_CMD_PRRG&nbsp;&nbsp;24<br>#define&nbsp;PI_CMD_HELP&nbsp;&nbsp;25<br>#define&nbsp;PI_CMD_PIGPV&nbsp;26<br>#define&nbsp;PI_CMD_WVCLR&nbsp;27<br>#define&nbsp;PI_CMD_WVAG&nbsp;&nbsp;28<br>#define&nbsp;PI_CMD_WVAS&nbsp;&nbsp;29<br>#define&nbsp;PI_CMD_WVGO&nbsp;&nbsp;30<br>#define&nbsp;PI_CMD_WVGOR&nbsp;31<br>#define&nbsp;PI_CMD_WVBSY&nbsp;32<br>#define&nbsp;PI_CMD_WVHLT&nbsp;33<br>#define&nbsp;PI_CMD_WVSM&nbsp;&nbsp;34<br>#define&nbsp;PI_CMD_WVSP&nbsp;&nbsp;35<br>#define&nbsp;PI_CMD_WVSC&nbsp;&nbsp;36<br>#define&nbsp;PI_CMD_TRIG&nbsp;&nbsp;37<br>#define&nbsp;PI_CMD_PROC&nbsp;&nbsp;38<br>#define&nbsp;PI_CMD_PROCD&nbsp;39<br>#define&nbsp;PI_CMD_PROCR&nbsp;40<br>#define&nbsp;PI_CMD_PROCS&nbsp;41<br>#define&nbsp;PI_CMD_SLRO&nbsp;&nbsp;42<br>#define&nbsp;PI_CMD_SLR&nbsp;&nbsp;&nbsp;43<br>#define&nbsp;PI_CMD_SLRC&nbsp;&nbsp;44<br>#define&nbsp;PI_CMD_PROCP&nbsp;45<br>#define&nbsp;PI_CMD_MICS&nbsp;&nbsp;46<br>#define&nbsp;PI_CMD_MILS&nbsp;&nbsp;47<br>#define&nbsp;PI_CMD_PARSE&nbsp;48<br>#define&nbsp;PI_CMD_WVCRE&nbsp;49<br>#define&nbsp;PI_CMD_WVDEL&nbsp;50<br>#define&nbsp;PI_CMD_WVTX&nbsp;&nbsp;51<br>#define&nbsp;PI_CMD_WVTXR&nbsp;52<br>#define&nbsp;PI_CMD_WVNEW&nbsp;53<br><br>#define&nbsp;PI_CMD_I2CO&nbsp;&nbsp;54<br>#define&nbsp;PI_CMD_I2CC&nbsp;&nbsp;55<br>#define&nbsp;PI_CMD_I2CRD&nbsp;56<br>#define&nbsp;PI_CMD_I2CWD&nbsp;57<br>#define&nbsp;PI_CMD_I2CWQ&nbsp;58<br>#define&nbsp;PI_CMD_I2CRS&nbsp;59<br>#define&nbsp;PI_CMD_I2CWS&nbsp;60<br>#define&nbsp;PI_CMD_I2CRB&nbsp;61<br>#define&nbsp;PI_CMD_I2CWB&nbsp;62<br>#define&nbsp;PI_CMD_I2CRW&nbsp;63<br>#define&nbsp;PI_CMD_I2CWW&nbsp;64<br>#define&nbsp;PI_CMD_I2CRK&nbsp;65<br>#define&nbsp;PI_CMD_I2CWK&nbsp;66<br>#define&nbsp;PI_CMD_I2CRI&nbsp;67<br>#define&nbsp;PI_CMD_I2CWI&nbsp;68<br>#define&nbsp;PI_CMD_I2CPC&nbsp;69<br>#define&nbsp;PI_CMD_I2CPK&nbsp;70<br><br>#define&nbsp;PI_CMD_SPIO&nbsp;&nbsp;71<br>#define&nbsp;PI_CMD_SPIC&nbsp;&nbsp;72<br>#define&nbsp;PI_CMD_SPIR&nbsp;&nbsp;73<br>#define&nbsp;PI_CMD_SPIW&nbsp;&nbsp;74<br>#define&nbsp;PI_CMD_SPIX&nbsp;&nbsp;75<br><br>#define&nbsp;PI_CMD_SERO&nbsp;&nbsp;76<br>#define&nbsp;PI_CMD_SERC&nbsp;&nbsp;77<br>#define&nbsp;PI_CMD_SERRB&nbsp;78<br>#define&nbsp;PI_CMD_SERWB&nbsp;79<br>#define&nbsp;PI_CMD_SERR&nbsp;&nbsp;80<br>#define&nbsp;PI_CMD_SERW&nbsp;&nbsp;81<br>#define&nbsp;PI_CMD_SERDA&nbsp;82<br><br>#define&nbsp;PI_CMD_GDC&nbsp;&nbsp;&nbsp;83<br>#define&nbsp;PI_CMD_GPW&nbsp;&nbsp;&nbsp;84<br><br>#define&nbsp;PI_CMD_HC&nbsp;&nbsp;&nbsp;&nbsp;85<br>#define&nbsp;PI_CMD_HP&nbsp;&nbsp;&nbsp;&nbsp;86<br><br>#define&nbsp;PI_CMD_CF1&nbsp;&nbsp;&nbsp;87<br>#define&nbsp;PI_CMD_CF2&nbsp;&nbsp;&nbsp;88<br><br>#define&nbsp;PI_CMD_BI2CC&nbsp;89<br>#define&nbsp;PI_CMD_BI2CO&nbsp;90<br>#define&nbsp;PI_CMD_BI2CZ&nbsp;91<br><br>#define&nbsp;PI_CMD_I2CZ&nbsp;&nbsp;92<br><br>#define&nbsp;PI_CMD_WVCHA&nbsp;93<br><br>#define&nbsp;PI_CMD_SLRI&nbsp;&nbsp;94<br><br>#define&nbsp;PI_CMD_CGI&nbsp;&nbsp;&nbsp;95<br>#define&nbsp;PI_CMD_CSI&nbsp;&nbsp;&nbsp;96<br><br>#define&nbsp;PI_CMD_FG&nbsp;&nbsp;&nbsp;&nbsp;97<br>#define&nbsp;PI_CMD_FN&nbsp;&nbsp;&nbsp;&nbsp;98<br><br>#define&nbsp;PI_CMD_NOIB&nbsp;&nbsp;99<br><br>#define&nbsp;PI_CMD_WVTXM&nbsp;100<br>#define&nbsp;PI_CMD_WVTAT&nbsp;101<br><br>#define&nbsp;PI_CMD_PADS&nbsp;&nbsp;102<br>#define&nbsp;PI_CMD_PADG&nbsp;&nbsp;103<br><br>#define&nbsp;PI_CMD_FO&nbsp;&nbsp;&nbsp;&nbsp;104<br>#define&nbsp;PI_CMD_FC&nbsp;&nbsp;&nbsp;&nbsp;105<br>#define&nbsp;PI_CMD_FR&nbsp;&nbsp;&nbsp;&nbsp;106<br>#define&nbsp;PI_CMD_FW&nbsp;&nbsp;&nbsp;&nbsp;107<br>#define&nbsp;PI_CMD_FS&nbsp;&nbsp;&nbsp;&nbsp;108<br>#define&nbsp;PI_CMD_FL&nbsp;&nbsp;&nbsp;&nbsp;109<br><br>#define&nbsp;PI_CMD_SHELL&nbsp;110<br><br>#define&nbsp;PI_CMD_BSPIC&nbsp;111<br>#define&nbsp;PI_CMD_BSPIO&nbsp;112<br>#define&nbsp;PI_CMD_BSPIX&nbsp;113<br><br>#define&nbsp;PI_CMD_BSCX&nbsp;&nbsp;114<br><br>#define&nbsp;PI_CMD_EVM&nbsp;&nbsp;&nbsp;115<br>#define&nbsp;PI_CMD_EVT&nbsp;&nbsp;&nbsp;116<br><br>#define&nbsp;PI_CMD_PROCU&nbsp;117<br>#define&nbsp;PI_CMD_WVCAP&nbsp;118<br><br></code><h2>Error Codes</h2><code><br>#define&nbsp;PI_INIT_FAILED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-1&nbsp;//&nbsp;gpioInitialise&nbsp;failed<br>#define&nbsp;PI_BAD_USER_GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-2&nbsp;//&nbsp;GPIO&nbsp;not&nbsp;0-31<br>#define&nbsp;PI_BAD_GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-3&nbsp;//&nbsp;GPIO&nbsp;not&nbsp;0-53<br>#define&nbsp;PI_BAD_MODE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-4&nbsp;//&nbsp;mode&nbsp;not&nbsp;0-7<br>#define&nbsp;PI_BAD_LEVEL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-5&nbsp;//&nbsp;level&nbsp;not&nbsp;0-1<br>#define&nbsp;PI_BAD_PUD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-6&nbsp;//&nbsp;pud&nbsp;not&nbsp;0-2<br>#define&nbsp;PI_BAD_PULSEWIDTH&nbsp;&nbsp;&nbsp;&nbsp;-7&nbsp;//&nbsp;pulsewidth&nbsp;not&nbsp;0&nbsp;or&nbsp;500-2500<br>#define&nbsp;PI_BAD_DUTYCYCLE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-8&nbsp;//&nbsp;dutycycle&nbsp;outside&nbsp;set&nbsp;range<br>#define&nbsp;PI_BAD_TIMER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-9&nbsp;//&nbsp;timer&nbsp;not&nbsp;0-9<br>#define&nbsp;PI_BAD_MS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-10&nbsp;//&nbsp;ms&nbsp;not&nbsp;10-60000<br>#define&nbsp;PI_BAD_TIMETYPE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-11&nbsp;//&nbsp;timetype&nbsp;not&nbsp;0-1<br>#define&nbsp;PI_BAD_SECONDS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-12&nbsp;//&nbsp;seconds&nbsp;&lt;&nbsp;0<br>#define&nbsp;PI_BAD_MICROS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-13&nbsp;//&nbsp;micros&nbsp;not&nbsp;0-999999<br>#define&nbsp;PI_TIMER_FAILED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-14&nbsp;//&nbsp;gpioSetTimerFunc&nbsp;failed<br>#define&nbsp;PI_BAD_WDOG_TIMEOUT&nbsp;-15&nbsp;//&nbsp;timeout&nbsp;not&nbsp;0-60000<br>#define&nbsp;PI_NO_ALERT_FUNC&nbsp;&nbsp;&nbsp;&nbsp;-16&nbsp;//&nbsp;DEPRECATED<br>#define&nbsp;PI_BAD_CLK_PERIPH&nbsp;&nbsp;&nbsp;-17&nbsp;//&nbsp;clock&nbsp;peripheral&nbsp;not&nbsp;0-1<br>#define&nbsp;PI_BAD_CLK_SOURCE&nbsp;&nbsp;&nbsp;-18&nbsp;//&nbsp;DEPRECATED<br>#define&nbsp;PI_BAD_CLK_MICROS&nbsp;&nbsp;&nbsp;-19&nbsp;//&nbsp;clock&nbsp;micros&nbsp;not&nbsp;1,&nbsp;2,&nbsp;4,&nbsp;5,&nbsp;8,&nbsp;or&nbsp;10<br>#define&nbsp;PI_BAD_BUF_MILLIS&nbsp;&nbsp;&nbsp;-20&nbsp;//&nbsp;buf&nbsp;millis&nbsp;not&nbsp;100-10000<br>#define&nbsp;PI_BAD_DUTYRANGE&nbsp;&nbsp;&nbsp;&nbsp;-21&nbsp;//&nbsp;dutycycle&nbsp;range&nbsp;not&nbsp;25-40000<br>#define&nbsp;PI_BAD_DUTY_RANGE&nbsp;&nbsp;&nbsp;-21&nbsp;//&nbsp;DEPRECATED&nbsp;(use&nbsp;PI_BAD_DUTYRANGE)<br>#define&nbsp;PI_BAD_SIGNUM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-22&nbsp;//&nbsp;signum&nbsp;not&nbsp;0-63<br>#define&nbsp;PI_BAD_PATHNAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-23&nbsp;//&nbsp;can't&nbsp;open&nbsp;pathname<br>#define&nbsp;PI_NO_HANDLE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-24&nbsp;//&nbsp;no&nbsp;handle&nbsp;available<br>#define&nbsp;PI_BAD_HANDLE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-25&nbsp;//&nbsp;unknown&nbsp;handle<br>#define&nbsp;PI_BAD_IF_FLAGS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-26&nbsp;//&nbsp;ifFlags&nbsp;&gt;&nbsp;4<br>#define&nbsp;PI_BAD_CHANNEL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-27&nbsp;//&nbsp;DMA&nbsp;channel&nbsp;not&nbsp;0-15<br>#define&nbsp;PI_BAD_PRIM_CHANNEL&nbsp;-27&nbsp;//&nbsp;DMA&nbsp;primary&nbsp;channel&nbsp;not&nbsp;0-15<br>#define&nbsp;PI_BAD_SOCKET_PORT&nbsp;&nbsp;-28&nbsp;//&nbsp;socket&nbsp;port&nbsp;not&nbsp;1024-32000<br>#define&nbsp;PI_BAD_FIFO_COMMAND&nbsp;-29&nbsp;//&nbsp;unrecognized&nbsp;fifo&nbsp;command<br>#define&nbsp;PI_BAD_SECO_CHANNEL&nbsp;-30&nbsp;//&nbsp;DMA&nbsp;secondary&nbsp;channel&nbsp;not&nbsp;0-15<br>#define&nbsp;PI_NOT_INITIALISED&nbsp;&nbsp;-31&nbsp;//&nbsp;function&nbsp;called&nbsp;before&nbsp;gpioInitialise<br>#define&nbsp;PI_INITIALISED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-32&nbsp;//&nbsp;function&nbsp;called&nbsp;after&nbsp;gpioInitialise<br>#define&nbsp;PI_BAD_WAVE_MODE&nbsp;&nbsp;&nbsp;&nbsp;-33&nbsp;//&nbsp;waveform&nbsp;mode&nbsp;not&nbsp;0-3<br>#define&nbsp;PI_BAD_CFG_INTERNAL&nbsp;-34&nbsp;//&nbsp;bad&nbsp;parameter&nbsp;in&nbsp;gpioCfgInternals&nbsp;call<br>#define&nbsp;PI_BAD_WAVE_BAUD&nbsp;&nbsp;&nbsp;&nbsp;-35&nbsp;//&nbsp;baud&nbsp;rate&nbsp;not&nbsp;50-250K(RX)/50-1M(TX)<br>#define&nbsp;PI_TOO_MANY_PULSES&nbsp;&nbsp;-36&nbsp;//&nbsp;waveform&nbsp;has&nbsp;too&nbsp;many&nbsp;pulses<br>#define&nbsp;PI_TOO_MANY_CHARS&nbsp;&nbsp;&nbsp;-37&nbsp;//&nbsp;waveform&nbsp;has&nbsp;too&nbsp;many&nbsp;chars<br>#define&nbsp;PI_NOT_SERIAL_GPIO&nbsp;&nbsp;-38&nbsp;//&nbsp;no&nbsp;bit&nbsp;bang&nbsp;serial&nbsp;read&nbsp;on&nbsp;GPIO<br>#define&nbsp;PI_BAD_SERIAL_STRUC&nbsp;-39&nbsp;//&nbsp;bad&nbsp;(null)&nbsp;serial&nbsp;structure&nbsp;parameter<br>#define&nbsp;PI_BAD_SERIAL_BUF&nbsp;&nbsp;&nbsp;-40&nbsp;//&nbsp;bad&nbsp;(null)&nbsp;serial&nbsp;buf&nbsp;parameter<br>#define&nbsp;PI_NOT_PERMITTED&nbsp;&nbsp;&nbsp;&nbsp;-41&nbsp;//&nbsp;GPIO&nbsp;operation&nbsp;not&nbsp;permitted<br>#define&nbsp;PI_SOME_PERMITTED&nbsp;&nbsp;&nbsp;-42&nbsp;//&nbsp;one&nbsp;or&nbsp;more&nbsp;GPIO&nbsp;not&nbsp;permitted<br>#define&nbsp;PI_BAD_WVSC_COMMND&nbsp;&nbsp;-43&nbsp;//&nbsp;bad&nbsp;WVSC&nbsp;subcommand<br>#define&nbsp;PI_BAD_WVSM_COMMND&nbsp;&nbsp;-44&nbsp;//&nbsp;bad&nbsp;WVSM&nbsp;subcommand<br>#define&nbsp;PI_BAD_WVSP_COMMND&nbsp;&nbsp;-45&nbsp;//&nbsp;bad&nbsp;WVSP&nbsp;subcommand<br>#define&nbsp;PI_BAD_PULSELEN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-46&nbsp;//&nbsp;trigger&nbsp;pulse&nbsp;length&nbsp;not&nbsp;1-100<br>#define&nbsp;PI_BAD_SCRIPT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-47&nbsp;//&nbsp;invalid&nbsp;script<br>#define&nbsp;PI_BAD_SCRIPT_ID&nbsp;&nbsp;&nbsp;&nbsp;-48&nbsp;//&nbsp;unknown&nbsp;script&nbsp;id<br>#define&nbsp;PI_BAD_SER_OFFSET&nbsp;&nbsp;&nbsp;-49&nbsp;//&nbsp;add&nbsp;serial&nbsp;data&nbsp;offset&nbsp;&gt;&nbsp;30&nbsp;minutes<br>#define&nbsp;PI_GPIO_IN_USE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-50&nbsp;//&nbsp;GPIO&nbsp;already&nbsp;in&nbsp;use<br>#define&nbsp;PI_BAD_SERIAL_COUNT&nbsp;-51&nbsp;//&nbsp;must&nbsp;read&nbsp;at&nbsp;least&nbsp;a&nbsp;byte&nbsp;at&nbsp;a&nbsp;time<br>#define&nbsp;PI_BAD_PARAM_NUM&nbsp;&nbsp;&nbsp;&nbsp;-52&nbsp;//&nbsp;script&nbsp;parameter&nbsp;id&nbsp;not&nbsp;0-9<br>#define&nbsp;PI_DUP_TAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-53&nbsp;//&nbsp;script&nbsp;has&nbsp;duplicate&nbsp;tag<br>#define&nbsp;PI_TOO_MANY_TAGS&nbsp;&nbsp;&nbsp;&nbsp;-54&nbsp;//&nbsp;script&nbsp;has&nbsp;too&nbsp;many&nbsp;tags<br>#define&nbsp;PI_BAD_SCRIPT_CMD&nbsp;&nbsp;&nbsp;-55&nbsp;//&nbsp;illegal&nbsp;script&nbsp;command<br>#define&nbsp;PI_BAD_VAR_NUM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-56&nbsp;//&nbsp;script&nbsp;variable&nbsp;id&nbsp;not&nbsp;0-149<br>#define&nbsp;PI_NO_SCRIPT_ROOM&nbsp;&nbsp;&nbsp;-57&nbsp;//&nbsp;no&nbsp;more&nbsp;room&nbsp;for&nbsp;scripts<br>#define&nbsp;PI_NO_MEMORY&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-58&nbsp;//&nbsp;can't&nbsp;allocate&nbsp;temporary&nbsp;memory<br>#define&nbsp;PI_SOCK_READ_FAILED&nbsp;-59&nbsp;//&nbsp;socket&nbsp;read&nbsp;failed<br>#define&nbsp;PI_SOCK_WRIT_FAILED&nbsp;-60&nbsp;//&nbsp;socket&nbsp;write&nbsp;failed<br>#define&nbsp;PI_TOO_MANY_PARAM&nbsp;&nbsp;&nbsp;-61&nbsp;//&nbsp;too&nbsp;many&nbsp;script&nbsp;parameters&nbsp;(&gt;&nbsp;10)<br>#define&nbsp;PI_NOT_HALTED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-62&nbsp;//&nbsp;DEPRECATED<br>#define&nbsp;PI_SCRIPT_NOT_READY&nbsp;-62&nbsp;//&nbsp;script&nbsp;initialising<br>#define&nbsp;PI_BAD_TAG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-63&nbsp;//&nbsp;script&nbsp;has&nbsp;unresolved&nbsp;tag<br>#define&nbsp;PI_BAD_MICS_DELAY&nbsp;&nbsp;&nbsp;-64&nbsp;//&nbsp;bad&nbsp;MICS&nbsp;delay&nbsp;(too&nbsp;large)<br>#define&nbsp;PI_BAD_MILS_DELAY&nbsp;&nbsp;&nbsp;-65&nbsp;//&nbsp;bad&nbsp;MILS&nbsp;delay&nbsp;(too&nbsp;large)<br>#define&nbsp;PI_BAD_WAVE_ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-66&nbsp;//&nbsp;non&nbsp;existent&nbsp;wave&nbsp;id<br>#define&nbsp;PI_TOO_MANY_CBS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-67&nbsp;//&nbsp;No&nbsp;more&nbsp;CBs&nbsp;for&nbsp;waveform<br>#define&nbsp;PI_TOO_MANY_OOL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-68&nbsp;//&nbsp;No&nbsp;more&nbsp;OOL&nbsp;for&nbsp;waveform<br>#define&nbsp;PI_EMPTY_WAVEFORM&nbsp;&nbsp;&nbsp;-69&nbsp;//&nbsp;attempt&nbsp;to&nbsp;create&nbsp;an&nbsp;empty&nbsp;waveform<br>#define&nbsp;PI_NO_WAVEFORM_ID&nbsp;&nbsp;&nbsp;-70&nbsp;//&nbsp;no&nbsp;more&nbsp;waveforms<br>#define&nbsp;PI_I2C_OPEN_FAILED&nbsp;&nbsp;-71&nbsp;//&nbsp;can't&nbsp;open&nbsp;I2C&nbsp;device<br>#define&nbsp;PI_SER_OPEN_FAILED&nbsp;&nbsp;-72&nbsp;//&nbsp;can't&nbsp;open&nbsp;serial&nbsp;device<br>#define&nbsp;PI_SPI_OPEN_FAILED&nbsp;&nbsp;-73&nbsp;//&nbsp;can't&nbsp;open&nbsp;SPI&nbsp;device<br>#define&nbsp;PI_BAD_I2C_BUS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-74&nbsp;//&nbsp;bad&nbsp;I2C&nbsp;bus<br>#define&nbsp;PI_BAD_I2C_ADDR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-75&nbsp;//&nbsp;bad&nbsp;I2C&nbsp;address<br>#define&nbsp;PI_BAD_SPI_CHANNEL&nbsp;&nbsp;-76&nbsp;//&nbsp;bad&nbsp;SPI&nbsp;channel<br>#define&nbsp;PI_BAD_FLAGS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-77&nbsp;//&nbsp;bad&nbsp;i2c/spi/ser&nbsp;open&nbsp;flags<br>#define&nbsp;PI_BAD_SPI_SPEED&nbsp;&nbsp;&nbsp;&nbsp;-78&nbsp;//&nbsp;bad&nbsp;SPI&nbsp;speed<br>#define&nbsp;PI_BAD_SER_DEVICE&nbsp;&nbsp;&nbsp;-79&nbsp;//&nbsp;bad&nbsp;serial&nbsp;device&nbsp;name<br>#define&nbsp;PI_BAD_SER_SPEED&nbsp;&nbsp;&nbsp;&nbsp;-80&nbsp;//&nbsp;bad&nbsp;serial&nbsp;baud&nbsp;rate<br>#define&nbsp;PI_BAD_PARAM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-81&nbsp;//&nbsp;bad&nbsp;i2c/spi/ser&nbsp;parameter<br>#define&nbsp;PI_I2C_WRITE_FAILED&nbsp;-82&nbsp;//&nbsp;i2c&nbsp;write&nbsp;failed<br>#define&nbsp;PI_I2C_READ_FAILED&nbsp;&nbsp;-83&nbsp;//&nbsp;i2c&nbsp;read&nbsp;failed<br>#define&nbsp;PI_BAD_SPI_COUNT&nbsp;&nbsp;&nbsp;&nbsp;-84&nbsp;//&nbsp;bad&nbsp;SPI&nbsp;count<br>#define&nbsp;PI_SER_WRITE_FAILED&nbsp;-85&nbsp;//&nbsp;ser&nbsp;write&nbsp;failed<br>#define&nbsp;PI_SER_READ_FAILED&nbsp;&nbsp;-86&nbsp;//&nbsp;ser&nbsp;read&nbsp;failed<br>#define&nbsp;PI_SER_READ_NO_DATA&nbsp;-87&nbsp;//&nbsp;ser&nbsp;read&nbsp;no&nbsp;data&nbsp;available<br>#define&nbsp;PI_UNKNOWN_COMMAND&nbsp;&nbsp;-88&nbsp;//&nbsp;unknown&nbsp;command<br>#define&nbsp;PI_SPI_XFER_FAILED&nbsp;&nbsp;-89&nbsp;//&nbsp;spi&nbsp;xfer/read/write&nbsp;failed<br>#define&nbsp;PI_BAD_POINTER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-90&nbsp;//&nbsp;bad&nbsp;(NULL)&nbsp;pointer<br>#define&nbsp;PI_NO_AUX_SPI&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-91&nbsp;//&nbsp;no&nbsp;auxiliary&nbsp;SPI&nbsp;on&nbsp;Pi&nbsp;A&nbsp;or&nbsp;B<br>#define&nbsp;PI_NOT_PWM_GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-92&nbsp;//&nbsp;GPIO&nbsp;is&nbsp;not&nbsp;in&nbsp;use&nbsp;for&nbsp;PWM<br>#define&nbsp;PI_NOT_SERVO_GPIO&nbsp;&nbsp;&nbsp;-93&nbsp;//&nbsp;GPIO&nbsp;is&nbsp;not&nbsp;in&nbsp;use&nbsp;for&nbsp;servo&nbsp;pulses<br>#define&nbsp;PI_NOT_HCLK_GPIO&nbsp;&nbsp;&nbsp;&nbsp;-94&nbsp;//&nbsp;GPIO&nbsp;has&nbsp;no&nbsp;hardware&nbsp;clock<br>#define&nbsp;PI_NOT_HPWM_GPIO&nbsp;&nbsp;&nbsp;&nbsp;-95&nbsp;//&nbsp;GPIO&nbsp;has&nbsp;no&nbsp;hardware&nbsp;PWM<br>#define&nbsp;PI_BAD_HPWM_FREQ&nbsp;&nbsp;&nbsp;&nbsp;-96&nbsp;//&nbsp;invalid&nbsp;hardware&nbsp;PWM&nbsp;frequency<br>#define&nbsp;PI_BAD_HPWM_DUTY&nbsp;&nbsp;&nbsp;&nbsp;-97&nbsp;//&nbsp;hardware&nbsp;PWM&nbsp;dutycycle&nbsp;not&nbsp;0-1M<br>#define&nbsp;PI_BAD_HCLK_FREQ&nbsp;&nbsp;&nbsp;&nbsp;-98&nbsp;//&nbsp;invalid&nbsp;hardware&nbsp;clock&nbsp;frequency<br>#define&nbsp;PI_BAD_HCLK_PASS&nbsp;&nbsp;&nbsp;&nbsp;-99&nbsp;//&nbsp;need&nbsp;password&nbsp;to&nbsp;use&nbsp;hardware&nbsp;clock&nbsp;1<br>#define&nbsp;PI_HPWM_ILLEGAL&nbsp;&nbsp;&nbsp;&nbsp;-100&nbsp;//&nbsp;illegal,&nbsp;PWM&nbsp;in&nbsp;use&nbsp;for&nbsp;main&nbsp;clock<br>#define&nbsp;PI_BAD_DATABITS&nbsp;&nbsp;&nbsp;&nbsp;-101&nbsp;//&nbsp;serial&nbsp;data&nbsp;bits&nbsp;not&nbsp;1-32<br>#define&nbsp;PI_BAD_STOPBITS&nbsp;&nbsp;&nbsp;&nbsp;-102&nbsp;//&nbsp;serial&nbsp;(half)&nbsp;stop&nbsp;bits&nbsp;not&nbsp;2-8<br>#define&nbsp;PI_MSG_TOOBIG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-103&nbsp;//&nbsp;socket/pipe&nbsp;message&nbsp;too&nbsp;big<br>#define&nbsp;PI_BAD_MALLOC_MODE&nbsp;-104&nbsp;//&nbsp;bad&nbsp;memory&nbsp;allocation&nbsp;mode<br>#define&nbsp;PI_TOO_MANY_SEGS&nbsp;&nbsp;&nbsp;-105&nbsp;//&nbsp;too&nbsp;many&nbsp;I2C&nbsp;transaction&nbsp;segments<br>#define&nbsp;PI_BAD_I2C_SEG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-106&nbsp;//&nbsp;an&nbsp;I2C&nbsp;transaction&nbsp;segment&nbsp;failed<br>#define&nbsp;PI_BAD_SMBUS_CMD&nbsp;&nbsp;&nbsp;-107&nbsp;//&nbsp;SMBus&nbsp;command&nbsp;not&nbsp;supported&nbsp;by&nbsp;driver<br>#define&nbsp;PI_NOT_I2C_GPIO&nbsp;&nbsp;&nbsp;&nbsp;-108&nbsp;//&nbsp;no&nbsp;bit&nbsp;bang&nbsp;I2C&nbsp;in&nbsp;progress&nbsp;on&nbsp;GPIO<br>#define&nbsp;PI_BAD_I2C_WLEN&nbsp;&nbsp;&nbsp;&nbsp;-109&nbsp;//&nbsp;bad&nbsp;I2C&nbsp;write&nbsp;length<br>#define&nbsp;PI_BAD_I2C_RLEN&nbsp;&nbsp;&nbsp;&nbsp;-110&nbsp;//&nbsp;bad&nbsp;I2C&nbsp;read&nbsp;length<br>#define&nbsp;PI_BAD_I2C_CMD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-111&nbsp;//&nbsp;bad&nbsp;I2C&nbsp;command<br>#define&nbsp;PI_BAD_I2C_BAUD&nbsp;&nbsp;&nbsp;&nbsp;-112&nbsp;//&nbsp;bad&nbsp;I2C&nbsp;baud&nbsp;rate,&nbsp;not&nbsp;50-500k<br>#define&nbsp;PI_CHAIN_LOOP_CNT&nbsp;&nbsp;-113&nbsp;//&nbsp;bad&nbsp;chain&nbsp;loop&nbsp;count<br>#define&nbsp;PI_BAD_CHAIN_LOOP&nbsp;&nbsp;-114&nbsp;//&nbsp;empty&nbsp;chain&nbsp;loop<br>#define&nbsp;PI_CHAIN_COUNTER&nbsp;&nbsp;&nbsp;-115&nbsp;//&nbsp;too&nbsp;many&nbsp;chain&nbsp;counters<br>#define&nbsp;PI_BAD_CHAIN_CMD&nbsp;&nbsp;&nbsp;-116&nbsp;//&nbsp;bad&nbsp;chain&nbsp;command<br>#define&nbsp;PI_BAD_CHAIN_DELAY&nbsp;-117&nbsp;//&nbsp;bad&nbsp;chain&nbsp;delay&nbsp;micros<br>#define&nbsp;PI_CHAIN_NESTING&nbsp;&nbsp;&nbsp;-118&nbsp;//&nbsp;chain&nbsp;counters&nbsp;nested&nbsp;too&nbsp;deeply<br>#define&nbsp;PI_CHAIN_TOO_BIG&nbsp;&nbsp;&nbsp;-119&nbsp;//&nbsp;chain&nbsp;is&nbsp;too&nbsp;long<br>#define&nbsp;PI_DEPRECATED&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-120&nbsp;//&nbsp;deprecated&nbsp;function&nbsp;removed<br>#define&nbsp;PI_BAD_SER_INVERT&nbsp;&nbsp;-121&nbsp;//&nbsp;bit&nbsp;bang&nbsp;serial&nbsp;invert&nbsp;not&nbsp;0&nbsp;or&nbsp;1<br>#define&nbsp;PI_BAD_EDGE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-122&nbsp;//&nbsp;bad&nbsp;ISR&nbsp;edge&nbsp;value,&nbsp;not&nbsp;0-2<br>#define&nbsp;PI_BAD_ISR_INIT&nbsp;&nbsp;&nbsp;&nbsp;-123&nbsp;//&nbsp;bad&nbsp;ISR&nbsp;initialisation<br>#define&nbsp;PI_BAD_FOREVER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-124&nbsp;//&nbsp;loop&nbsp;forever&nbsp;must&nbsp;be&nbsp;last&nbsp;command<br>#define&nbsp;PI_BAD_FILTER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-125&nbsp;//&nbsp;bad&nbsp;filter&nbsp;parameter<br>#define&nbsp;PI_BAD_PAD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-126&nbsp;//&nbsp;bad&nbsp;pad&nbsp;number<br>#define&nbsp;PI_BAD_STRENGTH&nbsp;&nbsp;&nbsp;&nbsp;-127&nbsp;//&nbsp;bad&nbsp;pad&nbsp;drive&nbsp;strength<br>#define&nbsp;PI_FIL_OPEN_FAILED&nbsp;-128&nbsp;//&nbsp;file&nbsp;open&nbsp;failed<br>#define&nbsp;PI_BAD_FILE_MODE&nbsp;&nbsp;&nbsp;-129&nbsp;//&nbsp;bad&nbsp;file&nbsp;mode<br>#define&nbsp;PI_BAD_FILE_FLAG&nbsp;&nbsp;&nbsp;-130&nbsp;//&nbsp;bad&nbsp;file&nbsp;flag<br>#define&nbsp;PI_BAD_FILE_READ&nbsp;&nbsp;&nbsp;-131&nbsp;//&nbsp;bad&nbsp;file&nbsp;read<br>#define&nbsp;PI_BAD_FILE_WRITE&nbsp;&nbsp;-132&nbsp;//&nbsp;bad&nbsp;file&nbsp;write<br>#define&nbsp;PI_FILE_NOT_ROPEN&nbsp;&nbsp;-133&nbsp;//&nbsp;file&nbsp;not&nbsp;open&nbsp;for&nbsp;read<br>#define&nbsp;PI_FILE_NOT_WOPEN&nbsp;&nbsp;-134&nbsp;//&nbsp;file&nbsp;not&nbsp;open&nbsp;for&nbsp;write<br>#define&nbsp;PI_BAD_FILE_SEEK&nbsp;&nbsp;&nbsp;-135&nbsp;//&nbsp;bad&nbsp;file&nbsp;seek<br>#define&nbsp;PI_NO_FILE_MATCH&nbsp;&nbsp;&nbsp;-136&nbsp;//&nbsp;no&nbsp;files&nbsp;match&nbsp;pattern<br>#define&nbsp;PI_NO_FILE_ACCESS&nbsp;&nbsp;-137&nbsp;//&nbsp;no&nbsp;permission&nbsp;to&nbsp;access&nbsp;file<br>#define&nbsp;PI_FILE_IS_A_DIR&nbsp;&nbsp;&nbsp;-138&nbsp;//&nbsp;file&nbsp;is&nbsp;a&nbsp;directory<br>#define&nbsp;PI_BAD_SHELL_STATUS&nbsp;-139&nbsp;//&nbsp;bad&nbsp;shell&nbsp;return&nbsp;status<br>#define&nbsp;PI_BAD_SCRIPT_NAME&nbsp;-140&nbsp;//&nbsp;bad&nbsp;script&nbsp;name<br>#define&nbsp;PI_BAD_SPI_BAUD&nbsp;&nbsp;&nbsp;&nbsp;-141&nbsp;//&nbsp;bad&nbsp;SPI&nbsp;baud&nbsp;rate,&nbsp;not&nbsp;50-500k<br>#define&nbsp;PI_NOT_SPI_GPIO&nbsp;&nbsp;&nbsp;&nbsp;-142&nbsp;//&nbsp;no&nbsp;bit&nbsp;bang&nbsp;SPI&nbsp;in&nbsp;progress&nbsp;on&nbsp;GPIO<br>#define&nbsp;PI_BAD_EVENT_ID&nbsp;&nbsp;&nbsp;&nbsp;-143&nbsp;//&nbsp;bad&nbsp;event&nbsp;id<br>#define&nbsp;PI_CMD_INTERRUPTED&nbsp;-144&nbsp;//&nbsp;Used&nbsp;by&nbsp;Python<br>#define&nbsp;PI_NOT_ON_BCM2711&nbsp;&nbsp;-145&nbsp;//&nbsp;not&nbsp;available&nbsp;on&nbsp;BCM2711<br>#define&nbsp;PI_ONLY_ON_BCM2711&nbsp;-146&nbsp;//&nbsp;only&nbsp;available&nbsp;on&nbsp;BCM2711<br><br>#define&nbsp;PI_PIGIF_ERR_0&nbsp;&nbsp;&nbsp;&nbsp;-2000<br>#define&nbsp;PI_PIGIF_ERR_99&nbsp;&nbsp;&nbsp;-2099<br><br>#define&nbsp;PI_CUSTOM_ERR_0&nbsp;&nbsp;&nbsp;-3000<br>#define&nbsp;PI_CUSTOM_ERR_999&nbsp;-3999<br><br></code><h2>Defaults</h2><code><br>#define&nbsp;PI_DEFAULT_BUFFER_MILLIS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;120<br>#define&nbsp;PI_DEFAULT_CLK_MICROS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5<br>#define&nbsp;PI_DEFAULT_CLK_PERIPHERAL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PI_CLOCK_PCM<br>#define&nbsp;PI_DEFAULT_IF_FLAGS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0<br>#define&nbsp;PI_DEFAULT_FOREGROUND&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0<br>#define&nbsp;PI_DEFAULT_DMA_CHANNEL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;14<br>#define&nbsp;PI_DEFAULT_DMA_PRIMARY_CHANNEL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;14<br>#define&nbsp;PI_DEFAULT_DMA_SECONDARY_CHANNEL&nbsp;&nbsp;&nbsp;6<br>#define&nbsp;PI_DEFAULT_DMA_PRIMARY_CH_2711&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;7<br>#define&nbsp;PI_DEFAULT_DMA_SECONDARY_CH_2711&nbsp;&nbsp;&nbsp;6<br>#define&nbsp;PI_DEFAULT_DMA_NOT_SET&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;15<br>#define&nbsp;PI_DEFAULT_SOCKET_PORT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8888<br>#define&nbsp;PI_DEFAULT_SOCKET_PORT_STR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"8888"<br>#define&nbsp;PI_DEFAULT_SOCKET_ADDR_STR&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"localhost"<br>#define&nbsp;PI_DEFAULT_UPDATE_MASK_UNKNOWN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0x0000000FFFFFFCLL<br>#define&nbsp;PI_DEFAULT_UPDATE_MASK_B1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0x03E7CF93<br>#define&nbsp;PI_DEFAULT_UPDATE_MASK_A_B2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0xFBC7CF9C<br>#define&nbsp;PI_DEFAULT_UPDATE_MASK_APLUS_BPLUS&nbsp;0x0080480FFFFFFCLL<br>#define&nbsp;PI_DEFAULT_UPDATE_MASK_ZERO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0x0080000FFFFFFCLL<br>#define&nbsp;PI_DEFAULT_UPDATE_MASK_PI2B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0x0080480FFFFFFCLL<br>#define&nbsp;PI_DEFAULT_UPDATE_MASK_PI3B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0x0000000FFFFFFCLL<br>#define&nbsp;PI_DEFAULT_UPDATE_MASK_PI4B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0x0000000FFFFFFCLL<br>#define&nbsp;PI_DEFAULT_UPDATE_MASK_COMPUTE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0x00FFFFFFFFFFFFLL<br>#define&nbsp;PI_DEFAULT_MEM_ALLOC_MODE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PI_MEM_ALLOC_AUTO<br><br>#define&nbsp;PI_DEFAULT_CFG_INTERNALS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0<br><br></code> \ No newline at end of file
diff --git a/DOC/tmp/body/download.body b/DOC/tmp/body/download.body
deleted file mode 100644
index cdabc9a..0000000
--- a/DOC/tmp/body/download.body
+++ /dev/null
@@ -1,57 +0,0 @@
-
-If the pigpio daemon is running it should be killed (sudo killall
-pigpiod) before make install and restarted afterwards (sudo
-pigpiod).<br>
-<br>
-<span style="font-weight: bold;">The initial part of the make, the
-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>
-make<br>
-sudo make install<br></code><br>
-<br>
-If the Python part of the install fails it may be because you need
-the setup tools.<br>
-<br>
-<code>sudo apt install python-setuptools
-python3-setuptools<br></code><br>
-<br>
-<h3>To check the library</h3>
-These tests make extensive use of GPIO 25 (pin 22).&nbsp; Make sure
-nothing, or only a LED, is connected to the GPIO before running the
-tests.&nbsp; Most tests are statistical in nature and so may on
-occasion fail.&nbsp; Repeated failures on the same test or many
-failures in a group of tests indicate a problem.<br>
-<code><br>
-sudo ./x_pigpio # check C I/F<br>
-<br>
-sudo pigpiod&nbsp;&nbsp;&nbsp; # start daemon<br>
-<br>
-./x_pigpiod_if2 # check C&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I/F to
-daemon<br>
-./x_pigpio.py&nbsp;&nbsp; # check Python I/F to daemon<br>
-./x_pigs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # check
-pigs&nbsp;&nbsp; I/F to daemon<br>
-./x_pipe&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # check
-pipe&nbsp;&nbsp; I/F to daemon<br>
-<br>
-<br></code>
-<h3>To compile, link, and run a C program</h3>
-<code>gcc -Wall -pthread -o foobar foobar.c -lpigpio -lrt<br>
-sudo ./foobar</code><code><br></code><br>
-<h3>To start the pigpio daemon<br></h3>
-<code>sudo pigpiod<br></code>
-<h3>To stop the pigpio daemon<br></h3>
-<code>sudo killall pigpiod<br></code><br>
-<h3>github</h3>
-<code>git clone https://github.com/joan2937/pigpio</code><br>
-<h3>Raspbian (raspberrypi.org image)</h3>
-<p>This may not be the most recent version.&nbsp; You can check the
-version with the command pigpiod -v.<br></p>
-<code>sudo apt-get update<br>
-sudo apt-get install pigpio python-pigpio python3-pigpio</code><br>
-<br>
diff --git a/DOC/tmp/body/ex_LDR.body b/DOC/tmp/body/ex_LDR.body
deleted file mode 100644
index 1b1911a..0000000
--- a/DOC/tmp/body/ex_LDR.body
+++ /dev/null
@@ -1,141 +0,0 @@
-
-<p>The following code shows a method of reading analogue sensors on
-the digital input only Pi.&nbsp; A Light Dependent Resistor (LDR)
-varies its resistance according to the incident light
-intensisty.</p>
-<h3>SETUP</h3>
-<img src="images/LDR-fritz.png" alt="fritzing diagram" style=
-"width: 200px; height: 300px;" align="left" hspace="10">The LDR
-used is a Cadmium Sulphide device with a 1MOhm dark resistance and
-2-4KOhm at 100 lux.&nbsp; The capacitor is a 104
-ceramic.<span itemprop="name"><br>
-<br>
-One end of the capacitor is connected to Pi ground.<br>
-<br>
-One end of the LDR is connected to Pi 3V3.<br>
-<br>
-The other ends of the capacitor and LDR are connected to a spare
-gpio.</span><br>
-<p>Here P1-1 is used for 3V3, P1-20 is used for ground, and gpio 18
-(P1-12) is used for the gpio.<br clear="all"></p>
-<p><img src="images/LDR-photo.jpg" style=
-"width: 500px; height: 667px;" alt="photo of set-up"></p>
-<h3>CODE</h3>
-<code>#include &lt;stdio.h&gt;<br>
-<br>
-#include &lt;pigpio.h&gt;<br>
-<br>
-/*
------------------------------------------------------------------------<br>
-
-<br>
-&nbsp;&nbsp; 3V3 ----- Light Dependent Resistor --+-- Capacitor
------ Ground<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-+-- gpio<br>
-<br>
-<br>
-&nbsp; cc -o LDR LDR.c -lpigpio -lpthread -lrt<br>
-&nbsp; sudo ./LDR<br>
-<br>
-*/<br>
-<br>
-#define LDR 18<br>
-<br>
-/* forward declaration */<br>
-<br>
-void alert(int pin, int level, uint32_t tick);<br>
-<br>
-int main (int argc, char *argv[])<br>
-{<br>
-&nbsp;&nbsp; if (gpioInitialise()&lt;0) return 1;<br>
-<br>
-&nbsp;&nbsp; gpioSetAlertFunc(LDR, alert); /* call alert when LDR
-changes state */<br>
-&nbsp;&nbsp;&nbsp;&nbsp;<br>
-&nbsp;&nbsp; while (1)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioSetMode(LDR, PI_OUTPUT); /*
-drain capacitor */<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioWrite(LDR, PI_OFF);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioDelay(200); /* 50 micros is
-enough, 200 is overkill */<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioSetMode(LDR, PI_INPUT); /* start
-capacitor recharge */<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioDelay(10000); /* nominal 100
-readings per second */<br>
-&nbsp;&nbsp; }<br>
-<br>
-&nbsp;&nbsp; gpioTerminate();<br>
-}<br>
-<br>
-void alert(int pin, int level, uint32_t tick)<br>
-{<br>
-&nbsp;&nbsp; static uint32_t inited = 0;<br>
-&nbsp;&nbsp; static uint32_t lastTick, firstTick;<br>
-<br>
-&nbsp;&nbsp; uint32_t diffTick;<br>
-<br>
-&nbsp;&nbsp; if (inited)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; diffTick = tick - lastTick;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lastTick = tick;<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (level == 1) printf("%u %d\ ",
-tick-firstTick, diffTick);<br>
-&nbsp;&nbsp; }<br>
-&nbsp;&nbsp; else<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inited = 1;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; firstTick = tick;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lastTick = firstTick;<br>
-&nbsp;&nbsp; }<br>
-}<br></code>
-<h3>BUILD</h3>
-<code>cc -o LDR LDR.c -lpigpio -lrt -lpthread<br></code>
-<h3>RUN</h3>
-<code>sudo ./LDR &gt;LDR.dat &amp;</code><br>
-<br>
-While the program is running you can capture the waveform using the
-notification feature built in to pigpio.&nbsp; Issue the following
-commands on the Pi.<br>
-<br>
-<code>pigs no<br>
-pig2vcd&nbsp; &lt;/dev/pigpio0 &gt;LDR.vcd &amp;<br>
-pigs nb 0 0x40000 # set bit for gpio 18<br></code>
-<p>Change the light falling on the LDR for a few seconds (e.g.
-shine a torch on it or shade it with your hands).<br></p>
-<code>pigs nc 0</code><br>
-<p>The file LDR.vcd will contain the captured waveform, which can
-be viewed using GTKWave.</p>
-<p>Overview</p>
-<img src="images/LDR-wave-1.png" style=
-"width: 600px; height: 100px;" alt="LDR waveform 1"><br>
-<p>Reading circa every 10ms<br></p>
-<img src="images/LDR-wave-2.png" style=
-"width: 600px; height: 100px;" alt="LDR waveform 2"><br>
-<p>One reading, circa 400us<br></p>
-<img src="images/LDR-wave-3.png" style=
-"width: 600px; height: 100px;" alt="LDR waveform 3"><br>
-<p>The file LDR.dat will contain pairs of timestamps and recharge
-time (in us).&nbsp; The following&nbsp; script will convert the
-timestamps into seconds.<span style=
-"font-style: italic;"><br></span></p>
-<p><code>awk '{print $1/1000000, $2}' LDR.dat
-&gt;LDR-secs.dat</code></p>
-<p>Gnuplot is a useful tool to graph data.<br></p>
-plot [14:24] 'LDR-secs.dat' with lines title 'LDR'
-<p>Gnuplot readings 14-24 seconds<br></p>
-<p><img src="images/LDR-gnup-1.png" style=
-"width: 600px; height: 321px;" alt="gnuplot 1"></p>
-plot [18:21] 'LDR-secs.dat' with lines title 'LDR'<br>
-<br>
-Gnuplot readings 18-21 seconds
-<p><img src="images/LDR-gnup-2.png" style=
-"width: 600px; height: 321px;" alt="Gnuplot 2"></p>
diff --git a/DOC/tmp/body/ex_ir_remote.body b/DOC/tmp/body/ex_ir_remote.body
deleted file mode 100644
index cebc97f..0000000
--- a/DOC/tmp/body/ex_ir_remote.body
+++ /dev/null
@@ -1,244 +0,0 @@
-
-<p>The following code shows one way to read an infrared remote
-control device (the sort used in TVs and stereo systems).</p>
-<h3>SETUP</h3>
-<img alt="fritzing diagram" style="width: 200px; height: 317px;"
-src="images/ir-fritz.png" align="left" hspace="10">The device used
-is a <span itemprop="name">SFH5110 (IR Receiver for remote control,
-carrier 38 kHz).<br>
-<br></span> Pin 1 (left from front) may be connected to any spare
-gpio.&nbsp; Here it's connected via a 4K7 current limiting
-resistor.&nbsp; This isn't really needed as the device has an
-internal 23K resistor in-line.&nbsp; It does no harm though.<br>
-<br>
-Pin 2 should be connected to a Pi ground pin.<br>
-<br>
-Pin 3 should be connected to a Pi 5V pin.<br>
-<p>Here pin 1 to gpio7 (P1-26) via a 4K7 resistor, pin 2 to ground
-(P1-14), and pin 3 to 5V (P1-2).<br clear="all"></p>
-<p><img src="images/ir-photo.jpg" style=
-"width: 500px; height: 500px;" alt="photo of set-up"></p>
-<h3>CODE</h3>
-<code>#include &lt;stdio.h&gt;<br>
-<br>
-#include &lt;pigpio.h&gt;<br>
-<br>
-#define IR_PIN 7<br>
-<br>
-#define OUTSIDE_CODE 0<br>
-#define INSIDE_CODE&nbsp; 1<br>
-<br>
-#define MIN_MESSAGE_GAP 3000<br>
-#define MAX_MESSAGE_END 3000<br>
-<br>
-#define MAX_TRANSITIONS 500<br>
-<br>
-/*<br>
-&nbsp;&nbsp; using the FNV-1a
-hash&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
-
-&nbsp;&nbsp; from
-http://isthe.com/chongo/tech/comp/fnv/#FNV-param<br>
-*/<br>
-<br>
-#define FNV_PRIME_32 16777619<br>
-#define FNV_BASIS_32 2166136261U<br>
-<br>
-static volatile uint32_t ir_hash = 0;<br>
-<br>
-typedef struct<br>
-{<br>
-&nbsp;&nbsp; int state;<br>
-&nbsp;&nbsp; int count;<br>
-&nbsp;&nbsp; int level;<br>
-&nbsp;&nbsp; uint16_t micros[MAX_TRANSITIONS];<br>
-} decode_t;<br>
-<br>
-/* forward declarations */<br>
-<br>
-void&nbsp;&nbsp;&nbsp;&nbsp; alert(int gpio, int level, uint32_t
-tick);<br>
-uint32_t getHash(decode_t * decode);<br>
-void&nbsp;&nbsp;&nbsp;&nbsp; updateState(decode_t * decode, int
-level, uint32_t micros);<br>
-<br>
-int main(int argc, char * argv[])<br>
-{<br>
-&nbsp;&nbsp; if (gpioInitialise()&lt;0)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 1 ;<br>
-&nbsp;&nbsp; }<br>
-<br>
-&nbsp;&nbsp; /* IR pin as input */<br>
-<br>
-&nbsp;&nbsp; gpioSetMode(IR_PIN, PI_INPUT);<br>
-<br>
-&nbsp;&nbsp; /* 5ms max gap after last pulse */<br>
-<br>
-&nbsp;&nbsp; gpioSetWatchdog(IR_PIN, 5);<br>
-<br>
-&nbsp;&nbsp; /* monitor IR level changes */<br>
-<br>
-&nbsp;&nbsp; gpioSetAlertFunc(IR_PIN, alert);<br>
-<br>
-&nbsp;&nbsp; while (1)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (ir_hash)<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* non-zero means
-new decode */<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("ir code is
-%u\ ", ir_hash);<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ir_hash = 0;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioDelay(100000); /* check remote
-10 times per second */<br>
-&nbsp;&nbsp; }<br>
-<br>
-&nbsp;&nbsp; gpioTerminate();<br>
-}<br>
-<br>
-void alert(int gpio, int level, uint32_t tick)<br>
-{<br>
-&nbsp;&nbsp; static int inited = 0;<br>
-<br>
-&nbsp;&nbsp; static decode_t activeHigh, activeLow;<br>
-<br>
-&nbsp;&nbsp; static uint32_t lastTick;<br>
-<br>
-&nbsp;&nbsp; uint32_t diffTick;<br>
-<br>
-&nbsp;&nbsp; if (!inited)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inited = 1;<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activeHigh.state = OUTSIDE_CODE;
-activeHigh.level = PI_LOW;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activeLow.state&nbsp; =
-OUTSIDE_CODE; activeLow.level&nbsp; = PI_HIGH;<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lastTick = tick;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<br>
-&nbsp;&nbsp; }<br>
-<br>
-&nbsp;&nbsp; diffTick = tick - lastTick;<br>
-<br>
-&nbsp;&nbsp; if (level != PI_TIMEOUT) lastTick = tick;<br>
-<br>
-&nbsp;&nbsp; updateState(&amp;activeHigh, level, diffTick);<br>
-&nbsp;&nbsp; updateState(&amp;activeLow, level, diffTick);<br>
-}<br>
-<br>
-void updateState(decode_t * decode, int level, uint32_t micros)<br>
-{<br>
-&nbsp;&nbsp; /*<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; We are dealing with active high as
-well as active low<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; remotes.&nbsp; Abstract the common
-functionality.<br>
-&nbsp;&nbsp; */<br>
-<br>
-&nbsp;&nbsp; if (decode-&gt;state == OUTSIDE_CODE)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (level == decode-&gt;level)<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (micros &gt;
-MIN_MESSAGE_GAP)<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-decode-&gt;state = INSIDE_CODE;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-decode-&gt;count = 0;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
-&nbsp;&nbsp; }<br>
-&nbsp;&nbsp; else<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (micros &gt; MAX_MESSAGE_END)<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* end of message
-*/<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* ignore if last
-code not consumed */<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!ir_hash)
-ir_hash = getHash(decode);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; decode-&gt;state =
-OUTSIDE_CODE;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if
-(decode-&gt;count &lt; (MAX_TRANSITIONS-1))<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-if (level != PI_TIMEOUT)<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-decode-&gt;micros[decode-&gt;count++] = micros;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
-&nbsp;&nbsp; }<br>
-}<br>
-<br>
-int compare(unsigned int oldval, unsigned int newval)<br>
-{<br>
-&nbsp;&nbsp; if&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (newval &lt; (oldval
-* 0.75)) {return 1;}<br>
-&nbsp;&nbsp; else if (oldval &lt; (newval * 0.75)) {return 2;}<br>
-&nbsp;&nbsp;
-else&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-{return 4;}<br>
-}<br>
-<br>
-uint32_t getHash(decode_t * decode)<br>
-{<br>
-&nbsp;&nbsp; /* use FNV-1a */<br>
-<br>
-&nbsp;&nbsp; uint32_t hash;<br>
-&nbsp;&nbsp; int i, value;<br>
-<br>
-&nbsp;&nbsp; if (decode-&gt;count &lt; 6) {return 0;}<br>
-<br>
-&nbsp;&nbsp; hash = FNV_BASIS_32;<br>
-<br>
-&nbsp;&nbsp; for (i=0; i&lt;(decode-&gt;count-2); i++)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value =
-compare(decode-&gt;micros[i], decode-&gt;micros[i+2]);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hash = hash ^ value;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hash = (hash * FNV_PRIME_32);<br>
-&nbsp;&nbsp; }<br>
-<br>
-&nbsp;&nbsp; return hash;<br>
-}<br></code>
-<h3>BUILD</h3>
-<code>cc -o ir_remote ir_remote.c -lpigpio -lrt
--lpthread<br></code>
-<h3>RUN</h3>
-<code>sudo ./ir_remote</code><br>
-<p>A hash code is formed from the level transitions detected during
-a remote key press.&nbsp; This is likely to be unique over multiple
-remotes and keys.</p>
-<p>While the program is running you can capture the waveform using
-the notification feature built in to pigpio.&nbsp; Issue the
-following commands on the Pi.</p>
-<code>pigs no<br>
-pig2vcd&nbsp; &lt;/dev/pigpio0 &gt;ir.vcd &amp;<br>
-pigs nb 0 0x80 # set bits for gpios 7 (0x80)<br></code>
-<p>Press a few different remotes and keys.&nbsp; Then enter<br></p>
-<code>pigs nc 0</code><br>
-<p>The file ir.vcd will contain the captured waveform, which can be
-viewed using GTKWave.</p>
-<p>Overview</p>
-<img src="images/ir-wave-1.png" style=
-"width: 600px; height: 100px;" alt="ir remote waveform 1"><br>
-<p>Remote A typical waveform</p>
-<img src="images/ir-wave-2.png" style=
-"width: 600px; height: 100px;" alt="ir remote waveform 2"><br>
-<p>Remote B typical waveform</p>
-<img style="width: 600px; height: 100px;" alt=
-"ir remote waveform 3" src="images/ir-wave-3.png">
diff --git a/DOC/tmp/body/ex_motor_shield.body b/DOC/tmp/body/ex_motor_shield.body
deleted file mode 100644
index fbadb3a..0000000
--- a/DOC/tmp/body/ex_motor_shield.body
+++ /dev/null
@@ -1,245 +0,0 @@
-
-The following example demonstrates the use of an Arduino shield
-from the Rasperry Pi.<br>
-<br>
-The shield used is a clone of the Adafruit motor shield.&nbsp; See
-<a href="http://shieldlist.org/adafruit/motor">shieldlist.org</a>
-for details.<br>
-<br>
-For the demonstration DC motors 3 and 4 are being driven forwards
-and backwards with changing speeds (speeds are controlled via
-PWM).<br>
-<br>
-Seven connections are made between the Pi and the shield.&nbsp;
-Four to latch the motor states (latch, enable, data, clock); Two to
-control motor speed (PWM 3 and 4); and ground.<br>
-<br>
-The code used was ported from the Adafruit Arduino code and
-converted to use the pigpio library.&nbsp; Only the DC motor code
-was ported.<br>
-<br>
-A video of the shield in use is available at <a href=
-"http://youtu.be/Z_l3C246oVI">youtube.com</a><br>
-<code><br>
-#include &lt;stdio.h&gt;</code> <code><br>
-<br>
-#include &lt;pigpio.h&gt;<br>
-<br>
-/*<br>
-&nbsp;&nbsp; This code may be used to drive the Adafruit (or
-clones) Motor Shield.<br>
-<br>
-&nbsp;&nbsp; The code as written only supports DC motors.<br>
-<br>
-&nbsp;&nbsp; http://shieldlist.org/adafruit/motor<br>
-<br>
-&nbsp;&nbsp; The shield pinouts are<br>
-<br>
-&nbsp;&nbsp; D12 MOTORLATCH<br>
-&nbsp;&nbsp; D11 PMW motor 1<br>
-&nbsp;&nbsp; D10 Servo 1<br>
-&nbsp;&nbsp; D9&nbsp; Servo 2<br>
-&nbsp;&nbsp; D8&nbsp; MOTORDATA<br>
-<br>
-&nbsp;&nbsp; D7&nbsp; MOTORENABLE<br>
-&nbsp;&nbsp; D6&nbsp; PWM motor 4<br>
-&nbsp;&nbsp; D5&nbsp; PWM motor 3<br>
-&nbsp;&nbsp; D4&nbsp; MOTORCLK<br>
-&nbsp;&nbsp; D3&nbsp; PWM motor 2<br>
-<br>
-&nbsp;&nbsp; The motor states (forward, backward, brake, release)
-are encoded using the<br>
-&nbsp;&nbsp; MOTOR_ latch pins.&nbsp; This saves four gpios.<br>
-*/<br>
-<br>
-typedef unsigned char uint8_t;<br>
-<br>
-#define BIT(bit) (1 &lt;&lt; (bit))<br>
-<br>
-/* assign gpios to drive the shield pins */<br>
-<br>
-/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-Shield&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Pi */<br>
-<br>
-#define MOTORLATCH&nbsp; 14<br>
-#define MOTORCLK&nbsp;&nbsp;&nbsp; 24<br>
-#define MOTORENABLE 25<br>
-#define MOTORDATA&nbsp;&nbsp; 15<br>
-<br>
-#define MOTOR_3_PWM&nbsp; 7<br>
-#define MOTOR_4_PWM&nbsp; 8<br>
-<br>
-/*<br>
-&nbsp;&nbsp; The only other connection needed between the Pi and
-the shield<br>
-&nbsp;&nbsp; is ground to ground. I used Pi P1-6 to shield gnd
-(next to D13).<br>
-*/<br>
-<br>
-/* assignment of motor states to latch */<br>
-<br>
-#define MOTOR1_A 2<br>
-#define MOTOR1_B 3<br>
-#define MOTOR2_A 1<br>
-#define MOTOR2_B 4<br>
-#define MOTOR4_A 0<br>
-#define MOTOR4_B 6<br>
-#define MOTOR3_A 5<br>
-#define MOTOR3_B 7<br>
-<br>
-#define FORWARD&nbsp; 1<br>
-#define BACKWARD 2<br>
-#define BRAKE&nbsp;&nbsp;&nbsp; 3<br>
-#define RELEASE&nbsp; 4<br>
-<br>
-static uint8_t latch_state;<br>
-<br>
-void latch_tx(void)<br>
-{<br>
-&nbsp;&nbsp; unsigned char i;<br>
-<br>
-&nbsp;&nbsp; gpioWrite(MOTORLATCH, PI_LOW);<br>
-<br>
-&nbsp;&nbsp; gpioWrite(MOTORDATA, PI_LOW);<br>
-<br>
-&nbsp;&nbsp; for (i=0; i&lt;8; i++)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioDelay(10);&nbsp; // 10 micros
-delay<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioWrite(MOTORCLK, PI_LOW);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (latch_state &amp; BIT(7-i))
-gpioWrite(MOTORDATA, PI_HIGH);<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-else&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-gpioWrite(MOTORDATA, PI_LOW);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioDelay(10);&nbsp; // 10 micros
-delay<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioWrite(MOTORCLK, PI_HIGH);<br>
-&nbsp;&nbsp; }<br>
-<br>
-&nbsp;&nbsp; gpioWrite(MOTORLATCH, PI_HIGH);<br>
-}<br>
-<br>
-void init(void)<br>
-{<br>
-&nbsp;&nbsp; latch_state = 0;<br>
-<br>
-&nbsp;&nbsp; latch_tx();<br>
-<br>
-&nbsp;&nbsp; gpioWrite(MOTORENABLE, PI_LOW);<br>
-}<br>
-<br>
-void DCMotorInit(uint8_t num)<br>
-{<br>
-&nbsp;&nbsp; switch (num)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 1: latch_state &amp;=
-~BIT(MOTOR1_A) &amp; ~BIT(MOTOR1_B); break;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 2: latch_state &amp;=
-~BIT(MOTOR2_A) &amp; ~BIT(MOTOR2_B); break;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 3: latch_state &amp;=
-~BIT(MOTOR3_A) &amp; ~BIT(MOTOR3_B); break;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 4: latch_state &amp;=
-~BIT(MOTOR4_A) &amp; ~BIT(MOTOR4_B); break;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; default: return;<br>
-&nbsp;&nbsp; }<br>
-<br>
-&nbsp;&nbsp; latch_tx();<br>
-<br>
-&nbsp;&nbsp; printf("Latch=%08X\ ", latch_state);<br>
-}<br>
-<br>
-void DCMotorRun(uint8_t motornum, uint8_t cmd)<br>
-{<br>
-&nbsp;&nbsp; uint8_t a, b;<br>
-<br>
-&nbsp;&nbsp; switch (motornum)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 1: a = MOTOR1_A; b = MOTOR1_B;
-break;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 2: a = MOTOR2_A; b = MOTOR2_B;
-break;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 3: a = MOTOR3_A; b = MOTOR3_B;
-break;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 4: a = MOTOR4_A; b = MOTOR4_B;
-break;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; default: return;<br>
-&nbsp;&nbsp; }<br>
-&nbsp;<br>
-&nbsp;&nbsp; switch (cmd)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case FORWARD:&nbsp; latch_state
-|=&nbsp; BIT(a); latch_state &amp;= ~BIT(b); break;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case BACKWARD: latch_state &amp;=
-~BIT(a); latch_state |=&nbsp; BIT(b); break;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case RELEASE:&nbsp; latch_state
-&amp;= ~BIT(a); latch_state &amp;= ~BIT(b); break;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; default: return;<br>
-&nbsp;&nbsp; }<br>
-<br>
-&nbsp;&nbsp; latch_tx();<br>
-<br>
-&nbsp;&nbsp; printf("Latch=%08X\ ", latch_state);<br>
-}<br>
-<br>
-int main (int argc, char *argv[])<br>
-{<br>
-&nbsp;&nbsp; int i;<br>
-<br>
-&nbsp;&nbsp; if (gpioInitialise()&lt;0) return 1;<br>
-<br>
-&nbsp;&nbsp; gpioSetMode(MOTORLATCH,&nbsp; PI_OUTPUT);<br>
-&nbsp;&nbsp; gpioSetMode(MOTORENABLE, PI_OUTPUT);<br>
-&nbsp;&nbsp; gpioSetMode(MOTORDATA,&nbsp;&nbsp; PI_OUTPUT);<br>
-&nbsp;&nbsp; gpioSetMode(MOTORCLK,&nbsp;&nbsp;&nbsp;
-PI_OUTPUT);<br>
-<br>
-&nbsp;&nbsp; gpioSetMode(MOTOR_3_PWM, PI_OUTPUT);<br>
-&nbsp;&nbsp; gpioSetMode(MOTOR_4_PWM, PI_OUTPUT);<br>
-<br>
-&nbsp;&nbsp; gpioPWM(MOTOR_3_PWM, 0);<br>
-&nbsp;&nbsp; gpioPWM(MOTOR_4_PWM, 0);<br>
-<br>
-&nbsp;&nbsp; init();<br>
-<br>
-&nbsp;&nbsp; for (i=60; i&lt;160; i+=20)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioPWM(MOTOR_3_PWM, i);<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioPWM(MOTOR_4_PWM, 220-i);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DCMotorRun(3, FORWARD);<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DCMotorRun(4, BACKWARD);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep(2);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DCMotorRun(3, RELEASE);<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DCMotorRun(4, RELEASE);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep(2);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioPWM(MOTOR_4_PWM, i);<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioPWM(MOTOR_3_PWM, 220-i);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DCMotorRun(3, BACKWARD);<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DCMotorRun(4, FORWARD);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep(2);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DCMotorRun(3, RELEASE);<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DCMotorRun(4, RELEASE);<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep(2);<br>
-&nbsp;&nbsp; }<br>
-<br>
-&nbsp;&nbsp; gpioPWM(MOTOR_4_PWM, 0);<br>
-&nbsp;&nbsp; gpioPWM(MOTOR_3_PWM, 0);<br>
-<br>
-&nbsp;&nbsp; DCMotorRun(3, RELEASE);<br>
-&nbsp;&nbsp; DCMotorRun(4, RELEASE);<br>
-<br>
-&nbsp;&nbsp; gpioTerminate();<br>
-}<br></code>
diff --git a/DOC/tmp/body/ex_rotary_encoder.body b/DOC/tmp/body/ex_rotary_encoder.body
deleted file mode 100644
index f399e29..0000000
--- a/DOC/tmp/body/ex_rotary_encoder.body
+++ /dev/null
@@ -1,176 +0,0 @@
-
-<p>The following code shows one way to read an incremental
-mechanical rotary enoder (the sort used for volume control in audio
-systems).&nbsp; These rotary encoders have two switches A and B
-which return a quadrature output, i.e. they are 90 degrees out of
-phase.</p>
-<h3>SETUP</h3>
-<img alt="fritzing diagram" style="width: 200px; height: 300px;"
-src="images/re-fritz.png" align="left" hspace="10">The common
-(centre) terminal should be connected to a Pi ground.
-<p>The A and B terminals may be connected to any spare gpios.</p>
-<p>Here A to gpio18 (P1-12), common to ground (P1-20), B to gpio7
-(P1-26).<br clear="all"></p>
-<p><img src="images/re-photo.jpg" style=
-"width: 400px; height: 300px;" alt="photo of set-up"></p>
-<h3>CODE</h3>
-<code>#include &lt;stdio.h&gt;<br>
-<br>
-#include &lt;pigpio.h&gt;<br>
-<br>
-/*<br>
-&nbsp;&nbsp; Rotary encoder connections:<br>
-<br>
-&nbsp;&nbsp; Encoder A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - gpio
-18&nbsp;&nbsp; (pin P1-12)<br>
-&nbsp;&nbsp; Encoder B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - gpio
-7&nbsp;&nbsp;&nbsp; (pin P1-26)<br>
-&nbsp;&nbsp; Encoder Common - Pi ground (pin P1-20)<br>
-*/<br>
-<br>
-#define ENCODER_A 18<br>
-#define ENCODER_B&nbsp; 7<br>
-<br>
-static volatile int encoderPos;<br>
-<br>
-/* forward declaration */<br>
-<br>
-void encoderPulse(int gpio, int lev, uint32_t tick);<br>
-<br>
-int main(int argc, char * argv[])<br>
-{<br>
-&nbsp;&nbsp; int pos=0;<br>
-<br>
-&nbsp;&nbsp; if (gpioInitialise()&lt;0) return 1;<br>
-<br>
-&nbsp;&nbsp; gpioSetMode(ENCODER_A, PI_INPUT);<br>
-&nbsp;&nbsp; gpioSetMode(ENCODER_B, PI_INPUT);<br>
-<br>
-&nbsp;&nbsp; /* pull up is needed as encoder common is grounded
-*/<br>
-<br>
-&nbsp;&nbsp; gpioSetPullUpDown(ENCODER_A, PI_PUD_UP);<br>
-&nbsp;&nbsp; gpioSetPullUpDown(ENCODER_B, PI_PUD_UP);<br>
-<br>
-&nbsp;&nbsp; encoderPos = pos;<br>
-<br>
-&nbsp;&nbsp; /* monitor encoder level changes */<br>
-<br>
-&nbsp;&nbsp; gpioSetAlertFunc(ENCODER_A, encoderPulse);<br>
-&nbsp;&nbsp; gpioSetAlertFunc(ENCODER_B, encoderPulse);<br>
-<br>
-&nbsp;&nbsp; while (1)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (pos != encoderPos)<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pos =
-encoderPos;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("pos=%d\ ",
-pos);<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpioDelay(20000); /* check pos 50
-times per second */<br>
-&nbsp;&nbsp; }<br>
-<br>
-&nbsp;&nbsp; gpioTerminate();<br>
-}<br>
-<br>
-void encoderPulse(int gpio, int level, uint32_t tick)<br>
-{<br>
-&nbsp;&nbsp; /*<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-+---------+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-+---------+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>
-&nbsp;&nbsp; A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>
-&nbsp;&nbsp;
-+---------+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-+---------+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +-----
-1<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-+---------+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-+---------+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-0<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>
-&nbsp;&nbsp; B&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>
-&nbsp;&nbsp; ----+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-+---------+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-+---------+&nbsp; 1<br>
-<br>
-&nbsp;&nbsp; */<br>
-<br>
-&nbsp;&nbsp; static int levA=0, levB=0, lastGpio = -1;<br>
-<br>
-&nbsp;&nbsp; if (gpio == ENCODER_A) levA = level; else levB =
-level;<br>
-<br>
-&nbsp;&nbsp; if (gpio != lastGpio) /* debounce */<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lastGpio = gpio;<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ((gpio == ENCODER_A) &amp;&amp;
-(level == 0))<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!levB)
-++encoderPos;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if ((gpio == ENCODER_B)
-&amp;&amp; (level == 1))<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (levA)
---encoderPos;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
-&nbsp;&nbsp; }<br>
-}<br></code>
-<h3>BUILD</h3>
-<code>cc -o rotary_encoder rotary_encoder.c -lpigpio -lrt
--lpthread<br></code>
-<h3>RUN</h3>
-<code>sudo ./rotary_encoder</code><br>
-<p>While the program is running you can capture the waveform using
-the notification feature built in to pigpio.&nbsp; Issue the
-following commands on the Pi.</p>
-<code>pigs no<br>
-pig2vcd&nbsp; &lt;/dev/pigpio0 &gt;re.vcd &amp;<br>
-pigs nb 0 0x40080 # set bits for gpios 7 (0x80) and 18
-(0x40000)<br></code>
-<p>Twiddle the rotary encoder forwards and backwards for a few
-seconds.&nbsp; Then enter<br></p>
-<code>pigs nc 0</code><br>
-<p>The file re.vcd will contain the captured waveform, which can be
-viewed using GTKWave.</p>
-<br>
-Overview<br>
-<br>
-<img src="images/re-wave-1.png" style=
-"width: 600px; height: 100px;" alt=
-"rotary encoder waveform overview"><br>
-<br>
-Detail of switch bounce.&nbsp; Contact A bounces for circa 700 us
-before completing the level transition<br>
-<br>
-<img src="images/re-wave-2.png" style=
-"width: 600px; height: 100px;" alt=
-"rotary encoder waveform detail"><br>
diff --git a/DOC/tmp/body/ex_sonar_ranger.body b/DOC/tmp/body/ex_sonar_ranger.body
deleted file mode 100644
index 8b3de67..0000000
--- a/DOC/tmp/body/ex_sonar_ranger.body
+++ /dev/null
@@ -1,155 +0,0 @@
-
-<p>The following code shows a method of reading a class of sonar
-rangers.&nbsp; These rangers requires a trigger pulse.&nbsp;
-Shortly after receiving a trigger they transmit a noise pulse and
-set the echo line high.&nbsp; When the echo is received the echo
-line is set low.<br></p>
-<h3>SETUP</h3>
-<img src="images/son-fritz.png" alt="fritzing diagram" style=
-"width: 200px; height: 600px;" align="left" hspace="10"><br>
-<br>
-<br>
-<br>
-<br>
-The ranger used is a SRF05 (check the pinouts, there are many
-variants).<br>
-<br>
-The fritzing diagram shows the back of the ranger, i.e. pin 1 is
-the rightmost.<br>
-<br>
-Pin 1 is 5V.<br>
-Pin 2 is the trigger line.<br>
-Pin 3 is the echo line.<br>
-Pin 4 is out (unused).<br>
-Pin 5 is ground.<br>
-<br clear="all">
-<p><img src="images/son-photo.jpg" style=
-"width: 500px; height: 376px;" alt="photo of set-up"></p>
-<h3>CODE</h3>
-<code>#include &lt;stdio.h&gt;<br>
-<br>
-#include &lt;pigpio.h&gt;<br>
-<br>
-/*<br>
-<br>
-P1&nbsp; Name&nbsp; gpio&nbsp;&nbsp;&nbsp; used for<br>
-<br>
-&nbsp;2&nbsp; 5V&nbsp;&nbsp;&nbsp; ---&nbsp;&nbsp;&nbsp;&nbsp;
-5V<br>
-&nbsp;6&nbsp; GND&nbsp;&nbsp; ---&nbsp;&nbsp;&nbsp;&nbsp;
-Ground<br>
-24&nbsp; CE0&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-Sonar echo<br>
-26&nbsp; CE1&nbsp;&nbsp; 7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-Sonar trigger<br>
-<br>
-*/<br>
-<br>
-#define SONAR_TRIGGER 7<br>
-#define SONAR_ECHO&nbsp;&nbsp;&nbsp; 8<br>
-<br>
-/* forward prototypes */<br>
-<br>
-void sonarTrigger(void);<br>
-<br>
-void sonarEcho(int gpio, int level, uint32_t tick);<br>
-<br>
-int main(int argc, char *argv[])<br>
-{<br>
-&nbsp;&nbsp; if (gpioInitialise()&lt;0) return 1;<br>
-<br>
-&nbsp;&nbsp; gpioSetMode(SONAR_TRIGGER, PI_OUTPUT);<br>
-&nbsp;&nbsp; gpioWrite&nbsp; (SONAR_TRIGGER, PI_OFF);<br>
-<br>
-&nbsp;&nbsp; gpioSetMode(SONAR_ECHO,&nbsp;&nbsp;&nbsp;
-PI_INPUT);<br>
-<br>
-&nbsp;&nbsp; /* update sonar 20 times a second, timer #0 */<br>
-<br>
-&nbsp;&nbsp; gpioSetTimerFunc(0, 50, sonarTrigger); /* every 50ms
-*/<br>
-<br>
-&nbsp;&nbsp; /* monitor sonar echos */<br>
-<br>
-&nbsp;&nbsp; gpioSetAlertFunc(SONAR_ECHO, sonarEcho);<br>
-<br>
-&nbsp;&nbsp; while (1) sleep(1);<br>
-<br>
-&nbsp;&nbsp; gpioTerminate();<br>
-<br>
-&nbsp;&nbsp; return 0;<br>
-}<br>
-<br>
-void sonarTrigger(void)<br>
-{<br>
-&nbsp;&nbsp; /* trigger a sonar reading */<br>
-<br>
-&nbsp;&nbsp; gpioWrite(SONAR_TRIGGER, PI_ON);<br>
-<br>
-&nbsp;&nbsp; gpioDelay(10); /* 10us trigger pulse */<br>
-<br>
-&nbsp;&nbsp; gpioWrite(SONAR_TRIGGER, PI_OFF);<br>
-}<br>
-<br>
-void sonarEcho(int gpio, int level, uint32_t tick)<br>
-{<br>
-&nbsp;&nbsp; static uint32_t startTick, firstTick=0;<br>
-<br>
-&nbsp;&nbsp; int diffTick;<br>
-<br>
-&nbsp;&nbsp; if (!firstTick) firstTick = tick;<br>
-<br>
-&nbsp;&nbsp; if (level == PI_ON)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; startTick = tick;<br>
-&nbsp;&nbsp; }<br>
-&nbsp;&nbsp; else if (level == PI_OFF)<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; diffTick = tick - startTick;<br>
-<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("%u %u\ ", tick-firstTick,
-diffTick);<br>
-&nbsp;&nbsp; }<br>
-}<br></code>
-<h3>BUILD</h3>
-<code>cc -o sonar sonar.c -lpigpio -lrt -lpthread<br></code>
-<h3>RUN</h3>
-<code>sudo ./sonar &gt;sonar.dat &amp;</code><br>
-<br>
-While the program is running you can capture the waveform using the
-notification feature built in to pigpio.&nbsp; Issue the following
-commands on the Pi.<br>
-<br>
-<code>pigs no<br>
-pig2vcd&nbsp; &lt;/dev/pigpio0 &gt;sonar.vcd &amp;<br>
-pigs nb 0 0x180 # set bits for gpios 7 and 8<br></code>
-<p>Move an object in front of the sonar ranger for a few
-seconds.<br></p>
-<code>pigs nc 0</code><br>
-<p>The file sonar.vcd will contain the captured waveform, which can
-be viewed using GTKWave.</p>
-<p>Overview</p>
-<img src="images/son-wave-1.png" style=
-"width: 600px; height: 100px;" alt="LDR waveform 1"><br>
-<p>Reading circa every 10ms<br></p>
-<img src="images/son-wave-2.png" style=
-"width: 600px; height: 100px;" alt="Sonar waveform 2"><br>
-<p>One reading, circa 400us<br></p>
-<img src="images/son-wave-3.png" style=
-"width: 600px; height: 100px;" alt="Sonar waveform 3"><br>
-<p>another</p>
-<img style="width: 600px; height: 100px;" alt="Sonar waveform 4"
-src="images/son-wave-4.png"><br>
-<p>The file sonar.dat will contain pairs of timestamps and echo
-length (in us).&nbsp; The following&nbsp; script will convert the
-timestamps into seconds.<span style=
-"font-style: italic;"><br></span></p>
-<p><code>awk '{print $1/1000000, $2}' sonar.dat
-&gt;sonar-secs.dat</code></p>
-<p>Gnuplot is a useful tool to graph data.<br></p>
-plot 'sonar-secs.dat' title 'Sonar'<br>
-<p><img src="images/son-gnup-1.png" style=
-"width: 600px; height: 321px;" alt="gnuplot 1"><br>
-&nbsp;plot [10:25] 'sonar-secs.dat' title 'Sonar'<br></p>
-<p><img src="images/son-gnup-2.png" style=
-"width: 600px; height: 321px;" alt="gnuplot 1"></p>
diff --git a/DOC/tmp/body/examples.body b/DOC/tmp/body/examples.body
deleted file mode 100644
index 7df20a8..0000000
--- a/DOC/tmp/body/examples.body
+++ /dev/null
@@ -1,495 +0,0 @@
-The following examples show various ways pigpio may be used to communicate with sensors via the GPIO.<br>
-<br>
-Although many are complete programs they are intended to be a starting point in producing your own code, not an end point.<br>
-<br>
-<a href="#Index">Index</a><br><br>
-<a href="#Hardware">Hardware</a><br><br>
-<a href="#Shell code">Shell code</a><br><br>
-<a href="#C code">C code</a><br><br>
-<a href="#C++ code">C++ code</a><br><br>
-<a href="#pigpiod_if2 code">pigpiod_if2 code</a><br><br>
-<a href="#Python code">Python code</a><br><br>
-<a href="#Miscellaneous related code">Miscellaneous related code</a><br><br>
-<a href="#External links">External links</a><br><br>
-<h3><span id="Hardware">Hardware</span></h3>
-A few practical examples of using pigpio with hardware.<br>
-<br>
-<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Hardware_ex_ir_remote"><a href="ex_ir_remote.html">IR Receiver</a><br>2013-06-09</span></td><td>Reading an infrared remote receiver.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Hardware_ex_LDR"><a href="ex_LDR.html">Light Dependent Resistor</a><br>2013-06-09</span></td><td>Measuring brightness with a light dependent resistor (LDR). Improved methods of timing the start of the capacitor recharge are given for <a href="#C_pot_cap_charge_c">C</a> and <a href="#Python_pot_cap_py">Python</a>.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Hardware_ex_motor_shield"><a href="ex_motor_shield.html">Motor Shield</a><br>2013-12-15</span></td><td>Using an Arduino motor shield.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Hardware_ex_rotary_encoder"><a href="ex_rotary_encoder.html">Rotary Encoder</a><br>2013-06-09</span></td><td>Reading a rotary encoder.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Hardware_ex_sonar_ranger"><a href="ex_sonar_ranger.html">Sonar Ranger</a><br>2013-06-10</span></td><td>Measuring range with a sonar ranger.<br>
-<br>
-</td></tr></tbody></table><h3><span id="Shell code">Shell code</span></h3>
-Examples of using pigpio with shell code.<br>
-<br>
-<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Shell_gpiotest"><a href="code/gpiotest.zip">GPIO test</a><br>2014-08-11</span></td><td>This bash script tests the user GPIO. <a href="http://youtu.be/sCJFLKWaxHo">Video</a><br>
-<br>
-</td></tr></tbody></table><h3><span id="C code">C code</span></h3>
-Examples of C pigpio programs.<br>
-<br>
-If your program is called foobar.c then build with<br>
-<br>
-gcc -Wall -pthread -o foobar foobar.c -lpigpio -lrt<br>
-<br>
-<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_freq_count_1"><a href="code/freq_count_1.zip">Frequency Counter 1</a><br>2014-08-20</span></td><td>A program showing how to use the <a href="cif.html#gpioSetAlertFunc">gpioSetAlertFunc</a> function to set a callback for GPIO state changes. A frequency count is generated for each monitored GPIO (frequencies up to 500kHz with a sample rate of 1&mu;s).<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_freq_count_2"><a href="code/freq_count_2.zip">Frequency Counter 2</a><br>2014-08-20</span></td><td>A program showing how to use the <a href="cif.html#gpioSetGetSamplesFunc">gpioSetGetSamplesFunc</a> function to set a callback for accumulated GPIO state changes over the last millisecond. A frequency count is generated for each monitored GPIO (frequencies up to 500kHz with a sample rate of 1&mu;s). Generally the method used is more complicated but more efficient than frequency counter 1.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_hall"><a href="code/hall.zip">Hall Effect Sensor</a><br>2014-06-13</span></td><td>Program to show status changes for a Hall effect sensor.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_I2C_sniffer"><a href="code/I2C_sniffer.zip">I2C Sniffer</a><br>2014-06-15</span></td><td>A program to passively sniff I2C transactions (100kHz bus maximum) and display the results. This C program uses pigpio notifications.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_ir_hasher_c"><a href="code/ir_hasher_c.zip">IR Receiver</a><br>2015-02-25</span></td><td>Function to hash a code from an IR receiver (reading an IR remote control).<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_PCF8591"><a href="code/PCF8591.zip">PCF8591 YL-40</a><br>2014-08-26</span></td><td>A program to display readings from the (I2C) PCF8591.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_pot_cap_charge_c"><a href="code/pot_cap_charge_c.zip">Pot + Capacitor Recharge Timing</a><br>2014-03-14</span></td><td>Function to time capacitor charging (through a resistance). The time can be used to estimate the resistance.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_rotary_encoder_c"><a href="code/rotary_encoder_c.zip">Rotary Encoder</a><br>2015-10-03</span></td><td>Function to decode a mechanical rotary encoder.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_rawMCP3008_c"><a href="code/rawMCP3008_c.zip">SPI bit bang MCP3008</a><br>2016-03-20</span></td><td>This program shows how to read multiple MCP3008 ADC simultaneously with accurately timed intervals. One 10-bit channel of each ADC may be sampled at up to 25k samples per second.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_rawMCP3202_c"><a href="code/rawMCP3202_c.zip">SPI bit bang MCP3202</a><br>2016-03-20</span></td><td>This program shows how to read multiple MCP3202 ADC simultaneously with accurately timed intervals. One 12-bit channel of each ADC may be sampled at up to 25k samples per second.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_rawMCP3XXX_c"><a href="code/rawMCP3XXX_c.zip">SPI bit bang MCP3008 and MCP3202</a><br>2016-03-20</span></td><td>This program shows how to read multiple MCP3008 and MCP3202 ADC simultaneously with accurately timed intervals. One channel of each ADC may be sampled at up to 25k samples per second. The 10-bit MCP3008 readings are multiplied by 4 so they have the same range (0-4095) as the 12-bit MCP3202.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_servo_demo"><a href="code/servo_demo.zip">Servo Pulse Generator</a><br>2016-10-08</span></td><td>This program generates servo pulses on one or more GPIO. Each connected servo is swept between 1000µs and 2000µs at a different speed.<br>
-<br>
-sudo ./servo_demo # Generate pulses on GPIO 4.<br>
-<br>
-sudo ./servo_demo 5 9 20 # Generate pulses on GPIO 5, 9, and 20.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_code/spi-pigpio-speed.c"><a href="code/spi-pigpio-speed.c">SPI pigpio driver speed test</a><br>2016-11-06</span></td><td>This C code is used to benchmark the pigpio SPI driver on the Pi. The code executes a given number of loops at a given baud rate and bytes per transfer.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C_wiegand_c"><a href="code/wiegand_c.zip">Wiegand Reader</a><br>2013-12-30</span></td><td>Function to read a Wiegand Reader.<br>
-<br>
-</td></tr></tbody></table><h3><span id="C++ code">C++ code</span></h3>
-Examples of C++ pigpio programs.<br>
-<br>
-If your program is called foobar.cpp then build with<br>
-<br>
-g++ -Wall -pthread -o foobar foobar.cpp -lpigpio -lrt<br>
-<br>
-<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C++_ir_hasher_cpp"><a href="code/ir_hasher_cpp.zip">IR Receiver</a><br>2015-02-22</span></td><td>Class to hash a code from an IR receiver (reading an IR remote control).<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C++_rotary_encoder_cpp"><a href="code/rotary_encoder_cpp.zip">Rotary Encoder</a><br>2013-12-30</span></td><td>Class to decode a mechanical rotary encoder.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="C++_wiegand_cpp"><a href="code/wiegand_cpp.zip">Wiegand Reader</a><br>2013-12-30</span></td><td>Class to read a Wiegand Reader.<br>
-<br>
-</td></tr></tbody></table><h3><span id="pigpiod_if2 code">pigpiod_if2 code</span></h3>The pigpiod_if2 code examples are linked with libpigpiod_if2 and are written in C.<br>
-<br>
-The pigpiod_if2 library may be compiled and run on any Linux machine and allows control of the GPIO on one or more networked Pis.<br>
-<br>
-It should be possible to adapt the library to run on Macs and PCs.<br>
-<br>
-Each Pi needs the pigpio daemon to be running. The pigpio daemon may be started with the command sudo pigpiod.<br>
-<br>
-<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2__433D"><a href="code/_433D.zip">433MHz Keyfob RX/TX</a><br>2015-11-17</span></td><td>Code to read and transmit 313 and 434 MHz key fob codes. The codes to be read must use Manchester encoding. The transmitted codes use Manchester encoding.<br>
-<br>
-./_433D -r10 # Print fob keycodes received on GPIO 10.<br>
-<br>
-./_433D -t5 8246184 # Transmit code on GPIO 5.<br>
-<br>
-./_433D -r10 -t5 8246184 # Transmit code on GPIO 5 then listen for codes<br>
-<br>
-./_433D -? for options.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2_DHTXXD"><a href="code/DHTXXD.zip">DHT11/21/22/33/44 Sensor</a><br>2016-02-16</span></td><td>Code to read the DHT temperature and humidity sensors. The sensor may be auto detected. A DHT11 sensor may be read once per second. The other sensors should not be read more often than once every three seconds.<br>
-<br>
-The code auto detects the DHT model and generally only the GPIO needs to be specified.<br>
-<br>
-./DHTXXD -g17 # Read a DHT connected to GPIO 17.<br>
-<br>
-./DHTXXD -g5 -i3 # Read a DHT connected to GPIO 5 every three seconds.<br>
-<br>
-./DHTXXD -? # for options.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2_RED"><a href="code/RED.zip">Rotary Encoder</a><br>2015-11-18</span></td><td>Code to monitor a rotary encoder and show the position changes. By default the detent changes are shown. There is an option to show the four steps per detent instead.<br>
-<br>
-./RED -a7 -b8 -s30 # Show encoder on 7/8 detent changes for 30 seconds.<br>
-<br>
-./RED -a5 -b6 -m1 # Show encoder on 5/6 step changes forever.<br>
-<br>
-./RED -? # for options.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2_servo_demo_D"><a href="code/servo_demo_D.zip">Servo Pulse Generator</a><br>2016-10-08</span></td><td>This program generates servo pulses on one or more GPIO. Each connected servo is swept between 1000µs and 2000µs at a different speed.<br>
-<br>
-./servo_demo_D # Generate pulses on GPIO 4.<br>
-<br>
-./servo_demo_D 5 9 20 # Generate pulses on GPIO 5, 9, and 20.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2_SRTED"><a href="code/SRTED.zip">Sonar Ranger</a><br>2015-11-16</span></td><td>Code to read the SRF-04 and SRF-05 type of sonar rangers which use the trigger echo method of operation. A 10 &mu;s trigger pulse initiates a series of high frequency sonar chirps. The echo line then goes high and stays high until an echo from an object is received. The echo high time is used to calculate the distance of the object.<br>
-<br>
-For a one-off reading only the trigger and echo GPIO need to be specified.<br>
-<br>
-./SRTED -t5 -e6 # Read a sonar ranger connected to GPIO 5/6.<br>
-<br>
-./SRTED -t11 -e5 -i0.1 # Read a sonar ranger connected to GPIO 11/5 every 0.1 seconds.<br>
-<br>
-./SRTED -? # for options.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2_tx_RED"><a href="code/tx_RED.zip">Transmit Rotary Encoder Test Signals</a><br>2015-11-25</span></td><td>Code to transmit quadrature signals to test rotary encoder software.<br>
-<br>
-tx_RED -aGPIO -bGPIO [options]<br>
-<br>
-tx_RED -? for options<br>
-<br>
-E.g.<br>
-<br>
-tx_RED -a5 -b6 -s20 -r-100<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2_tx_WD"><a href="code/tx_WD.zip">Transmit Wiegand Test Signals</a><br>2015-11-25</span></td><td>Code to transmit Wiegand codes to test Wiegand decoder software.<br>
-<br>
-tx_WD -gGPIO -wGPIO [options] {code}+<br>
-<br>
-tx_WD -? for options<br>
-<br>
-E.g.<br>
-<br>
-tx_WD -g5 -w6 -s37 12345 67890 123 899999<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="pdif2_WD"><a href="code/WD.zip">Wiegand Reader</a><br>2015-11-25</span></td><td>Code to read a Wiegand Reader.<br>
-<br>
-./WD -g7 -w8 -s30 # Read Wiegand codes from GPIO 7/8 for 30 seconds.<br>
-<br>
-./WD -g5 -w6 # Read Wiegand codes from GPIO 5/6 forever.<br>
-<br>
-./WD -? # for options.<br>
-<br>
-</td></tr></tbody></table><h3><span id="Python code">Python code</span></h3>The Python code may be run on any Python machine and allows control of the GPIO on one or more networked Pis.<br>
-<br>
-The Python machine need not be a Pi, it may run Windows, Mac, Linux, anything as long as it supports Python.<br>
-<br>
-Each Pi needs the pigpio daemon to be running. The pigpio daemon may be started with the command sudo pigpiod.<br>
-<br>
-<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python__433_py"><a href="code/_433_py.zip">433MHz Keyfob RX/TX</a><br>2015-10-30</span></td><td>Classes to send and receive 433MHz wireless keyfob codes. These keyfobs are widely used for remote control of devices.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python__7_segment"><a href="code/_7_segment.zip">7-Segment LED Display Multiplexing</a><br>2016-12-12</span></td><td>Script to multiplex several 7-segment LED displays. Each display has the segments a-g and the decimal point connected in parallel but has an individual enable GPIO (connected to the common anode or cathode).<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_test-APA102_py"><a href="code/test-APA102_py.zip">APA102 LED strip driver</a><br>2017-03-28</span></td><td>Script to drive an APA102 LED strip. Three different methods are demonstrated - using spidev SPI (only works on the local Pi), pigpio SPI, and pigpio waves. The SPI solutions only work with the dedicated SPI GPIO. Waves may use any spare GPIO. Four different examples are given including a LED strip clock.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_BME280_py"><a href="code/BME280_py.zip">BME280 Sensor</a><br>2016-08-05</span></td><td>Class to read the relative humidity, temperature, and pressure from a BME280 sensor. The sensor has both an I2C and a SPI interface which are both<br>
-supported by the class.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_code/DHT.py"><a href="code/DHT.py">DHT11/21/22/33/44 Sensor</a><br>2019-11-07</span></td><td>Class to read the relative humidity and temperature from a DHT sensor. It can automatically recognize the sensor type.<br>
-<br>
-The default script prints the reading from the specified DHT every 2 seconds. E.g. ./DHT.py 22 27 displays the data for DHT connected to GPIO 22 and 27.<br>
-<br>
-The following data is printed for each DHT: timestamp, GPIO, status, temperature, and humidity.<br>
-<br>
-The timestamp is the number of seconds since the epoch (start of 1970).<br>
-<br>
-The status will be one of: 0 - a good reading, 1 - checksum failure, 2 - data had one or more invalid values, 3 - no response from sensor.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_DHT22_py"><a href="code/DHT22_py.zip">DHT22 AM2302 Sensor</a><br>2014-07-11</span></td><td>Class to read the relative humidity and temperature from a DHT22/AM2302 sensor.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_DS18B20-1_py"><a href="code/DS18B20-1_py.zip">DS18B20 Temperature Sensor</a><br>2016-06-29</span></td><td>Script to read the temperature from any DS18B20 sensors connected to the 1-wire bus.<br>
-<br>
-To enable the 1-wire bus add the following line to /boot/config.txt and reboot.<br>
-<br>
-dtoverlay=w1-gpio<br>
-<br>
-By default you should connect the DS18B20 data line to GPIO 4 (pin 7).<br>
-<br>
-Connect 3V3 or 5V for power, ground to ground, 4k7 pull-up on data line to 3V3, and data line to GPIO 4.<br>
-<br>
-This script uses the file features of pigpio to access the remote file system.<br>
-<br>
-The following entry must be in /opt/pigpio/access.<br>
-<br>
-/sys/bus/w1/devices/28*/w1_slave r<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_PPD42NS_py"><a href="code/PPD42NS_py.zip">Dust Sensor</a><br>2015-11-22</span></td><td>Class to read a Shinyei PPD42NS Dust Sensor, e.g. as used in the Grove dust sensor.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_gpio_status_py"><a href="code/gpio_status_py.zip">GPIO Status</a><br>2014-06-12</span></td><td>Script to display the status of GPIO 0-31.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_hall"><a href="code/hall.zip">Hall Effect Sensor</a><br>2014-06-13</span></td><td>Program to show status changes for a Hall effect sensor.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_HX711_py"><a href="code/HX711_py.zip">HX711 24-bit ADC</a><br>2018-03-05</span></td><td>Class to read the channels of a HX711 24-bit ADC.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_i2c_ADXL345_py"><a href="code/i2c_ADXL345_py.zip">I2C ADXL345 Accelerometer</a><br>2015-04-01</span></td><td>Script to display the X, Y, and Z values read from an ADXL345 accelerometer.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_i2c_HMC5883L_py"><a href="code/i2c_HMC5883L_py.zip">I2C HMC5883L Magnetometer</a><br>2015-04-01</span></td><td>Script to display the X, Y, and Z values read from a HMC5883L Magnetometer (compass).<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_i2c_ITG3205_py"><a href="code/i2c_ITG3205_py.zip">I2C ITG3205 Gyroscope</a><br>2015-04-01</span></td><td>Script to display the X, Y, Z, and temperature values read from an ITG3205 gyroscope.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_i2c_lcd_py"><a href="code/i2c_lcd_py.zip">I2C LCD Display</a><br>2016-04-20</span></td><td>Class to display text on a LCD character display. The class supports the PCF8574T 8-bit I2C port expander connected to a HD44780 based LCD display. These displays are commonly available in 16x2 and 20x4 character formats.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_bsc_arduino_py"><a href="code/bsc_arduino_py.zip">I2C slave device</a><br>2016-10-31</span></td><td>This script demonstrates how to transfer messages from an Arduino acting as the I2C bus master to the Pi acting as an I2C slave device.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_I2C_sniffer"><a href="code/I2C_sniffer.zip">I2C Sniffer</a><br>2015-06-15</span></td><td>A program to passively sniff I2C transactions (100kHz bus maximum) and display the results.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_i2c_sonar_py"><a href="code/i2c_sonar_py.zip">I2C Sonar</a><br>2016-03-24</span></td><td>A class to read up to 8 HC-SR04 sonar rangers connected to an MCP23017 port expander.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_ir_hasher_py"><a href="code/ir_hasher_py.zip">IR Receiver</a><br>2014-06-12</span></td><td>Class to hash a code from an IR receiver (reading an IR remote control).<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_irrp_py"><a href="code/irrp_py.zip">IR Record and Playback</a><br>2015-12-21</span></td><td>This script may be used to record and play back arbitrary IR codes.<br>
-<br>
-To record the GPIO connected to the IR receiver, a file for the recorded codes, and the codes to be recorded are given.<br>
-<br>
-E.g. ./irrp.py -r -g4 -fir-codes vol+ vol- 1 2 3 4 5 6 7 8 9 0<br>
-<br>
-To playback the GPIO connected to the IR transmitter, the file containing the recorded codes, and the codes to be played back are given.<br>
-<br>
-E.g. ./irrp.py -p -g18 -fir-codes 2 3 4<br>
-<br>
-./irrp.py -h # for options<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_kivy_GPIO_py"><a href="code/kivy_GPIO_py.zip">Kivy GPIO control</a><br>2016-12-11</span></td><td>This example shows how to use Kivy to control a Pi's GPIO. The GPIO may be configured as inputs, outputs, or to generate Servo or PWM pulses. Kivy is an Open source Python library for rapid development of applications.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_MAX6675_py"><a href="code/MAX6675_py.zip">MAX6675 SPI Temperature Sensor</a><br>2016-05-02</span></td><td>A script to read the temperature from a MAX6675 connected to a K-type thermocouple. The MAX6675 supports readings in the range 0 - 1023.75 C. Up to 4 readings may be made per second.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_monitor_py"><a href="code/monitor_py.zip">Monitor GPIO</a><br>2016-09-17</span></td><td>Script to monitor GPIO for level changes. By default all GPIO are monitored. At a level change the GPIO, new level, and microseconds since the last change is printed.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_morse_code_py"><a href="code/morse_code_py.zip">Morse Code</a><br>2015-06-17</span></td><td>Script to transmit the morse code corresponding to a text string.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_code/NRF24.py"><a href="code/NRF24.py">NRF24 radio transceiver</a><br>2018-01-06</span></td><td>Script to transmit and receive messages using the nRF24L01 radio transceiver.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_PCA9685_py"><a href="code/PCA9685_py.zip">PCA9685 16 Channel PWM</a><br>2016-01-31</span></td><td>Class to control the 16 PWM channels of the I2C PCA9685. All channels use the same frequency. The duty cycle or pulse width may be set independently for each channel.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_PCF8591"><a href="code/PCF8591.zip">PCF8591 YL-40</a><br>2014-08-26</span></td><td>Script to display readings from the (I2C) PCF8591.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_code/PPM.py"><a href="code/PPM.py">PPM (Pulse Position Modulation) generation</a><br>2016-02-19</span></td><td>Script to generate PPM signals on a chosen GPIO.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_code/PPM_to_servo.py"><a href="code/PPM_to_servo.py">PPM (Pulse Position Modulation) to servo pulses</a><br>2019-10-09</span></td><td>Script to read a PPM signal on a GPIO and generate the corresponding servo signals on chosen GPIO.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_bench_1_py"><a href="code/bench_1_py.zip">pigpio Benchmark</a><br>2014-06-12</span></td><td>Script to benchmark the pigpio Python module's performance.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_pigpio_cgi_py"><a href="code/pigpio_cgi_py.zip">pigpio CGI</a><br>2015-05-04</span></td><td>Script demonstrating how to access the pigpio daemon using CGI from a browser. Instructions on how to use with Apache2 on the Pi are given in the comments.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_playback_py"><a href="code/playback_py.zip">Playback piscope recordings</a><br>2016-12-23</span></td><td>Script to playback GPIO data recorded in piscope format.<br>
-<br>
-To playback GPIO 4 to GPIO 4 from file data.piscope<br>
-./playback.py data.piscope 4<br>
-<br>
-To playback GPIO 4 to GPIO 7 from file rec.txt<br>
-./playback.py rec.txt 7=4<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_pot_cap_py"><a href="code/pot_cap_py.zip">Pot + Capacitor Recharge Timing</a><br>2016-09-26</span></td><td>Class to time capacitor charging (through a resistance). The time can be used to estimate the resistance.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_read_PWM_py"><a href="code/read_PWM_py.zip">PWM Monitor</a><br>2015-12-08</span></td><td>Class to monitor a PWM signal and calculate the frequency, pulse width, and duty cycle.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_rotary_encoder_py"><a href="code/rotary_encoder_py.zip">Rotary Encoder</a><br>2014-06-12</span></td><td>Class to decode a mechanical rotary encoder.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_read_RPM_py"><a href="code/read_RPM_py.zip">RPM Monitor</a><br>2016-01-20</span></td><td>Class to monitor speedometer pulses and calculate the RPM (Revolutions Per Minute).<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_Si7021_py"><a href="code/Si7021_py.zip">Si7021 I2C Temperature and Humidity Sensor</a><br>2016-05-07</span></td><td>Class to read the temperature and relative humidity from a Si7021.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_SPI_mon_py"><a href="code/SPI_mon_py.zip">SPI Monitor</a><br>2016-09-21</span></td><td>A program to passively sniff SPI transactions and display the results. The SPI rate should be limited to about 70kbps if using the default pigpio 5µs sampling rate.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_servo_demo_py"><a href="code/servo_demo_py.zip">Servo Pulse Generator</a><br>2016-10-07</span></td><td>This script generates servo pulses on one or more GPIO. Each connected servo is swept between 1000µs and 2000µs at a different speed.<br>
-<br>
-./servo_demo.py # Generate pulses on GPIO 4.<br>
-<br>
-./servo_demo.py 5 9 20 # Generate pulses on GPIO 5, 9, and 20.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_sonar_trigger_echo_py"><a href="code/sonar_trigger_echo_py.zip">Sonar Ranger</a><br>2014-06-12</span></td><td>Class to read sonar rangers with separate trigger and echo pins.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_TCS3200_py"><a href="code/TCS3200_py.zip">TCS3200 Colour Sensor</a><br>2015-07-03</span></td><td>Class to read the TCS3200 colour sensor<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_vw"><a href="code/vw.zip">Virtual Wire</a><br>2015-10-31</span></td><td>Class to send and receive radio messages compatible with the Virtual Wire library for Arduinos. This library is commonly used with 313MHz and 434MHz radio tranceivers.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_code/create_wave.py"><a href="code/create_wave.py">Wave create</a><br>2019-11-18</span></td><td>Script to generate waves from a template defined in a text file.<br>
-<br>
-You can also specify one of py, c, or pdif - the script output will then be a complete program to generate the wave (py for Python script, c for a C program, pdif for a C program using the pigpio daemon I/F).<br>
-<br>
-If none of py, c, or pdif are chosen the waveform will be generated for 30 seconds.<br>
-<br>
-Example text file<br>
-<br>
-# GPIO levels<br>
-23 11000001<br>
-11 01110000<br>
-12 00011100<br>
-4 00000111<br>
-<br>
-To generate a pdif program with a bit time of 100 microseconds<br>
-./create_wave.py wave_file 100 pdif >wave_pdif.c<br>
-<br>
-To just transmit the wave with a bit time of 50 microseconds<br>
-./create_wave.py wave_file 50<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_wave_PWM_py"><a href="code/wave_PWM_py.zip">Wave PWM 1</a><br>2016-03-19</span></td><td>Script to show how waves may be used to generate PWM at (one) arbitrary frequency on multiple GPIO. For instance PWM at 10kHz may be generated with 100 steps between off and fully on.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_wavePWM_py"><a href="code/wavePWM_py.zip">Wave PWM 2</a><br>2016-10-06</span></td><td>Class to generate PWM on multiple GPIO. It is more flexible than the Wave PWM 1 example in that the start of the pulse within each cycle may be specified as well as the duty cycle. The start and length of each pulse may be specified on a GPIO by GPIO basis in microseconds or as a fraction of the cycle time. The class includes a __main__ to demostrate its ability to send servo pulses.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Python_wiegand_py"><a href="code/wiegand_py.zip">Wiegand Reader</a><br>2014-06-12</span></td><td>Class to read a Wiegand reader.<br>
-<br>
-</td></tr></tbody></table><h3><span id="Miscellaneous related code">Miscellaneous related code</span></h3>
-The following code examples do not use pigpio.<br>
-<br>
-<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_adxl345_c"><a href="code/adxl345_c.zip">ADXL345</a><br>2014-03-12</span></td><td>This C program reads x, y, and z accelerations from the ADXL345 via I2C address 0x53.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_DS18B20_py"><a href="code/DS18B20_py.zip">DS18B20 Temperature Sensor</a><br>2016-04-25</span></td><td>This Python script reads the temperature from any DS18B20 sensors connected to the 1-wire bus.<br>
-<br>
-To enable the 1-wire bus add the following line to /boot/config.txt and reboot.<br>
-<br>
-dtoverlay=w1-gpio<br>
-<br>
-By default you should connect the DS18B20 data line to GPIO 4 (pin 7).<br>
-<br>
-Connect 3V3 or 5V for power, ground to ground, 4k7 pull-up on data line to 3V3, and data line to GPIO 4.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_EasyAsPiServer"><a href="code/EasyAsPiServer.zip">Easy as Pi Server</a><br>2014-09-15</span></td><td>This Python class implements a simple server which allows broswer commands to be executed on the Pi.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_minimal_clk"><a href="code/minimal_clk.zip">Minimal Clock Access</a><br>2015-05-20</span></td><td>This C code sets GPIO 4 to a specified clock frequency. The frequency can be set between 4.6875 kHz and 500 MHz (untested). The clock can be preferentially set from one of the sources OSC (19.2MHz), HDMI (216MHz), PLLD (500MHz), or PLLC (1000MHz). MASH can be set between 0 and 3. MASH may not work properly for clock dividers less than 5.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_minimal_gpio"><a href="code/minimal_gpio.zip">Minimal GPIO Access</a><br>2019-07-03</span></td><td>This C code has a minimal set of functions needed to control the GPIO and other Broadcom peripherals. The program requires root privileges to run. See Tiny GPIO access for an alternative which controls the GPIO (but not the other peripherals) and does not require root access.<br>
-<br>
-The code has been updated for the BCM2711 (Pi4B).<br>
-<br>
-The following functions are provided.<br>
-<br>
-gpioInitialise<br>
-gpioSetMode<br>
-gpioGetMode<br>
-gpioSetPullUpDown<br>
-gpioRead<br>
-gpioWrite<br>
-gpioTrigger<br>
-gpioReadBank1<br>
-gpioReadBank2<br>
-gpioClearBank1<br>
-gpioClearBank2<br>
-gpioSetBank1<br>
-gpioSetBank2<br>
-gpioHardwareRevision<br>
-gpioTick<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_nanopulse_c"><a href="code/nanopulse_c.zip">Nanosecond Pulse Generation</a><br>2014-01-29</span></td><td>This C program uses the PWM peripheral to generate precisely timed pulses of very short duration. Pulses as short as 4 nano seconds can be generated.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_PCF8591-x"><a href="code/PCF8591-x.zip">PCF8591 YL-40</a><br>2014-08-26</span></td><td>C and Python code to read the (I2C) PCF8591.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_code/spi-driver-speed.c"><a href="code/spi-driver-speed.c">SPI Linux driver speed test</a><br>2016-11-06</span></td><td>This C code is used to benchmark the Linux SPI driver on the Pi. The code executes a given number of loops at a given baud rate and bytes per transfer.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="Misc_tiny_gpio"><a href="code/tiny_gpio.zip">Tiny GPIO Access</a><br>2016-04-30</span></td><td>This C code has a minimal set of functions needed to control the GPIO without needing root privileges (it uses /dev/gpiomem to access the GPIO).<br>
-<br>
-You may need to change the permissions and ownership of /dev/gpiomem if they have not been correctly set up.<br>
-<br>
-sudo chown root:gpio /dev/gpiomem<br>
-sudo chmod g+rw /dev/gpiomem<br>
-<br>
-The user (default pi) needs to be in the gpio group.<br>
-<br>
-sudo adduser pi gpio<br>
-<br>
-The following functions are provided.<br>
-<br>
-gpioInitialise<br>
-gpioSetMode<br>
-gpioGetMode<br>
-gpioSetPullUpDown<br>
-gpioRead<br>
-gpioWrite<br>
-gpioTrigger<br>
-gpioReadBank1<br>
-gpioReadBank2<br>
-gpioClearBank1<br>
-gpioClearBank2<br>
-gpioSetBank1<br>
-gpioSetBank2<br>
-gpioHardwareRevision<br>
-<br>
-</td></tr></tbody></table><h3><span id="External links">External links</span></h3>
-Related code.<br>
-<br>
-<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="External_https://github.com/stripcode/pigpio-stepper-motor"><a href="https://github.com/stripcode/pigpio-stepper-motor">Stepper Motor</a><br>2016-08-12</span></td><td>Stepper motor code.<br>
-<br>
-</td></tr><tr><td style="width: 150px; vertical-align: top; font-size: 0.8em; font-weight: bold;"><span id="External_https://github.com/choeffer/360pibot"><a href="https://github.com/choeffer/360pibot">Parallax ActivityBot 360</a><br>2018-11-03</span></td><td>Python 3 implementation for programming a Parallax ActivityBot 360 Robot Kit with a Raspberry Pi.<br>
-<br>
-</td></tr></tbody></table><h3><span id="Index">Index</span></h3>
-<table style="text-align: left; width: 90%;" border="0" cellpadding="4" cellspacing="4"><tbody>
-<tr><td><span id="index_433mhz_keyfob_rx/tx"></span>433MHz Keyfob RX/TX</td><td> <a href="#pdif2__433D">pdif2</a>
- <a href="#Python__433_py">Python</a>
-</td></tr><tr><td><span id="index_7-segment_led_display_multiplexing"></span>7-Segment LED Display Multiplexing</td><td> <a href="#Python__7_segment">Python</a>
-</td></tr><tr><td><span id="index_adxl345"></span>ADXL345</td><td> <a href="#Misc_adxl345_c">Misc</a>
-</td></tr><tr><td><span id="index_apa102_led_strip_driver"></span>APA102 LED strip driver</td><td> <a href="#Python_test-APA102_py">Python</a>
-</td></tr><tr><td><span id="index_bme280_sensor"></span>BME280 Sensor</td><td> <a href="#Python_BME280_py">Python</a>
-</td></tr><tr><td><span id="index_dht11/21/22/33/44_sensor"></span>DHT11/21/22/33/44 Sensor</td><td> <a href="#pdif2_DHTXXD">pdif2</a>
- <a href="#Python_code/DHT.py">Python</a>
-</td></tr><tr><td><span id="index_dht22_am2302_sensor"></span>DHT22 AM2302 Sensor</td><td> <a href="#Python_DHT22_py">Python</a>
-</td></tr><tr><td><span id="index_ds18b20_temperature_sensor"></span>DS18B20 Temperature Sensor</td><td> <a href="#Python_DS18B20-1_py">Python</a>
- <a href="#Misc_DS18B20_py">Misc</a>
-</td></tr><tr><td><span id="index_dust_sensor"></span>Dust Sensor</td><td> <a href="#Python_PPD42NS_py">Python</a>
-</td></tr><tr><td><span id="index_easy_as_pi_server"></span>Easy as Pi Server</td><td> <a href="#Misc_EasyAsPiServer">Misc</a>
-</td></tr><tr><td><span id="index_frequency_counter_1"></span>Frequency Counter 1</td><td> <a href="#C_freq_count_1">C</a>
-</td></tr><tr><td><span id="index_frequency_counter_2"></span>Frequency Counter 2</td><td> <a href="#C_freq_count_2">C</a>
-</td></tr><tr><td><span id="index_gpio_status"></span>GPIO Status</td><td> <a href="#Python_gpio_status_py">Python</a>
-</td></tr><tr><td><span id="index_gpio_test"></span>GPIO test</td><td> <a href="#Shell_gpiotest">Shell</a>
-</td></tr><tr><td><span id="index_hall_effect_sensor"></span>Hall Effect Sensor</td><td> <a href="#C_hall">C</a>
- <a href="#Python_hall">Python</a>
-</td></tr><tr><td><span id="index_hx711_24-bit_adc"></span>HX711 24-bit ADC</td><td> <a href="#Python_HX711_py">Python</a>
-</td></tr><tr><td><span id="index_i2c_adxl345_accelerometer"></span>I2C ADXL345 Accelerometer</td><td> <a href="#Python_i2c_ADXL345_py">Python</a>
-</td></tr><tr><td><span id="index_i2c_hmc5883l_magnetometer"></span>I2C HMC5883L Magnetometer</td><td> <a href="#Python_i2c_HMC5883L_py">Python</a>
-</td></tr><tr><td><span id="index_i2c_itg3205_gyroscope"></span>I2C ITG3205 Gyroscope</td><td> <a href="#Python_i2c_ITG3205_py">Python</a>
-</td></tr><tr><td><span id="index_i2c_lcd_display"></span>I2C LCD Display</td><td> <a href="#Python_i2c_lcd_py">Python</a>
-</td></tr><tr><td><span id="index_i2c_slave_device"></span>I2C slave device</td><td> <a href="#Python_bsc_arduino_py">Python</a>
-</td></tr><tr><td><span id="index_i2c_sniffer"></span>I2C Sniffer</td><td> <a href="#C_I2C_sniffer">C</a>
- <a href="#Python_I2C_sniffer">Python</a>
-</td></tr><tr><td><span id="index_i2c_sonar"></span>I2C Sonar</td><td> <a href="#Python_i2c_sonar_py">Python</a>
-</td></tr><tr><td><span id="index_ir_receiver"></span>IR Receiver</td><td> <a href="#Hardware_ex_ir_remote">Hardware</a>
- <a href="#C_ir_hasher_c">C</a>
- <a href="#C++_ir_hasher_cpp">C++</a>
- <a href="#Python_ir_hasher_py">Python</a>
-</td></tr><tr><td><span id="index_ir_record_and_playback"></span>IR Record and Playback</td><td> <a href="#Python_irrp_py">Python</a>
-</td></tr><tr><td><span id="index_kivy_gpio_control"></span>Kivy GPIO control</td><td> <a href="#Python_kivy_GPIO_py">Python</a>
-</td></tr><tr><td><span id="index_light_dependent_resistor"></span>Light Dependent Resistor</td><td> <a href="#Hardware_ex_LDR">Hardware</a>
-</td></tr><tr><td><span id="index_max6675_spi_temperature_sensor"></span>MAX6675 SPI Temperature Sensor</td><td> <a href="#Python_MAX6675_py">Python</a>
-</td></tr><tr><td><span id="index_minimal_clock_access"></span>Minimal Clock Access</td><td> <a href="#Misc_minimal_clk">Misc</a>
-</td></tr><tr><td><span id="index_minimal_gpio_access"></span>Minimal GPIO Access</td><td> <a href="#Misc_minimal_gpio">Misc</a>
-</td></tr><tr><td><span id="index_monitor_gpio"></span>Monitor GPIO</td><td> <a href="#Python_monitor_py">Python</a>
-</td></tr><tr><td><span id="index_morse_code"></span>Morse Code</td><td> <a href="#Python_morse_code_py">Python</a>
-</td></tr><tr><td><span id="index_motor_shield"></span>Motor Shield</td><td> <a href="#Hardware_ex_motor_shield">Hardware</a>
-</td></tr><tr><td><span id="index_nanosecond_pulse_generation"></span>Nanosecond Pulse Generation</td><td> <a href="#Misc_nanopulse_c">Misc</a>
-</td></tr><tr><td><span id="index_nrf24_radio_transceiver"></span>NRF24 radio transceiver</td><td> <a href="#Python_code/NRF24.py">Python</a>
-</td></tr><tr><td><span id="index_parallax_activitybot_360"></span>Parallax ActivityBot 360</td><td> <a href="#External_https://github.com/choeffer/360pibot">External</a>
-</td></tr><tr><td><span id="index_pca9685_16_channel_pwm"></span>PCA9685 16 Channel PWM</td><td> <a href="#Python_PCA9685_py">Python</a>
-</td></tr><tr><td><span id="index_pcf8591_yl-40"></span>PCF8591 YL-40</td><td> <a href="#C_PCF8591">C</a>
- <a href="#Python_PCF8591">Python</a>
- <a href="#Misc_PCF8591-x">Misc</a>
-</td></tr><tr><td><span id="index_pigpio_benchmark"></span>pigpio Benchmark</td><td> <a href="#Python_bench_1_py">Python</a>
-</td></tr><tr><td><span id="index_pigpio_cgi"></span>pigpio CGI</td><td> <a href="#Python_pigpio_cgi_py">Python</a>
-</td></tr><tr><td><span id="index_playback_piscope_recordings"></span>Playback piscope recordings</td><td> <a href="#Python_playback_py">Python</a>
-</td></tr><tr><td><span id="index_pot_+_capacitor_recharge_timing"></span>Pot + Capacitor Recharge Timing</td><td> <a href="#C_pot_cap_charge_c">C</a>
- <a href="#Python_pot_cap_py">Python</a>
-</td></tr><tr><td><span id="index_ppm_(pulse_position_modulation)_generation"></span>PPM (Pulse Position Modulation) generation</td><td> <a href="#Python_code/PPM.py">Python</a>
-</td></tr><tr><td><span id="index_ppm_(pulse_position_modulation)_to_servo_pulses"></span>PPM (Pulse Position Modulation) to servo pulses</td><td> <a href="#Python_code/PPM_to_servo.py">Python</a>
-</td></tr><tr><td><span id="index_pwm_monitor"></span>PWM Monitor</td><td> <a href="#Python_read_PWM_py">Python</a>
-</td></tr><tr><td><span id="index_rotary_encoder"></span>Rotary Encoder</td><td> <a href="#Hardware_ex_rotary_encoder">Hardware</a>
- <a href="#C_rotary_encoder_c">C</a>
- <a href="#C++_rotary_encoder_cpp">C++</a>
- <a href="#pdif2_RED">pdif2</a>
- <a href="#Python_rotary_encoder_py">Python</a>
-</td></tr><tr><td><span id="index_rpm_monitor"></span>RPM Monitor</td><td> <a href="#Python_read_RPM_py">Python</a>
-</td></tr><tr><td><span id="index_servo_pulse_generator"></span>Servo Pulse Generator</td><td> <a href="#C_servo_demo">C</a>
- <a href="#pdif2_servo_demo_D">pdif2</a>
- <a href="#Python_servo_demo_py">Python</a>
-</td></tr><tr><td><span id="index_si7021_i2c_temperature_and_humidity_sensor"></span>Si7021 I2C Temperature and Humidity Sensor</td><td> <a href="#Python_Si7021_py">Python</a>
-</td></tr><tr><td><span id="index_sonar_ranger"></span>Sonar Ranger</td><td> <a href="#Hardware_ex_sonar_ranger">Hardware</a>
- <a href="#pdif2_SRTED">pdif2</a>
- <a href="#Python_sonar_trigger_echo_py">Python</a>
-</td></tr><tr><td><span id="index_spi_bit_bang_mcp3008"></span>SPI bit bang MCP3008</td><td> <a href="#C_rawMCP3008_c">C</a>
-</td></tr><tr><td><span id="index_spi_bit_bang_mcp3008_and_mcp3202"></span>SPI bit bang MCP3008 and MCP3202</td><td> <a href="#C_rawMCP3XXX_c">C</a>
-</td></tr><tr><td><span id="index_spi_bit_bang_mcp3202"></span>SPI bit bang MCP3202</td><td> <a href="#C_rawMCP3202_c">C</a>
-</td></tr><tr><td><span id="index_spi_linux_driver_speed_test"></span>SPI Linux driver speed test</td><td> <a href="#Misc_code/spi-driver-speed.c">Misc</a>
-</td></tr><tr><td><span id="index_spi_monitor"></span>SPI Monitor</td><td> <a href="#Python_SPI_mon_py">Python</a>
-</td></tr><tr><td><span id="index_spi_pigpio_driver_speed_test"></span>SPI pigpio driver speed test</td><td> <a href="#C_code/spi-pigpio-speed.c">C</a>
-</td></tr><tr><td><span id="index_stepper_motor"></span>Stepper Motor</td><td> <a href="#External_https://github.com/stripcode/pigpio-stepper-motor">External</a>
-</td></tr><tr><td><span id="index_tcs3200_colour_sensor"></span>TCS3200 Colour Sensor</td><td> <a href="#Python_TCS3200_py">Python</a>
-</td></tr><tr><td><span id="index_tiny_gpio_access"></span>Tiny GPIO Access</td><td> <a href="#Misc_tiny_gpio">Misc</a>
-</td></tr><tr><td><span id="index_transmit_rotary_encoder_test_signals"></span>Transmit Rotary Encoder Test Signals</td><td> <a href="#pdif2_tx_RED">pdif2</a>
-</td></tr><tr><td><span id="index_transmit_wiegand_test_signals"></span>Transmit Wiegand Test Signals</td><td> <a href="#pdif2_tx_WD">pdif2</a>
-</td></tr><tr><td><span id="index_virtual_wire"></span>Virtual Wire</td><td> <a href="#Python_vw">Python</a>
-</td></tr><tr><td><span id="index_wave_create"></span>Wave create</td><td> <a href="#Python_code/create_wave.py">Python</a>
-</td></tr><tr><td><span id="index_wave_pwm_1"></span>Wave PWM 1</td><td> <a href="#Python_wave_PWM_py">Python</a>
-</td></tr><tr><td><span id="index_wave_pwm_2"></span>Wave PWM 2</td><td> <a href="#Python_wavePWM_py">Python</a>
-</td></tr><tr><td><span id="index_wiegand_reader"></span>Wiegand Reader</td><td> <a href="#C_wiegand_c">C</a>
- <a href="#C++_wiegand_cpp">C++</a>
- <a href="#pdif2_WD">pdif2</a>
- <a href="#Python_wiegand_py">Python</a>
-</td></tr></tbody></table> \ No newline at end of file
diff --git a/DOC/tmp/body/faq.body b/DOC/tmp/body/faq.body
deleted file mode 100644
index 7c505f0..0000000
--- a/DOC/tmp/body/faq.body
+++ /dev/null
@@ -1,452 +0,0 @@
-
-<a href="#Are_my_GPIO_broken">Are my GPIO broken?</a><br>
-<br>
-<a href="#Audio_is_broken">Audio is broken</a><br>
-<br>
-<a href="#Cant_initialise_pigpio_library">Can´t initialise pigpio
-library</a><br>
-<br>
-<a href="#Cant_lock_varrunpigpio.pid">Can´t lock
-var/run/pigpio.pid</a><br>
-<br>
-<a href="#Hello_World">Hello World!</a><br>
-<br>
-<a href="#make_fails">Clock skew, make fails</a><br>
-<br>
-<a href="#Have_I_fried_my_GPIO">Have I fried my GPIO?</a><br>
-<br>
-<a href="#How_do_I_debounce_inputs">How do I debounce
-inputs?</a><br>
-<br>
-<a href="#How_fast_is_SPI">How fast is SPI?</a><br>
-<br>
-<a href="#Library_update_fails">Library update didn't work</a><br>
-<br>
-<a href="#make_fails">make fails with clock skew</a><br>
-<br>
-<a href="#Porting_pigpio">Porting pigpio to another CPU/SoC</a><br>
-<br>
-<a href="#Sound_isnt_working">Sound isn't working</a><br>
-<br>
-<a href="#Library_update_fails">Symbol not found</a><br>
-<br>
-<a href="#What_is_I2C">What is I2C?</a><br>
-<br>
-<a href="#What_is_Serial">What is Serial?</a><br>
-<br>
-<a href="#What_is_SPI">What is SPI?</a><br>
-<br>
-<a href="#Which_library">Which library should I use?</a><br>
-<br>
-<h3><a name="Are_my_GPIO_broken" id="Are_my_GPIO_broken"></a>Are my
-GPIO broken?</h3>
-<p>See <a href="#Have_I_fried_my_GPIO">Have I fried my
-GPIO?</a><br></p>
-<h3><a name="Audio_is_broken" id="Audio_is_broken"></a>Audio is
-broken</h3>
-<p>See <a href="#Sound_isnt_working">Sound isn't
-working</a><br></p>
-<h3><a name="Cant_lock_varrunpigpio.pid" id=
-"Cant_lock_varrunpigpio.pid"></a>Can´t lock
-/var/run/pigpio.pid</h3>
-<p>See <a href=
-"#Cant_initialise_pigpio_library">Can´t_initialise_pigpio_library</a><br>
-</p>
-<h3><a name="Cant_initialise_pigpio_library" id=
-"Cant_initialise_pigpio_library"></a>Can´t initialise pigpio
-library</h3>
-<p>This message means the pigpio daemon is already running.<br></p>
-<p>The default daemon is called pigpiod and may be removed as
-follows.<br></p>
-Check that it is running with the command
-<p><code>ps aux | grep pigpiod</code></p>
-<p>Kill the daemon with<br></p>
-<p><code>sudo killall pigpiod</code></p>
-<p>If your own program is acting as the daemon it may be removed as
-follows.</p>
-<p>Find its process id (<span style=
-"font-style: italic;">pid</span>).<br></p>
-<p><code>cat /var/run/pigpio.pid</code><br></p>
-<p>Kill the program with<br></p>
-<p><code>sudo kill -9 <span style=
-"font-style: italic;">pid</span></code><br></p>
-If the above doesn't work do the following and try starting the
-daemon again
-<p><code>sudo rm /var/run/pigpio.pid<br></code></p>
-<p>To start the daemon do</p>
-<p><code>sudo pigpiod</code></p>
-<h3><a name="Have_I_fried_my_GPIO" id=
-"Have_I_fried_my_GPIO"></a>Have I fried my GPIO?</h3>
-<p>If you think you have damaged one or more GPIO you can carry out
-a diagnostic test.</p>
-<p>The test is a command line script called <a rel="nofollow"
-class="external text" href=
-"http://abyz.me.uk/rpi/pigpio/code/gpiotest.zip">gpiotest</a></p>
-For the duration of the test nothing must be connected to the GPIO
-(no LEDs, wires, ribbon cables etc.).
-<p>The test checks that each GPIO may be read and written and that
-the internal resistor pull-ups and pull-downs are functional.</p>
-<p>A <a rel="nofollow" class="external text" href=
-"https://www.youtube.com/watch?v=sCJFLKWaxHo&amp;feature=youtu.be">video</a>
-showing what happens to the GPIO during a test.</p>
-<p>A test with all GPIO okay.</p>
-<pre>This program checks the Pi's (user) gpios.
-
-The program reads and writes all the gpios. Make sure NOTHING
-is connected to the gpios during this test.
-
-The program uses the pigpio daemon which must be running.
-
-To start the daemon use the command sudo pigpiod.
-
-Press the ENTER key to continue or ctrl-C to abort...
-
-Testing...
-Skipped non-user gpios: 0 1 28 29 30 31
-Tested user gpios: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18<br> 19 20 21 22 23 24 25 26 27
-Failed user gpios: None
-</pre>
-<p>A test showing failed GPIO.</p>
-<pre>This program checks the Pi's (user) gpios.
-
-The program reads and writes all the gpios. Make sure NOTHING
-is connected to the gpios during this test.
-
-The program uses the pigpio daemon which must be running.
-
-To start the daemon use the command sudo pigpiod.
-
-Press the ENTER key to continue or ctrl-C to abort...
-
-Testing...
-Write 1 to gpio 17 failed.
-Pull up on gpio 17 failed.
-Write 1 to gpio 18 failed.
-Pull up on gpio 18 failed.
-Write 0 to gpio 23 failed.
-Pull down on gpio 23 failed.
-Write 0 to gpio 24 failed.
-Pull down on gpio 24 failed.
-Write 1 to gpio 27 failed.
-Pull up on gpio 27 failed.
-Skipped non-user gpios: 0 1 28 29 30 31
-Tested user gpios: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18<br> 19 20 21 22 23 24 25 26 27
-Failed user gpios: 17 18 23 24 27
-</pre>
-<h3><a name="How_do_I_debounce_inputs" id=
-"How_do_I_debounce_inputs"></a>How do I debounce inputs?</h3>
-<p>Some devices like mechanical switches can generate multiple
-interrupts as they bounce between on and off.&nbsp; It is possible
-to debounce the inputs in hardware by the correct use of resistors
-and capacitors.<br></p>
-<p>In software use the glitch filter which ignores all events
-shorter than a set number of microseconds.&nbsp; C <a href=
-"cif.html#gpioGlitchFilter">gpioGlitchFilter</a>, Python <a href=
-"python.html#set_glitch_filter">set_glitch_filter</a>.<br></p>
-<h3><a name="How_fast_is_SPI" id="How_fast_is_SPI"></a>How fast is
-SPI?</h3>
-The SPI throughput in samples per second depends on a number of
-factors.<br>
-<br>
-<ul>
-<li>The SPI bit rate (transfer rate in bits per second)</li>
-</ul>
-<ul>
-<li>The number of bytes transferred per sample (a 12 bit ADC sample
-may require 3 bytes to transfer)</li>
-</ul>
-<ul>
-<li>The driver used</li>
-</ul>
-<p>Two of those factors are fixed, the variable is the driver
-used.</p>
-<p>The pigpio driver is considerably faster than the Linux SPI
-driver as is demonstrated by the following graphs.<br></p>
-<p>Each graph shows the SPI bit rate in bits per second along the
-horizontal axis.&nbsp; The samples per second achieved is shown on
-the vertical axis.&nbsp; Each graph contains plots assuming 1 to 5
-bytes per transfer.<br></p>
-<p>The source code used for the tests is <a href=
-"code/spi-driver-speed.c">spi-driver-speed.c</a> and <a href=
-"code/spi-pigpio-speed.c">spi-pigpio-speed.c</a><br></p>
-<p><img alt="spi-lnx-pibr1.png" src="images/spi-lnx-pibr1.png"></p>
-<hr>
-<p><img alt="spi-pig-pibr1.png" src="images/spi-pig-pibr1.png"></p>
-<hr>
-<p><img alt="spi-lnx-pi3b.png" src="images/spi-lnx-pi3b.png"></p>
-<hr>
-<p><img alt="spi-pig-pi3b.png" src="images/spi-pig-pi3b.png"></p>
-<h3><a name="Library_update_fails" id=
-"Library_update_fails"></a>Library update didn't work</h3>
-<p>pigpio places files in the following locations<br></p>
-<p>/usr/local/include (pigpio.h, pigpiod_if.h, pigpiod_if2.h)<br>
-/usr/local/lib (libpigpio.so, libpigpiod_if.so,
-libpigpiod_if2.so)<br>
-/usr/local/bin (pig2vcd, pigpiod, pigs)<br>
-/usr/local/man (man pages)<br></p>
-The raspberrypi.org image containing pigpio uses different
-locations.<br>
-<p>/usr/include (pigpio.h, pigpiod_if.h, pigpiod_if2.h)<br>
-/usr/lib (libpigpio.so, libpigpiod_if.so, libpigpiod_if2.so)<br>
-/usr/bin (pig2vcd, pigpiod, pigs)<br>
-/usr/man (man pages)<br></p>
-<p>Mostly this doesn't matter as the /usr/local directories will
-generally be earlier in the search path.&nbsp; The pigpio built
-includes, binaries, and manuals are normally found first.<br></p>
-<p>However the wrong libraries may be linked during the
-compilation.&nbsp; If this is the case remove the /usr/lib entries
-for libpigpio.so , libpigpiod_if.so, and libpigpiod_if2.so</p>
-<h3><a name="Hello_World" id="Hello_World"></a>Hello World!</h3>
-<p>The following examples show how to use the various components of
-the pigpio library.</p>
-<p>Each example shows how to read the level of a GPIO.</p>
-<h4>C</h4>
-read_cif.c
-<pre>
-#include &lt;stdio.h&gt;
-#include &lt;pigpio.h&gt;
-
-int main(int argc, char *argv[])
-{
- int GPIO=4;
- int level;
-
- if (gpioInitialise() &lt; 0) return 1;
-
- level = gpioRead(GPIO);
-
- printf("GPIO %d is %d\n", GPIO, level);
-
- gpioTerminate();
-}
- </pre>
-<p>Build</p>
-<code>gcc -pthread -o read_cif read_cif.c -lpigpio</code>
-<p>Run</p>
-<code>sudo ./read_cif</code>
-<h4>C via pigpio daemon</h4>
-read_pdif.c
-<pre>
-#include &lt;stdio.h&gt;
-#include &lt;pigpiod_if2.h&gt;
-
-int main(int argc, char *argv[])
-{
- int pi;
- int GPIO=4;
- int level;
-
- pi = pigpio_start(0, 0); /* Connect to local Pi. */
-
- if (pi &lt; 0)
- {
- printf("Can't connect to pigpio daemon\n");
- return 1;
- }
-
- level = gpio_read(pi, GPIO);
-
- printf("GPIO %d is %d\n", GPIO, level);
-
- pigpio_stop(pi); /* Disconnect from local Pi. */
-
- return 0;
-}
-</pre>
-<p>Build</p>
-<code>gcc -pthread -o read_pdif read_pdif.c -lpigpiod_if2</code>
-<p>Run</p>
-<code>./read_pdif</code>
-<h4>Python</h4>
-read_gpio.py
-<pre>
-#!/usr/bin/env python
-
-import pigpio
-
-GPIO=4
-
-pi = pigpio.pi()
-if not pi.connected:
- exit()
-
-level = pi.read(GPIO)
-
-print("GPIO {} is {}".format(GPIO, level))
-
-pi.stop()
- </pre>
-<p>Run</p>
-<code>python read_gpio.py</code>
-<h4>pigs</h4>
-<pre>
-pigs r 4
- </pre>
-<h4>pipe I/F</h4>
-<pre>
-echo "r 4" &gt;/dev/pigpio
-cat /dev/pigout
- </pre>
-<h3><a name="make_fails" id="make_fails"></a>make fails with clock
-skew</h3>
-<p>If make fails with one of the following messages it is probably
-because the Pi's clock is wrong.<br></p>
-<p><code>make: Warning: File 'xxx' has modification time x s in the
-future<br>
-make: warning: Clock skew detected. Your build may be
-incomplete.</code></p>
-<p>make uses the current time to work out which files need to be
-rebuilt (a file is rebuilt if it depends on other files which have
-a later time-stamp).<br></p>
-<p>The solution is to make sure the system clock is correct.&nbsp;
-If the Pi is networked this will not normally be a problem.<br></p>
-<p>To set the date and time use the date command as in the
-following example.</p>
-<p><code>sudo date -d "2017-03-01 18:47:00"</code></p>
-<h3><a name="Porting_pigpio" id="Porting_pigpio"></a>Porting pigpio
-to another CPU/SoC</h3>
-<h3><a name="Sound_isnt_working" id="Sound_isnt_working"></a>Sound
-isn't working</h3>
-<p>The Pi contains two pieces of hardware, a PWM peripheral and a
-PCM peripheral, to generate sound.&nbsp; The PWM peripheral is
-normally used and generates medium quality audio out of the
-headphone jack.&nbsp; The PCM peripheral may be used by add-ons
-such as HATs and generates high quality audio.<br></p>
-<p>pigpio uses at least one of these peripherals during normal
-operation (for timing DMA transfers).&nbsp; pigpio will use both
-peripherals if waves or the hardware PWM function is used.<br></p>
-<p>By default pigpio uses the PCM peripheral leaving the PWM
-peripheral free for medium quality audio.<br></p>
-<p>You can change the default with a configuration option.&nbsp;
-For C use <a href="cif.html#gpioCfgClock">gpioCfgClock</a>, for the
-<a href="pigpiod.html">pigpio daemon</a> use the -t option.</p>
-<h3><a name="What_is_I2C" id="What_is_I2C"></a>What is I2C?</h3>
-<p>I2C is a data link between the Pi (master) and one or more
-slaves.</p>
-<p>Data may be sent and received but the Pi initiates all
-transfers.<br></p>
-<p>I2C is a medium speed link.&nbsp; On the Pi the default speed is
-100 kbps, but 400 kbps also works.<br></p>
-<p>I2C is implemented as a bus with two lines called<br></p>
-<ul>
-<li>SDA - for data</li>
-<li>SCL - for a clock</li>
-</ul>
-On the Pi bus 1 is used which uses GPIO 2 (pin 3) for SDA and GPIO
-3 (pin 5) for SCL.<br>
-<br>
-Only one slave device may be communicated with at a time.&nbsp;
-Each message from the Pi includes the slave to be addressed and
-whether a read or write is to be performed.<br>
-<br>
-When the Pi (master) wishes to talk to a slave it begins by issuing
-a start sequence on the I2C bus. A start sequence is one of two
-special sequences defined for the I2C bus, the other being the stop
-sequence. The start sequence and stop sequence are special in that
-these are the only places where the SDA (data line) is allowed to
-change while the SCL (clock line) is high. When data is being
-transferred, SDA must remain stable and not change whilst SCL is
-high. The start and stop sequences mark the beginning and end of a
-transaction with the slave device.<br>
-<br>
-<img style="width: 600px;" alt="I2C start and stop sequences" src=
-"images/faq-i2c-ss.png"><br>
-<br>
-Data is transferred in 8-bit bytes. The bytes are placed on the SDA
-line starting with the most significant bit. The SCL line is then
-pulsed high, then low. For every byte transferred, the device
-receiving the data sends back an acknowledge bit, so there are
-actually 9 SCL clock pulses to transfer each 8-bit byte of data. If
-the receiving device sends back a low ACK bit, then it has received
-the data and is ready to accept another byte. If it sends back a
-high then it is indicating it cannot accept any further data and
-the master should terminate the transfer by sending a stop
-sequence.<br>
-<br>
-<p><img style="width: 600px;" alt="I2C waveform" src=
-"images/faq-i2c.jpg"><br></p>
-<h3><a name="What_is_Serial" id="What_is_Serial"></a>What is
-Serial?</h3>
-<p>Serial is a data link between the Pi and one other
-device.<br></p>
-<p>Data may be sent and received.&nbsp; Either the Pi or the device
-can initiate a transfer.<br></p>
-<p>Serial is a low to medium speed link.&nbsp; On the Pi speeds of
-50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600,
-19200, 38400, 57600, 115200, and 230400 bps may be used.<br></p>
-<p>Serial is implemented with one line for transmit called TXD and
-one line for receive called RXD.<br></p>
-<p>If only receive or transmit are required the other line need not
-be connected.<br></p>
-<p>The Pi uses GPIO 14 (pin 8) for TXD and GPIO 15 (pin 10) for
-RXD.<br></p>
-<p>Data is normally transmitted in 8-bit bytes with a start bit,
-eight data bits, no parity, and one stop bit.&nbsp; This is
-represented as 8N1.&nbsp; The number of transmitted bits per second
-(bps) is called the baud rate.&nbsp;&nbsp; The time for each bit,
-<span style="font-style: italic;">1 / baud rate</span> seconds, is
-referred to as the bit period.<br></p>
-<p>The lines are in the high state when no data is being
-transmitted.&nbsp; The start of a byte is signalled by the line
-going low for one bit period (the start bit).&nbsp; The data bits
-are then sent least significant bit firsts (low if the bit is 0,
-high if the bit is 1).&nbsp; The data bits are followed by the
-optional parity bit.&nbsp; Finally the line is set high for at
-least the number of stop bit periods.&nbsp; The line will stay high
-if there are no more bytes to be transmitted.<br></p>
-<p><img style="width: 600px;" alt="Serial waveform" src=
-"images/faq-serial.jpg"><br></p>
-<h3><a name="What_is_SPI" id="What_is_SPI"></a>What is SPI?</h3>
-<p>SPI is a data link between the Pi (master) and one or more
-slaves.</p>
-<p>Data may be sent and received but the Pi initiates all
-transfers.<br></p>
-<p>SPI is a medium to high speed link.&nbsp; On the Pi speeds of 32
-kbps to 8 Mbps may be used.<br></p>
-<p>SPI is implemented as a bus with three lines called<br></p>
-<ul>
-<li>MOSI - for data from the Pi to the slave</li>
-<li>MISO - for data from the slave to the Pi</li>
-<li>SCLK - for a clock</li>
-</ul>
-Only one slave device may be communicated with at a time.&nbsp; An
-additional line per slave called slave select is used to identify
-the slave to be addressed.
-<p>The Pi has two SPI buses<br></p>
-<ol>
-<li>the main SPI bus
-<ul>
-<li>MOSI GPIO 10 (pin 19)</li>
-<li>MISO GPIO 9 (pin 21)</li>
-<li>SCLK GPIO 11 (pin 23)</li>
-<li>Slave selects</li>
-<li style="list-style: none; display: inline">
-<ul>
-<li>CE0 GPIO 8 (pin 24)</li>
-<li>CE1 GPIO 7 (pin 26)</li>
-</ul>
-</li>
-</ul>
-</li>
-<li>the auxiliary SPI bus
-<ul>
-<li>MOSI GPIO 20 (pin 38)</li>
-<li>MISO GPIO 19 (pin 35)</li>
-<li>SCLK GPIO 21 (pin 40)</li>
-<li>Slave selects</li>
-<li style="list-style: none; display: inline">
-<ul>
-<li>CE0 GPIO 18 (pin 12)</li>
-<li>CE1 GPIO 17 (pin 11)</li>
-<li>CE2 GPIO 16 (pin 36)<br></li>
-</ul>
-</li>
-</ul>
-</li>
-</ol>
-<p><img style="width: 600px;" alt="SPI waveform" src=
-"images/faq-spi.jpg"><br></p>
-<p><br></p>
-<h3><a name="Which_library" id="Which_library"></a>Which library
-should I use?</h3>
-<p><br></p>
diff --git a/DOC/tmp/body/index.body b/DOC/tmp/body/index.body
deleted file mode 100644
index f8a4d2e..0000000
--- a/DOC/tmp/body/index.body
+++ /dev/null
@@ -1,652 +0,0 @@
-
-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>
-<li>
-<p>hardware timed sampling and time-stamping of GPIO 0-31 every 5
-us<br></p>
-</li>
-<li>
-<p>hardware timed PWM on all of GPIO 0-31<br></p>
-</li>
-<li>
-<p>hardware timed servo pulses on all of GPIO 0-31</p>
-</li>
-<li>
-<p>callbacks on GPIO 0-31 level change (time accurate to a few
-us)</p>
-</li>
-<li>
-<p>notifications via pipe on GPIO 0-31 level change<br></p>
-</li>
-<li>
-<p>callbacks at timed intervals</p>
-</li>
-<li>
-<p>reading/writing all of the GPIO in a bank (0-31, 32-53) as a
-single operation</p>
-</li>
-<li>
-<p>GPIO reading, writing, modes, and internal pulls<br></p>
-</li>
-<li>
-<p>socket and pipe interfaces for the bulk of the functionality</p>
-</li>
-<li>
-<p>waveforms to generate GPIO level changes (time accurate to a few
-us)</p>
-</li>
-<li>
-<p>software serial links using any user GPIO</p>
-</li>
-<li>
-<p>rudimentary permission control through the socket and pipe
-interfaces<br></p>
-</li>
-<li>creating and running scripts on the pigpio daemon</li>
-</ul>
-<h3>General</h3>
-The pigpio <a href="cif.html">library</a> is written in the C
-programming language.<br>
-<br>
-The <a href="pigpiod.html">pigpio daemon</a> offers a <a href=
-"sif.html">socket</a> and <a href="pif.html">pipe</a> interface to
-the underlying C library.<br>
-<br>
-A <a href="pdif2.html">C library</a> and a <a href=
-"python.html">Python module</a> allow control of the GPIO via the
-pigpio daemon.<br>
-<br>
-There is third party support for a number of <a href=
-"index.html#Other_Languages">other languages</a>.&nbsp;
-<h3>piscope</h3>
-<p><a href="piscope.html">piscope</a> is a logic analyser (digital
-waveform viewer).<br></p>
-piscope is a GTK+3 application and uses pigpio to provide raw GPIO
-level data.&nbsp; piscope may be run on a Pi or on any machine
-capable of compiling a GTK+3 application.
-<h3><a name="GPIO" id="GPIO"></a>GPIO</h3>
-<p><span style="font-weight: bold;">ALL GPIO</span> are identified
-by their <span style="font-weight: bold;">Broadcom
-number</span>.&nbsp; See <a href=
-"http://elinux.org/RPi_Low-level_peripherals#General_Purpose_Input.2FOutput_.28GPIO.29">
-elinux.org</a><br></p>
-There are 54 GPIO in total, arranged in two banks.<br>
-<p>Bank 1 contains GPIO 0-31.&nbsp; Bank 2 contains GPIO
-32-53.<br></p>
-For all types of Pi it is safe to read all the GPIO. If you try to
-write a system GPIO or change its mode you can crash the Pi or
-corrupt the data on the SD card.<br>
-<br>
-There are several types of board, each with different expansion
-headers, giving physical access to different GPIO.&nbsp;
-<ul>
-<li><a href="#Type_1">Type 1</a> - Model B (original model)</li>
-<li><a href="#Type_2">Type 2</a> - Model A, B (revision 2)</li>
-<li><a href="#Type_3">Type 3</a> - Model A+, B+, Pi Zero, Pi2B,
-Pi3B</li>
-<li><a href="#CM">Compute Module</a> - Compute Module</li>
-</ul>
-<h4><a name="Type_1" id="Type_1"></a>Type 1 - Model B (original
-model)</h4>
-<ul>
-<li>26 pin header (P1).</li>
-</ul>
-<ul>
-<li>Hardware revision numbers of 2 and 3.</li>
-</ul>
-<ul>
-<li>User GPIO 0-1, 4, 7-11, 14-15, 17-18, 21-25.</li>
-</ul>
-<table summary="" style="width: 60%; text-align: left;"
-cellspacing="0" cellpadding="0" border="0">
-<tbody>
-<tr>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-<br></td>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-GPIO</td>
-<td style="font-weight: bold; text-align: center;">pin</td>
-<td style="font-weight: bold; text-align: center;">pin</td>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-GPIO</td>
-<td style="font-weight: bold; text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">3V3</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">1</td>
-<td style="text-align: center;">2</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">5V</td>
-</tr>
-<tr>
-<td style="text-align: center;">SDA</td>
-<td style="text-align: center;">0<br></td>
-<td style="text-align: center;">3</td>
-<td style="text-align: center;">4</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">5V</td>
-</tr>
-<tr>
-<td style="text-align: center;">SCL</td>
-<td style="text-align: center;">1<br></td>
-<td style="text-align: center;">5</td>
-<td style="text-align: center;">6</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">Ground</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">4</td>
-<td style="text-align: center;">7</td>
-<td style="text-align: center;">8</td>
-<td style="text-align: center;">14</td>
-<td style="text-align: center;">TXD</td>
-</tr>
-<tr>
-<td style="text-align: center;">Ground</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">9</td>
-<td style="text-align: center;">10</td>
-<td style="text-align: center;">15</td>
-<td style="text-align: center;">RXD</td>
-</tr>
-<tr>
-<td style="text-align: center;">ce1</td>
-<td style="text-align: center;">17</td>
-<td style="text-align: center;">11</td>
-<td style="text-align: center;">12</td>
-<td style="text-align: center;">18</td>
-<td style="text-align: center;">ce0</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">21</td>
-<td style="text-align: center;">13</td>
-<td style="text-align: center;">14</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">Ground</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">22</td>
-<td style="text-align: center;">15</td>
-<td style="text-align: center;">16</td>
-<td style="text-align: center;">23</td>
-<td style="text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">3V3</td>
-<td style="text-align: center;">-<br></td>
-<td style="text-align: center;">17</td>
-<td style="text-align: center;">18</td>
-<td style="text-align: center;">24</td>
-<td style="text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">MOSI</td>
-<td style="text-align: center;">10</td>
-<td style="text-align: center;">19</td>
-<td style="text-align: center;">20</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">Ground</td>
-</tr>
-<tr>
-<td style="text-align: center;">MISO</td>
-<td style="text-align: center;">9</td>
-<td style="text-align: center;">21</td>
-<td style="text-align: center;">22</td>
-<td style="text-align: center;">25</td>
-<td style="text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">SCLK</td>
-<td style="text-align: center;">11</td>
-<td style="text-align: center;">23</td>
-<td style="text-align: center;">24</td>
-<td style="text-align: center;">8</td>
-<td style="text-align: center;">CE0</td>
-</tr>
-<tr>
-<td style="text-align: center;">Ground</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">25</td>
-<td style="text-align: center;">26</td>
-<td style="text-align: center;">7</td>
-<td style="text-align: center;">CE1</td>
-</tr>
-</tbody>
-</table>
-<br>
-<h4><a name="Type_2" id="Type_2"></a>Type 2 - Model A, B (revision
-2)</h4>
-26 pin header (P1) and an additional 8 pin header (P5).
-<ul>
-<li>Hardware revision numbers of 4, 5, 6 (B), 7, 8, 9 (A), and 13,
-14, 15 (B).</li>
-</ul>
-<ul>
-<li>User GPIO 2-4, 7-11, 14-15, 17-18, 22-25, 27-31.<br></li>
-</ul>
-<table summary="" style="width: 60%; text-align: left;"
-cellspacing="0" cellpadding="0" border="0">
-<tbody>
-<tr>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-<br></td>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-GPIO</td>
-<td style="font-weight: bold; text-align: center;">pin</td>
-<td style="font-weight: bold; text-align: center;">pin</td>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-GPIO</td>
-<td style="font-weight: bold; text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">3V3</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">1</td>
-<td style="text-align: center;">2</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">5V</td>
-</tr>
-<tr>
-<td style="text-align: center;">SDA</td>
-<td style="text-align: center;">2</td>
-<td style="text-align: center;">3</td>
-<td style="text-align: center;">4</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">5V</td>
-</tr>
-<tr>
-<td style="text-align: center;">SCL</td>
-<td style="text-align: center;">3</td>
-<td style="text-align: center;">5</td>
-<td style="text-align: center;">6</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">Ground</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">4</td>
-<td style="text-align: center;">7</td>
-<td style="text-align: center;">8</td>
-<td style="text-align: center;">14</td>
-<td style="text-align: center;">TXD</td>
-</tr>
-<tr>
-<td style="text-align: center;">Ground</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">9</td>
-<td style="text-align: center;">10</td>
-<td style="text-align: center;">15</td>
-<td style="text-align: center;">RXD</td>
-</tr>
-<tr>
-<td style="text-align: center;">ce1</td>
-<td style="text-align: center;">17</td>
-<td style="text-align: center;">11</td>
-<td style="text-align: center;">12</td>
-<td style="text-align: center;">18</td>
-<td style="text-align: center;">ce0</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">27</td>
-<td style="text-align: center;">13</td>
-<td style="text-align: center;">14</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">Ground</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">22</td>
-<td style="text-align: center;">15</td>
-<td style="text-align: center;">16</td>
-<td style="text-align: center;">23</td>
-<td style="text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">3V3</td>
-<td style="text-align: center;">-<br></td>
-<td style="text-align: center;">17</td>
-<td style="text-align: center;">18</td>
-<td style="text-align: center;">24</td>
-<td style="text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">MOSI</td>
-<td style="text-align: center;">10</td>
-<td style="text-align: center;">19</td>
-<td style="text-align: center;">20</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">Ground</td>
-</tr>
-<tr>
-<td style="text-align: center;">MISO</td>
-<td style="text-align: center;">9</td>
-<td style="text-align: center;">21</td>
-<td style="text-align: center;">22</td>
-<td style="text-align: center;">25</td>
-<td style="text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">SCLK</td>
-<td style="text-align: center;">11</td>
-<td style="text-align: center;">23</td>
-<td style="text-align: center;">24</td>
-<td style="text-align: center;">8</td>
-<td style="text-align: center;">CE0</td>
-</tr>
-<tr>
-<td style="text-align: center;">Ground</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">25</td>
-<td style="text-align: center;">26</td>
-<td style="text-align: center;">7</td>
-<td style="text-align: center;">CE1</td>
-</tr>
-</tbody>
-</table>
-<br>
-<table summary="" style="width: 60%; text-align: left;"
-cellspacing="0" cellpadding="0" border="0">
-<tbody>
-<tr>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-<br></td>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-GPIO</td>
-<td style="font-weight: bold; text-align: center;">pin</td>
-<td style="font-weight: bold; text-align: center;">pin</td>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-GPIO</td>
-<td style="font-weight: bold; text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">5V<br></td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">1</td>
-<td style="text-align: center;">2</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">3V3</td>
-</tr>
-<tr>
-<td style="text-align: center;">SDA<br></td>
-<td style="text-align: center;">28</td>
-<td style="text-align: center;">3</td>
-<td style="text-align: center;">4</td>
-<td style="text-align: center;">29</td>
-<td style="text-align: center;">SCL</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">30</td>
-<td style="text-align: center;">5</td>
-<td style="text-align: center;">6</td>
-<td style="text-align: center;">31</td>
-<td style="text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">Ground<br></td>
-<td style="text-align: center;">-<br></td>
-<td style="text-align: center;">7</td>
-<td style="text-align: center;">8</td>
-<td style="text-align: center;">-<br></td>
-<td style="text-align: center;">Ground</td>
-</tr>
-</tbody>
-</table>
-<br>
-<h4><a name="Type_3" id="Type_3"></a>Type 3 - Model A+, B+, Pi
-Zero, Pi Zero W, Pi2B, Pi3B, Pi4B<br></h4>
-<ul>
-<li>40 pin expansion header (J8).</li>
-</ul>
-<ul>
-<li>Hardware revision numbers of 16 or greater.</li>
-</ul>
-<ul>
-<li>User GPIO 2-27 (0 and 1 are reserved).<br></li>
-</ul>
-<table summary="" style="width: 60%; text-align: left;"
-cellspacing="0" cellpadding="0" border="0">
-<tbody>
-<tr>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-<br></td>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-GPIO</td>
-<td style="font-weight: bold; text-align: center;">pin</td>
-<td style="font-weight: bold; text-align: center;">pin</td>
-<td style=
-"vertical-align: top; font-weight: bold; text-align: center;">
-GPIO</td>
-<td style="font-weight: bold; text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">3V3</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">1</td>
-<td style="text-align: center;">2</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">5V</td>
-</tr>
-<tr>
-<td style="text-align: center;">SDA</td>
-<td style="text-align: center;">2</td>
-<td style="text-align: center;">3</td>
-<td style="text-align: center;">4</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">5V</td>
-</tr>
-<tr>
-<td style="text-align: center;">SCL</td>
-<td style="text-align: center;">3</td>
-<td style="text-align: center;">5</td>
-<td style="text-align: center;">6</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">Ground</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">4</td>
-<td style="text-align: center;">7</td>
-<td style="text-align: center;">8</td>
-<td style="text-align: center;">14</td>
-<td style="text-align: center;">TXD</td>
-</tr>
-<tr>
-<td style="text-align: center;">Ground</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">9</td>
-<td style="text-align: center;">10</td>
-<td style="text-align: center;">15</td>
-<td style="text-align: center;">RXD</td>
-</tr>
-<tr>
-<td style="text-align: center;">ce1</td>
-<td style="text-align: center;">17</td>
-<td style="text-align: center;">11</td>
-<td style="text-align: center;">12</td>
-<td style="text-align: center;">18</td>
-<td style="text-align: center;">ce0</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">27</td>
-<td style="text-align: center;">13</td>
-<td style="text-align: center;">14</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">Ground</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">22</td>
-<td style="text-align: center;">15</td>
-<td style="text-align: center;">16</td>
-<td style="text-align: center;">23</td>
-<td style="text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">3V3</td>
-<td style="text-align: center;">-<br></td>
-<td style="text-align: center;">17</td>
-<td style="text-align: center;">18</td>
-<td style="text-align: center;">24</td>
-<td style="text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">MOSI</td>
-<td style="text-align: center;">10</td>
-<td style="text-align: center;">19</td>
-<td style="text-align: center;">20</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">Ground</td>
-</tr>
-<tr>
-<td style="text-align: center;">MISO</td>
-<td style="text-align: center;">9</td>
-<td style="text-align: center;">21</td>
-<td style="text-align: center;">22</td>
-<td style="text-align: center;">25</td>
-<td style="text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;">SCLK</td>
-<td style="text-align: center;">11</td>
-<td style="text-align: center;">23</td>
-<td style="text-align: center;">24</td>
-<td style="text-align: center;">8</td>
-<td style="text-align: center;">CE0</td>
-</tr>
-<tr>
-<td style="text-align: center;">Ground</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">25</td>
-<td style="text-align: center;">26</td>
-<td style="text-align: center;">7</td>
-<td style="text-align: center;">CE1</td>
-</tr>
-<tr>
-<td style="text-align: center;">ID_SD</td>
-<td style="text-align: center;">0</td>
-<td style="text-align: center;">27</td>
-<td style="text-align: center;">28</td>
-<td style="text-align: center;">1</td>
-<td style="text-align: center;">ID_SC</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">5</td>
-<td style="text-align: center;">29</td>
-<td style="text-align: center;">30</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">Ground</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">6</td>
-<td style="text-align: center;">31</td>
-<td style="text-align: center;">32</td>
-<td style="text-align: center;">12</td>
-<td style="text-align: center;"><br></td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">13</td>
-<td style="text-align: center;">33</td>
-<td style="text-align: center;">34</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">Ground</td>
-</tr>
-<tr>
-<td style="text-align: center;">miso</td>
-<td style="text-align: center;">19</td>
-<td style="text-align: center;">35</td>
-<td style="text-align: center;">36</td>
-<td style="text-align: center;">16</td>
-<td style="text-align: center;">ce2</td>
-</tr>
-<tr>
-<td style="text-align: center;"><br></td>
-<td style="text-align: center;">26</td>
-<td style="text-align: center;">37</td>
-<td style="text-align: center;">38</td>
-<td style="text-align: center;">20</td>
-<td style="text-align: center;">mosi</td>
-</tr>
-<tr>
-<td style="text-align: center;">Ground</td>
-<td style="text-align: center;">-</td>
-<td style="text-align: center;">39</td>
-<td style="text-align: center;">40</td>
-<td style="text-align: center;">21</td>
-<td style="text-align: center;">sclk</td>
-</tr>
-</tbody>
-</table>
-<br>
-<h4><a name="CM" id="CM"></a>Compute Module</h4>
-<p>All 54 GPIO may be physically accessed.&nbsp; Some are reserved
-for system use - refer to the Compute Module documentation.<br></p>
-<p>Only GPIO 0-31 are supported for hardware timed sampling, PWM,
-servo pulses, alert callbacks, waves, and software serial
-links.<br></p>
-<h3><a name="Other_Languages" id="Other_Languages"></a>Other
-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>
-<ul>
-<li><a href="https://github.com/skvamme/pigpio">Erlang</a>
-(skvamme)</li>
-<li><a href="https://github.com/mattjlewis/pigpioj">Java</a> JNI
-wrapper around the pigpio C library (mattlewis)</li>
-<li><a href="https://github.com/mattjlewis/diozero">Java</a> via
-diozero, a high level wrapper around pigpio, Pi4J, wiringPi etc
-(mattlewis)</li>
-<li><a href="https://github.com/nkolban/jpigpio">Java</a>
-(nkolban)</li>
-<li><a href=
-"https://github.com/unosquare/pigpio-dotnet">.NET/mono</a>
-(unosquare)</li>
-<li><a href="https://github.com/fivdi/pigpio">Node.js</a>
-(fivdi)</li>
-<li><a href="https://metacpan.org/pod/RPi::PIGPIO">Perl</a> (Gligan
-Calin Horea)</li>
-<li><a href=
-"https://github.com/nak1114/ruby-extension-pigpio">Ruby</a>
-(Nak)</li>
-<li><a href=
-"https://github.com/vasmalltalk/pigpio-vast">Smalltalk</a>(Instantiations)</li>
-<li><a href=
-"https://github.com/UBogun/Xojo-pigpio">Xojo</a>(UBogun)</li>
-</ul>
-<hr style="width: 100%; height: 2px;">
-<p><font size="-2">The PWM and servo pulses are timed using the DMA
-and PWM/PCM peripherals.&nbsp; This use was inspired by Richard
-Hirst's <a href="https://github.com/richardghirst/PiBits" target=
-"_blank">servoblaster</a> kernel module.</font></p>
diff --git a/DOC/tmp/body/misc.body b/DOC/tmp/body/misc.body
deleted file mode 100644
index 8bb3552..0000000
--- a/DOC/tmp/body/misc.body
+++ /dev/null
@@ -1,24 +0,0 @@
-
-There are two C libraries which provide a socket interface to the
-pigpio daemon.&nbsp; They provide an interface very similar to the
-pigpio Python module.<br>
-<ul>
-<li>The original <a href="./pdif.html">pigpiod_if</a> library is
-now deprecated and will no longer be updated.&nbsp; This library is
-limited to controlling one Pi at a time.</li>
-</ul>
-<ul>
-<li>The new <a href="./pdif2.html">pigpiod_if2</a> library which
-should be used for new code.&nbsp; This library allows multiple Pis
-to be controlled at one time.</li>
-</ul>
-Additional details of the pigpio <a href="./sif.html">socket</a>
-interface.<br>
-<br>
-Additional details of the pigpio <a href="./pif.html">pipe</a>
-interface.<br>
-<br>
-<a href="pig2vcd.html">pig2vcd</a> is a utility which converts
-pigpio notifications into the VCD (Value Change Dump) format.&nbsp;
-VCD can be read by many programs, in particular <a href=
-"http://gtkwave.sourceforge.net/">GTKWave</a>.
diff --git a/DOC/tmp/body/pdif.body b/DOC/tmp/body/pdif.body
deleted file mode 100644
index 238e3f7..0000000
--- a/DOC/tmp/body/pdif.body
+++ /dev/null
@@ -1,1105 +0,0 @@
-<br><br>THIS LIBRARY IS DEPRECATED. NEW CODE SHOULD BE WRITTEN TO
-USE THE MORE VERSATILE pigpiod_if2 LIBRARY.
-<br><br>pigpiod_if is a C library for the Raspberry which allows control
-of the GPIO via the socket interface to the pigpio daemon.<br>
-<h3>Features</h3>o hardware timed PWM on any of GPIO 0-31
-<br><br>o hardware timed servo pulses on any of GPIO 0-31
-<br><br>o callbacks when any of GPIO 0-31 change state
-<br><br>o callbacks at timed intervals
-<br><br>o reading/writing all of the GPIO in a bank as one operation
-<br><br>o individually setting GPIO modes, reading and writing
-<br><br>o notifications when any of GPIO 0-31 change state
-<br><br>o the construction of output waveforms with microsecond timing
-<br><br>o rudimentary permission control over GPIO
-<br><br>o a simple interface to start and stop new threads
-<br><br>o I2C, SPI, and serial link wrappers
-<br><br>o creating and running scripts on the pigpio daemon
-<h3>GPIO</h3>ALL GPIO are identified by their Broadcom number.
-<h3>Notes</h3>The PWM and servo pulses are timed using the DMA and PWM/PCM peripherals.
-<h3>Usage</h3>Include &lt;pigpiod_if.h&gt; in your source files.
-<br><br>Assuming your source is in prog.c use the following command to build
-<br><br><code>gcc&nbsp;-Wall&nbsp;-pthread&nbsp;-o&nbsp;prog&nbsp;prog.c&nbsp;-lpigpiod_if&nbsp;-lrt<br></code><br><br>to run make sure the pigpio daemon is running
-<br><br><code>sudo&nbsp;pigpiod<br><br>&nbsp;./prog&nbsp;#&nbsp;sudo&nbsp;is&nbsp;not&nbsp;required&nbsp;to&nbsp;run&nbsp;programs&nbsp;linked&nbsp;to&nbsp;pigpiod_if<br></code><br><br>For examples see x_pigpiod_if.c within the pigpio archive file.
-<h3>Notes</h3>All the functions which return an int return &lt; 0 on error
-<h2>OVERVIEW</h2><table border="0" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td></td></tr><tr><td><b>ESSENTIAL
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#pigpio_start">pigpio_start</a></td><td> Connects to the pigpio daemon
-</td></tr><tr><td><a href="#pigpio_stop">pigpio_stop</a></td><td> Disconnects from the pigpio daemon
-</td></tr><tr><td></td><td></td></tr><tr><td><b>BEGINNER
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_mode">set_mode</a></td><td> Set a GPIO mode
-</td></tr><tr><td><a href="#get_mode">get_mode</a></td><td> Get a GPIO mode
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_pull_up_down">set_pull_up_down</a></td><td> Set/clear GPIO pull up/down resistor
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpio_read">gpio_read</a></td><td> Read a GPIO
-</td></tr><tr><td><a href="#gpio_write">gpio_write</a></td><td> Write a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_PWM_dutycycle">set_PWM_dutycycle</a></td><td> Start/stop PWM pulses on a GPIO
-</td></tr><tr><td><a href="#get_PWM_dutycycle">get_PWM_dutycycle</a></td><td> Get the PWM dutycycle in use on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_servo_pulsewidth">set_servo_pulsewidth</a></td><td> Start/stop servo pulses on a GPIO
-</td></tr><tr><td><a href="#get_servo_pulsewidth">get_servo_pulsewidth</a></td><td> Get the servo pulsewidth in use on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#callback">callback</a></td><td> Create GPIO level change callback
-</td></tr><tr><td><a href="#callback_ex">callback_ex</a></td><td> Create GPIO level change callback
-</td></tr><tr><td><a href="#callback_cancel">callback_cancel</a></td><td> Cancel a callback
-</td></tr><tr><td><a href="#wait_for_edge">wait_for_edge</a></td><td> Wait for GPIO level change
-</td></tr><tr><td></td><td></td></tr><tr><td><b>INTERMEDIATE
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpio_trigger">gpio_trigger</a></td><td> Send a trigger pulse to a GPIO.
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_watchdog">set_watchdog</a></td><td> Set a watchdog on a GPIO.
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_PWM_range">set_PWM_range</a></td><td> Configure PWM range for a GPIO
-</td></tr><tr><td><a href="#get_PWM_range">get_PWM_range</a></td><td> Get configured PWM range for a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_PWM_frequency">set_PWM_frequency</a></td><td> Configure PWM frequency for a GPIO
-</td></tr><tr><td><a href="#get_PWM_frequency">get_PWM_frequency</a></td><td> Get configured PWM frequency for a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#read_bank_1">read_bank_1</a></td><td> Read all GPIO in bank 1
-</td></tr><tr><td><a href="#read_bank_2">read_bank_2</a></td><td> Read all GPIO in bank 2
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#clear_bank_1">clear_bank_1</a></td><td> Clear selected GPIO in bank 1
-</td></tr><tr><td><a href="#clear_bank_2">clear_bank_2</a></td><td> Clear selected GPIO in bank 2
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_bank_1">set_bank_1</a></td><td> Set selected GPIO in bank 1
-</td></tr><tr><td><a href="#set_bank_2">set_bank_2</a></td><td> Set selected GPIO in bank 2
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#start_thread">start_thread</a></td><td> Start a new thread
-</td></tr><tr><td><a href="#stop_thread">stop_thread</a></td><td> Stop a previously started thread
-</td></tr><tr><td></td><td></td></tr><tr><td><b>ADVANCED
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_PWM_real_range">get_PWM_real_range</a></td><td> Get underlying PWM range for a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#notify_open">notify_open</a></td><td> Request a notification handle
-</td></tr><tr><td><a href="#notify_begin">notify_begin</a></td><td> Start notifications for selected GPIO
-</td></tr><tr><td><a href="#notify_pause">notify_pause</a></td><td> Pause notifications
-</td></tr><tr><td><a href="#notify_close">notify_close</a></td><td> Close a notification
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_serial_read_open">bb_serial_read_open</a></td><td> Opens a GPIO for bit bang serial reads
-</td></tr><tr><td><a href="#bb_serial_read">bb_serial_read</a></td><td> Reads bit bang serial data from a GPIO
-</td></tr><tr><td><a href="#bb_serial_read_close">bb_serial_read_close</a></td><td> Closes a GPIO for bit bang serial reads
-</td></tr><tr><td><a href="#bb_serial_invert">bb_serial_invert</a></td><td> Invert serial logic (1 invert, 0 normal)
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#hardware_clock">hardware_clock</a></td><td> Start hardware clock on supported GPIO
-</td></tr><tr><td><a href="#hardware_PWM">hardware_PWM</a></td><td> Start hardware PWM on supported GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_glitch_filter">set_glitch_filter</a></td><td> Set a glitch filter on a GPIO
-</td></tr><tr><td><a href="#set_noise_filter">set_noise_filter</a></td><td> Set a noise filter on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SCRIPTS
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#store_script">store_script</a></td><td> Store a script
-</td></tr><tr><td><a href="#run_script">run_script</a></td><td> Run a stored script
-</td></tr><tr><td><a href="#script_status">script_status</a></td><td> Get script status and parameters
-</td></tr><tr><td><a href="#stop_script">stop_script</a></td><td> Stop a running script
-</td></tr><tr><td><a href="#delete_script">delete_script</a></td><td> Delete a stored script
-</td></tr><tr><td></td><td></td></tr><tr><td><b>WAVES
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_clear">wave_clear</a></td><td> Deletes all waveforms
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_add_new">wave_add_new</a></td><td> Starts a new waveform
-</td></tr><tr><td><a href="#wave_add_generic">wave_add_generic</a></td><td> Adds a series of pulses to the waveform
-</td></tr><tr><td><a href="#wave_add_serial">wave_add_serial</a></td><td> Adds serial data to the waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_create">wave_create</a></td><td> Creates a waveform from added data
-</td></tr><tr><td><a href="#wave_delete">wave_delete</a></td><td> Deletes one or more waveforms
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_send_once">wave_send_once</a></td><td> Transmits a waveform once
-</td></tr><tr><td><a href="#wave_send_repeat">wave_send_repeat</a></td><td> Transmits a waveform repeatedly
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_chain">wave_chain</a></td><td> Transmits a chain of waveforms
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_tx_busy">wave_tx_busy</a></td><td> Checks to see if the waveform has ended
-</td></tr><tr><td><a href="#wave_tx_stop">wave_tx_stop</a></td><td> Aborts the current waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_get_micros">wave_get_micros</a></td><td> Length in microseconds of the current waveform
-</td></tr><tr><td><a href="#wave_get_high_micros">wave_get_high_micros</a></td><td> Length of longest waveform so far
-</td></tr><tr><td><a href="#wave_get_max_micros">wave_get_max_micros</a></td><td> Absolute maximum allowed micros
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_get_pulses">wave_get_pulses</a></td><td> Length in pulses of the current waveform
-</td></tr><tr><td><a href="#wave_get_high_pulses">wave_get_high_pulses</a></td><td> Length of longest waveform so far
-</td></tr><tr><td><a href="#wave_get_max_pulses">wave_get_max_pulses</a></td><td> Absolute maximum allowed pulses
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_get_cbs">wave_get_cbs</a></td><td> Length in cbs of the current waveform
-</td></tr><tr><td><a href="#wave_get_high_cbs">wave_get_high_cbs</a></td><td> Length of longest waveform so far
-</td></tr><tr><td><a href="#wave_get_max_cbs">wave_get_max_cbs</a></td><td> Absolute maximum allowed cbs
-</td></tr><tr><td></td><td></td></tr><tr><td><b>I2C
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_open">i2c_open</a></td><td> Opens an I2C device
-</td></tr><tr><td><a href="#i2c_close">i2c_close</a></td><td> Closes an I2C device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_write_quick">i2c_write_quick</a></td><td> smbus write quick
-</td></tr><tr><td><a href="#i2c_write_byte">i2c_write_byte</a></td><td> smbus write byte
-</td></tr><tr><td><a href="#i2c_read_byte">i2c_read_byte</a></td><td> smbus read byte
-</td></tr><tr><td><a href="#i2c_write_byte_data">i2c_write_byte_data</a></td><td> smbus write byte data
-</td></tr><tr><td><a href="#i2c_write_word_data">i2c_write_word_data</a></td><td> smbus write word data
-</td></tr><tr><td><a href="#i2c_read_byte_data">i2c_read_byte_data</a></td><td> smbus read byte data
-</td></tr><tr><td><a href="#i2c_read_word_data">i2c_read_word_data</a></td><td> smbus read word data
-</td></tr><tr><td><a href="#i2c_process_call">i2c_process_call</a></td><td> smbus process call
-</td></tr><tr><td><a href="#i2c_write_block_data">i2c_write_block_data</a></td><td> smbus write block data
-</td></tr><tr><td><a href="#i2c_read_block_data">i2c_read_block_data</a></td><td> smbus read block data
-</td></tr><tr><td><a href="#i2c_block_process_call">i2c_block_process_call</a></td><td> smbus block process call
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_write_i2c_block_data">i2c_write_i2c_block_data</a></td><td> smbus write I2C block data
-</td></tr><tr><td><a href="#i2c_read_i2c_block_data">i2c_read_i2c_block_data</a></td><td> smbus read I2C block data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_device">i2c_read_device</a></td><td> Reads the raw I2C device
-</td></tr><tr><td><a href="#i2c_write_device">i2c_write_device</a></td><td> Writes the raw I2C device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_zip">i2c_zip</a></td><td> Performs multiple I2C transactions
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_i2c_open">bb_i2c_open</a></td><td> Opens GPIO for bit banging I2C
-</td></tr><tr><td><a href="#bb_i2c_close">bb_i2c_close</a></td><td> Closes GPIO for bit banging I2C
-</td></tr><tr><td><a href="#bb_i2c_zip">bb_i2c_zip</a></td><td> Performs multiple bit banged I2C transactions
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SPI
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#spi_open">spi_open</a></td><td> Opens a SPI device
-</td></tr><tr><td><a href="#spi_close">spi_close</a></td><td> Closes a SPI device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#spi_read">spi_read</a></td><td> Reads bytes from a SPI device
-</td></tr><tr><td><a href="#spi_write">spi_write</a></td><td> Writes bytes to a SPI device
-</td></tr><tr><td><a href="#spi_xfer">spi_xfer</a></td><td> Transfers bytes with a SPI device
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SERIAL
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#serial_open">serial_open</a></td><td> Opens a serial device
-</td></tr><tr><td><a href="#serial_close">serial_close</a></td><td> Closes a serial device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#serial_write_byte">serial_write_byte</a></td><td> Writes a byte to a serial device
-</td></tr><tr><td><a href="#serial_read_byte">serial_read_byte</a></td><td> Reads a byte from a serial device
-</td></tr><tr><td><a href="#serial_write">serial_write</a></td><td> Writes bytes to a serial device
-</td></tr><tr><td><a href="#serial_read">serial_read</a></td><td> Reads bytes from a serial device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#serial_data_available">serial_data_available</a></td><td> Returns number of bytes ready to be read
-</td></tr><tr><td></td><td></td></tr><tr><td><b>CUSTOM
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#custom_1">custom_1</a></td><td> User custom function 1
-</td></tr><tr><td><a href="#custom_2">custom_2</a></td><td> User custom function 2
-</td></tr><tr><td></td><td></td></tr><tr><td><b>UTILITIES
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_current_tick">get_current_tick</a></td><td> Get current tick (microseconds)
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_hardware_revision">get_hardware_revision</a></td><td> Get hardware revision
-</td></tr><tr><td><a href="#get_pigpio_version">get_pigpio_version</a></td><td> Get the pigpio version
-</td></tr><tr><td><a href="#pigpiod_if_version">pigpiod_if_version</a></td><td> Get the pigpiod_if version
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#pigpio_error">pigpio_error</a></td><td> Get a text description of an error code.
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#time_sleep">time_sleep</a></td><td> Sleeps for a float number of seconds
-</td></tr><tr><td><a href="#time_time">time_time</a></td><td> Float number of seconds since the epoch
-</td></tr><tr><td></td><td></td></tr></tbody></table><h2>FUNCTIONS</h2><h3><a name="time_time"></a><a href="#double"><small>double</small></a> time_time<small>(void)</small></h3>
-Return the current time in seconds since the Epoch.
-<h3><a name="time_sleep"></a><a href="#void"><small>void</small></a> time_sleep<small>(<a href="#double">double</a> <a href="#seconds">seconds</a>)</small></h3>
-Delay execution for a given number of seconds.
-<br><br><code>seconds:&nbsp;the&nbsp;number&nbsp;of&nbsp;seconds&nbsp;to&nbsp;delay.<br></code><h3><a name="pigpio_error"></a><a href="#char"><small>char</small></a> *pigpio_error<small>(<a href="#int">int</a> <a href="#errnum">errnum</a>)</small></h3>
-Return a text description for an error code.
-<br><br><code>errnum:&nbsp;the&nbsp;error&nbsp;code.<br></code><h3><a name="pigpiod_if_version"></a><a href="#unsigned"><small>unsigned</small></a> pigpiod_if_version<small>(void)</small></h3>
-Return the pigpiod_if version.
-<h3><a name="start_thread"></a><a href="#pthread_t"><small>pthread_t</small></a> *start_thread<small>(<a href="#gpioThreadFunc_t">gpioThreadFunc_t</a> <a href="#thread_func">thread_func</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-Starts a new thread of execution with thread_func as the main routine.
-<br><br><code>thread_func:&nbsp;the&nbsp;main&nbsp;function&nbsp;for&nbsp;the&nbsp;new&nbsp;thread.<br>&nbsp;&nbsp;&nbsp;userdata:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;an&nbsp;arbitrary&nbsp;argument.<br></code><br><br>Returns a pointer to pthread_t if OK, otherwise NULL.
-<br><br>The function is passed the single argument userdata.
-<br><br>The thread can be cancelled by passing the pointer to pthread_t to
-<a href="#stop_thread">stop_thread</a>.
-<h3><a name="stop_thread"></a><a href="#void"><small>void</small></a> stop_thread<small>(<a href="#pthread_t">pthread_t</a> <a href="#*pth">*pth</a>)</small></h3>
-Cancels the thread pointed at by pth.
-<br><br><code>pth:&nbsp;the&nbsp;thread&nbsp;to&nbsp;be&nbsp;stopped.<br></code><br><br>No value is returned.
-<br><br>The thread to be stopped should have been started with <a href="#start_thread">start_thread</a>.
-<h3><a name="pigpio_start"></a><a href="#int"><small>int</small></a> pigpio_start<small>(<a href="#char">char</a> <a href="#*addrStr">*addrStr</a>, <a href="#char">char</a> <a href="#*portStr">*portStr</a>)</small></h3>
-Connect to the pigpio daemon. Reserving command and
-notification streams.
-<br><br><code>addrStr:&nbsp;specifies&nbsp;the&nbsp;host&nbsp;or&nbsp;IP&nbsp;address&nbsp;of&nbsp;the&nbsp;Pi&nbsp;running&nbsp;the<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pigpio&nbsp;daemon.&nbsp;&nbsp;It&nbsp;may&nbsp;be&nbsp;NULL&nbsp;in&nbsp;which&nbsp;case&nbsp;localhost<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is&nbsp;used&nbsp;unless&nbsp;overridden&nbsp;by&nbsp;the&nbsp;PIGPIO_ADDR&nbsp;environment<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;variable.<br><br>portStr:&nbsp;specifies&nbsp;the&nbsp;port&nbsp;address&nbsp;used&nbsp;by&nbsp;the&nbsp;Pi&nbsp;running&nbsp;the<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pigpio&nbsp;daemon.&nbsp;&nbsp;It&nbsp;may&nbsp;be&nbsp;NULL&nbsp;in&nbsp;which&nbsp;case&nbsp;"8888"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is&nbsp;used&nbsp;unless&nbsp;overridden&nbsp;by&nbsp;the&nbsp;PIGPIO_PORT&nbsp;environment<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;variable.<br></code><h3><a name="pigpio_stop"></a><a href="#void"><small>void</small></a> pigpio_stop<small>(void)</small></h3>
-Terminates the connection to the pigpio daemon and releases
-resources used by the library.
-<h3><a name="set_mode"></a><a href="#int"><small>int</small></a> set_mode<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#mode">mode</a>)</small></h3>
-Set the GPIO mode.
-<br><br><code>gpio:&nbsp;0-53.<br>mode:&nbsp;PI_INPUT,&nbsp;PI_OUTPUT,&nbsp;PI_ALT0,&nbsp;PI_ALT1,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PI_ALT2,&nbsp;PI_ALT3,&nbsp;PI_ALT4,&nbsp;PI_ALT5.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_MODE,
-or PI_NOT_PERMITTED.
-<h3><a name="get_mode"></a><a href="#int"><small>int</small></a> get_mode<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>)</small></h3>
-Get the GPIO mode.
-<br><br><code>gpio:&nbsp;0-53.<br></code><br><br>Returns the GPIO mode if OK, otherwise PI_BAD_GPIO.
-<h3><a name="set_pull_up_down"></a><a href="#int"><small>int</small></a> set_pull_up_down<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#pud">pud</a>)</small></h3>
-Set or clear the GPIO pull-up/down resistor.
-<br><br><code>gpio:&nbsp;0-53.<br>&nbsp;pud:&nbsp;PI_PUD_UP,&nbsp;PI_PUD_DOWN,&nbsp;PI_PUD_OFF.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_PUD,
-or PI_NOT_PERMITTED.
-<h3><a name="gpio_read"></a><a href="#int"><small>int</small></a> gpio_read<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>)</small></h3>
-Read the GPIO level.
-<br><br><code>gpio:0-53.<br></code><br><br>Returns the GPIO level if OK, otherwise PI_BAD_GPIO.
-<h3><a name="gpio_write"></a><a href="#int"><small>int</small></a> gpio_write<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#level">level</a>)</small></h3>
-Write the GPIO level.
-<br><br><code>&nbsp;gpio:&nbsp;0-53.<br>level:&nbsp;0,&nbsp;1.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_LEVEL,
-or PI_NOT_PERMITTED.
-<br><br>Notes
-<br><br>If PWM or servo pulses are active on the GPIO they are switched off.
-<h3><a name="set_PWM_dutycycle"></a><a href="#int"><small>int</small></a> set_PWM_dutycycle<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#dutycycle">dutycycle</a>)</small></h3>
-Start (non-zero dutycycle) or stop (0) PWM pulses on the GPIO.
-<br><br><code>user_gpio:&nbsp;0-31.<br>dutycycle:&nbsp;0-range&nbsp;(range&nbsp;defaults&nbsp;to&nbsp;255).<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_DUTYCYCLE,
-or PI_NOT_PERMITTED.
-Notes
-<br><br>The <a href="#set_PWM_range">set_PWM_range</a> function may be used to change the
-default range of 255.
-<h3><a name="get_PWM_dutycycle"></a><a href="#int"><small>int</small></a> get_PWM_dutycycle<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Return the PWM dutycycle in use on a GPIO.
-<br><br><code>user_gpio:&nbsp;0-31.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_NOT_PWM_GPIO.
-<br><br>For normal PWM the dutycycle will be out of the defined range
-for the GPIO (see <a href="#get_PWM_range">get_PWM_range</a>).
-<br><br>If a hardware clock is active on the GPIO the reported dutycycle
-will be 500000 (500k) out of 1000000 (1M).
-<br><br>If hardware PWM is active on the GPIO the reported dutycycle
-will be out of a 1000000 (1M).
-<h3><a name="set_PWM_range"></a><a href="#int"><small>int</small></a> set_PWM_range<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#range">range</a>)</small></h3>
-Set the range of PWM values to be used on the GPIO.
-<br><br><code>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;range:&nbsp;25-40000.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_DUTYRANGE,
-or PI_NOT_PERMITTED.
-<br><br>Notes
-<br><br>If PWM is currently active on the GPIO its dutycycle will be
-scaled to reflect the new range.
-<br><br>The real range, the number of steps between fully off and fully on
-for each of the 18 available GPIO frequencies is
-<br><br><code>&nbsp;&nbsp;25(#1),&nbsp;&nbsp;&nbsp;&nbsp;50(#2),&nbsp;&nbsp;&nbsp;100(#3),&nbsp;&nbsp;&nbsp;125(#4),&nbsp;&nbsp;&nbsp;&nbsp;200(#5),&nbsp;&nbsp;&nbsp;&nbsp;250(#6),<br>&nbsp;400(#7),&nbsp;&nbsp;&nbsp;500(#8),&nbsp;&nbsp;&nbsp;625(#9),&nbsp;&nbsp;&nbsp;800(#10),&nbsp;&nbsp;1000(#11),&nbsp;&nbsp;1250(#12),<br>2000(#13),&nbsp;2500(#14),&nbsp;4000(#15),&nbsp;5000(#16),&nbsp;10000(#17),&nbsp;20000(#18)<br></code><br><br>The real value set by set_PWM_range is (dutycycle * real range) / range.
-<h3><a name="get_PWM_range"></a><a href="#int"><small>int</small></a> get_PWM_range<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Get the range of PWM values being used on the GPIO.
-<br><br><code>user_gpio:&nbsp;0-31.<br></code><br><br>Returns the dutycycle range used for the GPIO if OK,
-otherwise PI_BAD_USER_GPIO.
-<br><br>If a hardware clock or hardware PWM is active on the GPIO the
-reported range will be 1000000 (1M).
-<h3><a name="get_PWM_real_range"></a><a href="#int"><small>int</small></a> get_PWM_real_range<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Get the real underlying range of PWM values being used on the GPIO.
-<br><br><code>user_gpio:&nbsp;0-31.<br></code><br><br>Returns the real range used for the GPIO if OK,
-otherwise PI_BAD_USER_GPIO.
-<br><br>If a hardware clock is active on the GPIO the reported
-real range will be 1000000 (1M).
-<br><br>If hardware PWM is active on the GPIO the reported real range
-will be approximately 250M divided by the set PWM frequency.
-<h3><a name="set_PWM_frequency"></a><a href="#int"><small>int</small></a> set_PWM_frequency<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#frequency">frequency</a>)</small></h3>
-Set the frequency (in Hz) of the PWM to be used on the GPIO.
-<br><br><code>user_gpio:&nbsp;0-31.<br>frequency:&nbsp;&gt;=0&nbsp;(Hz).<br></code><br><br>Returns the numerically closest frequency if OK, otherwise
-PI_BAD_USER_GPIO or PI_NOT_PERMITTED.
-<br><br>If PWM is currently active on the GPIO it will be switched
-off and then back on at the new frequency.
-<br><br>Each GPIO can be independently set to one of 18 different
-PWM frequencies.
-<br><br>The selectable frequencies depend upon the sample rate which
-may be 1, 2, 4, 5, 8, or 10 microseconds (default 5). The
-sample rate is set when the pigpio daemon is started.
-<br><br>The frequencies for each sample rate are:
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hertz<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1:&nbsp;40000&nbsp;20000&nbsp;10000&nbsp;8000&nbsp;5000&nbsp;4000&nbsp;2500&nbsp;2000&nbsp;1600<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1250&nbsp;&nbsp;1000&nbsp;&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;50<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2:&nbsp;20000&nbsp;10000&nbsp;&nbsp;5000&nbsp;4000&nbsp;2500&nbsp;2000&nbsp;1250&nbsp;1000&nbsp;&nbsp;800<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;625&nbsp;&nbsp;&nbsp;500&nbsp;&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;125&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;25<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4:&nbsp;10000&nbsp;&nbsp;5000&nbsp;&nbsp;2500&nbsp;2000&nbsp;1250&nbsp;1000&nbsp;&nbsp;625&nbsp;&nbsp;500&nbsp;&nbsp;400<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;313&nbsp;&nbsp;&nbsp;250&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;125&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;63&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;13<br>sample<br>&nbsp;rate<br>&nbsp;(us)&nbsp;&nbsp;5:&nbsp;&nbsp;8000&nbsp;&nbsp;4000&nbsp;&nbsp;2000&nbsp;1600&nbsp;1000&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;320<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;250&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;&nbsp;160&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;80&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;&nbsp;20&nbsp;&nbsp;&nbsp;10<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8:&nbsp;&nbsp;5000&nbsp;&nbsp;2500&nbsp;&nbsp;1250&nbsp;1000&nbsp;&nbsp;625&nbsp;&nbsp;500&nbsp;&nbsp;313&nbsp;&nbsp;250&nbsp;&nbsp;200<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;156&nbsp;&nbsp;&nbsp;125&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;63&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;31&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;13&nbsp;&nbsp;&nbsp;&nbsp;6<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10:&nbsp;&nbsp;4000&nbsp;&nbsp;2000&nbsp;&nbsp;1000&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;160<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;125&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;&nbsp;80&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;20&nbsp;&nbsp;&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;5<br></code><h3><a name="get_PWM_frequency"></a><a href="#int"><small>int</small></a> get_PWM_frequency<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Get the frequency of PWM being used on the GPIO.
-<br><br><code>user_gpio:&nbsp;0-31.<br></code><br><br>For normal PWM the frequency will be that defined for the GPIO by
-<a href="#set_PWM_frequency">set_PWM_frequency</a>.
-<br><br>If a hardware clock is active on the GPIO the reported frequency
-will be that set by <a href="#hardware_clock">hardware_clock</a>.
-<br><br>If hardware PWM is active on the GPIO the reported frequency
-will be that set by <a href="#hardware_PWM">hardware_PWM</a>.
-<br><br>Returns the frequency (in hertz) used for the GPIO if OK,
-otherwise PI_BAD_USER_GPIO.
-<h3><a name="set_servo_pulsewidth"></a><a href="#int"><small>int</small></a> set_servo_pulsewidth<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#pulsewidth">pulsewidth</a>)</small></h3>
-Start (500-2500) or stop (0) servo pulses on the GPIO.
-<br><br><code>&nbsp;user_gpio:&nbsp;0-31.<br>pulsewidth:&nbsp;0&nbsp;(off),&nbsp;500&nbsp;(anti-clockwise)&nbsp;-&nbsp;2500&nbsp;(clockwise).<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_PULSEWIDTH or
-PI_NOT_PERMITTED.
-<br><br>The selected pulsewidth will continue to be transmitted until
-changed by a subsequent call to set_servo_pulsewidth.
-<br><br>The pulsewidths supported by servos varies and should probably be
-determined by experiment. A value of 1500 should always be safe and
-represents the mid-point of rotation.
-<br><br>You can DAMAGE a servo if you command it to move beyond its limits.
-<br><br>OTHER UPDATE RATES:
-<br><br>This function updates servos at 50Hz. If you wish to use a different
-update frequency you will have to use the PWM functions.
-<br><br><code>Update&nbsp;Rate&nbsp;(Hz)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;200&nbsp;&nbsp;400&nbsp;&nbsp;500<br>1E6/Hz&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;20000&nbsp;10000&nbsp;5000&nbsp;2500&nbsp;2000<br></code><br><br>Firstly set the desired PWM frequency using <a href="#set_PWM_frequency">set_PWM_frequency</a>.
-<br><br>Then set the PWM range using <a href="#set_PWM_range">set_PWM_range</a> to 1E6/Hz.
-Doing this allows you to use units of microseconds when setting
-the servo pulsewidth.
-<br><br>E.g. If you want to update a servo connected to GPIO 25 at 400Hz
-<br><br><code>set_PWM_frequency(25,&nbsp;400);<br>set_PWM_range(25,&nbsp;2500);<br></code><br><br>Thereafter use the <a href="#set_PWM_dutycycle">set_PWM_dutycycle</a> function to move the servo,
-e.g. set_PWM_dutycycle(25, 1500) will set a 1500 us pulse.<br>
-<h3><a name="get_servo_pulsewidth"></a><a href="#int"><small>int</small></a> get_servo_pulsewidth<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Return the servo pulsewidth in use on a GPIO.
-<br><br><code>user_gpio:&nbsp;0-31.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_NOT_SERVO_GPIO.
-<h3><a name="notify_open"></a><a href="#int"><small>int</small></a> notify_open<small>(void)</small></h3>
-Get a free notification handle.
-<br><br>Returns a handle greater than or equal to zero if OK,
-otherwise PI_NO_HANDLE.
-<br><br>A notification is a method for being notified of GPIO state
-changes via a pipe.
-<br><br>Pipes are only accessible from the local machine so this function
-serves no purpose if you are using the library from a remote machine.
-The in-built (socket) notifications provided by <a href="#callback">callback</a>
-should be used instead.
-<br><br>Notifications for handle x will be available at the pipe
-named /dev/pigpiox (where x is the handle number).
-E.g. if the function returns 15 then the notifications must be
-read from /dev/pigpio15.
-<h3><a name="notify_begin"></a><a href="#int"><small>int</small></a> notify_begin<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Start notifications on a previously opened handle.
-<br><br><code>handle:&nbsp;0-31&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#notify_open">notify_open</a>)<br>&nbsp;&nbsp;bits:&nbsp;a&nbsp;mask&nbsp;indicating&nbsp;the&nbsp;GPIO&nbsp;to&nbsp;be&nbsp;notified.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<br><br>The notification sends state changes for each GPIO whose
-corresponding bit in bits is set.
-<br><br>Each notification occupies 12 bytes in the fifo as follows:
-<br><br><code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;seqno;<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;flags;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;tick;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;level;<br>}&nbsp;gpioReport_t;<br></code><br><br>seqno: starts at 0 each time the handle is opened and then increments
-by one for each report.
-<br><br>flags: two flags are defined, PI_NTFY_FLAGS_WDOG and PI_NTFY_FLAGS_ALIVE.
-<br><br>PI_NTFY_FLAGS_WDOG, if bit 5 is set then bits 0-4 of the flags
-indicate a GPIO which has had a watchdog timeout.
-<br><br>PI_NTFY_FLAGS_ALIVE, if bit 6 is set this indicates a keep alive
-signal on the pipe/socket and is sent once a minute in the absence
-of other notification activity.
-<br><br>tick: the number of microseconds since system boot. It wraps around
-after 1h12m.
-<br><br>level: indicates the level of each GPIO. If bit 1&lt;&lt;x is set then
-GPIO x is high.
-<h3><a name="notify_pause"></a><a href="#int"><small>int</small></a> notify_pause<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-Pause notifications on a previously opened handle.
-<br><br><code>handle:&nbsp;0-31&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#notify_open">notify_open</a>)<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<br><br>Notifications for the handle are suspended until
-<a href="#notify_begin">notify_begin</a> is called again.
-<h3><a name="notify_close"></a><a href="#int"><small>int</small></a> notify_close<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-Stop notifications on a previously opened handle and
-release the handle for reuse.
-<br><br><code>handle:&nbsp;0-31&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#notify_open">notify_open</a>)<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<h3><a name="set_watchdog"></a><a href="#int"><small>int</small></a> set_watchdog<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#timeout">timeout</a>)</small></h3>
-Sets a watchdog for a GPIO.
-<br><br><code>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;timeout:&nbsp;0-60000.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO
-or PI_BAD_WDOG_TIMEOUT.
-<br><br>The watchdog is nominally in milliseconds.
-<br><br>Only one watchdog may be registered per GPIO.
-<br><br>The watchdog may be cancelled by setting timeout to 0.
-<br><br>Once a watchdog has been started callbacks for the GPIO will be
-triggered every timeout interval after the last GPIO activity.
-<br><br>The callback will receive the special level PI_TIMEOUT.
-<h3><a name="set_glitch_filter"></a><a href="#int"><small>int</small></a> set_glitch_filter<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#steady">steady</a>)</small></h3>
-Sets a glitch filter on a GPIO.
-<br><br>Level changes on the GPIO are not reported unless the level
-has been stable for at least <a href="#steady">steady</a> microseconds. The
-level is then reported. Level changes of less than <a href="#steady">steady</a>
-microseconds are ignored.
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;steady:&nbsp;0-300000<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
-<br><br>This filter affects the GPIO samples returned to callbacks set up
-with <a href="#callback">callback</a>, <a href="#callback_ex">callback_ex</a> and <a href="#wait_for_edge">wait_for_edge</a>.
-<br><br>It does not affect levels read by <a href="#gpio_read">gpio_read</a>,
-<a href="#read_bank_1">read_bank_1</a>, or <a href="#read_bank_2">read_bank_2</a>.
-Each (stable) edge will be timestamped <a href="#steady">steady</a> microseconds
-after it was first detected.
-<h3><a name="set_noise_filter"></a><a href="#int"><small>int</small></a> set_noise_filter<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#steady">steady</a>, <a href="#unsigned">unsigned</a> <a href="#active">active</a>)</small></h3>
-Sets a noise filter on a GPIO.
-<br><br>Level changes on the GPIO are ignored until a level which has
-been stable for <a href="#steady">steady</a> microseconds is detected. Level changes
-on the GPIO are then reported for <a href="#active">active</a> microseconds after
-which the process repeats.
-<br><br><code>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;steady:&nbsp;0-300000<br>&nbsp;&nbsp;&nbsp;active:&nbsp;0-1000000<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
-<br><br>This filter affects the GPIO samples returned to callbacks set up
-with <a href="#callback">callback</a>, <a href="#callback_ex">callback_ex</a> and <a href="#wait_for_edge">wait_for_edge</a>.
-<br><br>It does not affect levels read by <a href="#gpio_read">gpio_read</a>,
-<a href="#read_bank_1">read_bank_1</a>, or <a href="#read_bank_2">read_bank_2</a>.
-<br><br>Level changes before and after the active period may
-be reported. Your software must be designed to cope with
-such reports.
-<h3><a name="read_bank_1"></a><a href="#uint32_t"><small>uint32_t</small></a> read_bank_1<small>(void)</small></h3>
-Read the levels of the bank 1 GPIO (GPIO 0-31).
-<br><br>The returned 32 bit integer has a bit set if the corresponding
-GPIO is logic 1. GPIO n has bit value (1&lt;&lt;n).
-<h3><a name="read_bank_2"></a><a href="#uint32_t"><small>uint32_t</small></a> read_bank_2<small>(void)</small></h3>
-Read the levels of the bank 2 GPIO (GPIO 32-53).
-<br><br>The returned 32 bit integer has a bit set if the corresponding
-GPIO is logic 1. GPIO n has bit value (1&lt;&lt;(n-32)).
-<h3><a name="clear_bank_1"></a><a href="#int"><small>int</small></a> clear_bank_1<small>(<a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Clears GPIO 0-31 if the corresponding bit in bits is set.
-<br><br><code>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;cleared.<br></code><br><br>Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-<br><br>A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-<h3><a name="clear_bank_2"></a><a href="#int"><small>int</small></a> clear_bank_2<small>(<a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Clears GPIO 32-53 if the corresponding bit (0-21) in bits is set.
-<br><br><code>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;cleared.<br></code><br><br>Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-<br><br>A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-<h3><a name="set_bank_1"></a><a href="#int"><small>int</small></a> set_bank_1<small>(<a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Sets GPIO 0-31 if the corresponding bit in bits is set.
-<br><br><code>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;set.<br></code><br><br>Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-<br><br>A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-<h3><a name="set_bank_2"></a><a href="#int"><small>int</small></a> set_bank_2<small>(<a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Sets GPIO 32-53 if the corresponding bit (0-21) in bits is set.
-<br><br><code>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;set.<br></code><br><br>Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-<br><br>A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-<h3><a name="hardware_clock"></a><a href="#int"><small>int</small></a> hardware_clock<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#clkfreq">clkfreq</a>)</small></h3>
-Starts a hardware clock on a GPIO at the specified frequency.
-Frequencies above 30MHz are unlikely to work.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gpio:&nbsp;see&nbsp;description<br>frequency:&nbsp;0&nbsp;(off)&nbsp;or&nbsp;4689-250000000&nbsp;(250M)<br></code><br><br>Returns 0 if OK, otherwise PI_NOT_PERMITTED, PI_BAD_GPIO,
-PI_NOT_HCLK_GPIO, PI_BAD_HCLK_FREQ,or PI_BAD_HCLK_PASS.
-<br><br>The same clock is available on multiple GPIO. The latest
-frequency setting will be used by all GPIO which share a clock.
-<br><br>The GPIO must be one of the following.
-<br><br><code>4&nbsp;&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;All&nbsp;models<br>5&nbsp;&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br>6&nbsp;&nbsp;&nbsp;clock&nbsp;2&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>20&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>21&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;Rev.2&nbsp;B&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br><br>32&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>34&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>42&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br>43&nbsp;&nbsp;clock&nbsp;2&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>44&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br></code><br><br>Access to clock 1 is protected by a password as its use will likely
-crash the Pi. The password is given by or'ing 0x5A000000 with the
-GPIO number.
-<h3><a name="hardware_PWM"></a><a href="#int"><small>int</small></a> hardware_PWM<small>(<a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#PWMfreq">PWMfreq</a>, <a href="#uint32_t">uint32_t</a> <a href="#PWMduty">PWMduty</a>)</small></h3>
-Starts hardware PWM on a GPIO at the specified frequency and dutycycle.
-Frequencies above 30MHz are unlikely to work.
-<br><br>NOTE: Any waveform started by <a href="#wave_send_once">wave_send_once</a>, <a href="#wave_send_repeat">wave_send_repeat</a>,
-or <a href="#wave_chain">wave_chain</a> will be cancelled.
-<br><br>This function is only valid if the pigpio main clock is PCM. The
-main clock defaults to PCM but may be overridden when the pigpio
-daemon is started (option -t).
-<br><br><code>&nbsp;&nbsp;&nbsp;gpio:&nbsp;see&nbsp;descripton<br>PWMfreq:&nbsp;0&nbsp;(off)&nbsp;or&nbsp;1-125000000&nbsp;(125M)<br>PWMduty:&nbsp;0&nbsp;(off)&nbsp;to&nbsp;1000000&nbsp;(1M)(fully&nbsp;on)<br></code><br><br>Returns 0 if OK, otherwise PI_NOT_PERMITTED, PI_BAD_GPIO,
-PI_NOT_HPWM_GPIO, PI_BAD_HPWM_DUTY, PI_BAD_HPWM_FREQ,
-or PI_HPWM_ILLEGAL.
-<br><br>The same PWM channel is available on multiple GPIO. The latest
-frequency and dutycycle setting will be used by all GPIO which
-share a PWM channel.
-<br><br>The GPIO must be one of the following.
-<br><br><code>12&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>13&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>18&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;All&nbsp;models<br>19&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br><br>40&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>41&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>45&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>52&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>53&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br></code><h3><a name="get_current_tick"></a><a href="#uint32_t"><small>uint32_t</small></a> get_current_tick<small>(void)</small></h3>
-Gets the current system tick.
-<br><br>Tick is the number of microseconds since system boot.
-<br><br>As tick is an unsigned 32 bit quantity it wraps around after
-2**32 microseconds, which is approximately 1 hour 12 minutes.
-<h3><a name="get_hardware_revision"></a><a href="#uint32_t"><small>uint32_t</small></a> get_hardware_revision<small>(void)</small></h3>
-Get the Pi's hardware revision number.
-<br><br>The hardware revision is the last few characters on the Revision line
-of /proc/cpuinfo.
-<br><br>If the hardware revision can not be found or is not a valid
-hexadecimal number the function returns 0.
-<br><br>The revision number can be used to determine the assignment of GPIO
-to pins (see <a href="#gpio">gpio</a>).
-<br><br>There are at least three types of board.
-<br><br>Type 1 boards have hardware revision numbers of 2 and 3.
-<br><br>Type 2 boards have hardware revision numbers of 4, 5, 6, and 15.
-<br><br>Type 3 boards have hardware revision numbers of 16 or greater.
-<h3><a name="get_pigpio_version"></a><a href="#uint32_t"><small>uint32_t</small></a> get_pigpio_version<small>(void)</small></h3>
-Returns the pigpio version.
-<h3><a name="wave_clear"></a><a href="#int"><small>int</small></a> wave_clear<small>(void)</small></h3>
-This function clears all waveforms and any data added by calls to the
-<a href="#wave_add_*">wave_add_*</a> functions.
-<br><br>Returns 0 if OK.
-<h3><a name="wave_add_new"></a><a href="#int"><small>int</small></a> wave_add_new<small>(void)</small></h3>
-This function starts a new empty waveform. You wouldn't normally need
-to call this function as it is automatically called after a waveform is
-created with the <a href="#wave_create">wave_create</a> function.
-<br><br>Returns 0 if OK.
-<h3><a name="wave_add_generic"></a><a href="#int"><small>int</small></a> wave_add_generic<small>(<a href="#unsigned">unsigned</a> <a href="#numPulses">numPulses</a>, <a href="#gpioPulse_t">gpioPulse_t</a> <a href="#*pulses">*pulses</a>)</small></h3>
-This function adds a number of pulses to the current waveform.
-<br><br><code>numPulses:&nbsp;the&nbsp;number&nbsp;of&nbsp;pulses.<br>&nbsp;&nbsp;&nbsp;pulses:&nbsp;an&nbsp;array&nbsp;of&nbsp;pulses.<br></code><br><br>Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_TOO_MANY_PULSES.
-<br><br>The pulses are interleaved in time order within the existing waveform
-(if any).
-<br><br>Merging allows the waveform to be built in parts, that is the settings
-for GPIO#1 can be added, and then GPIO#2 etc.
-<br><br>If the added waveform is intended to start after or within the existing
-waveform then the first pulse should consist solely of a delay.
-<h3><a name="wave_add_serial"></a><a href="#int"><small>int</small></a> wave_add_serial<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#data_bits">data_bits</a>, <a href="#unsigned">unsigned</a> <a href="#stop_bits">stop_bits</a>, <a href="#unsigned">unsigned</a> <a href="#offset">offset</a>, <a href="#unsigned">unsigned</a> <a href="#numBytes">numBytes</a>, <a href="#char">char</a> <a href="#*str">*str</a>)</small></h3>
-This function adds a waveform representing serial data to the
-existing waveform (if any). The serial data starts offset
-microseconds from the start of the waveform.
-<br><br><code>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;50-1000000<br>data_bits:&nbsp;number&nbsp;of&nbsp;data&nbsp;bits&nbsp;(1-32)<br>stop_bits:&nbsp;number&nbsp;of&nbsp;stop&nbsp;half&nbsp;bits&nbsp;(2-8)<br>&nbsp;&nbsp;&nbsp;offset:&nbsp;&gt;=0<br>&nbsp;numBytes:&nbsp;&gt;=1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str:&nbsp;an&nbsp;array&nbsp;of&nbsp;chars.<br></code><br><br>Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_BAD_USER_GPIO, PI_BAD_WAVE_BAUD, PI_BAD_DATABITS,
-PI_BAD_STOP_BITS, PI_TOO_MANY_CHARS, PI_BAD_SER_OFFSET,
-or PI_TOO_MANY_PULSES.
-<br><br>NOTES:
-<br><br>The serial data is formatted as one start bit, <a href="#data_bits">data_bits</a> data bits,
-and <a href="#stop_bits">stop_bits</a>/2 stop bits.
-<br><br>It is legal to add serial data streams with different baud rates to
-the same waveform.
-<br><br><a href="#numBytes">numBytes</a> is the number of bytes of data in str.
-<br><br>The bytes required for each character depend upon <a href="#data_bits">data_bits</a>.
-<br><br>For <a href="#data_bits">data_bits</a> 1-8 there will be one byte per character.<br>
-For <a href="#data_bits">data_bits</a> 9-16 there will be two bytes per character.<br>
-For <a href="#data_bits">data_bits</a> 17-32 there will be four bytes per character.
-<h3><a name="wave_create"></a><a href="#int"><small>int</small></a> wave_create<small>(void)</small></h3>
-This function creates a waveform from the data provided by the prior
-calls to the <a href="#wave_add_*">wave_add_*</a> functions. Upon success a wave id
-greater than or equal to 0 is returned, otherwise PI_EMPTY_WAVEFORM,
-PI_TOO_MANY_CBS, PI_TOO_MANY_OOL, or PI_NO_WAVEFORM_ID.
-<br><br>The data provided by the <a href="#wave_add_*">wave_add_*</a> functions is consumed by this
-function.
-<br><br>As many waveforms may be created as there is space available. The
-wave id is passed to <a href="#wave_send_*">wave_send_*</a> to specify the waveform to transmit.
-<br><br>Normal usage would be
-<br><br>Step 1. <a href="#wave_clear">wave_clear</a> to clear all waveforms and added data.
-<br><br>Step 2. <a href="#wave_add_*">wave_add_*</a> calls to supply the waveform data.
-<br><br>Step 3. <a href="#wave_create">wave_create</a> to create the waveform and get a unique id
-<br><br>Repeat steps 2 and 3 as needed.
-<br><br>Step 4. <a href="#wave_send_*">wave_send_*</a> with the id of the waveform to transmit.
-<br><br>A waveform comprises one or more pulses. Each pulse consists of a
-<a href="#gpioPulse_t">gpioPulse_t</a> structure.
-<br><br><code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOn;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOff;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;usDelay;<br>}&nbsp;gpioPulse_t;<br></code><br><br>The fields specify
-<br><br>1) the GPIO to be switched on at the start of the pulse.<br>
-2) the GPIO to be switched off at the start of the pulse.<br>
-3) the delay in microseconds before the next pulse.<br>
-<br><br>Any or all the fields can be zero. It doesn't make any sense to
-set all the fields to zero (the pulse will be ignored).
-<br><br>When a waveform is started each pulse is executed in order with the
-specified delay between the pulse and the next.
-<br><br>Returns the new waveform id if OK, otherwise PI_EMPTY_WAVEFORM,
-PI_NO_WAVEFORM_ID, PI_TOO_MANY_CBS, or PI_TOO_MANY_OOL.
-<h3><a name="wave_delete"></a><a href="#int"><small>int</small></a> wave_delete<small>(<a href="#unsigned">unsigned</a> <a href="#wave_id">wave_id</a>)</small></h3>
-This function deletes the waveform with id wave_id.
-<br><br><code>wave_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#wave_create">wave_create</a>.<br></code><br><br>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.
-<h3><a name="wave_send_once"></a><a href="#int"><small>int</small></a> wave_send_once<small>(<a href="#unsigned">unsigned</a> <a href="#wave_id">wave_id</a>)</small></h3>
-This function transmits the waveform with id wave_id. The waveform
-is sent once.
-<br><br>NOTE: Any hardware PWM started by <a href="#hardware_PWM">hardware_PWM</a> will be cancelled.
-<br><br><code>wave_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#wave_create">wave_create</a>.<br></code><br><br>Returns the number of DMA control blocks in the waveform if OK,
-otherwise PI_BAD_WAVE_ID, or PI_BAD_WAVE_MODE.
-<h3><a name="wave_send_repeat"></a><a href="#int"><small>int</small></a> wave_send_repeat<small>(<a href="#unsigned">unsigned</a> <a href="#wave_id">wave_id</a>)</small></h3>
-This function transmits the waveform with id wave_id. The waveform
-cycles until cancelled (either by the sending of a new waveform or
-by <a href="#wave_tx_stop">wave_tx_stop</a>).
-<br><br>NOTE: Any hardware PWM started by <a href="#hardware_PWM">hardware_PWM</a> will be cancelled.
-<br><br><code>wave_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#wave_create">wave_create</a>.<br></code><br><br>Returns the number of DMA control blocks in the waveform if OK,
-otherwise PI_BAD_WAVE_ID, or PI_BAD_WAVE_MODE.
-<h3><a name="wave_chain"></a><a href="#int"><small>int</small></a> wave_chain<small>(<a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#bufSize">bufSize</a>)</small></h3>
-This function transmits a chain of waveforms.
-<br><br>NOTE: Any hardware PWM started by <a href="#hardware_PWM">hardware_PWM</a> will be cancelled.
-<br><br>The waves to be transmitted are specified by the contents of buf
-which contains an ordered list of <a href="#wave_id">wave_id</a>s and optional command
-codes and related data.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;pointer&nbsp;to&nbsp;the&nbsp;wave_ids&nbsp;and&nbsp;optional&nbsp;command&nbsp;codes<br>bufSize:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;in&nbsp;buf<br></code><br><br>Returns 0 if OK, otherwise PI_CHAIN_NESTING, PI_CHAIN_LOOP_CNT, PI_BAD_CHAIN_LOOP, PI_BAD_CHAIN_CMD, PI_CHAIN_COUNTER,
-PI_BAD_CHAIN_DELAY, PI_CHAIN_TOO_BIG, or PI_BAD_WAVE_ID.
-<br><br>Each wave is transmitted in the order specified. A wave may
-occur multiple times per chain.
-<br><br>A blocks of waves may be transmitted multiple times by using
-the loop commands. The block is bracketed by loop start and
-end commands. Loops may be nested.
-<br><br>Delays between waves may be added with the delay command.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>Loop Start</td><td>255 0</td><td>Identify start of a wave block</td></tr><tr><td>Loop Repeat</td><td>255 1 x y</td><td>loop x + y*256 times</td></tr><tr><td>Delay</td><td>255 2 x y</td><td>delay x + y*256 microseconds</td></tr><tr><td>Loop Forever</td><td>255 3</td><td>loop forever</td></tr></tbody></table><br><br>If present Loop Forever must be the last entry in the chain.
-<br><br>The code is currently dimensioned to support a chain with roughly
-600 entries and 20 loop counters.
-<br><br><b><small>Example</small></b><br><br><code>#include&nbsp;&lt;stdio.h&gt;<br>#include&nbsp;&lt;pigpiod_if.h&gt;<br><br>#define&nbsp;WAVES&nbsp;5<br>#define&nbsp;GPIO&nbsp;4<br><br>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;*argv[])<br>{<br>&nbsp;&nbsp;&nbsp;int&nbsp;i,&nbsp;wid[WAVES];<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(pigpio_start(0,&nbsp;0)&lt;0)&nbsp;return&nbsp;-1;<br><br>&nbsp;&nbsp;&nbsp;set_mode(GPIO,&nbsp;PI_OUTPUT);<br><br>&nbsp;&nbsp;&nbsp;for&nbsp;(i=0;&nbsp;i&lt;WAVES;&nbsp;i++)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wave_add_generic(2,&nbsp;(gpioPulse_t[])<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{1&lt;&lt;GPIO,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;20},<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{0,&nbsp;1&lt;&lt;GPIO,&nbsp;(i+1)*200}});<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[i]&nbsp;=&nbsp;wave_create();<br>&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;wave_chain((char&nbsp;[])&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[4],&nbsp;wid[3],&nbsp;wid[2],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;4+3+2<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[0],&nbsp;wid[0],&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;0+0+0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[1],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;0+1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;2,&nbsp;0x88,&nbsp;0x13,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;delay&nbsp;5000us<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;30,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;30&nbsp;times)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[2],&nbsp;wid[3],&nbsp;wid[0],&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;2+3+0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[3],&nbsp;wid[1],&nbsp;wid[2],&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;3+1+2<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;10,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;10&nbsp;times)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;5,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;5&nbsp;times)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[4],&nbsp;wid[4],&nbsp;wid[4],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;4+4+4<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;2,&nbsp;0x20,&nbsp;0x4E,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;delay&nbsp;20000us<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[0],&nbsp;wid[0],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;0+0+0<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},&nbsp;46);<br><br>&nbsp;&nbsp;&nbsp;while&nbsp;(wave_tx_busy())&nbsp;time_sleep(0.1);<br><br>&nbsp;&nbsp;&nbsp;for&nbsp;(i=0;&nbsp;i&lt;WAVES;&nbsp;i++)&nbsp;wave_delete(wid[i]);<br><br>&nbsp;&nbsp;&nbsp;pigpio_stop();<br>}<br></code><h3><a name="wave_tx_busy"></a><a href="#int"><small>int</small></a> wave_tx_busy<small>(void)</small></h3>
-This function checks to see if a waveform is currently being
-transmitted.
-<br><br>Returns 1 if a waveform is currently being transmitted, otherwise 0.
-<h3><a name="wave_tx_stop"></a><a href="#int"><small>int</small></a> wave_tx_stop<small>(void)</small></h3>
-This function stops the transmission of the current waveform.
-<br><br>Returns 0 if OK.
-<br><br>This function is intended to stop a waveform started with the repeat mode.
-<h3><a name="wave_get_micros"></a><a href="#int"><small>int</small></a> wave_get_micros<small>(void)</small></h3>
-This function returns the length in microseconds of the current
-waveform.
-<h3><a name="wave_get_high_micros"></a><a href="#int"><small>int</small></a> wave_get_high_micros<small>(void)</small></h3>
-This function returns the length in microseconds of the longest waveform
-created since the pigpio daemon was started.
-<h3><a name="wave_get_max_micros"></a><a href="#int"><small>int</small></a> wave_get_max_micros<small>(void)</small></h3>
-This function returns the maximum possible size of a waveform in<br>
-microseconds.
-<h3><a name="wave_get_pulses"></a><a href="#int"><small>int</small></a> wave_get_pulses<small>(void)</small></h3>
-This function returns the length in pulses of the current waveform.
-<h3><a name="wave_get_high_pulses"></a><a href="#int"><small>int</small></a> wave_get_high_pulses<small>(void)</small></h3>
-This function returns the length in pulses of the longest waveform
-created since the pigpio daemon was started.
-<h3><a name="wave_get_max_pulses"></a><a href="#int"><small>int</small></a> wave_get_max_pulses<small>(void)</small></h3>
-This function returns the maximum possible size of a waveform in pulses.
-<h3><a name="wave_get_cbs"></a><a href="#int"><small>int</small></a> wave_get_cbs<small>(void)</small></h3>
-This function returns the length in DMA control blocks of the current
-waveform.
-<h3><a name="wave_get_high_cbs"></a><a href="#int"><small>int</small></a> wave_get_high_cbs<small>(void)</small></h3>
-This function returns the length in DMA control blocks of the longest
-waveform created since the pigpio daemon was started.
-<h3><a name="wave_get_max_cbs"></a><a href="#int"><small>int</small></a> wave_get_max_cbs<small>(void)</small></h3>
-This function returns the maximum possible size of a waveform in DMA
-control blocks.
-<h3><a name="gpio_trigger"></a><a href="#int"><small>int</small></a> gpio_trigger<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#pulseLen">pulseLen</a>, <a href="#unsigned">unsigned</a> <a href="#level">level</a>)</small></h3>
-This function sends a trigger pulse to a GPIO. The GPIO is set to
-level for pulseLen microseconds and then reset to not level.
-<br><br><code>user_gpio:&nbsp;0-31.<br>&nbsp;pulseLen:&nbsp;1-100.<br>&nbsp;&nbsp;&nbsp;&nbsp;level:&nbsp;0,1.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_LEVEL,
-PI_BAD_PULSELEN, or PI_NOT_PERMITTED.
-<h3><a name="store_script"></a><a href="#int"><small>int</small></a> store_script<small>(<a href="#char">char</a> <a href="#*script">*script</a>)</small></h3>
-This function stores a script for later execution.
-<br><br>See <a href="http://abyz.me.uk/rpi/pigpio/pigs.html#Scripts">http://abyz.me.uk/rpi/pigpio/pigs.html#Scripts</a> for details.
-<br><br><code>script:&nbsp;the&nbsp;text&nbsp;of&nbsp;the&nbsp;script.<br></code><br><br>The function returns a script id if the script is valid,
-otherwise PI_BAD_SCRIPT.
-<h3><a name="run_script"></a><a href="#int"><small>int</small></a> run_script<small>(<a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>, <a href="#unsigned">unsigned</a> <a href="#numPar">numPar</a>, <a href="#uint32_t">uint32_t</a> <a href="#*param">*param</a>)</small></h3>
-This function runs a stored script.
-<br><br><code>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#store_script">store_script</a>.<br>&nbsp;&nbsp;&nbsp;numPar:&nbsp;0-10,&nbsp;the&nbsp;number&nbsp;of&nbsp;parameters.<br>&nbsp;&nbsp;&nbsp;&nbsp;param:&nbsp;an&nbsp;array&nbsp;of&nbsp;parameters.<br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID, or
-PI_TOO_MANY_PARAM
-<br><br>param is an array of up to 10 parameters which may be referenced in
-the script as p0 to p9.
-<h3><a name="script_status"></a><a href="#int"><small>int</small></a> script_status<small>(<a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>, <a href="#uint32_t">uint32_t</a> <a href="#*param">*param</a>)</small></h3>
-This function returns the run status of a stored script as well
-as the current values of parameters 0 to 9.
-<br><br><code>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#store_script">store_script</a>.<br>&nbsp;&nbsp;&nbsp;&nbsp;param:&nbsp;an&nbsp;array&nbsp;to&nbsp;hold&nbsp;the&nbsp;returned&nbsp;10&nbsp;parameters.<br></code><br><br>The function returns greater than or equal to 0 if OK,
-otherwise PI_BAD_SCRIPT_ID.
-<br><br>The run status may be
-<br><br><code>PI_SCRIPT_INITING<br>PI_SCRIPT_HALTED<br>PI_SCRIPT_RUNNING<br>PI_SCRIPT_WAITING<br>PI_SCRIPT_FAILED<br></code><br><br>The current value of script parameters 0 to 9 are returned in param.
-<h3><a name="stop_script"></a><a href="#int"><small>int</small></a> stop_script<small>(<a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>)</small></h3>
-This function stops a running script.
-<br><br><code>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#store_script">store_script</a>.<br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID.
-<h3><a name="delete_script"></a><a href="#int"><small>int</small></a> delete_script<small>(<a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>)</small></h3>
-This function deletes a stored script.
-<br><br><code>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#store_script">store_script</a>.<br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID.
-<h3><a name="bb_serial_read_open"></a><a href="#int"><small>int</small></a> bb_serial_read_open<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#data_bits">data_bits</a>)</small></h3>
-This function opens a GPIO for bit bang reading of serial data.
-<br><br><code>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;50-250000<br>data_bits:&nbsp;1-32<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_WAVE_BAUD,
-or PI_GPIO_IN_USE.
-<br><br>The serial data is returned in a cyclic buffer and is read using
-bb_serial_read.
-<br><br>It is the caller's responsibility to read data from the cyclic buffer
-in a timely fashion.
-<h3><a name="bb_serial_read"></a><a href="#int"><small>int</small></a> bb_serial_read<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#void">void</a> <a href="#*buf">*buf</a>, <a href="#size_t">size_t</a> <a href="#bufSize">bufSize</a>)</small></h3>
-This function copies up to bufSize bytes of data read from the
-bit bang serial cyclic buffer to the buffer starting at buf.
-<br><br><code>user_gpio:&nbsp;0-31,&nbsp;previously&nbsp;opened&nbsp;with&nbsp;<a href="#bb_serial_read_open">bb_serial_read_open</a>.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;bytes.<br>&nbsp;&nbsp;bufSize:&nbsp;&gt;=0<br></code><br><br>Returns the number of bytes copied if OK, otherwise PI_BAD_USER_GPIO
-or PI_NOT_SERIAL_GPIO.
-<br><br>The bytes returned for each character depend upon the number of
-data bits <a href="#data_bits">data_bits</a> specified in the <a href="#bb_serial_read_open">bb_serial_read_open</a> command.
-<br><br>For <a href="#data_bits">data_bits</a> 1-8 there will be one byte per character.<br>
-For <a href="#data_bits">data_bits</a> 9-16 there will be two bytes per character.<br>
-For <a href="#data_bits">data_bits</a> 17-32 there will be four bytes per character.
-<h3><a name="bb_serial_read_close"></a><a href="#int"><small>int</small></a> bb_serial_read_close<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-This function closes a GPIO for bit bang reading of serial data.
-<br><br><code>user_gpio:&nbsp;0-31,&nbsp;previously&nbsp;opened&nbsp;with&nbsp;<a href="#bb_serial_read_open">bb_serial_read_open</a>.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_SERIAL_GPIO.
-<h3><a name="bb_serial_invert"></a><a href="#int"><small>int</small></a> bb_serial_invert<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#invert">invert</a>)</small></h3>
-This function inverts serial logic for big bang serial reads.
-<br><br><code>user_gpio:&nbsp;0-31,&nbsp;previously&nbsp;opened&nbsp;with&nbsp;<a href="#bb_serial_read_open">bb_serial_read_open</a>.<br>&nbsp;&nbsp;&nbsp;invert:&nbsp;0-1,&nbsp;1&nbsp;invert,&nbsp;0&nbsp;normal.<br></code><br><br>Returns 0 if OK, otherwise PI_NOT_SERIAL_GPIO or PI_BAD_SER_INVERT.
-<h3><a name="i2c_open"></a><a href="#int"><small>int</small></a> i2c_open<small>(<a href="#unsigned">unsigned</a> <a href="#i2c_bus">i2c_bus</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_addr">i2c_addr</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_flags">i2c_flags</a>)</small></h3>
-This returns a handle for the device at address i2c_addr on bus i2c_bus.
-<br><br><code>&nbsp;&nbsp;i2c_bus:&nbsp;&gt;=0.<br>&nbsp;i2c_addr:&nbsp;0-0x7F.<br>i2c_flags:&nbsp;0.<br></code><br><br>No flags are currently defined. This parameter should be set to zero.
-<br><br>Physically buses 0 and 1 are available on the Pi. Higher numbered buses
-will be available if a kernel supported bus multiplexor is being used.
-<br><br>The GPIO used are given in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td></tr><tr><td>I2C 0</td><td>0</td><td>1</td></tr><tr><td>I2C 1</td><td>2</td><td>3</td></tr></tbody></table><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_BAD_I2C_BUS, PI_BAD_I2C_ADDR,
-PI_BAD_FLAGS, PI_NO_HANDLE, or PI_I2C_OPEN_FAILED.
-<br><br>For the SMBus commands the low level transactions are shown at the end
-of the function description. The following abbreviations are used.
-<br><br><code>S&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Start&nbsp;bit<br>P&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Stop&nbsp;bit<br>Rd/Wr&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Read/Write&nbsp;bit.&nbsp;Rd&nbsp;equals&nbsp;1,&nbsp;Wr&nbsp;equals&nbsp;0.<br>A,&nbsp;NA&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Accept&nbsp;and&nbsp;not&nbsp;accept&nbsp;bit.<br><br>Addr&nbsp;&nbsp;(7&nbsp;bits):&nbsp;I2C&nbsp;7&nbsp;bit&nbsp;address.<br>Comm&nbsp;&nbsp;(8&nbsp;bits):&nbsp;Command&nbsp;byte,&nbsp;a&nbsp;data&nbsp;byte&nbsp;which&nbsp;often&nbsp;selects&nbsp;a&nbsp;register.<br>Data&nbsp;&nbsp;(8&nbsp;bits):&nbsp;A&nbsp;data&nbsp;byte.<br>Count&nbsp;(8&nbsp;bits):&nbsp;A&nbsp;data&nbsp;byte&nbsp;containing&nbsp;the&nbsp;length&nbsp;of&nbsp;a&nbsp;block&nbsp;operation.<br><br>[..]:&nbsp;Data&nbsp;sent&nbsp;by&nbsp;the&nbsp;device.<br></code><h3><a name="i2c_close"></a><a href="#int"><small>int</small></a> i2c_close<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This closes the I2C device associated with the handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<h3><a name="i2c_write_quick"></a><a href="#int"><small>int</small></a> i2c_write_quick<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#bit">bit</a>)</small></h3>
-This sends a single bit (in the Rd/Wr bit) to the device associated
-with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>&nbsp;&nbsp;&nbsp;bit:&nbsp;0-1,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Quick command. SMBus 2.0 5.5.1
-<code>S&nbsp;Addr&nbsp;Rd/Wr&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_write_byte"></a><a href="#int"><small>int</small></a> i2c_write_byte<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#bVal">bVal</a>)</small></h3>
-This sends a single byte to the device associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>&nbsp;&nbsp;bVal:&nbsp;0-0xFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Send byte. SMBus 2.0 5.5.2
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;Data&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_read_byte"></a><a href="#int"><small>int</small></a> i2c_read_byte<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This reads a single byte from the device associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br></code><br><br>Returns the byte read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-or PI_I2C_READ_FAILED.
-<br><br>Receive byte. SMBus 2.0 5.5.3
-<code>S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_write_byte_data"></a><a href="#int"><small>int</small></a> i2c_write_byte_data<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#unsigned">unsigned</a> <a href="#bVal">bVal</a>)</small></h3>
-This writes a single byte to the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write.<br>&nbsp;&nbsp;&nbsp;bVal:&nbsp;0-0xFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Write byte. SMBus 2.0 5.5.4
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;Comm&nbsp;[A]&nbsp;Data&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_write_word_data"></a><a href="#int"><small>int</small></a> i2c_write_word_data<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#unsigned">unsigned</a> <a href="#wVal">wVal</a>)</small></h3>
-This writes a single 16 bit word to the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write.<br>&nbsp;&nbsp;&nbsp;wVal:&nbsp;0-0xFFFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Write word. SMBus 2.0 5.5.4
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;Comm&nbsp;[A]&nbsp;DataLow&nbsp;[A]&nbsp;DataHigh&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_read_byte_data"></a><a href="#int"><small>int</small></a> i2c_read_byte_data<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>)</small></h3>
-This reads a single byte from the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read.<br></code><br><br>Returns the byte read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Read byte. SMBus 2.0 5.5.5
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;Comm&nbsp;[A]&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_read_word_data"></a><a href="#int"><small>int</small></a> i2c_read_word_data<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>)</small></h3>
-This reads a single 16 bit word from the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read.<br></code><br><br>Returns the word read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Read word. SMBus 2.0 5.5.5
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;Comm&nbsp;[A]&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[DataLow]&nbsp;A&nbsp;[DataHigh]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_process_call"></a><a href="#int"><small>int</small></a> i2c_process_call<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#unsigned">unsigned</a> <a href="#wVal">wVal</a>)</small></h3>
-This writes 16 bits of data to the specified register of the device
-associated with handle and and reads 16 bits of data in return.
-<br><br><code>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write/read.<br>&nbsp;&nbsp;&nbsp;wVal:&nbsp;0-0xFFFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></code><br><br>Returns the word read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Process call. SMBus 2.0 5.5.6
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;Comm&nbsp;[A]&nbsp;DataLow&nbsp;[A]&nbsp;DataHigh&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[DataLow]&nbsp;A&nbsp;[DataHigh]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_write_block_data"></a><a href="#int"><small>int</small></a> i2c_write_block_data<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes up to 32 bytes to the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write.<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;with&nbsp;the&nbsp;data&nbsp;to&nbsp;send.<br>&nbsp;&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Block write. SMBus 2.0 5.5.7
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;Comm&nbsp;[A]&nbsp;Count&nbsp;[A]&nbsp;Data&nbsp;[A]&nbsp;Data&nbsp;[A]&nbsp;...&nbsp;[A]&nbsp;Data&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_read_block_data"></a><a href="#int"><small>int</small></a> i2c_read_block_data<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>)</small></h3>
-This reads a block of up to 32 bytes from the specified register of
-the device associated with handle.
-<br><br><code>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read.<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data.<br></code><br><br>The amount of returned data is set by the device.
-<br><br>Returns the number of bytes read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Block read. SMBus 2.0 5.5.7
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;Comm&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Count]&nbsp;A&nbsp;[Data]&nbsp;A&nbsp;[Data]&nbsp;A&nbsp;...&nbsp;A&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_block_process_call"></a><a href="#int"><small>int</small></a> i2c_block_process_call<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes data bytes to the specified register of the device
-associated with handle and reads a device specified number
-of bytes of data in return.
-<br><br><code>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write/read.<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;with&nbsp;the&nbsp;data&nbsp;to&nbsp;send&nbsp;and&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data.<br>&nbsp;&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns the number of bytes read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>The smbus 2.0 documentation states that a minimum of 1 byte may be
-sent and a minimum of 1 byte may be received. The total number of
-bytes sent/received must be 32 or less.
-<br><br>Block write-block read. SMBus 2.0 5.5.8
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;Comm&nbsp;[A]&nbsp;Count&nbsp;[A]&nbsp;Data&nbsp;[A]&nbsp;...<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Count]&nbsp;A&nbsp;[Data]&nbsp;...&nbsp;A&nbsp;P<br></code><h3><a name="i2c_read_i2c_block_data"></a><a href="#int"><small>int</small></a> i2c_read_i2c_block_data<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This reads count bytes from the specified register of the device
-associated with handle . The count may be 1-32.
-<br><br><code>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read.<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data.<br>&nbsp;&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></code><br><br>Returns the number of bytes read (&gt;0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br><code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;Comm&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Data]&nbsp;A&nbsp;[Data]&nbsp;A&nbsp;...&nbsp;A&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_write_i2c_block_data"></a><a href="#int"><small>int</small></a> i2c_write_i2c_block_data<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes 1 to 32 bytes to the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write.<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;data&nbsp;to&nbsp;write.<br>&nbsp;&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br><code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;Comm&nbsp;[A]&nbsp;Data&nbsp;[A]&nbsp;Data&nbsp;[A]&nbsp;...&nbsp;[A]&nbsp;Data&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_read_device"></a><a href="#int"><small>int</small></a> i2c_read_device<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This reads count bytes from the raw device into buf.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data&nbsp;bytes.<br>&nbsp;count:&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></code><br><br>Returns count (&gt;0) if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_READ_FAILED.
-<h3><a name="i2c_write_device"></a><a href="#int"><small>int</small></a> i2c_write_device<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes count bytes from buf to the raw device.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;containing&nbsp;the&nbsp;data&nbsp;bytes&nbsp;to&nbsp;write.<br>&nbsp;count:&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<h3><a name="i2c_zip"></a><a href="#int"><small>int</small></a> i2c_zip<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*inBuf">*inBuf</a>, <a href="#unsigned">unsigned</a> <a href="#inLen">inLen</a>, <a href="#char">char</a> <a href="#*outBuf">*outBuf</a>, <a href="#unsigned">unsigned</a> <a href="#outLen">outLen</a>)</small></h3>
-This function executes a sequence of I2C operations. The
-operations to be performed are specified by the contents of inBuf
-which contains the concatenated command codes and associated data.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>&nbsp;inBuf:&nbsp;pointer&nbsp;to&nbsp;the&nbsp;concatenated&nbsp;I2C&nbsp;commands,&nbsp;see&nbsp;below<br>&nbsp;inLen:&nbsp;size&nbsp;of&nbsp;command&nbsp;buffer<br>outBuf:&nbsp;pointer&nbsp;to&nbsp;buffer&nbsp;to&nbsp;hold&nbsp;returned&nbsp;data<br>outLen:&nbsp;size&nbsp;of&nbsp;output&nbsp;buffer<br></code><br><br>Returns &gt;= 0 if OK (the number of bytes read), otherwise
-PI_BAD_HANDLE, PI_BAD_POINTER, PI_BAD_I2C_CMD, PI_BAD_I2C_RLEN.
-PI_BAD_I2C_WLEN, or PI_BAD_I2C_SEG.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>End</td><td>0</td><td>No more commands</td></tr><tr><td>Escape</td><td>1</td><td>Next P is two bytes</td></tr><tr><td>On</td><td>2</td><td>Switch combined flag on</td></tr><tr><td>Off</td><td>3</td><td>Switch combined flag off</td></tr><tr><td>Address</td><td>4 P</td><td>Set I2C address to P</td></tr><tr><td>Flags</td><td>5 lsb msb</td><td>Set I2C flags to lsb + (msb &lt;&lt; 8)</td></tr><tr><td>Read</td><td>6 P</td><td>Read P bytes of data</td></tr><tr><td>Write</td><td>7 P ...</td><td>Write P bytes of data</td></tr></tbody></table><br><br>The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-<br><br>The address defaults to that associated with the handle.
-The flags default to 0. The address and flags maintain their
-previous value until updated.
-<br><br>The returned I2C data is stored in consecutive locations of outBuf.
-<br><br><b><small>Example</small></b><br><br><code>Set&nbsp;address&nbsp;0x53,&nbsp;write&nbsp;0x32,&nbsp;read&nbsp;6&nbsp;bytes<br>Set&nbsp;address&nbsp;0x1E,&nbsp;write&nbsp;0x03,&nbsp;read&nbsp;6&nbsp;bytes<br>Set&nbsp;address&nbsp;0x68,&nbsp;write&nbsp;0x1B,&nbsp;read&nbsp;8&nbsp;bytes<br>End<br><br>0x04&nbsp;0x53&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x32&nbsp;&nbsp;&nbsp;0x06&nbsp;0x06<br>0x04&nbsp;0x1E&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x03&nbsp;&nbsp;&nbsp;0x06&nbsp;0x06<br>0x04&nbsp;0x68&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x1B&nbsp;&nbsp;&nbsp;0x06&nbsp;0x08<br>0x00<br></code><h3><a name="bb_i2c_open"></a><a href="#int"><small>int</small></a> bb_i2c_open<small>(<a href="#unsigned">unsigned</a> <a href="#SDA">SDA</a>, <a href="#unsigned">unsigned</a> <a href="#SCL">SCL</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>)</small></h3>
-This function selects a pair of GPIO for bit banging I2C at a
-specified baud rate.
-<br><br>Bit banging I2C allows for certain operations which are not possible
-with the standard I2C driver.
-<br><br>o baud rates as low as 50<br>
-o repeated starts<br>
-o clock stretching<br>
-o I2C on any pair of spare GPIO
-<br><br><code>&nbsp;SDA:&nbsp;0-31<br>&nbsp;SCL:&nbsp;0-31<br>baud:&nbsp;50-500000<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_I2C_BAUD, or
-PI_GPIO_IN_USE.
-<br><br>NOTE:
-<br><br>The GPIO used for SDA and SCL must have pull-ups to 3V3 connected. As
-a guide the hardware pull-ups on pins 3 and 5 are 1k8 in value.
-<h3><a name="bb_i2c_close"></a><a href="#int"><small>int</small></a> bb_i2c_close<small>(<a href="#unsigned">unsigned</a> <a href="#SDA">SDA</a>)</small></h3>
-This function stops bit banging I2C on a pair of GPIO previously
-opened with <a href="#bb_i2c_open">bb_i2c_open</a>.
-<br><br><code>SDA:&nbsp;0-31,&nbsp;the&nbsp;SDA&nbsp;GPIO&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_i2c_open">bb_i2c_open</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_I2C_GPIO.
-<h3><a name="bb_i2c_zip"></a><a href="#int"><small>int</small></a> bb_i2c_zip<small>(<a href="#unsigned">unsigned</a> <a href="#SDA">SDA</a>, <a href="#char">char</a> <a href="#*inBuf">*inBuf</a>, <a href="#unsigned">unsigned</a> <a href="#inLen">inLen</a>, <a href="#char">char</a> <a href="#*outBuf">*outBuf</a>, <a href="#unsigned">unsigned</a> <a href="#outLen">outLen</a>)</small></h3>
-This function executes a sequence of bit banged I2C operations. The
-operations to be performed are specified by the contents of inBuf
-which contains the concatenated command codes and associated data.
-<br><br><code>&nbsp;&nbsp;&nbsp;SDA:&nbsp;0-31&nbsp;(as&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_i2c_open">bb_i2c_open</a>)<br>&nbsp;inBuf:&nbsp;pointer&nbsp;to&nbsp;the&nbsp;concatenated&nbsp;I2C&nbsp;commands,&nbsp;see&nbsp;below<br>&nbsp;inLen:&nbsp;size&nbsp;of&nbsp;command&nbsp;buffer<br>outBuf:&nbsp;pointer&nbsp;to&nbsp;buffer&nbsp;to&nbsp;hold&nbsp;returned&nbsp;data<br>outLen:&nbsp;size&nbsp;of&nbsp;output&nbsp;buffer<br></code><br><br>Returns &gt;= 0 if OK (the number of bytes read), otherwise
-PI_BAD_USER_GPIO, PI_NOT_I2C_GPIO, PI_BAD_POINTER,
-PI_BAD_I2C_CMD, PI_BAD_I2C_RLEN, PI_BAD_I2C_WLEN,
-PI_I2C_READ_FAILED, or PI_I2C_WRITE_FAILED.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>End</td><td>0</td><td>No more commands</td></tr><tr><td>Escape</td><td>1</td><td>Next P is two bytes</td></tr><tr><td>Start</td><td>2</td><td>Start condition</td></tr><tr><td>Stop</td><td>3</td><td>Stop condition</td></tr><tr><td>Address</td><td>4 P</td><td>Set I2C address to P</td></tr><tr><td>Flags</td><td>5 lsb msb</td><td>Set I2C flags to lsb + (msb &lt;&lt; 8)</td></tr><tr><td>Read</td><td>6 P</td><td>Read P bytes of data</td></tr><tr><td>Write</td><td>7 P ...</td><td>Write P bytes of data</td></tr></tbody></table><br><br>The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-<br><br>The address and flags default to 0. The address and flags maintain
-their previous value until updated.
-<br><br>No flags are currently defined.
-<br><br>The returned I2C data is stored in consecutive locations of outBuf.
-<br><br><b><small>Example</small></b><br><br><code>Set&nbsp;address&nbsp;0x53<br>start,&nbsp;write&nbsp;0x32,&nbsp;(re)start,&nbsp;read&nbsp;6&nbsp;bytes,&nbsp;stop<br>Set&nbsp;address&nbsp;0x1E<br>start,&nbsp;write&nbsp;0x03,&nbsp;(re)start,&nbsp;read&nbsp;6&nbsp;bytes,&nbsp;stop<br>Set&nbsp;address&nbsp;0x68<br>start,&nbsp;write&nbsp;0x1B,&nbsp;(re)start,&nbsp;read&nbsp;8&nbsp;bytes,&nbsp;stop<br>End<br><br>0x04&nbsp;0x53<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x32&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x06&nbsp;0x03<br><br>0x04&nbsp;0x1E<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x03&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x06&nbsp;0x03<br><br>0x04&nbsp;0x68<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x1B&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x08&nbsp;0x03<br><br>0x00<br></code><h3><a name="spi_open"></a><a href="#int"><small>int</small></a> spi_open<small>(<a href="#unsigned">unsigned</a> <a href="#spi_channel">spi_channel</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#spi_flags">spi_flags</a>)</small></h3>
-This function returns a handle for the SPI device on the channel.
-Data will be transferred at baud bits per second. The flags may
-be used to modify the default behaviour of 4-wire operation, mode 0,
-active low chip select.
-<br><br>The Pi has two SPI peripherals: main and auxiliary.
-<br><br>The main SPI has two chip selects (channels), the auxiliary has
-three.
-<br><br>The auxiliary SPI is available on all models but the A and B.
-<br><br>The GPIO used are given in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>MISO</td><td>MOSI</td><td>SCLK</td><td>CE0</td><td>CE1</td><td>CE2</td></tr><tr><td>Main SPI</td><td>9</td><td>10</td><td>11</td><td>8</td><td>7</td><td>-</td></tr><tr><td>Aux SPI</td><td>19</td><td>20</td><td>21</td><td>18</td><td>17</td><td>16</td></tr></tbody></table><br><br><code>spi_channel:&nbsp;0-1&nbsp;(0-2&nbsp;for&nbsp;the&nbsp;auxiliary&nbsp;SPI).<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;32K-125M&nbsp;(values&nbsp;above&nbsp;30M&nbsp;are&nbsp;unlikely&nbsp;to&nbsp;work).<br>&nbsp;&nbsp;spi_flags:&nbsp;see&nbsp;below.<br></code><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_BAD_SPI_CHANNEL,
-PI_BAD_SPI_SPEED, PI_BAD_FLAGS, PI_NO_AUX_SPI, or PI_SPI_OPEN_FAILED.
-<br><br>spi_flags consists of the least significant 22 bits.
-<br><br><code>21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;W&nbsp;&nbsp;A&nbsp;u2&nbsp;u1&nbsp;u0&nbsp;p2&nbsp;p1&nbsp;p0&nbsp;&nbsp;m&nbsp;&nbsp;m<br></code><br><br>mm defines the SPI mode.
-<br><br>Warning: modes 1 and 3 do not appear to work on the auxiliary SPI.
-<br><br><code>Mode&nbsp;POL&nbsp;PHA<br>&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;0<br>&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;1<br>&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;0<br>&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;1<br></code><br><br>px is 0 if CEx is active low (default) and 1 for active high.
-<br><br>ux is 0 if the CEx GPIO is reserved for SPI (default) and 1 otherwise.
-<br><br>A is 0 for the main SPI, 1 for the auxiliary SPI.
-<br><br>W is 0 if the device is not 3-wire, 1 if the device is 3-wire. Main
-SPI only.
-<br><br>nnnn defines the number of bytes (0-15) to write before switching
-the MOSI line to MISO to read data. This field is ignored
-if W is not set. Main SPI only.
-<br><br>T is 1 if the least significant bit is transmitted on MOSI first, the
-default (0) shifts the most significant bit out first. Auxiliary SPI
-only.
-<br><br>R is 1 if the least significant bit is received on MISO first, the
-default (0) receives the most significant bit first. Auxiliary SPI
-only.
-<br><br>bbbbbb defines the word size in bits (0-32). The default (0)
-sets 8 bits per word. Auxiliary SPI only.
-<br><br>The <a href="#spi_read">spi_read</a>, <a href="#spi_write">spi_write</a>, and <a href="#spi_xfer">spi_xfer</a> functions
-transfer data packed into 1, 2, or 4 bytes according to
-the word size in bits.
-<br><br>For bits 1-8 there will be one byte per word.<br>
-For bits 9-16 there will be two bytes per word.<br>
-For bits 17-32 there will be four bytes per word.
-<br><br>Multi-byte transfers are made in least significant byte first order.
-<br><br>E.g. to transfer 32 11-bit words buf should contain 64 bytes
-and count should be 64.
-<br><br>E.g. to transfer the 14 bit value 0x1ABC send the bytes 0xBC followed
-by 0x1A.
-<br><br>The other bits in flags should be set to zero.
-<h3><a name="spi_close"></a><a href="#int"><small>int</small></a> spi_close<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This functions closes the SPI device identified by the handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<h3><a name="spi_read"></a><a href="#int"><small>int</small></a> spi_read<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function reads count bytes of data from the SPI
-device associated with the handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data&nbsp;bytes.<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></code><br><br>Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-<h3><a name="spi_write"></a><a href="#int"><small>int</small></a> spi_write<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function writes count bytes of data from buf to the SPI
-device associated with the handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;data&nbsp;bytes&nbsp;to&nbsp;write.<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-<h3><a name="spi_xfer"></a><a href="#int"><small>int</small></a> spi_xfer<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*txBuf">*txBuf</a>, <a href="#char">char</a> <a href="#*rxBuf">*rxBuf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function transfers count bytes of data from txBuf to the SPI
-device associated with the handle. Simultaneously count bytes of
-data are read from the device and placed in rxBuf.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>.<br>&nbsp;txBuf:&nbsp;the&nbsp;data&nbsp;bytes&nbsp;to&nbsp;write.<br>&nbsp;rxBuf:&nbsp;the&nbsp;received&nbsp;data&nbsp;bytes.<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;transfer.<br></code><br><br>Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-<h3><a name="serial_open"></a><a href="#int"><small>int</small></a> serial_open<small>(<a href="#char">char</a> <a href="#*ser_tty">*ser_tty</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#ser_flags">ser_flags</a>)</small></h3>
-This function opens a serial device at a specified baud rate
-with specified flags. The device name must start with
-/dev/tty or /dev/serial.
-<br><br><code>&nbsp;&nbsp;ser_tty:&nbsp;the&nbsp;serial&nbsp;device&nbsp;to&nbsp;open.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;the&nbsp;baud&nbsp;rate&nbsp;in&nbsp;bits&nbsp;per&nbsp;second,&nbsp;see&nbsp;below.<br>ser_flags:&nbsp;0.<br></code><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_NO_HANDLE, or
-PI_SER_OPEN_FAILED.
-<br><br>The baud rate must be one of 50, 75, 110, 134, 150,
-200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
-38400, 57600, 115200, or 230400.
-<br><br>No flags are currently defined. This parameter should be set to zero.
-<h3><a name="serial_close"></a><a href="#int"><small>int</small></a> serial_close<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This function closes the serial device associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<h3><a name="serial_write_byte"></a><a href="#int"><small>int</small></a> serial_write_byte<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#bVal">bVal</a>)</small></h3>
-This function writes bVal to the serial port associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_SER_WRITE_FAILED.
-<h3><a name="serial_read_byte"></a><a href="#int"><small>int</small></a> serial_read_byte<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This function reads a byte from the serial port associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br></code><br><br>Returns the read byte (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_SER_READ_NO_DATA, or PI_SER_READ_FAILED.
-<br><br>If no data is ready PI_SER_READ_NO_DATA is returned.
-<h3><a name="serial_write"></a><a href="#int"><small>int</small></a> serial_write<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function writes count bytes from buf to the the serial port
-associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;array&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_SER_WRITE_FAILED.
-<h3><a name="serial_read"></a><a href="#int"><small>int</small></a> serial_read<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function reads up to count bytes from the the serial port
-associated with handle and writes them to buf.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data.<br>&nbsp;count:&nbsp;the&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></code><br><br>Returns the number of bytes read (&gt;0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, PI_SER_READ_NO_DATA, or PI_SER_WRITE_FAILED.
-<br><br>If no data is ready zero is returned.
-<h3><a name="serial_data_available"></a><a href="#int"><small>int</small></a> serial_data_available<small>(<a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-Returns the number of bytes available to be read from the
-device associated with handle.
-<br><br><code>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br></code><br><br>Returns the number of bytes of data available (&gt;=0) if OK,
-otherwise PI_BAD_HANDLE.
-<h3><a name="custom_1"></a><a href="#int"><small>int</small></a> custom_1<small>(<a href="#unsigned">unsigned</a> <a href="#arg1">arg1</a>, <a href="#unsigned">unsigned</a> <a href="#arg2">arg2</a>, <a href="#char">char</a> <a href="#*argx">*argx</a>, <a href="#unsigned">unsigned</a> <a href="#argc">argc</a>)</small></h3>
-This function is available for user customisation.
-<br><br>It returns a single integer value.
-<br><br><code>arg1:&nbsp;&gt;=0<br>arg2:&nbsp;&gt;=0<br>argx:&nbsp;extra&nbsp;(byte)&nbsp;arguments<br>argc:&nbsp;number&nbsp;of&nbsp;extra&nbsp;arguments<br></code><br><br>Returns &gt;= 0 if OK, less than 0 indicates a user defined error.
-<h3><a name="custom_2"></a><a href="#int"><small>int</small></a> custom_2<small>(<a href="#unsigned">unsigned</a> <a href="#arg1">arg1</a>, <a href="#char">char</a> <a href="#*argx">*argx</a>, <a href="#unsigned">unsigned</a> <a href="#argc">argc</a>, <a href="#char">char</a> <a href="#*retBuf">*retBuf</a>, <a href="#unsigned">unsigned</a> <a href="#retMax">retMax</a>)</small></h3>
-This function is available for user customisation.
-<br><br>It differs from custom_1 in that it returns an array of bytes
-rather than just an integer.
-<br><br>The return value is an integer indicating the number of returned bytes.
-<code>&nbsp;&nbsp;arg1:&nbsp;&gt;=0<br>&nbsp;&nbsp;argc:&nbsp;extra&nbsp;(byte)&nbsp;arguments<br>&nbsp;count:&nbsp;number&nbsp;of&nbsp;extra&nbsp;arguments<br>retBuf:&nbsp;buffer&nbsp;for&nbsp;returned&nbsp;data<br>retMax:&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;return<br></code><br><br>Returns &gt;= 0 if OK, less than 0 indicates a user defined error.
-<br><br>Note, the number of returned bytes will be retMax or less.
-<h3><a name="callback"></a><a href="#int"><small>int</small></a> callback<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#edge">edge</a>, <a href="#CBFunc_t">CBFunc_t</a> <a href="#f">f</a>)</small></h3>
-This function initialises a new callback.
-<br><br><code>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edge:&nbsp;RISING_EDGE,&nbsp;FALLING_EDGE,&nbsp;or&nbsp;EITHER_EDGE.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function.<br></code><br><br>The function returns a callback id if OK, otherwise pigif_bad_malloc,
-pigif_duplicate_callback, or pigif_bad_callback.
-<br><br>The callback is called with the GPIO, edge, and tick, whenever the
-GPIO has the identified edge.
-<br><br><code>Parameter&nbsp;&nbsp;&nbsp;Value&nbsp;&nbsp;&nbsp;&nbsp;Meaning<br><br>GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-31&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;GPIO&nbsp;which&nbsp;has&nbsp;changed&nbsp;state<br><br>edge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;=&nbsp;change&nbsp;to&nbsp;low&nbsp;(a&nbsp;falling&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&nbsp;change&nbsp;to&nbsp;high&nbsp;(a&nbsp;rising&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;=&nbsp;no&nbsp;level&nbsp;change&nbsp;(a&nbsp;watchdog&nbsp;timeout)<br><br>tick&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32&nbsp;bit&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;microseconds&nbsp;since&nbsp;boot<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WARNING:&nbsp;this&nbsp;wraps&nbsp;around&nbsp;from<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4294967295&nbsp;to&nbsp;0&nbsp;roughly&nbsp;every&nbsp;72&nbsp;minutes<br></code><h3><a name="callback_ex"></a><a href="#int"><small>int</small></a> callback_ex<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#edge">edge</a>, <a href="#CBFuncEx_t">CBFuncEx_t</a> <a href="#f">f</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-This function initialises a new callback.
-<br><br><code>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edge:&nbsp;RISING_EDGE,&nbsp;FALLING_EDGE,&nbsp;or&nbsp;EITHER_EDGE.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function.<br>&nbsp;userdata:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;arbitrary&nbsp;user&nbsp;data.<br></code><br><br>The function returns a callback id if OK, otherwise pigif_bad_malloc,
-pigif_duplicate_callback, or pigif_bad_callback.
-<br><br>The callback is called with the GPIO, edge, tick, and user, whenever
-the GPIO has the identified edge.
-<br><br><code>Parameter&nbsp;&nbsp;&nbsp;Value&nbsp;&nbsp;&nbsp;&nbsp;Meaning<br><br>GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-31&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;GPIO&nbsp;which&nbsp;has&nbsp;changed&nbsp;state<br><br>edge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;=&nbsp;change&nbsp;to&nbsp;low&nbsp;(a&nbsp;falling&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&nbsp;change&nbsp;to&nbsp;high&nbsp;(a&nbsp;rising&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;=&nbsp;no&nbsp;level&nbsp;change&nbsp;(a&nbsp;watchdog&nbsp;timeout)<br><br>tick&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32&nbsp;bit&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;microseconds&nbsp;since&nbsp;boot<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WARNING:&nbsp;this&nbsp;wraps&nbsp;around&nbsp;from<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4294967295&nbsp;to&nbsp;0&nbsp;roughly&nbsp;every&nbsp;72&nbsp;minutes<br><br>userdata&nbsp;&nbsp;&nbsp;&nbsp;pointer&nbsp;&nbsp;Pointer&nbsp;to&nbsp;an&nbsp;arbitrary&nbsp;object<br></code><h3><a name="callback_cancel"></a><a href="#int"><small>int</small></a> callback_cancel<small>(<a href="#unsigned">unsigned</a> <a href="#callback_id">callback_id</a>)</small></h3>
-This function cancels a callback identified by its id.
-<br><br><code>callback_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#callback">callback</a>&nbsp;or&nbsp;<a href="#callback_ex">callback_ex</a>.<br></code><br><br>The function returns 0 if OK, otherwise pigif_callback_not_found.
-<h3><a name="wait_for_edge"></a><a href="#int"><small>int</small></a> wait_for_edge<small>(<a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#edge">edge</a>, <a href="#double">double</a> <a href="#timeout">timeout</a>)</small></h3>
-This function waits for edge on the GPIO for up to timeout
-seconds.
-<br><br><code>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edge:&nbsp;RISING_EDGE,&nbsp;FALLING_EDGE,&nbsp;or&nbsp;EITHER_EDGE.<br>&nbsp;&nbsp;timeout:&nbsp;&gt;=0.<br></code><br><br>The function returns 1 if the edge occurred, otherwise 0.
-<br><br>The function returns when the edge occurs or after the timeout.
-<h2>PARAMETERS</h2><h3><a name="active">active</a>: 0-1000000</h3>
-The number of microseconds level changes are reported for once
-a noise filter has been triggered (by <a href="#steady">steady</a> microseconds of
-a stable level).
-<h3><a name="*addrStr">*addrStr</a></h3>
-A string specifying the host or IP address of the Pi running
-the pigpio daemon. It may be NULL in which case localhost
-is used unless overridden by the PIGPIO_ADDR environment
-variable.
-<h3><a name="arg1">arg1</a></h3>
-An unsigned argument passed to a user customised function. Its
-meaning is defined by the customiser.
-<h3><a name="arg2">arg2</a></h3>
-An unsigned argument passed to a user customised function. Its
-meaning is defined by the customiser.
-<h3><a name="argc">argc</a></h3>
-The count of bytes passed to a user customised function.
-<h3><a name="*argx">*argx</a></h3>
-A pointer to an array of bytes passed to a user customised function.
-Its meaning and content is defined by the customiser.
-<h3><a name="baud">baud</a></h3>
-The speed of serial communication (I2C, SPI, serial link, waves) in
-bits per second.
-<h3><a name="bit">bit</a></h3>
-A value of 0 or 1.
-<h3><a name="bits">bits</a></h3>
-A value used to select GPIO. If bit n of bits is set then GPIO n is
-selected.
-<br><br>A convenient way to set bit n is to or in (1&lt;&lt;n).
-<br><br>e.g. to select bits 5, 9, 23 you could use (1&lt;&lt;5) | (1&lt;&lt;9) | (1&lt;&lt;23).
-<h3><a name="*buf">*buf</a></h3>
-A buffer to hold data being sent or being received.
-<h3><a name="bufSize">bufSize</a></h3>
-The size in bytes of a buffer.
-<h3><a name="bVal">bVal</a>: 0-255 (Hex 0x0-0xFF, Octal 0-0377)</h3>
-An 8-bit byte value.
-<h3><a name="callback_id">callback_id</a></h3>
-A &gt;=0, as returned by a call to <a href="#callback">callback</a> or <a href="#callback_ex">callback_ex</a>. This is
-passed to <a href="#callback_cancel">callback_cancel</a> to cancel the callback.
-<h3><a name="CBFunc_t">CBFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*CBFunc_t)<br>&nbsp;&nbsp;&nbsp;(unsigned&nbsp;user_gpio,&nbsp;unsigned&nbsp;level,&nbsp;uint32_t&nbsp;tick);<br></code><h3><a name="CBFuncEx_t">CBFuncEx_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*CBFuncEx_t)<br>&nbsp;&nbsp;&nbsp;(unsigned&nbsp;user_gpio,&nbsp;unsigned&nbsp;level,&nbsp;uint32_t&nbsp;tick,&nbsp;void&nbsp;*&nbsp;user);<br></code><h3><a name="char">char</a></h3>
-A single character, an 8 bit quantity able to store 0-255.
-<h3><a name="clkfreq">clkfreq</a>: 4689-250000000 (250M)</h3>
-The hardware clock frequency.
-<h3><a name="count">count</a></h3>
-The number of bytes to be transferred in an I2C, SPI, or Serial
-command.
-<h3><a name="data_bits">data_bits</a>: 1-32</h3>
-The number of data bits in each character of serial data.
-<br><br><code>#define&nbsp;PI_MIN_WAVE_DATABITS&nbsp;1<br>#define&nbsp;PI_MAX_WAVE_DATABITS&nbsp;32<br></code><h3><a name="double">double</a></h3>
-A floating point number.
-<h3><a name="dutycycle">dutycycle</a>: 0-range</h3>
-A number representing the ratio of on time to off time for PWM.
-<br><br>The number may vary between 0 and range (default 255) where
-0 is off and range is fully on.
-<h3><a name="edge">edge</a></h3>
-Used to identify a GPIO level transition of interest. A rising edge is
-a level change from 0 to 1. A falling edge is a level change from 1 to 0.
-<br><br><code>RISING_EDGE&nbsp;&nbsp;0<br>FALLING_EDGE&nbsp;1<br>EITHER_EDGE.&nbsp;2<br></code><h3><a name="errnum">errnum</a></h3>
-A negative number indicating a function call failed and the nature
-of the error.
-<h3><a name="f">f</a></h3>
-A function.
-<h3><a name="frequency">frequency</a>: &gt;=0</h3>
-The number of times a GPIO is swiched on and off per second. This
-can be set per GPIO and may be as little as 5Hz or as much as
-40KHz. The GPIO will be on for a proportion of the time as defined
-by its dutycycle.
-<h3><a name="gpio">gpio</a></h3>
-A Broadcom numbered GPIO, in the range 0-53.
-<br><br>There are 54 General Purpose Input Outputs (GPIO) named gpio0 through
-gpio53.
-<br><br>They are split into two banks. Bank 1 consists of gpio0 through
-gpio31. Bank 2 consists of gpio32 through gpio53.
-<br><br>All the GPIO which are safe for the user to read and write are in
-bank 1. Not all GPIO in bank 1 are safe though. Type 1 boards
-have 17 safe GPIO. Type 2 boards have 21. Type 3 boards have 26.
-<br><br>See <a href="#get_hardware_revision">get_hardware_revision</a>.
-<br><br>The user GPIO are marked with an X in the following table.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;1&nbsp;&nbsp;2&nbsp;&nbsp;3&nbsp;&nbsp;4&nbsp;&nbsp;5&nbsp;&nbsp;6&nbsp;&nbsp;7&nbsp;&nbsp;8&nbsp;&nbsp;9&nbsp;10&nbsp;11&nbsp;12&nbsp;13&nbsp;14&nbsp;15<br>Type&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16&nbsp;17&nbsp;18&nbsp;19&nbsp;20&nbsp;21&nbsp;22&nbsp;23&nbsp;24&nbsp;25&nbsp;26&nbsp;27&nbsp;28&nbsp;29&nbsp;30&nbsp;31<br>Type&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-<br>Type&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-<br></code><h3><a name="gpioPulse_t">gpioPulse_t</a></h3>
-<code>typedef&nbsp;struct<br>{<br>uint32_t&nbsp;gpioOn;<br>uint32_t&nbsp;gpioOff;<br>uint32_t&nbsp;usDelay;<br>}&nbsp;gpioPulse_t;<br></code><h3><a name="gpioThreadFunc_t">gpioThreadFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;*(gpioThreadFunc_t)&nbsp;(void&nbsp;*);<br></code><h3><a name="handle">handle</a>: &gt;=0</h3>
-A number referencing an object opened by one of <a href="#i2c_open">i2c_open</a>, <a href="#notify_open">notify_open</a>,
-<a href="#serial_open">serial_open</a>, and <a href="#spi_open">spi_open</a>.
-<h3><a name="i2c_addr">i2c_addr</a>: 0-0x7F</h3>
-The address of a device on the I2C bus.
-<h3><a name="i2c_bus">i2c_bus</a>: &gt;=0</h3>
-An I2C bus number.
-<h3><a name="i2c_flags">i2c_flags</a>: 0</h3>
-Flags which modify an I2C open command. None are currently defined.
-<h3><a name="i2c_reg">i2c_reg</a>: 0-255</h3>
-A register of an I2C device.
-<h3><a name="*inBuf">*inBuf</a></h3>
-A buffer used to pass data to a function.
-<h3><a name="inLen">inLen</a></h3>
-The number of bytes of data in a buffer.
-<h3><a name="int">int</a></h3>
-A whole number, negative or positive.
-<h3><a name="invert">invert</a></h3>
-A flag used to set normal or inverted bit bang serial data level logic.
-<h3><a name="level">level</a></h3>
-The level of a GPIO. Low or High.
-<br><br><code>PI_OFF&nbsp;0<br>PI_ON&nbsp;1<br><br>PI_CLEAR&nbsp;0<br>PI_SET&nbsp;1<br><br>PI_LOW&nbsp;0<br>PI_HIGH&nbsp;1<br></code><br><br>There is one exception. If a watchdog expires on a GPIO the level will be
-reported as PI_TIMEOUT. See <a href="#set_watchdog">set_watchdog</a>.
-<br><br><code>PI_TIMEOUT&nbsp;2<br></code><h3><a name="mode">mode</a>: 0-7</h3>
-The operational mode of a GPIO, normally INPUT or OUTPUT.
-<br><br><code>PI_INPUT&nbsp;0<br>PI_OUTPUT&nbsp;1<br>PI_ALT0&nbsp;4<br>PI_ALT1&nbsp;5<br>PI_ALT2&nbsp;6<br>PI_ALT3&nbsp;7<br>PI_ALT4&nbsp;3<br>PI_ALT5&nbsp;2<br></code><h3><a name="numBytes">numBytes</a></h3>
-The number of bytes used to store characters in a string. Depending
-on the number of bits per character there may be 1, 2, or 4 bytes
-per character.
-<h3><a name="numPar">numPar</a>: 0-10</h3>
-The number of parameters passed to a script.
-<h3><a name="numPulses">numPulses</a></h3>
-The number of pulses to be added to a waveform.
-<h3><a name="offset">offset</a></h3>
-The associated data starts this number of microseconds from the start of
-the waveform.
-<h3><a name="*outBuf">*outBuf</a></h3>
-A buffer used to return data from a function.
-<h3><a name="outLen">outLen</a></h3>
-The size in bytes of an output buffer.
-<h3><a name="*param">*param</a></h3>
-An array of script parameters.
-<h3><a name="*portStr">*portStr</a></h3>
-A string specifying the port address used by the Pi running
-the pigpio daemon. It may be NULL in which case "8888"
-is used unless overridden by the PIGPIO_PORT environment
-variable.
-<h3><a name="*pth">*pth</a></h3>
-A thread identifier, returned by <a href="#start_thread">start_thread</a>.
-<h3><a name="pthread_t">pthread_t</a></h3>
-A thread identifier.
-<h3><a name="pud">pud</a>: 0-2</h3>
-The setting of the pull up/down resistor for a GPIO, which may be off,
-pull-up, or pull-down.
-<code>PI_PUD_OFF&nbsp;0<br>PI_PUD_DOWN&nbsp;1<br>PI_PUD_UP&nbsp;2<br></code><h3><a name="pulseLen">pulseLen</a></h3>
-1-100, the length of a trigger pulse in microseconds.
-<h3><a name="*pulses">*pulses</a></h3>
-An array of pulses to be added to a waveform.
-<h3><a name="pulsewidth">pulsewidth</a>: 0, 500-2500</h3>
-<code>PI_SERVO_OFF&nbsp;0<br>PI_MIN_SERVO_PULSEWIDTH&nbsp;500<br>PI_MAX_SERVO_PULSEWIDTH&nbsp;2500<br></code><h3><a name="PWMduty">PWMduty</a>: 0-1000000 (1M)</h3>
-The hardware PWM dutycycle.
-<br><br><code>#define&nbsp;PI_HW_PWM_RANGE&nbsp;1000000<br></code><h3><a name="PWMfreq">PWMfreq</a>: 1-125000000 (125M)</h3>
-The hardware PWM frequency.
-<br><br><code>#define&nbsp;PI_HW_PWM_MIN_FREQ&nbsp;1<br>#define&nbsp;PI_HW_PWM_MAX_FREQ&nbsp;125000000<br></code><h3><a name="range">range</a>: 25-40000</h3>
-The permissible dutycycle values are 0-range.
-<code>PI_MIN_DUTYCYCLE_RANGE&nbsp;25<br>PI_MAX_DUTYCYCLE_RANGE&nbsp;40000<br></code><h3><a name="*retBuf">*retBuf</a></h3>
-A buffer to hold a number of bytes returned to a used customised function,
-<h3><a name="retMax">retMax</a></h3>
-The maximum number of bytes a user customised function should return.
-<h3><a name="*rxBuf">*rxBuf</a></h3>
-A pointer to a buffer to receive data.
-<h3><a name="SCL">SCL</a></h3>
-The user GPIO to use for the clock when bit banging I2C.
-<h3><a name="*script">*script</a></h3>
-A pointer to the text of a script.
-<h3><a name="script_id">script_id</a></h3>
-An id of a stored script as returned by <a href="#store_script">store_script</a>.
-<h3><a name="SDA">SDA</a></h3>
-The user GPIO to use for data when bit banging I2C.
-<h3><a name="seconds">seconds</a></h3>
-The number of seconds.
-<h3><a name="ser_flags">ser_flags</a></h3>
-Flags which modify a serial open command. None are currently defined.
-<h3><a name="*ser_tty">*ser_tty</a></h3>
-The name of a serial tty device, e.g. /dev/ttyAMA0, /dev/ttyUSB0, /dev/tty1.
-<h3><a name="size_t">size_t</a></h3>
-A standard type used to indicate the size of an object in bytes.
-<h3><a name="spi_channel">spi_channel</a></h3>
-A SPI channel, 0-2.
-<h3><a name="spi_flags">spi_flags</a></h3>
-See <a href="#spi_open">spi_open</a>.
-<h3><a name="steady">steady</a>: 0-300000</h3>
-The number of microseconds level changes must be stable for
-before reporting the level changed (<a href="#set_glitch_filter">set_glitch_filter</a>) or triggering
-the active part of a noise filter (<a href="#set_noise_filter">set_noise_filter</a>).
-<h3><a name="stop_bits">stop_bits</a>: 2-8</h3>
-The number of (half) stop bits to be used when adding serial data
-to a waveform.
-<br><br><code>#define&nbsp;PI_MIN_WAVE_HALFSTOPBITS&nbsp;2<br>#define&nbsp;PI_MAX_WAVE_HALFSTOPBITS&nbsp;8<br></code><h3><a name="*str">*str</a></h3>
- An array of characters.
-<h3><a name="thread_func">thread_func</a></h3>
-A function of type gpioThreadFunc_t used as the main function of a
-thread.
-<h3><a name="timeout">timeout</a></h3>
-A GPIO watchdog timeout in milliseconds.
-<code>PI_MIN_WDOG_TIMEOUT&nbsp;0<br>PI_MAX_WDOG_TIMEOUT&nbsp;60000<br></code><h3><a name="*txBuf">*txBuf</a></h3>
-An array of bytes to transmit.
-<h3><a name="uint32_t">uint32_t</a>: 0-0-4,294,967,295 (Hex 0x0-0xFFFFFFFF)</h3>
-A 32-bit unsigned value.
-<h3><a name="unsigned">unsigned</a></h3>
-A whole number &gt;= 0.
-<h3><a name="user_gpio">user_gpio</a></h3>
-0-31, a Broadcom numbered GPIO.
-<br><br>See <a href="#gpio">gpio</a>.
-<h3><a name="*userdata">*userdata</a></h3>
-A pointer to arbitrary user data. This may be used to identify the instance.
-<h3><a name="void">void</a></h3>
-Denoting no parameter is required
-<h3><a name="wave_add_*">wave_add_*</a></h3>
-One of <a href="#wave_add_new">wave_add_new</a>, <a href="#wave_add_generic">wave_add_generic</a>, <a href="#wave_add_serial">wave_add_serial</a>.
-<h3><a name="wave_id">wave_id</a></h3>
-A number representing a waveform created by <a href="#wave_create">wave_create</a>.
-<h3><a name="wave_send_*">wave_send_*</a></h3>
-One of <a href="#wave_send_once">wave_send_once</a>, <a href="#wave_send_repeat">wave_send_repeat</a>.
-<h3><a name="wVal">wVal</a>: 0-65535 (Hex 0x0-0xFFFF, Octal 0-0177777)</h3>
-A 16-bit word value.
-<h2>pigpiod_if Error Codes</h2><code><br>typedef&nbsp;enum<br>{<br>&nbsp;&nbsp;&nbsp;pigif_bad_send&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2000,<br>&nbsp;&nbsp;&nbsp;pigif_bad_recv&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2001,<br>&nbsp;&nbsp;&nbsp;pigif_bad_getaddrinfo&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2002,<br>&nbsp;&nbsp;&nbsp;pigif_bad_connect&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2003,<br>&nbsp;&nbsp;&nbsp;pigif_bad_socket&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2004,<br>&nbsp;&nbsp;&nbsp;pigif_bad_noib&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2005,<br>&nbsp;&nbsp;&nbsp;pigif_duplicate_callback&nbsp;=&nbsp;-2006,<br>&nbsp;&nbsp;&nbsp;pigif_bad_malloc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2007,<br>&nbsp;&nbsp;&nbsp;pigif_bad_callback&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2008,<br>&nbsp;&nbsp;&nbsp;pigif_notify_failed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2009,<br>&nbsp;&nbsp;&nbsp;pigif_callback_not_found&nbsp;=&nbsp;-2010,<br>}&nbsp;pigifError_t;<br><br></code> \ No newline at end of file
diff --git a/DOC/tmp/body/pdif2.body b/DOC/tmp/body/pdif2.body
deleted file mode 100644
index 21d2b4b..0000000
--- a/DOC/tmp/body/pdif2.body
+++ /dev/null
@@ -1,1460 +0,0 @@
-<br><br>pigpiod_if2 is a C library for the Raspberry which allows control
-of the GPIO via the socket interface to the pigpio daemon.<br>
-<h3>Features</h3>o hardware timed PWM on any of GPIO 0-31
-<br><br>o hardware timed servo pulses on any of GPIO 0-31
-<br><br>o callbacks when any of GPIO 0-31 change state
-<br><br>o callbacks at timed intervals
-<br><br>o reading/writing all of the GPIO in a bank as one operation
-<br><br>o individually setting GPIO modes, reading and writing
-<br><br>o notifications when any of GPIO 0-31 change state
-<br><br>o the construction of output waveforms with microsecond timing
-<br><br>o rudimentary permission control over GPIO
-<br><br>o a simple interface to start and stop new threads
-<br><br>o I2C, SPI, and serial link wrappers
-<br><br>o creating and running scripts on the pigpio daemon
-<h3>GPIO</h3>ALL GPIO are identified by their Broadcom number.
-<h3>Notes</h3>The PWM and servo pulses are timed using the DMA and PWM/PCM peripherals.
-<h3>Usage</h3>Include &lt;pigpiod_if2.h&gt; in your source files.
-<br><br>Assuming your source is in prog.c use the following command to build
-<br><br><code>gcc&nbsp;-Wall&nbsp;-pthread&nbsp;-o&nbsp;prog&nbsp;prog.c&nbsp;-lpigpiod_if2&nbsp;-lrt<br></code><br><br>to run make sure the pigpio daemon is running
-<br><br><code>sudo&nbsp;pigpiod<br><br>&nbsp;./prog&nbsp;#&nbsp;sudo&nbsp;is&nbsp;not&nbsp;required&nbsp;to&nbsp;run&nbsp;programs&nbsp;linked&nbsp;to&nbsp;pigpiod_if2<br></code><br><br>For examples see x_pigpiod_if2.c within the pigpio archive file.
-<h3>Notes</h3>All the functions which return an int return &lt; 0 on error
-<h2>OVERVIEW</h2><table border="0" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td></td></tr><tr><td><b>ESSENTIAL
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#pigpio_start">pigpio_start</a></td><td> Connects to a pigpio daemon
-</td></tr><tr><td><a href="#pigpio_stop">pigpio_stop</a></td><td> Disconnects from a pigpio daemon
-</td></tr><tr><td></td><td></td></tr><tr><td><b>BASIC
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_mode">set_mode</a></td><td> Set a GPIO mode
-</td></tr><tr><td><a href="#get_mode">get_mode</a></td><td> Get a GPIO mode
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_pull_up_down">set_pull_up_down</a></td><td> Set/clear GPIO pull up/down resistor
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpio_read">gpio_read</a></td><td> Read a GPIO
-</td></tr><tr><td><a href="#gpio_write">gpio_write</a></td><td> Write a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>PWM (overrides servo commands on same GPIO)
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_PWM_dutycycle">set_PWM_dutycycle</a></td><td> Start/stop PWM pulses on a GPIO
-</td></tr><tr><td><a href="#set_PWM_frequency">set_PWM_frequency</a></td><td> Configure PWM frequency for a GPIO
-</td></tr><tr><td><a href="#set_PWM_range">set_PWM_range</a></td><td> Configure PWM range for a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_PWM_dutycycle">get_PWM_dutycycle</a></td><td> Get the PWM dutycycle in use on a GPIO
-</td></tr><tr><td><a href="#get_PWM_frequency">get_PWM_frequency</a></td><td> Get configured PWM frequency for a GPIO
-</td></tr><tr><td><a href="#get_PWM_range">get_PWM_range</a></td><td> Get configured PWM range for a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_PWM_real_range">get_PWM_real_range</a></td><td> Get underlying PWM range for a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Servo (overrides PWM commands on same GPIO)
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_servo_pulsewidth">set_servo_pulsewidth</a></td><td> Start/stop servo pulses on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_servo_pulsewidth">get_servo_pulsewidth</a></td><td> Get the servo pulsewidth in use on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>INTERMEDIATE
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpio_trigger">gpio_trigger</a></td><td> Send a trigger pulse to a GPIO.
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_watchdog">set_watchdog</a></td><td> Set a watchdog on a GPIO.
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#read_bank_1">read_bank_1</a></td><td> Read all GPIO in bank 1
-</td></tr><tr><td><a href="#read_bank_2">read_bank_2</a></td><td> Read all GPIO in bank 2
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#clear_bank_1">clear_bank_1</a></td><td> Clear selected GPIO in bank 1
-</td></tr><tr><td><a href="#clear_bank_2">clear_bank_2</a></td><td> Clear selected GPIO in bank 2
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_bank_1">set_bank_1</a></td><td> Set selected GPIO in bank 1
-</td></tr><tr><td><a href="#set_bank_2">set_bank_2</a></td><td> Set selected GPIO in bank 2
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#callback">callback</a></td><td> Create GPIO level change callback
-</td></tr><tr><td><a href="#callback_ex">callback_ex</a></td><td> Create GPIO level change callback, extended
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#callback_cancel">callback_cancel</a></td><td> Cancel a callback
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wait_for_edge">wait_for_edge</a></td><td> Wait for GPIO level change
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#start_thread">start_thread</a></td><td> Start a new thread
-</td></tr><tr><td><a href="#stop_thread">stop_thread</a></td><td> Stop a previously started thread
-</td></tr><tr><td></td><td></td></tr><tr><td><b>ADVANCED
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#notify_open">notify_open</a></td><td> Request a notification handle
-</td></tr><tr><td><a href="#notify_begin">notify_begin</a></td><td> Start notifications for selected GPIO
-</td></tr><tr><td><a href="#notify_pause">notify_pause</a></td><td> Pause notifications
-</td></tr><tr><td><a href="#notify_close">notify_close</a></td><td> Close a notification
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#hardware_clock">hardware_clock</a></td><td> Start hardware clock on supported GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#hardware_PWM">hardware_PWM</a></td><td> Start hardware PWM on supported GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_glitch_filter">set_glitch_filter</a></td><td> Set a glitch filter on a GPIO
-</td></tr><tr><td><a href="#set_noise_filter">set_noise_filter</a></td><td> Set a noise filter on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_pad_strength">set_pad_strength</a></td><td> Sets a pads drive strength
-</td></tr><tr><td><a href="#get_pad_strength">get_pad_strength</a></td><td> Gets a pads drive strength
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#shell_">shell_</a></td><td> Executes a shell command
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Custom
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#custom_1">custom_1</a></td><td> User custom function 1
-</td></tr><tr><td><a href="#custom_2">custom_2</a></td><td> User custom function 2
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Events
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#event_callback">event_callback</a></td><td> Sets a callback for an event
-</td></tr><tr><td><a href="#event_callback_ex">event_callback_ex</a></td><td> Sets a callback for an event, extended
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#event_callback_cancel">event_callback_cancel</a></td><td> Cancel an event callback
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#event_trigger">event_trigger</a></td><td> Triggers an event
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wait_for_event">wait_for_event</a></td><td> Wait for an event
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Scripts
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#store_script">store_script</a></td><td> Store a script
-</td></tr><tr><td><a href="#run_script">run_script</a></td><td> Run a stored script
-</td></tr><tr><td><a href="#update_script">update_script</a></td><td> Set a scripts parameters
-</td></tr><tr><td><a href="#script_status">script_status</a></td><td> Get script status and parameters
-</td></tr><tr><td><a href="#stop_script">stop_script</a></td><td> Stop a running script
-</td></tr><tr><td><a href="#delete_script">delete_script</a></td><td> Delete a stored script
-</td></tr><tr><td></td><td></td></tr><tr><td><b>I2C
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_open">i2c_open</a></td><td> Opens an I2C device
-</td></tr><tr><td><a href="#i2c_close">i2c_close</a></td><td> Closes an I2C device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_write_quick">i2c_write_quick</a></td><td> smbus write quick
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_byte">i2c_read_byte</a></td><td> smbus read byte
-</td></tr><tr><td><a href="#i2c_write_byte">i2c_write_byte</a></td><td> smbus write byte
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_byte_data">i2c_read_byte_data</a></td><td> smbus read byte data
-</td></tr><tr><td><a href="#i2c_write_byte_data">i2c_write_byte_data</a></td><td> smbus write byte data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_word_data">i2c_read_word_data</a></td><td> smbus read word data
-</td></tr><tr><td><a href="#i2c_write_word_data">i2c_write_word_data</a></td><td> smbus write word data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_block_data">i2c_read_block_data</a></td><td> smbus read block data
-</td></tr><tr><td><a href="#i2c_write_block_data">i2c_write_block_data</a></td><td> smbus write block data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_i2c_block_data">i2c_read_i2c_block_data</a></td><td> smbus read I2C block data
-</td></tr><tr><td><a href="#i2c_write_i2c_block_data">i2c_write_i2c_block_data</a></td><td> smbus write I2C block data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_device">i2c_read_device</a></td><td> Reads the raw I2C device
-</td></tr><tr><td><a href="#i2c_write_device">i2c_write_device</a></td><td> Writes the raw I2C device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_process_call">i2c_process_call</a></td><td> smbus process call
-</td></tr><tr><td><a href="#i2c_block_process_call">i2c_block_process_call</a></td><td> smbus block process call
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_zip">i2c_zip</a></td><td> Performs multiple I2C transactions
-</td></tr><tr><td></td><td></td></tr><tr><td><b>I2C BIT BANG
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_i2c_open">bb_i2c_open</a></td><td> Opens GPIO for bit banging I2C
-</td></tr><tr><td><a href="#bb_i2c_close">bb_i2c_close</a></td><td> Closes GPIO for bit banging I2C
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_i2c_zip">bb_i2c_zip</a></td><td> Performs bit banged I2C transactions
-</td></tr><tr><td></td><td></td></tr><tr><td><b>I2C/SPI SLAVE
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#bsc_xfer">bsc_xfer</a></td><td> I2C/SPI as slave transfer
-</td></tr><tr><td><a href="#bsc_i2c">bsc_i2c</a></td><td> I2C as slave transfer
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SERIAL
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#serial_open">serial_open</a></td><td> Opens a serial device
-</td></tr><tr><td><a href="#serial_close">serial_close</a></td><td> Closes a serial device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#serial_read_byte">serial_read_byte</a></td><td> Reads a byte from a serial device
-</td></tr><tr><td><a href="#serial_write_byte">serial_write_byte</a></td><td> Writes a byte to a serial device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#serial_read">serial_read</a></td><td> Reads bytes from a serial device
-</td></tr><tr><td><a href="#serial_write">serial_write</a></td><td> Writes bytes to a serial device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#serial_data_available">serial_data_available</a></td><td> Returns number of bytes ready to be read
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SERIAL BIT BANG (read only)
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_serial_read_open">bb_serial_read_open</a></td><td> Opens a GPIO for bit bang serial reads
-</td></tr><tr><td><a href="#bb_serial_read_close">bb_serial_read_close</a></td><td> Closes a GPIO for bit bang serial reads
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_serial_invert">bb_serial_invert</a></td><td> Invert serial logic (1 invert, 0 normal)
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_serial_read">bb_serial_read</a></td><td> Reads bit bang serial data from a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SPI
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#spi_open">spi_open</a></td><td> Opens a SPI device
-</td></tr><tr><td><a href="#spi_close">spi_close</a></td><td> Closes a SPI device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#spi_read">spi_read</a></td><td> Reads bytes from a SPI device
-</td></tr><tr><td><a href="#spi_write">spi_write</a></td><td> Writes bytes to a SPI device
-</td></tr><tr><td><a href="#spi_xfer">spi_xfer</a></td><td> Transfers bytes with a SPI device
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SPI BIT BANG
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_spi_open">bb_spi_open</a></td><td> Opens GPIO for bit banging SPI
-</td></tr><tr><td><a href="#bb_spi_close">bb_spi_close</a></td><td> Closes GPIO for bit banging SPI
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_spi_xfer">bb_spi_xfer</a></td><td> Transfers bytes with bit banging SPI
-</td></tr><tr><td></td><td></td></tr><tr><td><b>FILES
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#file_open">file_open</a></td><td> Opens a file
-</td></tr><tr><td><a href="#file_close">file_close</a></td><td> Closes a file
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#file_read">file_read</a></td><td> Reads bytes from a file
-</td></tr><tr><td><a href="#file_write">file_write</a></td><td> Writes bytes to a file
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#file_seek">file_seek</a></td><td> Seeks to a position within a file
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#file_list">file_list</a></td><td> List files which match a pattern
-</td></tr><tr><td></td><td></td></tr><tr><td><b>WAVES
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_clear">wave_clear</a></td><td> Deletes all waveforms
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_add_new">wave_add_new</a></td><td> Starts a new waveform
-</td></tr><tr><td><a href="#wave_add_generic">wave_add_generic</a></td><td> Adds a series of pulses to the waveform
-</td></tr><tr><td><a href="#wave_add_serial">wave_add_serial</a></td><td> Adds serial data to the waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_create">wave_create</a></td><td> Creates a waveform from added data
-</td></tr><tr><td><a href="#wave_create_and_pad">wave_create_and_pad</a></td><td> Creates a waveform of fixed size from added data
-</td></tr><tr><td><a href="#wave_delete">wave_delete</a></td><td> Deletes one or more waveforms
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_send_once">wave_send_once</a></td><td> Transmits a waveform once
-</td></tr><tr><td><a href="#wave_send_repeat">wave_send_repeat</a></td><td> Transmits a waveform repeatedly
-</td></tr><tr><td><a href="#wave_send_using_mode">wave_send_using_mode</a></td><td> Transmits a waveform in the chosen mode
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_chain">wave_chain</a></td><td> Transmits a chain of waveforms
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_tx_at">wave_tx_at</a></td><td> Returns the current transmitting waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_tx_busy">wave_tx_busy</a></td><td> Checks to see if the waveform has ended
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_tx_stop">wave_tx_stop</a></td><td> Aborts the current waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_get_cbs">wave_get_cbs</a></td><td> Length in cbs of the current waveform
-</td></tr><tr><td><a href="#wave_get_high_cbs">wave_get_high_cbs</a></td><td> Length of longest waveform so far
-</td></tr><tr><td><a href="#wave_get_max_cbs">wave_get_max_cbs</a></td><td> Absolute maximum allowed cbs
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_get_micros">wave_get_micros</a></td><td> Length in micros of the current waveform
-</td></tr><tr><td><a href="#wave_get_high_micros">wave_get_high_micros</a></td><td> Length of longest waveform so far
-</td></tr><tr><td><a href="#wave_get_max_micros">wave_get_max_micros</a></td><td> Absolute maximum allowed micros
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_get_pulses">wave_get_pulses</a></td><td> Length in pulses of the current waveform
-</td></tr><tr><td><a href="#wave_get_high_pulses">wave_get_high_pulses</a></td><td> Length of longest waveform so far
-</td></tr><tr><td><a href="#wave_get_max_pulses">wave_get_max_pulses</a></td><td> Absolute maximum allowed pulses
-</td></tr><tr><td></td><td></td></tr><tr><td><b>UTILITIES
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_current_tick">get_current_tick</a></td><td> Get current tick (microseconds)
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_hardware_revision">get_hardware_revision</a></td><td> Get hardware revision
-</td></tr><tr><td><a href="#get_pigpio_version">get_pigpio_version</a></td><td> Get the pigpio version
-</td></tr><tr><td><a href="#pigpiod_if_version">pigpiod_if_version</a></td><td> Get the pigpiod_if2 version
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#pigpio_error">pigpio_error</a></td><td> Get a text description of an error code.
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#time_sleep">time_sleep</a></td><td> Sleeps for a float number of seconds
-</td></tr><tr><td><a href="#time_time">time_time</a></td><td> Float number of seconds since the epoch
-</td></tr><tr><td></td><td></td></tr></tbody></table><h2>FUNCTIONS</h2><h3><a name="time_time"></a><a href="#double"><small>double</small></a> time_time<small>(void)</small></h3>
-Return the current time in seconds since the Epoch.
-<h3><a name="time_sleep"></a><a href="#void"><small>void</small></a> time_sleep<small>(<a href="#double">double</a> <a href="#seconds">seconds</a>)</small></h3>
-Delay execution for a given number of seconds.
-<br><br><code>seconds:&nbsp;the&nbsp;number&nbsp;of&nbsp;seconds&nbsp;to&nbsp;delay.<br></code><h3><a name="pigpio_error"></a><a href="#char"><small>char</small></a> *pigpio_error<small>(<a href="#int">int</a> <a href="#errnum">errnum</a>)</small></h3>
-Return a text description for an error code.
-<br><br><code>errnum:&nbsp;the&nbsp;error&nbsp;code.<br></code><h3><a name="pigpiod_if_version"></a><a href="#unsigned"><small>unsigned</small></a> pigpiod_if_version<small>(void)</small></h3>
-Return the pigpiod_if2 version.
-<h3><a name="start_thread"></a><a href="#pthread_t"><small>pthread_t</small></a> *start_thread<small>(<a href="#gpioThreadFunc_t">gpioThreadFunc_t</a> <a href="#thread_func">thread_func</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-Starts a new thread of execution with thread_func as the main routine.
-<br><br><code>thread_func:&nbsp;the&nbsp;main&nbsp;function&nbsp;for&nbsp;the&nbsp;new&nbsp;thread.<br>&nbsp;&nbsp;&nbsp;userdata:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;an&nbsp;arbitrary&nbsp;argument.<br></code><br><br>Returns a pointer to pthread_t if OK, otherwise NULL.
-<br><br>The function is passed the single argument userdata.
-<br><br>The thread can be cancelled by passing the pointer to pthread_t to
-<a href="#stop_thread">stop_thread</a>.
-<h3><a name="stop_thread"></a><a href="#void"><small>void</small></a> stop_thread<small>(<a href="#pthread_t">pthread_t</a> <a href="#*pth">*pth</a>)</small></h3>
-Cancels the thread pointed at by pth.
-<br><br><code>pth:&nbsp;the&nbsp;thread&nbsp;to&nbsp;be&nbsp;stopped.<br></code><br><br>No value is returned.
-<br><br>The thread to be stopped should have been started with <a href="#start_thread">start_thread</a>.
-<h3><a name="pigpio_start"></a><a href="#int"><small>int</small></a> pigpio_start<small>(<a href="#char">char</a> <a href="#*addrStr">*addrStr</a>, <a href="#char">char</a> <a href="#*portStr">*portStr</a>)</small></h3>
-Connect to the pigpio daemon. Reserving command and
-notification streams.
-<br><br><code>addrStr:&nbsp;specifies&nbsp;the&nbsp;host&nbsp;or&nbsp;IP&nbsp;address&nbsp;of&nbsp;the&nbsp;Pi&nbsp;running&nbsp;the<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pigpio&nbsp;daemon.&nbsp;&nbsp;It&nbsp;may&nbsp;be&nbsp;NULL&nbsp;in&nbsp;which&nbsp;case&nbsp;localhost<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is&nbsp;used&nbsp;unless&nbsp;overridden&nbsp;by&nbsp;the&nbsp;PIGPIO_ADDR&nbsp;environment<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;variable.<br><br>portStr:&nbsp;specifies&nbsp;the&nbsp;port&nbsp;address&nbsp;used&nbsp;by&nbsp;the&nbsp;Pi&nbsp;running&nbsp;the<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pigpio&nbsp;daemon.&nbsp;&nbsp;It&nbsp;may&nbsp;be&nbsp;NULL&nbsp;in&nbsp;which&nbsp;case&nbsp;"8888"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is&nbsp;used&nbsp;unless&nbsp;overridden&nbsp;by&nbsp;the&nbsp;PIGPIO_PORT&nbsp;environment<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;variable.<br></code><br><br>Returns an integer value greater than or equal to zero if OK.
-<br><br>This value is passed to the GPIO routines to specify the Pi
-to be operated on.
-<h3><a name="pigpio_stop"></a><a href="#void"><small>void</small></a> pigpio_stop<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-Terminates the connection to a pigpio daemon and releases
-resources used by the library.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><h3><a name="set_mode"></a><a href="#int"><small>int</small></a> set_mode<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#mode">mode</a>)</small></h3>
-Set the GPIO mode.
-<br><br><code>&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>gpio:&nbsp;0-53.<br>mode:&nbsp;PI_INPUT,&nbsp;PI_OUTPUT,&nbsp;PI_ALT0,&nbsp;PI_ALT1,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PI_ALT2,&nbsp;PI_ALT3,&nbsp;PI_ALT4,&nbsp;PI_ALT5.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_MODE,
-or PI_NOT_PERMITTED.
-<h3><a name="get_mode"></a><a href="#int"><small>int</small></a> get_mode<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>)</small></h3>
-Get the GPIO mode.
-<br><br><code>&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>gpio:&nbsp;0-53.<br></code><br><br>Returns the GPIO mode if OK, otherwise PI_BAD_GPIO.
-<h3><a name="set_pull_up_down"></a><a href="#int"><small>int</small></a> set_pull_up_down<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#pud">pud</a>)</small></h3>
-Set or clear the GPIO pull-up/down resistor.
-<br><br><code>&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>gpio:&nbsp;0-53.<br>&nbsp;pud:&nbsp;PI_PUD_UP,&nbsp;PI_PUD_DOWN,&nbsp;PI_PUD_OFF.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_PUD,
-or PI_NOT_PERMITTED.
-<h3><a name="gpio_read"></a><a href="#int"><small>int</small></a> gpio_read<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>)</small></h3>
-Read the GPIO level.
-<br><br><code>&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>gpio:0-53.<br></code><br><br>Returns the GPIO level if OK, otherwise PI_BAD_GPIO.
-<h3><a name="gpio_write"></a><a href="#int"><small>int</small></a> gpio_write<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#level">level</a>)</small></h3>
-Write the GPIO level.
-<br><br><code>&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;gpio:&nbsp;0-53.<br>level:&nbsp;0,&nbsp;1.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_GPIO, PI_BAD_LEVEL,
-or PI_NOT_PERMITTED.
-<br><br>Notes
-<br><br>If PWM or servo pulses are active on the GPIO they are switched off.
-<h3><a name="set_PWM_dutycycle"></a><a href="#int"><small>int</small></a> set_PWM_dutycycle<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#dutycycle">dutycycle</a>)</small></h3>
-Start (non-zero dutycycle) or stop (0) PWM pulses on the GPIO.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br>dutycycle:&nbsp;0-range&nbsp;(range&nbsp;defaults&nbsp;to&nbsp;255).<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_DUTYCYCLE,
-or PI_NOT_PERMITTED.
-Notes
-<br><br>The <a href="#set_PWM_range">set_PWM_range</a> function may be used to change the
-default range of 255.
-<h3><a name="get_PWM_dutycycle"></a><a href="#int"><small>int</small></a> get_PWM_dutycycle<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Return the PWM dutycycle in use on a GPIO.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_NOT_PWM_GPIO.
-<br><br>For normal PWM the dutycycle will be out of the defined range
-for the GPIO (see <a href="#get_PWM_range">get_PWM_range</a>).
-<br><br>If a hardware clock is active on the GPIO the reported dutycycle
-will be 500000 (500k) out of 1000000 (1M).
-<br><br>If hardware PWM is active on the GPIO the reported dutycycle
-will be out of a 1000000 (1M).
-<h3><a name="set_PWM_range"></a><a href="#int"><small>int</small></a> set_PWM_range<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#range">range</a>)</small></h3>
-Set the range of PWM values to be used on the GPIO.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;range:&nbsp;25-40000.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_DUTYRANGE,
-or PI_NOT_PERMITTED.
-<br><br>Notes
-<br><br>If PWM is currently active on the GPIO its dutycycle will be
-scaled to reflect the new range.
-<br><br>The real range, the number of steps between fully off and fully on
-for each of the 18 available GPIO frequencies is
-<br><br><code>&nbsp;&nbsp;25(#1),&nbsp;&nbsp;&nbsp;&nbsp;50(#2),&nbsp;&nbsp;&nbsp;100(#3),&nbsp;&nbsp;&nbsp;125(#4),&nbsp;&nbsp;&nbsp;&nbsp;200(#5),&nbsp;&nbsp;&nbsp;&nbsp;250(#6),<br>&nbsp;400(#7),&nbsp;&nbsp;&nbsp;500(#8),&nbsp;&nbsp;&nbsp;625(#9),&nbsp;&nbsp;&nbsp;800(#10),&nbsp;&nbsp;1000(#11),&nbsp;&nbsp;1250(#12),<br>2000(#13),&nbsp;2500(#14),&nbsp;4000(#15),&nbsp;5000(#16),&nbsp;10000(#17),&nbsp;20000(#18)<br></code><br><br>The real value set by set_PWM_range is (dutycycle * real range) / range.
-<h3><a name="get_PWM_range"></a><a href="#int"><small>int</small></a> get_PWM_range<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Get the range of PWM values being used on the GPIO.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br></code><br><br>Returns the dutycycle range used for the GPIO if OK,
-otherwise PI_BAD_USER_GPIO.
-<br><br>If a hardware clock or hardware PWM is active on the GPIO the
-reported range will be 1000000 (1M).
-<h3><a name="get_PWM_real_range"></a><a href="#int"><small>int</small></a> get_PWM_real_range<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Get the real underlying range of PWM values being used on the GPIO.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br></code><br><br>Returns the real range used for the GPIO if OK,
-otherwise PI_BAD_USER_GPIO.
-<br><br>If a hardware clock is active on the GPIO the reported
-real range will be 1000000 (1M).
-<br><br>If hardware PWM is active on the GPIO the reported real range
-will be approximately 250M divided by the set PWM frequency.
-<h3><a name="set_PWM_frequency"></a><a href="#int"><small>int</small></a> set_PWM_frequency<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#frequency">frequency</a>)</small></h3>
-Set the frequency (in Hz) of the PWM to be used on the GPIO.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br>frequency:&nbsp;&gt;=0&nbsp;(Hz).<br></code><br><br>Returns the numerically closest frequency if OK, otherwise
-PI_BAD_USER_GPIO or PI_NOT_PERMITTED.
-<br><br>If PWM is currently active on the GPIO it will be switched
-off and then back on at the new frequency.
-<br><br>Each GPIO can be independently set to one of 18 different
-PWM frequencies.
-<br><br>The selectable frequencies depend upon the sample rate which
-may be 1, 2, 4, 5, 8, or 10 microseconds (default 5). The
-sample rate is set when the pigpio daemon is started.
-<br><br>The frequencies for each sample rate are:
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hertz<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1:&nbsp;40000&nbsp;20000&nbsp;10000&nbsp;8000&nbsp;5000&nbsp;4000&nbsp;2500&nbsp;2000&nbsp;1600<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1250&nbsp;&nbsp;1000&nbsp;&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;50<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2:&nbsp;20000&nbsp;10000&nbsp;&nbsp;5000&nbsp;4000&nbsp;2500&nbsp;2000&nbsp;1250&nbsp;1000&nbsp;&nbsp;800<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;625&nbsp;&nbsp;&nbsp;500&nbsp;&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;125&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;25<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4:&nbsp;10000&nbsp;&nbsp;5000&nbsp;&nbsp;2500&nbsp;2000&nbsp;1250&nbsp;1000&nbsp;&nbsp;625&nbsp;&nbsp;500&nbsp;&nbsp;400<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;313&nbsp;&nbsp;&nbsp;250&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;125&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;63&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;13<br>sample<br>&nbsp;rate<br>&nbsp;(us)&nbsp;&nbsp;5:&nbsp;&nbsp;8000&nbsp;&nbsp;4000&nbsp;&nbsp;2000&nbsp;1600&nbsp;1000&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;320<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;250&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;&nbsp;160&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;80&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;&nbsp;20&nbsp;&nbsp;&nbsp;10<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8:&nbsp;&nbsp;5000&nbsp;&nbsp;2500&nbsp;&nbsp;1250&nbsp;1000&nbsp;&nbsp;625&nbsp;&nbsp;500&nbsp;&nbsp;313&nbsp;&nbsp;250&nbsp;&nbsp;200<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;156&nbsp;&nbsp;&nbsp;125&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;63&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;31&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;13&nbsp;&nbsp;&nbsp;&nbsp;6<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10:&nbsp;&nbsp;4000&nbsp;&nbsp;2000&nbsp;&nbsp;1000&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;160<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;125&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;&nbsp;80&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;20&nbsp;&nbsp;&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;5<br></code><h3><a name="get_PWM_frequency"></a><a href="#int"><small>int</small></a> get_PWM_frequency<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Get the frequency of PWM being used on the GPIO.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br></code><br><br>For normal PWM the frequency will be that defined for the GPIO by
-<a href="#set_PWM_frequency">set_PWM_frequency</a>.
-<br><br>If a hardware clock is active on the GPIO the reported frequency
-will be that set by <a href="#hardware_clock">hardware_clock</a>.
-<br><br>If hardware PWM is active on the GPIO the reported frequency
-will be that set by <a href="#hardware_PWM">hardware_PWM</a>.
-<br><br>Returns the frequency (in hertz) used for the GPIO if OK,
-otherwise PI_BAD_USER_GPIO.
-<h3><a name="set_servo_pulsewidth"></a><a href="#int"><small>int</small></a> set_servo_pulsewidth<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#pulsewidth">pulsewidth</a>)</small></h3>
-Start (500-2500) or stop (0) servo pulses on the GPIO.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;user_gpio:&nbsp;0-31.<br>pulsewidth:&nbsp;0&nbsp;(off),&nbsp;500&nbsp;(anti-clockwise)&nbsp;-&nbsp;2500&nbsp;(clockwise).<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_PULSEWIDTH or
-PI_NOT_PERMITTED.
-<br><br>The selected pulsewidth will continue to be transmitted until
-changed by a subsequent call to set_servo_pulsewidth.
-<br><br>The pulsewidths supported by servos varies and should probably be
-determined by experiment. A value of 1500 should always be safe and
-represents the mid-point of rotation.
-<br><br>You can DAMAGE a servo if you command it to move beyond its limits.
-<br><br>OTHER UPDATE RATES:
-<br><br>This function updates servos at 50Hz. If you wish to use a different
-update frequency you will have to use the PWM functions.
-<br><br><code>Update&nbsp;Rate&nbsp;(Hz)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;200&nbsp;&nbsp;400&nbsp;&nbsp;500<br>1E6/Hz&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;20000&nbsp;10000&nbsp;5000&nbsp;2500&nbsp;2000<br></code><br><br>Firstly set the desired PWM frequency using <a href="#set_PWM_frequency">set_PWM_frequency</a>.
-<br><br>Then set the PWM range using <a href="#set_PWM_range">set_PWM_range</a> to 1E6/Hz.
-Doing this allows you to use units of microseconds when setting
-the servo pulsewidth.
-<br><br>E.g. If you want to update a servo connected to GPIO 25 at 400Hz
-<br><br><code>set_PWM_frequency(25,&nbsp;400);<br>set_PWM_range(25,&nbsp;2500);<br></code><br><br>Thereafter use the <a href="#set_PWM_dutycycle">set_PWM_dutycycle</a> function to move the servo,
-e.g. set_PWM_dutycycle(25, 1500) will set a 1500 us pulse.<br>
-<h3><a name="get_servo_pulsewidth"></a><a href="#int"><small>int</small></a> get_servo_pulsewidth<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-Return the servo pulsewidth in use on a GPIO.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_NOT_SERVO_GPIO.
-<h3><a name="notify_open"></a><a href="#int"><small>int</small></a> notify_open<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-Get a free notification handle.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><br><br>Returns a handle greater than or equal to zero if OK,
-otherwise PI_NO_HANDLE.
-<br><br>A notification is a method for being notified of GPIO state
-changes via a pipe.
-<br><br>Pipes are only accessible from the local machine so this function
-serves no purpose if you are using the library from a remote machine.
-The in-built (socket) notifications provided by <a href="#callback">callback</a>
-should be used instead.
-<br><br>Notifications for handle x will be available at the pipe
-named /dev/pigpiox (where x is the handle number).
-E.g. if the function returns 15 then the notifications must be
-read from /dev/pigpio15.
-<h3><a name="notify_begin"></a><a href="#int"><small>int</small></a> notify_begin<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Start notifications on a previously opened handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;0-31&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#notify_open">notify_open</a>)<br>&nbsp;&nbsp;bits:&nbsp;a&nbsp;mask&nbsp;indicating&nbsp;the&nbsp;GPIO&nbsp;to&nbsp;be&nbsp;notified.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<br><br>The notification sends state changes for each GPIO whose
-corresponding bit in bits is set.
-<br><br>Each notification occupies 12 bytes in the fifo as follows:
-<br><br><code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;seqno;<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;flags;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;tick;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;level;<br>}&nbsp;gpioReport_t;<br></code><br><br>seqno: starts at 0 each time the handle is opened and then increments
-by one for each report.
-<br><br>flags: three flags are defined, PI_NTFY_FLAGS_WDOG,
-PI_NTFY_FLAGS_ALIVE, and PI_NTFY_FLAGS_EVENT.
-<br><br>If bit 5 is set (PI_NTFY_FLAGS_WDOG) then bits 0-4 of the flags
-indicate a GPIO which has had a watchdog timeout.
-<br><br>If bit 6 is set (PI_NTFY_FLAGS_ALIVE) this indicates a keep alive
-signal on the pipe/socket and is sent once a minute in the absence
-of other notification activity.
-<br><br>If bit 7 is set (PI_NTFY_FLAGS_EVENT) then bits 0-4 of the flags
-indicate an event which has been triggered.
-<br><br>tick: the number of microseconds since system boot. It wraps around
-after 1h12m.
-<br><br>level: indicates the level of each GPIO. If bit 1&lt;&lt;x is set then
-GPIO x is high.
-<h3><a name="notify_pause"></a><a href="#int"><small>int</small></a> notify_pause<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-Pause notifications on a previously opened handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;0-31&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#notify_open">notify_open</a>)<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<br><br>Notifications for the handle are suspended until
-<a href="#notify_begin">notify_begin</a> is called again.
-<h3><a name="notify_close"></a><a href="#int"><small>int</small></a> notify_close<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-Stop notifications on a previously opened handle and
-release the handle for reuse.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;0-31&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#notify_open">notify_open</a>)<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<h3><a name="set_watchdog"></a><a href="#int"><small>int</small></a> set_watchdog<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#timeout">timeout</a>)</small></h3>
-Sets a watchdog for a GPIO.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;timeout:&nbsp;0-60000.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO
-or PI_BAD_WDOG_TIMEOUT.
-<br><br>The watchdog is nominally in milliseconds.
-<br><br>Only one watchdog may be registered per GPIO.
-<br><br>The watchdog may be cancelled by setting timeout to 0.
-<br><br>Once a watchdog has been started callbacks for the GPIO will be
-triggered every timeout interval after the last GPIO activity.
-<br><br>The callback will receive the special level PI_TIMEOUT.
-<h3><a name="set_glitch_filter"></a><a href="#int"><small>int</small></a> set_glitch_filter<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#steady">steady</a>)</small></h3>
-Sets a glitch filter on a GPIO.
-<br><br>Level changes on the GPIO are not reported unless the level
-has been stable for at least <a href="#steady">steady</a> microseconds. The
-level is then reported. Level changes of less than
-<a href="#steady">steady</a> microseconds are ignored.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;steady:&nbsp;0-300000<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
-<br><br>This filter affects the GPIO samples returned to callbacks set up
-with <a href="#callback">callback</a>, <a href="#callback_ex">callback_ex</a> and <a href="#wait_for_edge">wait_for_edge</a>.
-<br><br>It does not affect levels read by <a href="#gpio_read">gpio_read</a>,
-<a href="#read_bank_1">read_bank_1</a>, or <a href="#read_bank_2">read_bank_2</a>.
-<br><br>Each (stable) edge will be timestamped <a href="#steady">steady</a> microseconds
-after it was first detected.
-<h3><a name="set_noise_filter"></a><a href="#int"><small>int</small></a> set_noise_filter<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#steady">steady</a>, <a href="#unsigned">unsigned</a> <a href="#active">active</a>)</small></h3>
-Sets a noise filter on a GPIO.
-<br><br>Level changes on the GPIO are ignored until a level which has
-been stable for <a href="#steady">steady</a> microseconds is detected. Level changes
-on the GPIO are then reported for <a href="#active">active</a> microseconds after
-which the process repeats.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;steady:&nbsp;0-300000<br>&nbsp;&nbsp;&nbsp;active:&nbsp;0-1000000<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
-<br><br>This filter affects the GPIO samples returned to callbacks set up
-with <a href="#callback">callback</a>, <a href="#callback_ex">callback_ex</a> and <a href="#wait_for_edge">wait_for_edge</a>.
-<br><br>It does not affect levels read by <a href="#gpio_read">gpio_read</a>,
-<a href="#read_bank_1">read_bank_1</a>, or <a href="#read_bank_2">read_bank_2</a>.
-<br><br>Level changes before and after the active period may
-be reported. Your software must be designed to cope with
-such reports.
-<h3><a name="read_bank_1"></a><a href="#uint32_t"><small>uint32_t</small></a> read_bank_1<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-Read the levels of the bank 1 GPIO (GPIO 0-31).
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><br><br>The returned 32 bit integer has a bit set if the corresponding
-GPIO is logic 1. GPIO n has bit value (1&lt;&lt;n).
-<h3><a name="read_bank_2"></a><a href="#uint32_t"><small>uint32_t</small></a> read_bank_2<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-Read the levels of the bank 2 GPIO (GPIO 32-53).
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><br><br>The returned 32 bit integer has a bit set if the corresponding
-GPIO is logic 1. GPIO n has bit value (1&lt;&lt;(n-32)).
-<h3><a name="clear_bank_1"></a><a href="#int"><small>int</small></a> clear_bank_1<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Clears GPIO 0-31 if the corresponding bit in bits is set.
-<br><br><code>&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;cleared.<br></code><br><br>Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-<br><br>A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-<h3><a name="clear_bank_2"></a><a href="#int"><small>int</small></a> clear_bank_2<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Clears GPIO 32-53 if the corresponding bit (0-21) in bits is set.
-<br><br><code>&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;cleared.<br></code><br><br>Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-<br><br>A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-<h3><a name="set_bank_1"></a><a href="#int"><small>int</small></a> set_bank_1<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Sets GPIO 0-31 if the corresponding bit in bits is set.
-<br><br><code>&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;set.<br></code><br><br>Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-<br><br>A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-<h3><a name="set_bank_2"></a><a href="#int"><small>int</small></a> set_bank_2<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#uint32_t">uint32_t</a> <a href="#bits">bits</a>)</small></h3>
-Sets GPIO 32-53 if the corresponding bit (0-21) in bits is set.
-<br><br><code>&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>bits:&nbsp;a&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;set.<br></code><br><br>Returns 0 if OK, otherwise PI_SOME_PERMITTED.
-<br><br>A status of PI_SOME_PERMITTED indicates that the user is not
-allowed to write to one or more of the GPIO.
-<h3><a name="hardware_clock"></a><a href="#int"><small>int</small></a> hardware_clock<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#clkfreq">clkfreq</a>)</small></h3>
-Starts a hardware clock on a GPIO at the specified frequency.
-Frequencies above 30MHz are unlikely to work.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gpio:&nbsp;see&nbsp;description<br>frequency:&nbsp;0&nbsp;(off)&nbsp;or&nbsp;4689-250M&nbsp;(13184-375M&nbsp;for&nbsp;the&nbsp;BCM2711)<br></code><br><br>Returns 0 if OK, otherwise PI_NOT_PERMITTED, PI_BAD_GPIO,
-PI_NOT_HCLK_GPIO, PI_BAD_HCLK_FREQ,or PI_BAD_HCLK_PASS.
-<br><br>The same clock is available on multiple GPIO. The latest
-frequency setting will be used by all GPIO which share a clock.
-<br><br>The GPIO must be one of the following.
-<br><br><code>4&nbsp;&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;All&nbsp;models<br>5&nbsp;&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br>6&nbsp;&nbsp;&nbsp;clock&nbsp;2&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>20&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>21&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;Rev.2&nbsp;B&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br><br>32&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>34&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>42&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br>43&nbsp;&nbsp;clock&nbsp;2&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>44&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br></code><br><br>Access to clock 1 is protected by a password as its use will likely
-crash the Pi. The password is given by or'ing 0x5A000000 with the
-GPIO number.
-<h3><a name="hardware_PWM"></a><a href="#int"><small>int</small></a> hardware_PWM<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#gpio">gpio</a>, <a href="#unsigned">unsigned</a> <a href="#PWMfreq">PWMfreq</a>, <a href="#uint32_t">uint32_t</a> <a href="#PWMduty">PWMduty</a>)</small></h3>
-Starts hardware PWM on a GPIO at the specified frequency and dutycycle.
-Frequencies above 30MHz are unlikely to work.
-<br><br>NOTE: Any waveform started by <a href="#wave_send_*">wave_send_*</a> or <a href="#wave_chain">wave_chain</a>
-will be cancelled.
-<br><br>This function is only valid if the pigpio main clock is PCM. The
-main clock defaults to PCM but may be overridden when the pigpio
-daemon is started (option -t).
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;&nbsp;gpio:&nbsp;see&nbsp;descripton<br>PWMfreq:&nbsp;0&nbsp;(off)&nbsp;or&nbsp;1-125M&nbsp;(1-187.5M&nbsp;for&nbsp;the&nbsp;BCM2711)<br>PWMduty:&nbsp;0&nbsp;(off)&nbsp;to&nbsp;1000000&nbsp;(1M)(fully&nbsp;on)<br></code><br><br>Returns 0 if OK, otherwise PI_NOT_PERMITTED, PI_BAD_GPIO,
-PI_NOT_HPWM_GPIO, PI_BAD_HPWM_DUTY, PI_BAD_HPWM_FREQ,
-or PI_HPWM_ILLEGAL.
-<br><br>The same PWM channel is available on multiple GPIO. The latest
-frequency and dutycycle setting will be used by all GPIO which
-share a PWM channel.
-<br><br>The GPIO must be one of the following.
-<br><br><code>12&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>13&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>18&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;All&nbsp;models<br>19&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br><br>40&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>41&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>45&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>52&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>53&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br></code><br><br>The actual number of steps beween off and fully on is the
-integral part of 250M/PWMfreq (375M/PWMfreq for the BCM2711).
-<br><br>The actual frequency set is 250M/steps (375M/steps for the BCM2711).
-<br><br>There will only be a million steps for a PWMfreq of 250 (375 for
-the BCM2711). Lower frequencies will have more steps and higher
-frequencies will have fewer steps. PWMduty is
-automatically scaled to take this into account.
-<h3><a name="get_current_tick"></a><a href="#uint32_t"><small>uint32_t</small></a> get_current_tick<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-Gets the current system tick.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><br><br>Tick is the number of microseconds since system boot.
-<br><br>As tick is an unsigned 32 bit quantity it wraps around after
-2**32 microseconds, which is approximately 1 hour 12 minutes.
-<h3><a name="get_hardware_revision"></a><a href="#uint32_t"><small>uint32_t</small></a> get_hardware_revision<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-Get the Pi's hardware revision number.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><br><br>The hardware revision is the last few characters on the Revision line
-of /proc/cpuinfo.
-<br><br>If the hardware revision can not be found or is not a valid
-hexadecimal number the function returns 0.
-<br><br>The revision number can be used to determine the assignment of GPIO
-to pins (see <a href="#gpio">gpio</a>).
-<br><br>There are at least three types of board.
-<br><br>Type 1 boards have hardware revision numbers of 2 and 3.
-<br><br>Type 2 boards have hardware revision numbers of 4, 5, 6, and 15.
-<br><br>Type 3 boards have hardware revision numbers of 16 or greater.
-<h3><a name="get_pigpio_version"></a><a href="#uint32_t"><small>uint32_t</small></a> get_pigpio_version<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-Returns the pigpio version.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><h3><a name="wave_clear"></a><a href="#int"><small>int</small></a> wave_clear<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function clears all waveforms and any data added by calls to the
-<a href="#wave_add_*">wave_add_*</a> functions.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><br><br>Returns 0 if OK.
-<h3><a name="wave_add_new"></a><a href="#int"><small>int</small></a> wave_add_new<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function starts a new empty waveform. You wouldn't normally need
-to call this function as it is automatically called after a waveform is
-created with the <a href="#wave_create">wave_create</a> function.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><br><br>Returns 0 if OK.
-<h3><a name="wave_add_generic"></a><a href="#int"><small>int</small></a> wave_add_generic<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#numPulses">numPulses</a>, <a href="#gpioPulse_t">gpioPulse_t</a> <a href="#*pulses">*pulses</a>)</small></h3>
-This function adds a number of pulses to the current waveform.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>numPulses:&nbsp;the&nbsp;number&nbsp;of&nbsp;pulses.<br>&nbsp;&nbsp;&nbsp;pulses:&nbsp;an&nbsp;array&nbsp;of&nbsp;pulses.<br></code><br><br>Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_TOO_MANY_PULSES.
-<br><br>The pulses are interleaved in time order within the existing waveform
-(if any).
-<br><br>Merging allows the waveform to be built in parts, that is the settings
-for GPIO#1 can be added, and then GPIO#2 etc.
-<br><br>If the added waveform is intended to start after or within the existing
-waveform then the first pulse should consist solely of a delay.
-<h3><a name="wave_add_serial"></a><a href="#int"><small>int</small></a> wave_add_serial<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#data_bits">data_bits</a>, <a href="#unsigned">unsigned</a> <a href="#stop_bits">stop_bits</a>, <a href="#unsigned">unsigned</a> <a href="#offset">offset</a>, <a href="#unsigned">unsigned</a> <a href="#numBytes">numBytes</a>, <a href="#char">char</a> <a href="#*str">*str</a>)</small></h3>
-This function adds a waveform representing serial data to the
-existing waveform (if any). The serial data starts offset
-microseconds from the start of the waveform.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;50-1000000<br>data_bits:&nbsp;number&nbsp;of&nbsp;data&nbsp;bits&nbsp;(1-32)<br>stop_bits:&nbsp;number&nbsp;of&nbsp;stop&nbsp;half&nbsp;bits&nbsp;(2-8)<br>&nbsp;&nbsp;&nbsp;offset:&nbsp;&gt;=0<br>&nbsp;numBytes:&nbsp;&gt;=1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str:&nbsp;an&nbsp;array&nbsp;of&nbsp;chars.<br></code><br><br>Returns the new total number of pulses in the current waveform if OK,
-otherwise PI_BAD_USER_GPIO, PI_BAD_WAVE_BAUD, PI_BAD_DATABITS,
-PI_BAD_STOP_BITS, PI_TOO_MANY_CHARS, PI_BAD_SER_OFFSET,
-or PI_TOO_MANY_PULSES.
-<br><br>NOTES:
-<br><br>The serial data is formatted as one start bit, <a href="#data_bits">data_bits</a> data bits,
-and <a href="#stop_bits">stop_bits</a>/2 stop bits.
-<br><br>It is legal to add serial data streams with different baud rates to
-the same waveform.
-<br><br><a href="#numBytes">numBytes</a> is the number of bytes of data in str.
-<br><br>The bytes required for each character depend upon <a href="#data_bits">data_bits</a>.
-<br><br>For <a href="#data_bits">data_bits</a> 1-8 there will be one byte per character.<br>
-For <a href="#data_bits">data_bits</a> 9-16 there will be two bytes per character.<br>
-For <a href="#data_bits">data_bits</a> 17-32 there will be four bytes per character.
-<h3><a name="wave_create"></a><a href="#int"><small>int</small></a> wave_create<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function creates a waveform from the data provided by the prior
-calls to the <a href="#wave_add_*">wave_add_*</a> functions. Upon success a wave id
-greater than or equal to 0 is returned, otherwise PI_EMPTY_WAVEFORM,
-PI_TOO_MANY_CBS, PI_TOO_MANY_OOL, or PI_NO_WAVEFORM_ID.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><br><br>The data provided by the <a href="#wave_add_*">wave_add_*</a> functions is consumed by this
-function.
-<br><br>As many waveforms may be created as there is space available. The
-wave id is passed to <a href="#wave_send_*">wave_send_*</a> to specify the waveform to transmit.
-<br><br>Normal usage would be
-<br><br>Step 1. <a href="#wave_clear">wave_clear</a> to clear all waveforms and added data.
-<br><br>Step 2. <a href="#wave_add_*">wave_add_*</a> calls to supply the waveform data.
-<br><br>Step 3. <a href="#wave_create">wave_create</a> to create the waveform and get a unique id
-<br><br>Repeat steps 2 and 3 as needed.
-<br><br>Step 4. <a href="#wave_send_*">wave_send_*</a> with the id of the waveform to transmit.
-<br><br>A waveform comprises one or more pulses. Each pulse consists of a
-<a href="#gpioPulse_t">gpioPulse_t</a> structure.
-<br><br><code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOn;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOff;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;usDelay;<br>}&nbsp;gpioPulse_t;<br></code><br><br>The fields specify
-<br><br>1) the GPIO to be switched on at the start of the pulse.<br>
-2) the GPIO to be switched off at the start of the pulse.<br>
-3) the delay in microseconds before the next pulse.<br>
-<br><br>Any or all the fields can be zero. It doesn't make any sense to
-set all the fields to zero (the pulse will be ignored).
-<br><br>When a waveform is started each pulse is executed in order with the
-specified delay between the pulse and the next.
-<br><br>Returns the new waveform id if OK, otherwise PI_EMPTY_WAVEFORM,
-PI_NO_WAVEFORM_ID, PI_TOO_MANY_CBS, or PI_TOO_MANY_OOL.
-<h3><a name="wave_create_and_pad"></a><a href="#int"><small>int</small></a> wave_create_and_pad<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#int">int</a> <a href="#percent">percent</a>)</small></h3>
-This function creates a waveform like <a href="#wave_create">wave_create</a> but pads the consumed
-resources. Where percent gives the percentage of the resources to use (in terms
-of the theoretical maximum, not the current amount free). This allows the reuse<br>
-of deleted waves while a transmission is active.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>percent:&nbsp;0-100,&nbsp;size&nbsp;of&nbsp;waveform&nbsp;as&nbsp;percentage&nbsp;of&nbsp;maximum&nbsp;available.<br></code><br><br>The data provided by the <a href="#wave_add_*">wave_add_*</a> functions are consumed by this
-function.
-<br><br>As many waveforms may be created as there is space available. The
-wave id is passed to <a href="#wave_send_*">wave_send_*</a> to specify the waveform to transmit.
-<br><br>A usage would be the creation of two waves where one is filled while the other
-is being transmitted. Each wave is assigned 50% of the resources.
-This buffer structure allows the transmission of infinite wave sequences.
-<br><br>Normal usage:
-<br><br>Step 1. <a href="#wave_clear">wave_clear</a> to clear all waveforms and added data.
-<br><br>Step 2. <a href="#wave_add_*">wave_add_*</a> calls to supply the waveform data.
-<br><br>Step 3. <a href="#wave_create_and_pad">wave_create_and_pad</a> to create a waveform of uniform size.
-<br><br>Step 4. <a href="#wave_send_*">wave_send_*</a> with the id of the waveform to transmit.
-<br><br>Repeat steps 2-4 as needed.
-<br><br>Step 5. Any wave id can now be deleted and another wave of the same size
- can be created in its place.
-<br><br>Returns the new waveform id if OK, otherwise PI_EMPTY_WAVEFORM,
-PI_NO_WAVEFORM_ID, PI_TOO_MANY_CBS, or PI_TOO_MANY_OOL.
-<h3><a name="wave_delete"></a><a href="#int"><small>int</small></a> wave_delete<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#wave_id">wave_id</a>)</small></h3>
-This function deletes the waveform with id wave_id.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>wave_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#wave_create">wave_create</a>.<br></code><br><br>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.
-<h3><a name="wave_send_once"></a><a href="#int"><small>int</small></a> wave_send_once<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#wave_id">wave_id</a>)</small></h3>
-This function transmits the waveform with id wave_id. The waveform
-is sent once.
-<br><br>NOTE: Any hardware PWM started by <a href="#hardware_PWM">hardware_PWM</a> will be cancelled.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>wave_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#wave_create">wave_create</a>.<br></code><br><br>Returns the number of DMA control blocks in the waveform if OK,
-otherwise PI_BAD_WAVE_ID, or PI_BAD_WAVE_MODE.
-<h3><a name="wave_send_repeat"></a><a href="#int"><small>int</small></a> wave_send_repeat<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#wave_id">wave_id</a>)</small></h3>
-This function transmits the waveform with id wave_id. The waveform
-cycles until cancelled (either by the sending of a new waveform or
-by <a href="#wave_tx_stop">wave_tx_stop</a>).
-<br><br>NOTE: Any hardware PWM started by <a href="#hardware_PWM">hardware_PWM</a> will be cancelled.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>wave_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#wave_create">wave_create</a>.<br></code><br><br>Returns the number of DMA control blocks in the waveform if OK,
-otherwise PI_BAD_WAVE_ID, or PI_BAD_WAVE_MODE.
-<h3><a name="wave_send_using_mode"></a><a href="#int"><small>int</small></a> wave_send_using_mode<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#wave_id">wave_id</a>, <a href="#unsigned">unsigned</a> <a href="#mode">mode</a>)</small></h3>
-Transmits the waveform with id wave_id using mode mode.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>wave_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#wave_create">wave_create</a>.<br>&nbsp;&nbsp;&nbsp;mode:&nbsp;PI_WAVE_MODE_ONE_SHOT,&nbsp;PI_WAVE_MODE_REPEAT,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PI_WAVE_MODE_ONE_SHOT_SYNC,&nbsp;or&nbsp;PI_WAVE_MODE_REPEAT_SYNC.<br></code><br><br>PI_WAVE_MODE_ONE_SHOT: same as <a href="#wave_send_once">wave_send_once</a>.
-<br><br>PI_WAVE_MODE_REPEAT same as <a href="#wave_send_repeat">wave_send_repeat</a>.
-<br><br>PI_WAVE_MODE_ONE_SHOT_SYNC same as <a href="#wave_send_once">wave_send_once</a> but tries
-to sync with the previous waveform.
-<br><br>PI_WAVE_MODE_REPEAT_SYNC same as <a href="#wave_send_repeat">wave_send_repeat</a> but tries
-to sync with the previous waveform.
-<br><br>WARNING: bad things may happen if you delete the previous
-waveform before it has been synced to the new waveform.
-<br><br>NOTE: Any hardware PWM started by <a href="#hardware_PWM">hardware_PWM</a> will be cancelled.
-<br><br>Returns the number of DMA control blocks in the waveform if OK,
-otherwise PI_BAD_WAVE_ID, or PI_BAD_WAVE_MODE.
-<h3><a name="wave_chain"></a><a href="#int"><small>int</small></a> wave_chain<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#bufSize">bufSize</a>)</small></h3>
-This function transmits a chain of waveforms.
-<br><br>NOTE: Any hardware PWM started by <a href="#hardware_PWM">hardware_PWM</a> will be cancelled.
-<br><br>The waves to be transmitted are specified by the contents of buf
-which contains an ordered list of <a href="#wave_id">wave_id</a>s and optional command
-codes and related data.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;pointer&nbsp;to&nbsp;the&nbsp;wave_ids&nbsp;and&nbsp;optional&nbsp;command&nbsp;codes<br>bufSize:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;in&nbsp;buf<br></code><br><br>Returns 0 if OK, otherwise PI_CHAIN_NESTING, PI_CHAIN_LOOP_CNT, PI_BAD_CHAIN_LOOP, PI_BAD_CHAIN_CMD, PI_CHAIN_COUNTER,
-PI_BAD_CHAIN_DELAY, PI_CHAIN_TOO_BIG, or PI_BAD_WAVE_ID.
-<br><br>Each wave is transmitted in the order specified. A wave may
-occur multiple times per chain.
-<br><br>A blocks of waves may be transmitted multiple times by using
-the loop commands. The block is bracketed by loop start and
-end commands. Loops may be nested.
-<br><br>Delays between waves may be added with the delay command.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>Loop Start</td><td>255 0</td><td>Identify start of a wave block</td></tr><tr><td>Loop Repeat</td><td>255 1 x y</td><td>loop x + y*256 times</td></tr><tr><td>Delay</td><td>255 2 x y</td><td>delay x + y*256 microseconds</td></tr><tr><td>Loop Forever</td><td>255 3</td><td>loop forever</td></tr></tbody></table><br><br>If present Loop Forever must be the last entry in the chain.
-<br><br>The code is currently dimensioned to support a chain with roughly
-600 entries and 20 loop counters.
-<br><br><b><small>Example</small></b><br><br><code>#include&nbsp;&lt;stdio.h&gt;<br>#include&nbsp;&lt;pigpiod_if2.h&gt;<br><br>#define&nbsp;WAVES&nbsp;5<br>#define&nbsp;GPIO&nbsp;4<br><br>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;*argv[])<br>{<br>&nbsp;&nbsp;&nbsp;int&nbsp;i,&nbsp;pi,&nbsp;wid[WAVES];<br><br>&nbsp;&nbsp;&nbsp;pi&nbsp;=&nbsp;pigpio_start(0,&nbsp;0);<br>&nbsp;&nbsp;&nbsp;if&nbsp;(pi&lt;0)&nbsp;return&nbsp;-1;<br><br>&nbsp;&nbsp;&nbsp;set_mode(pi,&nbsp;GPIO,&nbsp;PI_OUTPUT);<br><br>&nbsp;&nbsp;&nbsp;for&nbsp;(i=0;&nbsp;i&lt;WAVES;&nbsp;i++)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wave_add_generic(pi,&nbsp;2,&nbsp;(gpioPulse_t[])<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{1&lt;&lt;GPIO,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;20},<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{0,&nbsp;1&lt;&lt;GPIO,&nbsp;(i+1)*200}});<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[i]&nbsp;=&nbsp;wave_create(pi);<br>&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;wave_chain(pi,&nbsp;(char&nbsp;[])&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[4],&nbsp;wid[3],&nbsp;wid[2],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;4+3+2<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[0],&nbsp;wid[0],&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;0+0+0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[1],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;0+1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;2,&nbsp;0x88,&nbsp;0x13,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;delay&nbsp;5000us<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;30,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;30&nbsp;times)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[2],&nbsp;wid[3],&nbsp;wid[0],&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;2+3+0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[3],&nbsp;wid[1],&nbsp;wid[2],&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;3+1+2<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;10,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;10&nbsp;times)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;5,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;5&nbsp;times)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[4],&nbsp;wid[4],&nbsp;wid[4],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;4+4+4<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;2,&nbsp;0x20,&nbsp;0x4E,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;delay&nbsp;20000us<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[0],&nbsp;wid[0],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;transmit&nbsp;waves&nbsp;0+0+0<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},&nbsp;46);<br><br>&nbsp;&nbsp;&nbsp;while&nbsp;(wave_tx_busy(pi))&nbsp;time_sleep(0.1);<br><br>&nbsp;&nbsp;&nbsp;for&nbsp;(i=0;&nbsp;i&lt;WAVES;&nbsp;i++)&nbsp;wave_delete(pi,&nbsp;wid[i]);<br><br>&nbsp;&nbsp;&nbsp;pigpio_stop(pi);<br>}<br></code><h3><a name="wave_tx_at"></a><a href="#int"><small>int</small></a> wave_tx_at<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function returns the id of the waveform currently being
-transmitted.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><br><br>Returns the waveform id or one of the following special values:
-<br><br>PI_WAVE_NOT_FOUND (9998) - transmitted wave not found.<br>
-PI_NO_TX_WAVE (9999) - no wave being transmitted.
-<h3><a name="wave_tx_busy"></a><a href="#int"><small>int</small></a> wave_tx_busy<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function checks to see if a waveform is currently being
-transmitted.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><br><br>Returns 1 if a waveform is currently being transmitted, otherwise 0.
-<h3><a name="wave_tx_stop"></a><a href="#int"><small>int</small></a> wave_tx_stop<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function stops the transmission of the current waveform.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><br><br>Returns 0 if OK.
-<br><br>This function is intended to stop a waveform started with the repeat mode.
-<h3><a name="wave_get_micros"></a><a href="#int"><small>int</small></a> wave_get_micros<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function returns the length in microseconds of the current
-waveform.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><h3><a name="wave_get_high_micros"></a><a href="#int"><small>int</small></a> wave_get_high_micros<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function returns the length in microseconds of the longest waveform
-created since the pigpio daemon was started.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><h3><a name="wave_get_max_micros"></a><a href="#int"><small>int</small></a> wave_get_max_micros<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function returns the maximum possible size of a waveform in<br>
-microseconds.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><h3><a name="wave_get_pulses"></a><a href="#int"><small>int</small></a> wave_get_pulses<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function returns the length in pulses of the current waveform.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><h3><a name="wave_get_high_pulses"></a><a href="#int"><small>int</small></a> wave_get_high_pulses<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function returns the length in pulses of the longest waveform
-created since the pigpio daemon was started.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><h3><a name="wave_get_max_pulses"></a><a href="#int"><small>int</small></a> wave_get_max_pulses<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function returns the maximum possible size of a waveform in pulses.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><h3><a name="wave_get_cbs"></a><a href="#int"><small>int</small></a> wave_get_cbs<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function returns the length in DMA control blocks of the current
-waveform.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><h3><a name="wave_get_high_cbs"></a><a href="#int"><small>int</small></a> wave_get_high_cbs<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function returns the length in DMA control blocks of the longest
-waveform created since the pigpio daemon was started.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><h3><a name="wave_get_max_cbs"></a><a href="#int"><small>int</small></a> wave_get_max_cbs<small>(<a href="#int">int</a> <a href="#pi">pi</a>)</small></h3>
-This function returns the maximum possible size of a waveform in DMA
-control blocks.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br></code><h3><a name="gpio_trigger"></a><a href="#int"><small>int</small></a> gpio_trigger<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#pulseLen">pulseLen</a>, <a href="#unsigned">unsigned</a> <a href="#level">level</a>)</small></h3>
-This function sends a trigger pulse to a GPIO. The GPIO is set to
-level for pulseLen microseconds and then reset to not level.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br>&nbsp;pulseLen:&nbsp;1-100.<br>&nbsp;&nbsp;&nbsp;&nbsp;level:&nbsp;0,1.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_LEVEL,
-PI_BAD_PULSELEN, or PI_NOT_PERMITTED.
-<h3><a name="store_script"></a><a href="#int"><small>int</small></a> store_script<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#char">char</a> <a href="#*script">*script</a>)</small></h3>
-This function stores a script for later execution.
-<br><br>See <a href="http://abyz.me.uk/rpi/pigpio/pigs.html#Scripts">http://abyz.me.uk/rpi/pigpio/pigs.html#Scripts</a> for details.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>script:&nbsp;the&nbsp;text&nbsp;of&nbsp;the&nbsp;script.<br></code><br><br>The function returns a script id if the script is valid,
-otherwise PI_BAD_SCRIPT.
-<h3><a name="run_script"></a><a href="#int"><small>int</small></a> run_script<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>, <a href="#unsigned">unsigned</a> <a href="#numPar">numPar</a>, <a href="#uint32_t">uint32_t</a> <a href="#*param">*param</a>)</small></h3>
-This function runs a stored script.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#store_script">store_script</a>.<br>&nbsp;&nbsp;&nbsp;numPar:&nbsp;0-10,&nbsp;the&nbsp;number&nbsp;of&nbsp;parameters.<br>&nbsp;&nbsp;&nbsp;&nbsp;param:&nbsp;an&nbsp;array&nbsp;of&nbsp;parameters.<br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID, or
-PI_TOO_MANY_PARAM
-<br><br>param is an array of up to 10 parameters which may be referenced in
-the script as p0 to p9.
-<h3><a name="update_script"></a><a href="#int"><small>int</small></a> update_script<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>, <a href="#unsigned">unsigned</a> <a href="#numPar">numPar</a>, <a href="#uint32_t">uint32_t</a> <a href="#*param">*param</a>)</small></h3>
-This function sets the parameters of a script. The script may or
-may not be running. The first numPar parameters of the script are
-overwritten with the new values.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#store_script">store_script</a>.<br>&nbsp;&nbsp;&nbsp;numPar:&nbsp;0-10,&nbsp;the&nbsp;number&nbsp;of&nbsp;parameters.<br>&nbsp;&nbsp;&nbsp;&nbsp;param:&nbsp;an&nbsp;array&nbsp;of&nbsp;parameters.<br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID, or
-PI_TOO_MANY_PARAM.
-<br><br>param is an array of up to 10 parameters which may be referenced in
-the script as p0 to p9.
-<h3><a name="script_status"></a><a href="#int"><small>int</small></a> script_status<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>, <a href="#uint32_t">uint32_t</a> <a href="#*param">*param</a>)</small></h3>
-This function returns the run status of a stored script as well
-as the current values of parameters 0 to 9.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#store_script">store_script</a>.<br>&nbsp;&nbsp;&nbsp;&nbsp;param:&nbsp;an&nbsp;array&nbsp;to&nbsp;hold&nbsp;the&nbsp;returned&nbsp;10&nbsp;parameters.<br></code><br><br>The function returns greater than or equal to 0 if OK,
-otherwise PI_BAD_SCRIPT_ID.
-<br><br>The run status may be
-<br><br><code>PI_SCRIPT_INITING<br>PI_SCRIPT_HALTED<br>PI_SCRIPT_RUNNING<br>PI_SCRIPT_WAITING<br>PI_SCRIPT_FAILED<br></code><br><br>The current value of script parameters 0 to 9 are returned in param.
-<h3><a name="stop_script"></a><a href="#int"><small>int</small></a> stop_script<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>)</small></h3>
-This function stops a running script.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#store_script">store_script</a>.<br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID.
-<h3><a name="delete_script"></a><a href="#int"><small>int</small></a> delete_script<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#script_id">script_id</a>)</small></h3>
-This function deletes a stored script.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>script_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#store_script">store_script</a>.<br></code><br><br>The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID.
-<h3><a name="bb_serial_read_open"></a><a href="#int"><small>int</small></a> bb_serial_read_open<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#data_bits">data_bits</a>)</small></h3>
-This function opens a GPIO for bit bang reading of serial data.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;50-250000<br>data_bits:&nbsp;1-32<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_WAVE_BAUD,
-or PI_GPIO_IN_USE.
-<br><br>The serial data is returned in a cyclic buffer and is read using
-bb_serial_read.
-<br><br>It is the caller's responsibility to read data from the cyclic buffer
-in a timely fashion.
-<h3><a name="bb_serial_read"></a><a href="#int"><small>int</small></a> bb_serial_read<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#void">void</a> <a href="#*buf">*buf</a>, <a href="#size_t">size_t</a> <a href="#bufSize">bufSize</a>)</small></h3>
-This function copies up to bufSize bytes of data read from the
-bit bang serial cyclic buffer to the buffer starting at buf.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31,&nbsp;previously&nbsp;opened&nbsp;with&nbsp;<a href="#bb_serial_read_open">bb_serial_read_open</a>.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;bytes.<br>&nbsp;&nbsp;bufSize:&nbsp;&gt;=0<br></code><br><br>Returns the number of bytes copied if OK, otherwise PI_BAD_USER_GPIO
-or PI_NOT_SERIAL_GPIO.
-<br><br>The bytes returned for each character depend upon the number of
-data bits <a href="#data_bits">data_bits</a> specified in the <a href="#bb_serial_read_open">bb_serial_read_open</a> command.
-<br><br>For <a href="#data_bits">data_bits</a> 1-8 there will be one byte per character.<br>
-For <a href="#data_bits">data_bits</a> 9-16 there will be two bytes per character.<br>
-For <a href="#data_bits">data_bits</a> 17-32 there will be four bytes per character.
-<h3><a name="bb_serial_read_close"></a><a href="#int"><small>int</small></a> bb_serial_read_close<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>)</small></h3>
-This function closes a GPIO for bit bang reading of serial data.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31,&nbsp;previously&nbsp;opened&nbsp;with&nbsp;<a href="#bb_serial_read_open">bb_serial_read_open</a>.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_SERIAL_GPIO.
-<h3><a name="bb_serial_invert"></a><a href="#int"><small>int</small></a> bb_serial_invert<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#invert">invert</a>)</small></h3>
-This function inverts serial logic for big bang serial reads.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31,&nbsp;previously&nbsp;opened&nbsp;with&nbsp;<a href="#bb_serial_read_open">bb_serial_read_open</a>.<br>&nbsp;&nbsp;&nbsp;invert:&nbsp;0-1,&nbsp;1&nbsp;invert,&nbsp;0&nbsp;normal.<br></code><br><br>Returns 0 if OK, otherwise PI_NOT_SERIAL_GPIO or PI_BAD_SER_INVERT.
-<h3><a name="i2c_open"></a><a href="#int"><small>int</small></a> i2c_open<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_bus">i2c_bus</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_addr">i2c_addr</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_flags">i2c_flags</a>)</small></h3>
-This returns a handle for the device at address i2c_addr on bus i2c_bus.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;i2c_bus:&nbsp;&gt;=0.<br>&nbsp;i2c_addr:&nbsp;0-0x7F.<br>i2c_flags:&nbsp;0.<br></code><br><br>No flags are currently defined. This parameter should be set to zero.
-<br><br>Physically buses 0 and 1 are available on the Pi. Higher numbered buses
-will be available if a kernel supported bus multiplexor is being used.
-<br><br>The GPIO used are given in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td></tr><tr><td>I2C 0</td><td>0</td><td>1</td></tr><tr><td>I2C 1</td><td>2</td><td>3</td></tr></tbody></table><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_BAD_I2C_BUS, PI_BAD_I2C_ADDR,
-PI_BAD_FLAGS, PI_NO_HANDLE, or PI_I2C_OPEN_FAILED.
-<br><br>For the SMBus commands the low level transactions are shown at the end
-of the function description. The following abbreviations are used.
-<br><br><code>S&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Start&nbsp;bit<br>P&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Stop&nbsp;bit<br>Rd/Wr&nbsp;&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Read/Write&nbsp;bit.&nbsp;Rd&nbsp;equals&nbsp;1,&nbsp;Wr&nbsp;equals&nbsp;0.<br>A,&nbsp;NA&nbsp;&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Accept&nbsp;and&nbsp;not&nbsp;accept&nbsp;bit.<br><br>Addr&nbsp;&nbsp;&nbsp;&nbsp;(7&nbsp;bits):&nbsp;I2C&nbsp;7&nbsp;bit&nbsp;address.<br>i2c_reg&nbsp;(8&nbsp;bits):&nbsp;A&nbsp;byte&nbsp;which&nbsp;often&nbsp;selects&nbsp;a&nbsp;register.<br>Data&nbsp;&nbsp;&nbsp;&nbsp;(8&nbsp;bits):&nbsp;A&nbsp;data&nbsp;byte.<br>Count&nbsp;&nbsp;&nbsp;(8&nbsp;bits):&nbsp;A&nbsp;byte&nbsp;defining&nbsp;the&nbsp;length&nbsp;of&nbsp;a&nbsp;block&nbsp;operation.<br><br>[..]:&nbsp;Data&nbsp;sent&nbsp;by&nbsp;the&nbsp;device.<br></code><h3><a name="i2c_close"></a><a href="#int"><small>int</small></a> i2c_close<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This closes the I2C device associated with the handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<h3><a name="i2c_write_quick"></a><a href="#int"><small>int</small></a> i2c_write_quick<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#bit">bit</a>)</small></h3>
-This sends a single bit (in the Rd/Wr bit) to the device associated
-with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>&nbsp;&nbsp;&nbsp;bit:&nbsp;0-1,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Quick command. SMBus 2.0 5.5.1
-<code>S&nbsp;Addr&nbsp;bit&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_write_byte"></a><a href="#int"><small>int</small></a> i2c_write_byte<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#bVal">bVal</a>)</small></h3>
-This sends a single byte to the device associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>&nbsp;&nbsp;bVal:&nbsp;0-0xFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Send byte. SMBus 2.0 5.5.2
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;bVal&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_read_byte"></a><a href="#int"><small>int</small></a> i2c_read_byte<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This reads a single byte from the device associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br></code><br><br>Returns the byte read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-or PI_I2C_READ_FAILED.
-<br><br>Receive byte. SMBus 2.0 5.5.3
-<code>S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_write_byte_data"></a><a href="#int"><small>int</small></a> i2c_write_byte_data<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#unsigned">unsigned</a> <a href="#bVal">bVal</a>)</small></h3>
-This writes a single byte to the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write.<br>&nbsp;&nbsp;&nbsp;bVal:&nbsp;0-0xFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Write byte. SMBus 2.0 5.5.4
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2c_reg&nbsp;[A]&nbsp;bVal&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_write_word_data"></a><a href="#int"><small>int</small></a> i2c_write_word_data<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#unsigned">unsigned</a> <a href="#wVal">wVal</a>)</small></h3>
-This writes a single 16 bit word to the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write.<br>&nbsp;&nbsp;&nbsp;wVal:&nbsp;0-0xFFFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Write word. SMBus 2.0 5.5.4
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2c_reg&nbsp;[A]&nbsp;wval_Low&nbsp;[A]&nbsp;wVal_High&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_read_byte_data"></a><a href="#int"><small>int</small></a> i2c_read_byte_data<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>)</small></h3>
-This reads a single byte from the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read.<br></code><br><br>Returns the byte read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Read byte. SMBus 2.0 5.5.5
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2c_reg&nbsp;[A]&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_read_word_data"></a><a href="#int"><small>int</small></a> i2c_read_word_data<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>)</small></h3>
-This reads a single 16 bit word from the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read.<br></code><br><br>Returns the word read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Read word. SMBus 2.0 5.5.5
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2c_reg&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[DataLow]&nbsp;A&nbsp;[DataHigh]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_process_call"></a><a href="#int"><small>int</small></a> i2c_process_call<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#unsigned">unsigned</a> <a href="#wVal">wVal</a>)</small></h3>
-This writes 16 bits of data to the specified register of the device
-associated with handle and and reads 16 bits of data in return.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write/read.<br>&nbsp;&nbsp;&nbsp;wVal:&nbsp;0-0xFFFF,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></code><br><br>Returns the word read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Process call. SMBus 2.0 5.5.6
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2c_reg&nbsp;[A]&nbsp;wVal_Low&nbsp;[A]&nbsp;wVal_High&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[DataLow]&nbsp;A&nbsp;[DataHigh]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_write_block_data"></a><a href="#int"><small>int</small></a> i2c_write_block_data<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes up to 32 bytes to the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write.<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;with&nbsp;the&nbsp;data&nbsp;to&nbsp;send.<br>&nbsp;&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br>Block write. SMBus 2.0 5.5.7
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2c_reg&nbsp;[A]&nbsp;count&nbsp;[A]&nbsp;buf0&nbsp;[A]&nbsp;buf1&nbsp;[A]&nbsp;...<br>&nbsp;&nbsp;&nbsp;[A]&nbsp;bufn&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_read_block_data"></a><a href="#int"><small>int</small></a> i2c_read_block_data<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>)</small></h3>
-This reads a block of up to 32 bytes from the specified register of
-the device associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read.<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data.<br></code><br><br>The amount of returned data is set by the device.
-<br><br>Returns the number of bytes read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>Block read. SMBus 2.0 5.5.7
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2c_reg&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Count]&nbsp;A&nbsp;[buf0]&nbsp;A&nbsp;[buf1]&nbsp;A&nbsp;...&nbsp;A&nbsp;[bufn]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_block_process_call"></a><a href="#int"><small>int</small></a> i2c_block_process_call<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes data bytes to the specified register of the device
-associated with handle and reads a device specified number
-of bytes of data in return.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write/read.<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;with&nbsp;the&nbsp;data&nbsp;to&nbsp;send&nbsp;and&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data.<br>&nbsp;&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns the number of bytes read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br>The smbus 2.0 documentation states that a minimum of 1 byte may be
-sent and a minimum of 1 byte may be received. The total number of
-bytes sent/received must be 32 or less.
-<br><br>Block write-block read. SMBus 2.0 5.5.8
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2c_reg&nbsp;[A]&nbsp;count&nbsp;[A]&nbsp;buf0&nbsp;[A]&nbsp;...<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Count]&nbsp;A&nbsp;[Data]&nbsp;...&nbsp;A&nbsp;P<br></code><h3><a name="i2c_read_i2c_block_data"></a><a href="#int"><small>int</small></a> i2c_read_i2c_block_data<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This reads count bytes from the specified register of the device
-associated with handle . The count may be 1-32.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;read.<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data.<br>&nbsp;&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></code><br><br>Returns the number of bytes read (&gt;0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, or PI_I2C_READ_FAILED.
-<br><br><code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2c_reg&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[buf0]&nbsp;A&nbsp;[buf1]&nbsp;A&nbsp;...&nbsp;A&nbsp;[bufn]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_write_i2c_block_data"></a><a href="#int"><small>int</small></a> i2c_write_i2c_block_data<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#i2c_reg">i2c_reg</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes 1 to 32 bytes to the specified register of the device
-associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>i2c_reg:&nbsp;0-255,&nbsp;the&nbsp;register&nbsp;to&nbsp;write.<br>&nbsp;&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;data&nbsp;to&nbsp;write.<br>&nbsp;&nbsp;count:&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br><code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;i2c_reg&nbsp;[A]&nbsp;buf0&nbsp;[A]&nbsp;buf1&nbsp;[A]&nbsp;...&nbsp;[A]&nbsp;bufn&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_read_device"></a><a href="#int"><small>int</small></a> i2c_read_device<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This reads count bytes from the raw device into buf.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data&nbsp;bytes.<br>&nbsp;count:&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></code><br><br>Returns count (&gt;0) if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_READ_FAILED.
-<br><br><code>S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[buf0]&nbsp;A&nbsp;[buf1]&nbsp;A&nbsp;...&nbsp;A&nbsp;[bufn]&nbsp;NA&nbsp;P<br></code><h3><a name="i2c_write_device"></a><a href="#int"><small>int</small></a> i2c_write_device<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This writes count bytes from buf to the raw device.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;containing&nbsp;the&nbsp;data&nbsp;bytes&nbsp;to&nbsp;write.<br>&nbsp;count:&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_I2C_WRITE_FAILED.
-<br><br><code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;buf0&nbsp;[A]&nbsp;buf1&nbsp;[A]&nbsp;...&nbsp;[A]&nbsp;bufn&nbsp;[A]&nbsp;P<br></code><h3><a name="i2c_zip"></a><a href="#int"><small>int</small></a> i2c_zip<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*inBuf">*inBuf</a>, <a href="#unsigned">unsigned</a> <a href="#inLen">inLen</a>, <a href="#char">char</a> <a href="#*outBuf">*outBuf</a>, <a href="#unsigned">unsigned</a> <a href="#outLen">outLen</a>)</small></h3>
-This function executes a sequence of I2C operations. The
-operations to be performed are specified by the contents of inBuf
-which contains the concatenated command codes and associated data.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#i2cOpen">i2cOpen</a><br>&nbsp;inBuf:&nbsp;pointer&nbsp;to&nbsp;the&nbsp;concatenated&nbsp;I2C&nbsp;commands,&nbsp;see&nbsp;below<br>&nbsp;inLen:&nbsp;size&nbsp;of&nbsp;command&nbsp;buffer<br>outBuf:&nbsp;pointer&nbsp;to&nbsp;buffer&nbsp;to&nbsp;hold&nbsp;returned&nbsp;data<br>outLen:&nbsp;size&nbsp;of&nbsp;output&nbsp;buffer<br></code><br><br>Returns &gt;= 0 if OK (the number of bytes read), otherwise
-PI_BAD_HANDLE, PI_BAD_POINTER, PI_BAD_I2C_CMD, PI_BAD_I2C_RLEN.
-PI_BAD_I2C_WLEN, or PI_BAD_I2C_SEG.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>End</td><td>0</td><td>No more commands</td></tr><tr><td>Escape</td><td>1</td><td>Next P is two bytes</td></tr><tr><td>On</td><td>2</td><td>Switch combined flag on</td></tr><tr><td>Off</td><td>3</td><td>Switch combined flag off</td></tr><tr><td>Address</td><td>4 P</td><td>Set I2C address to P</td></tr><tr><td>Flags</td><td>5 lsb msb</td><td>Set I2C flags to lsb + (msb &lt;&lt; 8)</td></tr><tr><td>Read</td><td>6 P</td><td>Read P bytes of data</td></tr><tr><td>Write</td><td>7 P ...</td><td>Write P bytes of data</td></tr></tbody></table><br><br>The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-<br><br>The address defaults to that associated with the handle.
-The flags default to 0. The address and flags maintain their
-previous value until updated.
-<br><br>The returned I2C data is stored in consecutive locations of outBuf.
-<br><br><b><small>Example</small></b><br><br><code>Set&nbsp;address&nbsp;0x53,&nbsp;write&nbsp;0x32,&nbsp;read&nbsp;6&nbsp;bytes<br>Set&nbsp;address&nbsp;0x1E,&nbsp;write&nbsp;0x03,&nbsp;read&nbsp;6&nbsp;bytes<br>Set&nbsp;address&nbsp;0x68,&nbsp;write&nbsp;0x1B,&nbsp;read&nbsp;8&nbsp;bytes<br>End<br><br>0x04&nbsp;0x53&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x32&nbsp;&nbsp;&nbsp;0x06&nbsp;0x06<br>0x04&nbsp;0x1E&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x03&nbsp;&nbsp;&nbsp;0x06&nbsp;0x06<br>0x04&nbsp;0x68&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x1B&nbsp;&nbsp;&nbsp;0x06&nbsp;0x08<br>0x00<br></code><h3><a name="bb_i2c_open"></a><a href="#int"><small>int</small></a> bb_i2c_open<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#SDA">SDA</a>, <a href="#unsigned">unsigned</a> <a href="#SCL">SCL</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>)</small></h3>
-This function selects a pair of GPIO for bit banging I2C at a
-specified baud rate.
-<br><br>Bit banging I2C allows for certain operations which are not possible
-with the standard I2C driver.
-<br><br>o baud rates as low as 50<br>
-o repeated starts<br>
-o clock stretching<br>
-o I2C on any pair of spare GPIO
-<br><br><code>&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;SDA:&nbsp;0-31<br>&nbsp;SCL:&nbsp;0-31<br>baud:&nbsp;50-500000<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_I2C_BAUD, or
-PI_GPIO_IN_USE.
-<br><br>NOTE:
-<br><br>The GPIO used for SDA and SCL must have pull-ups to 3V3 connected. As
-a guide the hardware pull-ups on pins 3 and 5 are 1k8 in value.
-<h3><a name="bb_i2c_close"></a><a href="#int"><small>int</small></a> bb_i2c_close<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#SDA">SDA</a>)</small></h3>
-This function stops bit banging I2C on a pair of GPIO previously
-opened with <a href="#bb_i2c_open">bb_i2c_open</a>.
-<br><br><code>&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>SDA:&nbsp;0-31,&nbsp;the&nbsp;SDA&nbsp;GPIO&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_i2c_open">bb_i2c_open</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_I2C_GPIO.
-<h3><a name="bb_i2c_zip"></a><a href="#int"><small>int</small></a> bb_i2c_zip<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#SDA">SDA</a>, <a href="#char">char</a> <a href="#*inBuf">*inBuf</a>, <a href="#unsigned">unsigned</a> <a href="#inLen">inLen</a>, <a href="#char">char</a> <a href="#*outBuf">*outBuf</a>, <a href="#unsigned">unsigned</a> <a href="#outLen">outLen</a>)</small></h3>
-This function executes a sequence of bit banged I2C operations. The
-operations to be performed are specified by the contents of inBuf
-which contains the concatenated command codes and associated data.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;&nbsp;SDA:&nbsp;0-31&nbsp;(as&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_i2c_open">bb_i2c_open</a>)<br>&nbsp;inBuf:&nbsp;pointer&nbsp;to&nbsp;the&nbsp;concatenated&nbsp;I2C&nbsp;commands,&nbsp;see&nbsp;below<br>&nbsp;inLen:&nbsp;size&nbsp;of&nbsp;command&nbsp;buffer<br>outBuf:&nbsp;pointer&nbsp;to&nbsp;buffer&nbsp;to&nbsp;hold&nbsp;returned&nbsp;data<br>outLen:&nbsp;size&nbsp;of&nbsp;output&nbsp;buffer<br></code><br><br>Returns &gt;= 0 if OK (the number of bytes read), otherwise
-PI_BAD_USER_GPIO, PI_NOT_I2C_GPIO, PI_BAD_POINTER,
-PI_BAD_I2C_CMD, PI_BAD_I2C_RLEN, PI_BAD_I2C_WLEN,
-PI_I2C_READ_FAILED, or PI_I2C_WRITE_FAILED.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>End</td><td>0</td><td>No more commands</td></tr><tr><td>Escape</td><td>1</td><td>Next P is two bytes</td></tr><tr><td>Start</td><td>2</td><td>Start condition</td></tr><tr><td>Stop</td><td>3</td><td>Stop condition</td></tr><tr><td>Address</td><td>4 P</td><td>Set I2C address to P</td></tr><tr><td>Flags</td><td>5 lsb msb</td><td>Set I2C flags to lsb + (msb &lt;&lt; 8)</td></tr><tr><td>Read</td><td>6 P</td><td>Read P bytes of data</td></tr><tr><td>Write</td><td>7 P ...</td><td>Write P bytes of data</td></tr></tbody></table><br><br>The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-<br><br>The address and flags default to 0. The address and flags maintain
-their previous value until updated.
-<br><br>No flags are currently defined.
-<br><br>The returned I2C data is stored in consecutive locations of outBuf.
-<br><br><b><small>Example</small></b><br><br><code>Set&nbsp;address&nbsp;0x53<br>start,&nbsp;write&nbsp;0x32,&nbsp;(re)start,&nbsp;read&nbsp;6&nbsp;bytes,&nbsp;stop<br>Set&nbsp;address&nbsp;0x1E<br>start,&nbsp;write&nbsp;0x03,&nbsp;(re)start,&nbsp;read&nbsp;6&nbsp;bytes,&nbsp;stop<br>Set&nbsp;address&nbsp;0x68<br>start,&nbsp;write&nbsp;0x1B,&nbsp;(re)start,&nbsp;read&nbsp;8&nbsp;bytes,&nbsp;stop<br>End<br><br>0x04&nbsp;0x53<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x32&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x06&nbsp;0x03<br><br>0x04&nbsp;0x1E<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x03&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x06&nbsp;0x03<br><br>0x04&nbsp;0x68<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x1B&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x08&nbsp;0x03<br><br>0x00<br></code><h3><a name="bb_spi_open"></a><a href="#int"><small>int</small></a> bb_spi_open<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#CS">CS</a>, <a href="#unsigned">unsigned</a> <a href="#MISO">MISO</a>, <a href="#unsigned">unsigned</a> <a href="#MOSI">MOSI</a>, <a href="#unsigned">unsigned</a> <a href="#SCLK">SCLK</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#spi_flags">spi_flags</a>)</small></h3>
-This function selects a set of GPIO for bit banging SPI at a
-specified baud rate.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CS:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MISO:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOSI:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SCLK:&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;50-250000<br>spi_flags:&nbsp;see&nbsp;below<br></code><br><br>spi_flags consists of the least significant 22 bits.
-<br><br><code>21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;p&nbsp;&nbsp;m&nbsp;&nbsp;m<br></code><br><br>mm defines the SPI mode, defaults to 0
-<br><br><code>Mode&nbsp;CPOL&nbsp;CPHA<br>&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0<br>&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;1<br>&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;0<br>&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;1<br></code><br><br>p is 0 if CS is active low (default) and 1 for active high.
-<br><br>T is 1 if the least significant bit is transmitted on MOSI first, the
-default (0) shifts the most significant bit out first.
-<br><br>R is 1 if the least significant bit is received on MISO first, the
-default (0) receives the most significant bit first.
-<br><br>The other bits in flags should be set to zero.
-<br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_SPI_BAUD, or
-PI_GPIO_IN_USE.
-<br><br>If more than one device is connected to the SPI bus (defined by
-SCLK, MOSI, and MISO) each must have its own CS.
-<br><br><b><small>Example</small></b><br><br><code>bb_spi_open(pi,10,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;10000,&nbsp;0);&nbsp;//&nbsp;device&nbsp;1<br>bb_spi_open(pi,11,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;20000,&nbsp;3);&nbsp;//&nbsp;device&nbsp;2<br></code><h3><a name="bb_spi_close"></a><a href="#int"><small>int</small></a> bb_spi_close<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#CS">CS</a>)</small></h3>
-This function stops bit banging SPI on a set of GPIO
-opened with <a href="#bbSPIOpen">bbSPIOpen</a>.
-<br><br><code>pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>CS:&nbsp;0-31,&nbsp;the&nbsp;CS&nbsp;GPIO&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_spi_open">bb_spi_open</a><br></code><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_SPI_GPIO.
-<h3><a name="bb_spi_xfer"></a><a href="#int"><small>int</small></a> bb_spi_xfer<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#CS">CS</a>, <a href="#char">char</a> <a href="#*txBuf">*txBuf</a>, <a href="#char">char</a> <a href="#*rxBuf">*rxBuf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function executes a bit banged SPI transfer.
-<br><br><code>&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;&nbsp;CS:&nbsp;0-31&nbsp;(as&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_spi_open">bb_spi_open</a>)<br>txBuf:&nbsp;pointer&nbsp;to&nbsp;buffer&nbsp;to&nbsp;hold&nbsp;data&nbsp;to&nbsp;be&nbsp;sent<br>rxBuf:&nbsp;pointer&nbsp;to&nbsp;buffer&nbsp;to&nbsp;hold&nbsp;returned&nbsp;data<br>count:&nbsp;size&nbsp;of&nbsp;data&nbsp;transfer<br></code><br><br>Returns &gt;= 0 if OK (the number of bytes read), otherwise
-PI_BAD_USER_GPIO, PI_NOT_SPI_GPIO or PI_BAD_POINTER.
-<br><br><b><small>Example</small></b><br><br><code>//&nbsp;gcc&nbsp;-Wall&nbsp;-pthread&nbsp;-o&nbsp;bb_spi_x_test&nbsp;bb_spi_x_test.c&nbsp;-lpigpiod_if2<br>//&nbsp;./bb_spi_x_test<br><br>#include&nbsp;&lt;stdio.h&gt;<br><br>#include&nbsp;"pigpiod_if2.h"<br><br>#define&nbsp;CE0&nbsp;5<br>#define&nbsp;CE1&nbsp;6<br>#define&nbsp;MISO&nbsp;13<br>#define&nbsp;MOSI&nbsp;19<br>#define&nbsp;SCLK&nbsp;12<br><br>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;*argv[])<br>{<br>&nbsp;&nbsp;&nbsp;int&nbsp;i,&nbsp;pi,&nbsp;count,&nbsp;set_val,&nbsp;read_val;<br>&nbsp;&nbsp;&nbsp;unsigned&nbsp;char&nbsp;inBuf[3];<br>&nbsp;&nbsp;&nbsp;char&nbsp;cmd1[]&nbsp;=&nbsp;{0,&nbsp;0};<br>&nbsp;&nbsp;&nbsp;char&nbsp;cmd2[]&nbsp;=&nbsp;{12,&nbsp;0};<br>&nbsp;&nbsp;&nbsp;char&nbsp;cmd3[]&nbsp;=&nbsp;{1,&nbsp;128,&nbsp;0};<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;((pi&nbsp;=&nbsp;pigpio_start(0,&nbsp;0))&nbsp;&lt;&nbsp;0)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fprintf(stderr,&nbsp;"pigpio&nbsp;initialisation&nbsp;failed&nbsp;(%d).\n",&nbsp;pi);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;1;<br>&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;bb_spi_open(pi,&nbsp;CE0,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;10000,&nbsp;0);&nbsp;//&nbsp;MCP4251&nbsp;DAC<br>&nbsp;&nbsp;&nbsp;bb_spi_open(pi,&nbsp;CE1,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;20000,&nbsp;3);&nbsp;//&nbsp;MCP3008&nbsp;ADC<br><br>&nbsp;&nbsp;&nbsp;for&nbsp;(i=0;&nbsp;i&lt;256;&nbsp;i++)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cmd1[1]&nbsp;=&nbsp;i;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count&nbsp;=&nbsp;bb_spi_xfer(pi,&nbsp;CE0,&nbsp;cmd1,&nbsp;(char&nbsp;*)inBuf,&nbsp;2);&nbsp;//&nbsp;&gt;&nbsp;DAC<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(count&nbsp;==&nbsp;2)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count&nbsp;=&nbsp;bb_spi_xfer(pi,&nbsp;CE0,&nbsp;cmd2,&nbsp;(char&nbsp;*)inBuf,&nbsp;2);&nbsp;//&nbsp;&lt;&nbsp;DAC<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(count&nbsp;==&nbsp;2)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set_val&nbsp;=&nbsp;inBuf[1];<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count&nbsp;=&nbsp;bb_spi_xfer(pi,&nbsp;CE1,&nbsp;cmd3,&nbsp;(char&nbsp;*)inBuf,&nbsp;3);&nbsp;//&nbsp;&lt;&nbsp;ADC<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(count&nbsp;==&nbsp;3)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;read_val&nbsp;=&nbsp;((inBuf[1]&3)&lt;&lt;8)&nbsp;|&nbsp;inBuf[2];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("%d&nbsp;%d\n",&nbsp;set_val,&nbsp;read_val);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;bb_spi_close(pi,&nbsp;CE0);<br>&nbsp;&nbsp;&nbsp;bb_spi_close(pi,&nbsp;CE1);<br><br>&nbsp;&nbsp;&nbsp;pigpio_stop(pi);<br>}<br></code><h3><a name="spi_open"></a><a href="#int"><small>int</small></a> spi_open<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#spi_channel">spi_channel</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#spi_flags">spi_flags</a>)</small></h3>
-This function returns a handle for the SPI device on the channel.
-Data will be transferred at baud bits per second. The flags may
-be used to modify the default behaviour of 4-wire operation, mode 0,
-active low chip select.
-<br><br>The Pi has two SPI peripherals: main and auxiliary.
-<br><br>The main SPI has two chip selects (channels), the auxiliary has
-three.
-<br><br>The auxiliary SPI is available on all models but the A and B.
-<br><br>The GPIO used are given in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>MISO</td><td>MOSI</td><td>SCLK</td><td>CE0</td><td>CE1</td><td>CE2</td></tr><tr><td>Main SPI</td><td>9</td><td>10</td><td>11</td><td>8</td><td>7</td><td>-</td></tr><tr><td>Aux SPI</td><td>19</td><td>20</td><td>21</td><td>18</td><td>17</td><td>16</td></tr></tbody></table><br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>spi_channel:&nbsp;0-1&nbsp;(0-2&nbsp;for&nbsp;the&nbsp;auxiliary&nbsp;SPI).<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;32K-125M&nbsp;(values&nbsp;above&nbsp;30M&nbsp;are&nbsp;unlikely&nbsp;to&nbsp;work).<br>&nbsp;&nbsp;spi_flags:&nbsp;see&nbsp;below.<br></code><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_BAD_SPI_CHANNEL,
-PI_BAD_SPI_SPEED, PI_BAD_FLAGS, PI_NO_AUX_SPI, or PI_SPI_OPEN_FAILED.
-<br><br>spi_flags consists of the least significant 22 bits.
-<br><br><code>21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;W&nbsp;&nbsp;A&nbsp;u2&nbsp;u1&nbsp;u0&nbsp;p2&nbsp;p1&nbsp;p0&nbsp;&nbsp;m&nbsp;&nbsp;m<br></code><br><br>mm defines the SPI mode.
-<br><br>Warning: modes 1 and 3 do not appear to work on the auxiliary SPI.
-<br><br><code>Mode&nbsp;POL&nbsp;PHA<br>&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;0<br>&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;1<br>&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;0<br>&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;1<br></code><br><br>px is 0 if CEx is active low (default) and 1 for active high.
-<br><br>ux is 0 if the CEx GPIO is reserved for SPI (default) and 1 otherwise.
-<br><br>A is 0 for the main SPI, 1 for the auxiliary SPI.
-<br><br>W is 0 if the device is not 3-wire, 1 if the device is 3-wire. Main
-SPI only.
-<br><br>nnnn defines the number of bytes (0-15) to write before switching
-the MOSI line to MISO to read data. This field is ignored
-if W is not set. Main SPI only.
-<br><br>T is 1 if the least significant bit is transmitted on MOSI first, the
-default (0) shifts the most significant bit out first. Auxiliary SPI
-only.
-<br><br>R is 1 if the least significant bit is received on MISO first, the
-default (0) receives the most significant bit first. Auxiliary SPI
-only.
-<br><br>bbbbbb defines the word size in bits (0-32). The default (0)
-sets 8 bits per word. Auxiliary SPI only.
-<br><br>The <a href="#spi_read">spi_read</a>, <a href="#spi_write">spi_write</a>, and <a href="#spi_xfer">spi_xfer</a> functions
-transfer data packed into 1, 2, or 4 bytes according to
-the word size in bits.
-<br><br>For bits 1-8 there will be one byte per character.<br>
-For bits 9-16 there will be two bytes per character.<br>
-For bits 17-32 there will be four bytes per character.
-<br><br>Multi-byte transfers are made in least significant byte first order.
-<br><br>E.g. to transfer 32 11-bit words buf should contain 64 bytes
-and count should be 64.
-<br><br>E.g. to transfer the 14 bit value 0x1ABC send the bytes 0xBC followed
-by 0x1A.
-<br><br>The other bits in flags should be set to zero.
-<h3><a name="spi_close"></a><a href="#int"><small>int</small></a> spi_close<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This functions closes the SPI device identified by the handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<h3><a name="spi_read"></a><a href="#int"><small>int</small></a> spi_read<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function reads count bytes of data from the SPI
-device associated with the handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data&nbsp;bytes.<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></code><br><br>Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-<h3><a name="spi_write"></a><a href="#int"><small>int</small></a> spi_write<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function writes count bytes of data from buf to the SPI
-device associated with the handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;data&nbsp;bytes&nbsp;to&nbsp;write.<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-<h3><a name="spi_xfer"></a><a href="#int"><small>int</small></a> spi_xfer<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*txBuf">*txBuf</a>, <a href="#char">char</a> <a href="#*rxBuf">*rxBuf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function transfers count bytes of data from txBuf to the SPI
-device associated with the handle. Simultaneously count bytes of
-data are read from the device and placed in rxBuf.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>.<br>&nbsp;txBuf:&nbsp;the&nbsp;data&nbsp;bytes&nbsp;to&nbsp;write.<br>&nbsp;rxBuf:&nbsp;the&nbsp;received&nbsp;data&nbsp;bytes.<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;transfer.<br></code><br><br>Returns the number of bytes transferred if OK, otherwise
-PI_BAD_HANDLE, PI_BAD_SPI_COUNT, or PI_SPI_XFER_FAILED.
-<h3><a name="serial_open"></a><a href="#int"><small>int</small></a> serial_open<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#char">char</a> <a href="#*ser_tty">*ser_tty</a>, <a href="#unsigned">unsigned</a> <a href="#baud">baud</a>, <a href="#unsigned">unsigned</a> <a href="#ser_flags">ser_flags</a>)</small></h3>
-This function opens a serial device at a specified baud rate
-with specified flags. The device name must start with
-/dev/tty or /dev/serial.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;ser_tty:&nbsp;the&nbsp;serial&nbsp;device&nbsp;to&nbsp;open.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:&nbsp;the&nbsp;baud&nbsp;rate&nbsp;in&nbsp;bits&nbsp;per&nbsp;second,&nbsp;see&nbsp;below.<br>ser_flags:&nbsp;0.<br></code><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_NO_HANDLE, or
-PI_SER_OPEN_FAILED.
-<br><br>The baud rate must be one of 50, 75, 110, 134, 150,
-200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
-38400, 57600, 115200, or 230400.
-<br><br>No flags are currently defined. This parameter should be set to zero.
-<h3><a name="serial_close"></a><a href="#int"><small>int</small></a> serial_close<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This function closes the serial device associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<h3><a name="serial_write_byte"></a><a href="#int"><small>int</small></a> serial_write_byte<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#unsigned">unsigned</a> <a href="#bVal">bVal</a>)</small></h3>
-This function writes bVal to the serial port associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_SER_WRITE_FAILED.
-<h3><a name="serial_read_byte"></a><a href="#int"><small>int</small></a> serial_read_byte<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This function reads a byte from the serial port associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br></code><br><br>Returns the read byte (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_SER_READ_NO_DATA, or PI_SER_READ_FAILED.
-<br><br>If no data is ready PI_SER_READ_NO_DATA is returned.
-<h3><a name="serial_write"></a><a href="#int"><small>int</small></a> serial_write<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function writes count bytes from buf to the the serial port
-associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;array&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, or
-PI_SER_WRITE_FAILED.
-<h3><a name="serial_read"></a><a href="#int"><small>int</small></a> serial_read<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function reads up to count bytes from the the serial port
-associated with handle and writes them to buf.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data.<br>&nbsp;count:&nbsp;the&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></code><br><br>Returns the number of bytes read (&gt;=0) if OK, otherwise PI_BAD_HANDLE,
-PI_BAD_PARAM, PI_SER_READ_NO_DATA, or PI_SER_WRITE_FAILED.
-<br><br>If no data is ready zero is returned.
-<h3><a name="serial_data_available"></a><a href="#int"><small>int</small></a> serial_data_available<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-Returns the number of bytes available to be read from the
-device associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>.<br></code><br><br>Returns the number of bytes of data available (&gt;=0) if OK,
-otherwise PI_BAD_HANDLE.
-<h3><a name="custom_1"></a><a href="#int"><small>int</small></a> custom_1<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#arg1">arg1</a>, <a href="#unsigned">unsigned</a> <a href="#arg2">arg2</a>, <a href="#char">char</a> <a href="#*argx">*argx</a>, <a href="#unsigned">unsigned</a> <a href="#argc">argc</a>)</small></h3>
-This function is available for user customisation.
-<br><br>It returns a single integer value.
-<br><br><code>&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>arg1:&nbsp;&gt;=0<br>arg2:&nbsp;&gt;=0<br>argx:&nbsp;extra&nbsp;(byte)&nbsp;arguments<br>argc:&nbsp;number&nbsp;of&nbsp;extra&nbsp;arguments<br></code><br><br>Returns &gt;= 0 if OK, less than 0 indicates a user defined error.
-<h3><a name="custom_2"></a><a href="#int"><small>int</small></a> custom_2<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#arg1">arg1</a>, <a href="#char">char</a> <a href="#*argx">*argx</a>, <a href="#unsigned">unsigned</a> <a href="#argc">argc</a>, <a href="#char">char</a> <a href="#*retBuf">*retBuf</a>, <a href="#unsigned">unsigned</a> <a href="#retMax">retMax</a>)</small></h3>
-This function is available for user customisation.
-<br><br>It differs from custom_1 in that it returns an array of bytes
-rather than just an integer.
-<br><br>The return value is an integer indicating the number of returned bytes.
-<code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;arg1:&nbsp;&gt;=0<br>&nbsp;&nbsp;argc:&nbsp;extra&nbsp;(byte)&nbsp;arguments<br>&nbsp;count:&nbsp;number&nbsp;of&nbsp;extra&nbsp;arguments<br>retBuf:&nbsp;buffer&nbsp;for&nbsp;returned&nbsp;data<br>retMax:&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;return<br></code><br><br>Returns &gt;= 0 if OK, less than 0 indicates a user defined error.
-<br><br>Note, the number of returned bytes will be retMax or less.
-<h3><a name="get_pad_strength"></a><a href="#int"><small>int</small></a> get_pad_strength<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#pad">pad</a>)</small></h3>
-This function returns the pad drive strength in mA.
-<br><br><code>&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>pad:&nbsp;0-2,&nbsp;the&nbsp;pad&nbsp;to&nbsp;get.<br></code><br><br>Returns the pad drive strength if OK, otherwise PI_BAD_PAD.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>strength&nbsp;=&nbsp;get_pad_strength(pi,&nbsp;0);&nbsp;//&nbsp;&nbsp;get&nbsp;pad&nbsp;0&nbsp;strength<br></code><h3><a name="set_pad_strength"></a><a href="#int"><small>int</small></a> set_pad_strength<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#pad">pad</a>, <a href="#unsigned">unsigned</a> <a href="#padStrength">padStrength</a>)</small></h3>
-This function sets the pad drive strength in mA.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pad:&nbsp;0-2,&nbsp;the&nbsp;pad&nbsp;to&nbsp;set.<br>padStrength:&nbsp;1-16&nbsp;mA.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_PAD, or PI_BAD_STRENGTH.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>set_pad_strength(pi,&nbsp;0,&nbsp;10);&nbsp;//&nbsp;set&nbsp;pad&nbsp;0&nbsp;strength&nbsp;to&nbsp;10&nbsp;mA<br></code><h3><a name="shell_"></a><a href="#int"><small>int</small></a> shell_<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#char">char</a> <a href="#*scriptName">*scriptName</a>, <a href="#char">char</a> <a href="#*scriptString">*scriptString</a>)</small></h3>
-This function uses the system call to execute a shell script
-with the given string as its parameter.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;scriptName:&nbsp;the&nbsp;name&nbsp;of&nbsp;the&nbsp;script,&nbsp;only&nbsp;alphanumeric&nbsp;characters,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'-'&nbsp;and&nbsp;'_'&nbsp;are&nbsp;allowed&nbsp;in&nbsp;the&nbsp;name.<br>scriptString:&nbsp;the&nbsp;string&nbsp;to&nbsp;pass&nbsp;to&nbsp;the&nbsp;script.<br></code><br><br>The exit status of the system call is returned if OK, otherwise
-PI_BAD_SHELL_STATUS.
-<br><br>scriptName must exist in /opt/pigpio/cgi and must be executable.
-<br><br>The returned exit status is normally 256 times that set by the
-shell script exit function. If the script can't be found 32512 will
-be returned.
-<br><br>The following table gives some example returned statuses.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Script exit status</td><td>Returned system call status</td></tr><tr><td>1</td><td>256</td></tr><tr><td>5</td><td>1280</td></tr><tr><td>10</td><td>2560</td></tr><tr><td>200</td><td>51200</td></tr><tr><td>script not found</td><td>32512</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>//&nbsp;pass&nbsp;two&nbsp;parameters,&nbsp;hello&nbsp;and&nbsp;world<br>status&nbsp;=&nbsp;shell_(pi,&nbsp;"scr1",&nbsp;"hello&nbsp;world");<br><br>//&nbsp;pass&nbsp;three&nbsp;parameters,&nbsp;hello,&nbsp;string&nbsp;with&nbsp;spaces,&nbsp;and&nbsp;world<br>status&nbsp;=&nbsp;shell_(pi,&nbsp;"scr1",&nbsp;"hello&nbsp;'string&nbsp;with&nbsp;spaces'&nbsp;world");<br><br>//&nbsp;pass&nbsp;one&nbsp;parameter,&nbsp;hello&nbsp;string&nbsp;with&nbsp;spaces&nbsp;world<br>status&nbsp;=&nbsp;shell_(pi,&nbsp;"scr1",&nbsp;"\"hello&nbsp;string&nbsp;with&nbsp;spaces&nbsp;world\"");<br></code><h3><a name="file_open"></a><a href="#int"><small>int</small></a> file_open<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#char">char</a> <a href="#*file">*file</a>, <a href="#unsigned">unsigned</a> <a href="#mode">mode</a>)</small></h3>
-This function returns a handle to a file opened in a specified mode.
-<br><br><code>&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>file:&nbsp;the&nbsp;file&nbsp;to&nbsp;open.<br>mode:&nbsp;the&nbsp;file&nbsp;open&nbsp;mode.<br></code><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_NO_HANDLE, PI_NO_FILE_ACCESS,
-PI_BAD_FILE_MODE, PI_FILE_OPEN_FAILED, or PI_FILE_IS_A_DIR.
-<br><br>File
-<br><br>A file may only be opened if permission is granted by an entry in
-/opt/pigpio/access. This is intended to allow remote access to files
-in a more or less controlled manner.
-<br><br>Each entry in /opt/pigpio/access takes the form of a file path
-which may contain wildcards followed by a single letter permission.
-The permission may be R for read, W for write, U for read/write,
-and N for no access.
-<br><br>Where more than one entry matches a file the most specific rule
-applies. If no entry matches a file then access is denied.
-<br><br>Suppose /opt/pigpio/access contains the following entries
-<br><br><code>/home/*&nbsp;n<br>/home/pi/shared/dir_1/*&nbsp;w<br>/home/pi/shared/dir_2/*&nbsp;r<br>/home/pi/shared/dir_3/*&nbsp;u<br>/home/pi/shared/dir_1/file.txt&nbsp;n<br></code><br><br>Files may be written in directory dir_1 with the exception
-of file.txt.
-<br><br>Files may be read in directory dir_2.
-<br><br>Files may be read and written in directory dir_3.
-<br><br>If a directory allows read, write, or read/write access then files may
-be created in that directory.
-<br><br>In an attempt to prevent risky permissions the following paths are
-ignored in /opt/pigpio/access.
-<br><br><code>a&nbsp;path&nbsp;containing&nbsp;..<br>a&nbsp;path&nbsp;containing&nbsp;only&nbsp;wildcards&nbsp;(*?)<br>a&nbsp;path&nbsp;containing&nbsp;less&nbsp;than&nbsp;two&nbsp;non-wildcard&nbsp;parts<br></code><br><br>Mode
-<br><br>The mode may have the following values.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Macro</td><td>Value</td><td>Meaning</td></tr><tr><td>PI_FILE_READ</td><td>1</td><td>open file for reading</td></tr><tr><td>PI_FILE_WRITE</td><td>2</td><td>open file for writing</td></tr><tr><td>PI_FILE_RW</td><td>3</td><td>open file for reading and writing</td></tr></tbody></table><br><br>The following values may be or'd into the mode.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Macro</td><td>Value</td><td>Meaning</td></tr><tr><td>PI_FILE_APPEND</td><td>4</td><td>Writes append data to the end of the file</td></tr><tr><td>PI_FILE_CREATE</td><td>8</td><td>The file is created if it doesn't exist</td></tr><tr><td>PI_FILE_TRUNC</td><td>16</td><td>The file is truncated</td></tr></tbody></table><br><br>Newly created files are owned by root with permissions owner read and write.
-<br><br><b><small>Example</small></b><br><br><code>#include&nbsp;&lt;stdio.h&gt;<br>#include&nbsp;&lt;pigpiod_if2.h&gt;<br><br>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;*argv[])<br>{<br>&nbsp;&nbsp;&nbsp;int&nbsp;pi,&nbsp;handle,&nbsp;c;<br>&nbsp;&nbsp;&nbsp;char&nbsp;buf[60000];<br><br>&nbsp;&nbsp;&nbsp;pi&nbsp;=&nbsp;pigpio_start(NULL,&nbsp;NULL);<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(pi&nbsp;&lt;&nbsp;0)&nbsp;return&nbsp;1;<br><br>&nbsp;&nbsp;&nbsp;//&nbsp;assumes&nbsp;/opt/pigpio/access&nbsp;contains&nbsp;the&nbsp;following&nbsp;line<br>&nbsp;&nbsp;&nbsp;//&nbsp;/ram/*.c&nbsp;r<br><br>&nbsp;&nbsp;&nbsp;handle&nbsp;=&nbsp;file_open(pi,&nbsp;"/ram/pigpio.c",&nbsp;PI_FILE_READ);<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(handle&nbsp;&gt;=&nbsp;0)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;((c=file_read(pi,&nbsp;handle,&nbsp;buf,&nbsp;sizeof(buf)-1)))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf[c]&nbsp;=&nbsp;0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("%s",&nbsp;buf);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;file_close(pi,&nbsp;handle);<br>&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;pigpio_stop(pi);<br>}<br></code><h3><a name="file_close"></a><a href="#int"><small>int</small></a> file_close<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>)</small></h3>
-This function closes the file associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#file_open">file_open</a>).<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE.
-<br><br><b><small>Example</small></b><br><br><code>file_close(pi,&nbsp;handle);<br></code><h3><a name="file_write"></a><a href="#int"><small>int</small></a> file_write<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function writes count bytes from buf to the the file
-associated with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#file_open">file_open</a>).<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;the&nbsp;array&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br>&nbsp;count:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;write.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM,
-PI_FILE_NOT_WOPEN, or PI_BAD_FILE_WRITE.
-<br><br><b><small>Example</small></b><br><br><code>if&nbsp;(file_write(pi,&nbsp;handle,&nbsp;buf,&nbsp;100)&nbsp;==&nbsp;0)<br>{<br>&nbsp;&nbsp;&nbsp;//&nbsp;file&nbsp;written&nbsp;okay<br>}<br>else<br>{<br>&nbsp;&nbsp;&nbsp;//&nbsp;error<br>}<br></code><h3><a name="file_read"></a><a href="#int"><small>int</small></a> file_read<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function reads up to count bytes from the the file
-associated with handle and writes them to buf.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>handle:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#file_open">file_open</a>).<br>&nbsp;&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;read&nbsp;data.<br>&nbsp;count:&nbsp;the&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></code><br><br>Returns the number of bytes read (&gt;0) if OK, otherwise PI_BAD_HANDLE, PI_BAD_PARAM, PI_FILE_NOT_ROPEN, or PI_BAD_FILE_WRITE.
-<br><br><b><small>Example</small></b><br><br><code>&nbsp;&nbsp;&nbsp;bytes&nbsp;=&nbsp;file_read(pi,&nbsp;handle,&nbsp;buf,&nbsp;sizeof(buf));<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(bytes&nbsp;&gt;=&nbsp;0)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;process&nbsp;read&nbsp;data<br>&nbsp;&nbsp;&nbsp;}<br></code><h3><a name="file_seek"></a><a href="#int"><small>int</small></a> file_seek<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#handle">handle</a>, <a href="#int32_t">int32_t</a> <a href="#seekOffset">seekOffset</a>, <a href="#int">int</a> <a href="#seekFrom">seekFrom</a>)</small></h3>
-This function seeks to a position within the file associated
-with handle.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;&nbsp;&nbsp;handle:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#file_open">file_open</a>).<br>seekOffset:&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;move.&nbsp;&nbsp;Positive&nbsp;offsets<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;move&nbsp;forward,&nbsp;negative&nbsp;offsets&nbsp;backwards.<br>&nbsp;&nbsp;seekFrom:&nbsp;one&nbsp;of&nbsp;PI_FROM_START&nbsp;(0),&nbsp;PI_FROM_CURRENT&nbsp;(1),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or&nbsp;PI_FROM_END&nbsp;(2).<br></code><br><br>Returns the new byte position within the file (&gt;=0) if OK, otherwise PI_BAD_HANDLE, or PI_BAD_FILE_SEEK.
-<br><br><b><small>Example</small></b><br><br><code>file_seek(pi,&nbsp;handle,&nbsp;123,&nbsp;PI_FROM_START);&nbsp;//&nbsp;Start&nbsp;plus&nbsp;123<br><br>size&nbsp;=&nbsp;file_seek(pi,&nbsp;handle,&nbsp;0,&nbsp;PI_FROM_END);&nbsp;//&nbsp;End,&nbsp;return&nbsp;size<br><br>pos&nbsp;=&nbsp;file_seek(pi,&nbsp;handle,&nbsp;0,&nbsp;PI_FROM_CURRENT);&nbsp;//&nbsp;Current&nbsp;position<br></code><h3><a name="file_list"></a><a href="#int"><small>int</small></a> file_list<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#char">char</a> <a href="#*fpat">*fpat</a>, <a href="#char">char</a> <a href="#*buf">*buf</a>, <a href="#unsigned">unsigned</a> <a href="#count">count</a>)</small></h3>
-This function returns a list of files which match a pattern.
-<br><br><code>&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;fpat:&nbsp;file&nbsp;pattern&nbsp;to&nbsp;match.<br>&nbsp;&nbsp;buf:&nbsp;an&nbsp;array&nbsp;to&nbsp;receive&nbsp;the&nbsp;matching&nbsp;file&nbsp;names.<br>count:&nbsp;the&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></code><br><br>Returns the number of returned bytes if OK, otherwise PI_NO_FILE_ACCESS,
-or PI_NO_FILE_MATCH.
-<br><br>The pattern must match an entry in /opt/pigpio/access. The pattern
-may contain wildcards. See <a href="#file_open">file_open</a>.
-<br><br>NOTE
-<br><br>The returned value is not the number of files, it is the number
-of bytes in the buffer. The file names are separated by newline
-characters.
-<br><br><b><small>Example</small></b><br><br><code>#include&nbsp;&lt;stdio.h&gt;<br>#include&nbsp;&lt;pigpiod_if2.h&gt;<br><br>int&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;*argv[])<br>{<br>&nbsp;&nbsp;&nbsp;int&nbsp;pi,&nbsp;handle,&nbsp;c;<br>&nbsp;&nbsp;&nbsp;char&nbsp;buf[60000];<br><br>&nbsp;&nbsp;&nbsp;pi&nbsp;=&nbsp;pigpio_start(NULL,&nbsp;NULL);<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(pi&nbsp;&lt;&nbsp;0)&nbsp;return&nbsp;1;<br><br>&nbsp;&nbsp;&nbsp;//&nbsp;assumes&nbsp;/opt/pigpio/access&nbsp;contains&nbsp;the&nbsp;following&nbsp;line<br>&nbsp;&nbsp;&nbsp;//&nbsp;/ram/*.c&nbsp;r<br><br>&nbsp;&nbsp;&nbsp;c&nbsp;=&nbsp;file_list(pi,&nbsp;"/ram/p*.c",&nbsp;buf,&nbsp;sizeof(buf));<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;(c&nbsp;&gt;=&nbsp;0)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf[c]&nbsp;=&nbsp;0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("%s",&nbsp;buf);<br>&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;pigpio_stop(pi);<br>}<br></code><h3><a name="callback"></a><a href="#int"><small>int</small></a> callback<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#edge">edge</a>, <a href="#CBFunc_t">CBFunc_t</a> <a href="#f">f</a>)</small></h3>
-This function initialises a new callback.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edge:&nbsp;RISING_EDGE,&nbsp;FALLING_EDGE,&nbsp;or&nbsp;EITHER_EDGE.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function.<br></code><br><br>The function returns a callback id if OK, otherwise pigif_bad_malloc,
-pigif_duplicate_callback, or pigif_bad_callback.
-<br><br>The callback is called with the GPIO, edge, and tick, whenever the
-GPIO has the identified edge.
-<br><br><code>Parameter&nbsp;&nbsp;&nbsp;Value&nbsp;&nbsp;&nbsp;&nbsp;Meaning<br><br>GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-31&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;GPIO&nbsp;which&nbsp;has&nbsp;changed&nbsp;state<br><br>edge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;=&nbsp;change&nbsp;to&nbsp;low&nbsp;(a&nbsp;falling&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&nbsp;change&nbsp;to&nbsp;high&nbsp;(a&nbsp;rising&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;=&nbsp;no&nbsp;level&nbsp;change&nbsp;(a&nbsp;watchdog&nbsp;timeout)<br><br>tick&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32&nbsp;bit&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;microseconds&nbsp;since&nbsp;boot<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WARNING:&nbsp;this&nbsp;wraps&nbsp;around&nbsp;from<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4294967295&nbsp;to&nbsp;0&nbsp;roughly&nbsp;every&nbsp;72&nbsp;minutes<br></code><br><br>The GPIO are sampled at a rate set when the pigpio daemon
-is started (default 5 us).
-<br><br>The number of samples per second is given in the following table.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;samples<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;per&nbsp;sec<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;1,000,000<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;500,000<br>sample&nbsp;&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;250,000<br>rate&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;200,000<br>(us)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8&nbsp;&nbsp;&nbsp;&nbsp;125,000<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;100,000<br></code><br><br>GPIO level changes shorter than the sample rate may be missed.
-<br><br>The daemon software which generates the callbacks is triggered
-1000 times per second. The callbacks will be called once per
-level change since the last time they were called.
-i.e. The callbacks will get all level changes but there will
-be a latency.
-<br><br>If you want to track the level of more than one GPIO do so by
-maintaining the state in the callback. Do not use <a href="#gpio_read">gpio_read</a>.
-Remember the event that triggered the callback may have
-happened several milliseconds before and the GPIO may have
-changed level many times since then.
-<h3><a name="callback_ex"></a><a href="#int"><small>int</small></a> callback_ex<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#edge">edge</a>, <a href="#CBFuncEx_t">CBFuncEx_t</a> <a href="#f">f</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-This function initialises a new callback.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edge:&nbsp;RISING_EDGE,&nbsp;FALLING_EDGE,&nbsp;or&nbsp;EITHER_EDGE.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function.<br>&nbsp;userdata:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;arbitrary&nbsp;user&nbsp;data.<br></code><br><br>The function returns a callback id if OK, otherwise pigif_bad_malloc,
-pigif_duplicate_callback, or pigif_bad_callback.
-<br><br>The callback is called with the GPIO, edge, tick, and the userdata
-pointer, whenever the GPIO has the identified edge.
-<br><br><code>Parameter&nbsp;&nbsp;&nbsp;Value&nbsp;&nbsp;&nbsp;&nbsp;Meaning<br><br>GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-31&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;GPIO&nbsp;which&nbsp;has&nbsp;changed&nbsp;state<br><br>edge&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;=&nbsp;change&nbsp;to&nbsp;low&nbsp;(a&nbsp;falling&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&nbsp;change&nbsp;to&nbsp;high&nbsp;(a&nbsp;rising&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;=&nbsp;no&nbsp;level&nbsp;change&nbsp;(a&nbsp;watchdog&nbsp;timeout)<br><br>tick&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32&nbsp;bit&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;microseconds&nbsp;since&nbsp;boot<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WARNING:&nbsp;this&nbsp;wraps&nbsp;around&nbsp;from<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4294967295&nbsp;to&nbsp;0&nbsp;roughly&nbsp;every&nbsp;72&nbsp;minutes<br><br>userdata&nbsp;&nbsp;&nbsp;&nbsp;pointer&nbsp;&nbsp;Pointer&nbsp;to&nbsp;an&nbsp;arbitrary&nbsp;object<br></code><h3><a name="callback_cancel"></a><a href="#int"><small>int</small></a> callback_cancel<small>(<a href="#unsigned">unsigned</a> <a href="#callback_id">callback_id</a>)</small></h3>
-This function cancels a callback identified by its id.
-<br><br><code>callback_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#callback">callback</a>&nbsp;or&nbsp;<a href="#callback_ex">callback_ex</a>.<br></code><br><br>The function returns 0 if OK, otherwise pigif_callback_not_found.
-<h3><a name="wait_for_edge"></a><a href="#int"><small>int</small></a> wait_for_edge<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#user_gpio">user_gpio</a>, <a href="#unsigned">unsigned</a> <a href="#edge">edge</a>, <a href="#double">double</a> <a href="#timeout">timeout</a>)</small></h3>
-This function waits for an edge on the GPIO for up to timeout
-seconds.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>user_gpio:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edge:&nbsp;RISING_EDGE,&nbsp;FALLING_EDGE,&nbsp;or&nbsp;EITHER_EDGE.<br>&nbsp;&nbsp;timeout:&nbsp;&gt;=0.<br></code><br><br>The function returns when the edge occurs or after the timeout.
-<br><br>Do not use this function for precise timing purposes,
-the edge is only checked 20 times a second. Whenever
-you need to know the accurate time of GPIO events use
-a <a href="#callback">callback</a> function.
-<br><br>The function returns 1 if the edge occurred, otherwise 0.
-<h3><a name="bsc_xfer"></a><a href="#int"><small>int</small></a> bsc_xfer<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#bsc_xfer_t">bsc_xfer_t</a> <a href="#*bscxfer">*bscxfer</a>)</small></h3>
-This function provides a low-level interface to the SPI/I2C Slave
-peripheral on the BCM chip.
-<br><br>This peripheral allows the Pi to act as a hardware slave device
-on an I2C or SPI bus.
-<br><br>This is not a bit bang version and as such is OS timing
-independent. The bus timing is handled directly by the chip.
-<br><br>The output process is simple. You simply append data to the FIFO
-buffer on the chip. This works like a queue, you add data to the
-queue and the master removes it.
-<br><br>I can't get SPI to work properly. I tried with a
-control word of 0x303 and swapped MISO and MOSI.
-<br><br>The function sets the BSC mode, writes any data in
-the transmit buffer to the BSC transmit FIFO, and
-copies any data in the BSC receive FIFO to the
-receive buffer.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>bscxfer:&nbsp;a&nbsp;structure&nbsp;defining&nbsp;the&nbsp;transfer.<br><br>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;control;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Write<br>&nbsp;&nbsp;&nbsp;int&nbsp;rxCnt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Read&nbsp;only<br>&nbsp;&nbsp;&nbsp;char&nbsp;rxBuf[BSC_FIFO_SIZE];&nbsp;//&nbsp;Read&nbsp;only<br>&nbsp;&nbsp;&nbsp;int&nbsp;txCnt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Write<br>&nbsp;&nbsp;&nbsp;char&nbsp;txBuf[BSC_FIFO_SIZE];&nbsp;//&nbsp;Write<br>}&nbsp;bsc_xfer_t;<br></code><br><br>To start a transfer set control (see below), copy the bytes to
-be added to the transmit FIFO (if any) to txBuf and set txCnt to
-the number of copied bytes.
-<br><br>Upon return rxCnt will be set to the number of received bytes placed
-in rxBuf.
-<br><br>The returned function value is the status of the transfer (see below).
-<br><br>If there was an error the status will be less than zero
-(and will contain the error code).
-<br><br>The most significant word of the returned status contains the number
-of bytes actually copied from txBuf to the BSC transmit FIFO (may be
-less than requested if the FIFO already contained untransmitted data).
-<br><br>Note that the control word sets the BSC mode. The BSC will stay in
-that mode until a different control word is sent.
-<br><br>GPIO used for models other than those based on the BCM2711.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td><td>MOSI</td><td>SCLK</td><td>MISO</td><td>CE</td></tr><tr><td>I2C</td><td>18</td><td>19</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>SPI</td><td>-</td><td>-</td><td>18</td><td>19</td><td>20</td><td>21</td></tr></tbody></table><br><br>GPIO used for models based on the BCM2711 (e.g. the Pi4B).
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td><td>MOSI</td><td>SCLK</td><td>MISO</td><td>CE</td></tr><tr><td>I2C</td><td>10</td><td>11</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>SPI</td><td>-</td><td>-</td><td>10</td><td>11</td><td>9</td><td>8</td></tr></tbody></table><br><br>When a zero control word is received the used GPIO will be reset
-to INPUT mode.
-<br><br>control consists of the following bits.
-<br><br><code>22&nbsp;21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;IT&nbsp;HC&nbsp;TF&nbsp;IR&nbsp;RE&nbsp;TE&nbsp;BK&nbsp;EC&nbsp;ES&nbsp;PL&nbsp;PH&nbsp;I2&nbsp;SP&nbsp;EN<br></code><br><br>Bits 0-13 are copied unchanged to the BSC CR register. See
-pages 163-165 of the Broadcom peripherals document for full
-details.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>aaaaaaa</td><td>defines the I2C slave address (only relevant in I2C mode)</td></tr><tr><td>IT</td><td>invert transmit status flags</td></tr><tr><td>HC</td><td>enable host control</td></tr><tr><td>TF</td><td>enable test FIFO</td></tr><tr><td>IR</td><td>invert receive status flags</td></tr><tr><td>RE</td><td>enable receive</td></tr><tr><td>TE</td><td>enable transmit</td></tr><tr><td>BK</td><td>abort operation and clear FIFOs</td></tr><tr><td>EC</td><td>send control register as first I2C byte</td></tr><tr><td>ES</td><td>send status register as first I2C byte</td></tr><tr><td>PL</td><td>set SPI polarity high</td></tr><tr><td>PH</td><td>set SPI phase high</td></tr><tr><td>I2</td><td>enable I2C mode</td></tr><tr><td>SP</td><td>enable SPI mode</td></tr><tr><td>EN</td><td>enable BSC peripheral</td></tr></tbody></table><br><br>The returned status has the following format
-<br><br><code>20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;RB&nbsp;TE&nbsp;RF&nbsp;TF&nbsp;RE&nbsp;TB<br></code><br><br>Bits 0-15 are copied unchanged from the BSC FR register. See
-pages 165-166 of the Broadcom peripherals document for full
-details.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>SSSSS</td><td>number of bytes successfully copied to transmit FIFO</td></tr><tr><td>RRRRR</td><td>number of bytes in receieve FIFO</td></tr><tr><td>TTTTT</td><td>number of bytes in transmit FIFO</td></tr><tr><td>RB</td><td>receive busy</td></tr><tr><td>TE</td><td>transmit FIFO empty</td></tr><tr><td>RF</td><td>receive FIFO full</td></tr><tr><td>TF</td><td>transmit FIFO full</td></tr><tr><td>RE</td><td>receive FIFO empty</td></tr><tr><td>TB</td><td>transmit busy</td></tr></tbody></table><br><br>The following example shows how to configure the BSC peripheral as
-an I2C slave with address 0x13 and send four bytes.
-<br><br><b><small>Example</small></b><br><br><code>bsc_xfer_t&nbsp;xfer;<br><br>xfer.control&nbsp;=&nbsp;(0x13&lt;&lt;16)&nbsp;|&nbsp;0x305;<br><br>memcpy(xfer.txBuf,&nbsp;"ABCD",&nbsp;4);<br>xfer.txCnt&nbsp;=&nbsp;4;<br><br>status&nbsp;=&nbsp;bsc_xfer(pi,&nbsp;&xfer);<br><br>if&nbsp;(status&nbsp;&gt;=&nbsp;0)<br>{<br>&nbsp;&nbsp;&nbsp;//&nbsp;process&nbsp;transfer<br>}<br></code><h3><a name="bsc_i2c"></a><a href="#int"><small>int</small></a> bsc_i2c<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#int">int</a> <a href="#i2c_addr">i2c_addr</a>, <a href="#bsc_xfer_t">bsc_xfer_t</a> <a href="#*bscxfer">*bscxfer</a>)</small></h3>
-This function allows the Pi to act as a slave I2C device.
-<br><br>This function is not available on the BCM2711 (e.g.as
-used in the Pi4B).
-<br><br>The data bytes (if any) are written to the BSC transmit
-FIFO and the bytes in the BSC receive FIFO are returned.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>i2c_addr:&nbsp;0-0x7F.<br>&nbsp;bscxfer:&nbsp;a&nbsp;structure&nbsp;defining&nbsp;the&nbsp;transfer.<br><br>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;control;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;N/A<br>&nbsp;&nbsp;&nbsp;int&nbsp;rxCnt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Read&nbsp;only<br>&nbsp;&nbsp;&nbsp;char&nbsp;rxBuf[BSC_FIFO_SIZE];&nbsp;//&nbsp;Read&nbsp;only<br>&nbsp;&nbsp;&nbsp;int&nbsp;txCnt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Write<br>&nbsp;&nbsp;&nbsp;char&nbsp;txBuf[BSC_FIFO_SIZE];&nbsp;//&nbsp;Write<br>}&nbsp;bsc_xfer_t;<br></code><br><br>txCnt is set to the number of bytes to be transmitted, possibly
-zero. The data itself should be copied to txBuf.
-<br><br>Any received data will be written to rxBuf with rxCnt set.
-<br><br>See <a href="#bsc_xfer">bsc_xfer</a> for details of the returned status value.
-<br><br>If there was an error the status will be less than zero
-(and will contain the error code).
-<br><br>Note that an i2c_address of 0 may be used to close
-the BSC device and reassign the used GPIO as inputs.
-<h3><a name="event_callback"></a><a href="#int"><small>int</small></a> event_callback<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#event">event</a>, <a href="#evtCBFunc_t">evtCBFunc_t</a> <a href="#f">f</a>)</small></h3>
-This function initialises an event callback.
-<br><br><code>&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>event:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function.<br></code><br><br>The function returns a callback id if OK, otherwise pigif_bad_malloc,
-pigif_duplicate_callback, or pigif_bad_callback.
-<br><br>The callback is called with the event id, and tick, whenever the
-event occurs.
-<h3><a name="event_callback_ex"></a><a href="#int"><small>int</small></a> event_callback_ex<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#event">event</a>, <a href="#evtCBFuncEx_t">evtCBFuncEx_t</a> <a href="#f">f</a>, <a href="#void">void</a> <a href="#*userdata">*userdata</a>)</small></h3>
-This function initialises an event callback.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;&nbsp;event:&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f:&nbsp;the&nbsp;callback&nbsp;function.<br>userdata:&nbsp;a&nbsp;pointer&nbsp;to&nbsp;arbitrary&nbsp;user&nbsp;data.<br></code><br><br>The function returns a callback id if OK, otherwise pigif_bad_malloc,
-pigif_duplicate_callback, or pigif_bad_callback.
-<br><br>The callback is called with the event id, the tick, and the userdata
-pointer whenever the event occurs.
-<h3><a name="event_callback_cancel"></a><a href="#int"><small>int</small></a> event_callback_cancel<small>(<a href="#unsigned">unsigned</a> <a href="#callback_id">callback_id</a>)</small></h3>
-This function cancels an event callback identified by its id.
-<br><br><code>callback_id:&nbsp;&gt;=0,&nbsp;as&nbsp;returned&nbsp;by&nbsp;a&nbsp;call&nbsp;to&nbsp;<a href="#event_callback">event_callback</a>&nbsp;or<br><a href="#event_callback_ex">event_callback_ex</a>.<br></code><br><br>The function returns 0 if OK, otherwise pigif_callback_not_found.
-<h3><a name="wait_for_event"></a><a href="#int"><small>int</small></a> wait_for_event<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#event">event</a>, <a href="#double">double</a> <a href="#timeout">timeout</a>)</small></h3>
-This function waits for an event for up to timeout seconds.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>&nbsp;&nbsp;event:&nbsp;0-31.<br>timeout:&nbsp;&gt;=0.<br></code><br><br>The function returns when the event occurs or after the timeout.
-<br><br>The function returns 1 if the event occurred, otherwise 0.
-<h3><a name="event_trigger"></a><a href="#int"><small>int</small></a> event_trigger<small>(<a href="#int">int</a> <a href="#pi">pi</a>, <a href="#unsigned">unsigned</a> <a href="#event">event</a>)</small></h3>
-This function signals the occurrence of an event.
-<br><br><code>&nbsp;&nbsp;&nbsp;pi:&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;<a href="#pigpio_start">pigpio_start</a>).<br>event:&nbsp;0-31.<br></code><br><br>Returns 0 if OK, otherwise PI_BAD_EVENT_ID.
-<br><br>An event is a signal used to inform one or more consumers
-to start an action. Each consumer which has registered an interest
-in the event (e.g. by calling <a href="#event_callback">event_callback</a>) will be informed by
-a callback.
-<br><br>One event, PI_EVENT_BSC (31) is predefined. This event is
-auto generated on BSC slave activity.
-<br><br>The meaning of other events is arbitrary.
-<br><br>Note that other than its id and its tick there is no data associated
-with an event.
-<h2>PARAMETERS</h2><h3><a name="active">active</a>: 0-1000000</h3>
-The number of microseconds level changes are reported for once
-a noise filter has been triggered (by <a href="#steady">steady</a> microseconds of
-a stable level).
-<h3><a name="*addrStr">*addrStr</a></h3>
-A string specifying the host or IP address of the Pi running
-the pigpio daemon. It may be NULL in which case localhost
-is used unless overridden by the PIGPIO_ADDR environment
-variable.
-<h3><a name="arg1">arg1</a></h3>
-An unsigned argument passed to a user customised function. Its
-meaning is defined by the customiser.
-<h3><a name="arg2">arg2</a></h3>
-An unsigned argument passed to a user customised function. Its
-meaning is defined by the customiser.
-<h3><a name="argc">argc</a></h3>
-The count of bytes passed to a user customised function.
-<h3><a name="*argx">*argx</a></h3>
-A pointer to an array of bytes passed to a user customised function.
-Its meaning and content is defined by the customiser.
-<h3><a name="baud">baud</a></h3>
-The speed of serial communication (I2C, SPI, serial link, waves) in
-bits per second.
-<h3><a name="bit">bit</a></h3>
-A value of 0 or 1.
-<h3><a name="bits">bits</a></h3>
-A value used to select GPIO. If bit n of bits is set then GPIO n is
-selected.
-<br><br>A convenient way to set bit n is to or in (1&lt;&lt;n).
-<br><br>e.g. to select bits 5, 9, 23 you could use (1&lt;&lt;5) | (1&lt;&lt;9) | (1&lt;&lt;23).
-<h3><a name="bsc_xfer_t">bsc_xfer_t</a></h3>
-<code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;control;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Write<br>&nbsp;&nbsp;&nbsp;int&nbsp;rxCnt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Read&nbsp;only<br>&nbsp;&nbsp;&nbsp;char&nbsp;rxBuf[BSC_FIFO_SIZE];&nbsp;//&nbsp;Read&nbsp;only<br>&nbsp;&nbsp;&nbsp;int&nbsp;txCnt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;Write<br>&nbsp;&nbsp;&nbsp;char&nbsp;txBuf[BSC_FIFO_SIZE];&nbsp;//&nbsp;Write<br>}&nbsp;bsc_xfer_t;<br></code><h3><a name="*bscxfer">*bscxfer</a></h3>
-A pointer to a <a href="#bsc_xfer_t">bsc_xfer_t</a> object used to control a BSC transfer.
-<h3><a name="*buf">*buf</a></h3>
-A buffer to hold data being sent or being received.
-<h3><a name="bufSize">bufSize</a></h3>
-The size in bytes of a buffer.
-<h3><a name="bVal">bVal</a>: 0-255 (Hex 0x0-0xFF, Octal 0-0377)</h3>
-An 8-bit byte value.
-<h3><a name="callback_id">callback_id</a></h3>
-A value &gt;=0, as returned by a call to a callback function, one of
-<br><br><a href="#callback">callback</a><br>
-<a href="#callback_ex">callback_ex</a><br>
-<a href="#event_callback">event_callback</a><br>
-<a href="#event_callback_ex">event_callback_ex</a>
-<br><br>The id is passed to <a href="#callback_cancel">callback_cancel</a> or <a href="#event_callback_cancel">event_callback_cancel</a>
-to cancel the callback.
-<h3><a name="CBFunc_t">CBFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*CBFunc_t)<br>&nbsp;&nbsp;&nbsp;(int&nbsp;pi,&nbsp;unsigned&nbsp;user_gpio,&nbsp;unsigned&nbsp;level,&nbsp;uint32_t&nbsp;tick);<br></code><h3><a name="CBFuncEx_t">CBFuncEx_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*CBFuncEx_t)<br>&nbsp;&nbsp;&nbsp;(int&nbsp;pi,&nbsp;unsigned&nbsp;user_gpio,&nbsp;unsigned&nbsp;level,&nbsp;uint32_t&nbsp;tick,&nbsp;void&nbsp;*&nbsp;userdata);<br></code><h3><a name="char">char</a></h3>
-A single character, an 8 bit quantity able to store 0-255.
-<h3><a name="clkfreq">clkfreq</a>: 4689-250M (13184-375M for the BCM2711)</h3>
-The hardware clock frequency.
-<h3><a name="count">count</a></h3>
-The number of bytes to be transferred in a file, I2C, SPI, or serial
-command.
-<h3><a name="CS">CS</a></h3>
-The GPIO used for the slave select signal when bit banging SPI.
-<h3><a name="data_bits">data_bits</a>: 1-32</h3>
-The number of data bits in each character of serial data.
-<br><br><code>#define&nbsp;PI_MIN_WAVE_DATABITS&nbsp;1<br>#define&nbsp;PI_MAX_WAVE_DATABITS&nbsp;32<br></code><h3><a name="double">double</a></h3>
-A floating point number.
-<h3><a name="dutycycle">dutycycle</a>: 0-range</h3>
-A number representing the ratio of on time to off time for PWM.
-<br><br>The number may vary between 0 and range (default 255) where
-0 is off and range is fully on.
-<h3><a name="edge">edge</a></h3>
-Used to identify a GPIO level transition of interest. A rising edge is
-a level change from 0 to 1. A falling edge is a level change from 1 to 0.
-<br><br><code>RISING_EDGE&nbsp;&nbsp;0<br>FALLING_EDGE&nbsp;1<br>EITHER_EDGE.&nbsp;2<br></code><h3><a name="errnum">errnum</a></h3>
-A negative number indicating a function call failed and the nature
-of the error.
-<h3><a name="event">event</a>: 0-31</h3>
-An event is a signal used to inform one or more consumers
-to start an action.
-<h3><a name="evtCBFunc_t">evtCBFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*evtCBFunc_t)<br>&nbsp;&nbsp;&nbsp;(int&nbsp;pi,&nbsp;unsigned&nbsp;event,&nbsp;uint32_t&nbsp;tick);<br></code><h3><a name="evtCBFuncEx_t">evtCBFuncEx_t</a></h3>
-<code>typedef&nbsp;void&nbsp;(*evtCBFuncEx_t)<br>&nbsp;&nbsp;&nbsp;(int&nbsp;pi,&nbsp;unsigned&nbsp;event,&nbsp;uint32_t&nbsp;tick,&nbsp;void&nbsp;*userdata);<br></code><h3><a name="f">f</a></h3>
-A function.
-<h3><a name="*file">*file</a></h3>
-A full file path. To be accessible the path must match an entry in
-/opt/pigpio/access.
-<h3><a name="*fpat">*fpat</a></h3>
-A file path which may contain wildcards. To be accessible the path
-must match an entry in /opt/pigpio/access.
-<h3><a name="frequency">frequency</a>: &gt;=0</h3>
-The number of times a GPIO is swiched on and off per second. This
-can be set per GPIO and may be as little as 5Hz or as much as
-40KHz. The GPIO will be on for a proportion of the time as defined
-by its dutycycle.
-<h3><a name="gpio">gpio</a></h3>
-A Broadcom numbered GPIO, in the range 0-53.
-<br><br>There are 54 General Purpose Input Outputs (GPIO) named GPIO0 through
-GPIO53.
-<br><br>They are split into two banks. Bank 1 consists of GPIO0 through
-GPIO31. Bank 2 consists of GPIO32 through GPIO53.
-<br><br>All the GPIO which are safe for the user to read and write are in
-bank 1. Not all GPIO in bank 1 are safe though. Type 1 boards
-have 17 safe GPIO. Type 2 boards have 21. Type 3 boards have 26.
-<br><br>See <a href="#get_hardware_revision">get_hardware_revision</a>.
-<br><br>The user GPIO are marked with an X in the following table.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;1&nbsp;&nbsp;2&nbsp;&nbsp;3&nbsp;&nbsp;4&nbsp;&nbsp;5&nbsp;&nbsp;6&nbsp;&nbsp;7&nbsp;&nbsp;8&nbsp;&nbsp;9&nbsp;10&nbsp;11&nbsp;12&nbsp;13&nbsp;14&nbsp;15<br>Type&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16&nbsp;17&nbsp;18&nbsp;19&nbsp;20&nbsp;21&nbsp;22&nbsp;23&nbsp;24&nbsp;25&nbsp;26&nbsp;27&nbsp;28&nbsp;29&nbsp;30&nbsp;31<br>Type&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-<br>Type&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-<br></code><h3><a name="gpioPulse_t">gpioPulse_t</a></h3>
-<code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOn;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;gpioOff;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;usDelay;<br>}&nbsp;gpioPulse_t;<br></code><h3><a name="gpioThreadFunc_t">gpioThreadFunc_t</a></h3>
-<code>typedef&nbsp;void&nbsp;*(gpioThreadFunc_t)&nbsp;(void&nbsp;*);<br></code><h3><a name="handle">handle</a>: &gt;=0</h3>
-A number referencing an object opened by one of
-<br><br><a href="#file_open">file_open</a><br>
-<a href="#i2c_open">i2c_open</a><br>
-<a href="#notify_open">notify_open</a><br>
-<a href="#serial_open">serial_open</a><br>
-<a href="#spi_open">spi_open</a>
-<h3><a name="i2c_addr">i2c_addr</a>: 0-0x7F</h3>
-The address of a device on the I2C bus.
-<h3><a name="i2c_bus">i2c_bus</a>: &gt;=0</h3>
-An I2C bus number.
-<h3><a name="i2c_flags">i2c_flags</a>: 0</h3>
-Flags which modify an I2C open command. None are currently defined.
-<h3><a name="i2c_reg">i2c_reg</a>: 0-255</h3>
-A register of an I2C device.
-<h3><a name="*inBuf">*inBuf</a></h3>
-A buffer used to pass data to a function.
-<h3><a name="inLen">inLen</a></h3>
-The number of bytes of data in a buffer.
-<h3><a name="int">int</a></h3>
-A whole number, negative or positive.
-<h3><a name="int32_t">int32_t</a></h3>
-A 32-bit signed value.
-<h3><a name="invert">invert</a></h3>
-A flag used to set normal or inverted bit bang serial data level logic.
-<h3><a name="level">level</a></h3>
-The level of a GPIO. Low or High.
-<br><br><code>PI_OFF&nbsp;0<br>PI_ON&nbsp;1<br><br>PI_CLEAR&nbsp;0<br>PI_SET&nbsp;1<br><br>PI_LOW&nbsp;0<br>PI_HIGH&nbsp;1<br></code><br><br>There is one exception. If a watchdog expires on a GPIO the level will be
-reported as PI_TIMEOUT. See <a href="#set_watchdog">set_watchdog</a>.
-<br><br><code>PI_TIMEOUT&nbsp;2<br></code><h3><a name="MISO">MISO</a></h3>
-The GPIO used for the MISO signal when bit banging SPI.
-<h3><a name="mode">mode</a></h3>
-1. The operational mode of a GPIO, normally INPUT or OUTPUT.
-<br><br><code>PI_INPUT&nbsp;0<br>PI_OUTPUT&nbsp;1<br>PI_ALT0&nbsp;4<br>PI_ALT1&nbsp;5<br>PI_ALT2&nbsp;6<br>PI_ALT3&nbsp;7<br>PI_ALT4&nbsp;3<br>PI_ALT5&nbsp;2<br></code><br><br>2. The mode of waveform transmission.
-<br><br><code>PI_WAVE_MODE_ONE_SHOT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0<br>PI_WAVE_MODE_REPEAT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1<br>PI_WAVE_MODE_ONE_SHOT_SYNC&nbsp;2<br>PI_WAVE_MODE_REPEAT_SYNC&nbsp;&nbsp;&nbsp;3<br></code><br><br>3. A file open mode.
-<br><br><code>PI_FILE_READ&nbsp;&nbsp;1<br>PI_FILE_WRITE&nbsp;2<br>PI_FILE_RW&nbsp;&nbsp;&nbsp;&nbsp;3<br></code><br><br>The following values can be or'd into the mode.
-<br><br><code>PI_FILE_APPEND&nbsp;4<br>PI_FILE_CREATE&nbsp;8<br>PI_FILE_TRUNC&nbsp;&nbsp;16<br></code><h3><a name="MOSI">MOSI</a></h3>
-The GPIO used for the MOSI signal when bit banging SPI.
-<h3><a name="numBytes">numBytes</a></h3>
-The number of bytes used to store characters in a string. Depending
-on the number of bits per character there may be 1, 2, or 4 bytes
-per character.
-<h3><a name="numPar">numPar</a>: 0-10</h3>
-The number of parameters passed to a script.
-<h3><a name="numPulses">numPulses</a></h3>
-The number of pulses to be added to a waveform.
-<h3><a name="offset">offset</a></h3>
-The associated data starts this number of microseconds from the start of
-the waveform.
-<h3><a name="*outBuf">*outBuf</a></h3>
-A buffer used to return data from a function.
-<h3><a name="outLen">outLen</a></h3>
-The size in bytes of an output buffer.
-<h3><a name="pad">pad</a>: 0-2</h3>
-A set of GPIO which share common drivers.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><h3><a name="padStrength">padStrength</a>: 1-16</h3>
-The mA which may be drawn from each GPIO whilst still guaranteeing the
-high and low levels.
-<h3><a name="*param">*param</a></h3>
-An array of script parameters.
-<h3><a name="percent">percent</a>: 0-100</h3>
-The size of waveform as percentage of maximum available.
-<h3><a name="pi">pi</a></h3>
-An integer defining a connected Pi. The value is returned by
-<a href="#pigpio_start">pigpio_start</a> upon success.
-<h3><a name="*portStr">*portStr</a></h3>
-A string specifying the port address used by the Pi running
-the pigpio daemon. It may be NULL in which case "8888"
-is used unless overridden by the PIGPIO_PORT environment
-variable.
-<h3><a name="*pth">*pth</a></h3>
-A thread identifier, returned by <a href="#start_thread">start_thread</a>.
-<h3><a name="pthread_t">pthread_t</a></h3>
-A thread identifier.
-<h3><a name="pud">pud</a>: 0-2</h3>
-The setting of the pull up/down resistor for a GPIO, which may be off,
-pull-up, or pull-down.
-<code>PI_PUD_OFF&nbsp;0<br>PI_PUD_DOWN&nbsp;1<br>PI_PUD_UP&nbsp;2<br></code><h3><a name="pulseLen">pulseLen</a></h3>
-1-100, the length of a trigger pulse in microseconds.
-<h3><a name="*pulses">*pulses</a></h3>
-An array of pulses to be added to a waveform.
-<h3><a name="pulsewidth">pulsewidth</a>: 0, 500-2500</h3>
-<code>PI_SERVO_OFF&nbsp;0<br>PI_MIN_SERVO_PULSEWIDTH&nbsp;500<br>PI_MAX_SERVO_PULSEWIDTH&nbsp;2500<br></code><h3><a name="PWMduty">PWMduty</a>: 0-1000000 (1M)</h3>
-The hardware PWM dutycycle.
-<br><br><code>#define&nbsp;PI_HW_PWM_RANGE&nbsp;1000000<br></code><h3><a name="PWMfreq">PWMfreq</a>: 1-125M (1-187.5M for the BCM2711)</h3>
-The hardware PWM frequency.
-<br><br><code>#define&nbsp;PI_HW_PWM_MIN_FREQ&nbsp;1<br>#define&nbsp;PI_HW_PWM_MAX_FREQ&nbsp;125000000<br>#define&nbsp;PI_HW_PWM_MAX_FREQ_2711&nbsp;187500000<br></code><h3><a name="range">range</a>: 25-40000</h3>
-The permissible dutycycle values are 0-range.
-<br><br><code>PI_MIN_DUTYCYCLE_RANGE&nbsp;25<br>PI_MAX_DUTYCYCLE_RANGE&nbsp;40000<br></code><h3><a name="*retBuf">*retBuf</a></h3>
-A buffer to hold a number of bytes returned to a used customised function,
-<h3><a name="retMax">retMax</a></h3>
-The maximum number of bytes a user customised function should return.
-<h3><a name="*rxBuf">*rxBuf</a></h3>
-A pointer to a buffer to receive data.
-<h3><a name="SCL">SCL</a></h3>
-The user GPIO to use for the clock when bit banging I2C.
-<h3><a name="SCLK">SCLK</a></h3>
-The GPIO used for the SCLK signal when bit banging SPI.
-<h3><a name="*script">*script</a></h3>
-A pointer to the text of a script.
-<h3><a name="script_id">script_id</a></h3>
-An id of a stored script as returned by <a href="#store_script">store_script</a>.
-<h3><a name="*scriptName">*scriptName</a></h3>
-The name of a <a href="#shell_">shell_</a> script to be executed. The script must be present in
-/opt/pigpio/cgi and must have execute permission.
-<h3><a name="*scriptString">*scriptString</a></h3>
-The string to be passed to a <a href="#shell_">shell_</a> script to be executed.
-<h3><a name="SDA">SDA</a></h3>
-The user GPIO to use for data when bit banging I2C.
-<h3><a name="seconds">seconds</a></h3>
-The number of seconds.
-<h3><a name="seekFrom">seekFrom</a></h3>
-<code>PI_FROM_START&nbsp;&nbsp;&nbsp;0<br>PI_FROM_CURRENT&nbsp;1<br>PI_FROM_END&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2<br></code><h3><a name="seekOffset">seekOffset</a></h3>
-The number of bytes to move forward (positive) or backwards (negative)
-from the seek position (start, current, or end of file).
-<h3><a name="ser_flags">ser_flags</a></h3>
-Flags which modify a serial open command. None are currently defined.
-<h3><a name="*ser_tty">*ser_tty</a></h3>
-The name of a serial tty device, e.g. /dev/ttyAMA0, /dev/ttyUSB0, /dev/tty1.
-<h3><a name="size_t">size_t</a></h3>
-A standard type used to indicate the size of an object in bytes.
-<h3><a name="spi_channel">spi_channel</a></h3>
-A SPI channel, 0-2.
-<h3><a name="spi_flags">spi_flags</a></h3>
-See <a href="#spi_open">spi_open</a> and <a href="#bb_spi_open">bb_spi_open</a>.
-<h3><a name="steady">steady</a>: 0-300000</h3>
-The number of microseconds level changes must be stable for
-before reporting the level changed (<a href="#set_glitch_filter">set_glitch_filter</a>) or triggering
-the active part of a noise filter (<a href="#set_noise_filter">set_noise_filter</a>).
-<h3><a name="stop_bits">stop_bits</a>: 2-8</h3>
-The number of (half) stop bits to be used when adding serial data
-to a waveform.
-<br><br><code>#define&nbsp;PI_MIN_WAVE_HALFSTOPBITS&nbsp;2<br>#define&nbsp;PI_MAX_WAVE_HALFSTOPBITS&nbsp;8<br></code><h3><a name="*str">*str</a></h3>
- An array of characters.
-<h3><a name="thread_func">thread_func</a></h3>
-A function of type gpioThreadFunc_t used as the main function of a
-thread.
-<h3><a name="timeout">timeout</a></h3>
-A GPIO watchdog timeout in milliseconds.
-<br><br><code>PI_MIN_WDOG_TIMEOUT&nbsp;0<br>PI_MAX_WDOG_TIMEOUT&nbsp;60000<br></code><h3><a name="*txBuf">*txBuf</a></h3>
-An array of bytes to transmit.
-<h3><a name="uint32_t">uint32_t</a>: 0-0-4,294,967,295 (Hex 0x0-0xFFFFFFFF)</h3>
-A 32-bit unsigned value.
-<h3><a name="unsigned">unsigned</a></h3>
-A whole number &gt;= 0.
-<h3><a name="user_gpio">user_gpio</a></h3>
-0-31, a Broadcom numbered GPIO.
-<br><br>See <a href="#gpio">gpio</a>.
-<h3><a name="*userdata">*userdata</a></h3>
-A pointer to arbitrary user data. This may be used to identify the instance.
-<br><br>You must ensure that the pointer is in scope at the time it is processed. If
-it is a pointer to a global this is automatic. Do not pass the address of a
-local variable. If you want to pass a transient object then use the
-following technique.
-<br><br>In the calling function:
-<br><br><code>user_type&nbsp;*userdata;<br><br>user_type&nbsp;my_userdata;<br><br>userdata&nbsp;=&nbsp;malloc(sizeof(user_type));<br><br>*userdata&nbsp;=&nbsp;my_userdata;<br></code><br><br>In the receiving function:
-<br><br><code>user_type&nbsp;my_userdata&nbsp;=&nbsp;*(user_type*)userdata;<br><br>free(userdata);<br></code><h3><a name="void">void</a></h3>
-Denoting no parameter is required
-<h3><a name="wave_add_*">wave_add_*</a></h3>
-One of
-<br><br><a href="#wave_add_new">wave_add_new</a><br>
-<a href="#wave_add_generic">wave_add_generic</a><br>
-<a href="#wave_add_serial">wave_add_serial</a>
-<h3><a name="wave_id">wave_id</a></h3>
-A number representing a waveform created by <a href="#wave_create">wave_create</a>.
-<h3><a name="wave_send_*">wave_send_*</a></h3>
-One of
-<br><br><a href="#wave_send_once">wave_send_once</a><br>
-<a href="#wave_send_repeat">wave_send_repeat</a>
-<h3><a name="wVal">wVal</a>: 0-65535 (Hex 0x0-0xFFFF, Octal 0-0177777)</h3>
-A 16-bit word value.
-<h2>pigpiod_if2 Error Codes</h2><code><br>typedef&nbsp;enum<br>{<br>&nbsp;&nbsp;&nbsp;pigif_bad_send&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2000,<br>&nbsp;&nbsp;&nbsp;pigif_bad_recv&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2001,<br>&nbsp;&nbsp;&nbsp;pigif_bad_getaddrinfo&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2002,<br>&nbsp;&nbsp;&nbsp;pigif_bad_connect&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2003,<br>&nbsp;&nbsp;&nbsp;pigif_bad_socket&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2004,<br>&nbsp;&nbsp;&nbsp;pigif_bad_noib&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2005,<br>&nbsp;&nbsp;&nbsp;pigif_duplicate_callback&nbsp;=&nbsp;-2006,<br>&nbsp;&nbsp;&nbsp;pigif_bad_malloc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2007,<br>&nbsp;&nbsp;&nbsp;pigif_bad_callback&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2008,<br>&nbsp;&nbsp;&nbsp;pigif_notify_failed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2009,<br>&nbsp;&nbsp;&nbsp;pigif_callback_not_found&nbsp;=&nbsp;-2010,<br>&nbsp;&nbsp;&nbsp;pigif_unconnected_pi&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2011,<br>&nbsp;&nbsp;&nbsp;pigif_too_many_pis&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;-2012,<br>}&nbsp;pigifError_t;<br><br></code> \ No newline at end of file
diff --git a/DOC/tmp/body/pif.body b/DOC/tmp/body/pif.body
deleted file mode 100644
index d72d3f8..0000000
--- a/DOC/tmp/body/pif.body
+++ /dev/null
@@ -1,21 +0,0 @@
-
-pigpio provides a pipe interface to many of its functions.<br>
-<br>
-The pipe interface is available whenever pigpio is running, either
-because it has been started as a daemon, or it has been linked in
-to a running user program.&nbsp; The pipe interface can be disabled
-by the program which initialises the library.&nbsp; pigpiod offers
-the -f option to disable the pipe interface.&nbsp; User programs
-should call <a href=
-"http://abyz.me.uk/rpi/pigpio/cif.html#gpioCfgInterfaces">gpioCfgInterfaces</a>
-if they wish to disable the pipe interface.<br>
-<br>
-pigpio listens for commands on pipe /dev/pigpio.&nbsp; The commands
-consist of a command identifier with, depending on the command,
-zero, one, or two parameters.&nbsp; The result, if any, may be read
-from pipe /dev/pigout.&nbsp; If any errors are detected a message
-will be written to pipe /dev/pigerr.<br>
-<br>
-<br>
-The format of the commands is identical to those used by <a href=
-"pigs.html">pigs</a>.
diff --git a/DOC/tmp/body/pig2vcd.body b/DOC/tmp/body/pig2vcd.body
deleted file mode 100644
index a6a7719..0000000
--- a/DOC/tmp/body/pig2vcd.body
+++ /dev/null
@@ -1,20 +0,0 @@
-pig2vcd is a utility which reads notifications on stdin and writes the
-output as a Value Change Dump (VCD) file on stdout.
-<br><br>The VCD file can be viewed using GTKWave.
-<h3>Notifications</h3>Notifications consist of 12 bytes with the following binary format.
-<br><br><code>typedef&nbsp;struct<br>{<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;seqno;<br>&nbsp;&nbsp;&nbsp;uint16_t&nbsp;flags;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;tick;<br>&nbsp;&nbsp;&nbsp;uint32_t&nbsp;level;<br>}&nbsp;gpioReport_t;<br></code><br><br>seqno: starts at 0 each time the handle is opened and then increments by one for each report.
-<br><br>flags: two flags are defined, PI_NTFY_FLAGS_WDOG and PI_NTFY_FLAGS_ALIVE. If bit 5 is set (PI_NTFY_FLAGS_WDOG) then bits 0-4 of the flags indicate a gpio which has had a watchdog timeout; if bit 6 is set (PI_NTFY_FLAGS_ALIVE) this indicates a keep alive signal on the pipe/socket and is sent once a minute in the absence of other notification activity.
-<br><br>tick: the number of microseconds since system boot. It wraps around after 1h12m.
-<br><br>level: indicates the level of each gpio. If bit 1&lt;&lt;x is set then gpio x is high. pig2vcd takes these notifications and outputs a text format VCD.
-<h3>VCD format</h3>The VCD starts with a header.
-<br><br><code>$date&nbsp;2013-05-31&nbsp;18:49:36&nbsp;$end<br>$version&nbsp;pig2vcd&nbsp;V1&nbsp;$end<br>$timescale&nbsp;1&nbsp;us&nbsp;$end<br>$scope&nbsp;module&nbsp;top&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;A&nbsp;0&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;B&nbsp;1&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;C&nbsp;2&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;D&nbsp;3&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;E&nbsp;4&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;F&nbsp;5&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;G&nbsp;6&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;H&nbsp;7&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;I&nbsp;8&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;J&nbsp;9&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;K&nbsp;10&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;L&nbsp;11&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;M&nbsp;12&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;N&nbsp;13&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;O&nbsp;14&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;P&nbsp;15&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;Q&nbsp;16&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;R&nbsp;17&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;S&nbsp;18&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;T&nbsp;19&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;U&nbsp;20&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;V&nbsp;21&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;W&nbsp;22&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;X&nbsp;23&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;Y&nbsp;24&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;Z&nbsp;25&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;a&nbsp;26&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;b&nbsp;27&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;c&nbsp;28&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;d&nbsp;29&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;e&nbsp;30&nbsp;$end<br>$var&nbsp;wire&nbsp;1&nbsp;f&nbsp;31&nbsp;$end<br>$upscope&nbsp;$end<br>$enddefinitions&nbsp;$end<br></code><br><br>The header defines gpio identifiers and their name. Each gpio identifier
-must be unique. pig2vcd arbitrarily uses 'A' through 'Z' for gpios 0
-through 25, and 'a' through 'f' for gpios 26 through 31.
-The corresponding names are 0 through 31.<br>
-<br><br>The VCD file may be edited to give a frendlier name, e.g. 8 could be
-changed to ENCODER_A if an encoder switch A is connected to gpio 8.
-<br><br>Following the header pig2vcd takes notifications and outputs a timestamp
-followed by a list of one or more gpios which have changed state.
-The timestamp consists of a '#' followed by the microsecond tick.
-The state lines contain the new state followed by the gpio identifier.
-<br><br><code>#1058747<br>0H<br>0I<br>#1059012<br>1H<br>#1079777<br>1I<br>#1079782<br>0I<br>#1079852<br>1I<br>#1079857<br>0I<br>0H<br>#1165113<br>1H<br>#1165118<br>0H<br>#1165153<br>1H<br></code> \ No newline at end of file
diff --git a/DOC/tmp/body/pigpiod.body b/DOC/tmp/body/pigpiod.body
deleted file mode 100644
index 1aed926..0000000
--- a/DOC/tmp/body/pigpiod.body
+++ /dev/null
@@ -1,51 +0,0 @@
-pigpiod is a utility which launches the pigpio library as a daemon.<br>
-<br>
-Once launched the pigpio library runs in the background accepting commands from the pipe and socket interfaces.<br>
-<br>
-The pigpiod utility requires sudo privileges to launch the library but thereafter the pipe and socket commands may be issued by normal users.<br>
-<br>
-pigpiod accepts the following configuration options<br>
-<br>
-<table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td><b>-a value</b></td><td>DMA memory allocation mode</td><td>0=AUTO, 1=PMAP, 2=MBOX</td><td>Default AUTO
-</td></tr><tr><td><b>-b value</b></td><td>GPIO sample buffer size in milliseconds</td><td>100-10000</td><td>Default 120
-</td></tr><tr><td><b>-c value</b></td><td>Library internal settings</td><td></td><td>Default 0
-</td></tr><tr><td><b>-d value</b></td><td>Primary DMA channel</td><td>0-14</td><td>Default 14
-</td></tr><tr><td><b>-e value</b></td><td>Secondary DMA channel</td><td>0-14</td><td>Default 6. Preferably use one of DMA channels 0 to 6 for the secondary channel
-</td></tr><tr><td><b>-f</b></td><td>Disable fifo interface</td><td></td><td>Default enabled
-</td></tr><tr><td><b>-g</b></td><td>Run in foreground (do not fork)</td><td></td><td>Default disabled
-</td></tr><tr><td><b>-k</b></td><td>Disable local and remote socket interface</td><td></td><td>Default enabled
-</td></tr><tr><td><b>-l</b></td><td>Disable remote socket interface</td><td></td><td>Default enabled
-</td></tr><tr><td><b>-m</b></td><td>Disable alerts (sampling)</td><td></td><td>Default enabled
-</td></tr><tr><td><b>-n IP address</b></td><td>Allow IP address to use the socket interface</td><td>Name (e.g. paul) or dotted quad (e.g. 192.168.1.66)</td><td>If the -n option is not used all addresses are allowed (unless overridden by the -k or -l options). Multiple -n options are allowed. If -k has been used -n has no effect. If -l has been used only -n localhost has any effect
-</td></tr><tr><td><b>-p value</b></td><td>Socket port</td><td>1024-32000</td><td>Default 8888
-</td></tr><tr><td><b>-s value</b></td><td>Sample rate</td><td>1, 2, 4, 5, 8, or 10 microseconds</td><td>Default 5
-</td></tr><tr><td><b>-t value</b></td><td>Clock peripheral</td><td>0=PWM 1=PCM</td><td>Default PCM. pigpio uses one or both of PCM and PWM. If PCM is used then PWM is available for audio. If PWM is used then PCM is available for audio. If waves or hardware PWM are used neither PWM nor PCM will be available for audio.
-</td></tr><tr><td><b>-v -V</b></td><td>Display pigpio version and exit</td><td></td><td>
-</td></tr><tr><td><b>-x mask</b></td><td>GPIO which may be updated</td><td>A 54 bit mask with (1&lt;&lt;n) set if the user may update GPIO #n</td><td>Default is the set of user GPIO for the board revision. Use -x -1 to allow all GPIO
-</td></tr></tbody></table><h3>Example</h3><code>sudo&nbsp;pigpiod&nbsp;-s&nbsp;2&nbsp;-b&nbsp;200&nbsp;-f<br></code><br><br>Launch the pigpio library with a sample rate of 2 microseconds and a 200 millisecond buffer. Disable the fifo interface.
-<h3>Permissions</h3>pigpio provides a rudimentary permissions system for commands issued via the socket and pipe interfaces.
-<br><br>All GPIO may be read.
-<br><br>Only the user GPIO for the board type or those specified by the -x option may be updated.
-<br><br><code>Type&nbsp;1&nbsp;boards&nbsp;0x03E6CF93&nbsp;(26&nbsp;pin&nbsp;header)<br>Type&nbsp;2&nbsp;boards&nbsp;0xFBC6CF9C&nbsp;(26&nbsp;pin&nbsp;+&nbsp;8&nbsp;pin&nbsp;header)<br>Type&nbsp;3&nbsp;boards&nbsp;0x0FFFFFFC&nbsp;(40&nbsp;pin&nbsp;header)<br></code><br><br>In this context an update includes the following:
-<br><br>GPIO mode set<br>
-GPIO pull/up down<br>
-GPIO write<br>
-GPIO set PWM (including range and frequency)<br>
-GPIO set servo
-<br><br>In addition the bank clear and set commands, and the wave commands will only
-affect updateable GPIO.
-<h3>Exceptions</h3>The following exceptions are made for particular models.
-<br><br><b>Models A and B</b><br><br>The green activity LED (GPIO 16) may be written.<br>
-<br><b>Models A+ and B+</b><br><br>The green activity LED (GPIO 47) may be written.<br>
-The red power LED (GPIO 35) may be written.<br>
-The high USB power mode (GPIO 38) may be written.<br>
-<br><b>Pi Zero</b><br><br>The green activity LED (GPIO 47) may be written.<br>
-<br><b>Pi2B</b><br><br>The green activity LED (GPIO 47) may be written.<br>
-The red power LED (GPIO 35) may be written.<br>
-The high USB power mode (GPIO 38) may be written.<br>
-<br><b>Pi3B</b><br><br>The green activity LED and the red power LED are not writable.<br>
-The USB power mode is fixed at 1.2 amps (high power).<br>
-<h3>DMA Channels</h3>The secondary channel is only used for the transmission of waves.
-<br><br>If possible use one of channels 0 to 6 for the secondary channel (a full channel).
-<br><br>A full channel only requires one DMA control block regardless of the length of a pulse delay. Channels 7 to 14 (lite channels) require one DMA control block for each 16383 microseconds of delay. I.e. a 10 second pulse delay requires one control block on a full channel and 611 control blocks on a lite channel.
-<br><br> \ No newline at end of file
diff --git a/DOC/tmp/body/pigs.body b/DOC/tmp/body/pigs.body
deleted file mode 100644
index 4a88b42..0000000
--- a/DOC/tmp/body/pigs.body
+++ /dev/null
@@ -1,1205 +0,0 @@
-<h2><a name="Introduction">Introduction</a></h2>
-The socket and pipe interfaces allow control of the Pi's GPIO by
-passing messages to the running pigpio library.
-<br><br>The normal way to start the pigpio library would be as a daemon during boot.
-<br><br><code>sudo&nbsp;pigpiod<br></code><h3>Features</h3>o hardware timed PWM on any of GPIO 0-31
-<br><br>o hardware timed servo pulses on any of GPIO 0-31
-<br><br>o reading/writing all of the GPIO in a bank as one operation
-<br><br>o individually setting GPIO modes, reading and writing
-<br><br>o notifications when any of GPIO 0-31 change state
-<br><br>o the construction of output waveforms with microsecond timing
-<br><br>o I2C, SPI, and serial link wrappers
-<br><br>o creating and running scripts on the pigpio daemon
-<h3>GPIO</h3>ALL GPIO are identified by their Broadcom number.
-<h3>Usage</h3>pigs is a program and internally uses the socket interface to pigpio
-whereas /dev/pigpio uses the pipe interface.
-<br><br>pigs and the pipe interface share the same commands and are invoked in
-a similar fashion from the command line.
-<br><br>The pigpio library must be running, either by running a program linked
-with the library or starting the pigpio daemon (sudo pigpiod).
-<br><br>pigs {command}+
-<br><br>echo "{command}+" &gt;/dev/pigpio
-<br><br>pigs will show the result of the command on screen.
-<br><br>The pigs process returns an exit status (which can be displayed with
-the command echo $?).
-<br><br><code>PIGS_OK&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0<br>PIGS_CONNECT_ERR&nbsp;255<br>PIGS_OPTION_ERR&nbsp;&nbsp;254<br>PIGS_SCRIPT_ERR&nbsp;&nbsp;253<br><br></code><br><br>The results of /dev/pigpio commands need to be read from /dev/pigout,
-e.g. cat /dev/pigout (try cat /dev/pigout& so that all subsequent
-results are shown on screen).
-<br><br>In both cases if an error was detected a message will have been written
-to /dev/pigerr (try cat /dev/pigerr&). This is likely to be more
-informative than the message returned by pigs or the error code
-returned by the pipe interface.
-<br><br>Several commands may be entered on a line. If present PROC and PARSE must
-be the last command on a line.
-<br><br>E.g.
-<br><br><code>pigs&nbsp;w&nbsp;22&nbsp;1&nbsp;mils&nbsp;1000&nbsp;w&nbsp;22&nbsp;0<br></code><br><br>is equivalent to
-<br><br><code>pigs&nbsp;w&nbsp;22&nbsp;1<br>pigs&nbsp;mils&nbsp;1000<br>pigs&nbsp;w&nbsp;22&nbsp;0<br></code><br><br>and
-<br><br><code>echo&nbsp;"m&nbsp;4&nbsp;w&nbsp;w&nbsp;4&nbsp;0&nbsp;mils&nbsp;250&nbsp;m&nbsp;4&nbsp;r&nbsp;r&nbsp;4"&nbsp;&gt;/dev/pigpio<br></code><br><br>is equivalent to
-<br><br><code>echo&nbsp;"m&nbsp;4&nbsp;w"&nbsp;&nbsp;&nbsp;&nbsp;&gt;/dev/pigpio<br>echo&nbsp;"w&nbsp;4&nbsp;0"&nbsp;&nbsp;&nbsp;&nbsp;&gt;/dev/pigpio<br>echo&nbsp;"mils&nbsp;250"&nbsp;&gt;/dev/pigpio<br>echo&nbsp;"m&nbsp;4&nbsp;r"&nbsp;&nbsp;&nbsp;&nbsp;&gt;/dev/pigpio<br>echo&nbsp;"r&nbsp;4"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&gt;/dev/pigpio<br></code><h3>Notes</h3>The examples from now on will show the pigs interface but the same
-commands will also work on the pipe interface.
-<br><br>pigs does not show the status of successful commands unless the
-command itself returns data. The status (0) will be returned to
-pigs but will be discarded.
-<br><br>The status/data of each command sent to the pipe interface should
-be read from /dev/pigout.
-<br><br>When a command takes a number as a parameter it may be entered as hex
-(precede by 0x), octal (precede by 0), or decimal.
-<br><br>E.g. 23 is 23 decimal, 0x100 is 256 decimal, 070 is 56 decimal.
-<br><br>Some commands can return a variable number of data bytes. By
-default this data is displayed as decimal. The pigs -a option
-can be used to force the display as ASCII and the pigs -x
-option can be used to force the display as hex.
-<br><br>E.g. assuming the transmitted serial data is the letters ABCDEONM
-<br><br><code>$&nbsp;pigs&nbsp;slr&nbsp;4&nbsp;100<br>8&nbsp;65&nbsp;66&nbsp;67&nbsp;68&nbsp;69&nbsp;79&nbsp;78&nbsp;77<br><br>$&nbsp;pigs&nbsp;-a&nbsp;slr&nbsp;4&nbsp;100<br>8&nbsp;ABCDEONM<br><br>$&nbsp;pigs&nbsp;-x&nbsp;slr&nbsp;4&nbsp;100<br>8&nbsp;41&nbsp;42&nbsp;43&nbsp;44&nbsp;45&nbsp;4f&nbsp;4e&nbsp;4d<br></code><h2><a name="Overview">Overview</a></h2>
-<table border="0" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td></td><td></td></tr><tr><td>BASIC
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#M/MODES">M/MODES</a> <a href="#g">g</a> <a href="#m">m</a></td><td>Set GPIO mode </td><td><small><a href="cif.html#gpioSetMode">gpioSetMode</a></small></td></tr><tr><td><a href="#MG/MODEG">MG/MODEG</a> <a href="#g">g</a></td><td>Get GPIO mode </td><td><small><a href="cif.html#gpioGetMode">gpioGetMode</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#PUD">PUD</a> <a href="#g">g</a> <a href="#p">p</a></td><td>Set GPIO pull up/down </td><td><small><a href="cif.html#gpioSetPullUpDown">gpioSetPullUpDown</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#R/READ">R/READ</a> <a href="#g">g</a></td><td>Read GPIO level </td><td><small><a href="cif.html#gpioRead">gpioRead</a></small></td></tr><tr><td><a href="#W/WRITE">W/WRITE</a> <a href="#g">g</a> <a href="#L">L</a></td><td>Write GPIO level </td><td><small><a href="cif.html#gpioWrite">gpioWrite</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>PWM (overrides servo commands on same GPIO)
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#P/PWM">P/PWM</a> <a href="#u">u</a> <a href="#v">v</a></td><td>Set GPIO PWM value </td><td><small><a href="cif.html#gpioPWM">gpioPWM</a></small></td></tr><tr><td><a href="#PFS">PFS</a> <a href="#u">u</a> <a href="#v">v</a></td><td>Set GPIO PWM frequency </td><td><small><a href="cif.html#gpioSetPWMfrequency">gpioSetPWMfrequency</a></small></td></tr><tr><td><a href="#PRS">PRS</a> <a href="#u">u</a> <a href="#v">v</a></td><td>Set GPIO PWM range </td><td><small><a href="cif.html#gpioSetPWMrange">gpioSetPWMrange</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#GDC">GDC</a> <a href="#u">u</a></td><td>Get GPIO PWM dutycycle </td><td><small><a href="cif.html#gpioGetPWMdutycycle">gpioGetPWMdutycycle</a></small></td></tr><tr><td><a href="#PFG">PFG</a> <a href="#u">u</a></td><td>Get GPIO PWM frequency </td><td><small><a href="cif.html#gpioGetPWMfrequency">gpioGetPWMfrequency</a></small></td></tr><tr><td><a href="#PRG">PRG</a> <a href="#u">u</a></td><td>Get GPIO PWM range </td><td><small><a href="cif.html#gpioGetPWMrange">gpioGetPWMrange</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#PRRG">PRRG</a> <a href="#u">u</a></td><td>Get GPIO PWM real range </td><td><small><a href="cif.html#gpioGetPWMrealRange">gpioGetPWMrealRange</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>Servo (overrides PWM commands on same GPIO)
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#S/SERVO">S/SERVO</a> <a href="#u">u</a> <a href="#v">v</a></td><td>Set GPIO servo pulsewidth </td><td><small><a href="cif.html#gpioServo">gpioServo</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#GPW">GPW</a> <a href="#u">u</a></td><td>Get GPIO servo pulsewidth </td><td><small><a href="cif.html#gpioGetServoPulsewidth">gpioGetServoPulsewidth</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>INTERMEDIATE
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#TRIG">TRIG</a> <a href="#u">u</a> <a href="#pl">pl</a> <a href="#L">L</a></td><td>Send a trigger pulse </td><td><small><a href="cif.html#gpioTrigger">gpioTrigger</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#WDOG">WDOG</a> <a href="#u">u</a> <a href="#v">v</a></td><td>Set GPIO watchdog </td><td><small><a href="cif.html#gpioSetWatchdog">gpioSetWatchdog</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#BR1">BR1</a></td><td>Read bank 1 GPIO </td><td><small><a href="cif.html#gpioRead_Bits_0_31">gpioRead_Bits_0_31</a></small></td></tr><tr><td><a href="#BR2">BR2</a></td><td>Read bank 2 GPIO </td><td><small><a href="cif.html#gpioRead_Bits_32_53">gpioRead_Bits_32_53</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#BC1">BC1</a> <a href="#bits">bits</a></td><td>Clear specified GPIO in bank 1 </td><td><small><a href="cif.html#gpioWrite_Bits_0_31_Clear">gpioWrite_Bits_0_31_Clear</a></small></td></tr><tr><td><a href="#BC2">BC2</a> <a href="#bits">bits</a></td><td>Clear specified GPIO in bank 2 </td><td><small><a href="cif.html#gpioWrite_Bits_32_53_Clear">gpioWrite_Bits_32_53_Clear</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#BS1">BS1</a> <a href="#bits">bits</a></td><td>Set specified GPIO in bank 1 </td><td><small><a href="cif.html#gpioWrite_Bits_0_31_Set">gpioWrite_Bits_0_31_Set</a></small></td></tr><tr><td><a href="#BS2">BS2</a> <a href="#bits">bits</a></td><td>Set specified GPIO in bank 2 </td><td><small><a href="cif.html#gpioWrite_Bits_32_53_Set">gpioWrite_Bits_32_53_Set</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>ADVANCED
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#NO">NO</a></td><td>Request a notification </td><td><small><a href="cif.html#gpioNotifyOpen">gpioNotifyOpen</a></small></td></tr><tr><td><a href="#NC">NC</a> <a href="#h">h</a></td><td>Close notification </td><td><small><a href="cif.html#gpioNotifyClose">gpioNotifyClose</a></small></td></tr><tr><td><a href="#NB">NB</a> <a href="#h">h</a> <a href="#bits">bits</a></td><td>Start notification </td><td><small><a href="cif.html#gpioNotifyBegin">gpioNotifyBegin</a></small></td></tr><tr><td><a href="#NP">NP</a> <a href="#h">h</a></td><td>Pause notification </td><td><small><a href="cif.html#gpioNotifyPause">gpioNotifyPause</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#HC">HC</a> <a href="#g">g</a> <a href="#cf">cf</a></td><td>Set hardware clock frequency </td><td><small><a href="cif.html#gpioHardwareClock">gpioHardwareClock</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#HP">HP</a> <a href="#g">g</a> <a href="#pf">pf</a> <a href="#pdc">pdc</a></td><td>Set hardware PWM frequency and dutycycle </td><td><small><a href="cif.html#gpioHardwarePWM">gpioHardwarePWM</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#FG">FG</a> <a href="#u">u</a> <a href="#stdy">stdy</a></td><td>Set a glitch filter on a GPIO </td><td><small><a href="cif.html#gpioGlitchFilter">gpioGlitchFilter</a></small></td></tr><tr><td><a href="#FN">FN</a> <a href="#u">u</a> <a href="#stdy">stdy</a> <a href="#actv">actv</a></td><td>Set a noise filter on a GPIO </td><td><small><a href="cif.html#gpioNoiseFilter">gpioNoiseFilter</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#PADS">PADS</a> <a href="#pad">pad</a> <a href="#padma">padma</a></td><td>Set pad drive strength </td><td><small><a href="cif.html#gpioSetPad">gpioSetPad</a></small></td></tr><tr><td><a href="#PADG">PADG</a> <a href="#pad">pad</a></td><td>Get pad drive strength </td><td><small><a href="cif.html#gpioGetPad">gpioGetPad</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#SHELL">SHELL</a> <a href="#name">name</a> <a href="#str">str</a></td><td>Execute a shell command </td><td><small><a href="cif.html#shell">shell</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>Custom
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#CF1">CF1</a> <a href="#uvs">uvs</a></td><td>Custom function 1 </td><td><small><a href="cif.html#gpioCustom1">gpioCustom1</a></small></td></tr><tr><td><a href="#CF2">CF2</a> <a href="#uvs">uvs</a></td><td>Custom function 2 </td><td><small><a href="cif.html#gpioCustom1">gpioCustom1</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>Events
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#EVM">EVM</a> <a href="#h">h</a> <a href="#bits">bits</a></td><td>Set events to monitor </td><td><small><a href="cif.html#eventMonitor">eventMonitor</a></small></td></tr><tr><td><a href="#EVT">EVT</a> <a href="#event">event</a></td><td>Trigger event </td><td><small><a href="cif.html#eventTrigger">eventTrigger</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>Scripts
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#PROC">PROC</a> <a href="#t">t</a></td><td>Store script </td><td><small><a href="cif.html#gpioStoreScript">gpioStoreScript</a></small></td></tr><tr><td><a href="#PROCR">PROCR</a> <a href="#sid">sid</a> <a href="#pars">pars</a></td><td>Run script </td><td><small><a href="cif.html#gpioRunScript">gpioRunScript</a></small></td></tr><tr><td><a href="#PROCU">PROCU</a> <a href="#sid">sid</a> <a href="#pars">pars</a></td><td>Set script parameters </td><td><small><a href="cif.html#gpioUpdateScript">gpioUpdateScript</a></small></td></tr><tr><td><a href="#PROCP">PROCP</a> <a href="#sid">sid</a></td><td>Get script status and parameters </td><td><small><a href="cif.html#gpioScriptStatus">gpioScriptStatus</a></small></td></tr><tr><td><a href="#PROCS">PROCS</a> <a href="#sid">sid</a></td><td>Stop script </td><td><small><a href="cif.html#gpioStopScript">gpioStopScript</a></small></td></tr><tr><td><a href="#PROCD">PROCD</a> <a href="#sid">sid</a></td><td>Delete script </td><td><small><a href="cif.html#gpioDeleteScript">gpioDeleteScript</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#PARSE">PARSE</a> <a href="#t">t</a></td><td>Validate script </td><td><small><a href="cif.html#gpioParseScript">gpioParseScript</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>I2C
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#I2CO">I2CO</a> <a href="#ib">ib</a> <a href="#id">id</a> <a href="#if">if</a></td><td>Open I2C bus and device with flags </td><td><small><a href="cif.html#i2cOpen">i2cOpen</a></small></td></tr><tr><td><a href="#I2CC">I2CC</a> <a href="#h">h</a></td><td>Close I2C handle </td><td><small><a href="cif.html#i2cClose">i2cClose</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#I2CWQ">I2CWQ</a> <a href="#h">h</a> <a href="#bit">bit</a></td><td>smb Write Quick: write bit </td><td><small><a href="cif.html#i2cWriteQuick">i2cWriteQuick</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#I2CRS">I2CRS</a> <a href="#h">h</a></td><td>smb Read Byte: read byte </td><td><small><a href="cif.html#i2cReadByte">i2cReadByte</a></small></td></tr><tr><td><a href="#I2CWS">I2CWS</a> <a href="#h">h</a> <a href="#bv">bv</a></td><td>smb Write Byte: write byte </td><td><small><a href="cif.html#i2cWriteByte">i2cWriteByte</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#I2CRB">I2CRB</a> <a href="#h">h</a> <a href="#r">r</a></td><td>smb Read Byte Data: read byte from register </td><td><small><a href="cif.html#i2cReadByteData">i2cReadByteData</a></small></td></tr><tr><td><a href="#I2CWB">I2CWB</a> <a href="#h">h</a> <a href="#r">r</a> <a href="#bv">bv</a></td><td>smb Write Byte Data: write byte to register </td><td><small><a href="cif.html#i2cWriteByteData">i2cWriteByteData</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#I2CRW">I2CRW</a> <a href="#h">h</a> <a href="#r">r</a></td><td>smb Read Word Data: read word from register </td><td><small><a href="cif.html#i2cReadWordData">i2cReadWordData</a></small></td></tr><tr><td><a href="#I2CWW">I2CWW</a> <a href="#h">h</a> <a href="#r">r</a> <a href="#wv">wv</a></td><td>smb Write Word Data: write word to register </td><td><small><a href="cif.html#i2cWriteWordData">i2cWriteWordData</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#I2CRK">I2CRK</a> <a href="#h">h</a> <a href="#r">r</a></td><td>smb Read Block Data: read data from register </td><td><small><a href="cif.html#i2cReadBlockData">i2cReadBlockData</a></small></td></tr><tr><td><a href="#I2CWK">I2CWK</a> <a href="#h">h</a> <a href="#r">r</a> <a href="#bvs">bvs</a></td><td>smb Write Block Data: write data to register </td><td><small><a href="cif.html#i2cWriteBlockData">i2cWriteBlockData</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#I2CWI">I2CWI</a> <a href="#h">h</a> <a href="#r">r</a> <a href="#bvs">bvs</a></td><td>smb Write I2C Block Data </td><td><small><a href="cif.html#i2cWriteI2CBlockData">i2cWriteI2CBlockData</a></small></td></tr><tr><td><a href="#I2CRI">I2CRI</a> <a href="#h">h</a> <a href="#r">r</a> <a href="#num">num</a></td><td>smb Read I2C Block Data: read bytes from register </td><td><small><a href="cif.html#i2cReadI2CBlockData">i2cReadI2CBlockData</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#I2CRD">I2CRD</a> <a href="#h">h</a> <a href="#num">num</a></td><td>i2c Read device </td><td><small><a href="cif.html#i2cReadDevice">i2cReadDevice</a></small></td></tr><tr><td><a href="#I2CWD">I2CWD</a> <a href="#h">h</a> <a href="#bvs">bvs</a></td><td>i2c Write device </td><td><small><a href="cif.html#i2cWriteDevice">i2cWriteDevice</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#I2CPC">I2CPC</a> <a href="#h">h</a> <a href="#r">r</a> <a href="#wv">wv</a></td><td>smb Process Call: exchange register with word </td><td><small><a href="cif.html#i2cProcessCall">i2cProcessCall</a></small></td></tr><tr><td><a href="#I2CPK">I2CPK</a> <a href="#h">h</a> <a href="#r">r</a> <a href="#bvs">bvs</a></td><td>smb Block Process Call: exchange data bytes with register </td><td><small><a href="cif.html#i2cBlockProcessCall">i2cBlockProcessCall</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#I2CZ">I2CZ</a> <a href="#h">h</a> <a href="#bvs">bvs</a></td><td>Performs multiple I2C transactions </td><td><small><a href="cif.html#i2cZip">i2cZip</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>I2C BIT BANG
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#BI2CO">BI2CO</a> <a href="#sda">sda</a> <a href="#scl">scl</a> <a href="#b">b</a></td><td>Open bit bang I2C </td><td><small><a href="cif.html#bbI2COpen">bbI2COpen</a></small></td></tr><tr><td><a href="#BI2CC">BI2CC</a> <a href="#sda">sda</a></td><td>Close bit bang I2C </td><td><small><a href="cif.html#bbI2CClose">bbI2CClose</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#BI2CZ">BI2CZ</a> <a href="#sda">sda</a> <a href="#bvs">bvs</a></td><td>I2C bit bang multiple transactions </td><td><small><a href="cif.html#bbI2CZip">bbI2CZip</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>I2C/SPI SLAVE
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#BSCX">BSCX</a> <a href="#bctl">bctl</a> <a href="#bvs">bvs</a></td><td>BSC I2C/SPI transfer </td><td><small><a href="cif.html#bscXfer">bscXfer</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>SERIAL
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#SERO">SERO</a> <a href="#dev">dev</a> <a href="#b">b</a> <a href="#sef">sef</a></td><td>Open serial device dev at baud b with flags </td><td><small><a href="cif.html#serOpen">serOpen</a></small></td></tr><tr><td><a href="#SERC">SERC</a> <a href="#h">h</a></td><td>Close serial handle </td><td><small><a href="cif.html#serClose">serClose</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#SERRB">SERRB</a></td><td>Read byte from serial handle </td><td><small><a href="cif.html#serReadByte">serReadByte</a></small></td></tr><tr><td><a href="#SERWB">SERWB</a> <a href="#h">h</a> <a href="#bv">bv</a></td><td>Write byte to serial handle </td><td><small><a href="cif.html#serWriteByte">serWriteByte</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#SERR">SERR</a> <a href="#h">h</a> <a href="#num">num</a></td><td>Read bytes from serial handle </td><td><small><a href="cif.html#serRead">serRead</a></small></td></tr><tr><td><a href="#SERW">SERW</a> <a href="#h">h</a> <a href="#bvs">bvs</a></td><td>Write bytes to serial handle </td><td><small><a href="cif.html#serWrite">serWrite</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#SERDA">SERDA</a> <a href="#h">h</a></td><td>Check for serial data ready to read </td><td><small><a href="cif.html#serDataAvailable">serDataAvailable</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>SERIAL BIT BANG (read only)
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#SLRO">SLRO</a> <a href="#u">u</a> <a href="#b">b</a> <a href="#db">db</a></td><td>Open GPIO for bit bang serial data </td><td><small><a href="cif.html#gpioSerialReadOpen">gpioSerialReadOpen</a></small></td></tr><tr><td><a href="#SLRC">SLRC</a> <a href="#u">u</a></td><td>Close GPIO for bit bang serial data </td><td><small><a href="cif.html#gpioSerialReadClose">gpioSerialReadClose</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#SLRI">SLRI</a> <a href="#u">u</a> <a href="#v">v</a></td><td>Sets bit bang serial data logic levels </td><td><small><a href="cif.html#gpioSerialReadInvert">gpioSerialReadInvert</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#SLR">SLR</a> <a href="#u">u</a> <a href="#num">num</a></td><td>Read bit bang serial data from GPIO </td><td><small><a href="cif.html#gpioSerialRead">gpioSerialRead</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>SPI
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#SPIO">SPIO</a> <a href="#c">c</a> <a href="#b">b</a> <a href="#spf">spf</a></td><td>SPI open channel at baud b with flags </td><td><small><a href="cif.html#spiOpen">spiOpen</a></small></td></tr><tr><td><a href="#SPIC">SPIC</a> <a href="#h">h</a></td><td>SPI close handle </td><td><small><a href="cif.html#spiClose">spiClose</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#SPIR">SPIR</a> <a href="#h">h</a> <a href="#num">num</a></td><td>SPI read bytes from handle </td><td><small><a href="cif.html#spiRead">spiRead</a></small></td></tr><tr><td><a href="#SPIW">SPIW</a> <a href="#h">h</a> <a href="#bvs">bvs</a></td><td>SPI write bytes to handle </td><td><small><a href="cif.html#spiWrite">spiWrite</a></small></td></tr><tr><td><a href="#SPIX">SPIX</a> <a href="#h">h</a> <a href="#bvs">bvs</a></td><td>SPI transfer bytes to handle </td><td><small><a href="cif.html#spiXfer">spiXfer</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>SPI BIT BANG
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#BSPIO">BSPIO</a> <a href="#cs">cs</a> <a href="#miso">miso</a> <a href="#mosi">mosi</a> <a href="#sclk">sclk</a> <a href="#b">b</a> <a href="#spf">spf</a></td><td>Open bit bang SPI </td><td><small><a href="cif.html#bbSPIOpen">bbSPIOpen</a></small></td></tr><tr><td><a href="#BSPIC">BSPIC</a> <a href="#cs">cs</a></td><td>Close bit bang SPI </td><td><small><a href="cif.html#bbSPIClose">bbSPIClose</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#BSPIX">BSPIX</a> <a href="#cs">cs</a> <a href="#bvs">bvs</a></td><td>SPI bit bang transfer </td><td><small><a href="cif.html#bbSPIXfer">bbSPIXfer</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>FILES
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#FO">FO</a> <a href="#file">file</a> <a href="#mode">mode</a></td><td>Open a file in mode </td><td><small><a href="cif.html#fileOpen">fileOpen</a></small></td></tr><tr><td><a href="#FC">FC</a> <a href="#h">h</a></td><td>Close file handle </td><td><small><a href="cif.html#fileClose">fileClose</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#FR">FR</a> <a href="#h">h</a> <a href="#num">num</a></td><td>Read bytes from file handle </td><td><small><a href="cif.html#fileRead">fileRead</a></small></td></tr><tr><td><a href="#FW">FW</a> <a href="#h">h</a> <a href="#bvs">bvs</a></td><td>Write bytes to file handle </td><td><small><a href="cif.html#fileWrite">fileWrite</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#FS">FS</a> <a href="#h">h</a> <a href="#num">num</a> <a href="#from">from</a></td><td>Seek to file handle position </td><td><small><a href="cif.html#fileSeek">fileSeek</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#FL">FL</a> <a href="#pat">pat</a> <a href="#num">num</a></td><td>List files which match pattern </td><td><small><a href="cif.html#fileList">fileList</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>WAVES
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#WVCLR">WVCLR</a></td><td>Clear all waveforms </td><td><small><a href="cif.html#gpioWaveClear">gpioWaveClear</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#WVNEW">WVNEW</a></td><td>Initialise a new waveform </td><td><small><a href="cif.html#gpioWaveAddNew">gpioWaveAddNew</a></small></td></tr><tr><td><a href="#WVAG">WVAG</a> <a href="#trips">trips</a></td><td>Add generic pulses to waveform </td><td><small><a href="cif.html#gpioWaveAddGeneric">gpioWaveAddGeneric</a></small></td></tr><tr><td><a href="#WVAS">WVAS</a> <a href="#u">u</a> <a href="#b">b</a> <a href="#db">db</a> <a href="#sb">sb</a> <a href="#o">o</a> <a href="#bvs">bvs</a></td><td>Add serial data to waveform </td><td><small><a href="cif.html#gpioWaveAddSerial">gpioWaveAddSerial</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#WVCRE">WVCRE</a></td><td>Create a waveform </td><td><small><a href="cif.html#gpioWaveCreate">gpioWaveCreate</a></small></td></tr><tr><td><a href="#WVCAP">WVCAP</a></td><td>Create a waveform of fixed size </td><td><small><a href="cif.html#gpioWaveCreatePad">gpioWaveCreatePad</a></small></td></tr><tr><td><a href="#WVDEL">WVDEL</a> <a href="#wid">wid</a></td><td>Delete selected waveform </td><td><small><a href="cif.html#gpioWaveDelete">gpioWaveDelete</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#WVTX">WVTX</a> <a href="#wid">wid</a></td><td>Transmits waveform once </td><td><small><a href="cif.html#gpioWaveTxSend">gpioWaveTxSend</a></small></td></tr><tr><td><a href="#WVTXM">WVTXM</a> <a href="#wid">wid</a> <a href="#wmde">wmde</a></td><td>Transmits waveform using mode </td><td><small><a href="cif.html#gpioWaveTxSend">gpioWaveTxSend</a></small></td></tr><tr><td><a href="#WVTXR">WVTXR</a> <a href="#wid">wid</a></td><td>Transmits waveform repeatedly </td><td><small><a href="cif.html#gpioWaveTxSend">gpioWaveTxSend</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#WVCHA">WVCHA</a> <a href="#bvs">bvs</a></td><td>Transmits a chain of waveforms </td><td><small><a href="cif.html#gpioWaveChain">gpioWaveChain</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#WVTAT">WVTAT</a></td><td>Returns the current transmitting waveform </td><td><small><a href="cif.html#gpioWaveTxAt">gpioWaveTxAt</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#WVBSY">WVBSY</a></td><td>Check if waveform is being transmitted </td><td><small><a href="cif.html#gpioWaveTxBusy">gpioWaveTxBusy</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#WVHLT">WVHLT</a></td><td>Stop waveform </td><td><small><a href="cif.html#gpioWaveTxStop">gpioWaveTxStop</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#WVSC">WVSC</a> <a href="#ws">ws</a></td><td>Get waveform DMA CB stats </td><td><small><a href="cif.html#gpioWaveGetCbs">gpioWaveGetCbs</a></small></td></tr><tr><td><a href="#WVSM">WVSM</a> <a href="#ws">ws</a></td><td>Get waveform time stats </td><td><small><a href="cif.html#gpioWaveGetMicros">gpioWaveGetMicros</a></small></td></tr><tr><td><a href="#WVSP">WVSP</a> <a href="#ws">ws</a></td><td>Get waveform pulse stats </td><td><small><a href="cif.html#gpioWaveGetPulses">gpioWaveGetPulses</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>UTILITIES
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#H/HELP">H/HELP</a></td><td>Display command help </td><td><small><a href="cif.html#"></a></small></td></tr><tr><td><a href="#HWVER">HWVER</a></td><td>Get hardware version </td><td><small><a href="cif.html#gpioHardwareRevision">gpioHardwareRevision</a></small></td></tr><tr><td><a href="#MICS">MICS</a> <a href="#v">v</a></td><td>Microseconds delay </td><td><small><a href="cif.html#gpioDelay">gpioDelay</a></small></td></tr><tr><td><a href="#MILS">MILS</a> <a href="#v">v</a></td><td>Milliseconds delay </td><td><small><a href="cif.html#gpioDelay">gpioDelay</a></small></td></tr><tr><td><a href="#PIGPV">PIGPV</a></td><td>Get pigpio library version </td><td><small><a href="cif.html#gpioVersion">gpioVersion</a></small></td></tr><tr><td><a href="#T/TICK">T/TICK</a></td><td>Get current tick </td><td><small><a href="cif.html#gpioTick">gpioTick</a></small></td></tr><tr><td></td><td></td><td></td></tr><tr><td>CONFIGURATION
-</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td><a href="#CGI">CGI</a></td><td>Configuration get internals </td><td><small><a href="cif.html#gpioCfgGetInternals">gpioCfgGetInternals</a></small></td></tr><tr><td><a href="#CSI">CSI</a> <a href="#v">v</a></td><td>Configuration set internals </td><td><small><a href="cif.html#gpioCfgSetInternals">gpioCfgSetInternals</a></small></td></tr><tr><td></td><td></td><td></td></tr></tbody></table><h2><a name="Commands">Commands</a></h2>
-<h3><a name="BC1">BC1</a>
- <a href="#bits">bits</a> - Clear specified GPIO in bank 1</h3>This command clears (sets low) the GPIO specified by <a href="#bits">bits</a> in bank 1.
-Bank 1 consists of GPIO 0-31.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;bc1&nbsp;0x400010&nbsp;#&nbsp;clear&nbsp;GPIO&nbsp;4&nbsp;(1&lt;&lt;4)&nbsp;and&nbsp;22&nbsp;(1&lt;&lt;22)<br><br>$&nbsp;pigs&nbsp;bc1&nbsp;32&nbsp;#&nbsp;clear&nbsp;GPIO&nbsp;5&nbsp;(1&lt;&lt;5)<br>-42<br>ERROR:&nbsp;no&nbsp;permission&nbsp;to&nbsp;update&nbsp;one&nbsp;or&nbsp;more&nbsp;GPIO<br></code><h3><a name="BC2">BC2</a>
- <a href="#bits">bits</a> - Clear specified GPIO in bank 2</h3>This command clears (sets low) the GPIO specified by <a href="#bits">bits</a> in bank 2.
-Bank 2 consists of GPIO 32-53.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;bc2&nbsp;0x8000&nbsp;#&nbsp;clear&nbsp;GPIO&nbsp;47&nbsp;(activity&nbsp;LED&nbsp;on&nbsp;A+/B+/Pi2/Pi3)<br><br>$&nbsp;pigs&nbsp;bc2&nbsp;1&nbsp;#&nbsp;clear&nbsp;GPIO&nbsp;32&nbsp;(first&nbsp;in&nbsp;bank&nbsp;2)<br>-42<br>ERROR:&nbsp;no&nbsp;permission&nbsp;to&nbsp;update&nbsp;one&nbsp;or&nbsp;more&nbsp;GPIO<br></code><h3><a name="BI2CC">BI2CC</a>
- <a href="#sda">sda</a> - Close bit bang I2C</h3>This command signals that bit banging I2C on <a href="#sda">sda</a> (and <a href="#scl">scl</a>) is no
-longer required.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;bi2cc&nbsp;5<br></code><h3><a name="BI2CO">BI2CO</a>
- <a href="#sda">sda</a> <a href="#scl">scl</a> <a href="#b">b</a> - Open bit bang I2C</h3>This command signals that GPIO <a href="#sda">sda</a> and <a href="#scl">scl</a> are to be used
-for bit banging I2C at <a href="#b">b</a> baud.
-<br><br>Bit banging I2C allows for certain operations which are not possible
-with the standard I2C driver.
-<br><br>o baud rates as low as 50<br>
-o repeated starts<br>
-o clock stretching<br>
-o I2C on any pair of spare GPIO
-<br><br>The baud rate may be between 50 and 500000 bits per second.
-<br><br>The GPIO used for SDA and SCL must have pull-ups to 3V3 connected. As
-a guide the hardware pull-ups on pins 3 and 5 are 1k8 in value.
-<h3><a name="BI2CZ">BI2CZ</a>
- <a href="#sda">sda</a> <a href="#bvs">bvs</a> - I2C bit bang multiple transactions</h3>This function executes a sequence of bit banged I2C operations. The
-operations to be performed are specified by the contents of <a href="#bvs">bvs</a>
-which contains the concatenated command codes and associated data.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>End</td><td>0</td><td>No more commands</td></tr><tr><td>Escape</td><td>1</td><td>Next P is two bytes</td></tr><tr><td>Start</td><td>2</td><td>Start condition</td></tr><tr><td>Stop</td><td>3</td><td>Stop condition</td></tr><tr><td>Address</td><td>4 P</td><td>Set I2C address to P</td></tr><tr><td>Flags</td><td>5 lsb msb</td><td>Set I2C flags to lsb + (msb &lt;&lt; 8)</td></tr><tr><td>Read</td><td>6 P</td><td>Read P bytes of data</td></tr><tr><td>Write</td><td>7 P ...</td><td>Write P bytes of data</td></tr></tbody></table><br><br>The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-<br><br>The address and flags default to 0. The address and flags maintain
-their previous value until updated.
-<br><br>No flags are currently defined.
-<br><br><b><small>Example</small></b><br><br><code>Set&nbsp;address&nbsp;0x53<br>start,&nbsp;write&nbsp;0x32,&nbsp;(re)start,&nbsp;read&nbsp;6&nbsp;bytes,&nbsp;stop<br>Set&nbsp;address&nbsp;0x1E<br>start,&nbsp;write&nbsp;0x03,&nbsp;(re)start,&nbsp;read&nbsp;6&nbsp;bytes,&nbsp;stop<br>Set&nbsp;address&nbsp;0x68<br>start,&nbsp;write&nbsp;0x1B,&nbsp;(re)start,&nbsp;read&nbsp;8&nbsp;bytes,&nbsp;stop<br>End<br><br>0x04&nbsp;0x53<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x32&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x06&nbsp;0x03<br><br>0x04&nbsp;0x1E<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x03&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x06&nbsp;0x03<br><br>0x04&nbsp;0x68<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x1B&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x08&nbsp;0x03<br><br>0x00<br></code><h3><a name="BR1">BR1</a>
- - Read bank 1 GPIO</h3>This command read GPIO 0-31 (bank 1) and returns the levels as a
-32-bit hexadecimal value.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;br1<br>1001C1CF<br></code><h3><a name="BR2">BR2</a>
- - Read bank 2 GPIO</h3>This command read GPIO 32-53 (bank 2) and returns the levels as a
-32-bit hexadecimal value.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;br2<br>003F0000<br></code><h3><a name="BS1">BS1</a>
- <a href="#bits">bits</a> - Set specified GPIO in bank 1</h3>This command sets (sets high) the GPIO specified by <a href="#bits">bits</a> in bank 1.
-Bank 1 consists of GPIO 0-31.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;bs1&nbsp;16&nbsp;#&nbsp;set&nbsp;GPIO&nbsp;4&nbsp;(1&lt;&lt;4)<br><br>$&nbsp;pigs&nbsp;bs1&nbsp;1&nbsp;#&nbsp;set&nbsp;GPIO&nbsp;1&nbsp;(1&lt;&lt;0)<br>-42<br>ERROR:&nbsp;no&nbsp;permission&nbsp;to&nbsp;update&nbsp;one&nbsp;or&nbsp;more&nbsp;GPIO<br></code><h3><a name="BS2">BS2</a>
- <a href="#bits">bits</a> - Set specified GPIO in bank 2</h3>This command sets (sets high) the GPIO specified by <a href="#bits">bits</a> in bank 2.
-Bank 2 consists of GPIO 32-53.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;bs2&nbsp;0x40&nbsp;#&nbsp;set&nbsp;GPIO&nbsp;38&nbsp;(enable&nbsp;high&nbsp;current&nbsp;mode&nbsp;A+/B+/Pi2/Pi3)<br><br>$&nbsp;pigs&nbsp;bs2&nbsp;1&nbsp;#&nbsp;set&nbsp;GPIO&nbsp;32&nbsp;(first&nbsp;in&nbsp;bank&nbsp;2)<br>-42<br>ERROR:&nbsp;no&nbsp;permission&nbsp;to&nbsp;update&nbsp;one&nbsp;or&nbsp;more&nbsp;GPIO<br></code><h3><a name="BSCX">BSCX</a>
- <a href="#bctl">bctl</a> <a href="#bvs">bvs</a> - BSC I2C/SPI transfer</h3>This command performs a BSC I2C/SPI slave transfer as defined by
-<a href="#bctl">bctl</a> with data <a href="#bvs">bvs</a>.
-<br><br>This function provides a low-level interface to the SPI/I2C Slave
-peripheral on the BCM chip.
-<br><br>This peripheral allows the Pi to act as a hardware slave device
-on an I2C or SPI bus.
-<br><br>This is not a bit bang version and as such is OS timing
-independent. The bus timing is handled directly by the chip.
-<br><br>The output process is simple. You simply append data to the FIFO
-buffer on the chip. This works like a queue, you add data to the
-queue and the master removes it.
-<br><br>I can't get SPI to work properly. I tried with a
-control word of 0x303 and swapped MISO and MOSI.
-<br><br>The command sets the BSC mode and writes any data <a href="#bvs">bvs</a>
-to the BSC transmit FIFO. It returns the data count (at least 1
-for the status word), the status word, followed by any data bytes
-read from the BSC receive FIFO.
-<br><br>Note that the control word sets the BSC mode. The BSC will stay in
-that mode until a different control word is sent.
-<br><br>For I2C use a control word of (I2C address &lt;&lt; 16) + 0x305.
-<br><br>E.g. to talk as I2C slave with address 0x13 use 0x130305.
-<br><br>GPIO used for models other than those based on the BCM2711.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td><td>MOSI</td><td>SCLK</td><td>MISO</td><td>CE</td></tr><tr><td>I2C</td><td>18</td><td>19</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>SPI</td><td>-</td><td>-</td><td>18</td><td>19</td><td>20</td><td>21</td></tr></tbody></table><br><br>GPIO used for models based on the BCM2711 (e.g. the Pi4B).
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td><td>MOSI</td><td>SCLK</td><td>MISO</td><td>CE</td></tr><tr><td>I2C</td><td>10</td><td>11</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>SPI</td><td>-</td><td>-</td><td>10</td><td>11</td><td>9</td><td>8</td></tr></tbody></table><br><br>When a zero control word is received the used GPIO will be reset
-to INPUT mode.
-<br><br>The control word consists of the following bits.
-<br><br><code>22&nbsp;21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;IT&nbsp;HC&nbsp;TF&nbsp;IR&nbsp;RE&nbsp;TE&nbsp;BK&nbsp;EC&nbsp;ES&nbsp;PL&nbsp;PH&nbsp;I2&nbsp;SP&nbsp;EN<br></code><br><br>Bits 0-13 are copied unchanged to the BSC CR register. See
-pages 163-165 of the Broadcom peripherals document for full
-details.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>aaaaaaa</td><td>defines the I2C slave address (only relevant in I2C mode)</td></tr><tr><td>IT</td><td>invert transmit status flags</td></tr><tr><td>HC</td><td>enable host control</td></tr><tr><td>TF</td><td>enable test FIFO</td></tr><tr><td>IR</td><td>invert receive status flags</td></tr><tr><td>RE</td><td>enable receive</td></tr><tr><td>TE</td><td>enable transmit</td></tr><tr><td>BK</td><td>abort operation and clear FIFOs</td></tr><tr><td>EC</td><td>send control register as first I2C byte</td></tr><tr><td>ES</td><td>send status register as first I2C byte</td></tr><tr><td>PL</td><td>set SPI polarity high</td></tr><tr><td>PH</td><td>set SPI phase high</td></tr><tr><td>I2</td><td>enable I2C mode</td></tr><tr><td>SP</td><td>enable SPI mode</td></tr><tr><td>EN</td><td>enable BSC peripheral</td></tr></tbody></table><br><br>The returned status has the following format
-<br><br><code>20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;RB&nbsp;TE&nbsp;RF&nbsp;TF&nbsp;RE&nbsp;TB<br></code><br><br>Bits 0-15 are copied unchanged from the BSC FR register. See
-pages 165-166 of the Broadcom peripherals document for full
-details.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>SSSSS</td><td>number of bytes successfully copied to transmit FIFO</td></tr><tr><td>RRRRR</td><td>number of bytes in receieve FIFO</td></tr><tr><td>TTTTT</td><td>number of bytes in transmit FIFO</td></tr><tr><td>RB</td><td>receive busy</td></tr><tr><td>TE</td><td>transmit FIFO empty</td></tr><tr><td>RF</td><td>receive FIFO full</td></tr><tr><td>TF</td><td>transmit FIFO full</td></tr><tr><td>RE</td><td>receive FIFO empty</td></tr><tr><td>TB</td><td>transmit busy</td></tr></tbody></table><br><br>This example assumes that GPIO 2/3 are connected to GPIO 18/19
-(GPIO 10/11 on the BCM2711).
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;bscx&nbsp;0x130305&nbsp;#&nbsp;start&nbsp;BSC&nbsp;as&nbsp;I2C&nbsp;slave&nbsp;0x13<br>1&nbsp;18<br><br>$&nbsp;i2cdetect&nbsp;-y&nbsp;1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;1&nbsp;&nbsp;2&nbsp;&nbsp;3&nbsp;&nbsp;4&nbsp;&nbsp;5&nbsp;&nbsp;6&nbsp;&nbsp;7&nbsp;&nbsp;8&nbsp;&nbsp;9&nbsp;&nbsp;a&nbsp;&nbsp;b&nbsp;&nbsp;c&nbsp;&nbsp;d&nbsp;&nbsp;e&nbsp;&nbsp;f<br>00:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>10:&nbsp;--&nbsp;--&nbsp;--&nbsp;13&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>20:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>30:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>40:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>50:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>60:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>70:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br><br>$&nbsp;pigs&nbsp;i2co&nbsp;1&nbsp;0x13&nbsp;0&nbsp;#&nbsp;get&nbsp;handle&nbsp;for&nbsp;device&nbsp;0x13&nbsp;on&nbsp;bus&nbsp;1<br>0<br><br>$&nbsp;pigs&nbsp;i2cwd&nbsp;0&nbsp;90&nbsp;87&nbsp;51&nbsp;9&nbsp;23&nbsp;#&nbsp;write&nbsp;5&nbsp;bytes<br><br>$&nbsp;pigs&nbsp;bscx&nbsp;0x130305&nbsp;#&nbsp;check&nbsp;for&nbsp;data<br>6&nbsp;18&nbsp;90&nbsp;87&nbsp;51&nbsp;9&nbsp;23<br><br>$&nbsp;pigs&nbsp;bscx&nbsp;0x130305&nbsp;11&nbsp;13&nbsp;15&nbsp;17&nbsp;#&nbsp;check&nbsp;for&nbsp;data&nbsp;and&nbsp;send&nbsp;4&nbsp;bytes<br>1&nbsp;262338<br><br>$&nbsp;pigs&nbsp;i2crd&nbsp;0&nbsp;4&nbsp;#&nbsp;read&nbsp;4&nbsp;bytes<br>4&nbsp;11&nbsp;13&nbsp;15&nbsp;17<br><br>$&nbsp;pigs&nbsp;i2cwd&nbsp;0&nbsp;90&nbsp;87&nbsp;51&nbsp;9&nbsp;23&nbsp;#&nbsp;write&nbsp;5&nbsp;bytes<br>$&nbsp;pigs&nbsp;bscx&nbsp;0x130305&nbsp;11&nbsp;13&nbsp;15&nbsp;17&nbsp;#&nbsp;check&nbsp;for&nbsp;data&nbsp;and&nbsp;send&nbsp;4&nbsp;bytes<br>6&nbsp;262338&nbsp;90&nbsp;87&nbsp;51&nbsp;9&nbsp;23<br><br>$&nbsp;pigs&nbsp;i2crd&nbsp;0&nbsp;4<br>4&nbsp;11&nbsp;13&nbsp;15&nbsp;17<br><br>$&nbsp;pigs&nbsp;bscx&nbsp;0x130305&nbsp;22&nbsp;33&nbsp;44&nbsp;55&nbsp;66<br>1&nbsp;327938<br>$&nbsp;pigs&nbsp;i2crd&nbsp;0&nbsp;5<br>5&nbsp;22&nbsp;33&nbsp;44&nbsp;55&nbsp;66<br></code><h3><a name="BSPIC">BSPIC</a>
- <a href="#cs">cs</a> - Close bit bang SPI</h3>This command stops bit banging SPI on a set of GPIO
-opened with <a href="#BSPIO">BSPIO</a>.
-<br><br>The set of GPIO is specifed by <a href="#cs">cs</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;bspic&nbsp;10<br><br>$&nbsp;pigs&nbsp;bspic&nbsp;10<br>-142<br>ERROR:&nbsp;no&nbsp;bit&nbsp;bang&nbsp;SPI&nbsp;in&nbsp;progress&nbsp;on&nbsp;GPIO<br></code><h3><a name="BSPIO">BSPIO</a>
- <a href="#cs">cs</a> <a href="#miso">miso</a> <a href="#mosi">mosi</a> <a href="#sclk">sclk</a> <a href="#b">b</a> <a href="#spf">spf</a> - Open bit bang SPI</h3>This command starts bit banging SPI on a group of GPIO with slave
-select <a href="#cs">cs</a>, MISO <a href="#miso">miso</a>, MOSI <a href="#mosi">mosi</a>, and clock <a href="#sclk">sclk</a>.
-<br><br>Data will be transferred at baud <a href="#b">b</a> bits per second (which may
-be set in the range 50-250000).
-<br><br>The flags <a href="#spf">spf</a> may be used to modify the default behaviour of
-mode 0, active low chip select.
-<br><br>The flags consists of the least significant 22 bits.
-<br><br><code>21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;p&nbsp;&nbsp;m&nbsp;&nbsp;m<br></code><br><br>mm defines the SPI mode.
-<br><br><code>Mode&nbsp;POL&nbsp;PHA<br>&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;0<br>&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;1<br>&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;0<br>&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;1<br></code><br><br>p is 0 if CS is active low (default) and 1 for active high.
-<br><br>T is 1 if the least significant bit is transmitted on MOSI first, the
-default (0) shifts the most significant bit out first.
-<br><br>R is 1 if the least significant bit is received on MISO first, the
-default (0) receives the most significant bit first.
-<br><br>The other bits in flags should be set to zero.
-<br><br>Upon success 0 is returned. On error a negative status code
-will be returned.
-<br><br>If more than one device is connected to the SPI bus (defined by
-SCLK, MOSI, and MISO) each must have its own CS.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;bspio&nbsp;&nbsp;9&nbsp;11&nbsp;12&nbsp;13&nbsp;50000&nbsp;0<br><br>$&nbsp;pigs&nbsp;bspio&nbsp;10&nbsp;11&nbsp;12&nbsp;13&nbsp;50000&nbsp;0<br><br>$&nbsp;pigs&nbsp;bspio&nbsp;29&nbsp;19&nbsp;20&nbsp;21&nbsp;50000&nbsp;0&nbsp;#&nbsp;GPIO&nbsp;29&nbsp;not&nbsp;avaialble&nbsp;on&nbsp;this&nbsp;Pi<br>-41<br>ERROR:&nbsp;no&nbsp;permission&nbsp;to&nbsp;update&nbsp;GPIO<br></code><h3><a name="BSPIX">BSPIX</a>
- <a href="#cs">cs</a> <a href="#bvs">bvs</a> - SPI bit bang transfer</h3>This command writes bytes <a href="#bvs">bvs</a> to the bit bang SPI device
-associated with slave select <a href="#cs">cs</a>. It returns the same
-number of bytes read from the device.
-<br><br>Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;bspio&nbsp;5&nbsp;13&nbsp;19&nbsp;12&nbsp;10000&nbsp;0&nbsp;#&nbsp;MCP4251&nbsp;DAC<br>$&nbsp;pigs&nbsp;bspio&nbsp;6&nbsp;13&nbsp;19&nbsp;12&nbsp;20000&nbsp;3&nbsp;#&nbsp;MCP3008&nbsp;ADC<br><br>$&nbsp;pigs&nbsp;bspix&nbsp;5&nbsp;0&nbsp;16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;set&nbsp;DAC&nbsp;to&nbsp;16<br>2&nbsp;255&nbsp;255<br><br>$&nbsp;pigs&nbsp;bspix&nbsp;5&nbsp;12&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;read&nbsp;back&nbsp;DAC<br>2&nbsp;254&nbsp;16<br><br>$&nbsp;pigs&nbsp;bspix&nbsp;6&nbsp;1&nbsp;128&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;read&nbsp;ADC&nbsp;input&nbsp;0<br>3&nbsp;0&nbsp;3&nbsp;184&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;952<br><br>$&nbsp;pigs&nbsp;bspix&nbsp;5&nbsp;0&nbsp;240&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;set&nbsp;DAC&nbsp;to&nbsp;240<br>2&nbsp;255&nbsp;255<br><br>$&nbsp;pigs&nbsp;bspix&nbsp;5&nbsp;12&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;read&nbsp;back&nbsp;DAC<br>2&nbsp;254&nbsp;240<br><br>$&nbsp;pigs&nbsp;bspix&nbsp;6&nbsp;1&nbsp;128&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;read&nbsp;ADC&nbsp;input&nbsp;0<br>3&nbsp;0&nbsp;0&nbsp;63&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;63<br><br>$&nbsp;pigs&nbsp;bspix&nbsp;5&nbsp;0&nbsp;128&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;set&nbsp;DAC&nbsp;to&nbsp;128<br>2&nbsp;255&nbsp;255<br><br>$&nbsp;pigs&nbsp;bspix&nbsp;5&nbsp;12&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;read&nbsp;back&nbsp;DAC<br>2&nbsp;254&nbsp;128<br><br>$&nbsp;pigs&nbsp;bspix&nbsp;6&nbsp;1&nbsp;128&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;read&nbsp;ADC&nbsp;input&nbsp;0<br>3&nbsp;0&nbsp;1&nbsp;255&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;511<br><br>$&nbsp;pigs&nbsp;bspic&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;close&nbsp;SPI&nbsp;CS&nbsp;5<br>$&nbsp;pigs&nbsp;bspic&nbsp;6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;close&nbsp;SPI&nbsp;CS&nbsp;6<br><br>$&nbsp;pigs&nbsp;bspic&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;try&nbsp;to&nbsp;close&nbsp;SPI&nbsp;CS&nbsp;5&nbsp;again<br>-142<br>ERROR:&nbsp;no&nbsp;bit&nbsp;bang&nbsp;SPI&nbsp;in&nbsp;progress&nbsp;on&nbsp;GPIO<br></code><h3><a name="CF1">CF1</a>
- <a href="#uvs">uvs</a> - Custom function 1</h3>This command calls a user customised function. The meaning of
-any paramaters and the returned value is defined by the
-customiser.
-<h3><a name="CF2">CF2</a>
- <a href="#uvs">uvs</a> - Custom function 2</h3>This command calls a user customised function. The meaning of
-any paramaters and the returned value is defined by the
-customiser.
-<h3><a name="CGI">CGI</a>
- - Configuration get internals</h3>This command returns the value of the internal library
-configuration settings.
-<h3><a name="CSI">CSI</a>
- <a href="#v">v</a> - Configuration set internals</h3>This command sets the value of the internal library
-configuration settings to <a href="#v">v</a>.
-<h3><a name="EVM">EVM</a>
- <a href="#h">h</a> <a href="#bits">bits</a> - Set events to monitor</h3>This command starts event reporting on handle <a href="#h">h</a> (returned by
-a prior call to <a href="#NO">NO</a>).
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>The notification gets reports for each event specified by <a href="#bits">bits</a>.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;evm&nbsp;0&nbsp;-1&nbsp;#&nbsp;Shorthand&nbsp;for&nbsp;events&nbsp;0-31.<br>$&nbsp;pigs&nbsp;evm&nbsp;0&nbsp;0xf0&nbsp;#&nbsp;Get&nbsp;notifications&nbsp;for&nbsp;events&nbsp;4-7.<br><br>$&nbsp;pigs&nbsp;evm&nbsp;1&nbsp;0xf<br>-25<br>ERROR:&nbsp;unknown&nbsp;handle<br></code><h3><a name="EVT">EVT</a>
- <a href="#event">event</a> - Trigger event</h3>This command triggers event <a href="#event">event</a>.
-<br><br>One event, number 31, is predefined. This event is
-auto generated on BSC slave activity.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;evt&nbsp;12<br>$&nbsp;pigs&nbsp;evt&nbsp;5<br><br>$&nbsp;pigs&nbsp;evt&nbsp;32<br>-143<br>ERROR:&nbsp;bad&nbsp;event&nbsp;id<br></code><h3><a name="FC">FC</a>
- <a href="#h">h</a> - Close file handle</h3>This command closes a file handle <a href="#h">h</a> previously opened with <a href="#FO">FO</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;fc&nbsp;0&nbsp;#&nbsp;First&nbsp;close&nbsp;okay.<br><br>$&nbsp;pigs&nbsp;fc&nbsp;0&nbsp;#&nbsp;Second&nbsp;fails.<br>-25<br>ERROR:&nbsp;unknown&nbsp;handle<br></code><h3><a name="FG">FG</a>
- <a href="#u">u</a> <a href="#stdy">stdy</a> - Set a glitch filter on a GPIO</h3>Level changes on the GPIO <a href="#u">u</a> are not reported unless the level
-has been stable for at least <a href="#stdy">stdy</a> microseconds. The
-level is then reported. Level changes of less than <a href="#stdy">stdy</a>
-microseconds are ignored.
-<br><br>The filter only affects callbacks (including pipe notifications).
-<br><br>The <a href="#R/READ">R/READ</a>, <a href="#BR1">BR1</a>, and <a href="#BR2">BR2</a> commands are not affected.
-<br><br>Note, each (stable) edge will be timestamped <a href="#stdy">stdy</a> microseconds
-after it was first detected.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;fg&nbsp;4&nbsp;250<br><br>$&nbsp;pigs&nbsp;fg&nbsp;4&nbsp;1000000<br>-125<br>ERROR:&nbsp;bad&nbsp;filter&nbsp;parameter<br></code><h3><a name="FL">FL</a>
- <a href="#pat">pat</a> <a href="#num">num</a> - List files which match pattern</h3>This command returns a list of the files matching <a href="#pat">pat</a>. Up
-to <a href="#num">num</a> bytes may be returned.
-<br><br>Upon success the count of returned bytes followed by the matching
-files is returned. On error a negative status code will be returned.
-<br><br>A newline (0x0a) character separates each file name.
-<br><br>Only files which have a matching entry in /opt/pigpio/access may
-be listed.
-<br><br>Suppose /opt/pigpio/access contains
-<br><br>/sys/bus/w1/devices/28*/w1_slave r
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;-a&nbsp;fl&nbsp;"/sys/bus/w1/devices/28*/w1_slave"&nbsp;5000<br>90&nbsp;/sys/bus/w1/devices/28-000005d34cd2/w1_slave<br>/sys/bus/w1/devices/28-001414abbeff/w1_slave<br><br>$&nbsp;pigs&nbsp;-a&nbsp;fl&nbsp;"/sys/bus/*"&nbsp;5000<br>ERROR:&nbsp;no&nbsp;permission&nbsp;to&nbsp;access&nbsp;file<br>-137<br></code><h3><a name="FN">FN</a>
- <a href="#u">u</a> <a href="#stdy">stdy</a> <a href="#actv">actv</a> - Set a noise filter on a GPIO</h3>Level changes on the GPIO <a href="#u">u</a> are ignored until a level which has
-been stable for <a href="#stdy">stdy</a> microseconds is detected. Level
-changes on the GPIO are then reported for <a href="#actv">actv</a> microseconds
-after which the process repeats.
-<br><br>The filter only affects callbacks (including pipe notifications).
-<br><br>The <a href="#R/READ">R/READ</a>, <a href="#BR1">BR1</a>, and <a href="#BR2">BR2</a> commands are not affected.
-<br><br>Note, level changes before and after the active period may
-be reported. Your software must be designed to cope with
-such reports.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;fn&nbsp;7&nbsp;250&nbsp;1000<br><br>$&nbsp;pigs&nbsp;fn&nbsp;7&nbsp;2500000&nbsp;1000<br>-125<br>ERROR:&nbsp;bad&nbsp;filter&nbsp;parameter<br></code><h3><a name="FO">FO</a>
- <a href="#file">file</a> <a href="#mode">mode</a> - Open a file in mode</h3>This function returns a handle to a file <a href="#file">file</a> opened
-in a specified mode <a href="#mode">mode</a>.
-<br><br>Upon success a handle (&gt;=0) is returned. On error a negative status code
-will be returned.
-<br><br>File
-<br><br>A file may only be opened if permission is granted by an entry in
-/opt/pigpio/access. This is intended to allow remote access to files
-in a more or less controlled manner.
-<br><br>Each entry in /opt/pigpio/access takes the form of a file path
-which may contain wildcards followed by a single letter permission.
-The permission may be R for read, W for write, U for read/write,
-and N for no access.
-<br><br>Where more than one entry matches a file the most specific rule
-applies. If no entry matches a file then access is denied.
-<br><br>Suppose /opt/pigpio/access contains the following entries
-<br><br><code>/home/*&nbsp;n<br>/home/pi/shared/dir_1/*&nbsp;w<br>/home/pi/shared/dir_2/*&nbsp;r<br>/home/pi/shared/dir_3/*&nbsp;u<br>/home/pi/shared/dir_1/file.txt&nbsp;n<br></code><br><br>Files may be written in directory dir_1 with the exception
-of file.txt.
-<br><br>Files may be read in directory dir_2.
-<br><br>Files may be read and written in directory dir_3.
-<br><br>If a directory allows read, write, or read/write access then files may
-be created in that directory.
-<br><br>In an attempt to prevent risky permissions the following paths are
-ignored in /opt/pigpio/access.
-<br><br><code>a&nbsp;path&nbsp;containing&nbsp;..<br>a&nbsp;path&nbsp;containing&nbsp;only&nbsp;wildcards&nbsp;(*?)<br>a&nbsp;path&nbsp;containing&nbsp;less&nbsp;than&nbsp;two&nbsp;non-wildcard&nbsp;parts<br></code><br><br>Mode
-<br><br>The mode may have the following values.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>Value</td><td>Meaning</td></tr><tr><td>READ</td><td>1</td><td>open file for reading</td></tr><tr><td>WRITE</td><td>2</td><td>open file for writing</td></tr><tr><td>RW</td><td>3</td><td>open file for reading and writing</td></tr></tbody></table><br><br>The following values may be or'd into the mode.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>Value</td><td>Meaning</td></tr><tr><td>APPEND</td><td>4</td><td>All writes append data to the end of the file</td></tr><tr><td>CREATE</td><td>8</td><td>The file is created if it doesn't exist</td></tr><tr><td>TRUNC</td><td>16</td><td>The file is truncated</td></tr></tbody></table><br><br>Newly created files are owned by root with permissions owner read and write.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;ls&nbsp;/ram/*.c<br>/ram/command.c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/ram/pigpiod.c&nbsp;&nbsp;/ram/pigs.c<br>/ram/x_pigpiod_if.c&nbsp;/ram/pig2vcd.c&nbsp;&nbsp;/ram/pigpiod_if2.c<br>/ram/x_pigpio.c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/ram/x_repeat.c&nbsp;/ram/pigpio.c<br>/ram/pigpiod_if.c&nbsp;&nbsp;&nbsp;/ram/x_pigpiod_if2.c<br><br>#&nbsp;assumes&nbsp;/opt/pigpio/access&nbsp;contains&nbsp;the&nbsp;following&nbsp;line<br>#&nbsp;/ram/*.c&nbsp;r<br><br>$&nbsp;pigs&nbsp;fo&nbsp;/ram/pigpio.c&nbsp;1<br>0<br><br>$&nbsp;pigs&nbsp;fo&nbsp;/ram/new.c&nbsp;1<br>-128<br>ERROR:&nbsp;file&nbsp;open&nbsp;failed<br><br>$&nbsp;pigs&nbsp;fo&nbsp;/ram/new.c&nbsp;9<br>1<br><br>$&nbsp;ls&nbsp;/ram/*.c&nbsp;-l<br>-rw-r--r--&nbsp;1&nbsp;joan&nbsp;joan&nbsp;&nbsp;42923&nbsp;Jul&nbsp;10&nbsp;11:22&nbsp;/ram/command.c<br>-rw-------&nbsp;1&nbsp;root&nbsp;root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;Jul&nbsp;10&nbsp;16:54&nbsp;/ram/new.c<br>-rw-r--r--&nbsp;1&nbsp;joan&nbsp;joan&nbsp;&nbsp;&nbsp;2971&nbsp;Jul&nbsp;10&nbsp;11:22&nbsp;/ram/pig2vcd.c<br>-rw-------&nbsp;1&nbsp;joan&nbsp;joan&nbsp;296235&nbsp;Jul&nbsp;10&nbsp;11:22&nbsp;/ram/pigpio.c<br>-rw-r--r--&nbsp;1&nbsp;joan&nbsp;joan&nbsp;&nbsp;&nbsp;9266&nbsp;Jul&nbsp;10&nbsp;11:22&nbsp;/ram/pigpiod.c<br>-rw-r--r--&nbsp;1&nbsp;joan&nbsp;joan&nbsp;&nbsp;37331&nbsp;Jul&nbsp;10&nbsp;11:22&nbsp;/ram/pigpiod_if2.c<br>-rw-r--r--&nbsp;1&nbsp;joan&nbsp;joan&nbsp;&nbsp;33088&nbsp;Jul&nbsp;10&nbsp;11:22&nbsp;/ram/pigpiod_if.c<br>-rw-r--r--&nbsp;1&nbsp;joan&nbsp;joan&nbsp;&nbsp;&nbsp;7990&nbsp;Jul&nbsp;10&nbsp;11:22&nbsp;/ram/pigs.c<br>-rw-r--r--&nbsp;1&nbsp;joan&nbsp;joan&nbsp;&nbsp;19970&nbsp;Jul&nbsp;10&nbsp;11:22&nbsp;/ram/x_pigpio.c<br>-rw-r--r--&nbsp;1&nbsp;joan&nbsp;joan&nbsp;&nbsp;20804&nbsp;Jul&nbsp;10&nbsp;11:22&nbsp;/ram/x_pigpiod_if2.c<br>-rw-r--r--&nbsp;1&nbsp;joan&nbsp;joan&nbsp;&nbsp;19844&nbsp;Jul&nbsp;10&nbsp;11:22&nbsp;/ram/x_pigpiod_if.c<br>-rw-r--r--&nbsp;1&nbsp;joan&nbsp;joan&nbsp;&nbsp;19907&nbsp;Jul&nbsp;10&nbsp;11:22&nbsp;/ram/x_repeat.c<br></code><h3><a name="FR">FR</a>
- <a href="#h">h</a> <a href="#num">num</a> - Read bytes from file handle</h3>This command returns up to <a href="#num">num</a> bytes of data read from the
-file associated with handle <a href="#h">h</a>.
-<br><br>Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;fr&nbsp;0&nbsp;10<br>5&nbsp;48&nbsp;49&nbsp;128&nbsp;144&nbsp;255<br><br>$&nbsp;pigs&nbsp;fr&nbsp;0&nbsp;10<br>0<br></code><h3><a name="FS">FS</a>
- <a href="#h">h</a> <a href="#num">num</a> <a href="#from">from</a> - Seek to file handle position</h3>This command seeks to a position within the file associated
-with handle <a href="#h">h</a>.
-<br><br>The number of bytes to move is <a href="#num">num</a>. Positive offsets
-move forward, negative offsets backwards. The move start
-position is determined by <a href="#from">from</a> as follows.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>From</td></tr><tr><td>0</td><td>start</td></tr><tr><td>1</td><td>current position</td></tr><tr><td>2</td><td>end</td></tr></tbody></table><br><br>Upon success the new byte position within the file (&gt;=0) is
-returned. On error a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;fs&nbsp;0&nbsp;200&nbsp;0&nbsp;#&nbsp;Seek&nbsp;to&nbsp;start&nbsp;of&nbsp;file&nbsp;plus&nbsp;200<br>200<br><br>$&nbsp;pigs&nbsp;fs&nbsp;0&nbsp;0&nbsp;1&nbsp;#&nbsp;Return&nbsp;current&nbsp;position<br>200<br><br>$&nbsp;pigs&nbsp;fs&nbsp;0&nbsp;0&nbsp;2&nbsp;#&nbsp;Seek&nbsp;to&nbsp;end&nbsp;of&nbsp;file,&nbsp;return&nbsp;size<br>296235<br></code><h3><a name="FW">FW</a>
- <a href="#h">h</a> <a href="#bvs">bvs</a> - Write bytes to file handle</h3>This command writes bytes <a href="#bvs">bvs</a> to the file
-associated with handle <a href="#h">h</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;fw&nbsp;0&nbsp;23&nbsp;45&nbsp;67&nbsp;89<br></code><h3><a name="GDC">GDC</a>
- <a href="#u">u</a> - Get GPIO PWM dutycycle</h3>This command returns the PWM dutycycle in use on GPIO <a href="#u">u</a>.
-<br><br>Upon success the dutycycle is returned. On error a negative
-status code will be returned.
-<br><br>For normal PWM the dutycycle will be out of the defined range
-for the GPIO (see <a href="#PRG">PRG</a>).
-<br><br>If a hardware clock is active on the GPIO the reported
-dutycycle will be 500000 (500k) out of 1000000 (1M).
-<br><br>If hardware PWM is active on the GPIO the reported dutycycle
-will be out of a 1000000 (1M).
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;p&nbsp;4&nbsp;129<br>$&nbsp;pigs&nbsp;gdc&nbsp;4<br>129<br><br>pigs&nbsp;gdc&nbsp;5<br>-92<br>ERROR:&nbsp;GPIO&nbsp;is&nbsp;not&nbsp;in&nbsp;use&nbsp;for&nbsp;PWM<br></code><h3><a name="GPW">GPW</a>
- <a href="#u">u</a> - Get GPIO servo pulsewidth</h3>This command returns the servo pulsewidth in use on GPIO <a href="#u">u</a>.
-<br><br>Upon success the servo pulsewidth is returned. On error a negative
-status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;s&nbsp;4&nbsp;1235<br>$&nbsp;pigs&nbsp;gpw&nbsp;4<br>1235<br><br>$&nbsp;pigs&nbsp;gpw&nbsp;9<br>-93<br>ERROR:&nbsp;GPIO&nbsp;is&nbsp;not&nbsp;in&nbsp;use&nbsp;for&nbsp;servo&nbsp;pulses<br></code><h3><a name="H/HELP">H/HELP</a>
- - Display command help</h3>This command displays a brief list of the commands and their parameters.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;h<br><br>$&nbsp;pigs&nbsp;help<br></code><h3><a name="HC">HC</a>
- <a href="#g">g</a> <a href="#cf">cf</a> - Set hardware clock frequency</h3>This command sets the hardware clock associated with GPIO <a href="#g">g</a> to
-frequency <a href="#cf">cf</a>. Frequencies above 30MHz are unlikely to work.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;hc&nbsp;4&nbsp;5000&nbsp;#&nbsp;start&nbsp;a&nbsp;5&nbsp;KHz&nbsp;clock&nbsp;on&nbsp;GPIO&nbsp;4&nbsp;(clock&nbsp;0)<br><br>$&nbsp;pigs&nbsp;hc&nbsp;5&nbsp;5000000&nbsp;#&nbsp;start&nbsp;a&nbsp;5&nbsp;MHz&nbsp;clcok&nbsp;on&nbsp;GPIO&nbsp;5&nbsp;(clock&nbsp;1)<br>-99<br>ERROR:&nbsp;need&nbsp;password&nbsp;to&nbsp;use&nbsp;hardware&nbsp;clock&nbsp;1<br></code><br><br>The same clock is available on multiple GPIO. The latest
-frequency setting will be used by all GPIO which share a clock.
-<br><br>The GPIO must be one of the following.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>4</td><td>clock 0</td><td>All models</td></tr><tr><td>5</td><td>clock 1</td><td>All models but A and B (reserved for system use)</td></tr><tr><td>6</td><td>clock 2</td><td>All models but A and B</td></tr><tr><td>20</td><td>clock 0</td><td>All models but A and B</td></tr><tr><td>21</td><td>clock 1</td><td>All models but A and B Rev.2 (reserved for system use)</td></tr></tbody></table><br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>32</td><td>clock 0</td><td>Compute module only</td></tr><tr><td>34</td><td>clock 0</td><td>Compute module only</td></tr><tr><td>42</td><td>clock 1</td><td>Compute module only (reserved for system use)</td></tr><tr><td>43</td><td>clock 2</td><td>Compute module only</td></tr><tr><td>44</td><td>clock 1</td><td>Compute module only (reserved for system use)</td></tr></tbody></table><br><br>Access to clock 1 is protected by a password as its use will
-likely crash the Pi. The password is given by or'ing 0x5A000000
-with the GPIO number.
-<h3><a name="HP">HP</a>
- <a href="#g">g</a> <a href="#pf">pf</a> <a href="#pdc">pdc</a> - Set hardware PWM frequency and dutycycle</h3>This command sets the hardware PWM associated with GPIO <a href="#g">g</a> to
-frequency <a href="#pf">pf</a> with dutycycle <a href="#pdc">pdc</a>. Frequencies above 30MHz
-are unlikely to work.
-<br><br>NOTE: Any waveform started by <a href="#WVTX">WVTX</a>, <a href="#WVTXR">WVTXR</a>, or <a href="#WVCHA">WVCHA</a>
-will be cancelled.
-<br><br>This function is only valid if the pigpio main clock is PCM. The
-main clock defaults to PCM but may be overridden when the pigpio
-daemon is started (option -t).
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><code>$&nbsp;pigs&nbsp;hp&nbsp;18&nbsp;100&nbsp;800000&nbsp;#&nbsp;80%&nbsp;dutycycle<br><br>$&nbsp;pigs&nbsp;hp&nbsp;19&nbsp;100&nbsp;200000&nbsp;#&nbsp;20%&nbsp;dutycycle<br><br>$&nbsp;pigs&nbsp;hp&nbsp;19&nbsp;400000000&nbsp;100000<br>-96<br>ERROR:&nbsp;invalid&nbsp;hardware&nbsp;PWM&nbsp;frequency<br></code><br><br>The same PWM channel is available on multiple GPIO. The latest
-frequency and dutycycle setting will be used by all GPIO which
-share a PWM channel.
-<br><br>The GPIO must be one of the following.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>12</td><td>PWM channel 0</td><td>All models but A and B</td></tr><tr><td>13</td><td>PWM channel 1</td><td>All models but A and B</td></tr><tr><td>18</td><td>PWM channel 0</td><td>All models</td></tr><tr><td>19</td><td>PWM channel 1</td><td>All models but A and B</td></tr></tbody></table><br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>40</td><td>PWM channel 0</td><td>Compute module only</td></tr><tr><td>41</td><td>PWM channel 1</td><td>Compute module only</td></tr><tr><td>45</td><td>PWM channel 1</td><td>Compute module only</td></tr><tr><td>52</td><td>PWM channel 0</td><td>Compute module only</td></tr><tr><td>53</td><td>PWM channel 1</td><td>Compute module only</td></tr></tbody></table><br><br>The actual number of steps beween off and fully on is the
-integral part of 250M/<a href="#pf">pf</a> (375M/<a href="#pf">pf</a> for the BCM2711).
-<br><br>The actual frequency set is 250M/steps (375M/steps for the BCM2711).
-<br><br>There will only be a million steps for a <a href="#pf">pf</a> of 250 (375 for
-the BCM2711). Lower frequencies will have more steps and higher
-frequencies will have fewer steps. <a href="#pdc">pdc</a> is
-automatically scaled to take this into account.
-<h3><a name="HWVER">HWVER</a>
- - Get hardware version</h3>This command returns the hardware revision of the Pi.
-<br><br>The hardware revision is found in the last 4 characters on the revision
-line of /proc/cpuinfo.
-<br><br>If the hardware revision can not be found or is not a valid hexadecimal
-number the command returns 0.
-<br><br>The revision number can be used to determine the assignment of GPIO
-to pins (see <a href="#g">g</a>).
-<br><br>There are currently three types of board.
-<br><br>Type 1 boards have hardware revision numbers of 2 and 3.
-<br><br>Type 2 boards have hardware revision numbers of 4, 5, 6, and 15.
-<br><br>Type 3 boards have hardware revision numbers of 16 or greater.
-<br><br>for "Revision : 0002" the command returns 2.
-<br><br>for "Revision : 000f" the command returns 15.
-<br><br>for "Revision : 000g" the command returns 0.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;hwver&nbsp;#&nbsp;On&nbsp;a&nbsp;B+<br>16<br></code><h3><a name="I2CC">I2CC</a>
- <a href="#h">h</a> - Close I2C handle</h3>This command closes an I2C handle <a href="#h">h</a> previously opened with <a href="#I2CO">I2CO</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2cc&nbsp;0&nbsp;#&nbsp;First&nbsp;close&nbsp;okay.<br><br>$&nbsp;pigs&nbsp;i2cc&nbsp;0&nbsp;#&nbsp;Second&nbsp;fails.<br>-25<br>ERROR:&nbsp;unknown&nbsp;handle<br></code><h3><a name="I2CO">I2CO</a>
- <a href="#ib">ib</a> <a href="#id">id</a> <a href="#if">if</a> - Open I2C bus and device with flags</h3>This command returns a handle to access device <a href="#id">id</a> on I2C bus <a href="#ib">ib</a>.
-The device is opened with flags <a href="#if">if</a>.
-<br><br>Physically buses 0 and 1 are available on the Pi. Higher
-numbered buses will be available if a kernel supported bus
-multiplexor is being used.
-<br><br>The GPIO used are given in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td></tr><tr><td>I2C 0</td><td>0</td><td>1</td></tr><tr><td>I2C 1</td><td>2</td><td>3</td></tr></tbody></table><br><br>No flags are currently defined. The parameter <a href="#if">if</a> should be 0.
-<br><br>Upon success the next free handle (&gt;=0) is returned. On error a
-negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2co&nbsp;1&nbsp;0x70&nbsp;0&nbsp;#&nbsp;Bus&nbsp;1,&nbsp;device&nbsp;0x70,&nbsp;flags&nbsp;0.<br>0<br><br>$&nbsp;pigs&nbsp;i2co&nbsp;1&nbsp;0x53&nbsp;0&nbsp;#&nbsp;Bus&nbsp;1,&nbsp;device&nbsp;0x53,&nbsp;flags&nbsp;0.<br>1<br></code><h3><a name="I2CPC">I2CPC</a>
- <a href="#h">h</a> <a href="#r">r</a> <a href="#wv">wv</a> - smb Process Call: exchange register with word</h3>This command writes <a href="#wv">wv</a> to register <a href="#r">r</a> of the I2C device
-associated with handle <a href="#h">h</a> and returns a 16-bit word read from the
-device.
-<br><br>Upon success a value between 0 and 65535 will be returned. On error
-a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2cpc&nbsp;0&nbsp;37&nbsp;43210<br>39933<br><br>$&nbsp;pigs&nbsp;i2cpc&nbsp;0&nbsp;256&nbsp;43210<br>ERROR:&nbsp;bad&nbsp;i2c/spi/ser&nbsp;parameter<br>-81<br></code><h3><a name="I2CPK">I2CPK</a>
- <a href="#h">h</a> <a href="#r">r</a> <a href="#bvs">bvs</a> - smb Block Process Call: exchange data bytes with register</h3>This command writes the data bytes <a href="#bvs">bvs</a> to register <a href="#r">r</a> of the I2C device
-associated with handle <a href="#h">h</a> and returns a device specific number of bytes.
-<br><br>Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2cpk&nbsp;0&nbsp;0&nbsp;0x11&nbsp;0x12<br>6&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br></code><h3><a name="I2CRB">I2CRB</a>
- <a href="#h">h</a> <a href="#r">r</a> - smb Read Byte Data: read byte from register</h3>This command returns a single byte read from register <a href="#r">r</a> of the I2C device
-associated with handle <a href="#h">h</a>.
-<br><br>Upon success a value between 0 and 255 will be returned. On error
-a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2crb&nbsp;0&nbsp;0<br>6<br></code><h3><a name="I2CRD">I2CRD</a>
- <a href="#h">h</a> <a href="#num">num</a> - i2c Read device</h3>This command returns <a href="#num">num</a> bytes read from the I2C device associated with
-handle <a href="#h">h</a>.
-<br><br>Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-<br><br>This command operates on the raw I2C device. The maximum value of the
-parameter <a href="#num">num</a> is dependent on the I2C drivers and the device
-itself. pigs imposes a limit of about 8000 bytes.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2crd&nbsp;0&nbsp;16<br>16&nbsp;6&nbsp;24&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;32&nbsp;78<br></code><h3><a name="I2CRI">I2CRI</a>
- <a href="#h">h</a> <a href="#r">r</a> <a href="#num">num</a> - smb Read I2C Block Data: read bytes from register</h3>This command returns <a href="#num">num</a> bytes from register <a href="#r">r</a> of the I2C device
-associated with handle <a href="#h">h</a>.
-<br><br>Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-<br><br>The parameter <a href="#num">num</a> may be 1-32.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2cri&nbsp;0&nbsp;0&nbsp;16<br>16&nbsp;237&nbsp;155&nbsp;155&nbsp;155&nbsp;155&nbsp;155&nbsp;155&nbsp;155&nbsp;155&nbsp;155&nbsp;155&nbsp;155&nbsp;155&nbsp;155&nbsp;155&nbsp;155<br></code><h3><a name="I2CRK">I2CRK</a>
- <a href="#h">h</a> <a href="#r">r</a> - smb Read Block Data: read data from register</h3>This command returns between 1 and 32 bytes read from register <a href="#r">r</a> of
-the I2C device associated with handle <a href="#h">h</a>.
-<br><br>Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-<br><br>The number of bytes of returned data is specific to the device and
-register.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2crk&nbsp;0&nbsp;0<br>6&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br><br>$&nbsp;pigs&nbsp;i2crk&nbsp;0&nbsp;1<br>24&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;120&nbsp;222&nbsp;105&nbsp;215&nbsp;128&nbsp;87&nbsp;195&nbsp;217&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br></code><h3><a name="I2CRS">I2CRS</a>
- <a href="#h">h</a> - smb Read Byte: read byte</h3>This command returns a single byte read from the I2C device
-associated with handle <a href="#h">h</a>.
-<br><br>Upon success a value between 0 and 255 will be returned. On error
-a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2crs&nbsp;0<br>0<br></code><h3><a name="I2CRW">I2CRW</a>
- <a href="#h">h</a> <a href="#r">r</a> - smb Read Word Data: read word from register</h3>This command returns a single 16 bit word read from register <a href="#r">r</a> of
-the I2C device associated with handle <a href="#h">h</a>.
-<br><br>Upon success a value between 0 and 65535 will be returned. On error
-a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2crw&nbsp;0&nbsp;0<br>6150<br></code><h3><a name="I2CWB">I2CWB</a>
- <a href="#h">h</a> <a href="#r">r</a> <a href="#bv">bv</a> - smb Write Byte Data: write byte to register</h3>This command writes a single byte <a href="#bv">bv</a> to register <a href="#r">r</a> of the
-I2C device associated with handle <a href="#h">h</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2cwb&nbsp;0&nbsp;10&nbsp;0x54<br></code><h3><a name="I2CWD">I2CWD</a>
- <a href="#h">h</a> <a href="#bvs">bvs</a> - i2c Write device</h3>This command writes a block of bytes <a href="#bvs">bvs</a> to the I2C device
-associated with handle <a href="#h">h</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>The number of bytes which may be written in one transaction is
-dependent on the I2C drivers and the device itself. pigs imposes
-a limit of about 500 bytes.
-<br><br>This command operates on the raw I2C device.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2cwd&nbsp;0&nbsp;0x01&nbsp;0x02&nbsp;0x03&nbsp;0x04<br></code><h3><a name="I2CWI">I2CWI</a>
- <a href="#h">h</a> <a href="#r">r</a> <a href="#bvs">bvs</a> - smb Write I2C Block Data</h3>This command writes between 1 and 32 bytes <a href="#bvs">bvs</a> to register <a href="#r">r</a> of
-the I2C device associated with handle <a href="#h">h</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2cwi&nbsp;0&nbsp;4&nbsp;0x01&nbsp;0x04&nbsp;0xc0<br></code><h3><a name="I2CWK">I2CWK</a>
- <a href="#h">h</a> <a href="#r">r</a> <a href="#bvs">bvs</a> - smb Write Block Data: write data to register</h3>This command writes between 1 and 32 bytes <a href="#bvs">bvs</a> to register <a href="#r">r</a> of
-the I2C device associated with handle <a href="#h">h</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>pigs&nbsp;i2cwk&nbsp;0&nbsp;4&nbsp;0x01&nbsp;0x04&nbsp;0xc0<br></code><h3><a name="I2CWQ">I2CWQ</a>
- <a href="#h">h</a> <a href="#bit">bit</a> - smb Write Quick: write bit</h3>This command writes a single <a href="#bit">bit</a> to the I2C device associated
-with handle <a href="#h">h</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2cwq&nbsp;0&nbsp;1<br></code><h3><a name="I2CWS">I2CWS</a>
- <a href="#h">h</a> <a href="#bv">bv</a> - smb Write Byte: write byte</h3>This command writes a single byte <a href="#bv">bv</a> to the I2C device associated
-with handle <a href="#h">h</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2cws&nbsp;0&nbsp;0x12<br><br>$&nbsp;pigs&nbsp;i2cws&nbsp;0&nbsp;0xff<br>-82<br>ERROR:&nbsp;I2C&nbsp;write&nbsp;failed<br></code><h3><a name="I2CWW">I2CWW</a>
- <a href="#h">h</a> <a href="#r">r</a> <a href="#wv">wv</a> - smb Write Word Data: write word to register</h3>This command writes a single 16 bit word <a href="#wv">wv</a> to register <a href="#r">r</a> of
-the I2C device associated with handle <a href="#h">h</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;i2cww&nbsp;0&nbsp;0&nbsp;0xffff<br></code><h3><a name="I2CZ">I2CZ</a>
- <a href="#h">h</a> <a href="#bvs">bvs</a> - Performs multiple I2C transactions</h3>This command executes a sequence of I2C operations. The
-operations to be performed are specified by the contents of <a href="#bvs">bvs</a>
-which contains the concatenated command codes and associated data.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>End</td><td>0</td><td>No more commands</td></tr><tr><td>Escape</td><td>1</td><td>Next P is two bytes</td></tr><tr><td>On</td><td>2</td><td>Switch combined flag on</td></tr><tr><td>Off</td><td>3</td><td>Switch combined flag off</td></tr><tr><td>Address</td><td>4 P</td><td>Set I2C address to P</td></tr><tr><td>Flags</td><td>5 lsb msb</td><td>Set I2C flags to lsb + (msb &lt;&lt; 8)</td></tr><tr><td>Read</td><td>6 P</td><td>Read P bytes of data</td></tr><tr><td>Write</td><td>7 P ...</td><td>Write P bytes of data</td></tr></tbody></table><br><br>The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-<br><br>The address defaults to that associated with the handle <a href="#h">h</a>.
-The flags default to 0. The address and flags maintain their
-previous value until updated.
-<br><br><b><small>Example</small></b><br><br><code>Set&nbsp;address&nbsp;0x53,&nbsp;write&nbsp;0x32,&nbsp;read&nbsp;6&nbsp;bytes<br>Set&nbsp;address&nbsp;0x1E,&nbsp;write&nbsp;0x03,&nbsp;read&nbsp;6&nbsp;bytes<br>Set&nbsp;address&nbsp;0x68,&nbsp;write&nbsp;0x1B,&nbsp;read&nbsp;8&nbsp;bytes<br>End<br><br>0x04&nbsp;0x53&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x32&nbsp;&nbsp;&nbsp;0x06&nbsp;0x06<br>0x04&nbsp;0x1E&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x03&nbsp;&nbsp;&nbsp;0x06&nbsp;0x06<br>0x04&nbsp;0x68&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x1B&nbsp;&nbsp;&nbsp;0x06&nbsp;0x08<br>0x00<br></code><h3><a name="M/MODES">M/MODES</a>
- <a href="#g">g</a> <a href="#m">m</a> - Set GPIO mode</h3>This command sets GPIO <a href="#g">g</a> to mode <a href="#m">m</a>, typically input (read)
-or output (write).
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>Each GPIO can be configured to be in one of 8 different modes. The modes
-are named Input, Output, ALT0, ALT1, ALT2, ALT3, ALT4, and ALT5.
-<br><br>To set the mode use the code for the mode.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Mode</td><td>Input</td><td>Output</td><td>ALT0</td><td>ALT1</td><td>ALT2</td><td>ALT3</td><td>ALT4</td><td>ALT5</td></tr><tr><td>Code</td><td>R</td><td>W</td><td>0</td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;m&nbsp;4&nbsp;r&nbsp;#&nbsp;Input&nbsp;(read)<br>$&nbsp;pigs&nbsp;m&nbsp;4&nbsp;w&nbsp;#&nbsp;Output&nbsp;(write)<br>$&nbsp;pigs&nbsp;m&nbsp;4&nbsp;0&nbsp;#&nbsp;ALT&nbsp;0<br>$&nbsp;pigs&nbsp;m&nbsp;4&nbsp;5&nbsp;#&nbsp;ALT&nbsp;5<br></code><h3><a name="MG/MODEG">MG/MODEG</a>
- <a href="#g">g</a> - Get GPIO mode</h3>This command returns the current mode of GPIO <a href="#g">g</a>.
-<br><br>Upon success the value of the GPIO mode is returned.
-On error a negative status code will be returned.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Value</td><td>0</td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td></tr><tr><td>Mode</td><td>Input</td><td>Output</td><td>ALT5</td><td>ALT4</td><td>ALT0</td><td>ALT1</td><td>ALT2</td><td>ALT3</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;mg&nbsp;4<br>1<br></code><h3><a name="MICS">MICS</a>
- <a href="#v">v</a> - Microseconds delay</h3>This command delays execution for <a href="#v">v</a> microseconds.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>The main use of this command is expected to be within <a href="#Scripts">Scripts</a>.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;mics&nbsp;20&nbsp;#&nbsp;Delay&nbsp;20&nbsp;microseconds.<br>$&nbsp;pigs&nbsp;mics&nbsp;1000000&nbsp;#&nbsp;Delay&nbsp;1&nbsp;second.<br><br>$&nbsp;pigs&nbsp;mics&nbsp;2000000<br>-64<br>ERROR:&nbsp;bad&nbsp;MICS&nbsp;delay&nbsp;(too&nbsp;large)<br></code><h3><a name="MILS">MILS</a>
- <a href="#v">v</a> - Milliseconds delay</h3>This command delays execution for <a href="#v">v</a> milliseconds.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;mils&nbsp;2000&nbsp;#&nbsp;Delay&nbsp;2&nbsp;seconds.<br><br>$&nbsp;pigs&nbsp;mils&nbsp;61000<br>-65<br>ERROR:&nbsp;bad&nbsp;MILS&nbsp;delay&nbsp;(too&nbsp;large)<br></code><h3><a name="NB">NB</a>
- <a href="#h">h</a> <a href="#bits">bits</a> - Start notification</h3>This command starts notifications on handle <a href="#h">h</a> returned by
-a prior call to <a href="#NO">NO</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>The notification gets state changes for each GPIO specified by <a href="#bits">bits</a>.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;nb&nbsp;0&nbsp;-1&nbsp;#&nbsp;Shorthand&nbsp;for&nbsp;GPIO&nbsp;0-31.<br>$&nbsp;pigs&nbsp;nb&nbsp;0&nbsp;0xf0&nbsp;#&nbsp;Get&nbsp;notifications&nbsp;for&nbsp;GPIO&nbsp;4-7.<br><br>$&nbsp;pigs&nbsp;nb&nbsp;1&nbsp;0xf<br>-25<br>ERROR:&nbsp;unknown&nbsp;handle<br></code><h3><a name="NC">NC</a>
- <a href="#h">h</a> - Close notification</h3>This command stops notifications on handle <a href="#h">h</a> returned by
-a prior call to <a href="#NO">NO</a> and releases the handle for reuse.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;nc&nbsp;0&nbsp;#&nbsp;First&nbsp;call&nbsp;succeeds.<br><br>$&nbsp;pigs&nbsp;nc&nbsp;1&nbsp;#&nbsp;Second&nbsp;call&nbsp;fails.<br>-25<br>ERROR:&nbsp;unknown&nbsp;handle<br></code><h3><a name="NO">NO</a>
- - Request a notification</h3>This command requests a free notification handle.
-<br><br>A notification is a method for being notified of GPIO state changes via a pipe.
-<br><br>Upon success the command returns a handle greater than or equal to zero.
-On error a negative status code will be returned.
-<br><br>Notifications for handle x will be available at the pipe named /dev/pigpiox
-(where x is the handle number).
-<br><br>E.g. if the command returns 15 then the notifications must be read
-from /dev/pigpio15.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;no<br>0<br></code><h3><a name="NP">NP</a>
- <a href="#h">h</a> - Pause notification</h3>This command pauses notifications on handle <a href="#h">h</a> returned by
-a prior call to <a href="#NO">NO</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>Notifications for the handle are suspended until a new <a href="#NB">NB</a> command
-is given for the handle.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;np&nbsp;0<br></code><h3><a name="P/PWM">P/PWM</a>
- <a href="#u">u</a> <a href="#v">v</a> - Set GPIO PWM value</h3>This command starts PWM on GPIO <a href="#u">u</a> with dutycycle <a href="#v">v</a>. The dutycycle
-varies from 0 (off) to range (fully on). The range defaults to 255.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>This and the servo functionality use the DMA and PWM or PCM peripherals
-to control and schedule the pulsewidths and dutycycles.
-<br><br>The <a href="#PRS">PRS</a> command may be used to change the default range of 255.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;p&nbsp;4&nbsp;64&nbsp;&nbsp;#&nbsp;Start&nbsp;PWM&nbsp;on&nbsp;GPIO&nbsp;4&nbsp;with&nbsp;25%&nbsp;dutycycle<br>$&nbsp;pigs&nbsp;p&nbsp;4&nbsp;128&nbsp;#&nbsp;50%<br>$&nbsp;pigs&nbsp;p&nbsp;4&nbsp;192&nbsp;#&nbsp;75%<br>$&nbsp;pigs&nbsp;p&nbsp;4&nbsp;255&nbsp;#&nbsp;100%<br></code><h3><a name="PADG">PADG</a>
- <a href="#pad">pad</a> - Get pad drive strength</h3>This command gets the <a href="#pad">pad</a> drive strength <a href="#padma">padma</a> in mA.
-<br><br>Returns the pad drive strength if OK. On error a negative status code
-will be returned.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;padg&nbsp;0<br>8<br>$&nbsp;pigs&nbsp;pads&nbsp;0&nbsp;16<br>$&nbsp;pigs&nbsp;padg&nbsp;0<br>16<br>pigs&nbsp;padg&nbsp;3<br>-126<br>ERROR:&nbsp;bad&nbsp;pad&nbsp;number<br></code><h3><a name="PADS">PADS</a>
- <a href="#pad">pad</a> <a href="#padma">padma</a> - Set pad drive strength</h3>This command sets the <a href="#pad">pad</a> drive strength <a href="#padma">padma</a> in mA.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;pads&nbsp;0&nbsp;16<br>$&nbsp;pigs&nbsp;padg&nbsp;0<br>16<br>$&nbsp;pigs&nbsp;pads&nbsp;0&nbsp;17<br>-127<br>ERROR:&nbsp;bad&nbsp;pad&nbsp;drive&nbsp;strength<br></code><h3><a name="PARSE">PARSE</a>
- <a href="#t">t</a> - Validate script</h3>Validates the text <a href="#t">t</a> of a script without storing the script.
-<br><br>Upon success nothing is returned. On error a list of detected
-script errors will be given.
-<br><br>See <a href="#Scripts">Scripts</a>.
-<br><br>This command may be used to find script syntax faults.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;parse&nbsp;tag&nbsp;100&nbsp;w&nbsp;22&nbsp;1&nbsp;mils&nbsp;200&nbsp;w&nbsp;22&nbsp;0&nbsp;mils&nbsp;800&nbsp;jmp&nbsp;100<br><br>$&nbsp;pigs&nbsp;parse&nbsp;tag&nbsp;0&nbsp;w&nbsp;22&nbsp;1&nbsp;mills&nbsp;50&nbsp;w&nbsp;22&nbsp;0&nbsp;dcr&nbsp;p10&nbsp;jp&nbsp;99<br>Unknown&nbsp;command:&nbsp;mills<br>Unknown&nbsp;command:&nbsp;50<br>Bad&nbsp;parameter&nbsp;to&nbsp;dcr<br>Can't&nbsp;resolve&nbsp;tag&nbsp;99<br></code><h3><a name="PFG">PFG</a>
- <a href="#u">u</a> - Get GPIO PWM frequency</h3>This command returns the PWM frequency in Hz used for GPIO <a href="#u">u</a>.
-<br><br>Upon success the PWM frequency is returned. On error a negative
-status code will be returned.
-<br><br>For normal PWM the frequency will be that defined for the GPIO
-by <a href="#PFS">PFS</a>.
-<br><br>If a hardware clock is active on the GPIO the reported frequency
-will be that set by <a href="#HC">HC</a>.
-<br><br>If hardware PWM is active on the GPIO the reported frequency
-will be that set by <a href="#HP">HP</a>.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;pfg&nbsp;4<br>800<br><br>$&nbsp;pigs&nbsp;pfg&nbsp;34<br>ERROR:&nbsp;GPIO&nbsp;not&nbsp;0-31<br>-2<br></code><h3><a name="PFS">PFS</a>
- <a href="#u">u</a> <a href="#v">v</a> - Set GPIO PWM frequency</h3>This command sets the PWM frequency <a href="#v">v</a> to be used for GPIO <a href="#u">u</a>.
-<br><br>The numerically closest frequency to <a href="#v">v</a> will be selected.
-<br><br>Upon success the new frequency is returned. On error a negative status code
-will be returned.
-<br><br>If PWM is currently active on the GPIO it will be
-switched off and then back on at the new frequency.
-<br><br>Each GPIO can be independently set to one of 18 different PWM
-frequencies.
-<br><br>The selectable frequencies depend upon the sample rate which
-may be 1, 2, 4, 5, 8, or 10 microseconds (default 5). The
-sample rate is set when the pigpio daemon is started.
-<br><br>The frequencies for each sample rate are:
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hertz<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1:&nbsp;40000&nbsp;20000&nbsp;10000&nbsp;8000&nbsp;5000&nbsp;4000&nbsp;2500&nbsp;2000&nbsp;1600<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1250&nbsp;&nbsp;1000&nbsp;&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;50<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2:&nbsp;20000&nbsp;10000&nbsp;&nbsp;5000&nbsp;4000&nbsp;2500&nbsp;2000&nbsp;1250&nbsp;1000&nbsp;&nbsp;800<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;625&nbsp;&nbsp;&nbsp;500&nbsp;&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;125&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;25<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4:&nbsp;10000&nbsp;&nbsp;5000&nbsp;&nbsp;2500&nbsp;2000&nbsp;1250&nbsp;1000&nbsp;&nbsp;625&nbsp;&nbsp;500&nbsp;&nbsp;400<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;313&nbsp;&nbsp;&nbsp;250&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;125&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;63&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;13<br>sample<br>&nbsp;rate<br>&nbsp;(us)&nbsp;&nbsp;5:&nbsp;&nbsp;8000&nbsp;&nbsp;4000&nbsp;&nbsp;2000&nbsp;1600&nbsp;1000&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;320<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;250&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;&nbsp;160&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;80&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;&nbsp;20&nbsp;&nbsp;&nbsp;10<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8:&nbsp;&nbsp;5000&nbsp;&nbsp;2500&nbsp;&nbsp;1250&nbsp;1000&nbsp;&nbsp;625&nbsp;&nbsp;500&nbsp;&nbsp;313&nbsp;&nbsp;250&nbsp;&nbsp;200<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;156&nbsp;&nbsp;&nbsp;125&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;63&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;31&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;13&nbsp;&nbsp;&nbsp;&nbsp;6<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10:&nbsp;&nbsp;4000&nbsp;&nbsp;2000&nbsp;&nbsp;1000&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;160<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;125&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;&nbsp;80&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;20&nbsp;&nbsp;&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;5<br></code><br><br><b><small>Example</small></b><br><br><code>pigs&nbsp;pfs&nbsp;4&nbsp;0&nbsp;#&nbsp;0&nbsp;selects&nbsp;the&nbsp;lowest&nbsp;frequency.<br>10<br><br>$&nbsp;pigs&nbsp;pfs&nbsp;4&nbsp;1000&nbsp;#&nbsp;Set&nbsp;1000Hz&nbsp;PWM.<br>1000<br><br>$&nbsp;pigs&nbsp;pfs&nbsp;4&nbsp;100000&nbsp;#&nbsp;Very&nbsp;big&nbsp;number&nbsp;selects&nbsp;the&nbsp;highest&nbsp;frequency.<br>8000<br></code><h3><a name="PIGPV">PIGPV</a>
- - Get pigpio library version</h3>This command returns the pigpio library version.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;pigpv<br>17<br></code><h3><a name="PRG">PRG</a>
- <a href="#u">u</a> - Get GPIO PWM range</h3>This command returns the dutycycle range for GPIO <a href="#u">u</a>.
-<br><br>Upon success the range is returned. On error a negative status code
-will be returned.
-<br><br>If a hardware clock or hardware PWM is active on the GPIO the reported
-range will be 1000000 (1M).
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;prg&nbsp;4<br>255<br></code><h3><a name="PROC">PROC</a>
- <a href="#t">t</a> - Store script</h3>This command stores a script <a href="#t">t</a> for later execution.
-<br><br>If the script is valid a script id (&gt;=0) is returned which is passed
-to the other script commands. On error a negative status code
-will be returned.
-<br><br>See <a href="#Scripts">Scripts</a>.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;proc&nbsp;tag&nbsp;123&nbsp;w&nbsp;4&nbsp;0&nbsp;mils&nbsp;200&nbsp;w&nbsp;4&nbsp;1&nbsp;mils&nbsp;300&nbsp;dcr&nbsp;p0&nbsp;jp&nbsp;123<br>0<br><br>$&nbsp;pigs&nbsp;proc&nbsp;tag&nbsp;123&nbsp;w&nbsp;4&nbsp;0&nbsp;mils&nbsp;5&nbsp;w&nbsp;4&nbsp;1&nbsp;mils&nbsp;5&nbsp;jmp&nbsp;12<br>ERROR:&nbsp;script&nbsp;has&nbsp;unresolved&nbsp;tag<br>-63<br></code><h3><a name="PROCD">PROCD</a>
- <a href="#sid">sid</a> - Delete script</h3>This command deletes script <a href="#sid">sid</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>See <a href="#Scripts">Scripts</a>.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;procd&nbsp;1<br><br>$&nbsp;pigs&nbsp;procd&nbsp;1<br>ERROR:&nbsp;unknown&nbsp;script&nbsp;id<br>-48<br></code><h3><a name="PROCP">PROCP</a>
- <a href="#sid">sid</a> - Get script status and parameters</h3>This command returns the status of script <a href="#sid">sid</a> as well as the
-current value of its 10 parameters.
-<br><br>Upon success the script status and parameters are returned.
-On error a negative status code will be returned.
-<br><br>The script status may be one of
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>0</td><td>being initialised</td></tr><tr><td>1</td><td>halted</td></tr><tr><td>2</td><td>running</td></tr><tr><td>3</td><td>waiting</td></tr><tr><td>4</td><td>failed</td></tr></tbody></table><br><br>See <a href="#Scripts">Scripts</a>.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;procp&nbsp;0<br>1&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br></code><h3><a name="PROCR">PROCR</a>
- <a href="#sid">sid</a> <a href="#pars">pars</a> - Run script</h3>This command runs stored script <a href="#sid">sid</a> passing it up to 10 optional
-parameters.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>See <a href="#Scripts">Scripts</a>.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;proc&nbsp;tag&nbsp;123&nbsp;w&nbsp;4&nbsp;0&nbsp;mils&nbsp;200&nbsp;w&nbsp;4&nbsp;1&nbsp;mils&nbsp;300&nbsp;dcr&nbsp;p0&nbsp;jp&nbsp;123<br>0<br><br>$&nbsp;pigs&nbsp;procr&nbsp;0&nbsp;50&nbsp;#&nbsp;Run&nbsp;script&nbsp;0&nbsp;with&nbsp;parameter&nbsp;0&nbsp;of&nbsp;50.<br><br>$&nbsp;pigs&nbsp;procp&nbsp;0<br>2&nbsp;44&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br>$&nbsp;pigs&nbsp;procp&nbsp;0<br>2&nbsp;37&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br>$&nbsp;pigs&nbsp;procp&nbsp;0<br>2&nbsp;10&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br>$&nbsp;pigs&nbsp;procp&nbsp;0<br>2&nbsp;5&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br>$&nbsp;pigs&nbsp;procp&nbsp;0<br>2&nbsp;2&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br>$&nbsp;pigs&nbsp;procp&nbsp;0<br>1&nbsp;-1&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br></code><h3><a name="PROCS">PROCS</a>
- <a href="#sid">sid</a> - Stop script</h3>This command stops a running script <a href="#sid">sid</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>See <a href="#Scripts">Scripts</a>.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;procs&nbsp;0<br><br>$&nbsp;pigs&nbsp;procs&nbsp;1<br>-48<br>ERROR:&nbsp;unknown&nbsp;script&nbsp;id<br></code><h3><a name="PROCU">PROCU</a>
- <a href="#sid">sid</a> <a href="#pars">pars</a> - Set script parameters</h3>This command sets the parameters of a stored script <a href="#sid">sid</a> passing
-it up to 10 parameters.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>See <a href="#Scripts">Scripts</a>.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;proc&nbsp;tag&nbsp;0&nbsp;hp&nbsp;18&nbsp;p0&nbsp;p1&nbsp;mils&nbsp;1000&nbsp;jmp&nbsp;0<br>0<br>$&nbsp;pigs&nbsp;procu&nbsp;0&nbsp;50&nbsp;500000<br>$&nbsp;pigs&nbsp;procr&nbsp;0<br>$&nbsp;pigs&nbsp;procu&nbsp;0&nbsp;100<br>$&nbsp;pigs&nbsp;procu&nbsp;0&nbsp;200<br>$&nbsp;pigs&nbsp;procu&nbsp;0&nbsp;200&nbsp;100000<br></code><h3><a name="PRRG">PRRG</a>
- <a href="#u">u</a> - Get GPIO PWM real range</h3>This command returns the real underlying range used by GPIO <a href="#u">u</a>.
-<br><br>If a hardware clock is active on the GPIO the reported
-real range will be 1000000 (1M).
-<br><br>If hardware PWM is active on the GPIO the reported real range
-will be approximately 250M divided by the set PWM frequency.
-<br><br>On error a negative status code will be returned.
-<br><br>See <a href="#PRS">PRS</a>.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;prrg&nbsp;17<br>250<br><br>$&nbsp;pigs&nbsp;pfs&nbsp;17&nbsp;0<br>10<br>$&nbsp;pigs&nbsp;prrg&nbsp;17<br>20000<br><br>$&nbsp;pigs&nbsp;pfs&nbsp;17&nbsp;100000<br>8000<br>$&nbsp;pigs&nbsp;prrg&nbsp;17<br>25<br></code><h3><a name="PRS">PRS</a>
- <a href="#u">u</a> <a href="#v">v</a> - Set GPIO PWM range</h3>This command sets the dutycycle range <a href="#v">v</a> to be used for GPIO <a href="#u">u</a>.
-Subsequent uses of command <a href="#P/PWM">P/PWM</a> will use a dutycycle between 0 (off)
-and <a href="#v">v</a> (fully on).
-<br><br>Upon success the real underlying range used by the GPIO is returned.
-On error a negative status code will be returned.
-<br><br>If PWM is currently active on the GPIO its dutycycle will be scaled to
-reflect the new range.
-<br><br>The real range, the number of steps between fully off and fully on
-for each frequency, is given in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>#1</td><td>#2</td><td>#3</td><td>#4</td><td>#5</td><td>#6</td><td>#7</td><td>#8</td><td>#9</td></tr><tr><td>25</td><td>50</td><td>100</td><td>125</td><td>200</td><td>250</td><td>400</td><td>500</td><td>625</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>#10</td><td>#11</td><td>#12</td><td>#13</td><td>#14</td><td>#15</td><td>#16</td><td>#17</td><td>#18</td></tr><tr><td>800</td><td>1000</td><td>1250</td><td>2000</td><td>2500</td><td>4000</td><td>5000</td><td>10000</td><td>20000</td></tr></tbody></table><br><br>The real value set by <a href="#PRS">PRS</a> is (dutycycle * real range) / range.
-<br><br>See <a href="#PRRG">PRRG</a>
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;prs&nbsp;18&nbsp;1000<br>250<br></code><h3><a name="PUD">PUD</a>
- <a href="#g">g</a> <a href="#p">p</a> - Set GPIO pull up/down</h3>This command sets the internal pull/up down for GPIO <a href="#g">g</a> to mode <a href="#p">p</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>The mode may be pull-down (D), pull-up (U), or off (O).
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;pud&nbsp;4&nbsp;d&nbsp;#&nbsp;Set&nbsp;pull-down&nbsp;on&nbsp;GPIO&nbsp;4.<br>$&nbsp;pigs&nbsp;pud&nbsp;4&nbsp;u&nbsp;#&nbsp;Set&nbsp;pull-up&nbsp;on&nbsp;GPIO&nbsp;4.<br>$&nbsp;pigs&nbsp;pud&nbsp;4&nbsp;o&nbsp;#&nbsp;No&nbsp;pull-up/down&nbsp;on&nbsp;GPIO&nbsp;4.<br></code><h3><a name="R/READ">R/READ</a>
- <a href="#g">g</a> - Read GPIO level</h3>This reads the current level of GPIO <a href="#g">g</a>.
-<br><br>Upon success the current level is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;r&nbsp;17&nbsp;#&nbsp;Get&nbsp;level&nbsp;of&nbsp;GPIO&nbsp;17.<br>0<br><br>$&nbsp;pigs&nbsp;r&nbsp;4&nbsp;#&nbsp;Get&nbsp;level&nbsp;of&nbsp;GPIO&nbsp;4.<br>1<br></code><h3><a name="S/SERVO">S/SERVO</a>
- <a href="#u">u</a> <a href="#v">v</a> - Set GPIO servo pulsewidth</h3>This command starts servo pulses of <a href="#v">v</a> microseconds on GPIO <a href="#u">u</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>The servo pulsewidth may be 0 (off), 500 (most anti-clockwise)
-to 2500 (most clockwise).
-<br><br>The range supported by servos varies and should probably be determined
-by experiment. Generally values between 1000-2000 should be safe.
-A value of 1500 should always be safe and represents
-the mid-point of rotation.
-<br><br>You can DAMAGE a servo if you command it to move beyond its limits.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;SERVO&nbsp;17&nbsp;1500<br></code><br><br>This example causes an on pulse of 1500 microseconds duration to be
-transmitted on GPIO 17 at a rate of 50 times per second.
-<br><br>This will command a servo connected to GPIO 17 to rotate to its mid-point.
-<br><br><b><small>Example</small></b><br><br><code>pigs&nbsp;s&nbsp;17&nbsp;0&nbsp;#&nbsp;Switch&nbsp;servo&nbsp;pulses&nbsp;off.<br></code><h3><a name="SERC">SERC</a>
- <a href="#h">h</a> - Close serial handle</h3>This command closes a serial handle <a href="#h">h</a> previously opened with <a href="#SERO">SERO</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;serc&nbsp;0&nbsp;#&nbsp;First&nbsp;close&nbsp;okay.<br><br>$&nbsp;pigs&nbsp;serc&nbsp;0&nbsp;#&nbsp;Second&nbsp;close&nbsp;gives&nbsp;error.<br>-25<br>ERROR:&nbsp;unknown&nbsp;handle<br></code><h3><a name="SERDA">SERDA</a>
- <a href="#h">h</a> - Check for serial data ready to read</h3>This command returns the number of bytes of data available
-to be read from the serial device associated with handle <a href="#h">h</a>.
-<br><br>Upon success the count of bytes available to be read is
-returned (which may be 0). On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;serda&nbsp;0<br>0<br></code><h3><a name="SERO">SERO</a>
- <a href="#dev">dev</a> <a href="#b">b</a> <a href="#sef">sef</a> - Open serial device dev at baud b with flags</h3>This command opens the serial <a href="#dev">dev</a> at <a href="#b">b</a> bits per second.
-<br><br>No flags are currently defined. <a href="#sef">sef</a> should be set to zero.
-<br><br>Upon success a handle (&gt;=0) is returned. On error a negative status code
-will be returned.
-<br><br>The device name must start with /dev/tty or /dev/serial.
-<br><br>The baud rate must be one of 50, 75, 110, 134, 150,
-200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
-38400, 57600, 115200, or 230400.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;sero&nbsp;/dev/ttyAMA0&nbsp;9600&nbsp;0<br>0<br><br>$&nbsp;pigs&nbsp;sero&nbsp;/dev/tty1&nbsp;38400&nbsp;0<br>1<br></code><h3><a name="SERR">SERR</a>
- <a href="#h">h</a> <a href="#num">num</a> - Read bytes from serial handle</h3>This command returns up to <a href="#num">num</a> bytes of data read from the
-serial device associated with handle <a href="#h">h</a>.
-<br><br>Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;serr&nbsp;0&nbsp;10<br>5&nbsp;48&nbsp;49&nbsp;128&nbsp;144&nbsp;255<br><br>$&nbsp;pigs&nbsp;serr&nbsp;0&nbsp;10<br>0<br></code><h3><a name="SERRB">SERRB</a>
- - Read byte from serial handle</h3>This command returns a byte of data read from the serial
-device associated with handle <a href="#h">h</a>.
-<br><br>Upon success a number between 0 and 255 is returned.
-On error a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;serrb&nbsp;0<br>23<br>$&nbsp;pigs&nbsp;serrb&nbsp;0<br>45<br></code><h3><a name="SERW">SERW</a>
- <a href="#h">h</a> <a href="#bvs">bvs</a> - Write bytes to serial handle</h3>This command writes bytes <a href="#bvs">bvs</a> to the serial device
-associated with handle <a href="#h">h</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;serw&nbsp;0&nbsp;23&nbsp;45&nbsp;67&nbsp;89<br></code><h3><a name="SERWB">SERWB</a>
- <a href="#h">h</a> <a href="#bv">bv</a> - Write byte to serial handle</h3>This command writes a single byte <a href="#bv">bv</a> to the serial device
-associated with handle <a href="#h">h</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;serwb&nbsp;0&nbsp;23<br>$&nbsp;pigs&nbsp;serwb&nbsp;0&nbsp;0xf0<br></code><h3><a name="SHELL">SHELL</a>
- <a href="#name">name</a> <a href="#str">str</a> - Execute a shell command</h3>This command uses the system call to execute a shell script <a href="#name">name</a>
-with the given string <a href="#str">str</a> as its parameter.
-<br><br>The exit status of the system call is returned if OK, otherwise
-PI_BAD_SHELL_STATUS.
-<br><br><a href="#name">name</a> must exist in /opt/pigpio/cgi and must be executable.
-<br><br>The returned exit status is normally 256 times that set
-by the shell script exit function. If the script can't
-be found 32512 will be returned.
-<br><br>The following table gives some example returned statuses.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Script exit status</td><td>Returned system call status</td></tr><tr><td>1</td><td>256</td></tr><tr><td>5</td><td>1280</td></tr><tr><td>10</td><td>2560</td></tr><tr><td>200</td><td>51200</td></tr><tr><td>script not found</td><td>32512</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>#&nbsp;pass&nbsp;two&nbsp;parameters,&nbsp;hello&nbsp;and&nbsp;world<br>$&nbsp;pigs&nbsp;shell&nbsp;scr1&nbsp;hello&nbsp;world<br>256<br><br>#&nbsp;pass&nbsp;three&nbsp;parameters,&nbsp;hello,&nbsp;string&nbsp;with&nbsp;spaces,&nbsp;and&nbsp;world<br>$&nbsp;pigs&nbsp;shell&nbsp;scr1&nbsp;"hello&nbsp;'string&nbsp;with&nbsp;spaces'&nbsp;world"<br>256<br><br>#&nbsp;pass&nbsp;one&nbsp;parameter,&nbsp;hello&nbsp;string&nbsp;with&nbsp;spaces&nbsp;world<br>$&nbsp;pigs&nbsp;shell&nbsp;scr1&nbsp;"\"hello&nbsp;string&nbsp;with&nbsp;spaces&nbsp;world\""<br>256<br><br>#&nbsp;non-existent&nbsp;script<br>$&nbsp;pigs&nbsp;shell&nbsp;scr78&nbsp;par1<br>32512<br></code><h3><a name="SLR">SLR</a>
- <a href="#u">u</a> <a href="#num">num</a> - Read bit bang serial data from GPIO</h3>This command returns up to <a href="#num">num</a> bytes of bit bang serial data
-read from GPIO <a href="#u">u</a>.
-<br><br>Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-<br><br>The GPIO <a href="#u">u</a> should have been initialised with the <a href="#SLRO">SLRO</a> command.
-<br><br>The bytes returned for each character depend upon the number of
-data bits <a href="#db">db</a> specified in the <a href="#SLRO">SLRO</a> command.
-<br><br>For <a href="#db">db</a> 1-8 there will be one byte per character.<br>
-For <a href="#db">db</a> 9-16 there will be two bytes per character.<br>
-For <a href="#db">db</a> 17-32 there will be four bytes per character.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;slr&nbsp;15&nbsp;20<br>6&nbsp;1&nbsp;0&nbsp;23&nbsp;45&nbsp;89&nbsp;0<br></code><h3><a name="SLRC">SLRC</a>
- <a href="#u">u</a> - Close GPIO for bit bang serial data</h3>This command closes GPIO <a href="#u">u</a> for reading bit bang serial data.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;slrc&nbsp;23<br><br>$&nbsp;pigs&nbsp;slrc&nbsp;23<br>-38<br>ERROR:&nbsp;no&nbsp;serial&nbsp;read&nbsp;in&nbsp;progress&nbsp;on&nbsp;GPIO<br></code><h3><a name="SLRI">SLRI</a>
- <a href="#u">u</a> <a href="#v">v</a> - Sets bit bang serial data logic levels</h3>This command sets the logic level for reading bit bang serial data
-on GPIO <a href="#u">u</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>The invert parameter <a href="#v">v</a> is 1 for inverted signal, 0 for normal.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;slri&nbsp;17&nbsp;1&nbsp;#&nbsp;invert&nbsp;logic&nbsp;on&nbsp;GPIO&nbsp;17<br><br>$&nbsp;pigs&nbsp;slri&nbsp;23&nbsp;0&nbsp;#&nbsp;use&nbsp;normal&nbsp;logic&nbsp;on&nbsp;GPIO&nbsp;23<br></code><h3><a name="SLRO">SLRO</a>
- <a href="#u">u</a> <a href="#b">b</a> <a href="#db">db</a> - Open GPIO for bit bang serial data</h3>This command opens GPIO <a href="#u">u</a> for reading bit bang serial data
-at <a href="#b">b</a> baud and <a href="#db">db</a> data bits.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>The baud rate may be between 50 and 250000 bits per second.
-<br><br>The received data is held in a cyclic buffer.
-<br><br>It is the user's responsibility to read the data (with <a href="#SLR">SLR</a>)
-in a timely fashion.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;slro&nbsp;23&nbsp;19200&nbsp;8<br><br>$&nbsp;pigs&nbsp;slro&nbsp;23&nbsp;19200&nbsp;8<br>-50<br>ERROR:&nbsp;GPIO&nbsp;already&nbsp;in&nbsp;use<br></code><h3><a name="SPIC">SPIC</a>
- <a href="#h">h</a> - SPI close handle</h3>This command closes the SPI handle <a href="#h">h</a> returned by a prior
-call to <a href="#SPIO">SPIO</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;spic&nbsp;1<br><br>$&nbsp;pigs&nbsp;spic&nbsp;1<br>-25<br>ERROR:&nbsp;unknown&nbsp;handle<br></code><h3><a name="SPIO">SPIO</a>
- <a href="#c">c</a> <a href="#b">b</a> <a href="#spf">spf</a> - SPI open channel at baud b with flags</h3>This command returns a handle to a SPI device on channel <a href="#c">c</a>.
-<br><br>Data will be transferred at <a href="#b">b</a> bits per second. The flags <a href="#spf">spf</a>
-may be used to modify the default behaviour of 4-wire operation,
-mode 0, active low chip select.
-<br><br>Speeds between 32kbps and 125Mbps are allowed. Speeds above 30Mbps
-are unlikely to work.
-<br><br>The Pi has two SPI peripherals: main and auxiliary.
-<br><br>The main SPI has two chip selects (channels), the auxiliary has
-three.
-<br><br>The auxiliary SPI is available on all models but the A and B.
-<br><br>The GPIO used are given in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>MISO</td><td>MOSI</td><td>SCLK</td><td>CE0</td><td>CE1</td><td>CE2</td></tr><tr><td>Main SPI</td><td>9</td><td>10</td><td>11</td><td>8</td><td>7</td><td>-</td></tr><tr><td>Aux SPI</td><td>19</td><td>20</td><td>21</td><td>18</td><td>17</td><td>16</td></tr></tbody></table><br><br>The flags consists of the least significant 22 bits.
-<br><br><code>21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;W&nbsp;&nbsp;A&nbsp;u2&nbsp;u1&nbsp;u0&nbsp;p2&nbsp;p1&nbsp;p0&nbsp;&nbsp;m&nbsp;&nbsp;m<br></code><br><br>mm defines the SPI mode.
-<br><br>Warning: modes 1 and 3 do not appear to work on the auxiliary SPI.
-<br><br><code>Mode&nbsp;POL&nbsp;PHA<br>&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;0<br>&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;1<br>&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;0<br>&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;1<br></code><br><br>px is 0 if CEx is active low (default) and 1 for active high.
-<br><br>ux is 0 if the CEx GPIO is reserved for SPI (default) and 1 otherwise.
-<br><br>A is 0 for the main SPI, 1 for the auxiliary SPI.
-<br><br>W is 0 if the device is not 3-wire, 1 if the device is 3-wire. Main
-SPI only.
-<br><br>nnnn defines the number of bytes (0-15) to write before switching
-the MOSI line to MISO to read data. This field is ignored
-if W is not set. Main SPI only.
-<br><br>T is 1 if the least significant bit is transmitted on MOSI first, the
-default (0) shifts the most significant bit out first. Auxiliary SPI
-only.
-<br><br>R is 1 if the least significant bit is received on MISO first, the
-default (0) receives the most significant bit first. Auxiliary SPI
-only.
-<br><br>bbbbbb defines the word size in bits (0-32). The default (0)
-sets 8 bits per word. Auxiliary SPI only.
-<br><br>The <a href="#SPIR">SPIR</a>, <a href="#SPIW">SPIW</a>, and <a href="#SPIX">SPIX</a> commands transfer data
-packed into 1, 2, or 4 bytes according to the word size in bits.
-<br><br>For bits 1-8 there will be one byte per character.<br>
-For bits 9-16 there will be two bytes per character.<br>
-For bits 17-32 there will be four bytes per character.
-<br><br>Multi-byte transfers are made in least significant byte first order.
-<br><br>E.g. to transfer 32 11-bit words 64 bytes need to be sent.
-<br><br>E.g. to transfer the 14 bit value 0x1ABC send the bytes 0xBC followed
-by 0x1A.
-<br><br>The other bits in flags should be set to zero.
-<br><br>Upon success a handle (&gt;=0) is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;spio&nbsp;0&nbsp;100000&nbsp;3&nbsp;#&nbsp;Open&nbsp;channel&nbsp;0&nbsp;at&nbsp;100kbps&nbsp;in&nbsp;mode&nbsp;3.<br>0<br><br>$&nbsp;pigs&nbsp;spio&nbsp;0&nbsp;32000&nbsp;256&nbsp;#&nbsp;Open&nbsp;channel&nbsp;0&nbsp;of&nbsp;auxiliary&nbsp;spi&nbsp;at&nbsp;32kbps.<br>1<br></code><h3><a name="SPIR">SPIR</a>
- <a href="#h">h</a> <a href="#num">num</a> - SPI read bytes from handle</h3>This command returns <a href="#num">num</a> bytes read from the SPI device
-associated with handle <a href="#h">h</a>.
-<br><br>Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;spir&nbsp;0&nbsp;10&nbsp;#&nbsp;Read&nbsp;10&nbsp;bytes&nbsp;from&nbsp;the&nbsp;SPI&nbsp;device.<br>10&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br></code><h3><a name="SPIW">SPIW</a>
- <a href="#h">h</a> <a href="#bvs">bvs</a> - SPI write bytes to handle</h3>This command writes bytes <a href="#bvs">bvs</a> to the SPI device
-associated with handle <a href="#h">h</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;spiw&nbsp;0&nbsp;0x22&nbsp;0x33&nbsp;0xcc&nbsp;0xff<br></code><h3><a name="SPIX">SPIX</a>
- <a href="#h">h</a> <a href="#bvs">bvs</a> - SPI transfer bytes to handle</h3>This command writes bytes <a href="#bvs">bvs</a> to the SPI device
-associated with handle <a href="#h">h</a>. It returns the same
-number of bytes read from the device.
-<br><br>Upon success the count of returned bytes followed by the bytes themselves
-is returned. On error a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;spix&nbsp;0&nbsp;0x22&nbsp;0x33&nbsp;0xcc&nbsp;0xff<br>4&nbsp;0&nbsp;0&nbsp;0&nbsp;0<br></code><h3><a name="T/TICK">T/TICK</a>
- - Get current tick</h3>This command returns the current system tick.
-<br><br>Tick is the number of microseconds since system boot.
-<br><br>As tick is an unsigned 32 bit quantity it wraps around after 2^32 microseconds,
-which is approximately 1 hour 12 minutes.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;t&nbsp;mils&nbsp;1000&nbsp;t<br>3691823946<br>3692833987<br></code><h3><a name="TRIG">TRIG</a>
- <a href="#u">u</a> <a href="#pl">pl</a> <a href="#L">L</a> - Send a trigger pulse</h3>This command sends a trigger pulse of <a href="#pl">pl</a> microseconds at level <a href="#L">L</a>
-to GPIO <a href="#u">u</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>The GPIO is set to not level at the end of the pulse.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;trig&nbsp;4&nbsp;10&nbsp;1<br><br>$&nbsp;pigs&nbsp;trig&nbsp;4&nbsp;51&nbsp;1<br>-46<br>ERROR:&nbsp;trigger&nbsp;pulse&nbsp;&gt;&nbsp;50&nbsp;microseconds<br></code><h3><a name="W/WRITE">W/WRITE</a>
- <a href="#g">g</a> <a href="#L">L</a> - Write GPIO level</h3>This command sets GPIO <a href="#g">g</a> to level <a href="#L">L</a>. The level may be 0
-(low, off, clear) or 1 (high, on, set).
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;w&nbsp;23&nbsp;0<br>$&nbsp;pigs&nbsp;w&nbsp;23&nbsp;1<br><br>$&nbsp;pigs&nbsp;w&nbsp;23&nbsp;2<br>-5<br>ERROR:&nbsp;level&nbsp;not&nbsp;0-1<br></code><h3><a name="WDOG">WDOG</a>
- <a href="#u">u</a> <a href="#v">v</a> - Set GPIO watchdog</h3>This command sets a watchdog of <a href="#v">v</a> milliseconds on GPIO <a href="#u">u</a>.
-<br><br>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br>The watchdog is nominally in milliseconds.
-<br><br>One watchdog may be registered per GPIO.
-<br><br>The watchdog may be cancelled by setting timeout to 0.
-<br><br>Once a watchdog has been started monitors of the GPIO
-will be triggered every timeout interval after the last
-GPIO activity. The watchdog expiry will be indicated by
-a special TIMEOUT value.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wdog&nbsp;23&nbsp;90000<br>-15<br>ERROR:&nbsp;timeout&nbsp;not&nbsp;0-60000<br><br>$&nbsp;pigs&nbsp;wdog&nbsp;23&nbsp;9000<br></code><br><br>This example causes a report to be written to any notification pipes
-listening on GPIO 23 whenever GPIO 23 changes state or approximately
-every 9000 ms.
-<h3><a name="WVAG">WVAG</a>
- <a href="#trips">trips</a> - Add generic pulses to waveform</h3>This command adds 1 one or more triplets <a href="#trips">trips</a> of GPIO on, GPIO off,
-delay to the existing waveform (if any).
-<br><br>Upon success the total number of pulses in the waveform so far is
-returned. On error a negative status code will be returned.
-<br><br>The triplets will be added at the start of the existing waveform. If
-they are to start offset from the start then the first triplet should
-consist solely of a delay i.e. 0 0 offset.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvag&nbsp;0x10&nbsp;0x80&nbsp;1000&nbsp;0x80&nbsp;0x10&nbsp;9000<br>2<br><br>$&nbsp;pigs&nbsp;wvag&nbsp;0&nbsp;0&nbsp;10000&nbsp;0x10&nbsp;0x80&nbsp;1000&nbsp;0x80&nbsp;0x10&nbsp;9000<br>4<br></code><h3><a name="WVAS">WVAS</a>
- <a href="#u">u</a> <a href="#b">b</a> <a href="#db">db</a> <a href="#sb">sb</a> <a href="#o">o</a> <a href="#bvs">bvs</a> - Add serial data to waveform</h3>This command adds a waveform representing serial data <a href="#bvs">bvs</a> to
-GPIO <a href="#u">u</a> at <a href="#b">b</a> baud to the existing waveform (if any).
-The serial data starts <a href="#o">o</a> microseconds from the start of the
-waveform.
-<br><br>Upon success the total number of pulses in the waveform so far is
-returned. On error a negative status code will be returned.
-<br><br>The serial data is formatted as one start bit, <a href="#db">db</a> data bits, and
-<a href="#sb">sb</a>/2 stop bits.
-<br><br>The baud rate may be between 50 and 1000000 bits per second.
-<br><br>It is legal to add serial data streams with different baud rates to
-the same waveform.
-<br><br>The bytes required for each character depend upon <a href="#db">db</a>.
-<br><br>For <a href="#db">db</a> 1-8 there will be one byte per character.<br>
-For <a href="#db">db</a> 9-16 there will be two bytes per character.<br>
-For <a href="#db">db</a> 17-32 there will be four bytes per character.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvas&nbsp;4&nbsp;9600&nbsp;8&nbsp;2&nbsp;0&nbsp;0x30&nbsp;0x31&nbsp;0x32&nbsp;0x33<br>23<br><br>$&nbsp;pigs&nbsp;wvas&nbsp;7&nbsp;38400&nbsp;8&nbsp;2&nbsp;0&nbsp;0x41&nbsp;0x42<br>35<br></code><h3><a name="WVTAT">WVTAT</a>
- - Returns the current transmitting waveform</h3>This command returns the id of the waveform currently
-being transmitted.
-<br><br>Returns the waveform id or one of the following special
-values:
-<br><br>9998 - transmitted wave not found<br>
-9999 - no wave being transmitted
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvtat<br>9999<br></code><h3><a name="WVBSY">WVBSY</a>
- - Check if waveform is being transmitted</h3>This command checks to see if a waveform is currently being transmitted.
-<br><br>Returns 1 if a waveform is currently being transmitted, otherwise 0.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvbsy<br>0<br></code><h3><a name="WVCHA">WVCHA</a>
- <a href="#bvs">bvs</a> - Transmits a chain of waveforms</h3>This command transmits a chain of waveforms.
-<br><br>NOTE: Any hardware PWM started by <a href="#HP">HP</a> will
-be cancelled.
-<br><br>The waves to be transmitted are specified by the contents of
-<a href="#bvs">bvs</a> which contains an ordered list of wave_ids and optional
-command codes and related data.
-<br><br>Upon success 0 is returned. On error a negative status code
-will be returned.
-<br><br>Each wave is transmitted in the order specified. A wave may
-occur multiple times per chain.
-<br><br>A blocks of waves may be transmitted multiple times by using
-the loop commands. The block is bracketed by loop start and
-end commands. Loops may be nested.
-<br><br>Delays between waves may be added with the delay command.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>Loop Start</td><td>255 0</td><td>Identify start of a wave block</td></tr><tr><td>Loop Repeat</td><td>255 1 x y</td><td>loop x + y*256 times</td></tr><tr><td>Delay</td><td>255 2 x y</td><td>delay x + y*256 microseconds</td></tr><tr><td>Loop Forever</td><td>255 3</td><td>loop forever</td></tr></tbody></table><br><br>If present Loop Forever must be the last entry in the chain.
-<br><br>The code is currently dimensioned to support a chain with roughly
-600 entries and 20 loop counters.
-<br><br><b><small>Example</small></b><br><br><code>#!/bin/bash<br><br>GPIO=4<br>WAVES=5<br><br>pigs&nbsp;m&nbsp;$GPIO&nbsp;w<br><br>for&nbsp;((i=0;&nbsp;i&lt;$WAVES;&nbsp;i++))<br>do<br>&nbsp;&nbsp;&nbsp;pigs&nbsp;wvag&nbsp;$((1&lt;&lt;GPIO))&nbsp;0&nbsp;20&nbsp;0&nbsp;$((1&lt;&lt;GPIO))&nbsp;$(((i+1)*200))<br>&nbsp;&nbsp;&nbsp;w[i]=$(pigs&nbsp;wvcre)<br>done<br><br>#&nbsp;transmit&nbsp;waves&nbsp;4+3+2<br>#&nbsp;loop&nbsp;start<br>#&nbsp;&nbsp;&nbsp;&nbsp;transmit&nbsp;waves&nbsp;0+0+0<br>#&nbsp;&nbsp;&nbsp;&nbsp;loop&nbsp;start<br>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;transmit&nbsp;waves&nbsp;0+1<br>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;delay&nbsp;5000us<br>#&nbsp;&nbsp;&nbsp;&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;30&nbsp;times)<br>#&nbsp;&nbsp;&nbsp;&nbsp;loop&nbsp;start<br>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;transmit&nbsp;waves&nbsp;2+3+0<br>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;transmit&nbsp;waves&nbsp;3+1+2<br>#&nbsp;&nbsp;&nbsp;&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;10&nbsp;times)<br>#&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;5&nbsp;times)<br>#&nbsp;transmit&nbsp;waves&nbsp;4+4+4<br>#&nbsp;delay&nbsp;20000us<br>#&nbsp;transmit&nbsp;waves&nbsp;0+0+0<br><br>pigs&nbsp;wvcha&nbsp;\<br>&nbsp;&nbsp;&nbsp;${w[4]}&nbsp;${w[3]}&nbsp;${w[2]}&nbsp;\<br>&nbsp;&nbsp;&nbsp;255&nbsp;0&nbsp;\<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${w[0]}&nbsp;${w[0]}&nbsp;${w[0]}&nbsp;\<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255&nbsp;0&nbsp;\<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${w[0]}&nbsp;${w[1]}&nbsp;\<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255&nbsp;2&nbsp;0x88&nbsp;0x13&nbsp;\<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255&nbsp;1&nbsp;30&nbsp;0&nbsp;\<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255&nbsp;0&nbsp;\<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${w[2]}&nbsp;${w[3]}&nbsp;${w[0]}&nbsp;\<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${w[3]}&nbsp;${w[1]}&nbsp;${w[2]}&nbsp;\<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255&nbsp;1&nbsp;10&nbsp;0&nbsp;\<br>&nbsp;&nbsp;&nbsp;255&nbsp;1&nbsp;5&nbsp;0&nbsp;\<br>&nbsp;&nbsp;&nbsp;${w[4]}&nbsp;${w[4]}&nbsp;${w[4]}&nbsp;\<br>&nbsp;&nbsp;&nbsp;255&nbsp;2&nbsp;0x20&nbsp;0x4E&nbsp;\<br>&nbsp;&nbsp;&nbsp;${w[0]}&nbsp;${w[0]}&nbsp;${w[0]}<br><br>while&nbsp;[[&nbsp;$(pigs&nbsp;wvbsy)&nbsp;-eq&nbsp;1&nbsp;]];&nbsp;do&nbsp;sleep&nbsp;0.1;&nbsp;done<br><br>for&nbsp;((i=0;&nbsp;i&lt;$WAVES;&nbsp;i++));&nbsp;do&nbsp;echo&nbsp;${w[i]};&nbsp;pigs&nbsp;wvdel&nbsp;${w[i]};&nbsp;done<br></code><h3><a name="WVCLR">WVCLR</a>
- - Clear all waveforms</h3>This command clears all waveforms.
-<br><br>Nothing is returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvclr<br></code><h3><a name="WVCRE">WVCRE</a>
- - Create a waveform</h3>This command creates a waveform from the data provided by the prior
-calls to the <a href="#WVAG">WVAG</a> and <a href="#WVAS">WVAS</a> commands.
-<br><br>Upon success a wave id (&gt;=0) is returned. On error a negative status
-code will be returned.
-<br><br>The data provided by the <a href="#WVAG">WVAG</a> and <a href="#WVAS">WVAS</a> commands is
-consumed by this command.
-<br><br>As many waveforms may be created as there is space available.
-The wave id is passed to <a href="#WVTX">WVTX</a> or <a href="#WVTXR">WVTXR</a> to specify the
-waveform to transmit.
-<br><br>Normal usage would be
-<br><br>Step 1. <a href="#WVCLR">WVCLR</a> to clear all waveforms and added data.
-<br><br>Step 2. <a href="#WVAG">WVAG</a>/<a href="#WVAS">WVAS</a> calls to supply the waveform data.
-<br><br>Step 3. <a href="#WVCRE">WVCRE</a> to create the waveform and get a unique id.
-<br><br>Repeat steps 2 and 3 as needed.
-<br><br>Step 4. <a href="#WVTX">WVTX</a> or <a href="#WVTXR">WVTXR</a> with the id of the waveform to transmit.
-<br><br>A waveform comprises of one or more pulses.
-<br><br>A pulse specifies
-<br><br>1) the GPIO to be switched on at the start of the pulse.<br>
-2) the GPIO to be switched off at the start of the pulse.<br>
-3) the delay in microseconds before the next pulse.
-<br><br>Any or all the fields can be zero. It doesn't make any sense to
-set all the fields to zero (the pulse will be ignored).
-<br><br>When a waveform is started each pulse is executed in order with
-the specified delay between the pulse and the next.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvas&nbsp;4&nbsp;9600&nbsp;0&nbsp;23&nbsp;45&nbsp;67&nbsp;89&nbsp;90<br>37<br>$&nbsp;pigs&nbsp;wvcre<br>0<br><br>$&nbsp;pigs&nbsp;wvcre<br>-69<br>ERROR:&nbsp;attempt&nbsp;to&nbsp;create&nbsp;an&nbsp;empty&nbsp;waveform<br></code><h3><a name="WVCAP">WVCAP</a>
- - Create a waveform of fixed size</h3>Similar to <a href="#WVCRE">WVCRE</a>, 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.
-<br><br>Upon success a wave id (&gt;=0) is returned. On error a negative status
-code will be returned.
-<br><br>The data provided by the <a href="#WVAG">WVAG</a> and <a href="#WVAS">WVAS</a> commands are
-consumed by this command.
-<br><br>As many waveforms may be created as there is space available.
-The wave id is passed to <a href="#WVTX">WVTX</a> or <a href="#WVTXR">WVTXR</a> to specify the
-waveform to transmit.
-<br><br>Normal usage would be
-<br><br>Step 1. <a href="#WVCLR">WVCLR</a> to clear all waveforms and added data.
-<br><br>Step 2. <a href="#WVAG">WVAG</a>/<a href="#WVAS">WVAS</a> calls to supply the waveform data.
-<br><br>Step 3. <a href="#WVCAP">WVCAP</a> to create a waveform of a uniform size.
-<br><br>Step 4. <a href="#WVTX">WVTX</a> or <a href="#WVTXR">WVTXR</a> with the id of the waveform to transmit.
-<br><br>Repeat steps 2 - 4 as needed.
-<br><br>Step 5. Any wave id can now be deleted and another wave of the same size
- can be created in its place.
-<br><br><b><small>Example</small></b><br><br><code>#&nbsp;Create&nbsp;a&nbsp;wave&nbsp;that&nbsp;consumes&nbsp;50%&nbsp;of&nbsp;the&nbsp;total&nbsp;resource:<br><br>$&nbsp;pigs&nbsp;wvag&nbsp;16&nbsp;0&nbsp;5000000&nbsp;0&nbsp;16&nbsp;5000000<br>2<br>$&nbsp;pigs&nbsp;wvcap&nbsp;50<br>0<br>$&nbsp;pigs&nbsp;wvtx&nbsp;0<br>11918<br></code><h3><a name="WVDEL">WVDEL</a>
- <a href="#wid">wid</a> - Delete selected waveform</h3>This command deletes the waveform with id <a href="#wid">wid</a>.
-<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>Upon success nothing is returned. On error a negative status code
-will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvdel&nbsp;0<br><br>$&nbsp;pigs&nbsp;wvdel&nbsp;0<br>-66<br>ERROR:&nbsp;non&nbsp;existent&nbsp;wave&nbsp;id<br></code><h3><a name="WVHLT">WVHLT</a>
- - Stop waveform</h3>This command aborts the transmission of the current waveform.
-<br><br>Nothing is returned.
-<br><br>This command is intended to stop a waveform started in the repeat mode.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvhlt<br></code><h3><a name="WVNEW">WVNEW</a>
- - Initialise a new waveform</h3>This clears any existing waveform data ready for the creation of a new
-waveform.
-<br><br>Nothing is returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvnew<br></code><h3><a name="WVSC">WVSC</a>
- <a href="#ws">ws</a> - Get waveform DMA CB stats</h3>The statistic requested by <a href="#ws">ws</a> is returned.
-<br><br><a href="#ws">ws</a> identifies the subcommand as follows.
-<br><br>0 Get Cbs<br>
-1 Get High Cbs<br>
-2 Get Max Cbs
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvas&nbsp;4&nbsp;9600&nbsp;0&nbsp;23&nbsp;45&nbsp;67&nbsp;89&nbsp;90<br>37<br><br>$&nbsp;pigs&nbsp;wvsc&nbsp;0<br>74<br>$&nbsp;pigs&nbsp;wvsc&nbsp;1<br>74<br>$&nbsp;pigs&nbsp;wvsc&nbsp;2<br>25016<br></code><h3><a name="WVSM">WVSM</a>
- <a href="#ws">ws</a> - Get waveform time stats</h3>The statistic requested by <a href="#ws">ws</a> is returned.
-<br><br><a href="#ws">ws</a> identifies the subcommand as follows.
-<br><br>0 Get Micros<br>
-1 Get High Micros<br>
-2 Get Max Micros
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvsm&nbsp;0<br>5314<br>$&nbsp;pigs&nbsp;wvsm&nbsp;1<br>5314<br>$&nbsp;pigs&nbsp;wvsm&nbsp;2<br>1800000000<br></code><h3><a name="WVSP">WVSP</a>
- <a href="#ws">ws</a> - Get waveform pulse stats</h3>The statistic requested by <a href="#ws">ws</a> is returned.
-<br><br><a href="#ws">ws</a> identifies the subcommand as follows.
-<br><br>0 Get Pulses<br>
-1 Get High Pulses<br>
-2 Get Max Pulses
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvsp&nbsp;0<br>37<br>$&nbsp;pigs&nbsp;wvsp&nbsp;1<br>37<br>$&nbsp;pigs&nbsp;wvsp&nbsp;2<br>12000<br></code><h3><a name="WVTX">WVTX</a>
- <a href="#wid">wid</a> - Transmits waveform once</h3>This command transmits the waveform with id <a href="#wid">wid</a> once.
-<br><br>NOTE: Any hardware PWM started by <a href="#HP">HP</a> will be cancelled.
-<br><br>Upon success the number of DMA control blocks in the waveform is returned.
-On error a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvtx&nbsp;1<br>75<br><br>$&nbsp;pigs&nbsp;wvtx&nbsp;2<br>-66<br>ERROR:&nbsp;non&nbsp;existent&nbsp;wave&nbsp;id<br></code><h3><a name="WVTXM">WVTXM</a>
- <a href="#wid">wid</a> <a href="#wmde">wmde</a> - Transmits waveform using mode</h3>This command transmits the waveform with id <a href="#wid">wid</a> using mode <a href="#wmde">wmde</a>.
-<br><br>The mode may be send once (0), send repeatedly (1), send once but
-first sync with previous wave (2), or send repeatedly but first
-sync with previous wave (3).
-<br><br>WARNING: bad things may happen if you delete the previous
-waveform before it has been synced to the new waveform.
-<br><br>NOTE: Any hardware PWM started by <a href="#HP">HP</a> will be cancelled.
-<br><br>Upon success the number of DMA control blocks in the waveform is returned.
-On error a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvtxm&nbsp;1&nbsp;3<br>75<br><br>$&nbsp;pigs&nbsp;wvtxm&nbsp;2&nbsp;0<br>-66<br>ERROR:&nbsp;non&nbsp;existent&nbsp;wave&nbsp;id<br></code><h3><a name="WVTXR">WVTXR</a>
- <a href="#wid">wid</a> - Transmits waveform repeatedly</h3>This command transmits the waveform with id <a href="#wid">wid</a> repeatedly.
-<br><br>NOTE: Any hardware PWM started by <a href="#HP">HP</a> will be cancelled.
-<br><br>Upon success the number of DMA control blocks in the waveform is returned.
-On error a negative status code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>$&nbsp;pigs&nbsp;wvtxr&nbsp;1<br>75<br><br>$&nbsp;pigs&nbsp;wvtxr&nbsp;2<br>-66<br>ERROR:&nbsp;non&nbsp;existent&nbsp;wave&nbsp;id<br></code><h2><a name="Parameters">Parameters</a></h2>
-<h3><a name="actv">actv</a> - 0-1000000</h3>
-The number of microseconds level changes are reported for once
-a noise filter has been triggered (by <a href="#stdy">stdy</a> microseconds of
-a stable level).
-<h3><a name="b">b</a> - baud</h3>
-The command expects the baud rate in bits per second for
-the transmission of serial data (I2C/SPI/serial link, waves).
-<h3><a name="bctl">bctl</a> - BSC control word</h3>
-The command expects a BSC control word, see <a href="#BSCX">BSCX</a>.
-<h3><a name="bit">bit</a> - bit value (0-1)</h3>
-The command expects 0 or 1.
-<h3><a name="bits">bits</a> - a bit mask</h3>
-A mask is used to select one or more GPIO. A GPIO is selected
-if bit (1&lt;&lt;GPIO) is set in the mask.
-<br><br>E.g. a mask of 6 (binary 110) select GPIO 1 and 2, a mask of
-0x103 (binary 100000011) selects GPIO 0, 1, and 8.
-<h3><a name="bv">bv</a> - a byte value (0-255)</h3>
-The command expects a byte value.
-<h3><a name="bvs">bvs</a> - byte values (0-255)</h3>
-The command expects one or more byte values.
-<h3><a name="c">c</a> - SPI channel (0-1)</h3>
-The command expects a SPI channel.
-<h3><a name="cf">cf</a> - hardware clock frequency (4689-250M, 13184-375M for the BCM2711)</h3>
-The command expects a frequency.
-<h3><a name="cs">cs</a> - GPIO (0-31)</h3>
-The GPIO used for the slave select signal when bit banging SPI.
-<h3><a name="db">db</a> - serial data bits (1-32)</h3>
-The command expects the number of data bits per serial character.
-<h3><a name="dev">dev</a> - a tty serial device (/dev/tty* or /dev/serial*)</h3>
-The command expects the name of a tty serial device, e.g.
-<br><br><code>/dev/ttyAMA0<br>/dev/ttyUSB0<br>/dev/tty0<br>/dev/serial0<br></code><h3><a name="event">event</a> - 0-31</h3>
-An event is a signal used to inform one or more consumers
-to start an action.
-<h3><a name="file">file</a> - a file name</h3>
-The file name must match an entry in /opt/pigpio/access.
-<h3><a name="from">from</a> - 0-2</h3>
-Position to seek from <a href="#FS">FS</a>.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>From</td></tr><tr><td>0</td><td>start</td></tr><tr><td>1</td><td>current position</td></tr><tr><td>2</td><td>end</td></tr></tbody></table><h3><a name="g">g</a> - GPIO (0-53)</h3>
-The command expects a GPIO.
-<br><br>There are 54 General Purpose Input Outputs (GPIO) named gpio0 through gpio53.
-<br><br>They are split into two banks. Bank 1 consists of gpio0 through gpio31.
-Bank 2 consists of gpio32 through gpio53.
-<br><br>All the GPIO which are safe for the user to read and write are in bank 1.
-Not all GPIO in bank 1 are safe though. Type 1 boards have 17 safe GPIO.
-Type 2 boards have 21. Type 3 boards have 26.
-<br><br>See <a href="#HWVER">HWVER</a>.
-<br><br>The user GPIO are marked with an X in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>0</td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td><td>15</td></tr><tr><td>Type 1</td><td>X</td><td>X</td><td>-</td><td>-</td><td>X</td><td>-</td><td>-</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>-</td><td>-</td><td>X</td><td>X</td></tr><tr><td>Type 2</td><td>-</td><td>-</td><td>X</td><td>X</td><td>X</td><td>-</td><td>-</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>-</td><td>-</td><td>X</td><td>X</td></tr><tr><td>Type 3</td><td></td><td></td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>16</td><td>17</td><td>18</td><td>19</td><td>20</td><td>21</td><td>22</td><td>23</td><td>24</td><td>25</td><td>26</td><td>27</td><td>28</td><td>29</td><td>30</td><td>31</td></tr><tr><td>Type 1</td><td>-</td><td>X</td><td>X</td><td>-</td><td>-</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Type 2</td><td>-</td><td>X</td><td>X</td><td>-</td><td>-</td><td>-</td><td>X</td><td>X</td><td>X</td><td>X</td><td>-</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr><tr><td>Type 3</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>-</td><td>-</td><td>-</td><td>-</td></tr></tbody></table><br><br>You are not prevented from writing to unsafe GPIO. The consequences
-of doing so range from no effect, to a crash, or corrupted data.
-<h3><a name="h">h</a> - handle (&gt;=0)</h3>
-The command expects a handle.
-<br><br>A handle is a number referencing an object opened by one of <a href="#FO">FO</a>,
-<a href="#I2CO">I2CO</a>, <a href="#NO">NO</a>, <a href="#SERO">SERO</a>, <a href="#SPIO">SPIO</a>.
-<h3><a name="ib">ib</a> - I2C bus (&gt;=0)</h3>
-The command expects an I2C bus number.
-<h3><a name="id">id</a> - I2C device (0-0x7F)</h3>
-The command expects the address of an I2C device.
-<h3><a name="if">if</a> - I2C flags (0)</h3>
-The command expects an I2C flags value. No flags are currently defined.
-<h3><a name="L">L</a> - level (0-1)</h3>
-The command expects a GPIO level.
-<h3><a name="m">m</a> - mode (RW540123)</h3>
-The command expects a mode character.
-<br><br>Each GPIO can be configured to be in one of 8 different modes. The modes
-are named Input, Output, ALT0, ALT1, ALT2, ALT3, ALT4, and ALT5.
-<br><br>To set the mode use the code for the mode.
-<br><br>The value is returned by the mode get command.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Mode</td><td>Input</td><td>Output</td><td>ALT0</td><td>ALT1</td><td>ALT2</td><td>ALT3</td><td>ALT4</td><td>ALT5</td></tr><tr><td>Code</td><td>R</td><td>W</td><td>0</td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td></tr><tr><td>Value</td><td>0</td><td>1</td><td>4</td><td>5</td><td>6</td><td>7</td><td>3</td><td>2</td></tr></tbody></table><h3><a name="miso">miso</a> - GPIO (0-31)</h3>
-The GPIO used for the MISO signal when bit banging SPI.
-<h3><a name="mode">mode</a> - file open mode</h3>
-One of the following values.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>Value</td><td>Meaning</td></tr><tr><td>READ</td><td>1</td><td>open file for reading</td></tr><tr><td>WRITE</td><td>2</td><td>open file for writing</td></tr><tr><td>RW</td><td>3</td><td>open file for reading and writing</td></tr></tbody></table><br><br>The following values can be or'd into the mode.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>Value</td><td>Meaning</td></tr><tr><td>APPEND</td><td>4</td><td>All writes append data to the end of the file</td></tr><tr><td>CREATE</td><td>8</td><td>The file is created if it doesn't exist</td></tr><tr><td>TRUNC</td><td>16</td><td>The file is truncated</td></tr></tbody></table><h3><a name="mosi">mosi</a> - GPIO (0-31)</h3>
-The GPIO used for the MOSI signal when bit banging SPI.
-<h3><a name="name">name</a> - the name of a script</h3>
-Only alphanumeric characters, '-' and '_' are allowed in the name.
-<h3><a name="num">num</a> - maximum number of bytes to return (1-)</h3>
-The command expects the maximum number of bytes to return.
-<br><br>For the I2C and SPI commands the requested number of bytes will always
-be returned.
-<br><br>For the serial and file commands the smaller of the number of
-bytes available to be read (which may be zero) and <a href="#num">num</a> bytes
-will be returned.
-<h3><a name="o">o</a> - offset (&gt;=0)</h3>
-Serial data is stored offset microseconds from the start of the waveform.
-<h3><a name="p">p</a> - PUD (ODU)</h3>
-The command expects a PUD character.
-<br><br>Each GPIO can be configured to use or not use an internal pull up or
-pull down resistor. This is useful to provide a default state for inputs.
-<br><br>A pull up will default the input to 1 (high).
-<br><br>A pull down will default the input to 0 (low).
-<br><br>To set the pull up down state use the command character for the state.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pull Up Down</td><td>Off</td><td>Pull Down</td><td>Pull Up</td></tr><tr><td>Command Character</td><td>O</td><td>D</td><td>U</td></tr></tbody></table><br><br>There is no mechanism to read the pull up down state.
-<h3><a name="pad">pad</a> - 0-2</h3>
-A set of GPIO which share common drivers.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><h3><a name="padma">padma</a> - 1-16</h3>
-The mA which may be drawn from each GPIO whilst still guaranteeing the
-high and low levels.
-<h3><a name="pars">pars</a> - script parameters</h3>
-The command expects 0 to 10 numbers as parameters to be passed to the script.
-<h3><a name="pat">pat</a> - a file name pattern</h3>
-A file path which may contain wildcards. To be accessible the path
-must match an entry in /opt/pigpio/access.
-<h3><a name="pdc">pdc</a> - hardware PWM dutycycle (0-1000000)</h3>
-The command expects a dutycycle.
-<h3><a name="pf">pf</a> - hardware PWM frequency (1-125M, 1-187.5M for the BCM2711)</h3>
-The command expects a frequency.
-<h3><a name="pl">pl</a> - pulse length (1-100)</h3>
-The command expects a pulse length in microseconds.
-<h3><a name="r">r</a> - register (0-255)</h3>
-The command expects an I2C register number.
-<h3><a name="sb">sb</a> - serial stop (half) bits (2-8)</h3>
-The command expects the number of stop (half) bits per serial character.
-<h3><a name="scl">scl</a> - user GPIO (0-31)</h3>
-The command expects the number of the GPIO to be used for SCL
-when bit banging I2C.
-<h3><a name="sclk">sclk</a> - user GPIO (0-31)</h3>
-The GPIO used for the SCLK signal when bit banging SPI.
-<h3><a name="sda">sda</a> - user GPIO (0-31)</h3>
-The command expects the number of the GPIO to be used for SDA
-when bit banging I2C.
-<h3><a name="sef">sef</a> - serial flags (32 bits)</h3>
-The command expects a flag value. No serial flags are currently defined.
-<h3><a name="sid">sid</a> - script id (&gt;= 0)</h3>
-The command expects a script id as returned by a call to <a href="#PROC">PROC</a>.
-<h3><a name="spf">spf</a> - SPI flags (32 bits)</h3>
-See <a href="#SPIO">SPIO</a> and <a href="#BSPIO">BSPIO</a>.
-<h3><a name="stdy">stdy</a> - 0-300000</h3>
-The number of microseconds level changes must be stable for
-before reporting the level changed (<a href="#FG">FG</a>) or triggering
-the active part of a noise filter (<a href="#FN">FN</a>).
-<h3><a name="str">str</a> - a string</h3>
-The command expects a string.
-<h3><a name="t">t</a> - a string</h3>
-The command expects a string.
-<h3><a name="trips">trips</a> - triplets</h3>
-The command expects 1 or more triplets of GPIO on, GPIO off, delay.
-<br><br>E.g. 0x400000 0 100000 0 0x400000 900000 defines two pulses as follows
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>GPIO on</td><td>GPIO off</td><td>delay</td></tr><tr><td>0x400000 (GPIO 22)</td><td>0 (None)</td><td>100000 (1/10th s)</td></tr><tr><td>0 (None)</td><td>0x400000 (GPIO 22)</td><td>900000 (9/10th s)</td></tr></tbody></table><h3><a name="u">u</a> - user GPIO (0-31)</h3>
-The command expects the number of a user GPIO.
-<br><br>A number of commands are restricted to GPIO in bank 1,
-in particular the PWM commands, the servo command,
-the watchdog command, and the notification command.
-<br><br>It is your responsibility to ensure that the PWM and servo commands
-are only used on safe GPIO.
-<br><br>See <a href="#g">g</a>
-<h3><a name="uvs">uvs</a> - values</h3>
-The command expects an arbitrary number of &gt;=0 values (possibly none).
-Any after the first two must be &lt;= 255.
-<h3><a name="v">v</a> - value</h3>
-The command expects a number.
-<h3><a name="wid">wid</a> - wave id (&gt;=0)</h3>
-The command expects a wave id.
-<br><br>When a waveform is created it is given an id (0, 1, 2, ...).
-<h3><a name="wmde">wmde</a> - mode (0-3)</h3>
-The command expects a wave transmission mode.
-<br><br>0 = send once<br>
-1 = send repeatedly<br>
-2 = send once but first sync with previous wave<br>
-3 = send repeatedly but first sync with previous wave<br>
-<h3><a name="ws">ws</a> - wave stats sucommand (0-2)</h3>
-The command expects a subcommand.
-<br><br>0 = current value.<br>
-1 = highest value so far.<br>
-2 = maximum possible value.
-<h3><a name="wv">wv</a> - word value (0-65535)</h3>
-The command expects a word value.
-<h2><a name="Scripts">Scripts</a></h2>
-Scripts are programs to be stored and executed by the pigpio daemon.
-They are intended to mitigate any performance problems associated with
-the pigpio daemon server/client model.
-<h3>Example</h3>A trivial example might be useful. Suppose you want to toggle a GPIO
-on and off as fast as possible.
-<br><br>From the command line you could write
-<br><br><code>for&nbsp;((i=0;&nbsp;i&lt;1000;i++));&nbsp;do&nbsp;pigs&nbsp;w&nbsp;22&nbsp;1&nbsp;w&nbsp;22&nbsp;0;&nbsp;done<br></code><br><br>Timing that you will see it takes about 14 seconds, or roughly
-70 toggles per second.
-<br><br>Using the pigpio Python module you could use code such as
-<br><br><code>#!/usr/bin/env&nbsp;python<br><br>import&nbsp;time<br><br>import&nbsp;pigpio<br><br>PIN=4<br><br>TOGGLE=10000<br><br>pi&nbsp;=&nbsp;pigpio.pi()&nbsp;#&nbsp;Connect&nbsp;to&nbsp;local&nbsp;Pi.<br><br>s&nbsp;=&nbsp;time.time()<br><br>for&nbsp;i&nbsp;in&nbsp;range(TOGGLE):<br>&nbsp;&nbsp;&nbsp;pi.write(PIN,&nbsp;1)<br>&nbsp;&nbsp;&nbsp;pi.write(PIN,&nbsp;0)<br><br>e&nbsp;=&nbsp;time.time()<br><br>print("pigpio&nbsp;did&nbsp;{}&nbsp;toggles&nbsp;per&nbsp;second".format(int(TOGGLE/(e-s))))<br><br>pi.stop()<br></code><br><br>Timing that shows a speed improvement to roughly 800 toggles per second.
-<br><br>Now let's use a script.
-<br><br><code>pigs&nbsp;proc&nbsp;tag&nbsp;999&nbsp;w&nbsp;22&nbsp;1&nbsp;w&nbsp;22&nbsp;0&nbsp;dcr&nbsp;p0&nbsp;jp&nbsp;999<br></code><br><br>Ignore the details for now.
-<br><br>Let's time the script running.
-<br><br>Again, ignore the details for now.
-<br><br><code>time&nbsp;(pigs&nbsp;procr&nbsp;0&nbsp;10000000;&nbsp;while&nbsp;a=$(pigs&nbsp;procp&nbsp;0);&nbsp;[[&nbsp;${a::1}&nbsp;-eq&nbsp;2&nbsp;]];\<br>&nbsp;do&nbsp;sleep&nbsp;0.2;&nbsp;done)<br></code><br><br>The script takes roughly 12 seconds to complete, or 800,000 toggles per second.
-<br><br>That is the advantage of a stored script.
-<br><br>Some details.
-<br><br><code>pigs&nbsp;proc&nbsp;tag&nbsp;999&nbsp;w&nbsp;22&nbsp;1&nbsp;w&nbsp;22&nbsp;0&nbsp;dcr&nbsp;p0&nbsp;jp&nbsp;999<br></code><br><br>proc introduces a script. Everything after proc is part of the script.<br>
-tag 999 names the current position in the script.<br>
-w 22 1 writes 1 to GPIO 22.<br>
-w 22 0 writes 0 to GPIO 22.<br>
-dcr p0 decrements parameter 0.<br>
-jp 999 jumps to tag 999 if the result is positive.
-<br><br><code>time&nbsp;(pigs&nbsp;procr&nbsp;0&nbsp;10000000;&nbsp;while&nbsp;a=$(pigs&nbsp;procp&nbsp;0);&nbsp;[[&nbsp;${a::1}&nbsp;-eq&nbsp;2&nbsp;]];\<br>&nbsp;do&nbsp;sleep&nbsp;0.2;&nbsp;done)<br></code><br><br>pigs procr 0 10000000 starts script 0 with parameter 0 of 10 million.
-<br><br>The rest is bash apart from
-<br><br>pigs procp 0 asks for the status and parameters of script 0.
-The status will be 2 while the script is running and 1 when it is complete.
-<h3>Virtual machine</h3>A script runs within a virtual machine with
-<br><br>a 32 bit accumulator A.<br>
-a flags register F.<br>
-a program counter PC.
-<br><br>Each script has
-<br><br>10 parameters named 0 through 9.<br>
-150 variables named 0 through 149.<br>
-50 labels which are named by any unique number.
-<h3>Commands</h3>Many pigpio commands may be used within a script. However
-some commands do not work within the script model as designed and
-are not permitted.
-<br><br>The following commands are not permitted within a script:
-<br><br>File - FL FO FR FW
-<br><br>I2C - BI2CZ I2CPK I2CRD I2CRI I2CRK I2CWD I2CWI I2CWK I2CZ
-<br><br>Misc - BSCX CF1 CF2 SHELL
-<br><br>Script control - PARSE PROC PROCD PROCP PROCR PROCS PROCU
-<br><br>Serial - SERO SERR SERW SLR
-<br><br>SPI - BSPIO BSPIX SPIR SPIW SPIX
-<br><br>Waves - WVAG WVAS WVCHA WVGO WVGOR
-<br><br>The following commands are only permitted within a script:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Command</td><td>Description</td><td>Definition</td></tr><tr><td>ADD x</td><td>Add x to accumulator</td><td>A+=x; F=A</td></tr><tr><td>AND x</td><td>And x with accumulator</td><td>A&=x; F=A</td></tr><tr><td>CALL L</td><td>Call subroutine at tag L</td><td>push(PC+1); PC=L</td></tr><tr><td>CMP x</td><td>Compare x with accumulator</td><td>F=A-x</td></tr><tr><td>DCR y</td><td>Decrement register</td><td>--*y; F=*y</td></tr><tr><td>DCRA</td><td>Decrement accumulator</td><td>--A; F=A</td></tr><tr><td>DIV x</td><td>Divide x into accumulator</td><td>A/=x; F=A</td></tr><tr><td>EVTWT</td><td>Wait for an event to occur</td><td>A=wait(x); F=A</td></tr><tr><td>HALT</td><td>Halt</td><td>Halt</td></tr><tr><td>INR y</td><td>Increment register</td><td>++*y; F=*y</td></tr><tr><td>INRA</td><td>Increment accumulator</td><td>++A; F=A</td></tr><tr><td>JM L</td><td>Jump if minus to tag L</td><td>if (F&lt;0) PC=L</td></tr><tr><td>JMP L</td><td>Jump to tag L</td><td>PC=L</td></tr><tr><td>JNZ L</td><td>Jump if non-zero to tag L</td><td>if (F) PC=L</td></tr><tr><td>JP L</td><td>Jump if positive to tag L</td><td>if (F&gt;=0) PC=L</td></tr><tr><td>JZ L</td><td>Jump if zero to tag L</td><td>if (!F) PC=L</td></tr><tr><td>LD y x</td><td>Load register with x</td><td>*y=x</td></tr><tr><td>LDA x</td><td>Load accumulator with x</td><td>A=x</td></tr><tr><td>MLT x</td><td>Multiply x with accumulator</td><td>A*=x; F=A</td></tr><tr><td>MOD x</td><td>Modulus x with accumulator</td><td>A%=x; F=A</td></tr><tr><td>OR x</td><td>Or x with accumulator</td><td>A|=x; F=A</td></tr><tr><td>POP y</td><td>Pop register</td><td>y=pop()</td></tr><tr><td>POPA</td><td>Pop accumulator</td><td>A=pop()</td></tr><tr><td>PUSH y</td><td>Push register</td><td>push(y)</td></tr><tr><td>PUSHA</td><td>Push accumulator</td><td>push(A)</td></tr><tr><td>RET</td><td>Return from subroutine</td><td>PC=pop()</td></tr><tr><td>RL y x</td><td>Rotate left register x bits</td><td>*y&lt;&lt;=x; F=*y</td></tr><tr><td>RLA x</td><td>Rotate left accumulator x bits</td><td>A&lt;&lt;=x; F=A</td></tr><tr><td>RR y x</td><td>Rotate right register x bits</td><td>*y&gt;&gt;=x; F=*y</td></tr><tr><td>RRA x</td><td>Rotate right accumulator x bits</td><td>A&gt;&gt;=x; F=A</td></tr><tr><td>STA y</td><td>Store accumulator in register</td><td>y=A</td></tr><tr><td>SUB x</td><td>Subtract x from accumulator</td><td>A-=x; F=A</td></tr><tr><td>SYS str</td><td>Run external script (/opt/pigpio/cgi/str)</td><td>system(str); F=A</td></tr><tr><td>TAG L</td><td>Label the current script position</td><td>N/A</td></tr><tr><td>WAIT x</td><td>Wait for a GPIO in x to change state</td><td>A=wait(x); F=A</td></tr><tr><td>X y1 y2</td><td>Exchange contents of registers y1 and y2</td><td>t=*y1;*y1=*y2;*y2=t</td></tr><tr><td>XA y</td><td>Exchange contents of accumulator and register</td><td>t=A;A=*y;*y=t</td></tr><tr><td>XOR x</td><td>Xor x with accumulator</td><td>A^=x; F=A</td></tr></tbody></table><br><br>x may be a constant, a parameter (p0-p9), or a variable (v0-v149).
-<br><br>y may be a parameter (p0-p9), or a variable (v0-v149). If p or v isn't
-specified y is assumed to be a variable.
-<br><br>The EVTWT command parameter is a bit-mask with 1 set for events of interest.
-<br><br>The WAIT command parameter is a bit-mask with 1 set for GPIO of interest.
-<br><br>The SYS script receives two unsigned parameters: the accumulator A and
-the current GPIO levels.
-<br><br> \ No newline at end of file
diff --git a/DOC/tmp/body/piscope.body b/DOC/tmp/body/piscope.body
deleted file mode 100644
index dd0c7ce..0000000
--- a/DOC/tmp/body/piscope.body
+++ /dev/null
@@ -1,205 +0,0 @@
-
-<h2>Introduction<br></h2>
-<a href="piscope.tar">piscope</a> is a logic analyser (digital
-waveform viewer) for the Raspberry.&nbsp; It shows the state (high
-or low) of selected GPIO in real-time.<br>
-<br>
-See <a href="http://youtu.be/2apqOiLHEzs">video</a>.<br>
-<br>
-piscope uses the services of the pigpio <a href=
-"download.html">library</a>.&nbsp; pigpio needs to be running on
-the Pi whose GPIO are to be monitored.<br>
-<br>
-The pigpio library may be started as a daemon (background process)
-by the following command.<br>
-<br>
-<code>sudo pigpiod<br></code><br>
-piscope may be invoked in several different ways<br>
-<br>
-<table summary="" style=
-"text-align: left; width: 90%; height: 246px;" cellspacing="2"
-cellpadding="2" border="1">
-<tbody>
-<tr>
-<td style="width: 15%;"><small>Pi<br></small></td>
-<td style="vertical-align: top; width: 55%;"><small><span style=
-"font-style: italic;">pi_host</span> ~ $ piscope
-&amp;<br></small></td>
-<td style="vertical-align: top; width: 30%;"><small>Pi captures
-data<br>
-Pi processes data<br>
-Pi displays data<br></small></td>
-</tr>
-<tr>
-<td style="vertical-align: top;"><small>Pi plus Linux PC<br>
-<br>
-(with the<br>
-display on a remote<br>
-&nbsp; Linux PC)<br></small></td>
-<td style="vertical-align: top;"><small><span style=
-"font-style: italic;">remote_host</span> ~ $ ssh -X <span style=
-"font-style: italic;">pi_host</span><br></small><small><span style=
-"font-style: italic;">pi_host</span> ~ $ piscope
-&amp;</small><small><br></small></td>
-<td style="vertical-align: top;"><small>Pi captures data<br>
-Pi processes data<br>
-Remote Linux PC displays data<br></small></td>
-</tr>
-<tr>
-<td style="vertical-align: top;"><small>Pi plus Windows PC<br>
-<br>
-(with the<br>
-display on a remote<br>
-&nbsp; Windows PC)</small></td>
-<td style="vertical-align: top;"><small>You need to install an SSH
-client (putty suggested) and a X11 server (xming suggested).<br>
-<br>
-Run Program Files -&gt; Xming -&gt; XLaunch and accept the
-defaults.<br>
-<br>
-Run putty and enter the Pi's host name or IP address.&nbsp; Click
-on SSH X11 and tick Enable X11 forwarding and then select
-Open.</small><br>
-<small><br></small> <small><span style=
-"font-style: italic;">pi_host</span> ~ $ piscope
-&amp;</small><br></td>
-<td style="vertical-align: top;"><small>Pi captures data<br>
-Pi processes data<br>
-Remote Windows PC displays data</small></td>
-</tr>
-<tr>
-<td style="vertical-align: top;"><small>Pi plus Linux PC<br>
-<br>
-(with the display and processing on a remote Linux
-PC)<br></small></td>
-<td style="vertical-align: top;"><small><span style=
-"font-style: italic;">remote_host</span> ~ $ export
-PIGPIO_ADDR=<span style="font-style: italic;">pi_host</span><br>
-<span style="font-style: italic;">remote_host</span> ~ $ piscope
-&amp;<br></small></td>
-<td style="vertical-align: top;"><small>Pi captures data<br>
-Remote processes data<br>
-Remote displays data<br></small></td>
-</tr>
-</tbody>
-</table>
-<br>
-piscope operates in one of three modes<br>
-<br>
-<table summary="" style="text-align: left; width: 90%;"
-cellspacing="2" cellpadding="2" border="1">
-<tbody>
-<tr>
-<td style="vertical-align: top;">Live<br></td>
-<td style="vertical-align: top;">The latest GPIO samples are
-displayed.<br>
-<br>
-The mode will automatically change to Pause if a sampling trigger
-is detected.<br>
-<br>
-There are four triggers.&nbsp; Each trigger is made up of a
-combination of GPIO states (one of don't care, low, high, edge,
-falling, or rising per GPIO).&nbsp; Triggers are always
-counted.&nbsp; In addition a trigger may be sample to, sample
-around, or sample from, a so called sampling trigger.<br></td>
-<td style="vertical-align: top;">New samples are added to the
-sample buffer.<br>
-<br>
-Once the sample buffer is full the <span style=
-"font-weight: bold;">oldest</span> samples are discarded.</td>
-</tr>
-<tr>
-<td style="vertical-align: top;">Play<br></td>
-<td style="vertical-align: top;">Recorded GPIO samples are
-displayed.<br>
-<br>
-The play speed may be varied between 64 times real-time to 1/32768
-of real-time.<br>
-<br>
-The page up key increases the play speed by a factor of 2.&nbsp;
-The page down key decreases the play speed by a factor of 2.&nbsp;
-The home key sets the play speed to 1X.<br></td>
-<td style="vertical-align: top;">New samples are added to the
-sample buffer.<br>
-<br>
-Once the sample buffer is full <span style=
-"font-weight: bold;">new</span> samples are discarded.</td>
-</tr>
-<tr>
-<td style="vertical-align: top;">Pause<br></td>
-<td style="vertical-align: top;">Recorded GPIO samples are
-displayed.<br>
-<br>
-The left and right cursor keys move the blue marker to the previous
-or next edge.&nbsp; By default all GPIO edges are considered.&nbsp;
-Clicking on a GPIO name will limit edge searches to the highlighted
-GPIO only.<br>
-<br>
-The left and right square bracket keys move the blue marker to the
-previous or next trigger.<br>
-<br>
-The time between the blue and gold markers is displayed.&nbsp; The
-gold marker is set to the blue marker by a press of the 'g'
-key.<br></td>
-<td style="vertical-align: top;">New samples are added to the
-sample buffer.<br>
-<br>
-Once the sample buffer is full <span style=
-"font-weight: bold;">new</span> samples are discarded.</td>
-</tr>
-</tbody>
-</table>
-<br>
-In all modes the down and up cursor keys zoom the time scale in and
-out.<br>
-<br>
-Samples can be saved with File Save All Samples or File Save
-Selected Samples.
-<p>To select samples enter pause mode. Press 1 to specify the start
-of the samples (green marker) and 2 to specify the end of the
-samples (red marker).</p>
-<p>The samples may be saved in the native piscope format or in VCD
-format.</p>
-<p>Data saved in VCD format may be viewed and further processed
-with GTKWave.</p>
-<p>Data saved in the native piscope format may be restored later
-with File Restore Saved Data.</p>
-<h2>Installation</h2>
-<p>To download and install piscope.</p>
-<h3>Pi (pre-built image)</h3>
-<code>wget abyz.me.uk/rpi/pigpio/piscope.tar<br>
-tar xvf piscope.tar<br>
-cd PISCOPE<br>
-make hf<br>
-make install</code><span style="font-weight: bold;"><br></span>
-<h3>Linux 64 bit X86/AMD (pre-built image)</h3>
-<code>wget abyz.me.uk/rpi/pigpio/piscope.tar<br>
-tar xvf piscope.tar<br>
-cd PISCOPE<br>
-make x86_64<br>
-make install<br></code>
-<h3>All machines (building from source)</h3>
-You only need to perform this step if you want to build the
-executable from the source files.&nbsp; This is not needed if you
-use a pre-built image.<br>
-<span style="font-weight: bold;"><br>
-WARNING</span>: Installing gtk+-3.0 uses a lot of SD card
-space.<br>
-<br>
-Most of the space used by gtk+-3.0 is taken up by unneeded *-dbg
-packages.<br>
-<br>
-With *-dbg packages an additional 3753MB SD space is required.<br>
-<br>
-If you edit the list of packages to be downloaded and remove the
-*-dbg packages only 134MB of additional SD space is needed (as at
-the time of writing).<br>
-<br>
-<code>#<br></code> <code># *** This may take a lot of time and use
-a lot of SD card space ***<br></code> <code>#<br>
-sudo apt-get install gtk+-3.0<br></code> <code>#<br></code>
-<code>wget abyz.me.uk/rpi/pigpio/piscope.tar<br>
-tar xvf piscope.tar<br>
-cd PISCOPE<br>
-make<br>
-make install<br></code><br>
diff --git a/DOC/tmp/body/python.body b/DOC/tmp/body/python.body
deleted file mode 100644
index 4f756e4..0000000
--- a/DOC/tmp/body/python.body
+++ /dev/null
@@ -1,1231 +0,0 @@
-pigpio is a Python module for the Raspberry which talks to
-the pigpio daemon to allow control of the general purpose
-input outputs (GPIO).
-<h3>Features</h3>o the pigpio Python module can run on Windows, Macs, or Linux
-<br><br>o controls one or more Pi's
-<br><br>o hardware timed PWM on any of GPIO 0-31
-<br><br>o hardware timed servo pulses on any of GPIO 0-31
-<br><br>o callbacks when any of GPIO 0-31 change state
-<br><br>o creating and transmitting precisely timed waveforms
-<br><br>o reading/writing GPIO and setting their modes
-<br><br>o wrappers for I2C, SPI, and serial links
-<br><br>o creating and running scripts on the pigpio daemon
-<h3>GPIO</h3>ALL GPIO are identified by their Broadcom number.
-<h3>Notes</h3>Transmitted waveforms are accurate to a microsecond.
-<br><br>Callback level changes are time-stamped and will be
-accurate to within a few microseconds.
-<h3>Settings</h3>A number of settings are determined when the pigpio daemon is started.
-<br><br>o the sample rate (1, 2, 4, 5, 8, or 10 us, default 5 us).
-<br><br>o the set of GPIO which may be updated (generally written to). The
- default set is those available on the Pi board revision.
-<br><br>o the available PWM frequencies (see <a href="#set_PWM_frequency">set_PWM_frequency</a>).
-<h3>Exceptions</h3>By default a fatal exception is raised if you pass an invalid
-argument to a pigpio function.
-<br><br>If you wish to handle the returned status yourself you should set
-pigpio.exceptions to False.
-<br><br>You may prefer to check the returned status in only a few parts
-of your code. In that case do the following:
-<br><br><b><small>Example</small></b><br><br><code>pigpio.exceptions&nbsp;=&nbsp;False<br><br>#&nbsp;Code&nbsp;where&nbsp;you&nbsp;want&nbsp;to&nbsp;test&nbsp;the&nbsp;error&nbsp;status.<br><br>pigpio.exceptions&nbsp;=&nbsp;True<br></code><h3>Usage</h3>This module uses the services of the C pigpio library. pigpio
-must be running on the Pi(s) whose GPIO are to be manipulated.
-<br><br>The normal way to start pigpio is as a daemon (during system
-start).
-<br><br>sudo pigpiod
-<br><br>Your Python program must import pigpio and create one or more
-instances of the pigpio.pi class. This class gives access to
-a specified Pi's GPIO.
-<br><br><b><small>Example</small></b><br><br><code>pi1&nbsp;=&nbsp;pigpio.pi()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;pi1&nbsp;accesses&nbsp;the&nbsp;local&nbsp;Pi's&nbsp;GPIO<br>pi2&nbsp;=&nbsp;pigpio.pi('tom')&nbsp;&nbsp;#&nbsp;pi2&nbsp;accesses&nbsp;tom's&nbsp;GPIO<br>pi3&nbsp;=&nbsp;pigpio.pi('dick')&nbsp;#&nbsp;pi3&nbsp;accesses&nbsp;dick's&nbsp;GPIO<br><br>pi1.write(4,&nbsp;0)&nbsp;#&nbsp;set&nbsp;local&nbsp;Pi's&nbsp;GPIO&nbsp;4&nbsp;low<br>pi2.write(4,&nbsp;1)&nbsp;#&nbsp;set&nbsp;tom's&nbsp;GPIO&nbsp;4&nbsp;to&nbsp;high<br>pi3.read(4)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;get&nbsp;level&nbsp;of&nbsp;dick's&nbsp;GPIO&nbsp;4<br></code><br><br>The later example code snippets assume that pi is an instance of
-the pigpio.pi class.
-<h2>OVERVIEW</h2><table border="0" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td></td></tr><tr><td><b>ESSENTIAL
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#pigpio.pi">pigpio.pi</a></td><td> Initialise Pi connection
-</td></tr><tr><td><a href="#stop">stop</a></td><td> Stop a Pi connection
-</td></tr><tr><td></td><td></td></tr><tr><td><b>BASIC
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_mode">set_mode</a></td><td> Set a GPIO mode
-</td></tr><tr><td><a href="#get_mode">get_mode</a></td><td> Get a GPIO mode
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_pull_up_down">set_pull_up_down</a></td><td> Set/clear GPIO pull up/down resistor
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#read">read</a></td><td> Read a GPIO
-</td></tr><tr><td><a href="#write">write</a></td><td> Write a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>PWM (overrides servo commands on same GPIO)
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_PWM_dutycycle">set_PWM_dutycycle</a></td><td> Start/stop PWM pulses on a GPIO
-</td></tr><tr><td><a href="#set_PWM_frequency">set_PWM_frequency</a></td><td> Set PWM frequency of a GPIO
-</td></tr><tr><td><a href="#set_PWM_range">set_PWM_range</a></td><td> Configure PWM range of a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_PWM_dutycycle">get_PWM_dutycycle</a></td><td> Get PWM dutycycle set on a GPIO
-</td></tr><tr><td><a href="#get_PWM_frequency">get_PWM_frequency</a></td><td> Get PWM frequency of a GPIO
-</td></tr><tr><td><a href="#get_PWM_range">get_PWM_range</a></td><td> Get configured PWM range of a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_PWM_real_range">get_PWM_real_range</a></td><td> Get underlying PWM range for a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Servo (overrides PWM commands on same GPIO)
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_servo_pulsewidth">set_servo_pulsewidth</a></td><td> Start/Stop servo pulses on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_servo_pulsewidth">get_servo_pulsewidth</a></td><td> Get servo pulsewidth set on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>INTERMEDIATE
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#gpio_trigger">gpio_trigger</a></td><td> Send a trigger pulse to a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_watchdog">set_watchdog</a></td><td> Set a watchdog on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#read_bank_1">read_bank_1</a></td><td> Read all bank 1 GPIO
-</td></tr><tr><td><a href="#read_bank_2">read_bank_2</a></td><td> Read all bank 2 GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#clear_bank_1">clear_bank_1</a></td><td> Clear selected GPIO in bank 1
-</td></tr><tr><td><a href="#clear_bank_2">clear_bank_2</a></td><td> Clear selected GPIO in bank 2
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_bank_1">set_bank_1</a></td><td> Set selected GPIO in bank 1
-</td></tr><tr><td><a href="#set_bank_2">set_bank_2</a></td><td> Set selected GPIO in bank 2
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#callback">callback</a></td><td> Create GPIO level change callback
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wait_for_edge">wait_for_edge</a></td><td> Wait for GPIO level change
-</td></tr><tr><td></td><td></td></tr><tr><td><b>ADVANCED
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#notify_open">notify_open</a></td><td> Request a notification handle
-</td></tr><tr><td><a href="#notify_begin">notify_begin</a></td><td> Start notifications for selected GPIO
-</td></tr><tr><td><a href="#notify_pause">notify_pause</a></td><td> Pause notifications
-</td></tr><tr><td><a href="#notify_close">notify_close</a></td><td> Close a notification
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#hardware_clock">hardware_clock</a></td><td> Start hardware clock on supported GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#hardware_PWM">hardware_PWM</a></td><td> Start hardware PWM on supported GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_glitch_filter">set_glitch_filter</a></td><td> Set a glitch filter on a GPIO
-</td></tr><tr><td><a href="#set_noise_filter">set_noise_filter</a></td><td> Set a noise filter on a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#set_pad_strength">set_pad_strength</a></td><td> Sets a pads drive strength
-</td></tr><tr><td><a href="#get_pad_strength">get_pad_strength</a></td><td> Gets a pads drive strength
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#shell">shell</a></td><td> Executes a shell command
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Custom
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#custom_1">custom_1</a></td><td> User custom function 1
-</td></tr><tr><td><a href="#custom_2">custom_2</a></td><td> User custom function 2
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Events
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#event_callback">event_callback</a></td><td> Sets a callback for an event
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#event_trigger">event_trigger</a></td><td> Triggers an event
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wait_for_event">wait_for_event</a></td><td> Wait for an event
-</td></tr><tr><td></td><td></td></tr><tr><td><b>Scripts
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#store_script">store_script</a></td><td> Store a script
-</td></tr><tr><td><a href="#run_script">run_script</a></td><td> Run a stored script
-</td></tr><tr><td><a href="#update_script">update_script</a></td><td> Set a scripts parameters
-</td></tr><tr><td><a href="#script_status">script_status</a></td><td> Get script status and parameters
-</td></tr><tr><td><a href="#stop_script">stop_script</a></td><td> Stop a running script
-</td></tr><tr><td><a href="#delete_script">delete_script</a></td><td> Delete a stored script
-</td></tr><tr><td></td><td></td></tr><tr><td><b>I2C
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_open">i2c_open</a></td><td> Opens an I2C device
-</td></tr><tr><td><a href="#i2c_close">i2c_close</a></td><td> Closes an I2C device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_write_quick">i2c_write_quick</a></td><td> SMBus write quick
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_byte">i2c_read_byte</a></td><td> SMBus read byte
-</td></tr><tr><td><a href="#i2c_write_byte">i2c_write_byte</a></td><td> SMBus write byte
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_byte_data">i2c_read_byte_data</a></td><td> SMBus read byte data
-</td></tr><tr><td><a href="#i2c_write_byte_data">i2c_write_byte_data</a></td><td> SMBus write byte data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_word_data">i2c_read_word_data</a></td><td> SMBus read word data
-</td></tr><tr><td><a href="#i2c_write_word_data">i2c_write_word_data</a></td><td> SMBus write word data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_block_data">i2c_read_block_data</a></td><td> SMBus read block data
-</td></tr><tr><td><a href="#i2c_write_block_data">i2c_write_block_data</a></td><td> SMBus write block data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_i2c_block_data">i2c_read_i2c_block_data</a></td><td> SMBus read I2C block data
-</td></tr><tr><td><a href="#i2c_write_i2c_block_data">i2c_write_i2c_block_data</a></td><td> SMBus write I2C block data
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_read_device">i2c_read_device</a></td><td> Reads the raw I2C device
-</td></tr><tr><td><a href="#i2c_write_device">i2c_write_device</a></td><td> Writes the raw I2C device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_process_call">i2c_process_call</a></td><td> SMBus process call
-</td></tr><tr><td><a href="#i2c_block_process_call">i2c_block_process_call</a></td><td> SMBus block process call
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#i2c_zip">i2c_zip</a></td><td> Performs multiple I2C transactions
-</td></tr><tr><td></td><td></td></tr><tr><td><b>I2C BIT BANG
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_i2c_open">bb_i2c_open</a></td><td> Opens GPIO for bit banging I2C
-</td></tr><tr><td><a href="#bb_i2c_close">bb_i2c_close</a></td><td> Closes GPIO for bit banging I2C
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_i2c_zip">bb_i2c_zip</a></td><td> Performs multiple bit banged I2C transactions
-</td></tr><tr><td></td><td></td></tr><tr><td><b>I2C/SPI SLAVE
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#bsc_xfer">bsc_xfer</a></td><td> I2C/SPI as slave transfer
-</td></tr><tr><td><a href="#bsc_i2c">bsc_i2c</a></td><td> I2C as slave transfer
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SERIAL
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#serial_open">serial_open</a></td><td> Opens a serial device
-</td></tr><tr><td><a href="#serial_close">serial_close</a></td><td> Closes a serial device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#serial_read_byte">serial_read_byte</a></td><td> Reads a byte from a serial device
-</td></tr><tr><td><a href="#serial_write_byte">serial_write_byte</a></td><td> Writes a byte to a serial device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#serial_read">serial_read</a></td><td> Reads bytes from a serial device
-</td></tr><tr><td><a href="#serial_write">serial_write</a></td><td> Writes bytes to a serial device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#serial_data_available">serial_data_available</a></td><td> Returns number of bytes ready to be read
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SERIAL BIT BANG (read only)
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_serial_read_open">bb_serial_read_open</a></td><td> Open a GPIO for bit bang serial reads
-</td></tr><tr><td><a href="#bb_serial_read_close">bb_serial_read_close</a></td><td> Close a GPIO for bit bang serial reads
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_serial_invert">bb_serial_invert</a></td><td> Invert serial logic (1 invert, 0 normal)
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_serial_read">bb_serial_read</a></td><td> Read bit bang serial data from a GPIO
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SPI
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#spi_open">spi_open</a></td><td> Opens a SPI device
-</td></tr><tr><td><a href="#spi_close">spi_close</a></td><td> Closes a SPI device
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#spi_read">spi_read</a></td><td> Reads bytes from a SPI device
-</td></tr><tr><td><a href="#spi_write">spi_write</a></td><td> Writes bytes to a SPI device
-</td></tr><tr><td><a href="#spi_xfer">spi_xfer</a></td><td> Transfers bytes with a SPI device
-</td></tr><tr><td></td><td></td></tr><tr><td><b>SPI BIT BANG
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#bb_spi_open">bb_spi_open</a></td><td> Opens GPIO for bit banging SPI
-</td></tr><tr><td><a href="#bb_spi_close">bb_spi_close</a></td><td> Closes GPIO for bit banging SPI
-</td></tr><tr><td><a href="#bb_spi_xfer">bb_spi_xfer</a></td><td> Transfers bytes with bit banging SPI
-</td></tr><tr><td></td><td></td></tr><tr><td><b>FILES
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#file_open">file_open</a></td><td> Opens a file
-</td></tr><tr><td><a href="#file_close">file_close</a></td><td> Closes a file
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#file_read">file_read</a></td><td> Reads bytes from a file
-</td></tr><tr><td><a href="#file_write">file_write</a></td><td> Writes bytes to a file
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#file_seek">file_seek</a></td><td> Seeks to a position within a file
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#file_list">file_list</a></td><td> List files which match a pattern
-</td></tr><tr><td></td><td></td></tr><tr><td><b>WAVES
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_clear">wave_clear</a></td><td> Deletes all waveforms
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_add_new">wave_add_new</a></td><td> Starts a new waveform
-</td></tr><tr><td><a href="#wave_add_generic">wave_add_generic</a></td><td> Adds a series of pulses to the waveform
-</td></tr><tr><td><a href="#wave_add_serial">wave_add_serial</a></td><td> Adds serial data to the waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_create">wave_create</a></td><td> Creates a waveform from added data
-</td></tr><tr><td><a href="#wave_create_and_pad">wave_create_and_pad</a></td><td> Creates a waveform of fixed size from added data
-</td></tr><tr><td><a href="#wave_delete">wave_delete</a></td><td> Deletes a waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_send_once">wave_send_once</a></td><td> Transmits a waveform once
-</td></tr><tr><td><a href="#wave_send_repeat">wave_send_repeat</a></td><td> Transmits a waveform repeatedly
-</td></tr><tr><td><a href="#wave_send_using_mode">wave_send_using_mode</a></td><td> Transmits a waveform in the chosen mode
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_chain">wave_chain</a></td><td> Transmits a chain of waveforms
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_tx_at">wave_tx_at</a></td><td> Returns the current transmitting waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_tx_busy">wave_tx_busy</a></td><td> Checks to see if a waveform has ended
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_tx_stop">wave_tx_stop</a></td><td> Aborts the current waveform
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_get_cbs">wave_get_cbs</a></td><td> Length in cbs of the current waveform
-</td></tr><tr><td><a href="#wave_get_max_cbs">wave_get_max_cbs</a></td><td> Absolute maximum allowed cbs
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_get_micros">wave_get_micros</a></td><td> Length in microseconds of the current waveform
-</td></tr><tr><td><a href="#wave_get_max_micros">wave_get_max_micros</a></td><td> Absolute maximum allowed micros
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#wave_get_pulses">wave_get_pulses</a></td><td> Length in pulses of the current waveform
-</td></tr><tr><td><a href="#wave_get_max_pulses">wave_get_max_pulses</a></td><td> Absolute maximum allowed pulses
-</td></tr><tr><td></td><td></td></tr><tr><td><b>UTILITIES
-</b></td><td></td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_current_tick">get_current_tick</a></td><td> Get current tick (microseconds)
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#get_hardware_revision">get_hardware_revision</a></td><td> Get hardware revision
-</td></tr><tr><td><a href="#get_pigpio_version">get_pigpio_version</a></td><td> Get the pigpio version
-</td></tr><tr><td></td><td></td></tr><tr><td><a href="#pigpio.error_text">pigpio.error_text</a></td><td> Gets error text from error number
-</td></tr><tr><td><a href="#pigpio.tickDiff">pigpio.tickDiff</a></td><td> Returns difference between two ticks
-</td></tr><tr><td><b></b></td><td></td></tr></tbody></table><h2> class pi
-</h2><h3><a name="pigpio.pi">pigpio.pi<small>(<a href="#host">host</a>, <a href="#port">port</a>, <a href="#show_errors">show_errors</a>)</small></h3>
-Grants access to a Pi's GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>host:=&nbsp;the&nbsp;host&nbsp;name&nbsp;of&nbsp;the&nbsp;Pi&nbsp;on&nbsp;which&nbsp;the&nbsp;pigpio&nbsp;daemon&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;running.&nbsp;&nbsp;The&nbsp;default&nbsp;is&nbsp;localhost&nbsp;unless&nbsp;overridden&nbsp;by<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;PIGPIO_ADDR&nbsp;environment&nbsp;variable.<br></samp><br><br><b><small>Parameters</small></b><br><br><samp>port:=&nbsp;the&nbsp;port&nbsp;number&nbsp;on&nbsp;which&nbsp;the&nbsp;pigpio&nbsp;daemon&nbsp;is&nbsp;listening.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;default&nbsp;is&nbsp;8888&nbsp;unless&nbsp;overridden&nbsp;by&nbsp;the&nbsp;PIGPIO_PORT<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;environment&nbsp;variable.&nbsp;&nbsp;The&nbsp;pigpio&nbsp;daemon&nbsp;must&nbsp;have&nbsp;been<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;started&nbsp;with&nbsp;the&nbsp;same&nbsp;port&nbsp;number.<br></samp><br><br>This connects to the pigpio daemon and reserves resources
-to be used for sending commands and receiving notifications.
-<br><br>An instance attribute <a href="#connected">connected</a> may be used to check the
-success of the connection. If the connection is established
-successfully <a href="#connected">connected</a> will be True, otherwise False.
-<br><br><b><small>Example</small></b><br><br><code>pi&nbsp;=&nbsp;pigio.pi()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;use&nbsp;defaults<br>pi&nbsp;=&nbsp;pigpio.pi('mypi')&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;specify&nbsp;host,&nbsp;default&nbsp;port<br>pi&nbsp;=&nbsp;pigpio.pi('mypi',&nbsp;7777)&nbsp;#&nbsp;specify&nbsp;host&nbsp;and&nbsp;port<br><br>pi&nbsp;=&nbsp;pigpio.pi()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;exit&nbsp;script&nbsp;if&nbsp;no&nbsp;connection<br>if&nbsp;not&nbsp;pi.connected:<br>&nbsp;&nbsp;&nbsp;exit()<br></code><h3><a name="__repr__">__repr__<small>()</small></h3>
-<h3><a name="bb_i2c_close">bb_i2c_close<small>(<a href="#SDA">SDA</a>)</small></h3>
-This function stops bit banging I2C on a pair of GPIO
-previously opened with <a href="#bb_i2c_open">bb_i2c_open</a>.
-<br><br><b><small>Parameters</small></b><br><br><samp>SDA:=&nbsp;0-31,&nbsp;the&nbsp;SDA&nbsp;GPIO&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_i2c_open">bb_i2c_open</a><br></samp><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_I2C_GPIO.
-<br><br><b><small>Example</small></b><br><br><code>pi.bb_i2c_close(SDA)<br></code><h3><a name="bb_i2c_open">bb_i2c_open<small>(<a href="#SDA">SDA</a>, <a href="#SCL">SCL</a>, <a href="#baud">baud</a>)</small></h3>
-This function selects a pair of GPIO for bit banging I2C at a
-specified baud rate.
-<br><br>Bit banging I2C allows for certain operations which are not possible
-with the standard I2C driver.
-<br><br>o baud rates as low as 50
-o repeated starts
-o clock stretching
-o I2C on any pair of spare GPIO
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;SDA:=&nbsp;0-31<br>&nbsp;SCL:=&nbsp;0-31<br>baud:=&nbsp;50-500000<br></samp><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_I2C_BAUD, or
-PI_GPIO_IN_USE.
-<br><br>NOTE:
-<br><br>The GPIO used for SDA and SCL must have pull-ups to 3V3 connected.
-As a guide the hardware pull-ups on pins 3 and 5 are 1k8 in value.
-<br><br><b><small>Example</small></b><br><br><code>h&nbsp;=&nbsp;pi.bb_i2c_open(4,&nbsp;5,&nbsp;50000)&nbsp;#&nbsp;bit&nbsp;bang&nbsp;on&nbsp;GPIO&nbsp;4/5&nbsp;at&nbsp;50kbps<br></code><h3><a name="bb_i2c_zip">bb_i2c_zip<small>(<a href="#SDA">SDA</a>, <a href="#data">data</a>)</small></h3>
-This function executes a sequence of bit banged I2C operations.
-The operations to be performed are specified by the contents
-of data which contains the concatenated command codes and
-associated data.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;SDA:=&nbsp;0-31&nbsp;(as&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_i2c_open">bb_i2c_open</a>)<br>data:=&nbsp;the&nbsp;concatenated&nbsp;I2C&nbsp;commands,&nbsp;see&nbsp;below<br></samp><br><br>The returned value is a tuple of the number of bytes read and a
-bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br><b><small>Example</small></b><br><br><code>(count,&nbsp;data)&nbsp;=&nbsp;pi.bb_i2c_zip(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SDA,&nbsp;[4,&nbsp;0x53,&nbsp;2,&nbsp;7,&nbsp;1,&nbsp;0x32,&nbsp;2,&nbsp;6,&nbsp;6,&nbsp;3,&nbsp;0])<br></code><br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>End</td><td>0</td><td>No more commands</td></tr><tr><td>Escape</td><td>1</td><td>Next P is two bytes</td></tr><tr><td>Start</td><td>2</td><td>Start condition</td></tr><tr><td>Stop</td><td>3</td><td>Stop condition</td></tr><tr><td>Address</td><td>4 P</td><td>Set I2C address to P</td></tr><tr><td>Flags</td><td>5 lsb msb</td><td>Set I2C flags to lsb + (msb &lt;&lt; 8)</td></tr><tr><td>Read</td><td>6 P</td><td>Read P bytes of data</td></tr><tr><td>Write</td><td>7 P ...</td><td>Write P bytes of data</td></tr></tbody></table><br><br>The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-<br><br>The address and flags default to 0. The address and flags maintain
-their previous value until updated.
-<br><br>No flags are currently defined.
-<br><br>Any read I2C data is concatenated in the returned bytearray.
-<br><br><b><small>Example</small></b><br><br><code>Set&nbsp;address&nbsp;0x53<br>start,&nbsp;write&nbsp;0x32,&nbsp;(re)start,&nbsp;read&nbsp;6&nbsp;bytes,&nbsp;stop<br>Set&nbsp;address&nbsp;0x1E<br>start,&nbsp;write&nbsp;0x03,&nbsp;(re)start,&nbsp;read&nbsp;6&nbsp;bytes,&nbsp;stop<br>Set&nbsp;address&nbsp;0x68<br>start,&nbsp;write&nbsp;0x1B,&nbsp;(re)start,&nbsp;read&nbsp;8&nbsp;bytes,&nbsp;stop<br>End<br><br>0x04&nbsp;0x53<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x32&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x06&nbsp;0x03<br><br>0x04&nbsp;0x1E<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x03&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x06&nbsp;0x03<br><br>0x04&nbsp;0x68<br>0x02&nbsp;0x07&nbsp;0x01&nbsp;0x1B&nbsp;&nbsp;&nbsp;0x02&nbsp;0x06&nbsp;0x08&nbsp;0x03<br><br>0x00<br></code><h3><a name="bb_serial_invert">bb_serial_invert<small>(<a href="#user_gpio">user_gpio</a>, <a href="#invert">invert</a>)</small></h3>
-Invert serial logic.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31&nbsp;(opened&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_serial_read_open">bb_serial_read_open</a>)<br>&nbsp;&nbsp;&nbsp;&nbsp;invert:=&nbsp;0-1&nbsp;(1&nbsp;invert,&nbsp;0&nbsp;normal)<br></samp><br><br><b><small>Example</small></b><br><br><code>status&nbsp;=&nbsp;pi.bb_serial_invert(17,&nbsp;1)<br></code><h3><a name="bb_serial_read">bb_serial_read<small>(<a href="#user_gpio">user_gpio</a>)</small></h3>
-Returns data from the bit bang serial cyclic buffer.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31&nbsp;(opened&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_serial_read_open">bb_serial_read_open</a>)<br></samp><br><br>The returned value is a tuple of the number of bytes read and a
-bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br>The bytes returned for each character depend upon the number of
-data bits <a href="#bb_bits">bb_bits</a> specified in the <a href="#bb_serial_read_open">bb_serial_read_open</a>
-command.
-<br><br>For <a href="#bb_bits">bb_bits</a> 1-8 there will be one byte per character.
-For <a href="#bb_bits">bb_bits</a> 9-16 there will be two bytes per character.
-For <a href="#bb_bits">bb_bits</a> 17-32 there will be four bytes per character.
-<br><br><b><small>Example</small></b><br><br><code>(count,&nbsp;data)&nbsp;=&nbsp;pi.bb_serial_read(4)<br></code><h3><a name="bb_serial_read_close">bb_serial_read_close<small>(<a href="#user_gpio">user_gpio</a>)</small></h3>
-Closes a GPIO for bit bang reading of serial data.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31&nbsp;(opened&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_serial_read_open">bb_serial_read_open</a>)<br></samp><br><br><b><small>Example</small></b><br><br><code>status&nbsp;=&nbsp;pi.bb_serial_read_close(17)<br></code><h3><a name="bb_serial_read_open">bb_serial_read_open<small>(<a href="#user_gpio">user_gpio</a>, <a href="#baud">baud</a>, <a href="#bb_bits">bb_bits</a>)</small></h3>
-Opens a GPIO for bit bang reading of serial data.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31,&nbsp;the&nbsp;GPIO&nbsp;to&nbsp;use.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:=&nbsp;50-250000,&nbsp;the&nbsp;baud&nbsp;rate.<br>&nbsp;&nbsp;bb_bits:=&nbsp;1-32,&nbsp;the&nbsp;number&nbsp;of&nbsp;bits&nbsp;per&nbsp;word,&nbsp;default&nbsp;8.<br></samp><br><br>The serial data is held in a cyclic buffer and is read using
-<a href="#bb_serial_read">bb_serial_read</a>.
-<br><br>It is the caller's responsibility to read data from the cyclic
-buffer in a timely fashion.
-<br><br><b><small>Example</small></b><br><br><code>status&nbsp;=&nbsp;pi.bb_serial_read_open(4,&nbsp;19200)<br>status&nbsp;=&nbsp;pi.bb_serial_read_open(17,&nbsp;9600)<br></code><h3><a name="bb_spi_close">bb_spi_close<small>(<a href="#CS">CS</a>)</small></h3>
-This function stops bit banging SPI on a set of GPIO
-opened with <a href="#bb_spi_open">bb_spi_open</a>.
-<br><br><b><small>Parameters</small></b><br><br><samp>CS:=&nbsp;0-31,&nbsp;the&nbsp;CS&nbsp;GPIO&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_spi_open">bb_spi_open</a><br></samp><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_SPI_GPIO.
-<br><br><b><small>Example</small></b><br><br><code>pi.bb_spi_close(CS)<br></code><h3><a name="bb_spi_open">bb_spi_open<small>(<a href="#CS">CS</a>, <a href="#MISO">MISO</a>, <a href="#MOSI">MOSI</a>, <a href="#SCLK">SCLK</a>, <a href="#baud">baud</a>, <a href="#spi_flags">spi_flags</a>)</small></h3>
-This function selects a set of GPIO for bit banging SPI at a
-specified baud rate.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CS&nbsp;:=&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;MISO&nbsp;:=&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;MOSI&nbsp;:=&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;SCLK&nbsp;:=&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;&nbsp;baud&nbsp;:=&nbsp;50-250000<br>spiFlags&nbsp;:=&nbsp;see&nbsp;below<br></samp><br><br>spiFlags consists of the least significant 22 bits.
-<br><br><code>21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;0&nbsp;&nbsp;p&nbsp;&nbsp;m&nbsp;&nbsp;m<br></code><br><br>mm defines the SPI mode, defaults to 0
-<br><br><code>Mode&nbsp;CPOL&nbsp;CPHA<br>&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0<br>&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;1<br>&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;0<br>&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;1<br></code><br><br>The following constants may be used to set the mode:
-<br><br><code>pigpio.SPI_MODE_0<br>pigpio.SPI_MODE_1<br>pigpio.SPI_MODE_2<br>pigpio.SPI_MODE_3<br></code><br><br>Alternatively pigpio.SPI_CPOL and/or pigpio.SPI_CPHA
-may be used.
-<br><br>p is 0 if CS is active low (default) and 1 for active high.
-pigpio.SPI_CS_HIGH_ACTIVE may be used to set this flag.
-<br><br>T is 1 if the least significant bit is transmitted on MOSI first,
-the default (0) shifts the most significant bit out first.
-pigpio.SPI_TX_LSBFIRST may be used to set this flag.
-<br><br>R is 1 if the least significant bit is received on MISO first,
-the default (0) receives the most significant bit first.
-pigpio.SPI_RX_LSBFIRST may be used to set this flag.
-<br><br>The other bits in spiFlags should be set to zero.
-<br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_SPI_BAUD, or
-PI_GPIO_IN_USE.
-<br><br>If more than one device is connected to the SPI bus (defined by
-SCLK, MOSI, and MISO) each must have its own CS.
-<br><br><b><small>Example</small></b><br><br><code>bb_spi_open(10,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;10000,&nbsp;0);&nbsp;//&nbsp;device&nbsp;1<br>bb_spi_open(11,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;20000,&nbsp;3);&nbsp;//&nbsp;device&nbsp;2<br></code><h3><a name="bb_spi_xfer">bb_spi_xfer<small>(<a href="#CS">CS</a>, <a href="#data">data</a>)</small></h3>
-This function executes a bit banged SPI transfer.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;CS:=&nbsp;0-31&nbsp;(as&nbsp;used&nbsp;in&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#bb_spi_open">bb_spi_open</a>)<br>data:=&nbsp;data&nbsp;to&nbsp;be&nbsp;sent<br></samp><br><br>The returned value is a tuple of the number of bytes read and a
-bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br><b><small>Example</small></b><br><br><code>#!/usr/bin/env&nbsp;python<br><br>import&nbsp;pigpio<br><br>CE0=5<br>CE1=6<br>MISO=13<br>MOSI=19<br>SCLK=12<br><br>pi&nbsp;=&nbsp;pigpio.pi()<br>if&nbsp;not&nbsp;pi.connected:<br>&nbsp;&nbsp;&nbsp;exit()<br><br>pi.bb_spi_open(CE0,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;10000,&nbsp;0)&nbsp;#&nbsp;MCP4251&nbsp;DAC<br>pi.bb_spi_open(CE1,&nbsp;MISO,&nbsp;MOSI,&nbsp;SCLK,&nbsp;20000,&nbsp;3)&nbsp;#&nbsp;MCP3008&nbsp;ADC<br><br>for&nbsp;i&nbsp;in&nbsp;range(256):<br><br>&nbsp;&nbsp;&nbsp;count,&nbsp;data&nbsp;=&nbsp;pi.bb_spi_xfer(CE0,&nbsp;[0,&nbsp;i])&nbsp;#&nbsp;Set&nbsp;DAC&nbsp;value<br><br>&nbsp;&nbsp;&nbsp;if&nbsp;count&nbsp;==&nbsp;2:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count,&nbsp;data&nbsp;=&nbsp;pi.bb_spi_xfer(CE0,&nbsp;[12,&nbsp;0])&nbsp;#&nbsp;Read&nbsp;back&nbsp;DAC<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;count&nbsp;==&nbsp;2:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set_val&nbsp;=&nbsp;data[1]<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count,&nbsp;data&nbsp;=&nbsp;pi.bb_spi_xfer(CE1,&nbsp;[1,&nbsp;128,&nbsp;0])&nbsp;#&nbsp;Read&nbsp;ADC<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;count&nbsp;==&nbsp;3:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;read_val&nbsp;=&nbsp;((data[1]&3)&lt;&lt;8)&nbsp;|&nbsp;data[2]<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print("{}&nbsp;{}".format(set_val,&nbsp;read_val))<br><br>pi.bb_spi_close(CE0)<br>pi.bb_spi_close(CE1)<br><br>pi.stop()<br></code><h3><a name="bsc_i2c">bsc_i2c<small>(<a href="#i2c_address">i2c_address</a>, <a href="#data">data</a>)</small></h3>
-This function allows the Pi to act as a slave I2C device.
-<br><br>This function is not available on the BCM2711 (e.g. as
-used in the Pi4B).
-<br><br>The data bytes (if any) are written to the BSC transmit
-FIFO and the bytes in the BSC receive FIFO are returned.
-<br><br><b><small>Parameters</small></b><br><br><samp>i2c_address:=&nbsp;the&nbsp;I2C&nbsp;slave&nbsp;address.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data:=&nbsp;the&nbsp;data&nbsp;bytes&nbsp;to&nbsp;transmit.<br></samp><br><br>The returned value is a tuple of the status, the number
-of bytes read, and a bytearray containing the read bytes.
-<br><br>See <a href="#bsc_xfer">bsc_xfer</a> for details of the status value.
-<br><br>If there was an error the status will be less than zero
-(and will contain the error code).
-<br><br>Note that an i2c_address of 0 may be used to close
-the BSC device and reassign the used GPIO as inputs.
-<br><br>This example assumes GPIO 2/3 are connected to GPIO 18/19
-(GPIO 10/11 on the BCM2711).
-<br><br><b><small>Example</small></b><br><br><code>#!/usr/bin/env&nbsp;python<br>import&nbsp;time<br>import&nbsp;pigpio<br><br>I2C_ADDR=0x13<br><br>def&nbsp;i2c(id,&nbsp;tick):<br>&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;pi<br><br>&nbsp;&nbsp;&nbsp;&nbsp;s,&nbsp;b,&nbsp;d&nbsp;=&nbsp;pi.bsc_i2c(I2C_ADDR)<br>&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;b:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;d[0]&nbsp;==&nbsp;ord('t'):&nbsp;#&nbsp;116&nbsp;send&nbsp;'HH:MM:SS*'<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print("sent={}&nbsp;FR={}&nbsp;received={}&nbsp;[{}]".<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;format(s&gt;&gt;16,&nbsp;s&0xfff,b,d))<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s,&nbsp;b,&nbsp;d&nbsp;=&nbsp;pi.bsc_i2c(I2C_ADDR,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"{}*".format(time.asctime()[11:19]))<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elif&nbsp;d[0]&nbsp;==&nbsp;ord('d'):&nbsp;#&nbsp;100&nbsp;send&nbsp;'Sun&nbsp;Oct&nbsp;30*'<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print("sent={}&nbsp;FR={}&nbsp;received={}&nbsp;[{}]".<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;format(s&gt;&gt;16,&nbsp;s&0xfff,b,d))<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s,&nbsp;b,&nbsp;d&nbsp;=&nbsp;pi.bsc_i2c(I2C_ADDR,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"{}*".format(time.asctime()[:10]))<br><br>pi&nbsp;=&nbsp;pigpio.pi()<br><br>if&nbsp;not&nbsp;pi.connected:<br>&nbsp;&nbsp;&nbsp;&nbsp;exit()<br><br>#&nbsp;Respond&nbsp;to&nbsp;BSC&nbsp;slave&nbsp;activity<br><br>e&nbsp;=&nbsp;pi.event_callback(pigpio.EVENT_BSC,&nbsp;i2c)<br><br>pi.bsc_i2c(I2C_ADDR)&nbsp;#&nbsp;Configure&nbsp;BSC&nbsp;as&nbsp;I2C&nbsp;slave<br><br>time.sleep(600)<br><br>e.cancel()<br><br>pi.bsc_i2c(0)&nbsp;#&nbsp;Disable&nbsp;BSC&nbsp;peripheral<br><br>pi.stop()<br></code><br><br>While running the above.
-<br><br><code>$&nbsp;i2cdetect&nbsp;-y&nbsp;1<br>&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;1&nbsp;&nbsp;2&nbsp;&nbsp;3&nbsp;&nbsp;4&nbsp;&nbsp;5&nbsp;&nbsp;6&nbsp;&nbsp;7&nbsp;&nbsp;8&nbsp;&nbsp;9&nbsp;&nbsp;a&nbsp;&nbsp;b&nbsp;&nbsp;c&nbsp;&nbsp;d&nbsp;&nbsp;e&nbsp;&nbsp;f<br>00:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>10:&nbsp;--&nbsp;--&nbsp;--&nbsp;13&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>20:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>30:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>40:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>50:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>60:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br>70:&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--&nbsp;--<br><br>$&nbsp;pigs&nbsp;i2co&nbsp;1&nbsp;0x13&nbsp;0<br>0<br><br>$&nbsp;pigs&nbsp;i2cwd&nbsp;0&nbsp;116<br>$&nbsp;pigs&nbsp;i2crd&nbsp;0&nbsp;9&nbsp;-a<br>9&nbsp;10:13:58*<br><br>$&nbsp;pigs&nbsp;i2cwd&nbsp;0&nbsp;116<br>$&nbsp;pigs&nbsp;i2crd&nbsp;0&nbsp;9&nbsp;-a<br>9&nbsp;10:14:29*<br><br>$&nbsp;pigs&nbsp;i2cwd&nbsp;0&nbsp;100<br>$&nbsp;pigs&nbsp;i2crd&nbsp;0&nbsp;11&nbsp;-a<br>11&nbsp;Sun&nbsp;Oct&nbsp;30*<br><br>$&nbsp;pigs&nbsp;i2cwd&nbsp;0&nbsp;100<br>$&nbsp;pigs&nbsp;i2crd&nbsp;0&nbsp;11&nbsp;-a<br>11&nbsp;Sun&nbsp;Oct&nbsp;30*<br><br>$&nbsp;pigs&nbsp;i2cwd&nbsp;0&nbsp;116<br>$&nbsp;pigs&nbsp;i2crd&nbsp;0&nbsp;9&nbsp;-a<br>9&nbsp;10:23:16*<br><br>$&nbsp;pigs&nbsp;i2cwd&nbsp;0&nbsp;100<br>$&nbsp;pigs&nbsp;i2crd&nbsp;0&nbsp;11&nbsp;-a<br>11&nbsp;Sun&nbsp;Oct&nbsp;30*<br></code><h3><a name="bsc_xfer">bsc_xfer<small>(<a href="#bsc_control">bsc_control</a>, <a href="#data">data</a>)</small></h3>
-This function provides a low-level interface to the SPI/I2C Slave
-peripheral on the BCM chip.
-<br><br>This peripheral allows the Pi to act as a hardware slave device
-on an I2C or SPI bus.
-<br><br>This is not a bit bang version and as such is OS timing
-independent. The bus timing is handled directly by the chip.
-<br><br>The output process is simple. You simply append data to the FIFO
-buffer on the chip. This works like a queue, you add data to the
-queue and the master removes it.
-<br><br>I can't get SPI to work properly. I tried with a
-control word of 0x303 and swapped MISO and MOSI.
-<br><br>The function sets the BSC mode, writes any data in
-the transmit buffer to the BSC transmit FIFO, and
-copies any data in the BSC receive FIFO to the
-receive buffer.
-<br><br><b><small>Parameters</small></b><br><br><samp>bsc_control:=&nbsp;see&nbsp;below<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data:=&nbsp;the&nbsp;data&nbsp;bytes&nbsp;to&nbsp;place&nbsp;in&nbsp;the&nbsp;transmit&nbsp;FIFO.<br></samp><br><br>The returned value is a tuple of the status (see below),
-the number of bytes read, and a bytearray containing the
-read bytes. If there was an error the status will be less
-than zero (and will contain the error code).
-<br><br>Note that the control word sets the BSC mode. The BSC will
-stay in that mode until a different control word is sent.
-<br><br>GPIO used for models other than those based on the BCM2711.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td><td>MOSI</td><td>SCLK</td><td>MISO</td><td>CE</td></tr><tr><td>I2C</td><td>18</td><td>19</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>SPI</td><td>-</td><td>-</td><td>18</td><td>19</td><td>20</td><td>21</td></tr></tbody></table><br><br>GPIO used for models based on the BCM2711 (e.g. the Pi4B).
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td><td>MOSI</td><td>SCLK</td><td>MISO</td><td>CE</td></tr><tr><td>I2C</td><td>10</td><td>11</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>SPI</td><td>-</td><td>-</td><td>10</td><td>11</td><td>9</td><td>8</td></tr></tbody></table><br><br>When a zero control word is received the used GPIO will be reset
-to INPUT mode.
-<br><br>bsc_control consists of the following bits:
-<br><br><code>22&nbsp;21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;IT&nbsp;HC&nbsp;TF&nbsp;IR&nbsp;RE&nbsp;TE&nbsp;BK&nbsp;EC&nbsp;ES&nbsp;PL&nbsp;PH&nbsp;I2&nbsp;SP&nbsp;EN<br></code><br><br>Bits 0-13 are copied unchanged to the BSC CR register. See
-pages 163-165 of the Broadcom peripherals document for full
-details.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>aaaaaaa</td><td>defines the I2C slave address (only relevant in I2C mode)</td></tr><tr><td>IT</td><td>invert transmit status flags</td></tr><tr><td>HC</td><td>enable host control</td></tr><tr><td>TF</td><td>enable test FIFO</td></tr><tr><td>IR</td><td>invert receive status flags</td></tr><tr><td>RE</td><td>enable receive</td></tr><tr><td>TE</td><td>enable transmit</td></tr><tr><td>BK</td><td>abort operation and clear FIFOs</td></tr><tr><td>EC</td><td>send control register as first I2C byte</td></tr><tr><td>ES</td><td>send status register as first I2C byte</td></tr><tr><td>PL</td><td>set SPI polarity high</td></tr><tr><td>PH</td><td>set SPI phase high</td></tr><tr><td>I2</td><td>enable I2C mode</td></tr><tr><td>SP</td><td>enable SPI mode</td></tr><tr><td>EN</td><td>enable BSC peripheral</td></tr></tbody></table><br><br>The status has the following format:
-<br><br><code>20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;S&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;&nbsp;T&nbsp;RB&nbsp;TE&nbsp;RF&nbsp;TF&nbsp;RE&nbsp;TB<br></code><br><br>Bits 0-15 are copied unchanged from the BSC FR register. See
-pages 165-166 of the Broadcom peripherals document for full
-details.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>SSSSS</td><td>number of bytes successfully copied to transmit FIFO</td></tr><tr><td>RRRRR</td><td>number of bytes in receieve FIFO</td></tr><tr><td>TTTTT</td><td>number of bytes in transmit FIFO</td></tr><tr><td>RB</td><td>receive busy</td></tr><tr><td>TE</td><td>transmit FIFO empty</td></tr><tr><td>RF</td><td>receive FIFO full</td></tr><tr><td>TF</td><td>transmit FIFO full</td></tr><tr><td>RE</td><td>receive FIFO empty</td></tr><tr><td>TB</td><td>transmit busy</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>(status,&nbsp;count,&nbsp;data)&nbsp;=&nbsp;pi.bsc_xfer(0x330305,&nbsp;"Hello!")<br></code><h3><a name="callback">callback<small>(<a href="#user_gpio">user_gpio</a>, <a href="#edge">edge</a>, <a href="#func">func</a>)</small></h3>
-Calls a user supplied function (a callback) whenever the
-specified GPIO edge is detected.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edge:=&nbsp;EITHER_EDGE,&nbsp;RISING_EDGE&nbsp;(default),&nbsp;or&nbsp;FALLING_EDGE.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;func:=&nbsp;user&nbsp;supplied&nbsp;callback&nbsp;function.<br></samp><br><br>The user supplied callback receives three parameters, the GPIO,
-the level, and the tick.
-<br><br><code>Parameter&nbsp;&nbsp;&nbsp;Value&nbsp;&nbsp;&nbsp;&nbsp;Meaning<br><br>GPIO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-31&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;GPIO&nbsp;which&nbsp;has&nbsp;changed&nbsp;state<br><br>level&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0-2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;=&nbsp;change&nbsp;to&nbsp;low&nbsp;(a&nbsp;falling&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;=&nbsp;change&nbsp;to&nbsp;high&nbsp;(a&nbsp;rising&nbsp;edge)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;=&nbsp;no&nbsp;level&nbsp;change&nbsp;(a&nbsp;watchdog&nbsp;timeout)<br><br>tick&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;32&nbsp;bit&nbsp;&nbsp;&nbsp;The&nbsp;number&nbsp;of&nbsp;microseconds&nbsp;since&nbsp;boot<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WARNING:&nbsp;this&nbsp;wraps&nbsp;around&nbsp;from<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4294967295&nbsp;to&nbsp;0&nbsp;roughly&nbsp;every&nbsp;72&nbsp;minutes<br></code><br><br>If a user callback is not specified a default tally callback is
-provided which simply counts edges. The count may be retrieved
-by calling the tally function. The count may be reset to zero
-by calling the reset_tally function.
-<br><br>The callback may be cancelled by calling the cancel function.
-<br><br>A GPIO may have multiple callbacks (although I can't think of
-a reason to do so).
-<br><br>The GPIO are sampled at a rate set when the pigpio daemon
-is started (default 5 us).
-<br><br>The number of samples per second is given in the following table.
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;samples<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;per&nbsp;sec<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;1,000,000<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;500,000<br>sample&nbsp;&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;250,000<br>rate&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;200,000<br>(us)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8&nbsp;&nbsp;&nbsp;&nbsp;125,000<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;100,000<br></code><br><br>GPIO level changes shorter than the sample rate may be missed.
-<br><br>The daemon software which generates the callbacks is triggered
-1000 times per second. The callbacks will be called once per
-level change since the last time they were called.
-i.e. The callbacks will get all level changes but there will
-be a latency.
-<br><br>If you want to track the level of more than one GPIO do so by
-maintaining the state in the callback. Do not use <a href="#read">read</a>.
-Remember the event that triggered the callback may have
-happened several milliseconds before and the GPIO may have
-changed level many times since then.
-<br><br><b><small>Example</small></b><br><br><code>def&nbsp;cbf(gpio,&nbsp;level,&nbsp;tick):<br>&nbsp;&nbsp;&nbsp;print(gpio,&nbsp;level,&nbsp;tick)<br><br>cb1&nbsp;=&nbsp;pi.callback(22,&nbsp;pigpio.EITHER_EDGE,&nbsp;cbf)<br><br>cb2&nbsp;=&nbsp;pi.callback(4,&nbsp;pigpio.EITHER_EDGE)<br><br>cb3&nbsp;=&nbsp;pi.callback(17)<br><br>print(cb3.tally())<br><br>cb3.reset_tally()<br><br>cb1.cancel()&nbsp;#&nbsp;To&nbsp;cancel&nbsp;callback&nbsp;cb1.<br></code><h3><a name="clear_bank_1">clear_bank_1<small>(<a href="#bits">bits</a>)</small></h3>
-Clears GPIO 0-31 if the corresponding bit in bits is set.
-<br><br><b><small>Parameters</small></b><br><br><samp>bits:=&nbsp;a&nbsp;32&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;cleared.<br></samp><br><br>A returned status of PI_SOME_PERMITTED indicates that the user
-is not allowed to write to one or more of the GPIO.
-<br><br><b><small>Example</small></b><br><br><code>pi.clear_bank_1(int("111110010000",2))<br></code><h3><a name="clear_bank_2">clear_bank_2<small>(<a href="#bits">bits</a>)</small></h3>
-Clears GPIO 32-53 if the corresponding bit (0-21) in bits is set.
-<br><br><b><small>Parameters</small></b><br><br><samp>bits:=&nbsp;a&nbsp;32&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;cleared.<br></samp><br><br>A returned status of PI_SOME_PERMITTED indicates that the user
-is not allowed to write to one or more of the GPIO.
-<br><br><b><small>Example</small></b><br><br><code>pi.clear_bank_2(0x1010)<br></code><h3><a name="custom_1">custom_1<small>(<a href="#arg1">arg1</a>, <a href="#arg2">arg2</a>, <a href="#argx">argx</a>)</small></h3>
-Calls a pigpio function customised by the user.
-<br><br><b><small>Parameters</small></b><br><br><samp>arg1:=&nbsp;&gt;=0,&nbsp;default&nbsp;0.<br>arg2:=&nbsp;&gt;=0,&nbsp;default&nbsp;0.<br>argx:=&nbsp;extra&nbsp;arguments&nbsp;(each&nbsp;0-255),&nbsp;default&nbsp;empty.<br></samp><br><br>The returned value is an integer which by convention
-should be &gt;=0 for OK and &lt;0 for error.
-<br><br><b><small>Example</small></b><br><br><code>value&nbsp;=&nbsp;pi.custom_1()<br><br>value&nbsp;=&nbsp;pi.custom_1(23)<br><br>value&nbsp;=&nbsp;pi.custom_1(0,&nbsp;55)<br><br>value&nbsp;=&nbsp;pi.custom_1(23,&nbsp;56,&nbsp;[1,&nbsp;5,&nbsp;7])<br><br>value&nbsp;=&nbsp;pi.custom_1(23,&nbsp;56,&nbsp;b"hello")<br><br>value&nbsp;=&nbsp;pi.custom_1(23,&nbsp;56,&nbsp;"hello")<br></code><h3><a name="custom_2">custom_2<small>(<a href="#arg1">arg1</a>, <a href="#argx">argx</a>, <a href="#retMax">retMax</a>)</small></h3>
-Calls a pigpio function customised by the user.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;arg1:=&nbsp;&gt;=0,&nbsp;default&nbsp;0.<br>&nbsp;&nbsp;argx:=&nbsp;extra&nbsp;arguments&nbsp;(each&nbsp;0-255),&nbsp;default&nbsp;empty.<br>retMax:=&nbsp;&gt;=0,&nbsp;maximum&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;return,&nbsp;default&nbsp;8192.<br></samp><br><br>The returned value is a tuple of the number of bytes
-returned and a bytearray containing the bytes. If
-there was an error the number of bytes read will be
-less than zero (and will contain the error code).
-<br><br><b><small>Example</small></b><br><br><code>(count,&nbsp;data)&nbsp;=&nbsp;pi.custom_2()<br><br>(count,&nbsp;data)&nbsp;=&nbsp;pi.custom_2(23)<br><br>(count,&nbsp;data)&nbsp;=&nbsp;pi.custom_2(23,&nbsp;[1,&nbsp;5,&nbsp;7])<br><br>(count,&nbsp;data)&nbsp;=&nbsp;pi.custom_2(23,&nbsp;b"hello")<br><br>(count,&nbsp;data)&nbsp;=&nbsp;pi.custom_2(23,&nbsp;"hello",&nbsp;128)<br></code><h3><a name="delete_script">delete_script<small>(<a href="#script_id">script_id</a>)</small></h3>
-Deletes a stored script.
-<br><br><b><small>Parameters</small></b><br><br><samp>script_id:=&nbsp;id&nbsp;of&nbsp;stored&nbsp;script.<br></samp><br><br><b><small>Example</small></b><br><br><code>status&nbsp;=&nbsp;pi.delete_script(sid)<br></code><h3><a name="event_callback">event_callback<small>(<a href="#event">event</a>, <a href="#func">func</a>)</small></h3>
-Calls a user supplied function (a callback) whenever the
-specified event is signalled.
-<br><br><b><small>Parameters</small></b><br><br><samp>event:=&nbsp;0-31.<br>&nbsp;func:=&nbsp;user&nbsp;supplied&nbsp;callback&nbsp;function.<br></samp><br><br>The user supplied callback receives two parameters, the event id,
-and the tick.
-<br><br>If a user callback is not specified a default tally callback is
-provided which simply counts events. The count may be retrieved
-by calling the tally function. The count may be reset to zero
-by calling the reset_tally function.
-<br><br>The callback may be cancelled by calling the event_cancel function.
-<br><br>An event may have multiple callbacks (although I can't think of
-a reason to do so).
-<br><br><b><small>Example</small></b><br><br><code>def&nbsp;cbf(event,&nbsp;tick):<br>&nbsp;&nbsp;&nbsp;print(event,&nbsp;tick)<br><br>cb1&nbsp;=&nbsp;pi.event_callback(22,&nbsp;cbf)<br><br>cb2&nbsp;=&nbsp;pi.event_callback(4)<br><br>print(cb2.tally())<br><br>cb2.reset_tally()<br><br>cb1.event_cancel()&nbsp;#&nbsp;To&nbsp;cancel&nbsp;callback&nbsp;cb1.<br></code><h3><a name="event_trigger">event_trigger<small>(<a href="#event">event</a>)</small></h3>
-This function signals the occurrence of an event.
-<br><br><b><small>Parameters</small></b><br><br><samp>event:=&nbsp;0-31,&nbsp;the&nbsp;event<br></samp><br><br>Returns 0 if OK, otherwise PI_BAD_EVENT_ID.
-<br><br>An event is a signal used to inform one or more consumers
-to start an action. Each consumer which has registered an
-interest in the event (e.g. by calling <a href="#event_callback">event_callback</a>) will
-be informed by a callback.
-<br><br>One event, EVENT_BSC (31) is predefined. This event is
-auto generated on BSC slave activity.
-<br><br>The meaning of other events is arbitrary.
-<br><br>Note that other than its id and its tick there is no data associated
-with an event.
-<br><br><b><small>Example</small></b><br><br><code>pi.event_trigger(23)<br></code><h3><a name="file_close">file_close<small>(<a href="#handle">handle</a>)</small></h3>
-Closes the file associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#file_open">file_open</a>).<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.file_close(handle)<br></code><h3><a name="file_list">file_list<small>(<a href="#fpattern">fpattern</a>)</small></h3>
-Returns a list of files which match a pattern.
-<br><br><b><small>Parameters</small></b><br><br><samp>fpattern:=&nbsp;file&nbsp;pattern&nbsp;to&nbsp;match.<br></samp><br><br>Returns the number of returned bytes if OK, otherwise
-PI_NO_FILE_ACCESS, or PI_NO_FILE_MATCH.
-<br><br>The pattern must match an entry in /opt/pigpio/access. The
-pattern may contain wildcards. See <a href="#file_open">file_open</a>.
-<br><br>NOTE
-<br><br>The returned value is not the number of files, it is the number
-of bytes in the buffer. The file names are separated by newline
-characters.
-<br><br><b><small>Example</small></b><br><br><code>#!/usr/bin/env&nbsp;python<br><br>import&nbsp;pigpio<br><br>pi&nbsp;=&nbsp;pigpio.pi()<br><br>if&nbsp;not&nbsp;pi.connected:<br>&nbsp;&nbsp;&nbsp;exit()<br><br>#&nbsp;Assumes&nbsp;/opt/pigpio/access&nbsp;contains&nbsp;the&nbsp;following&nbsp;line:<br>#&nbsp;/ram/*.c&nbsp;r<br><br>c,&nbsp;d&nbsp;=&nbsp;pi.file_list("/ram/p*.c")<br>if&nbsp;c&nbsp;&gt;&nbsp;0:<br>&nbsp;&nbsp;&nbsp;print(d)<br><br>pi.stop()<br></code><h3><a name="file_open">file_open<small>(<a href="#file_name">file_name</a>, <a href="#file_mode">file_mode</a>)</small></h3>
-This function returns a handle to a file opened in a specified mode.
-<br><br><b><small>Parameters</small></b><br><br><samp>file_name:=&nbsp;the&nbsp;file&nbsp;to&nbsp;open.<br>file_mode:=&nbsp;the&nbsp;file&nbsp;open&nbsp;mode.<br></samp><br><br>Returns a handle (&gt;=0) if OK, otherwise PI_NO_HANDLE,
-PI_NO_FILE_ACCESS, PI_BAD_FILE_MODE,
-PI_FILE_OPEN_FAILED, or PI_FILE_IS_A_DIR.
-<br><br><b><small>Example</small></b><br><br><code>h&nbsp;=&nbsp;pi.file_open("/home/pi/shared/dir_3/file.txt",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pigpio.FILE_WRITE&nbsp;|&nbsp;pigpio.FILE_CREATE)<br><br>pi.file_write(h,&nbsp;"Hello&nbsp;world")<br><br>pi.file_close(h)<br></code><br><br>File
-<br><br>A file may only be opened if permission is granted by an entry
-in /opt/pigpio/access. This is intended to allow remote access
-to files in a more or less controlled manner.
-<br><br>Each entry in /opt/pigpio/access takes the form of a file path
-which may contain wildcards followed by a single letter permission.
-The permission may be R for read, W for write, U for read/write,
-and N for no access.
-<br><br>Where more than one entry matches a file the most specific rule
-applies. If no entry matches a file then access is denied.
-<br><br>Suppose /opt/pigpio/access contains the following entries:
-<br><br><code>/home/*&nbsp;n<br>/home/pi/shared/dir_1/*&nbsp;w<br>/home/pi/shared/dir_2/*&nbsp;r<br>/home/pi/shared/dir_3/*&nbsp;u<br>/home/pi/shared/dir_1/file.txt&nbsp;n<br></code><br><br>Files may be written in directory dir_1 with the exception
-of file.txt.
-<br><br>Files may be read in directory dir_2.
-<br><br>Files may be read and written in directory dir_3.
-<br><br>If a directory allows read, write, or read/write access then files
-may be created in that directory.
-<br><br>In an attempt to prevent risky permissions the following paths are
-ignored in /opt/pigpio/access:
-<br><br><code>a&nbsp;path&nbsp;containing&nbsp;..<br>a&nbsp;path&nbsp;containing&nbsp;only&nbsp;wildcards&nbsp;(*?)<br>a&nbsp;path&nbsp;containing&nbsp;less&nbsp;than&nbsp;two&nbsp;non-wildcard&nbsp;parts<br></code><br><br>Mode
-<br><br>The mode may have the following values:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Constant</td><td>Value</td><td>Meaning</td></tr><tr><td>FILE_READ</td><td>1</td><td>open file for reading</td></tr><tr><td>FILE_WRITE</td><td>2</td><td>open file for writing</td></tr><tr><td>FILE_RW</td><td>3</td><td>open file for reading and writing</td></tr></tbody></table><br><br>The following values may be or'd into the mode:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Value</td><td>Meaning</td></tr><tr><td>FILE_APPEND</td><td>4</td><td>All writes append data to the end of the file</td></tr><tr><td>FILE_CREATE</td><td>8</td><td>The file is created if it doesn't exist</td></tr><tr><td>FILE_TRUNC</td><td>16</td><td>The file is truncated</td></tr></tbody></table><br><br>Newly created files are owned by root with permissions owner
-read and write.
-<br><br><b><small>Example</small></b><br><br><code>#!/usr/bin/env&nbsp;python<br><br>import&nbsp;pigpio<br><br>pi&nbsp;=&nbsp;pigpio.pi()<br><br>if&nbsp;not&nbsp;pi.connected:<br>&nbsp;&nbsp;&nbsp;exit()<br><br>#&nbsp;Assumes&nbsp;/opt/pigpio/access&nbsp;contains&nbsp;the&nbsp;following&nbsp;line:<br>#&nbsp;/ram/*.c&nbsp;r<br><br>handle&nbsp;=&nbsp;pi.file_open("/ram/pigpio.c",&nbsp;pigpio.FILE_READ)<br><br>done&nbsp;=&nbsp;False<br><br>while&nbsp;not&nbsp;done:<br>&nbsp;&nbsp;&nbsp;c,&nbsp;d&nbsp;=&nbsp;pi.file_read(handle,&nbsp;60000)<br>&nbsp;&nbsp;&nbsp;if&nbsp;c&nbsp;&gt;&nbsp;0:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(d)<br>&nbsp;&nbsp;&nbsp;else:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;done&nbsp;=&nbsp;True<br><br>pi.file_close(handle)<br><br>pi.stop()<br></code><h3><a name="file_read">file_read<small>(<a href="#handle">handle</a>, <a href="#count">count</a>)</small></h3>
-Reads up to count bytes from the file associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#file_open">file_open</a>).<br>&nbsp;count:=&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></samp><br><br>The returned value is a tuple of the number of bytes read and a
-bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br><b><small>Example</small></b><br><br><code>(b,&nbsp;d)&nbsp;=&nbsp;pi.file_read(h2,&nbsp;100)<br>if&nbsp;b&nbsp;&gt;&nbsp;0:<br>&nbsp;&nbsp;&nbsp;#&nbsp;process&nbsp;read&nbsp;data<br></code><h3><a name="file_seek">file_seek<small>(<a href="#handle">handle</a>, <a href="#seek_offset">seek_offset</a>, <a href="#seek_from">seek_from</a>)</small></h3>
-Seeks to a position relative to the start, current position,
-or end of the file. Returns the new position.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#file_open">file_open</a>).<br>seek_offset:=&nbsp;byte&nbsp;offset.<br>&nbsp;&nbsp;seek_from:=&nbsp;FROM_START,&nbsp;FROM_CURRENT,&nbsp;or&nbsp;FROM_END.<br></samp><br><br><b><small>Example</small></b><br><br><code>new_pos&nbsp;=&nbsp;pi.file_seek(h,&nbsp;100,&nbsp;pigpio.FROM_START)<br><br>cur_pos&nbsp;=&nbsp;pi.file_seek(h,&nbsp;0,&nbsp;pigpio.FROM_CURRENT)<br><br>file_size&nbsp;=&nbsp;pi.file_seek(h,&nbsp;0,&nbsp;pigpio.FROM_END)<br></code><h3><a name="file_write">file_write<small>(<a href="#handle">handle</a>, <a href="#data">data</a>)</small></h3>
-Writes the data bytes to the file associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#file_open">file_open</a>).<br>&nbsp;&nbsp;data:=&nbsp;the&nbsp;bytes&nbsp;to&nbsp;write.<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.file_write(h1,&nbsp;b'\x02\x03\x04')<br><br>pi.file_write(h2,&nbsp;b'help')<br><br>pi.file_write(h2,&nbsp;"hello")<br><br>pi.file_write(h1,&nbsp;[2,&nbsp;3,&nbsp;4])<br></code><h3><a name="get_PWM_dutycycle">get_PWM_dutycycle<small>(<a href="#user_gpio">user_gpio</a>)</small></h3>
-Returns the PWM dutycycle being used on the GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31.<br></samp><br><br>Returns the PWM dutycycle.
-<br><br>For normal PWM the dutycycle will be out of the defined range
-for the GPIO (see <a href="#get_PWM_range">get_PWM_range</a>).
-<br><br>If a hardware clock is active on the GPIO the reported
-dutycycle will be 500000 (500k) out of 1000000 (1M).
-<br><br>If hardware PWM is active on the GPIO the reported dutycycle
-will be out of a 1000000 (1M).
-<br><br><b><small>Example</small></b><br><br><code>pi.set_PWM_dutycycle(4,&nbsp;25)<br>print(pi.get_PWM_dutycycle(4))<br>25<br><br>pi.set_PWM_dutycycle(4,&nbsp;203)<br>print(pi.get_PWM_dutycycle(4))<br>203<br></code><h3><a name="get_PWM_frequency">get_PWM_frequency<small>(<a href="#user_gpio">user_gpio</a>)</small></h3>
-Returns the frequency of PWM being used on the GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31.<br></samp><br><br>Returns the frequency (in Hz) used for the GPIO.
-<br><br>For normal PWM the frequency will be that defined for the GPIO
-by <a href="#set_PWM_frequency">set_PWM_frequency</a>.
-<br><br>If a hardware clock is active on the GPIO the reported frequency
-will be that set by <a href="#hardware_clock">hardware_clock</a>.
-<br><br>If hardware PWM is active on the GPIO the reported frequency
-will be that set by <a href="#hardware_PWM">hardware_PWM</a>.
-<br><br><b><small>Example</small></b><br><br><code>pi.set_PWM_frequency(4,0)<br>print(pi.get_PWM_frequency(4))<br>10<br><br>pi.set_PWM_frequency(4,&nbsp;800)<br>print(pi.get_PWM_frequency(4))<br>800<br></code><h3><a name="get_PWM_range">get_PWM_range<small>(<a href="#user_gpio">user_gpio</a>)</small></h3>
-Returns the range of PWM values being used on the GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31.<br></samp><br><br>If a hardware clock or hardware PWM is active on the GPIO
-the reported range will be 1000000 (1M).
-<br><br><b><small>Example</small></b><br><br><code>pi.set_PWM_range(9,&nbsp;500)<br>print(pi.get_PWM_range(9))<br>500<br></code><h3><a name="get_PWM_real_range">get_PWM_real_range<small>(<a href="#user_gpio">user_gpio</a>)</small></h3>
-Returns the real (underlying) range of PWM values being
-used on the GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31.<br></samp><br><br>If a hardware clock is active on the GPIO the reported
-real range will be 1000000 (1M).
-<br><br>If hardware PWM is active on the GPIO the reported real range
-will be approximately 250M divided by the set PWM frequency.
-<br><br><b><small>Example</small></b><br><br><code>pi.set_PWM_frequency(4,&nbsp;800)<br>print(pi.get_PWM_real_range(4))<br>250<br></code><h3><a name="get_current_tick">get_current_tick<small>()</small></h3>
-Returns the current system tick.
-<br><br>Tick is the number of microseconds since system boot. As an
-unsigned 32 bit quantity tick wraps around approximately
-every 71.6 minutes.
-<br><br><b><small>Example</small></b><br><br><code>t1&nbsp;=&nbsp;pi.get_current_tick()<br>time.sleep(1)<br>t2&nbsp;=&nbsp;pi.get_current_tick()<br></code><h3><a name="get_hardware_revision">get_hardware_revision<small>()</small></h3>
-Returns the Pi's hardware revision number.
-<br><br>The hardware revision is the last few characters on the
-Revision line of /proc/cpuinfo.
-<br><br>The revision number can be used to determine the assignment
-of GPIO to pins (see <a href="#gpio">gpio</a>).
-<br><br>There are at least three types of board.
-<br><br>Type 1 boards have hardware revision numbers of 2 and 3.
-<br><br>Type 2 boards have hardware revision numbers of 4, 5, 6, and 15.
-<br><br>Type 3 boards have hardware revision numbers of 16 or greater.
-<br><br>If the hardware revision can not be found or is not a valid
-hexadecimal number the function returns 0.
-<br><br><b><small>Example</small></b><br><br><code>print(pi.get_hardware_revision())<br>2<br></code><h3><a name="get_mode">get_mode<small>(<a href="#gpio">gpio</a>)</small></h3>
-Returns the GPIO mode.
-<br><br><b><small>Parameters</small></b><br><br><samp>gpio:=&nbsp;0-53.<br></samp><br><br>Returns a value as follows
-<br><br><code>0&nbsp;=&nbsp;INPUT<br>1&nbsp;=&nbsp;OUTPUT<br>2&nbsp;=&nbsp;ALT5<br>3&nbsp;=&nbsp;ALT4<br>4&nbsp;=&nbsp;ALT0<br>5&nbsp;=&nbsp;ALT1<br>6&nbsp;=&nbsp;ALT2<br>7&nbsp;=&nbsp;ALT3<br></code><br><br><b><small>Example</small></b><br><br><code>print(pi.get_mode(0))<br>4<br></code><h3><a name="get_pad_strength">get_pad_strength<small>(<a href="#pad">pad</a>)</small></h3>
-This function returns the pad drive strength in mA.
-<br><br><b><small>Parameters</small></b><br><br><samp>pad:=&nbsp;0-2,&nbsp;the&nbsp;pad&nbsp;to&nbsp;get.<br></samp><br><br>Returns the pad drive strength if OK, otherwise PI_BAD_PAD.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>strength&nbsp;=&nbsp;pi.get_pad_strength(0)&nbsp;#&nbsp;Get&nbsp;pad&nbsp;0&nbsp;strength.<br></code><h3><a name="get_pigpio_version">get_pigpio_version<small>()</small></h3>
-Returns the pigpio software version.
-<br><br><b><small>Example</small></b><br><br><code>v&nbsp;=&nbsp;pi.get_pigpio_version()<br></code><h3><a name="get_servo_pulsewidth">get_servo_pulsewidth<small>(<a href="#user_gpio">user_gpio</a>)</small></h3>
-Returns the servo pulsewidth being used on the GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31.<br></samp><br><br>Returns the servo pulsewidth.
-<br><br><b><small>Example</small></b><br><br><code>pi.set_servo_pulsewidth(4,&nbsp;525)<br>print(pi.get_servo_pulsewidth(4))<br>525<br><br>pi.set_servo_pulsewidth(4,&nbsp;2130)<br>print(pi.get_servo_pulsewidth(4))<br>2130<br></code><h3><a name="gpio_trigger">gpio_trigger<small>(<a href="#user_gpio">user_gpio</a>, <a href="#pulse_len">pulse_len</a>, <a href="#level">level</a>)</small></h3>
-Send a trigger pulse to a GPIO. The GPIO is set to
-level for pulse_len microseconds and then reset to not level.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31<br>pulse_len:=&nbsp;1-100<br>&nbsp;&nbsp;&nbsp;&nbsp;level:=&nbsp;0-1<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.gpio_trigger(23,&nbsp;10,&nbsp;1)<br></code><h3><a name="hardware_PWM">hardware_PWM<small>(<a href="#gpio">gpio</a>, <a href="#PWMfreq">PWMfreq</a>, <a href="#PWMduty">PWMduty</a>)</small></h3>
-Starts hardware PWM on a GPIO at the specified frequency
-and dutycycle. Frequencies above 30MHz are unlikely to work.
-<br><br>NOTE: Any waveform started by <a href="#wave_send_once">wave_send_once</a>,
-<a href="#wave_send_repeat">wave_send_repeat</a>, or <a href="#wave_chain">wave_chain</a> will be cancelled.
-<br><br>This function is only valid if the pigpio main clock is PCM.
-The main clock defaults to PCM but may be overridden when the
-pigpio daemon is started (option -t).
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;&nbsp;gpio:=&nbsp;see&nbsp;descripton<br>PWMfreq:=&nbsp;0&nbsp;(off)&nbsp;or&nbsp;1-125M&nbsp;(1-187.5M&nbsp;for&nbsp;the&nbsp;BCM2711).<br>PWMduty:=&nbsp;0&nbsp;(off)&nbsp;to&nbsp;1000000&nbsp;(1M)(fully&nbsp;on).<br></samp><br><br>Returns 0 if OK, otherwise PI_NOT_PERMITTED, PI_BAD_GPIO,
-PI_NOT_HPWM_GPIO, PI_BAD_HPWM_DUTY, PI_BAD_HPWM_FREQ.
-<br><br>The same PWM channel is available on multiple GPIO.
-The latest frequency and dutycycle setting will be used
-by all GPIO which share a PWM channel.
-<br><br>The GPIO must be one of the following:
-<br><br><code>12&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>13&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>18&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;All&nbsp;models<br>19&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br><br>40&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>41&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>45&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>52&nbsp;&nbsp;PWM&nbsp;channel&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>53&nbsp;&nbsp;PWM&nbsp;channel&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br></code><br><br>The actual number of steps beween off and fully on is the
-integral part of 250M/PWMfreq (375M/PWMfreq for the BCM2711).
-<br><br>The actual frequency set is 250M/steps (375M/steps
-for the BCM2711).
-<br><br>There will only be a million steps for a PWMfreq of 250
-(375 for the BCM2711). Lower frequencies will have more
-steps and higher frequencies will have fewer steps.
-PWMduty is automatically scaled to take this into account.
-<br><br><b><small>Example</small></b><br><br><code>pi.hardware_PWM(18,&nbsp;800,&nbsp;250000)&nbsp;#&nbsp;800Hz&nbsp;25%&nbsp;dutycycle<br><br>pi.hardware_PWM(18,&nbsp;2000,&nbsp;750000)&nbsp;#&nbsp;2000Hz&nbsp;75%&nbsp;dutycycle<br></code><h3><a name="hardware_clock">hardware_clock<small>(<a href="#gpio">gpio</a>, <a href="#clkfreq">clkfreq</a>)</small></h3>
-Starts a hardware clock on a GPIO at the specified frequency.
-Frequencies above 30MHz are unlikely to work.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;&nbsp;gpio:=&nbsp;see&nbsp;description<br>clkfreq:=&nbsp;0&nbsp;(off)&nbsp;or&nbsp;4689-250M&nbsp;(13184-375M&nbsp;for&nbsp;the&nbsp;BCM2711)<br></samp><br><br>Returns 0 if OK, otherwise PI_NOT_PERMITTED, PI_BAD_GPIO,
-PI_NOT_HCLK_GPIO, PI_BAD_HCLK_FREQ,or PI_BAD_HCLK_PASS.
-<br><br>The same clock is available on multiple GPIO. The latest
-frequency setting will be used by all GPIO which share a clock.
-<br><br>The GPIO must be one of the following:
-<br><br><code>4&nbsp;&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;All&nbsp;models<br>5&nbsp;&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br>6&nbsp;&nbsp;&nbsp;clock&nbsp;2&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>20&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;B<br>21&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;All&nbsp;models&nbsp;but&nbsp;A&nbsp;and&nbsp;Rev.2&nbsp;B&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br><br>32&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>34&nbsp;&nbsp;clock&nbsp;0&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>42&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br>43&nbsp;&nbsp;clock&nbsp;2&nbsp;&nbsp;Compute&nbsp;module&nbsp;only<br>44&nbsp;&nbsp;clock&nbsp;1&nbsp;&nbsp;Compute&nbsp;module&nbsp;only&nbsp;(reserved&nbsp;for&nbsp;system&nbsp;use)<br></code><br><br>Access to clock 1 is protected by a password as its use will
-likely crash the Pi. The password is given by or'ing 0x5A000000
-with the GPIO number.
-<br><br><b><small>Example</small></b><br><br><code>pi.hardware_clock(4,&nbsp;5000)&nbsp;#&nbsp;5&nbsp;KHz&nbsp;clock&nbsp;on&nbsp;GPIO&nbsp;4<br><br>pi.hardware_clock(4,&nbsp;40000000)&nbsp;#&nbsp;40&nbsp;MHz&nbsp;clock&nbsp;on&nbsp;GPIO&nbsp;4<br></code><h3><a name="i2c_block_process_call">i2c_block_process_call<small>(<a href="#handle">handle</a>, <a href="#reg">reg</a>, <a href="#data">data</a>)</small></h3>
-Writes data bytes to the specified register of the device
-associated with handle and reads a device specified number
-of bytes of data in return.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;&nbsp;reg:=&nbsp;&gt;=0,&nbsp;the&nbsp;device&nbsp;register.<br>&nbsp;&nbsp;data:=&nbsp;the&nbsp;bytes&nbsp;to&nbsp;write.<br></samp><br><br>The SMBus 2.0 documentation states that a minimum of 1 byte may
-be sent and a minimum of 1 byte may be received. The total
-number of bytes sent/received must be 32 or less.
-<br><br>SMBus 2.0 5.5.8 - Block write-block read.
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;reg&nbsp;[A]&nbsp;len(data)&nbsp;[A]&nbsp;data0&nbsp;[A]&nbsp;...&nbsp;datan&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Count]&nbsp;A&nbsp;[Data]&nbsp;...&nbsp;A&nbsp;P<br></code><br><br>The returned value is a tuple of the number of bytes read and a
-bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br><b><small>Example</small></b><br><br><code>(b,&nbsp;d)&nbsp;=&nbsp;pi.i2c_block_process_call(h,&nbsp;10,&nbsp;b'\x02\x05\x00')<br><br>(b,&nbsp;d)&nbsp;=&nbsp;pi.i2c_block_process_call(h,&nbsp;10,&nbsp;b'abcdr')<br><br>(b,&nbsp;d)&nbsp;=&nbsp;pi.i2c_block_process_call(h,&nbsp;10,&nbsp;"abracad")<br><br>(b,&nbsp;d)&nbsp;=&nbsp;pi.i2c_block_process_call(h,&nbsp;10,&nbsp;[2,&nbsp;5,&nbsp;16])<br></code><h3><a name="i2c_close">i2c_close<small>(<a href="#handle">handle</a>)</small></h3>
-Closes the I2C device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.i2c_close(h)<br></code><h3><a name="i2c_open">i2c_open<small>(<a href="#i2c_bus">i2c_bus</a>, <a href="#i2c_address">i2c_address</a>, <a href="#i2c_flags">i2c_flags</a>)</small></h3>
-Returns a handle (&gt;=0) for the device at the I2C bus address.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;&nbsp;&nbsp;i2c_bus:=&nbsp;&gt;=0.<br>i2c_address:=&nbsp;0-0x7F.<br>&nbsp;&nbsp;i2c_flags:=&nbsp;0,&nbsp;no&nbsp;flags&nbsp;are&nbsp;currently&nbsp;defined.<br></samp><br><br>Physically buses 0 and 1 are available on the Pi. Higher
-numbered buses will be available if a kernel supported bus
-multiplexor is being used.
-<br><br>The GPIO used are given in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>SDA</td><td>SCL</td></tr><tr><td>I2C 0</td><td>0</td><td>1</td></tr><tr><td>I2C 1</td><td>2</td><td>3</td></tr></tbody></table><br><br>For the SMBus commands the low level transactions are shown
-at the end of the function description. The following
-abbreviations are used:
-<br><br><code>S&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Start&nbsp;bit<br>P&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Stop&nbsp;bit<br>Rd/Wr&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Read/Write&nbsp;bit.&nbsp;Rd&nbsp;equals&nbsp;1,&nbsp;Wr&nbsp;equals&nbsp;0.<br>A,&nbsp;NA&nbsp;(1&nbsp;bit)&nbsp;:&nbsp;Accept&nbsp;and&nbsp;not&nbsp;accept&nbsp;bit.<br>Addr&nbsp;&nbsp;(7&nbsp;bits):&nbsp;I2C&nbsp;7&nbsp;bit&nbsp;address.<br>reg&nbsp;&nbsp;&nbsp;(8&nbsp;bits):&nbsp;Command&nbsp;byte,&nbsp;which&nbsp;often&nbsp;selects&nbsp;a&nbsp;register.<br>Data&nbsp;&nbsp;(8&nbsp;bits):&nbsp;A&nbsp;data&nbsp;byte.<br>Count&nbsp;(8&nbsp;bits):&nbsp;A&nbsp;byte&nbsp;defining&nbsp;the&nbsp;length&nbsp;of&nbsp;a&nbsp;block&nbsp;operation.<br><br>[..]:&nbsp;Data&nbsp;sent&nbsp;by&nbsp;the&nbsp;device.<br></code><br><br><b><small>Example</small></b><br><br><code>h&nbsp;=&nbsp;pi.i2c_open(1,&nbsp;0x53)&nbsp;#&nbsp;open&nbsp;device&nbsp;at&nbsp;address&nbsp;0x53&nbsp;on&nbsp;bus&nbsp;1<br></code><h3><a name="i2c_process_call">i2c_process_call<small>(<a href="#handle">handle</a>, <a href="#reg">reg</a>, <a href="#word_val">word_val</a>)</small></h3>
-Writes 16 bits of data to the specified register of the device
-associated with handle and reads 16 bits of data in return.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reg:=&nbsp;&gt;=0,&nbsp;the&nbsp;device&nbsp;register.<br>word_val:=&nbsp;0-65535,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></samp><br><br>SMBus 2.0 5.5.6 - Process call.
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;reg&nbsp;[A]&nbsp;word_val_Low&nbsp;[A]&nbsp;word_val_High&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[DataLow]&nbsp;A&nbsp;[DataHigh]&nbsp;NA&nbsp;P<br></code><br><br><b><small>Example</small></b><br><br><code>r&nbsp;=&nbsp;pi.i2c_process_call(h,&nbsp;4,&nbsp;0x1231)<br>r&nbsp;=&nbsp;pi.i2c_process_call(h,&nbsp;6,&nbsp;0)<br></code><h3><a name="i2c_read_block_data">i2c_read_block_data<small>(<a href="#handle">handle</a>, <a href="#reg">reg</a>)</small></h3>
-Reads a block of up to 32 bytes from the specified register of
-the device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;&nbsp;reg:=&nbsp;&gt;=0,&nbsp;the&nbsp;device&nbsp;register.<br></samp><br><br>SMBus 2.0 5.5.7 - Block read.
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;reg&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Count]&nbsp;A&nbsp;[Data]&nbsp;A&nbsp;[Data]&nbsp;A&nbsp;...&nbsp;A&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><br><br>The amount of returned data is set by the device.
-<br><br>The returned value is a tuple of the number of bytes read and a
-bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br><b><small>Example</small></b><br><br><code>(b,&nbsp;d)&nbsp;=&nbsp;pi.i2c_read_block_data(h,&nbsp;10)<br>if&nbsp;b&nbsp;&gt;=&nbsp;0:<br>&nbsp;&nbsp;&nbsp;#&nbsp;process&nbsp;data<br>else:<br>&nbsp;&nbsp;&nbsp;#&nbsp;process&nbsp;read&nbsp;failure<br></code><h3><a name="i2c_read_byte">i2c_read_byte<small>(<a href="#handle">handle</a>)</small></h3>
-Reads a single byte from the device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br></samp><br><br>SMBus 2.0 5.5.3 - Receive byte.
-<code>S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><br><br><b><small>Example</small></b><br><br><code>b&nbsp;=&nbsp;pi.i2c_read_byte(2)&nbsp;#&nbsp;read&nbsp;a&nbsp;byte&nbsp;from&nbsp;device&nbsp;2<br></code><h3><a name="i2c_read_byte_data">i2c_read_byte_data<small>(<a href="#handle">handle</a>, <a href="#reg">reg</a>)</small></h3>
-Reads a single byte from the specified register of the device
-associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;&nbsp;reg:=&nbsp;&gt;=0,&nbsp;the&nbsp;device&nbsp;register.<br></samp><br><br>SMBus 2.0 5.5.5 - Read byte.
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;reg&nbsp;[A]&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><br><br><b><small>Example</small></b><br><br><code>#&nbsp;read&nbsp;byte&nbsp;from&nbsp;reg&nbsp;17&nbsp;of&nbsp;device&nbsp;2<br>b&nbsp;=&nbsp;pi.i2c_read_byte_data(2,&nbsp;17)<br><br>#&nbsp;read&nbsp;byte&nbsp;from&nbsp;reg&nbsp;&nbsp;1&nbsp;of&nbsp;device&nbsp;0<br>b&nbsp;=&nbsp;pi.i2c_read_byte_data(0,&nbsp;1)<br></code><h3><a name="i2c_read_device">i2c_read_device<small>(<a href="#handle">handle</a>, <a href="#count">count</a>)</small></h3>
-Returns count bytes read from the raw device associated
-with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;count:=&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></samp><br><br><code>S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Data]&nbsp;A&nbsp;[Data]&nbsp;A&nbsp;...&nbsp;A&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><br><br>The returned value is a tuple of the number of bytes read and a
-bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br><b><small>Example</small></b><br><br><code>(count,&nbsp;data)&nbsp;=&nbsp;pi.i2c_read_device(h,&nbsp;12)<br></code><h3><a name="i2c_read_i2c_block_data">i2c_read_i2c_block_data<small>(<a href="#handle">handle</a>, <a href="#reg">reg</a>, <a href="#count">count</a>)</small></h3>
-Reads count bytes from the specified register of the device
-associated with handle . The count may be 1-32.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;&nbsp;reg:=&nbsp;&gt;=0,&nbsp;the&nbsp;device&nbsp;register.<br>&nbsp;count:=&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></samp><br><br><code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;reg&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[Data]&nbsp;A&nbsp;[Data]&nbsp;A&nbsp;...&nbsp;A&nbsp;[Data]&nbsp;NA&nbsp;P<br></code><br><br>The returned value is a tuple of the number of bytes read and a
-bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br><b><small>Example</small></b><br><br><code>(b,&nbsp;d)&nbsp;=&nbsp;pi.i2c_read_i2c_block_data(h,&nbsp;4,&nbsp;32)<br>if&nbsp;b&nbsp;&gt;=&nbsp;0:<br>&nbsp;&nbsp;&nbsp;#&nbsp;process&nbsp;data<br>else:<br>&nbsp;&nbsp;&nbsp;#&nbsp;process&nbsp;read&nbsp;failure<br></code><h3><a name="i2c_read_word_data">i2c_read_word_data<small>(<a href="#handle">handle</a>, <a href="#reg">reg</a>)</small></h3>
-Reads a single 16 bit word from the specified register of the
-device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;&nbsp;reg:=&nbsp;&gt;=0,&nbsp;the&nbsp;device&nbsp;register.<br></samp><br><br>SMBus 2.0 5.5.5 - Read word.
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;reg&nbsp;[A]&nbsp;S&nbsp;Addr&nbsp;Rd&nbsp;[A]&nbsp;[DataLow]&nbsp;A&nbsp;[DataHigh]&nbsp;NA&nbsp;P<br></code><br><br><b><small>Example</small></b><br><br><code>#&nbsp;read&nbsp;word&nbsp;from&nbsp;reg&nbsp;2&nbsp;of&nbsp;device&nbsp;3<br>w&nbsp;=&nbsp;pi.i2c_read_word_data(3,&nbsp;2)<br><br>#&nbsp;read&nbsp;word&nbsp;from&nbsp;reg&nbsp;7&nbsp;of&nbsp;device&nbsp;2<br>w&nbsp;=&nbsp;pi.i2c_read_word_data(2,&nbsp;7)<br></code><h3><a name="i2c_write_block_data">i2c_write_block_data<small>(<a href="#handle">handle</a>, <a href="#reg">reg</a>, <a href="#data">data</a>)</small></h3>
-Writes up to 32 bytes to the specified register of the device
-associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;&nbsp;reg:=&nbsp;&gt;=0,&nbsp;the&nbsp;device&nbsp;register.<br>&nbsp;&nbsp;data:=&nbsp;the&nbsp;bytes&nbsp;to&nbsp;write.<br></samp><br><br>SMBus 2.0 5.5.7 - Block write.
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;reg&nbsp;[A]&nbsp;len(data)&nbsp;[A]&nbsp;data0&nbsp;[A]&nbsp;data1&nbsp;[A]&nbsp;...&nbsp;[A]<br>&nbsp;&nbsp;&nbsp;datan&nbsp;[A]&nbsp;P<br></code><br><br><b><small>Example</small></b><br><br><code>pi.i2c_write_block_data(4,&nbsp;5,&nbsp;b'hello')<br><br>pi.i2c_write_block_data(4,&nbsp;5,&nbsp;"data&nbsp;bytes")<br><br>pi.i2c_write_block_data(5,&nbsp;0,&nbsp;b'\x00\x01\x22')<br><br>pi.i2c_write_block_data(6,&nbsp;2,&nbsp;[0,&nbsp;1,&nbsp;0x22])<br></code><h3><a name="i2c_write_byte">i2c_write_byte<small>(<a href="#handle">handle</a>, <a href="#byte_val">byte_val</a>)</small></h3>
-Sends a single byte to the device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>byte_val:=&nbsp;0-255,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></samp><br><br>SMBus 2.0 5.5.2 - Send byte.
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;byte_val&nbsp;[A]&nbsp;P<br></code><br><br><b><small>Example</small></b><br><br><code>pi.i2c_write_byte(1,&nbsp;17)&nbsp;&nbsp;&nbsp;#&nbsp;send&nbsp;byte&nbsp;&nbsp;&nbsp;17&nbsp;to&nbsp;device&nbsp;1<br>pi.i2c_write_byte(2,&nbsp;0x23)&nbsp;#&nbsp;send&nbsp;byte&nbsp;0x23&nbsp;to&nbsp;device&nbsp;2<br></code><h3><a name="i2c_write_byte_data">i2c_write_byte_data<small>(<a href="#handle">handle</a>, <a href="#reg">reg</a>, <a href="#byte_val">byte_val</a>)</small></h3>
-Writes a single byte to the specified register of the device
-associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reg:=&nbsp;&gt;=0,&nbsp;the&nbsp;device&nbsp;register.<br>byte_val:=&nbsp;0-255,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></samp><br><br>SMBus 2.0 5.5.4 - Write byte.
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;reg&nbsp;[A]&nbsp;byte_val&nbsp;[A]&nbsp;P<br></code><br><br><b><small>Example</small></b><br><br><code>#&nbsp;send&nbsp;byte&nbsp;0xC5&nbsp;to&nbsp;reg&nbsp;2&nbsp;of&nbsp;device&nbsp;1<br>pi.i2c_write_byte_data(1,&nbsp;2,&nbsp;0xC5)<br><br>#&nbsp;send&nbsp;byte&nbsp;9&nbsp;to&nbsp;reg&nbsp;4&nbsp;of&nbsp;device&nbsp;2<br>pi.i2c_write_byte_data(2,&nbsp;4,&nbsp;9)<br></code><h3><a name="i2c_write_device">i2c_write_device<small>(<a href="#handle">handle</a>, <a href="#data">data</a>)</small></h3>
-Writes the data bytes to the raw device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;data:=&nbsp;the&nbsp;bytes&nbsp;to&nbsp;write.<br></samp><br><br><code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;data0&nbsp;[A]&nbsp;data1&nbsp;[A]&nbsp;...&nbsp;[A]&nbsp;datan&nbsp;[A]&nbsp;P<br></code><br><br><b><small>Example</small></b><br><br><code>pi.i2c_write_device(h,&nbsp;b"\x12\x34\xA8")<br><br>pi.i2c_write_device(h,&nbsp;b"help")<br><br>pi.i2c_write_device(h,&nbsp;'help')<br><br>pi.i2c_write_device(h,&nbsp;[23,&nbsp;56,&nbsp;231])<br></code><h3><a name="i2c_write_i2c_block_data">i2c_write_i2c_block_data<small>(<a href="#handle">handle</a>, <a href="#reg">reg</a>, <a href="#data">data</a>)</small></h3>
-Writes data bytes to the specified register of the device
-associated with handle . 1-32 bytes may be written.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;&nbsp;reg:=&nbsp;&gt;=0,&nbsp;the&nbsp;device&nbsp;register.<br>&nbsp;&nbsp;data:=&nbsp;the&nbsp;bytes&nbsp;to&nbsp;write.<br></samp><br><br><code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;reg&nbsp;[A]&nbsp;data0&nbsp;[A]&nbsp;data1&nbsp;[A]&nbsp;...&nbsp;[A]&nbsp;datan&nbsp;[NA]&nbsp;P<br></code><br><br><b><small>Example</small></b><br><br><code>pi.i2c_write_i2c_block_data(4,&nbsp;5,&nbsp;'hello')<br><br>pi.i2c_write_i2c_block_data(4,&nbsp;5,&nbsp;b'hello')<br><br>pi.i2c_write_i2c_block_data(5,&nbsp;0,&nbsp;b'\x00\x01\x22')<br><br>pi.i2c_write_i2c_block_data(6,&nbsp;2,&nbsp;[0,&nbsp;1,&nbsp;0x22])<br></code><h3><a name="i2c_write_quick">i2c_write_quick<small>(<a href="#handle">handle</a>, <a href="#bit">bit</a>)</small></h3>
-Sends a single bit to the device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;&nbsp;bit:=&nbsp;0&nbsp;or&nbsp;1,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></samp><br><br>SMBus 2.0 5.5.1 - Quick command.
-<code>S&nbsp;Addr&nbsp;bit&nbsp;[A]&nbsp;P<br></code><br><br><b><small>Example</small></b><br><br><code>pi.i2c_write_quick(0,&nbsp;1)&nbsp;#&nbsp;send&nbsp;1&nbsp;to&nbsp;device&nbsp;0<br>pi.i2c_write_quick(3,&nbsp;0)&nbsp;#&nbsp;send&nbsp;0&nbsp;to&nbsp;device&nbsp;3<br></code><h3><a name="i2c_write_word_data">i2c_write_word_data<small>(<a href="#handle">handle</a>, <a href="#reg">reg</a>, <a href="#word_val">word_val</a>)</small></h3>
-Writes a single 16 bit word to the specified register of the
-device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reg:=&nbsp;&gt;=0,&nbsp;the&nbsp;device&nbsp;register.<br>word_val:=&nbsp;0-65535,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></samp><br><br>SMBus 2.0 5.5.4 - Write word.
-<code>S&nbsp;Addr&nbsp;Wr&nbsp;[A]&nbsp;reg&nbsp;[A]&nbsp;word_val_Low&nbsp;[A]&nbsp;word_val_High&nbsp;[A]&nbsp;P<br></code><br><br><b><small>Example</small></b><br><br><code>#&nbsp;send&nbsp;word&nbsp;0xA0C5&nbsp;to&nbsp;reg&nbsp;5&nbsp;of&nbsp;device&nbsp;4<br>pi.i2c_write_word_data(4,&nbsp;5,&nbsp;0xA0C5)<br><br>#&nbsp;send&nbsp;word&nbsp;2&nbsp;to&nbsp;reg&nbsp;2&nbsp;of&nbsp;device&nbsp;5<br>pi.i2c_write_word_data(5,&nbsp;2,&nbsp;23)<br></code><h3><a name="i2c_zip">i2c_zip<small>(<a href="#handle">handle</a>, <a href="#data">data</a>)</small></h3>
-This function executes a sequence of I2C operations. The
-operations to be performed are specified by the contents of data
-which contains the concatenated command codes and associated data.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#i2c_open">i2c_open</a>).<br>&nbsp;&nbsp;data:=&nbsp;the&nbsp;concatenated&nbsp;I2C&nbsp;commands,&nbsp;see&nbsp;below<br></samp><br><br>The returned value is a tuple of the number of bytes read and a
-bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br><b><small>Example</small></b><br><br><code>(count,&nbsp;data)&nbsp;=&nbsp;pi.i2c_zip(h,&nbsp;[4,&nbsp;0x53,&nbsp;7,&nbsp;1,&nbsp;0x32,&nbsp;6,&nbsp;6,&nbsp;0])<br></code><br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>End</td><td>0</td><td>No more commands</td></tr><tr><td>Escape</td><td>1</td><td>Next P is two bytes</td></tr><tr><td>On</td><td>2</td><td>Switch combined flag on</td></tr><tr><td>Off</td><td>3</td><td>Switch combined flag off</td></tr><tr><td>Address</td><td>4 P</td><td>Set I2C address to P</td></tr><tr><td>Flags</td><td>5 lsb msb</td><td>Set I2C flags to lsb + (msb &lt;&lt; 8)</td></tr><tr><td>Read</td><td>6 P</td><td>Read P bytes of data</td></tr><tr><td>Write</td><td>7 P ...</td><td>Write P bytes of data</td></tr></tbody></table><br><br>The address, read, and write commands take a parameter P.
-Normally P is one byte (0-255). If the command is preceded by
-the Escape command then P is two bytes (0-65535, least significant
-byte first).
-<br><br>The address defaults to that associated with the handle.
-The flags default to 0. The address and flags maintain their
-previous value until updated.
-<br><br>Any read I2C data is concatenated in the returned bytearray.
-<br><br><b><small>Example</small></b><br><br><code>Set&nbsp;address&nbsp;0x53,&nbsp;write&nbsp;0x32,&nbsp;read&nbsp;6&nbsp;bytes<br>Set&nbsp;address&nbsp;0x1E,&nbsp;write&nbsp;0x03,&nbsp;read&nbsp;6&nbsp;bytes<br>Set&nbsp;address&nbsp;0x68,&nbsp;write&nbsp;0x1B,&nbsp;read&nbsp;8&nbsp;bytes<br>End<br><br>0x04&nbsp;0x53&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x32&nbsp;&nbsp;&nbsp;0x06&nbsp;0x06<br>0x04&nbsp;0x1E&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x03&nbsp;&nbsp;&nbsp;0x06&nbsp;0x06<br>0x04&nbsp;0x68&nbsp;&nbsp;&nbsp;0x07&nbsp;0x01&nbsp;0x1B&nbsp;&nbsp;&nbsp;0x06&nbsp;0x08<br>0x00<br></code><h3><a name="notify_begin">notify_begin<small>(<a href="#handle">handle</a>, <a href="#bits">bits</a>)</small></h3>
-Starts notifications on a handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#notify_open">notify_open</a>)<br>&nbsp;&nbsp;bits:=&nbsp;a&nbsp;32&nbsp;bit&nbsp;mask&nbsp;indicating&nbsp;the&nbsp;GPIO&nbsp;to&nbsp;be&nbsp;notified.<br></samp><br><br>The notification sends state changes for each GPIO whose
-corresponding bit in bits is set.
-<br><br>The following code starts notifications for GPIO 1, 4,
-6, 7, and 10 (1234 = 0x04D2 = 0b0000010011010010).
-<br><br><b><small>Example</small></b><br><br><code>h&nbsp;=&nbsp;pi.notify_open()<br>if&nbsp;h&nbsp;&gt;=&nbsp;0:<br>&nbsp;&nbsp;&nbsp;pi.notify_begin(h,&nbsp;1234)<br></code><h3><a name="notify_close">notify_close<small>(<a href="#handle">handle</a>)</small></h3>
-Stops notifications on a handle and releases the handle for reuse.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#notify_open">notify_open</a>)<br></samp><br><br><b><small>Example</small></b><br><br><code>h&nbsp;=&nbsp;pi.notify_open()<br>if&nbsp;h&nbsp;&gt;=&nbsp;0:<br>&nbsp;&nbsp;&nbsp;pi.notify_begin(h,&nbsp;1234)<br>&nbsp;&nbsp;&nbsp;...<br>&nbsp;&nbsp;&nbsp;pi.notify_close(h)<br>&nbsp;&nbsp;&nbsp;...<br></code><h3><a name="notify_open">notify_open<small>()</small></h3>
-Returns a notification handle (&gt;=0).
-<br><br>A notification is a method for being notified of GPIO state
-changes via a pipe.
-<br><br>Pipes are only accessible from the local machine so this
-function serves no purpose if you are using Python from a
-remote machine. The in-built (socket) notifications
-provided by <a href="#callback">callback</a> should be used instead.
-<br><br>Notifications for handle x will be available at the pipe
-named /dev/pigpiox (where x is the handle number).
-<br><br>E.g. if the function returns 15 then the notifications must be
-read from /dev/pigpio15.
-<br><br>Notifications have the following structure:
-<br><br><code>H&nbsp;seqno<br>H&nbsp;flags<br>I&nbsp;tick<br>I&nbsp;level<br></code><br><br>seqno: starts at 0 each time the handle is opened and then
-increments by one for each report.
-<br><br>flags: three flags are defined, PI_NTFY_FLAGS_WDOG,
-PI_NTFY_FLAGS_ALIVE, and PI_NTFY_FLAGS_EVENT.
-<br><br>If bit 5 is set (PI_NTFY_FLAGS_WDOG) then bits 0-4 of the
-flags indicate a GPIO which has had a watchdog timeout.
-<br><br>If bit 6 is set (PI_NTFY_FLAGS_ALIVE) this indicates a keep
-alive signal on the pipe/socket and is sent once a minute
-in the absence of other notification activity.
-<br><br>If bit 7 is set (PI_NTFY_FLAGS_EVENT) then bits 0-4 of the
-flags indicate an event which has been triggered.
-<br><br>tick: the number of microseconds since system boot. It wraps
-around after 1h12m.
-<br><br>level: indicates the level of each GPIO. If bit 1&lt;&lt;x is set
-then GPIO x is high.
-<br><br><b><small>Example</small></b><br><br><code>h&nbsp;=&nbsp;pi.notify_open()<br>if&nbsp;h&nbsp;&gt;=&nbsp;0:<br>&nbsp;&nbsp;&nbsp;pi.notify_begin(h,&nbsp;1234)<br></code><h3><a name="notify_pause">notify_pause<small>(<a href="#handle">handle</a>)</small></h3>
-Pauses notifications on a handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#notify_open">notify_open</a>)<br></samp><br><br>Notifications for the handle are suspended until
-<a href="#notify_begin">notify_begin</a> is called again.
-<br><br><b><small>Example</small></b><br><br><code>h&nbsp;=&nbsp;pi.notify_open()<br>if&nbsp;h&nbsp;&gt;=&nbsp;0:<br>&nbsp;&nbsp;&nbsp;pi.notify_begin(h,&nbsp;1234)<br>&nbsp;&nbsp;&nbsp;...<br>&nbsp;&nbsp;&nbsp;pi.notify_pause(h)<br>&nbsp;&nbsp;&nbsp;...<br>&nbsp;&nbsp;&nbsp;pi.notify_begin(h,&nbsp;1234)<br>&nbsp;&nbsp;&nbsp;...<br></code><h3><a name="read">read<small>(<a href="#gpio">gpio</a>)</small></h3>
-Returns the GPIO level.
-<br><br><b><small>Parameters</small></b><br><br><samp>gpio:=&nbsp;0-53.<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.set_mode(23,&nbsp;pigpio.INPUT)<br><br>pi.set_pull_up_down(23,&nbsp;pigpio.PUD_DOWN)<br>print(pi.read(23))<br>0<br><br>pi.set_pull_up_down(23,&nbsp;pigpio.PUD_UP)<br>print(pi.read(23))<br>1<br></code><h3><a name="read_bank_1">read_bank_1<small>()</small></h3>
-Returns the levels of the bank 1 GPIO (GPIO 0-31).
-<br><br>The returned 32 bit integer has a bit set if the corresponding
-GPIO is high. GPIO n has bit value (1&lt;&lt;n).
-<br><br><b><small>Example</small></b><br><br><code>print(bin(pi.read_bank_1()))<br>0b10010100000011100100001001111<br></code><h3><a name="read_bank_2">read_bank_2<small>()</small></h3>
-Returns the levels of the bank 2 GPIO (GPIO 32-53).
-<br><br>The returned 32 bit integer has a bit set if the corresponding
-GPIO is high. GPIO n has bit value (1&lt;&lt;(n-32)).
-<br><br><b><small>Example</small></b><br><br><code>print(bin(pi.read_bank_2()))<br>0b1111110000000000000000<br></code><h3><a name="run_script">run_script<small>(<a href="#script_id">script_id</a>, <a href="#params">params</a>)</small></h3>
-Runs a stored script.
-<br><br><b><small>Parameters</small></b><br><br><samp>script_id:=&nbsp;id&nbsp;of&nbsp;stored&nbsp;script.<br>&nbsp;&nbsp;&nbsp;params:=&nbsp;up&nbsp;to&nbsp;10&nbsp;parameters&nbsp;required&nbsp;by&nbsp;the&nbsp;script.<br></samp><br><br><b><small>Example</small></b><br><br><code>s&nbsp;=&nbsp;pi.run_script(sid,&nbsp;[par1,&nbsp;par2])<br><br>s&nbsp;=&nbsp;pi.run_script(sid)<br><br>s&nbsp;=&nbsp;pi.run_script(sid,&nbsp;[1,&nbsp;2,&nbsp;3,&nbsp;4,&nbsp;5,&nbsp;6,&nbsp;7,&nbsp;8,&nbsp;9,&nbsp;10])<br></code><h3><a name="script_status">script_status<small>(<a href="#script_id">script_id</a>)</small></h3>
-Returns the run status of a stored script as well as the
-current values of parameters 0 to 9.
-<br><br><b><small>Parameters</small></b><br><br><samp>script_id:=&nbsp;id&nbsp;of&nbsp;stored&nbsp;script.<br></samp><br><br>The run status may be
-<br><br><code>PI_SCRIPT_INITING<br>PI_SCRIPT_HALTED<br>PI_SCRIPT_RUNNING<br>PI_SCRIPT_WAITING<br>PI_SCRIPT_FAILED<br></code><br><br>The return value is a tuple of run status and a list of
-the 10 parameters. On error the run status will be negative
-and the parameter list will be empty.
-<br><br><b><small>Example</small></b><br><br><code>(s,&nbsp;pars)&nbsp;=&nbsp;pi.script_status(sid)<br></code><h3><a name="serial_close">serial_close<small>(<a href="#handle">handle</a>)</small></h3>
-Closes the serial device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>).<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.serial_close(h1)<br></code><h3><a name="serial_data_available">serial_data_available<small>(<a href="#handle">handle</a>)</small></h3>
-Returns the number of bytes available to be read from the
-device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>).<br></samp><br><br><b><small>Example</small></b><br><br><code>rdy&nbsp;=&nbsp;pi.serial_data_available(h1)<br><br>if&nbsp;rdy&nbsp;&gt;&nbsp;0:<br>&nbsp;&nbsp;&nbsp;(b,&nbsp;d)&nbsp;=&nbsp;pi.serial_read(h1,&nbsp;rdy)<br></code><h3><a name="serial_open">serial_open<small>(<a href="#tty">tty</a>, <a href="#baud">baud</a>, <a href="#ser_flags">ser_flags</a>)</small></h3>
-Returns a handle for the serial tty device opened
-at baud bits per second. The device name must start
-with /dev/tty or /dev/serial.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tty:=&nbsp;the&nbsp;serial&nbsp;device&nbsp;to&nbsp;open.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:=&nbsp;baud&nbsp;rate&nbsp;in&nbsp;bits&nbsp;per&nbsp;second,&nbsp;see&nbsp;below.<br>ser_flags:=&nbsp;0,&nbsp;no&nbsp;flags&nbsp;are&nbsp;currently&nbsp;defined.<br></samp><br><br>Normally you would only use the <a href="#serial_*">serial_*</a> functions if
-you are or will be connecting to the Pi over a network. If
-you will always run on the local Pi use the standard serial
-module instead.
-<br><br>The baud rate must be one of 50, 75, 110, 134, 150,
-200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
-38400, 57600, 115200, or 230400.
-<br><br><b><small>Example</small></b><br><br><code>h1&nbsp;=&nbsp;pi.serial_open("/dev/ttyAMA0",&nbsp;300)<br><br>h2&nbsp;=&nbsp;pi.serial_open("/dev/ttyUSB1",&nbsp;19200,&nbsp;0)<br><br>h3&nbsp;=&nbsp;pi.serial_open("/dev/serial0",&nbsp;9600)<br></code><h3><a name="serial_read">serial_read<small>(<a href="#handle">handle</a>, <a href="#count">count</a>)</small></h3>
-Reads up to count bytes from the device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>).<br>&nbsp;count:=&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read&nbsp;(defaults&nbsp;to&nbsp;1000).<br></samp><br><br>The returned value is a tuple of the number of bytes read and
-a bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br>If no data is ready a bytes read of zero is returned.
-<b><small>Example</small></b><br><br><code>(b,&nbsp;d)&nbsp;=&nbsp;pi.serial_read(h2,&nbsp;100)<br>if&nbsp;b&nbsp;&gt;&nbsp;0:<br>&nbsp;&nbsp;&nbsp;#&nbsp;process&nbsp;read&nbsp;data<br></code><h3><a name="serial_read_byte">serial_read_byte<small>(<a href="#handle">handle</a>)</small></h3>
-Returns a single byte from the device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>).<br></samp><br><br>If no data is ready a negative error code will be returned.
-<br><br><b><small>Example</small></b><br><br><code>b&nbsp;=&nbsp;pi.serial_read_byte(h1)<br></code><h3><a name="serial_write">serial_write<small>(<a href="#handle">handle</a>, <a href="#data">data</a>)</small></h3>
-Writes the data bytes to the device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>).<br>&nbsp;&nbsp;data:=&nbsp;the&nbsp;bytes&nbsp;to&nbsp;write.<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.serial_write(h1,&nbsp;b'\x02\x03\x04')<br><br>pi.serial_write(h2,&nbsp;b'help')<br><br>pi.serial_write(h2,&nbsp;"hello")<br><br>pi.serial_write(h1,&nbsp;[2,&nbsp;3,&nbsp;4])<br></code><h3><a name="serial_write_byte">serial_write_byte<small>(<a href="#handle">handle</a>, <a href="#byte_val">byte_val</a>)</small></h3>
-Writes a single byte to the device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#serial_open">serial_open</a>).<br>byte_val:=&nbsp;0-255,&nbsp;the&nbsp;value&nbsp;to&nbsp;write.<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.serial_write_byte(h1,&nbsp;23)<br><br>pi.serial_write_byte(h1,&nbsp;ord('Z'))<br></code><h3><a name="set_PWM_dutycycle">set_PWM_dutycycle<small>(<a href="#user_gpio">user_gpio</a>, <a href="#dutycycle">dutycycle</a>)</small></h3>
-Starts (non-zero dutycycle) or stops (0) PWM pulses on the GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31.<br>dutycycle:=&nbsp;0-range&nbsp;(range&nbsp;defaults&nbsp;to&nbsp;255).<br></samp><br><br>The <a href="#set_PWM_range">set_PWM_range</a> function can change the default range of 255.
-<br><br><b><small>Example</small></b><br><br><code>pi.set_PWM_dutycycle(4,&nbsp;&nbsp;&nbsp;0)&nbsp;#&nbsp;PWM&nbsp;off<br>pi.set_PWM_dutycycle(4,&nbsp;&nbsp;64)&nbsp;#&nbsp;PWM&nbsp;1/4&nbsp;on<br>pi.set_PWM_dutycycle(4,&nbsp;128)&nbsp;#&nbsp;PWM&nbsp;1/2&nbsp;on<br>pi.set_PWM_dutycycle(4,&nbsp;192)&nbsp;#&nbsp;PWM&nbsp;3/4&nbsp;on<br>pi.set_PWM_dutycycle(4,&nbsp;255)&nbsp;#&nbsp;PWM&nbsp;full&nbsp;on<br></code><h3><a name="set_PWM_frequency">set_PWM_frequency<small>(<a href="#user_gpio">user_gpio</a>, <a href="#frequency">frequency</a>)</small></h3>
-Sets the frequency (in Hz) of the PWM to be used on the GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31.<br>frequency:=&nbsp;&gt;=0&nbsp;Hz<br></samp><br><br>Returns the numerically closest frequency if OK, otherwise
-PI_BAD_USER_GPIO or PI_NOT_PERMITTED.
-<br><br>If PWM is currently active on the GPIO it will be switched
-off and then back on at the new frequency.
-<br><br>Each GPIO can be independently set to one of 18 different
-PWM frequencies.
-<br><br>The selectable frequencies depend upon the sample rate which
-may be 1, 2, 4, 5, 8, or 10 microseconds (default 5). The
-sample rate is set when the pigpio daemon is started.
-<br><br>The frequencies for each sample rate are:
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hertz<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1:&nbsp;40000&nbsp;20000&nbsp;10000&nbsp;8000&nbsp;5000&nbsp;4000&nbsp;2500&nbsp;2000&nbsp;1600<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1250&nbsp;&nbsp;1000&nbsp;&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;50<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2:&nbsp;20000&nbsp;10000&nbsp;&nbsp;5000&nbsp;4000&nbsp;2500&nbsp;2000&nbsp;1250&nbsp;1000&nbsp;&nbsp;800<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;625&nbsp;&nbsp;&nbsp;500&nbsp;&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;125&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;25<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4:&nbsp;10000&nbsp;&nbsp;5000&nbsp;&nbsp;2500&nbsp;2000&nbsp;1250&nbsp;1000&nbsp;&nbsp;625&nbsp;&nbsp;500&nbsp;&nbsp;400<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;313&nbsp;&nbsp;&nbsp;250&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;125&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;63&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;13<br>sample<br>&nbsp;rate<br>&nbsp;(us)&nbsp;&nbsp;5:&nbsp;&nbsp;8000&nbsp;&nbsp;4000&nbsp;&nbsp;2000&nbsp;1600&nbsp;1000&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;320<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;250&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;&nbsp;160&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;80&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;&nbsp;20&nbsp;&nbsp;&nbsp;10<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8:&nbsp;&nbsp;5000&nbsp;&nbsp;2500&nbsp;&nbsp;1250&nbsp;1000&nbsp;&nbsp;625&nbsp;&nbsp;500&nbsp;&nbsp;313&nbsp;&nbsp;250&nbsp;&nbsp;200<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;156&nbsp;&nbsp;&nbsp;125&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;63&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;31&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;13&nbsp;&nbsp;&nbsp;&nbsp;6<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10:&nbsp;&nbsp;4000&nbsp;&nbsp;2000&nbsp;&nbsp;1000&nbsp;&nbsp;800&nbsp;&nbsp;500&nbsp;&nbsp;400&nbsp;&nbsp;250&nbsp;&nbsp;200&nbsp;&nbsp;160<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;125&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;&nbsp;80&nbsp;&nbsp;&nbsp;50&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;&nbsp;25&nbsp;&nbsp;&nbsp;20&nbsp;&nbsp;&nbsp;10&nbsp;&nbsp;&nbsp;&nbsp;5<br></code><br><br><b><small>Example</small></b><br><br><code>pi.set_PWM_frequency(4,0)<br>print(pi.get_PWM_frequency(4))<br>10<br><br>pi.set_PWM_frequency(4,100000)<br>print(pi.get_PWM_frequency(4))<br>8000<br></code><h3><a name="set_PWM_range">set_PWM_range<small>(<a href="#user_gpio">user_gpio</a>, <a href="#range_">range_</a>)</small></h3>
-Sets the range of PWM values to be used on the GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;range_:=&nbsp;25-40000.<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.set_PWM_range(9,&nbsp;100)&nbsp;&nbsp;#&nbsp;now&nbsp;&nbsp;25&nbsp;1/4,&nbsp;&nbsp;&nbsp;50&nbsp;1/2,&nbsp;&nbsp;&nbsp;75&nbsp;3/4&nbsp;on<br>pi.set_PWM_range(9,&nbsp;500)&nbsp;&nbsp;#&nbsp;now&nbsp;125&nbsp;1/4,&nbsp;&nbsp;250&nbsp;1/2,&nbsp;&nbsp;375&nbsp;3/4&nbsp;on<br>pi.set_PWM_range(9,&nbsp;3000)&nbsp;#&nbsp;now&nbsp;750&nbsp;1/4,&nbsp;1500&nbsp;1/2,&nbsp;2250&nbsp;3/4&nbsp;on<br></code><h3><a name="set_bank_1">set_bank_1<small>(<a href="#bits">bits</a>)</small></h3>
-Sets GPIO 0-31 if the corresponding bit in bits is set.
-<br><br><b><small>Parameters</small></b><br><br><samp>bits:=&nbsp;a&nbsp;32&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;set.<br></samp><br><br>A returned status of PI_SOME_PERMITTED indicates that the user
-is not allowed to write to one or more of the GPIO.
-<br><br><b><small>Example</small></b><br><br><code>pi.set_bank_1(int("111110010000",2))<br></code><h3><a name="set_bank_2">set_bank_2<small>(<a href="#bits">bits</a>)</small></h3>
-Sets GPIO 32-53 if the corresponding bit (0-21) in bits is set.
-<br><br><b><small>Parameters</small></b><br><br><samp>bits:=&nbsp;a&nbsp;32&nbsp;bit&nbsp;mask&nbsp;with&nbsp;1&nbsp;set&nbsp;if&nbsp;the&nbsp;corresponding&nbsp;GPIO&nbsp;is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;be&nbsp;set.<br></samp><br><br>A returned status of PI_SOME_PERMITTED indicates that the user
-is not allowed to write to one or more of the GPIO.
-<br><br><b><small>Example</small></b><br><br><code>pi.set_bank_2(0x303)<br></code><h3><a name="set_glitch_filter">set_glitch_filter<small>(<a href="#user_gpio">user_gpio</a>, <a href="#steady">steady</a>)</small></h3>
-Sets a glitch filter on a GPIO.
-<br><br>Level changes on the GPIO are not reported unless the level
-has been stable for at least <a href="#steady">steady</a> microseconds. The
-level is then reported. Level changes of less than <a href="#steady">steady</a>
-microseconds are ignored.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;steady:=&nbsp;0-300000<br></samp><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
-<br><br>This filter affects the GPIO samples returned to callbacks set up
-with <a href="#callback">callback</a> and <a href="#wait_for_edge">wait_for_edge</a>.
-<br><br>It does not affect levels read by <a href="#read">read</a>,
-<a href="#read_bank_1">read_bank_1</a>, or <a href="#read_bank_2">read_bank_2</a>.
-<br><br>Each (stable) edge will be timestamped <a href="#steady">steady</a>
-microseconds after it was first detected.
-<br><br><b><small>Example</small></b><br><br><code>pi.set_glitch_filter(23,&nbsp;100)<br></code><h3><a name="set_mode">set_mode<small>(<a href="#gpio">gpio</a>, <a href="#mode">mode</a>)</small></h3>
-Sets the GPIO mode.
-<br><br><b><small>Parameters</small></b><br><br><samp>gpio:=&nbsp;0-53.<br>mode:=&nbsp;INPUT,&nbsp;OUTPUT,&nbsp;ALT0,&nbsp;ALT1,&nbsp;ALT2,&nbsp;ALT3,&nbsp;ALT4,&nbsp;ALT5.<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.set_mode(&nbsp;4,&nbsp;pigpio.INPUT)&nbsp;&nbsp;#&nbsp;GPIO&nbsp;&nbsp;4&nbsp;as&nbsp;input<br>pi.set_mode(17,&nbsp;pigpio.OUTPUT)&nbsp;#&nbsp;GPIO&nbsp;17&nbsp;as&nbsp;output<br>pi.set_mode(24,&nbsp;pigpio.ALT2)&nbsp;&nbsp;&nbsp;#&nbsp;GPIO&nbsp;24&nbsp;as&nbsp;ALT2<br></code><h3><a name="set_noise_filter">set_noise_filter<small>(<a href="#user_gpio">user_gpio</a>, <a href="#steady">steady</a>, <a href="#active">active</a>)</small></h3>
-Sets a noise filter on a GPIO.
-<br><br>Level changes on the GPIO are ignored until a level which has
-been stable for <a href="#steady">steady</a> microseconds is detected. Level
-changes on the GPIO are then reported for <a href="#active">active</a>
-microseconds after which the process repeats.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;0-31<br>&nbsp;&nbsp;&nbsp;steady:=&nbsp;0-300000<br>&nbsp;&nbsp;&nbsp;active:=&nbsp;0-1000000<br></samp><br><br>Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
-<br><br>This filter affects the GPIO samples returned to callbacks set up
-with <a href="#callback">callback</a> and <a href="#wait_for_edge">wait_for_edge</a>.
-<br><br>It does not affect levels read by <a href="#read">read</a>,
-<a href="#read_bank_1">read_bank_1</a>, or <a href="#read_bank_2">read_bank_2</a>.
-<br><br>Level changes before and after the active period may
-be reported. Your software must be designed to cope with
-such reports.
-<br><br><b><small>Example</small></b><br><br><code>pi.set_noise_filter(23,&nbsp;1000,&nbsp;5000)<br></code><h3><a name="set_pad_strength">set_pad_strength<small>(<a href="#pad">pad</a>, <a href="#pad_strength">pad_strength</a>)</small></h3>
-This function sets the pad drive strength in mA.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pad:=&nbsp;0-2,&nbsp;the&nbsp;pad&nbsp;to&nbsp;set.<br>pad_strength:=&nbsp;1-16&nbsp;mA.<br></samp><br><br>Returns 0 if OK, otherwise PI_BAD_PAD, or PI_BAD_STRENGTH.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>pi.set_pad_strength(2,&nbsp;14)&nbsp;#&nbsp;Set&nbsp;pad&nbsp;2&nbsp;to&nbsp;14&nbsp;mA.<br></code><h3><a name="set_pull_up_down">set_pull_up_down<small>(<a href="#gpio">gpio</a>, <a href="#pud">pud</a>)</small></h3>
-Sets or clears the internal GPIO pull-up/down resistor.
-<br><br><b><small>Parameters</small></b><br><br><samp>gpio:=&nbsp;0-53.<br>&nbsp;pud:=&nbsp;PUD_UP,&nbsp;PUD_DOWN,&nbsp;PUD_OFF.<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.set_pull_up_down(17,&nbsp;pigpio.PUD_OFF)<br>pi.set_pull_up_down(23,&nbsp;pigpio.PUD_UP)<br>pi.set_pull_up_down(24,&nbsp;pigpio.PUD_DOWN)<br></code><h3><a name="set_servo_pulsewidth">set_servo_pulsewidth<small>(<a href="#user_gpio">user_gpio</a>, <a href="#pulsewidth">pulsewidth</a>)</small></h3>
-Starts (500-2500) or stops (0) servo pulses on the GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;user_gpio:=&nbsp;0-31.<br>pulsewidth:=&nbsp;0&nbsp;(off),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;500&nbsp;(most&nbsp;anti-clockwise)&nbsp;-&nbsp;2500&nbsp;(most&nbsp;clockwise).<br></samp><br><br>The selected pulsewidth will continue to be transmitted until
-changed by a subsequent call to set_servo_pulsewidth.
-<br><br>The pulsewidths supported by servos varies and should probably
-be determined by experiment. A value of 1500 should always be
-safe and represents the mid-point of rotation.
-<br><br>You can DAMAGE a servo if you command it to move beyond its
-limits.
-<br><br><b><small>Example</small></b><br><br><code>pi.set_servo_pulsewidth(17,&nbsp;0)&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;off<br>pi.set_servo_pulsewidth(17,&nbsp;1000)&nbsp;#&nbsp;safe&nbsp;anti-clockwise<br>pi.set_servo_pulsewidth(17,&nbsp;1500)&nbsp;#&nbsp;centre<br>pi.set_servo_pulsewidth(17,&nbsp;2000)&nbsp;#&nbsp;safe&nbsp;clockwise<br></code><h3><a name="set_watchdog">set_watchdog<small>(<a href="#user_gpio">user_gpio</a>, <a href="#wdog_timeout">wdog_timeout</a>)</small></h3>
-Sets a watchdog timeout for a GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;&nbsp;user_gpio:=&nbsp;0-31.<br>wdog_timeout:=&nbsp;0-60000.<br></samp><br><br>The watchdog is nominally in milliseconds.
-<br><br>Only one watchdog may be registered per GPIO.
-<br><br>The watchdog may be cancelled by setting timeout to 0.
-<br><br>Once a watchdog has been started callbacks for the GPIO
-will be triggered every timeout interval after the last
-GPIO activity.
-<br><br>The callback will receive the special level TIMEOUT.
-<br><br><b><small>Example</small></b><br><br><code>pi.set_watchdog(23,&nbsp;1000)&nbsp;#&nbsp;1000&nbsp;ms&nbsp;watchdog&nbsp;on&nbsp;GPIO&nbsp;23<br>pi.set_watchdog(23,&nbsp;0)&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;cancel&nbsp;watchdog&nbsp;on&nbsp;GPIO&nbsp;23<br></code><h3><a name="shell">shell<small>(<a href="#shellscr">shellscr</a>, <a href="#pstring">pstring</a>)</small></h3>
-This function uses the system call to execute a shell script
-with the given string as its parameter.
-<br><br><b><small>Parameters</small></b><br><br><samp>shellscr:=&nbsp;the&nbsp;name&nbsp;of&nbsp;the&nbsp;script,&nbsp;only&nbsp;alphanumerics,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'-'&nbsp;and&nbsp;'_'&nbsp;are&nbsp;allowed&nbsp;in&nbsp;the&nbsp;name<br>pstring&nbsp;:=&nbsp;the&nbsp;parameter&nbsp;string&nbsp;to&nbsp;pass&nbsp;to&nbsp;the&nbsp;script<br></samp><br><br>The exit status of the system call is returned if OK,
-otherwise PI_BAD_SHELL_STATUS.
-<br><br><a href="#shellscr">shellscr</a> must exist in /opt/pigpio/cgi and must be executable.
-<br><br>The returned exit status is normally 256 times that set by
-the shell script exit function. If the script can't be
-found 32512 will be returned.
-<br><br>The following table gives some example returned statuses:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Script exit status</td><td>Returned system call status</td></tr><tr><td>1</td><td>256</td></tr><tr><td>5</td><td>1280</td></tr><tr><td>10</td><td>2560</td></tr><tr><td>200</td><td>51200</td></tr><tr><td>script not found</td><td>32512</td></tr></tbody></table><br><br><b><small>Example</small></b><br><br><code>//&nbsp;pass&nbsp;two&nbsp;parameters,&nbsp;hello&nbsp;and&nbsp;world<br>status&nbsp;=&nbsp;pi.shell("scr1",&nbsp;"hello&nbsp;world");<br><br>//&nbsp;pass&nbsp;three&nbsp;parameters,&nbsp;hello,&nbsp;string&nbsp;with&nbsp;spaces,&nbsp;and&nbsp;world<br>status&nbsp;=&nbsp;pi.shell("scr1",&nbsp;"hello&nbsp;'string&nbsp;with&nbsp;spaces'&nbsp;world");<br><br>//&nbsp;pass&nbsp;one&nbsp;parameter,&nbsp;hello&nbsp;string&nbsp;with&nbsp;spaces&nbsp;world<br>status&nbsp;=&nbsp;pi.shell("scr1",&nbsp;"\"hello&nbsp;string&nbsp;with&nbsp;spaces&nbsp;world\"");<br></code><h3><a name="spi_close">spi_close<small>(<a href="#handle">handle</a>)</small></h3>
-Closes the SPI device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>).<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.spi_close(h)<br></code><h3><a name="spi_open">spi_open<small>(<a href="#spi_channel">spi_channel</a>, <a href="#baud">baud</a>, <a href="#spi_flags">spi_flags</a>)</small></h3>
-Returns a handle for the SPI device on the channel. Data
-will be transferred at baud bits per second. The flags
-may be used to modify the default behaviour of 4-wire
-operation, mode 0, active low chip select.
-<br><br>The Pi has two SPI peripherals: main and auxiliary.
-<br><br>The main SPI has two chip selects (channels), the auxiliary
-has three.
-<br><br>The auxiliary SPI is available on all models but the A and B.
-<br><br>The GPIO used are given in the following table.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td></td><td>MISO</td><td>MOSI</td><td>SCLK</td><td>CE0</td><td>CE1</td><td>CE2</td></tr><tr><td>Main SPI</td><td>9</td><td>10</td><td>11</td><td>8</td><td>7</td><td>-</td></tr><tr><td>Aux SPI</td><td>19</td><td>20</td><td>21</td><td>18</td><td>17</td><td>16</td></tr></tbody></table><br><br><b><small>Parameters</small></b><br><br><samp>spi_channel:=&nbsp;0-1&nbsp;(0-2&nbsp;for&nbsp;the&nbsp;auxiliary&nbsp;SPI).<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:=&nbsp;32K-125M&nbsp;(values&nbsp;above&nbsp;30M&nbsp;are&nbsp;unlikely&nbsp;to&nbsp;work).<br>&nbsp;&nbsp;spi_flags:=&nbsp;see&nbsp;below.<br></samp><br><br>spi_flags consists of the least significant 22 bits.
-<br><br><code>21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;b&nbsp;&nbsp;R&nbsp;&nbsp;T&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;n&nbsp;&nbsp;W&nbsp;&nbsp;A&nbsp;u2&nbsp;u1&nbsp;u0&nbsp;p2&nbsp;p1&nbsp;p0&nbsp;&nbsp;m&nbsp;&nbsp;m<br></code><br><br>mm defines the SPI mode.
-<br><br>WARNING: modes 1 and 3 do not appear to work on
-the auxiliary SPI.
-<br><br><code>Mode&nbsp;POL&nbsp;PHA<br>&nbsp;0&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;0<br>&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;&nbsp;1<br>&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;0<br>&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;1<br></code><br><br>px is 0 if CEx is active low (default) and 1 for active high.
-<br><br>ux is 0 if the CEx GPIO is reserved for SPI (default)
-and 1 otherwise.
-<br><br>A is 0 for the main SPI, 1 for the auxiliary SPI.
-<br><br>W is 0 if the device is not 3-wire, 1 if the device is 3-wire.
-Main SPI only.
-<br><br>nnnn defines the number of bytes (0-15) to write before
-switching the MOSI line to MISO to read data. This field
-is ignored if W is not set. Main SPI only.
-<br><br>T is 1 if the least significant bit is transmitted on MOSI
-first, the default (0) shifts the most significant bit out
-first. Auxiliary SPI only.
-<br><br>R is 1 if the least significant bit is received on MISO
-first, the default (0) receives the most significant bit
-first. Auxiliary SPI only.
-<br><br>bbbbbb defines the word size in bits (0-32). The default (0)
-sets 8 bits per word. Auxiliary SPI only.
-<br><br>The <a href="#spi_read">spi_read</a>, <a href="#spi_write">spi_write</a>, and <a href="#spi_xfer">spi_xfer</a> functions
-transfer data packed into 1, 2, or 4 bytes according to
-the word size in bits.
-<br><br>For bits 1-8 there will be one byte per character.
-For bits 9-16 there will be two bytes per character.
-For bits 17-32 there will be four bytes per character.
-<br><br>Multi-byte transfers are made in least significant byte
-first order.
-<br><br>E.g. to transfer 32 11-bit words data should
-contain 64 bytes.
-<br><br>E.g. to transfer the 14 bit value 0x1ABC send the
-bytes 0xBC followed by 0x1A.
-<br><br>The other bits in flags should be set to zero.
-<br><br><b><small>Example</small></b><br><br><code>#&nbsp;open&nbsp;SPI&nbsp;device&nbsp;on&nbsp;channel&nbsp;1&nbsp;in&nbsp;mode&nbsp;3&nbsp;at&nbsp;50000&nbsp;bits&nbsp;per&nbsp;second<br><br>h&nbsp;=&nbsp;pi.spi_open(1,&nbsp;50000,&nbsp;3)<br></code><h3><a name="spi_read">spi_read<small>(<a href="#handle">handle</a>, <a href="#count">count</a>)</small></h3>
-Reads count bytes from the SPI device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>).<br>&nbsp;count:=&nbsp;&gt;0,&nbsp;the&nbsp;number&nbsp;of&nbsp;bytes&nbsp;to&nbsp;read.<br></samp><br><br>The returned value is a tuple of the number of bytes read and a
-bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br><b><small>Example</small></b><br><br><code>(b,&nbsp;d)&nbsp;=&nbsp;pi.spi_read(h,&nbsp;60)&nbsp;#&nbsp;read&nbsp;60&nbsp;bytes&nbsp;from&nbsp;device&nbsp;h<br>if&nbsp;b&nbsp;==&nbsp;60:<br>&nbsp;&nbsp;&nbsp;#&nbsp;process&nbsp;read&nbsp;data<br>else:<br>&nbsp;&nbsp;&nbsp;#&nbsp;error&nbsp;path<br></code><h3><a name="spi_write">spi_write<small>(<a href="#handle">handle</a>, <a href="#data">data</a>)</small></h3>
-Writes the data bytes to the SPI device associated with handle.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>).<br>&nbsp;&nbsp;data:=&nbsp;the&nbsp;bytes&nbsp;to&nbsp;write.<br></samp><br><br><b><small>Example</small></b><br><br><code>pi.spi_write(0,&nbsp;b'\x02\xc0\x80')&nbsp;#&nbsp;write&nbsp;3&nbsp;bytes&nbsp;to&nbsp;device&nbsp;0<br><br>pi.spi_write(0,&nbsp;b'defgh')&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;write&nbsp;5&nbsp;bytes&nbsp;to&nbsp;device&nbsp;0<br><br>pi.spi_write(0,&nbsp;"def")&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;write&nbsp;3&nbsp;bytes&nbsp;to&nbsp;device&nbsp;0<br><br>pi.spi_write(1,&nbsp;[2,&nbsp;192,&nbsp;128])&nbsp;&nbsp;&nbsp;#&nbsp;write&nbsp;3&nbsp;bytes&nbsp;to&nbsp;device&nbsp;1<br></code><h3><a name="spi_xfer">spi_xfer<small>(<a href="#handle">handle</a>, <a href="#data">data</a>)</small></h3>
-Writes the data bytes to the SPI device associated with handle,
-returning the data bytes read from the device.
-<br><br><b><small>Parameters</small></b><br><br><samp>handle:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#spi_open">spi_open</a>).<br>&nbsp;&nbsp;data:=&nbsp;the&nbsp;bytes&nbsp;to&nbsp;write.<br></samp><br><br>The returned value is a tuple of the number of bytes read and a
-bytearray containing the bytes. If there was an error the
-number of bytes read will be less than zero (and will contain
-the error code).
-<br><br><b><small>Example</small></b><br><br><code>(count,&nbsp;rx_data)&nbsp;=&nbsp;pi.spi_xfer(h,&nbsp;b'\x01\x80\x00')<br><br>(count,&nbsp;rx_data)&nbsp;=&nbsp;pi.spi_xfer(h,&nbsp;[1,&nbsp;128,&nbsp;0])<br><br>(count,&nbsp;rx_data)&nbsp;=&nbsp;pi.spi_xfer(h,&nbsp;b"hello")<br><br>(count,&nbsp;rx_data)&nbsp;=&nbsp;pi.spi_xfer(h,&nbsp;"hello")<br></code><h3><a name="stop">stop<small>()</small></h3>
-Release pigpio resources.
-<br><br><b><small>Example</small></b><br><br><code>pi.stop()<br></code><h3><a name="stop_script">stop_script<small>(<a href="#script_id">script_id</a>)</small></h3>
-Stops a running script.
-<br><br><b><small>Parameters</small></b><br><br><samp>script_id:=&nbsp;id&nbsp;of&nbsp;stored&nbsp;script.<br></samp><br><br><b><small>Example</small></b><br><br><code>status&nbsp;=&nbsp;pi.stop_script(sid)<br></code><h3><a name="store_script">store_script<small>(<a href="#script">script</a>)</small></h3>
-Store a script for later execution.
-<br><br>See <a href="http://abyz.me.uk/rpi/pigpio/pigs.html#Scripts">http://abyz.me.uk/rpi/pigpio/pigs.html#Scripts</a> for
-details.
-<br><br><b><small>Parameters</small></b><br><br><samp>script:=&nbsp;the&nbsp;script&nbsp;text&nbsp;as&nbsp;a&nbsp;series&nbsp;of&nbsp;bytes.<br></samp><br><br>Returns a &gt;=0 script id if OK.
-<br><br><b><small>Example</small></b><br><br><code>sid&nbsp;=&nbsp;pi.store_script(<br>&nbsp;&nbsp;&nbsp;b'tag&nbsp;0&nbsp;w&nbsp;22&nbsp;1&nbsp;mils&nbsp;100&nbsp;w&nbsp;22&nbsp;0&nbsp;mils&nbsp;100&nbsp;dcr&nbsp;p0&nbsp;jp&nbsp;0')<br></code><h3><a name="update_script">update_script<small>(<a href="#script_id">script_id</a>, <a href="#params">params</a>)</small></h3>
-Sets the parameters of a script. The script may or
-may not be running. The first parameters of the script are
-overwritten with the new values.
-<br><br><b><small>Parameters</small></b><br><br><samp>script_id:=&nbsp;id&nbsp;of&nbsp;stored&nbsp;script.<br>&nbsp;&nbsp;&nbsp;params:=&nbsp;up&nbsp;to&nbsp;10&nbsp;parameters&nbsp;required&nbsp;by&nbsp;the&nbsp;script.<br></samp><br><br><b><small>Example</small></b><br><br><code>s&nbsp;=&nbsp;pi.update_script(sid,&nbsp;[par1,&nbsp;par2])<br><br>s&nbsp;=&nbsp;pi.update_script(sid,&nbsp;[1,&nbsp;2,&nbsp;3,&nbsp;4,&nbsp;5,&nbsp;6,&nbsp;7,&nbsp;8,&nbsp;9,&nbsp;10])<br></code><h3><a name="wait_for_edge">wait_for_edge<small>(<a href="#user_gpio">user_gpio</a>, <a href="#edge">edge</a>, <a href="#wait_timeout">wait_timeout</a>)</small></h3>
-Wait for an edge event on a GPIO.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;&nbsp;user_gpio:=&nbsp;0-31.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;edge:=&nbsp;EITHER_EDGE,&nbsp;RISING_EDGE&nbsp;(default),&nbsp;or<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FALLING_EDGE.<br>wait_timeout:=&nbsp;&gt;=0.0&nbsp;(default&nbsp;60.0).<br></samp><br><br>The function returns when the edge is detected or after
-the number of seconds specified by timeout has expired.
-<br><br>Do not use this function for precise timing purposes,
-the edge is only checked 20 times a second. Whenever
-you need to know the accurate time of GPIO events use
-a <a href="#callback">callback</a> function.
-<br><br>The function returns True if the edge is detected,
-otherwise False.
-<br><br><b><small>Example</small></b><br><br><code>if&nbsp;pi.wait_for_edge(23):<br>&nbsp;&nbsp;&nbsp;print("Rising&nbsp;edge&nbsp;detected")<br>else:<br>&nbsp;&nbsp;&nbsp;print("wait&nbsp;for&nbsp;edge&nbsp;timed&nbsp;out")<br><br>if&nbsp;pi.wait_for_edge(23,&nbsp;pigpio.FALLING_EDGE,&nbsp;5.0):<br>&nbsp;&nbsp;&nbsp;print("Falling&nbsp;edge&nbsp;detected")<br>else:<br>&nbsp;&nbsp;&nbsp;print("wait&nbsp;for&nbsp;falling&nbsp;edge&nbsp;timed&nbsp;out")<br></code><h3><a name="wait_for_event">wait_for_event<small>(<a href="#event">event</a>, <a href="#wait_timeout">wait_timeout</a>)</small></h3>
-Wait for an event.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;event:=&nbsp;0-31.<br>wait_timeout:=&nbsp;&gt;=0.0&nbsp;(default&nbsp;60.0).<br></samp><br><br>The function returns when the event is signalled or after
-the number of seconds specified by timeout has expired.
-<br><br>The function returns True if the event is detected,
-otherwise False.
-<br><br><b><small>Example</small></b><br><br><code>if&nbsp;pi.wait_for_event(23):<br>&nbsp;&nbsp;&nbsp;print("event&nbsp;detected")<br>else:<br>&nbsp;&nbsp;&nbsp;print("wait&nbsp;for&nbsp;event&nbsp;timed&nbsp;out")<br></code><h3><a name="wave_add_generic">wave_add_generic<small>(<a href="#pulses">pulses</a>)</small></h3>
-Adds a list of pulses to the current waveform.
-<br><br><b><small>Parameters</small></b><br><br><samp>pulses:=&nbsp;list&nbsp;of&nbsp;pulses&nbsp;to&nbsp;add&nbsp;to&nbsp;the&nbsp;waveform.<br></samp><br><br>Returns the new total number of pulses in the current waveform.
-<br><br>The pulses are interleaved in time order within the existing
-waveform (if any).
-<br><br>Merging allows the waveform to be built in parts, that is the
-settings for GPIO#1 can be added, and then GPIO#2 etc.
-<br><br>If the added waveform is intended to start after or within
-the existing waveform then the first pulse should consist
-solely of a delay.
-<br><br><b><small>Example</small></b><br><br><code>G1=4<br>G2=24<br><br>pi.set_mode(G1,&nbsp;pigpio.OUTPUT)<br>pi.set_mode(G2,&nbsp;pigpio.OUTPUT)<br><br>flash_500=[]&nbsp;#&nbsp;flash&nbsp;every&nbsp;500&nbsp;ms<br>flash_100=[]&nbsp;#&nbsp;flash&nbsp;every&nbsp;100&nbsp;ms<br><br>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ON&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OFF&nbsp;&nbsp;DELAY<br><br>flash_500.append(pigpio.pulse(1&lt;&lt;G1,&nbsp;1&lt;&lt;G2,&nbsp;500000))<br>flash_500.append(pigpio.pulse(1&lt;&lt;G2,&nbsp;1&lt;&lt;G1,&nbsp;500000))<br><br>flash_100.append(pigpio.pulse(1&lt;&lt;G1,&nbsp;1&lt;&lt;G2,&nbsp;100000))<br>flash_100.append(pigpio.pulse(1&lt;&lt;G2,&nbsp;1&lt;&lt;G1,&nbsp;100000))<br><br>pi.wave_clear()&nbsp;#&nbsp;clear&nbsp;any&nbsp;existing&nbsp;waveforms<br><br>pi.wave_add_generic(flash_500)&nbsp;#&nbsp;500&nbsp;ms&nbsp;flashes<br>f500&nbsp;=&nbsp;pi.wave_create()&nbsp;#&nbsp;create&nbsp;and&nbsp;save&nbsp;id<br><br>pi.wave_add_generic(flash_100)&nbsp;#&nbsp;100&nbsp;ms&nbsp;flashes<br>f100&nbsp;=&nbsp;pi.wave_create()&nbsp;#&nbsp;create&nbsp;and&nbsp;save&nbsp;id<br><br>pi.wave_send_repeat(f500)<br><br>time.sleep(4)<br><br>pi.wave_send_repeat(f100)<br><br>time.sleep(4)<br><br>pi.wave_send_repeat(f500)<br><br>time.sleep(4)<br><br>pi.wave_tx_stop()&nbsp;#&nbsp;stop&nbsp;waveform<br><br>pi.wave_clear()&nbsp;#&nbsp;clear&nbsp;all&nbsp;waveforms<br></code><h3><a name="wave_add_new">wave_add_new<small>()</small></h3>
-Starts a new empty waveform.
-<br><br>You would not normally need to call this function as it is
-automatically called after a waveform is created with the
-<a href="#wave_create">wave_create</a> function.
-<br><br><b><small>Example</small></b><br><br><code>pi.wave_add_new()<br></code><h3><a name="wave_add_serial">wave_add_serial<small>(<a href="#user_gpio">user_gpio</a>, <a href="#baud">baud</a>, <a href="#data">data</a>, <a href="#offset">offset</a>, <a href="#bb_bits">bb_bits</a>, <a href="#bb_stop">bb_stop</a>)</small></h3>
-Adds a waveform representing serial data to the existing
-waveform (if any). The serial data starts <a href="#offset">offset</a>
-microseconds from the start of the waveform.
-<br><br><b><small>Parameters</small></b><br><br><samp>user_gpio:=&nbsp;GPIO&nbsp;to&nbsp;transmit&nbsp;data.&nbsp;&nbsp;You&nbsp;must&nbsp;set&nbsp;the&nbsp;GPIO&nbsp;mode<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;output.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baud:=&nbsp;50-1000000&nbsp;bits&nbsp;per&nbsp;second.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data:=&nbsp;the&nbsp;bytes&nbsp;to&nbsp;write.<br>&nbsp;&nbsp;&nbsp;offset:=&nbsp;number&nbsp;of&nbsp;microseconds&nbsp;from&nbsp;the&nbsp;start&nbsp;of&nbsp;the<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;waveform,&nbsp;default&nbsp;0.<br>&nbsp;&nbsp;bb_bits:=&nbsp;number&nbsp;of&nbsp;data&nbsp;bits,&nbsp;default&nbsp;8.<br>&nbsp;&nbsp;bb_stop:=&nbsp;number&nbsp;of&nbsp;stop&nbsp;half&nbsp;bits,&nbsp;default&nbsp;2.<br></samp><br><br>Returns the new total number of pulses in the current waveform.
-<br><br>The serial data is formatted as one start bit, <a href="#bb_bits">bb_bits</a>
-data bits, and <a href="#bb_stop">bb_stop</a>/2 stop bits.
-<br><br>It is legal to add serial data streams with different baud
-rates to the same waveform.
-<br><br>The bytes required for each character depend upon <a href="#bb_bits">bb_bits</a>.
-<br><br>For <a href="#bb_bits">bb_bits</a> 1-8 there will be one byte per character.
-For <a href="#bb_bits">bb_bits</a> 9-16 there will be two bytes per character.
-For <a href="#bb_bits">bb_bits</a> 17-32 there will be four bytes per character.
-<br><br><b><small>Example</small></b><br><br><code>pi.wave_add_serial(4,&nbsp;300,&nbsp;'Hello&nbsp;world')<br><br>pi.wave_add_serial(4,&nbsp;300,&nbsp;b"Hello&nbsp;world")<br><br>pi.wave_add_serial(4,&nbsp;300,&nbsp;b'\x23\x01\x00\x45')<br><br>pi.wave_add_serial(17,&nbsp;38400,&nbsp;[23,&nbsp;128,&nbsp;234],&nbsp;5000)<br></code><h3><a name="wave_chain">wave_chain<small>(<a href="#data">data</a>)</small></h3>
-This function transmits a chain of waveforms.
-<br><br>NOTE: Any hardware PWM started by <a href="#hardware_PWM">hardware_PWM</a>
-will be cancelled.
-<br><br>The waves to be transmitted are specified by the contents
-of data which contains an ordered list of <a href="#wave_id">wave_id</a>s
-and optional command codes and related data.
-<br><br>Returns 0 if OK, otherwise PI_CHAIN_NESTING,
-PI_CHAIN_LOOP_CNT, PI_BAD_CHAIN_LOOP, PI_BAD_CHAIN_CMD,
-PI_CHAIN_COUNTER, PI_BAD_CHAIN_DELAY, PI_CHAIN_TOO_BIG,
-or PI_BAD_WAVE_ID.
-<br><br>Each wave is transmitted in the order specified. A wave
-may occur multiple times per chain.
-<br><br>A blocks of waves may be transmitted multiple times by
-using the loop commands. The block is bracketed by loop
-start and end commands. Loops may be nested.
-<br><br>Delays between waves may be added with the delay command.
-<br><br>The following command codes are supported:
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Name</td><td>Cmd & Data</td><td>Meaning</td></tr><tr><td>Loop Start</td><td>255 0</td><td>Identify start of a wave block</td></tr><tr><td>Loop Repeat</td><td>255 1 x y</td><td>loop x + y*256 times</td></tr><tr><td>Delay</td><td>255 2 x y</td><td>delay x + y*256 microseconds</td></tr><tr><td>Loop Forever</td><td>255 3</td><td>loop forever</td></tr></tbody></table><br><br>If present Loop Forever must be the last entry in the chain.
-<br><br>The code is currently dimensioned to support a chain with
-roughly 600 entries and 20 loop counters.
-<br><br><b><small>Example</small></b><br><br><code>#!/usr/bin/env&nbsp;python<br><br>import&nbsp;time<br>import&nbsp;pigpio<br><br>WAVES=5<br>GPIO=4<br><br>wid=[0]*WAVES<br><br>pi&nbsp;=&nbsp;pigpio.pi()&nbsp;#&nbsp;Connect&nbsp;to&nbsp;local&nbsp;Pi.<br><br>pi.set_mode(GPIO,&nbsp;pigpio.OUTPUT);<br><br>for&nbsp;i&nbsp;in&nbsp;range(WAVES):<br>&nbsp;&nbsp;&nbsp;pi.wave_add_generic([<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pigpio.pulse(1&lt;&lt;GPIO,&nbsp;0,&nbsp;20),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pigpio.pulse(0,&nbsp;1&lt;&lt;GPIO,&nbsp;(i+1)*200)]);<br><br>&nbsp;&nbsp;&nbsp;wid[i]&nbsp;=&nbsp;pi.wave_create();<br><br>pi.wave_chain([<br>&nbsp;&nbsp;&nbsp;wid[4],&nbsp;wid[3],&nbsp;wid[2],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;transmit&nbsp;waves&nbsp;4+3+2<br>&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[0],&nbsp;wid[0],&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;transmit&nbsp;waves&nbsp;0+0+0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[1],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;transmit&nbsp;waves&nbsp;0+1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;2,&nbsp;0x88,&nbsp;0x13,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;delay&nbsp;5000us<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;30,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;30&nbsp;times)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;loop&nbsp;start<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[2],&nbsp;wid[3],&nbsp;wid[0],&nbsp;#&nbsp;transmit&nbsp;waves&nbsp;2+3+0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wid[3],&nbsp;wid[1],&nbsp;wid[2],&nbsp;#&nbsp;transmit&nbsp;waves&nbsp;3+1+2<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;10,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;10&nbsp;times)<br>&nbsp;&nbsp;&nbsp;255,&nbsp;1,&nbsp;5,&nbsp;0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;loop&nbsp;end&nbsp;(repeat&nbsp;5&nbsp;times)<br>&nbsp;&nbsp;&nbsp;wid[4],&nbsp;wid[4],&nbsp;wid[4],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;transmit&nbsp;waves&nbsp;4+4+4<br>&nbsp;&nbsp;&nbsp;255,&nbsp;2,&nbsp;0x20,&nbsp;0x4E,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;delay&nbsp;20000us<br>&nbsp;&nbsp;&nbsp;wid[0],&nbsp;wid[0],&nbsp;wid[0],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;transmit&nbsp;waves&nbsp;0+0+0<br>&nbsp;&nbsp;&nbsp;])<br><br>while&nbsp;pi.wave_tx_busy():<br>&nbsp;&nbsp;&nbsp;time.sleep(0.1);<br><br>for&nbsp;i&nbsp;in&nbsp;range(WAVES):<br>&nbsp;&nbsp;&nbsp;pi.wave_delete(wid[i])<br><br>pi.stop()<br></code><h3><a name="wave_clear">wave_clear<small>()</small></h3>
-Clears all waveforms and any data added by calls to the
-<a href="#wave_add_*">wave_add_*</a> functions.
-<br><br><b><small>Example</small></b><br><br><code>pi.wave_clear()<br></code><h3><a name="wave_create">wave_create<small>()</small></h3>
-Creates a waveform from the data provided by the prior calls
-to the <a href="#wave_add_*">wave_add_*</a> functions.
-<br><br>Returns a wave id (&gt;=0) if OK, otherwise PI_EMPTY_WAVEFORM,
-PI_TOO_MANY_CBS, PI_TOO_MANY_OOL, or PI_NO_WAVEFORM_ID.
-<br><br>The data provided by the <a href="#wave_add_*">wave_add_*</a> functions is consumed by
-this function.
-<br><br>As many waveforms may be created as there is space available.
-The wave id is passed to <a href="#wave_send_*">wave_send_*</a> to specify the waveform
-to transmit.
-<br><br>Normal usage would be
-<br><br>Step 1. <a href="#wave_clear">wave_clear</a> to clear all waveforms and added data.
-<br><br>Step 2. <a href="#wave_add_*">wave_add_*</a> calls to supply the waveform data.
-<br><br>Step 3. <a href="#wave_create">wave_create</a> to create the waveform and get a unique id
-<br><br>Repeat steps 2 and 3 as needed.
-<br><br>Step 4. <a href="#wave_send_*">wave_send_*</a> with the id of the waveform to transmit.
-<br><br>A waveform comprises one or more pulses.
-<br><br>A pulse specifies
-<br><br>1) the GPIO to be switched on at the start of the pulse.
-2) the GPIO to be switched off at the start of the pulse.
-3) the delay in microseconds before the next pulse.
-<br><br>Any or all the fields can be zero. It doesn't make any sense
-to set all the fields to zero (the pulse will be ignored).
-<br><br>When a waveform is started each pulse is executed in order with
-the specified delay between the pulse and the next.
-<br><br><b><small>Example</small></b><br><br><code>wid&nbsp;=&nbsp;pi.wave_create()<br></code><h3><a name="wave_create_and_pad">wave_create_and_pad<small>(<a href="#percent">percent</a>)</small></h3>
-This function creates a waveform like <a href="#wave_create">wave_create</a> but pads the consumed
-resources. Where percent gives the percentage of the resources to use
-(in terms of the theoretical maximum, not the current amount free).
-This allows the reuse of deleted waves while a transmission is active.
-<br><br>Upon success a wave id greater than or equal to 0 is returned, otherwise
-PI_EMPTY_WAVEFORM, PI_TOO_MANY_CBS, PI_TOO_MANY_OOL, or PI_NO_WAVEFORM_ID.
-<br><br><code>percent:&nbsp;0-100,&nbsp;size&nbsp;of&nbsp;waveform&nbsp;as&nbsp;percentage&nbsp;of&nbsp;maximum&nbsp;available.<br></code><br><br>The data provided by the <a href="#wave_add_*">wave_add_*</a> functions are consumed by this
-function.
-<br><br>As many waveforms may be created as there is space available. The
-wave id is passed to <a href="#wave_send_*">wave_send_*</a> to specify the waveform to transmit.
-<br><br>A usage would be the creation of two waves where one is filled while the
-other is being transmitted. Each wave is assigned 50% of the resources.
-This buffer structure allows the transmission of infinite wave sequences.
-<br><br>Normal usage:
-<br><br>Step 1. <a href="#wave_clear">wave_clear</a> to clear all waveforms and added data.
-<br><br>Step 2. <a href="#wave_add_*">wave_add_*</a> calls to supply the waveform data.
-<br><br>Step 3. <a href="#wave_create_and_pad">wave_create_and_pad</a> to create a waveform of uniform size.
-<br><br>Step 4. <a href="#wave_send_*">wave_send_*</a> with the id of the waveform to transmit.
-<br><br>Repeat steps 2-4 as needed.
-<br><br>Step 5. Any wave id can now be deleted and another wave of the same size
- can be created in its place.
-<br><br><b><small>Example</small></b><br><br><code>wid&nbsp;=&nbsp;pi.wave_create_and_pad(50)<br></code><h3><a name="wave_delete">wave_delete<small>(<a href="#wave_id">wave_id</a>)</small></h3>
-This function deletes the waveform with id wave_id.
-<br><br><b><small>Parameters</small></b><br><br><samp>wave_id:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#wave_create">wave_create</a>).<br></samp><br><br>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><b><small>Example</small></b><br><br><code>pi.wave_delete(6)&nbsp;#&nbsp;delete&nbsp;waveform&nbsp;with&nbsp;id&nbsp;6<br><br>pi.wave_delete(0)&nbsp;#&nbsp;delete&nbsp;waveform&nbsp;with&nbsp;id&nbsp;0<br></code><h3><a name="wave_get_cbs">wave_get_cbs<small>()</small></h3>
-Returns the length in DMA control blocks of the current
-waveform.
-<br><br><b><small>Example</small></b><br><br><code>cbs&nbsp;=&nbsp;pi.wave_get_cbs()<br></code><h3><a name="wave_get_max_cbs">wave_get_max_cbs<small>()</small></h3>
-Returns the maximum possible size of a waveform in DMA
-control blocks.
-<br><br><b><small>Example</small></b><br><br><code>cbs&nbsp;=&nbsp;pi.wave_get_max_cbs()<br></code><h3><a name="wave_get_max_micros">wave_get_max_micros<small>()</small></h3>
-Returns the maximum possible size of a waveform in microseconds.
-<br><br><b><small>Example</small></b><br><br><code>micros&nbsp;=&nbsp;pi.wave_get_max_micros()<br></code><h3><a name="wave_get_max_pulses">wave_get_max_pulses<small>()</small></h3>
-Returns the maximum possible size of a waveform in pulses.
-<br><br><b><small>Example</small></b><br><br><code>pulses&nbsp;=&nbsp;pi.wave_get_max_pulses()<br></code><h3><a name="wave_get_micros">wave_get_micros<small>()</small></h3>
-Returns the length in microseconds of the current waveform.
-<br><br><b><small>Example</small></b><br><br><code>micros&nbsp;=&nbsp;pi.wave_get_micros()<br></code><h3><a name="wave_get_pulses">wave_get_pulses<small>()</small></h3>
-Returns the length in pulses of the current waveform.
-<br><br><b><small>Example</small></b><br><br><code>pulses&nbsp;=&nbsp;pi.wave_get_pulses()<br></code><h3><a name="wave_send_once">wave_send_once<small>(<a href="#wave_id">wave_id</a>)</small></h3>
-Transmits the waveform with id wave_id. The waveform is sent
-once.
-<br><br>NOTE: Any hardware PWM started by <a href="#hardware_PWM">hardware_PWM</a> will
-be cancelled.
-<br><br><b><small>Parameters</small></b><br><br><samp>wave_id:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#wave_create">wave_create</a>).<br></samp><br><br>Returns the number of DMA control blocks used in the waveform.
-<br><br><b><small>Example</small></b><br><br><code>cbs&nbsp;=&nbsp;pi.wave_send_once(wid)<br></code><h3><a name="wave_send_repeat">wave_send_repeat<small>(<a href="#wave_id">wave_id</a>)</small></h3>
-Transmits the waveform with id wave_id. The waveform repeats
-until wave_tx_stop is called or another call to <a href="#wave_send_*">wave_send_*</a>
-is made.
-<br><br>NOTE: Any hardware PWM started by <a href="#hardware_PWM">hardware_PWM</a> will
-be cancelled.
-<br><br><b><small>Parameters</small></b><br><br><samp>wave_id:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#wave_create">wave_create</a>).<br></samp><br><br>Returns the number of DMA control blocks used in the waveform.
-<br><br><b><small>Example</small></b><br><br><code>cbs&nbsp;=&nbsp;pi.wave_send_repeat(wid)<br></code><h3><a name="wave_send_using_mode">wave_send_using_mode<small>(<a href="#wave_id">wave_id</a>, <a href="#mode">mode</a>)</small></h3>
-Transmits the waveform with id wave_id using mode mode.
-<br><br><b><small>Parameters</small></b><br><br><samp>wave_id:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#wave_create">wave_create</a>).<br>&nbsp;&nbsp;&nbsp;mode:=&nbsp;WAVE_MODE_ONE_SHOT,&nbsp;WAVE_MODE_REPEAT,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WAVE_MODE_ONE_SHOT_SYNC,&nbsp;or&nbsp;WAVE_MODE_REPEAT_SYNC.<br></samp><br><br>WAVE_MODE_ONE_SHOT: same as <a href="#wave_send_once">wave_send_once</a>.
-<br><br>WAVE_MODE_REPEAT same as <a href="#wave_send_repeat">wave_send_repeat</a>.
-<br><br>WAVE_MODE_ONE_SHOT_SYNC same as <a href="#wave_send_once">wave_send_once</a> but tries
-to sync with the previous waveform.
-<br><br>WAVE_MODE_REPEAT_SYNC same as <a href="#wave_send_repeat">wave_send_repeat</a> but tries
-to sync with the previous waveform.
-<br><br>WARNING: bad things may happen if you delete the previous
-waveform before it has been synced to the new waveform.
-<br><br>NOTE: Any hardware PWM started by <a href="#hardware_PWM">hardware_PWM</a> will
-be cancelled.
-<br><br><b><small>Parameters</small></b><br><br><samp>wave_id:=&nbsp;&gt;=0&nbsp;(as&nbsp;returned&nbsp;by&nbsp;a&nbsp;prior&nbsp;call&nbsp;to&nbsp;<a href="#wave_create">wave_create</a>).<br></samp><br><br>Returns the number of DMA control blocks used in the waveform.
-<br><br><b><small>Example</small></b><br><br><code>cbs&nbsp;=&nbsp;pi.wave_send_using_mode(wid,&nbsp;WAVE_MODE_REPEAT_SYNC)<br></code><h3><a name="wave_tx_at">wave_tx_at<small>()</small></h3>
-Returns the id of the waveform currently being
-transmitted.
-<br><br>Returns the waveform id or one of the following special
-values:
-<br><br>WAVE_NOT_FOUND (9998) - transmitted wave not found.
-NO_TX_WAVE (9999) - no wave being transmitted.
-<br><br><b><small>Example</small></b><br><br><code>wid&nbsp;=&nbsp;pi.wave_tx_at()<br></code><h3><a name="wave_tx_busy">wave_tx_busy<small>()</small></h3>
-Returns 1 if a waveform is currently being transmitted,
-otherwise 0.
-<br><br><b><small>Example</small></b><br><br><code>pi.wave_send_once(0)&nbsp;#&nbsp;send&nbsp;first&nbsp;waveform<br><br>while&nbsp;pi.wave_tx_busy():&nbsp;#&nbsp;wait&nbsp;for&nbsp;waveform&nbsp;to&nbsp;be&nbsp;sent<br>&nbsp;&nbsp;&nbsp;time.sleep(0.1)<br><br>pi.wave_send_once(1)&nbsp;#&nbsp;send&nbsp;next&nbsp;waveform<br></code><h3><a name="wave_tx_repeat">wave_tx_repeat<small>()</small></h3>
-This function is deprecated and has beeen removed.
-<br><br>Use <a href="#wave_create">wave_create</a>/<a href="#wave_send_*">wave_send_*</a> instead.
-<h3><a name="wave_tx_start">wave_tx_start<small>()</small></h3>
-This function is deprecated and has been removed.
-<br><br>Use <a href="#wave_create">wave_create</a>/<a href="#wave_send_*">wave_send_*</a> instead.
-<h3><a name="wave_tx_stop">wave_tx_stop<small>()</small></h3>
-Stops the transmission of the current waveform.
-<br><br>This function is intended to stop a waveform started with
-wave_send_repeat.
-<br><br><b><small>Example</small></b><br><br><code>pi.wave_send_repeat(3)<br><br>time.sleep(5)<br><br>pi.wave_tx_stop()<br></code><h3><a name="write">write<small>(<a href="#gpio">gpio</a>, <a href="#level">level</a>)</small></h3>
-Sets the GPIO level.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;GPIO:=&nbsp;0-53.<br>level:=&nbsp;0,&nbsp;1.<br></samp><br><br>If PWM or servo pulses are active on the GPIO they are
-switched off.
-<br><br><b><small>Example</small></b><br><br><code>pi.set_mode(17,&nbsp;pigpio.OUTPUT)<br><br>pi.write(17,0)<br>print(pi.read(17))<br>0<br><br>pi.write(17,1)<br>print(pi.read(17))<br>1<br></code><h2> class pulse
-</h2><h3><a name="pigpio.pulse">pigpio.pulse<small>(<a href="#gpio_on">gpio_on</a>, <a href="#gpio_off">gpio_off</a>, <a href="#delay">delay</a>)</small></h3>
-Initialises a pulse.
-<br><br><b><small>Parameters</small></b><br><br><samp>&nbsp;gpio_on:=&nbsp;the&nbsp;GPIO&nbsp;to&nbsp;switch&nbsp;on&nbsp;at&nbsp;the&nbsp;start&nbsp;of&nbsp;the&nbsp;pulse.<br>gpio_off:=&nbsp;the&nbsp;GPIO&nbsp;to&nbsp;switch&nbsp;off&nbsp;at&nbsp;the&nbsp;start&nbsp;of&nbsp;the&nbsp;pulse.<br>&nbsp;&nbsp;&nbsp;delay:=&nbsp;the&nbsp;delay&nbsp;in&nbsp;microseconds&nbsp;before&nbsp;the&nbsp;next&nbsp;pulse.<br></samp><h2>FUNCTIONS</h2><h3><a name="pigpio.error_text">pigpio.error_text<small>(<a href="#errnum">errnum</a>)</small></h3>
-Returns a text description of a pigpio error.
-<br><br><b><small>Parameters</small></b><br><br><samp>errnum:=&nbsp;&lt;0,&nbsp;the&nbsp;error&nbsp;number<br></samp><br><br><b><small>Example</small></b><br><br><code>print(pigpio.error_text(-5))<br>level&nbsp;not&nbsp;0-1<br></code><h3><a name="pigpio.tickDiff">pigpio.tickDiff<small>(<a href="#t1">t1</a>, <a href="#t2">t2</a>)</small></h3>
-Returns the microsecond difference between two ticks.
-<br><br><b><small>Parameters</small></b><br><br><samp>t1:=&nbsp;the&nbsp;earlier&nbsp;tick<br>t2:=&nbsp;the&nbsp;later&nbsp;tick<br></samp><br><br><b><small>Example</small></b><br><br><code>print(pigpio.tickDiff(4294967272,&nbsp;12))<br>36<br></code><h3><a name="pigpio.u2i">pigpio.u2i<small>(<a href="#uint32">uint32</a>)</small></h3>
-Converts a 32 bit unsigned number to signed.
-<br><br><b><small>Parameters</small></b><br><br><samp>uint32:=&nbsp;an&nbsp;unsigned&nbsp;32&nbsp;bit&nbsp;number<br></samp><br><br><b><small>Example</small></b><br><br><code>print(u2i(4294967272))<br>-24<br>print(u2i(37))<br>37<br></code><h2>PARAMETERS</h2><h3><a name="active"></a>active: 0-1000000</h3>The number of microseconds level changes are reported for once
-a noise filter has been triggered (by <a href="#steady">steady</a> microseconds of
-a stable level).
-<h3><a name="arg1"></a>arg1: </h3>An unsigned argument passed to a user customised function. Its
-meaning is defined by the customiser.
-<h3><a name="arg2"></a>arg2: </h3>An unsigned argument passed to a user customised function. Its
-meaning is defined by the customiser.
-<h3><a name="argx"></a>argx: </h3>An array of bytes passed to a user customised function.
-Its meaning and content is defined by the customiser.
-<h3><a name="baud"></a>baud: </h3>The speed of serial communication (I2C, SPI, serial link, waves)
-in bits per second.
-<h3><a name="bb_bits"></a>bb_bits: 1-32</h3>The number of data bits to be used when adding serial data to a
-waveform.
-<h3><a name="bb_stop"></a>bb_stop: 2-8</h3>The number of (half) stop bits to be used when adding serial data
-to a waveform.
-<h3><a name="bit"></a>bit: 0-1</h3>A value of 0 or 1.
-<h3><a name="bits"></a>bits: 32 bit number</h3>A mask used to select GPIO to be operated on. If bit n is set
-then GPIO n is selected. A convenient way of setting bit n is to
-bit or in the value (1&lt;&lt;n).
-<br><br>To select GPIO 1, 7, 23
-<br><br>bits = (1&lt;&lt;1) | (1&lt;&lt;7) | (1&lt;&lt;23)
-<h3><a name="bsc_control"></a>bsc_control: </h3><code>22&nbsp;21&nbsp;20&nbsp;19&nbsp;18&nbsp;17&nbsp;16&nbsp;15&nbsp;14&nbsp;13&nbsp;12&nbsp;11&nbsp;10&nbsp;&nbsp;9&nbsp;&nbsp;8&nbsp;&nbsp;7&nbsp;&nbsp;6&nbsp;&nbsp;5&nbsp;&nbsp;4&nbsp;&nbsp;3&nbsp;&nbsp;2&nbsp;&nbsp;1&nbsp;&nbsp;0<br>&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;a&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;IT&nbsp;HC&nbsp;TF&nbsp;IR&nbsp;RE&nbsp;TE&nbsp;BK&nbsp;EC&nbsp;ES&nbsp;PL&nbsp;PH&nbsp;I2&nbsp;SP&nbsp;EN<br></code><br><br>aaaaaaa defines the I2C slave address (only relevant in I2C mode)
-<br><br>Bits 0-13 are copied unchanged to the BSC CR register. See
-pages 163-165 of the Broadcom peripherals document.
-<h3><a name="byte_val"></a>byte_val: 0-255</h3>A whole number.
-<h3><a name="clkfreq"></a>clkfreq: 4689-250M (13184-375M for the BCM2711)</h3>The hardware clock frequency.
-<h3><a name="connected"></a>connected: </h3>True if a connection was established, False otherwise.
-<h3><a name="count"></a>count: </h3>The number of bytes of data to be transferred.
-<h3><a name="CS"></a>CS: </h3>The GPIO used for the slave select signal when bit banging SPI.
-<h3><a name="data"></a>data: </h3>Data to be transmitted, a series of bytes.
-<h3><a name="delay"></a>delay: &gt;=1</h3>The length of a pulse in microseconds.
-<h3><a name="dutycycle"></a>dutycycle: 0-range_</h3>A number between 0 and range_.
-<br><br>The dutycycle sets the proportion of time on versus time off during each
-PWM cycle.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Dutycycle</td><td>On time</td></tr><tr><td>0</td><td>Off</td></tr><tr><td>range_ * 0.25</td><td>25% On</td></tr><tr><td>range_ * 0.50</td><td>50% On</td></tr><tr><td>range_ * 0.75</td><td>75% On</td></tr><tr><td>range_</td><td>Fully On</td></tr></tbody></table><h3><a name="edge"></a>edge: 0-2</h3><code>EITHER_EDGE&nbsp;=&nbsp;2<br>FALLING_EDGE&nbsp;=&nbsp;1<br>RISING_EDGE&nbsp;=&nbsp;0<br></code><h3><a name="errnum"></a>errnum: &lt;0</h3><code>PI_BAD_USER_GPIO&nbsp;=&nbsp;-2<br>PI_BAD_GPIO&nbsp;=&nbsp;-3<br>PI_BAD_MODE&nbsp;=&nbsp;-4<br>PI_BAD_LEVEL&nbsp;=&nbsp;-5<br>PI_BAD_PUD&nbsp;=&nbsp;-6<br>PI_BAD_PULSEWIDTH&nbsp;=&nbsp;-7<br>PI_BAD_DUTYCYCLE&nbsp;=&nbsp;-8<br>PI_BAD_WDOG_TIMEOUT&nbsp;=&nbsp;-15<br>PI_BAD_DUTYRANGE&nbsp;=&nbsp;-21<br>PI_NO_HANDLE&nbsp;=&nbsp;-24<br>PI_BAD_HANDLE&nbsp;=&nbsp;-25<br>PI_BAD_WAVE_BAUD&nbsp;=&nbsp;-35<br>PI_TOO_MANY_PULSES&nbsp;=&nbsp;-36<br>PI_TOO_MANY_CHARS&nbsp;=&nbsp;-37<br>PI_NOT_SERIAL_GPIO&nbsp;=&nbsp;-38<br>PI_NOT_PERMITTED&nbsp;=&nbsp;-41<br>PI_SOME_PERMITTED&nbsp;=&nbsp;-42<br>PI_BAD_WVSC_COMMND&nbsp;=&nbsp;-43<br>PI_BAD_WVSM_COMMND&nbsp;=&nbsp;-44<br>PI_BAD_WVSP_COMMND&nbsp;=&nbsp;-45<br>PI_BAD_PULSELEN&nbsp;=&nbsp;-46<br>PI_BAD_SCRIPT&nbsp;=&nbsp;-47<br>PI_BAD_SCRIPT_ID&nbsp;=&nbsp;-48<br>PI_BAD_SER_OFFSET&nbsp;=&nbsp;-49<br>PI_GPIO_IN_USE&nbsp;=&nbsp;-50<br>PI_BAD_SERIAL_COUNT&nbsp;=&nbsp;-51<br>PI_BAD_PARAM_NUM&nbsp;=&nbsp;-52<br>PI_DUP_TAG&nbsp;=&nbsp;-53<br>PI_TOO_MANY_TAGS&nbsp;=&nbsp;-54<br>PI_BAD_SCRIPT_CMD&nbsp;=&nbsp;-55<br>PI_BAD_VAR_NUM&nbsp;=&nbsp;-56<br>PI_NO_SCRIPT_ROOM&nbsp;=&nbsp;-57<br>PI_NO_MEMORY&nbsp;=&nbsp;-58<br>PI_SOCK_READ_FAILED&nbsp;=&nbsp;-59<br>PI_SOCK_WRIT_FAILED&nbsp;=&nbsp;-60<br>PI_TOO_MANY_PARAM&nbsp;=&nbsp;-61<br>PI_SCRIPT_NOT_READY&nbsp;=&nbsp;-62<br>PI_BAD_TAG&nbsp;=&nbsp;-63<br>PI_BAD_MICS_DELAY&nbsp;=&nbsp;-64<br>PI_BAD_MILS_DELAY&nbsp;=&nbsp;-65<br>PI_BAD_WAVE_ID&nbsp;=&nbsp;-66<br>PI_TOO_MANY_CBS&nbsp;=&nbsp;-67<br>PI_TOO_MANY_OOL&nbsp;=&nbsp;-68<br>PI_EMPTY_WAVEFORM&nbsp;=&nbsp;-69<br>PI_NO_WAVEFORM_ID&nbsp;=&nbsp;-70<br>PI_I2C_OPEN_FAILED&nbsp;=&nbsp;-71<br>PI_SER_OPEN_FAILED&nbsp;=&nbsp;-72<br>PI_SPI_OPEN_FAILED&nbsp;=&nbsp;-73<br>PI_BAD_I2C_BUS&nbsp;=&nbsp;-74<br>PI_BAD_I2C_ADDR&nbsp;=&nbsp;-75<br>PI_BAD_SPI_CHANNEL&nbsp;=&nbsp;-76<br>PI_BAD_FLAGS&nbsp;=&nbsp;-77<br>PI_BAD_SPI_SPEED&nbsp;=&nbsp;-78<br>PI_BAD_SER_DEVICE&nbsp;=&nbsp;-79<br>PI_BAD_SER_SPEED&nbsp;=&nbsp;-80<br>PI_BAD_PARAM&nbsp;=&nbsp;-81<br>PI_I2C_WRITE_FAILED&nbsp;=&nbsp;-82<br>PI_I2C_READ_FAILED&nbsp;=&nbsp;-83<br>PI_BAD_SPI_COUNT&nbsp;=&nbsp;-84<br>PI_SER_WRITE_FAILED&nbsp;=&nbsp;-85<br>PI_SER_READ_FAILED&nbsp;=&nbsp;-86<br>PI_SER_READ_NO_DATA&nbsp;=&nbsp;-87<br>PI_UNKNOWN_COMMAND&nbsp;=&nbsp;-88<br>PI_SPI_XFER_FAILED&nbsp;=&nbsp;-89<br>PI_NO_AUX_SPI&nbsp;=&nbsp;-91<br>PI_NOT_PWM_GPIO&nbsp;=&nbsp;-92<br>PI_NOT_SERVO_GPIO&nbsp;=&nbsp;-93<br>PI_NOT_HCLK_GPIO&nbsp;=&nbsp;-94<br>PI_NOT_HPWM_GPIO&nbsp;=&nbsp;-95<br>PI_BAD_HPWM_FREQ&nbsp;=&nbsp;-96<br>PI_BAD_HPWM_DUTY&nbsp;=&nbsp;-97<br>PI_BAD_HCLK_FREQ&nbsp;=&nbsp;-98<br>PI_BAD_HCLK_PASS&nbsp;=&nbsp;-99<br>PI_HPWM_ILLEGAL&nbsp;=&nbsp;-100<br>PI_BAD_DATABITS&nbsp;=&nbsp;-101<br>PI_BAD_STOPBITS&nbsp;=&nbsp;-102<br>PI_MSG_TOOBIG&nbsp;=&nbsp;-103<br>PI_BAD_MALLOC_MODE&nbsp;=&nbsp;-104<br>PI_BAD_SMBUS_CMD&nbsp;=&nbsp;-107<br>PI_NOT_I2C_GPIO&nbsp;=&nbsp;-108<br>PI_BAD_I2C_WLEN&nbsp;=&nbsp;-109<br>PI_BAD_I2C_RLEN&nbsp;=&nbsp;-110<br>PI_BAD_I2C_CMD&nbsp;=&nbsp;-111<br>PI_BAD_I2C_BAUD&nbsp;=&nbsp;-112<br>PI_CHAIN_LOOP_CNT&nbsp;=&nbsp;-113<br>PI_BAD_CHAIN_LOOP&nbsp;=&nbsp;-114<br>PI_CHAIN_COUNTER&nbsp;=&nbsp;-115<br>PI_BAD_CHAIN_CMD&nbsp;=&nbsp;-116<br>PI_BAD_CHAIN_DELAY&nbsp;=&nbsp;-117<br>PI_CHAIN_NESTING&nbsp;=&nbsp;-118<br>PI_CHAIN_TOO_BIG&nbsp;=&nbsp;-119<br>PI_DEPRECATED&nbsp;=&nbsp;-120<br>PI_BAD_SER_INVERT&nbsp;=&nbsp;-121<br>PI_BAD_FOREVER&nbsp;=&nbsp;-124<br>PI_BAD_FILTER&nbsp;=&nbsp;-125<br>PI_BAD_PAD&nbsp;=&nbsp;-126<br>PI_BAD_STRENGTH&nbsp;=&nbsp;-127<br>PI_FIL_OPEN_FAILED&nbsp;=&nbsp;-128<br>PI_BAD_FILE_MODE&nbsp;=&nbsp;-129<br>PI_BAD_FILE_FLAG&nbsp;=&nbsp;-130<br>PI_BAD_FILE_READ&nbsp;=&nbsp;-131<br>PI_BAD_FILE_WRITE&nbsp;=&nbsp;-132<br>PI_FILE_NOT_ROPEN&nbsp;=&nbsp;-133<br>PI_FILE_NOT_WOPEN&nbsp;=&nbsp;-134<br>PI_BAD_FILE_SEEK&nbsp;=&nbsp;-135<br>PI_NO_FILE_MATCH&nbsp;=&nbsp;-136<br>PI_NO_FILE_ACCESS&nbsp;=&nbsp;-137<br>PI_FILE_IS_A_DIR&nbsp;=&nbsp;-138<br>PI_BAD_SHELL_STATUS&nbsp;=&nbsp;-139<br>PI_BAD_SCRIPT_NAME&nbsp;=&nbsp;-140<br>PI_BAD_SPI_BAUD&nbsp;=&nbsp;-141<br>PI_NOT_SPI_GPIO&nbsp;=&nbsp;-142<br>PI_BAD_EVENT_ID&nbsp;=&nbsp;-143<br>PI_CMD_INTERRUPTED&nbsp;=&nbsp;-144<br>PI_NOT_ON_BCM2711&nbsp;&nbsp;&nbsp;=&nbsp;-145<br>PI_ONLY_ON_BCM2711&nbsp;&nbsp;=&nbsp;-146<br></code><h3><a name="event"></a>event: 0-31</h3>An event is a signal used to inform one or more consumers
-to start an action.
-<h3><a name="file_mode"></a>file_mode: </h3>The mode may have the following values
-<br><br><code>FILE_READ&nbsp;&nbsp;&nbsp;1<br>FILE_WRITE&nbsp;&nbsp;2<br>FILE_RW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3<br></code><br><br>The following values can be or'd into the file open mode
-<br><br><code>FILE_APPEND&nbsp;4<br>FILE_CREATE&nbsp;8<br>FILE_TRUNC&nbsp;&nbsp;16<br></code><h3><a name="file_name"></a>file_name: </h3>A full file path. To be accessible the path must match
-an entry in /opt/pigpio/access.
-<h3><a name="fpattern"></a>fpattern: </h3>A file path which may contain wildcards. To be accessible the path
-must match an entry in /opt/pigpio/access.
-<h3><a name="frequency"></a>frequency: 0-40000</h3>Defines the frequency to be used for PWM on a GPIO.
-The closest permitted frequency will be used.
-<h3><a name="func"></a>func: </h3>A user supplied callback function.
-<h3><a name="gpio"></a>gpio: 0-53</h3>A Broadcom numbered GPIO. All the user GPIO are in the range 0-31.
-<br><br>There are 54 General Purpose Input Outputs (GPIO) named GPIO0
-through GPIO53.
-<br><br>They are split into two banks. Bank 1 consists of GPIO0
-through GPIO31. Bank 2 consists of GPIO32 through GPIO53.
-<br><br>All the GPIO which are safe for the user to read and write are in
-bank 1. Not all GPIO in bank 1 are safe though. Type 1 boards
-have 17 safe GPIO. Type 2 boards have 21. Type 3 boards have 26.
-<br><br>See <a href="#get_hardware_revision">get_hardware_revision</a>.
-<br><br>The user GPIO are marked with an X in the following table
-<br><br><code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;&nbsp;1&nbsp;&nbsp;2&nbsp;&nbsp;3&nbsp;&nbsp;4&nbsp;&nbsp;5&nbsp;&nbsp;6&nbsp;&nbsp;7&nbsp;&nbsp;8&nbsp;&nbsp;9&nbsp;10&nbsp;11&nbsp;12&nbsp;13&nbsp;14&nbsp;15<br>Type&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16&nbsp;17&nbsp;18&nbsp;19&nbsp;20&nbsp;21&nbsp;22&nbsp;23&nbsp;24&nbsp;25&nbsp;26&nbsp;27&nbsp;28&nbsp;29&nbsp;30&nbsp;31<br>Type&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-<br>Type&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X<br>Type&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;X&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-&nbsp;&nbsp;-<br></code><h3><a name="gpio_off"></a>gpio_off: </h3>A mask used to select GPIO to be operated on. See <a href="#bits">bits</a>.
-<br><br>This mask selects the GPIO to be switched off at the start
-of a pulse.
-<h3><a name="gpio_on"></a>gpio_on: </h3>A mask used to select GPIO to be operated on. See <a href="#bits">bits</a>.
-<br><br>This mask selects the GPIO to be switched on at the start
-of a pulse.
-<h3><a name="handle"></a>handle: &gt;=0</h3>A number referencing an object opened by one of the following
-<br><br><a href="#file_open">file_open</a>
-<a href="#i2c_open">i2c_open</a>
-<a href="#notify_open">notify_open</a>
-<a href="#serial_open">serial_open</a>
-<a href="#spi_open">spi_open</a>
-<h3><a name="host"></a>host: </h3>The name or IP address of the Pi running the pigpio daemon.
-<h3><a name="i2c_address"></a>i2c_address: 0-0x7F</h3>The address of a device on the I2C bus.
-<h3><a name="i2c_bus"></a>i2c_bus: &gt;=0</h3>An I2C bus number.
-<h3><a name="i2c_flags"></a>i2c_flags: 0</h3>No I2C flags are currently defined.
-<h3><a name="invert"></a>invert: 0-1</h3>A flag used to set normal or inverted bit bang serial data
-level logic.
-<h3><a name="level"></a>level: 0-1 (2)</h3><code>CLEAR&nbsp;=&nbsp;0<br>HIGH&nbsp;=&nbsp;1<br>LOW&nbsp;=&nbsp;0<br>OFF&nbsp;=&nbsp;0<br>ON&nbsp;=&nbsp;1<br>SET&nbsp;=&nbsp;1<br>TIMEOUT&nbsp;=&nbsp;2&nbsp;#&nbsp;only&nbsp;returned&nbsp;for&nbsp;a&nbsp;watchdog&nbsp;timeout<br></code><h3><a name="MISO"></a>MISO: </h3>The GPIO used for the MISO signal when bit banging SPI.
-<h3><a name="mode"></a>mode: </h3>1.The operational mode of a GPIO, normally INPUT or OUTPUT.
-<br><br><code>ALT0&nbsp;=&nbsp;4<br>ALT1&nbsp;=&nbsp;5<br>ALT2&nbsp;=&nbsp;6<br>ALT3&nbsp;=&nbsp;7<br>ALT4&nbsp;=&nbsp;3<br>ALT5&nbsp;=&nbsp;2<br>INPUT&nbsp;=&nbsp;0<br>OUTPUT&nbsp;=&nbsp;1<br></code><br><br>2. The mode of waveform transmission.
-<br><br><code>WAVE_MODE_ONE_SHOT&nbsp;=&nbsp;0<br>WAVE_MODE_REPEAT&nbsp;=&nbsp;1<br>WAVE_MODE_ONE_SHOT_SYNC&nbsp;=&nbsp;2<br>WAVE_MODE_REPEAT_SYNC&nbsp;=&nbsp;3<br></code><h3><a name="MOSI"></a>MOSI: </h3>The GPIO used for the MOSI signal when bit banging SPI.
-<h3><a name="offset"></a>offset: &gt;=0</h3>The offset wave data starts from the beginning of the waveform
-being currently defined.
-<h3><a name="pad"></a>pad: 0-2</h3>A set of GPIO which share common drivers.
-<br><br><table border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>Pad</td><td>GPIO</td></tr><tr><td>0</td><td>0-27</td></tr><tr><td>1</td><td>28-45</td></tr><tr><td>2</td><td>46-53</td></tr></tbody></table><h3><a name="pad_strength"></a>pad_strength: 1-16</h3>The mA which may be drawn from each GPIO whilst still guaranteeing the
-high and low levels.
-<h3><a name="params"></a>params: 32 bit number</h3>When scripts are started they can receive up to 10 parameters
-to define their operation.
-<h3><a name="percent"></a>percent: : 0-100</h3>The size of waveform as percentage of maximum available.
-<h3><a name="port"></a>port: </h3>The port used by the pigpio daemon, defaults to 8888.
-<h3><a name="pstring"></a>pstring: </h3>The string to be passed to a <a href="#shell">shell</a> script to be executed.
-<h3><a name="pud"></a>pud: 0-2</h3><code>PUD_DOWN&nbsp;=&nbsp;1<br>PUD_OFF&nbsp;=&nbsp;0<br>PUD_UP&nbsp;=&nbsp;2<br></code><h3><a name="pulse_len"></a>pulse_len: 1-100</h3>The length of the trigger pulse in microseconds.
-<h3><a name="pulses"></a>pulses: </h3>A list of class pulse objects defining the characteristics of a
-waveform.
-<h3><a name="pulsewidth"></a>pulsewidth: </h3>The servo pulsewidth in microseconds. 0 switches pulses off.
-<h3><a name="PWMduty"></a>PWMduty: 0-1000000 (1M)</h3>The hardware PWM dutycycle.
-<h3><a name="PWMfreq"></a>PWMfreq: 1-125M (1-187.5M for the BCM2711)</h3>The hardware PWM frequency.
-<h3><a name="range_"></a>range_: 25-40000</h3>Defines the limits for the <a href="#dutycycle">dutycycle</a> parameter.
-<br><br>range_ defaults to 255.
-<h3><a name="reg"></a>reg: 0-255</h3>An I2C device register. The usable registers depend on the
-actual device.
-<h3><a name="retMax"></a>retMax: &gt;=0</h3>The maximum number of bytes a user customised function
-should return, default 8192.
-<h3><a name="SCL"></a>SCL: </h3>The user GPIO to use for the clock when bit banging I2C.
-<h3><a name="SCLK"></a>SCLK: :</h3>The GPIO used for the SCLK signal when bit banging SPI.
-<h3><a name="script"></a>script: </h3>The text of a script to store on the pigpio daemon.
-<h3><a name="script_id"></a>script_id: &gt;=0</h3>A number referencing a script created by <a href="#store_script">store_script</a>.
-<h3><a name="SDA"></a>SDA: </h3>The user GPIO to use for data when bit banging I2C.
-<h3><a name="seek_from"></a>seek_from: 0-2</h3>Direction to seek for <a href="#file_seek">file_seek</a>.
-<br><br><code>FROM_START=0<br>FROM_CURRENT=1<br>FROM_END=2<br></code><h3><a name="seek_offset"></a>seek_offset: </h3>The number of bytes to move forward (positive) or backwards
-(negative) from the seek position (start, current, or end of file).
-<h3><a name="ser_flags"></a>ser_flags: 32 bit</h3>No serial flags are currently defined.
-<h3><a name="serial_*"></a>serial_*: </h3>One of the serial_ functions.
-<h3><a name="shellscr"></a>shellscr: </h3>The name of a shell script. The script must exist
-in /opt/pigpio/cgi and must be executable.
-<h3><a name="show_errors"></a>show_errors: </h3>Controls the display of pigpio daemon connection failures.
-The default of True prints the probable failure reasons to
-standard output.
-<h3><a name="spi_channel"></a>spi_channel: 0-2</h3>A SPI channel.
-<h3><a name="spi_flags"></a>spi_flags: 32 bit</h3>See <a href="#spi_open">spi_open</a>.
-<h3><a name="steady"></a>steady: 0-300000</h3>The number of microseconds level changes must be stable for
-before reporting the level changed (<a href="#set_glitch_filter">set_glitch_filter</a>)
-or triggering the active part of a noise filter
-(<a href="#set_noise_filter">set_noise_filter</a>).
-<h3><a name="t1"></a>t1: </h3>A tick (earlier).
-<h3><a name="t2"></a>t2: </h3>A tick (later).
-<h3><a name="tty"></a>tty: </h3>A Pi serial tty device, e.g. /dev/ttyAMA0, /dev/ttyUSB0
-<h3><a name="uint32"></a>uint32: </h3>An unsigned 32 bit number.
-<h3><a name="user_gpio"></a>user_gpio: 0-31</h3>A Broadcom numbered GPIO.
-<br><br>All the user GPIO are in the range 0-31.
-<br><br>Not all the GPIO within this range are usable, some are reserved
-for system use.
-<br><br>See <a href="#gpio">gpio</a>.
-<h3><a name="wait_timeout"></a>wait_timeout: 0.0 -</h3>The number of seconds to wait in <a href="#wait_for_edge">wait_for_edge</a> before timing out.
-<h3><a name="wave_add_*"></a>wave_add_*: </h3>One of the following
-<br><br><a href="#wave_add_new">wave_add_new</a>
-<a href="#wave_add_generic">wave_add_generic</a>
-<a href="#wave_add_serial">wave_add_serial</a>
-<h3><a name="wave_id"></a>wave_id: &gt;=0</h3>A number referencing a wave created by <a href="#wave_create">wave_create</a>.
-<h3><a name="wave_send_*"></a>wave_send_*: </h3>One of the following
-<br><br><a href="#wave_send_once">wave_send_once</a>
-<a href="#wave_send_repeat">wave_send_repeat</a>
-<h3><a name="wdog_timeout"></a>wdog_timeout: 0-60000</h3>Defines a GPIO watchdog timeout in milliseconds. If no level
-change is detected on the GPIO for timeout millisecond a watchdog
-timeout report is issued (with level TIMEOUT).
-<h3><a name="word_val"></a>word_val: 0-65535</h3>A whole number.
-<br><br> \ No newline at end of file
diff --git a/DOC/tmp/body/sif.body b/DOC/tmp/body/sif.body
deleted file mode 100644
index 1274ee9..0000000
--- a/DOC/tmp/body/sif.body
+++ /dev/null
@@ -1,1994 +0,0 @@
-
-pigpio provides a socket interface to many of its functions.<br>
-<br>
-The socket interface is available whenever pigpio is running,
-either because it has been started as a daemon, or it has been
-linked in to a running user program.<br>
-<br>
-The socket interface can be disabled by the program which
-initialises the library.&nbsp; pigpiod offers the -k option to
-disable the socket interface.&nbsp; User programs should call
-<a href="cif.html#gpioCfgInterfaces">gpioCfgInterfaces</a> if they
-wish to disable the socket interface.<br>
-<br>
-pigpio listens for connections on port 8888 by default.&nbsp; This
-default may be overridden when pigpio starts by the <a href=
-"cif.html#gpioCfgSocketPort">gpioCfgSocketPort</a> function
-call.&nbsp; The pigpio daemon uses this function to provide an
-option to change the port number.<br>
-<br>
-The pigs utility is an example of using the socket interface from
-C.<span style="font-weight: bold;"><br></span>
-<h3><a name="Request" id="Request"></a>Request</h3>
-<p>pigpio expects messages of type <a href=
-"sif.html#cmdCmd_t">cmdCmd_t</a> immediately followed with an
-extension for a few commands.<br>
-<br>
-The caller should fill in cmd, p1, p2, p3/res, and any extension as
-needed.&nbsp; p3 will always be zero unless the command requires an
-extension in which case p3 will be the length in bytes of the
-extension.<br>
-<br>
-The <a href="sif.html#cmdCmd_t">cmdCmd_t</a> is echoed back with
-the result, if any, in p3/res, and an extension immediately
-afterwards for a few commands.<br></p>
-<table summary="" style="width: 80%;" cellspacing="2" cellpadding=
-"2" border="1">
-<tbody>
-<tr>
-<td style="font-weight: bold;">COMMAND</td>
-<td style="font-weight: bold;">cmd<br></td>
-<td style="font-weight: bold;">p1</td>
-<td style="font-weight: bold;">p2</td>
-<td style="font-weight: bold;">p3</td>
-<td style="font-weight: bold;">Extension<br></td>
-</tr>
-<tr>
-<td>MODES</td>
-<td>0</td>
-<td>gpio</td>
-<td>mode</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>MODEG</td>
-<td>1</td>
-<td>gpio</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PUD</td>
-<td>2</td>
-<td>gpio</td>
-<td>pud</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>READ</td>
-<td>3</td>
-<td>gpio</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WRITE</td>
-<td>4</td>
-<td>gpio</td>
-<td>level</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PWM</td>
-<td>5</td>
-<td>gpio</td>
-<td>dutycycle</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PRS</td>
-<td>6</td>
-<td>gpio</td>
-<td>range</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PFS</td>
-<td>7</td>
-<td>gpio</td>
-<td>frequency</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SERVO</td>
-<td>8</td>
-<td>gpio</td>
-<td>pulsewidth</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WDOG</td>
-<td>9</td>
-<td>gpio</td>
-<td>timeout</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BR1</td>
-<td>10</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BR2</td>
-<td>11</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BC1</td>
-<td>12</td>
-<td>bits</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BC2</td>
-<td>13</td>
-<td>bits</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BS1</td>
-<td>14</td>
-<td>bits</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BS2</td>
-<td>15</td>
-<td>bits</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>TICK</td>
-<td>16</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>HWVER</td>
-<td>17</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>NO</td>
-<td>18</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>NB</td>
-<td>19</td>
-<td>handle</td>
-<td>bits</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>NP</td>
-<td>20</td>
-<td>handle</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>NC</td>
-<td>21</td>
-<td>handle</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PRG</td>
-<td>22</td>
-<td>gpio</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PFG</td>
-<td>23</td>
-<td>gpio</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PRRG</td>
-<td>24</td>
-<td>gpio</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>HELP<br></td>
-<td>25</td>
-<td>N/A<br></td>
-<td>N/A<br></td>
-<td>N/A<br></td>
-<td>N/A<br></td>
-</tr>
-<tr>
-<td>PIGPV</td>
-<td>26</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVCLR</td>
-<td>27</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVAG</td>
-<td>28</td>
-<td>0</td>
-<td>0</td>
-<td>12*X</td>
-<td>gpioPulse_t pulse[X]</td>
-</tr>
-<tr>
-<td>WVAS</td>
-<td>29</td>
-<td>gpio</td>
-<td>baud</td>
-<td>12+X</td>
-<td>uint32_t databits<br>
-uint32_t stophalfbits<br>
-uint32_t offset<br>
-uint8_t data[X]</td>
-</tr>
-<tr>
-<td>N/A<br></td>
-<td>30</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>N/A<br></td>
-<td>31</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVBSY</td>
-<td>32</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVHLT</td>
-<td>33</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVSM</td>
-<td>34</td>
-<td>subcmd</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVSP</td>
-<td>35</td>
-<td>subcmd</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVSC</td>
-<td>36</td>
-<td>subcmd</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>TRIG</td>
-<td>37</td>
-<td>gpio</td>
-<td>pulselen</td>
-<td>4</td>
-<td>uint32_t level</td>
-</tr>
-<tr>
-<td>PROC</td>
-<td>38</td>
-<td>0</td>
-<td>0</td>
-<td>X</td>
-<td>uint8_t text[X]</td>
-</tr>
-<tr>
-<td>PROCD</td>
-<td>39</td>
-<td>script_id</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PROCR</td>
-<td>40</td>
-<td>script_id</td>
-<td>0</td>
-<td>4*X<br></td>
-<td>uint32_t pars[X]<br></td>
-</tr>
-<tr>
-<td>PROCS</td>
-<td>41</td>
-<td>script_id</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SLRO</td>
-<td>42</td>
-<td>gpio</td>
-<td>baud</td>
-<td>4</td>
-<td>uint32_t databits<br></td>
-</tr>
-<tr>
-<td>SLR</td>
-<td>43</td>
-<td>gpio</td>
-<td>count</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SLRC</td>
-<td>44</td>
-<td>gpio</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PROCP</td>
-<td>45</td>
-<td>script_id</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>MICS</td>
-<td>46</td>
-<td>micros</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>MILS</td>
-<td>47</td>
-<td>millis</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PARSE</td>
-<td>48</td>
-<td>N/A</td>
-<td>N/A<br></td>
-<td>N/A<br></td>
-<td>N/A</td>
-</tr>
-<tr>
-<td>WVCRE</td>
-<td>49</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVDEL</td>
-<td>50</td>
-<td>wave_id</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVTX</td>
-<td>51</td>
-<td>wave_id</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVTXR</td>
-<td>52</td>
-<td>wave_id</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVNEW</td>
-<td>53</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CO</td>
-<td>54</td>
-<td>bus</td>
-<td>device</td>
-<td>4</td>
-<td>uint32_t flags</td>
-</tr>
-<tr>
-<td>I2CC</td>
-<td>55</td>
-<td>handle</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CRD</td>
-<td>56</td>
-<td>handle</td>
-<td>count</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CWD</td>
-<td>57</td>
-<td>handle</td>
-<td>0</td>
-<td>X</td>
-<td>uint8_t data[X]</td>
-</tr>
-<tr>
-<td>I2CWQ</td>
-<td>58</td>
-<td>handle</td>
-<td>bit</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CRS</td>
-<td>59</td>
-<td>handle</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CWS</td>
-<td>60</td>
-<td>handle</td>
-<td>byte</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CRB</td>
-<td>61</td>
-<td>handle</td>
-<td>register</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CWB</td>
-<td>62</td>
-<td>handle</td>
-<td>register</td>
-<td>4</td>
-<td>uint32_t byte</td>
-</tr>
-<tr>
-<td>I2CRW</td>
-<td>63</td>
-<td>handle</td>
-<td>register</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CWW</td>
-<td>64</td>
-<td>handle</td>
-<td>register</td>
-<td>4</td>
-<td>uint32_t word</td>
-</tr>
-<tr>
-<td>I2CRK</td>
-<td>65</td>
-<td>handle</td>
-<td>register<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CWK</td>
-<td>66</td>
-<td>handle</td>
-<td>register<br></td>
-<td>X</td>
-<td>uint8_t bvs[X]<br></td>
-</tr>
-<tr>
-<td>I2CRI</td>
-<td>67</td>
-<td>handle</td>
-<td>register<br></td>
-<td>4</td>
-<td>uint32_t num<br></td>
-</tr>
-<tr>
-<td>I2CWI</td>
-<td>68</td>
-<td>handle</td>
-<td>register<br></td>
-<td>X<br></td>
-<td>uint8_t bvs[X]<br></td>
-</tr>
-<tr>
-<td>I2CPC</td>
-<td>69</td>
-<td>handle</td>
-<td>register<br></td>
-<td>4</td>
-<td>uint32_t word<br></td>
-</tr>
-<tr>
-<td>I2CPK</td>
-<td>70</td>
-<td>handle</td>
-<td>register<br></td>
-<td>X<br></td>
-<td>uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td>SPIO<br></td>
-<td>71</td>
-<td>channel</td>
-<td>baud</td>
-<td>4</td>
-<td>uint32_t flags</td>
-</tr>
-<tr>
-<td>SPIC</td>
-<td>72</td>
-<td>handle</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SPIR</td>
-<td>73</td>
-<td>handle</td>
-<td>count</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SPIW</td>
-<td>74</td>
-<td>handle</td>
-<td>0</td>
-<td>X</td>
-<td>uint8_t data[X]</td>
-</tr>
-<tr>
-<td>SPIX</td>
-<td>75</td>
-<td>handle</td>
-<td>0</td>
-<td>X</td>
-<td>uint8_t data[X]</td>
-</tr>
-<tr>
-<td>SERO</td>
-<td>76</td>
-<td>baud</td>
-<td>flags</td>
-<td>X</td>
-<td>uint8_t device[X]</td>
-</tr>
-<tr>
-<td>SERC</td>
-<td>77</td>
-<td>handle</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SERRB</td>
-<td>78</td>
-<td>handle</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SERWB</td>
-<td>79</td>
-<td>handle</td>
-<td>byte</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SERR</td>
-<td>80</td>
-<td>handle</td>
-<td>count</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SERW</td>
-<td>81</td>
-<td>handle</td>
-<td>0</td>
-<td>X</td>
-<td>uint8_t data[X]</td>
-</tr>
-<tr>
-<td>SERDA</td>
-<td>82</td>
-<td>handle</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">GDC<br></td>
-<td style="vertical-align: top;">83<br></td>
-<td style="vertical-align: top;">gpio<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">GPW<br></td>
-<td style="vertical-align: top;">84<br></td>
-<td style="vertical-align: top;">gpio<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">HC<br></td>
-<td style="vertical-align: top;">85<br></td>
-<td style="vertical-align: top;">gpio<br></td>
-<td style="vertical-align: top;">frequency<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">HP<br></td>
-<td style="vertical-align: top;">86<br></td>
-<td style="vertical-align: top;">gpio<br></td>
-<td style="vertical-align: top;">frequency<br></td>
-<td style="vertical-align: top;">4<br></td>
-<td style="vertical-align: top;">uint32_t dutycycle<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">CF1<br></td>
-<td style="vertical-align: top;">87<br></td>
-<td style="vertical-align: top;">arg1<br></td>
-<td style="vertical-align: top;">arg2<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t argx[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">CF2<br></td>
-<td style="vertical-align: top;">88<br></td>
-<td style="vertical-align: top;">arg1<br></td>
-<td style="vertical-align: top;">retMax<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t argx[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BI2CC<br></td>
-<td style="vertical-align: top;">89<br></td>
-<td style="vertical-align: top;">sda<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BI2CO<br></td>
-<td style="vertical-align: top;">90<br></td>
-<td style="vertical-align: top;">sda<br></td>
-<td style="vertical-align: top;">scl<br></td>
-<td style="vertical-align: top;">4<br></td>
-<td style="vertical-align: top;">uint32_t baud<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BI2CZ<br></td>
-<td style="vertical-align: top;">91<br></td>
-<td style="vertical-align: top;">sda<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">I2CZ<br></td>
-<td style="vertical-align: top;">92<br></td>
-<td style="vertical-align: top;">handle<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">WVCHA<br></td>
-<td style="vertical-align: top;">93<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">SLRI<br></td>
-<td style="vertical-align: top;">94<br></td>
-<td style="vertical-align: top;">gpio<br></td>
-<td style="vertical-align: top;">invert<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">CGI<br></td>
-<td style="vertical-align: top;">95<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">CSI<br></td>
-<td style="vertical-align: top;">96<br></td>
-<td style="vertical-align: top;">config<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FG<br></td>
-<td style="vertical-align: top;">97<br></td>
-<td style="vertical-align: top;">gpio<br></td>
-<td style="vertical-align: top;">steady<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FN<br></td>
-<td style="vertical-align: top;">98<br></td>
-<td style="vertical-align: top;">gpio<br></td>
-<td style="vertical-align: top;">steady<br></td>
-<td style="vertical-align: top;">4<br></td>
-<td style="vertical-align: top;">uint32_t active<br></td>
-</tr>
-<tr>
-<td>NOIB</td>
-<td>99</td>
-<td>0</td>
-<td>0</td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">WVTXM<br></td>
-<td style="vertical-align: top;">100<br></td>
-<td style="vertical-align: top;">wave_id<br></td>
-<td style="vertical-align: top;">mode<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">WVTAT<br></td>
-<td style="vertical-align: top;">101<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">PADS<br></td>
-<td style="vertical-align: top;">102<br></td>
-<td style="vertical-align: top;">pad<br></td>
-<td style="vertical-align: top;">strength<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">PADG<br></td>
-<td style="vertical-align: top;">103<br></td>
-<td style="vertical-align: top;">pad<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FO<br></td>
-<td style="vertical-align: top;">104<br></td>
-<td style="vertical-align: top;">mode<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t file[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FC<br></td>
-<td style="vertical-align: top;">105<br></td>
-<td style="vertical-align: top;">handle<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FR<br></td>
-<td style="vertical-align: top;">106<br></td>
-<td style="vertical-align: top;">handle<br></td>
-<td style="vertical-align: top;">count<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FW<br></td>
-<td style="vertical-align: top;">107<br></td>
-<td style="vertical-align: top;">handle<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FS<br></td>
-<td style="vertical-align: top;">108<br></td>
-<td style="vertical-align: top;">handle<br></td>
-<td style="vertical-align: top;">offset<br></td>
-<td style="vertical-align: top;">4<br></td>
-<td style="vertical-align: top;">uint32_t from<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FL<br></td>
-<td style="vertical-align: top;">109<br></td>
-<td style="vertical-align: top;">count<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t pattern[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">SHELL<br></td>
-<td style="vertical-align: top;">110<br></td>
-<td style="vertical-align: top;">len(name)<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">len(name)+<br>
-1+<br>
-len(string)<br></td>
-<td style="vertical-align: top;">uint8_t name[len(name)]<br>
-uint8_t null (0)<br>
-uint8_t string[len(string)]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BSPIC<br></td>
-<td style="vertical-align: top;">111<br></td>
-<td style="vertical-align: top;">CS<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BSPIO<br></td>
-<td style="vertical-align: top;">112<br></td>
-<td style="vertical-align: top;">CS<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">20<br></td>
-<td style="vertical-align: top;">uint32_t MISO<br>
-uint32_t MOSI<br>
-uint32_t SCLK<br>
-uint32_t baud<br>
-uint32_t spi_flags<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BSPIX<br></td>
-<td style="vertical-align: top;">113<br></td>
-<td style="vertical-align: top;">CS<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BSCX<br></td>
-<td style="vertical-align: top;">114<br></td>
-<td style="vertical-align: top;">control<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">EVM<br></td>
-<td style="vertical-align: top;">115<br></td>
-<td style="vertical-align: top;">handle<br></td>
-<td style="vertical-align: top;">bits<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">EVT<br></td>
-<td style="vertical-align: top;">116<br></td>
-<td style="vertical-align: top;">event<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td valign="top">PROCU<br></td>
-<td valign="top">117<br></td>
-<td valign="top">script_id<br></td>
-<td valign="top">0<br></td>
-<td valign="top">4*X<br></td>
-<td valign="top">uint32_t pars[X]<br></td>
-</tr>
-</tbody>
-</table>
-<h3><a name="Response" id="Response"></a>Response</h3>
-<p>The response has cmd/p1/p2 as in the request.&nbsp; p3/res holds
-the return value.&nbsp; If the command returns additional values
-they will be in the immediately following extension.<br></p>
-Normally res should be treated as a 32 bit signed value and will be
-greater than or equal to zero.&nbsp; Upon failure res will be less
-than 0 and contains an error code.<br>
-<p>There are a few commands where the returned value should be
-treated as a 32 bit unsigned value.&nbsp; These commands can not
-fail.&nbsp; They are indicated with a * after the command
-name.<br></p>
-<p>Commands with an extension have the size of the extension in
-bytes returned in res (or &lt;0 on error as above).</p>
-<table summary="" style="width: 80%;" cellspacing="2" cellpadding=
-"2" border="1">
-<tbody>
-<tr>
-<td style="font-weight: bold;">COMMAND</td>
-<td style="font-weight: bold;">cmd<br></td>
-<td style="vertical-align: top; font-weight: bold;">p1<br></td>
-<td style="vertical-align: top; font-weight: bold;">p2<br></td>
-<td style="font-weight: bold;">res<br></td>
-<td style="font-weight: bold;">Extension<br></td>
-</tr>
-<tr>
-<td>MODES</td>
-<td>0</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>MODEG</td>
-<td>1</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>mode<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PUD</td>
-<td>2</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>READ</td>
-<td>3</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>level<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WRITE</td>
-<td>4</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PWM</td>
-<td>5</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PRS</td>
-<td>6</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PFS</td>
-<td>7</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SERVO</td>
-<td>8</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WDOG</td>
-<td>9</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BR1 *</td>
-<td>10</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>bits<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BR2 *</td>
-<td>11</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>bits<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BC1</td>
-<td>12</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BC2</td>
-<td>13</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BS1</td>
-<td>14</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>BS2</td>
-<td>15</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>TICK *<br></td>
-<td>16</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>tick<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>HWVER *<br></td>
-<td>17</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>version<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>NO</td>
-<td>18</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>handle<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>NB</td>
-<td>19</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>NP</td>
-<td>20</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>NC</td>
-<td>21</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PRG</td>
-<td>22</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>range<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PFG</td>
-<td>23</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>frequency<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PRRG</td>
-<td>24</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>real range<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>HELP</td>
-<td>25</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>N/A<br></td>
-<td>N/A<br></td>
-</tr>
-<tr>
-<td>PIGPV *<br></td>
-<td>26</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>version<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVCLR</td>
-<td>27</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVAG</td>
-<td>28</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>wave pulses<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVAS</td>
-<td>29</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>wave pulses<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>N/A<br></td>
-<td>30</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>-<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>N/A<br></td>
-<td>31</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>-<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVBSY</td>
-<td>32</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>busy (1) or not busy (0)<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVHLT</td>
-<td>33</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVSM</td>
-<td>34</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>wave micros<br>
-wave micros - high<br>
-wave micros - max<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVSP</td>
-<td>35</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>wave pulses<br>
-wave pulses - high<br>
-wave pulses - max<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVSC</td>
-<td>36</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>wave DMA CBs<br>
-wave DMA CBs - high<br>
-wave DMA CBs - max<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>TRIG</td>
-<td>37</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0<br></td>
-<td>-</td>
-</tr>
-<tr>
-<td>PROC</td>
-<td>38</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>script id<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PROCD</td>
-<td>39</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PROCR</td>
-<td>40</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>script status<br></td>
-<td>-</td>
-</tr>
-<tr>
-<td>PROCS</td>
-<td>41</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SLRO</td>
-<td>42</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SLR</td>
-<td>43</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>X<br></td>
-<td>uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td>SLRC</td>
-<td>44</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PROCP</td>
-<td>45</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>44</td>
-<td>uint32_t script_status<br>
-uint32_t pars[10]<br></td>
-</tr>
-<tr>
-<td>MICS</td>
-<td>46</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>MILS</td>
-<td>47</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>PARSE</td>
-<td>48</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>N/A<br></td>
-<td>-</td>
-</tr>
-<tr>
-<td>WVCRE</td>
-<td>49</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>wave id<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVDEL</td>
-<td>50</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVTX</td>
-<td>51</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>wave DMA CBs<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVTXR</td>
-<td>52</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>wave DMA CBs<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>WVNEW</td>
-<td>53</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CO</td>
-<td>54</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>handle</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CC</td>
-<td>55</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CRD</td>
-<td>56</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>X<br></td>
-<td>uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td>I2CWD</td>
-<td>57</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CWQ</td>
-<td>58</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CRS</td>
-<td>59</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>byte value<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CWS</td>
-<td>60</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CRB</td>
-<td>61</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>byte value<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CWB</td>
-<td>62</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CRW</td>
-<td>63</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>word value<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CWW</td>
-<td>64</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CRK</td>
-<td>65</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CWK</td>
-<td>66</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CRI</td>
-<td>67</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>X<br></td>
-<td>uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td>I2CWI</td>
-<td>68</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CPC</td>
-<td>69</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>word value<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>I2CPK</td>
-<td>70</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>X<br></td>
-<td>uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td>SPIO<br></td>
-<td>71</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>handle<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SPIC</td>
-<td>72</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SPIR</td>
-<td>73</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>X<br></td>
-<td>uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td>SPIW</td>
-<td>74</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SPIX</td>
-<td>75</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>X</td>
-<td>uint8_t data[X]</td>
-</tr>
-<tr>
-<td>SERO</td>
-<td>76</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>handle<br></td>
-<td>-</td>
-</tr>
-<tr>
-<td>SERC</td>
-<td>77</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SERRB</td>
-<td>78</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>byte value<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SERWB</td>
-<td>79</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SERR</td>
-<td>80</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>X<br></td>
-<td>uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td>SERW</td>
-<td>81</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td>SERDA</td>
-<td>82</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>data ready count<br></td>
-<td>-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">GDC<br></td>
-<td style="vertical-align: top;">83<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">dutycycle<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">GPW<br></td>
-<td style="vertical-align: top;">84<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">pulsewidth<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">HC<br></td>
-<td style="vertical-align: top;">85<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">HP<br></td>
-<td style="vertical-align: top;">86<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">CF1<br></td>
-<td style="vertical-align: top;">87<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">value<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">CF2<br></td>
-<td style="vertical-align: top;">88<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t retBuf[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BI2CC<br></td>
-<td style="vertical-align: top;">89<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BI2CO<br></td>
-<td style="vertical-align: top;">90<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">handle<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BI2CZ<br></td>
-<td style="vertical-align: top;">91<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">I2CZ<br></td>
-<td style="vertical-align: top;">92<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">WVCHA<br></td>
-<td style="vertical-align: top;">93<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">SLRI<br></td>
-<td style="vertical-align: top;">94<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">CGI<br></td>
-<td style="vertical-align: top;">95<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">config<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">CSI<br></td>
-<td style="vertical-align: top;">96<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FG<br></td>
-<td style="vertical-align: top;">97<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FN<br></td>
-<td style="vertical-align: top;">98<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td>NOIB</td>
-<td>99</td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td>0</td>
-<td>-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">WVTXM<br></td>
-<td style="vertical-align: top;">100<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">wave DMA CBs<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">WVTAT<br></td>
-<td style="vertical-align: top;">101<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">wave id<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">PADS<br></td>
-<td style="vertical-align: top;">102<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">PADG<br></td>
-<td style="vertical-align: top;">103<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">strength<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FO<br></td>
-<td style="vertical-align: top;">104<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">handle<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FC<br></td>
-<td style="vertical-align: top;">105<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FR<br></td>
-<td style="vertical-align: top;">106<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t data[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FW<br></td>
-<td style="vertical-align: top;">107<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FS<br></td>
-<td style="vertical-align: top;">108<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">position<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">FL<br></td>
-<td style="vertical-align: top;">109<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t filenames[X]<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">SHELL<br></td>
-<td style="vertical-align: top;">110<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">exit status<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BSPIC<br></td>
-<td style="vertical-align: top;">111<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BSPIO<br></td>
-<td style="vertical-align: top;">112<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BSPIX<br></td>
-<td style="vertical-align: top;">113<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">X<br></td>
-<td style="vertical-align: top;">uint8_t data[X]</td>
-</tr>
-<tr>
-<td style="vertical-align: top;">BSCX<br></td>
-<td style="vertical-align: top;">114<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">X+4<br></td>
-<td style="vertical-align: top;">uint32_t status<br>
-uint8_t data[X]</td>
-</tr>
-<tr>
-<td style="vertical-align: top;">EVM<br></td>
-<td style="vertical-align: top;">115<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td style="vertical-align: top;">EVT<br></td>
-<td style="vertical-align: top;">116<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">-<br></td>
-<td style="vertical-align: top;">0<br></td>
-<td style="vertical-align: top;">-<br></td>
-</tr>
-<tr>
-<td valign="top">PROCU<br></td>
-<td valign="top">117<br></td>
-<td valign="top">-<br></td>
-<td valign="top">-<br></td>
-<td valign="top">0<br></td>
-<td valign="top">-<br></td>
-</tr>
-</tbody>
-</table>
-<code><br></code>
-<h3><a name="cmdCmd_t" id="cmdCmd_t"></a>cmdCmd_t</h3>
-<code>typedef struct<br>
-{<br>
-&nbsp;&nbsp; uint32_t cmd;<br>
-&nbsp;&nbsp; uint32_t p1;<br>
-&nbsp;&nbsp; uint32_t p2;<br>
-&nbsp;&nbsp; union<br>
-&nbsp;&nbsp; {<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uint32_t p3;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uint32_t ext_len;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uint32_t res;<br>
-&nbsp;&nbsp; };<br>
-} cmdCmd_t;<br></code><br>
diff --git a/DOC/tmp/pydoc/pigpio.pydoc b/DOC/tmp/pydoc/pigpio.pydoc
deleted file mode 100644
index c5dbdc2..0000000
--- a/DOC/tmp/pydoc/pigpio.pydoc
+++ /dev/null
@@ -1,4162 +0,0 @@
-Help on module pigpio:
-
-NAME
- pigpio
-
-FILE
- /mnt/d/Users/guy/Projects/pigpio/pigpio.py
-
-DESCRIPTION
- pigpio is a Python module for the Raspberry which talks to
- the pigpio daemon to allow control of the general purpose
- input outputs (GPIO).
-
- [http://abyz.me.uk/rpi/pigpio/python.html]
-
- *Features*
-
- o the pigpio Python module can run on Windows, Macs, or Linux
-
- o controls one or more Pi's
-
- o hardware timed PWM on any of GPIO 0-31
-
- o hardware timed servo pulses on any of GPIO 0-31
-
- o callbacks when any of GPIO 0-31 change state
-
- o creating and transmitting precisely timed waveforms
-
- o reading/writing GPIO and setting their modes
-
- o wrappers for I2C, SPI, and serial links
-
- o creating and running scripts on the pigpio daemon
-
- *GPIO*
-
- ALL GPIO are identified by their Broadcom number.
-
- *Notes*
-
- Transmitted waveforms are accurate to a microsecond.
-
- Callback level changes are time-stamped and will be
- accurate to within a few microseconds.
-
- *Settings*
-
- A number of settings are determined when the pigpio daemon is started.
-
- o the sample rate (1, 2, 4, 5, 8, or 10 us, default 5 us).
-
- o the set of GPIO which may be updated (generally written to). The
- default set is those available on the Pi board revision.
-
- o the available PWM frequencies (see [*set_PWM_frequency*]).
-
- *Exceptions*
-
- By default a fatal exception is raised if you pass an invalid
- argument to a pigpio function.
-
- If you wish to handle the returned status yourself you should set
- pigpio.exceptions to False.
-
- You may prefer to check the returned status in only a few parts
- of your code. In that case do the following:
-
- ...
- pigpio.exceptions = False
-
- # Code where you want to test the error status.
-
- pigpio.exceptions = True
- ...
-
- *Usage*
-
- This module uses the services of the C pigpio library. pigpio
- must be running on the Pi(s) whose GPIO are to be manipulated.
-
- The normal way to start pigpio is as a daemon (during system
- start).
-
- sudo pigpiod
-
- Your Python program must import pigpio and create one or more
- instances of the pigpio.pi class. This class gives access to
- a specified Pi's GPIO.
-
- ...
- pi1 = pigpio.pi() # pi1 accesses the local Pi's GPIO
- pi2 = pigpio.pi('tom') # pi2 accesses tom's GPIO
- pi3 = pigpio.pi('dick') # pi3 accesses dick's GPIO
-
- pi1.write(4, 0) # set local Pi's GPIO 4 low
- pi2.write(4, 1) # set tom's GPIO 4 to high
- pi3.read(4) # get level of dick's GPIO 4
- ...
-
- The later example code snippets assume that pi is an instance of
- the pigpio.pi class.
-
- OVERVIEW
-
- ESSENTIAL
-
- pigpio.pi Initialise Pi connection
- stop Stop a Pi connection
-
- BASIC
-
- set_mode Set a GPIO mode
- get_mode Get a GPIO mode
-
- set_pull_up_down Set/clear GPIO pull up/down resistor
-
- read Read a GPIO
- write Write a GPIO
-
- PWM_(overrides_servo_commands_on_same_GPIO)
-
- set_PWM_dutycycle Start/stop PWM pulses on a GPIO
- set_PWM_frequency Set PWM frequency of a GPIO
- set_PWM_range Configure PWM range of a GPIO
-
- get_PWM_dutycycle Get PWM dutycycle set on a GPIO
- get_PWM_frequency Get PWM frequency of a GPIO
- get_PWM_range Get configured PWM range of a GPIO
-
- get_PWM_real_range Get underlying PWM range for a GPIO
-
- Servo_(overrides_PWM_commands_on_same_GPIO)
-
- set_servo_pulsewidth Start/Stop servo pulses on a GPIO
-
- get_servo_pulsewidth Get servo pulsewidth set on a GPIO
-
- INTERMEDIATE
-
- gpio_trigger Send a trigger pulse to a GPIO
-
- set_watchdog Set a watchdog on a GPIO
-
- read_bank_1 Read all bank 1 GPIO
- read_bank_2 Read all bank 2 GPIO
-
- clear_bank_1 Clear selected GPIO in bank 1
- clear_bank_2 Clear selected GPIO in bank 2
-
- set_bank_1 Set selected GPIO in bank 1
- set_bank_2 Set selected GPIO in bank 2
-
- callback Create GPIO level change callback
-
- wait_for_edge Wait for GPIO level change
-
- ADVANCED
-
- notify_open Request a notification handle
- notify_begin Start notifications for selected GPIO
- notify_pause Pause notifications
- notify_close Close a notification
-
- hardware_clock Start hardware clock on supported GPIO
-
- hardware_PWM Start hardware PWM on supported GPIO
-
- set_glitch_filter Set a glitch filter on a GPIO
- set_noise_filter Set a noise filter on a GPIO
-
- set_pad_strength Sets a pads drive strength
- get_pad_strength Gets a pads drive strength
-
- shell Executes a shell command
-
- Custom
-
- custom_1 User custom function 1
- custom_2 User custom function 2
-
- Events
-
- event_callback Sets a callback for an event
-
- event_trigger Triggers an event
-
- wait_for_event Wait for an event
-
- Scripts
-
- store_script Store a script
- run_script Run a stored script
- update_script Set a scripts parameters
- script_status Get script status and parameters
- stop_script Stop a running script
- delete_script Delete a stored script
-
- I2C
-
- i2c_open Opens an I2C device
- i2c_close Closes an I2C device
-
- i2c_write_quick SMBus write quick
-
- i2c_read_byte SMBus read byte
- i2c_write_byte SMBus write byte
-
- i2c_read_byte_data SMBus read byte data
- i2c_write_byte_data SMBus write byte data
-
- i2c_read_word_data SMBus read word data
- i2c_write_word_data SMBus write word data
-
- i2c_read_block_data SMBus read block data
- i2c_write_block_data SMBus write block data
-
- i2c_read_i2c_block_data SMBus read I2C block data
- i2c_write_i2c_block_data SMBus write I2C block data
-
- i2c_read_device Reads the raw I2C device
- i2c_write_device Writes the raw I2C device
-
- i2c_process_call SMBus process call
- i2c_block_process_call SMBus block process call
-
- i2c_zip Performs multiple I2C transactions
-
- I2C_BIT_BANG
-
- bb_i2c_open Opens GPIO for bit banging I2C
- bb_i2c_close Closes GPIO for bit banging I2C
-
- bb_i2c_zip Performs multiple bit banged I2C transactions
-
- I2C/SPI_SLAVE
-
- bsc_xfer I2C/SPI as slave transfer
- bsc_i2c I2C as slave transfer
-
- SERIAL
-
- serial_open Opens a serial device
- serial_close Closes a serial device
-
- serial_read_byte Reads a byte from a serial device
- serial_write_byte Writes a byte to a serial device
-
- serial_read Reads bytes from a serial device
- serial_write Writes bytes to a serial device
-
- serial_data_available Returns number of bytes ready to be read
-
- SERIAL_BIT_BANG_(read_only)
-
- bb_serial_read_open Open a GPIO for bit bang serial reads
- bb_serial_read_close Close a GPIO for bit bang serial reads
-
- bb_serial_invert Invert serial logic (1 invert, 0 normal)
-
- bb_serial_read Read bit bang serial data from a GPIO
-
- SPI
-
- spi_open Opens a SPI device
- spi_close Closes a SPI device
-
- spi_read Reads bytes from a SPI device
- spi_write Writes bytes to a SPI device
- spi_xfer Transfers bytes with a SPI device
-
- SPI_BIT_BANG
-
- bb_spi_open Opens GPIO for bit banging SPI
- bb_spi_close Closes GPIO for bit banging SPI
- bb_spi_xfer Transfers bytes with bit banging SPI
-
- FILES
-
- file_open Opens a file
- file_close Closes a file
-
- file_read Reads bytes from a file
- file_write Writes bytes to a file
-
- file_seek Seeks to a position within a file
-
- file_list List files which match a pattern
-
- WAVES
-
- wave_clear Deletes all waveforms
-
- wave_add_new Starts a new waveform
- wave_add_generic Adds a series of pulses to the waveform
- wave_add_serial Adds serial data to the waveform
-
- wave_create Creates a waveform from added data
- wave_create_and_pad Creates a waveform of fixed size from added data
- wave_delete Deletes a waveform
-
- wave_send_once Transmits a waveform once
- wave_send_repeat Transmits a waveform repeatedly
- wave_send_using_mode Transmits a waveform in the chosen mode
-
- wave_chain Transmits a chain of waveforms
-
- wave_tx_at Returns the current transmitting waveform
-
- wave_tx_busy Checks to see if a waveform has ended
-
- wave_tx_stop Aborts the current waveform
-
- wave_get_cbs Length in cbs of the current waveform
- wave_get_max_cbs Absolute maximum allowed cbs
-
- wave_get_micros Length in microseconds of the current waveform
- wave_get_max_micros Absolute maximum allowed micros
-
- wave_get_pulses Length in pulses of the current waveform
- wave_get_max_pulses Absolute maximum allowed pulses
-
- UTILITIES
-
- get_current_tick Get current tick (microseconds)
-
- get_hardware_revision Get hardware revision
- get_pigpio_version Get the pigpio version
-
- pigpio.error_text Gets error text from error number
- pigpio.tickDiff Returns difference between two ticks
-
-CLASSES
- exceptions.Exception(exceptions.BaseException)
- error
- pi
- pulse
-
- class error(exceptions.Exception)
- | pigpio module exception
- |
- | Method resolution order:
- | error
- | exceptions.Exception
- | exceptions.BaseException
- | __builtin__.object
- |
- | Methods defined here:
- |
- | __init__(self, value)
- |
- | __str__(self)
- |
- | ----------------------------------------------------------------------
- | Data descriptors defined here:
- |
- | __weakref__
- | list of weak references to the object (if defined)
- |
- | ----------------------------------------------------------------------
- | Data and other attributes inherited from exceptions.Exception:
- |
- | __new__ = <built-in method __new__ of type object>
- | T.__new__(S, ...) -> a new object with type S, a subtype of T
- |
- | ----------------------------------------------------------------------
- | Methods inherited from exceptions.BaseException:
- |
- | __delattr__(...)
- | x.__delattr__('name') <==> del x.name
- |
- | __getattribute__(...)
- | x.__getattribute__('name') <==> x.name
- |
- | __getitem__(...)
- | x.__getitem__(y) <==> x[y]
- |
- | __getslice__(...)
- | x.__getslice__(i, j) <==> x[i:j]
- |
- | Use of negative indices is not supported.
- |
- | __reduce__(...)
- |
- | __repr__(...)
- | x.__repr__() <==> repr(x)
- |
- | __setattr__(...)
- | x.__setattr__('name', value) <==> x.name = value
- |
- | __setstate__(...)
- |
- | __unicode__(...)
- |
- | ----------------------------------------------------------------------
- | Data descriptors inherited from exceptions.BaseException:
- |
- | __dict__
- |
- | args
- |
- | message
-
- class pi
- | Methods defined here:
- |
- | __init__(self, host='localhost', port=8888, show_errors=True)
- | Grants access to a Pi's GPIO.
- |
- | host:= the host name of the Pi on which the pigpio daemon is
- | running. The default is localhost unless overridden by
- | the PIGPIO_ADDR environment variable.
- |
- | port:= the port number on which the pigpio daemon is listening.
- | The default is 8888 unless overridden by the PIGPIO_PORT
- | environment variable. The pigpio daemon must have been
- | started with the same port number.
- |
- | This connects to the pigpio daemon and reserves resources
- | to be used for sending commands and receiving notifications.
- |
- | An instance attribute [*connected*] may be used to check the
- | success of the connection. If the connection is established
- | successfully [*connected*] will be True, otherwise False.
- |
- | ...
- | pi = pigio.pi() # use defaults
- | pi = pigpio.pi('mypi') # specify host, default port
- | pi = pigpio.pi('mypi', 7777) # specify host and port
- |
- | pi = pigpio.pi() # exit script if no connection
- | if not pi.connected:
- | exit()
- | ...
- |
- | __repr__(self)
- |
- | bb_i2c_close(self, SDA)
- | This function stops bit banging I2C on a pair of GPIO
- | previously opened with [*bb_i2c_open*].
- |
- | SDA:= 0-31, the SDA GPIO used in a prior call to [*bb_i2c_open*]
- |
- | Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_I2C_GPIO.
- |
- | ...
- | pi.bb_i2c_close(SDA)
- | ...
- |
- | bb_i2c_open(self, SDA, SCL, baud=100000)
- | This function selects a pair of GPIO for bit banging I2C at a
- | specified baud rate.
- |
- | Bit banging I2C allows for certain operations which are not possible
- | with the standard I2C driver.
- |
- | o baud rates as low as 50
- | o repeated starts
- | o clock stretching
- | o I2C on any pair of spare GPIO
- |
- | SDA:= 0-31
- | SCL:= 0-31
- | baud:= 50-500000
- |
- | Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_I2C_BAUD, or
- | PI_GPIO_IN_USE.
- |
- | NOTE:
- |
- | The GPIO used for SDA and SCL must have pull-ups to 3V3 connected.
- | As a guide the hardware pull-ups on pins 3 and 5 are 1k8 in value.
- |
- | ...
- | h = pi.bb_i2c_open(4, 5, 50000) # bit bang on GPIO 4/5 at 50kbps
- | ...
- |
- | bb_i2c_zip(self, SDA, data)
- | This function executes a sequence of bit banged I2C operations.
- | The operations to be performed are specified by the contents
- | of data which contains the concatenated command codes and
- | associated data.
- |
- | SDA:= 0-31 (as used in a prior call to [*bb_i2c_open*])
- | data:= the concatenated I2C commands, see below
- |
- | The returned value is a tuple of the number of bytes read and a
- | bytearray containing the bytes. If there was an error the
- | number of bytes read will be less than zero (and will contain
- | the error code).
- |
- | ...
- | (count, data) = pi.bb_i2c_zip(
- | SDA, [4, 0x53, 2, 7, 1, 0x32, 2, 6, 6, 3, 0])
- | ...
- |
- | The following command codes are supported:
- |
- | Name @ Cmd & Data @ Meaning
- | End @ 0 @ No more commands
- | Escape @ 1 @ Next P is two bytes
- | Start @ 2 @ Start condition
- | Stop @ 3 @ Stop condition
- | Address @ 4 P @ Set I2C address to P
- | Flags @ 5 lsb msb @ Set I2C flags to lsb + (msb << 8)
- | Read @ 6 P @ Read P bytes of data
- | Write @ 7 P ... @ Write P bytes of data
- |
- | The address, read, and write commands take a parameter P.
- | Normally P is one byte (0-255). If the command is preceded by
- | the Escape command then P is two bytes (0-65535, least significant
- | byte first).
- |
- | The address and flags default to 0. The address and flags maintain
- | their previous value until updated.
- |
- | No flags are currently defined.
- |
- | Any read I2C data is concatenated in the returned bytearray.
- |
- | ...
- | Set address 0x53
- | start, write 0x32, (re)start, read 6 bytes, stop
- | Set address 0x1E
- | start, write 0x03, (re)start, read 6 bytes, stop
- | Set address 0x68
- | start, write 0x1B, (re)start, read 8 bytes, stop
- | End
- |
- | 0x04 0x53
- | 0x02 0x07 0x01 0x32 0x02 0x06 0x06 0x03
- |
- | 0x04 0x1E
- | 0x02 0x07 0x01 0x03 0x02 0x06 0x06 0x03
- |
- | 0x04 0x68
- | 0x02 0x07 0x01 0x1B 0x02 0x06 0x08 0x03
- |
- | 0x00
- | ...
- |
- | bb_serial_invert(self, user_gpio, invert)
- | Invert serial logic.
- |
- | user_gpio:= 0-31 (opened in a prior call to [*bb_serial_read_open*])
- | invert:= 0-1 (1 invert, 0 normal)
- |
- | ...
- | status = pi.bb_serial_invert(17, 1)
- | ...
- |
- | bb_serial_read(self, user_gpio)
- | Returns data from the bit bang serial cyclic buffer.
- |
- | user_gpio:= 0-31 (opened in a prior call to [*bb_serial_read_open*])
- |
- | The returned value is a tuple of the number of bytes read and a
- | bytearray containing the bytes. If there was an error the
- | number of bytes read will be less than zero (and will contain
- | the error code).
- |
- | The bytes returned for each character depend upon the number of
- | data bits [*bb_bits*] specified in the [*bb_serial_read_open*]
- | command.
- |
- | For [*bb_bits*] 1-8 there will be one byte per character.
- | For [*bb_bits*] 9-16 there will be two bytes per character.
- | For [*bb_bits*] 17-32 there will be four bytes per character.
- |
- | ...
- | (count, data) = pi.bb_serial_read(4)
- | ...
- |
- | bb_serial_read_close(self, user_gpio)
- | Closes a GPIO for bit bang reading of serial data.
- |
- | user_gpio:= 0-31 (opened in a prior call to [*bb_serial_read_open*])
- |
- | ...
- | status = pi.bb_serial_read_close(17)
- | ...
- |
- | bb_serial_read_open(self, user_gpio, baud, bb_bits=8)
- | Opens a GPIO for bit bang reading of serial data.
- |
- | user_gpio:= 0-31, the GPIO to use.
- | baud:= 50-250000, the baud rate.
- | bb_bits:= 1-32, the number of bits per word, default 8.
- |
- | The serial data is held in a cyclic buffer and is read using
- | [*bb_serial_read*].
- |
- | It is the caller's responsibility to read data from the cyclic
- | buffer in a timely fashion.
- |
- | ...
- | status = pi.bb_serial_read_open(4, 19200)
- | status = pi.bb_serial_read_open(17, 9600)
- | ...
- |
- | bb_spi_close(self, CS)
- | This function stops bit banging SPI on a set of GPIO
- | opened with [*bb_spi_open*].
- |
- | CS:= 0-31, the CS GPIO used in a prior call to [*bb_spi_open*]
- |
- | Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_NOT_SPI_GPIO.
- |
- | ...
- | pi.bb_spi_close(CS)
- | ...
- |
- | bb_spi_open(self, CS, MISO, MOSI, SCLK, baud=100000, spi_flags=0)
- | This function selects a set of GPIO for bit banging SPI at a
- | specified baud rate.
- |
- | CS := 0-31
- | MISO := 0-31
- | MOSI := 0-31
- | SCLK := 0-31
- | baud := 50-250000
- | spiFlags := see below
- |
- | spiFlags consists of the least significant 22 bits.
- |
- | . .
- | 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
- | 0 0 0 0 0 0 R T 0 0 0 0 0 0 0 0 0 0 0 p m m
- | . .
- |
- | mm defines the SPI mode, defaults to 0
- |
- | . .
- | Mode CPOL CPHA
- | 0 0 0
- | 1 0 1
- | 2 1 0
- | 3 1 1
- | . .
- |
- | The following constants may be used to set the mode:
- |
- | . .
- | pigpio.SPI_MODE_0
- | pigpio.SPI_MODE_1
- | pigpio.SPI_MODE_2
- | pigpio.SPI_MODE_3
- | . .
- |
- | Alternatively pigpio.SPI_CPOL and/or pigpio.SPI_CPHA
- | may be used.
- |
- | p is 0 if CS is active low (default) and 1 for active high.
- | pigpio.SPI_CS_HIGH_ACTIVE may be used to set this flag.
- |
- | T is 1 if the least significant bit is transmitted on MOSI first,
- | the default (0) shifts the most significant bit out first.
- | pigpio.SPI_TX_LSBFIRST may be used to set this flag.
- |
- | R is 1 if the least significant bit is received on MISO first,
- | the default (0) receives the most significant bit first.
- | pigpio.SPI_RX_LSBFIRST may be used to set this flag.
- |
- | The other bits in spiFlags should be set to zero.
- |
- | Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_BAD_SPI_BAUD, or
- | PI_GPIO_IN_USE.
- |
- | If more than one device is connected to the SPI bus (defined by
- | SCLK, MOSI, and MISO) each must have its own CS.
- |
- | ...
- | bb_spi_open(10, MISO, MOSI, SCLK, 10000, 0); // device 1
- | bb_spi_open(11, MISO, MOSI, SCLK, 20000, 3); // device 2
- | ...
- |
- | bb_spi_xfer(self, CS, data)
- | This function executes a bit banged SPI transfer.
- |
- | CS:= 0-31 (as used in a prior call to [*bb_spi_open*])
- | data:= data to be sent
- |
- | The returned value is a tuple of the number of bytes read and a
- | bytearray containing the bytes. If there was an error the
- | number of bytes read will be less than zero (and will contain
- | the error code).
- |
- | ...
- | #!/usr/bin/env python
- |
- | import pigpio
- |
- | CE0=5
- | CE1=6
- | MISO=13
- | MOSI=19
- | SCLK=12
- |
- | pi = pigpio.pi()
- | if not pi.connected:
- | exit()
- |
- | pi.bb_spi_open(CE0, MISO, MOSI, SCLK, 10000, 0) # MCP4251 DAC
- | pi.bb_spi_open(CE1, MISO, MOSI, SCLK, 20000, 3) # MCP3008 ADC
- |
- | for i in range(256):
- |
- | count, data = pi.bb_spi_xfer(CE0, [0, i]) # Set DAC value
- |
- | if count == 2:
- |
- | count, data = pi.bb_spi_xfer(CE0, [12, 0]) # Read back DAC
- |
- | if count == 2:
- |
- | set_val = data[1]
- |
- | count, data = pi.bb_spi_xfer(CE1, [1, 128, 0]) # Read ADC
- |
- | if count == 3:
- |
- | read_val = ((data[1]&3)<<8) | data[2]
- |
- | print("{} {}".format(set_val, read_val))
- |
- | pi.bb_spi_close(CE0)
- | pi.bb_spi_close(CE1)
- |
- | pi.stop()
- | ...
- |
- | bsc_i2c(self, i2c_address, data=[])
- | This function allows the Pi to act as a slave I2C device.
- |
- | This function is not available on the BCM2711 (e.g. as
- | used in the Pi4B).
- |
- | The data bytes (if any) are written to the BSC transmit
- | FIFO and the bytes in the BSC receive FIFO are returned.
- |
- | i2c_address:= the I2C slave address.
- | data:= the data bytes to transmit.
- |
- | The returned value is a tuple of the status, the number
- | of bytes read, and a bytearray containing the read bytes.
- |
- | See [*bsc_xfer*] for details of the status value.
- |
- | If there was an error the status will be less than zero
- | (and will contain the error code).
- |
- | Note that an i2c_address of 0 may be used to close
- | the BSC device and reassign the used GPIO as inputs.
- |
- | This example assumes GPIO 2/3 are connected to GPIO 18/19
- | (GPIO 10/11 on the BCM2711).
- |
- | ...
- | #!/usr/bin/env python
- | import time
- | import pigpio
- |
- | I2C_ADDR=0x13
- |
- | def i2c(id, tick):
- | global pi
- |
- | s, b, d = pi.bsc_i2c(I2C_ADDR)
- | if b:
- | if d[0] == ord('t'): # 116 send 'HH:MM:SS*'
- |
- | print("sent={} FR={} received={} [{}]".
- | format(s>>16, s&0xfff,b,d))
- |
- | s, b, d = pi.bsc_i2c(I2C_ADDR,
- | "{}*".format(time.asctime()[11:19]))
- |
- | elif d[0] == ord('d'): # 100 send 'Sun Oct 30*'
- |
- | print("sent={} FR={} received={} [{}]".
- | format(s>>16, s&0xfff,b,d))
- |
- | s, b, d = pi.bsc_i2c(I2C_ADDR,
- | "{}*".format(time.asctime()[:10]))
- |
- | pi = pigpio.pi()
- |
- | if not pi.connected:
- | exit()
- |
- | # Respond to BSC slave activity
- |
- | e = pi.event_callback(pigpio.EVENT_BSC, i2c)
- |
- | pi.bsc_i2c(I2C_ADDR) # Configure BSC as I2C slave
- |
- | time.sleep(600)
- |
- | e.cancel()
- |
- | pi.bsc_i2c(0) # Disable BSC peripheral
- |
- | pi.stop()
- | ...
- |
- | While running the above.
- |
- | . .
- | $ i2cdetect -y 1
- | 0 1 2 3 4 5 6 7 8 9 a b c d e f
- | 00: -- -- -- -- -- -- -- -- -- -- -- -- --
- | 10: -- -- -- 13 -- -- -- -- -- -- -- -- -- -- -- --
- | 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
- | 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
- | 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
- | 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
- | 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
- | 70: -- -- -- -- -- -- -- --
- |
- | $ pigs i2co 1 0x13 0
- | 0
- |
- | $ pigs i2cwd 0 116
- | $ pigs i2crd 0 9 -a
- | 9 10:13:58*
- |
- | $ pigs i2cwd 0 116
- | $ pigs i2crd 0 9 -a
- | 9 10:14:29*
- |
- | $ pigs i2cwd 0 100
- | $ pigs i2crd 0 11 -a
- | 11 Sun Oct 30*
- |
- | $ pigs i2cwd 0 100
- | $ pigs i2crd 0 11 -a
- | 11 Sun Oct 30*
- |
- | $ pigs i2cwd 0 116
- | $ pigs i2crd 0 9 -a
- | 9 10:23:16*
- |
- | $ pigs i2cwd 0 100
- | $ pigs i2crd 0 11 -a
- | 11 Sun Oct 30*
- | . .
- |
- | bsc_xfer(self, bsc_control, data)
- | This function provides a low-level interface to the SPI/I2C Slave
- | peripheral on the BCM chip.
- |
- | This peripheral allows the Pi to act as a hardware slave device
- | on an I2C or SPI bus.
- |
- | This is not a bit bang version and as such is OS timing
- | independent. The bus timing is handled directly by the chip.
- |
- | The output process is simple. You simply append data to the FIFO
- | buffer on the chip. This works like a queue, you add data to the
- | queue and the master removes it.
- |
- | I can't get SPI to work properly. I tried with a
- | control word of 0x303 and swapped MISO and MOSI.
- |
- | The function sets the BSC mode, writes any data in
- | the transmit buffer to the BSC transmit FIFO, and
- | copies any data in the BSC receive FIFO to the
- | receive buffer.
- |
- | bsc_control:= see below
- | data:= the data bytes to place in the transmit FIFO.
- |
- | The returned value is a tuple of the status (see below),
- | the number of bytes read, and a bytearray containing the
- | read bytes. If there was an error the status will be less
- | than zero (and will contain the error code).
- |
- | Note that the control word sets the BSC mode. The BSC will
- | stay in that mode until a different control word is sent.
- |
- | GPIO used for models other than those based on the BCM2711.
- |
- | @ SDA @ SCL @ MOSI @ SCLK @ MISO @ CE
- | I2C @ 18 @ 19 @ - @ - @ - @ -
- | SPI @ - @ - @ 18 @ 19 @ 20 @ 21
- |
- | GPIO used for models based on the BCM2711 (e.g. the Pi4B).
- |
- | @ SDA @ SCL @ MOSI @ SCLK @ MISO @ CE
- | I2C @ 10 @ 11 @ - @ - @ - @ -
- | SPI @ - @ - @ 10 @ 11 @ 9 @ 8
- |
- | When a zero control word is received the used GPIO will be reset
- | to INPUT mode.
- |
- | bsc_control consists of the following bits:
- |
- | . .
- | 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
- | a a a a a a a - - IT HC TF IR RE TE BK EC ES PL PH I2 SP EN
- | . .
- |
- | Bits 0-13 are copied unchanged to the BSC CR register. See
- | pages 163-165 of the Broadcom peripherals document for full
- | details.
- |
- | aaaaaaa @ defines the I2C slave address (only relevant in I2C mode)
- | IT @ invert transmit status flags
- | HC @ enable host control
- | TF @ enable test FIFO
- | IR @ invert receive status flags
- | RE @ enable receive
- | TE @ enable transmit
- | BK @ abort operation and clear FIFOs
- | EC @ send control register as first I2C byte
- | ES @ send status register as first I2C byte
- | PL @ set SPI polarity high
- | PH @ set SPI phase high
- | I2 @ enable I2C mode
- | SP @ enable SPI mode
- | EN @ enable BSC peripheral
- |
- | The status has the following format:
- |
- | . .
- | 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
- | S S S S S R R R R R T T T T T RB TE RF TF RE TB
- | . .
- |
- | Bits 0-15 are copied unchanged from the BSC FR register. See
- | pages 165-166 of the Broadcom peripherals document for full
- | details.
- |
- | SSSSS @ number of bytes successfully copied to transmit FIFO
- | RRRRR @ number of bytes in receieve FIFO
- | TTTTT @ number of bytes in transmit FIFO
- | RB @ receive busy
- | TE @ transmit FIFO empty
- | RF @ receive FIFO full
- | TF @ transmit FIFO full
- | RE @ receive FIFO empty
- | TB @ transmit busy
- |
- | ...
- | (status, count, data) = pi.bsc_xfer(0x330305, "Hello!")
- | ...
- |
- | callback(self, user_gpio, edge=0, func=None)
- | Calls a user supplied function (a callback) whenever the
- | specified GPIO edge is detected.
- |
- | user_gpio:= 0-31.
- | edge:= EITHER_EDGE, RISING_EDGE (default), or FALLING_EDGE.
- | func:= user supplied callback function.
- |
- | The user supplied callback receives three parameters, the GPIO,
- | the level, and the tick.
- |
- | . .
- | Parameter Value Meaning
- |
- | GPIO 0-31 The GPIO which has changed state
- |
- | level 0-2 0 = change to low (a falling edge)
- | 1 = change to high (a rising edge)
- | 2 = no level change (a watchdog timeout)
- |
- | tick 32 bit The number of microseconds since boot
- | WARNING: this wraps around from
- | 4294967295 to 0 roughly every 72 minutes
- | . .
- |
- | If a user callback is not specified a default tally callback is
- | provided which simply counts edges. The count may be retrieved
- | 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 cancel function.
- |
- | A GPIO may have multiple callbacks (although I can't think of
- | a reason to do so).
- |
- | The GPIO are sampled at a rate set when the pigpio daemon
- | is started (default 5 us).
- |
- | The number of samples per second is given in the following table.
- |
- | . .
- | samples
- | per sec
- |
- | 1 1,000,000
- | 2 500,000
- | sample 4 250,000
- | rate 5 200,000
- | (us) 8 125,000
- | 10 100,000
- | . .
- |
- | GPIO level changes shorter than the sample rate may be missed.
- |
- | The daemon software which generates the callbacks is triggered
- | 1000 times per second. The callbacks will be called once per
- | level change since the last time they were called.
- | i.e. The callbacks will get all level changes but there will
- | be a latency.
- |
- | If you want to track the level of more than one GPIO do so by
- | maintaining the state in the callback. Do not use [*read*].
- | Remember the event that triggered the callback may have
- | happened several milliseconds before and the GPIO may have
- | changed level many times since then.
- |
- | ...
- | def cbf(gpio, level, tick):
- | print(gpio, level, tick)
- |
- | cb1 = pi.callback(22, pigpio.EITHER_EDGE, cbf)
- |
- | cb2 = pi.callback(4, pigpio.EITHER_EDGE)
- |
- | cb3 = pi.callback(17)
- |
- | print(cb3.tally())
- |
- | cb3.reset_tally()
- |
- | cb1.cancel() # To cancel callback cb1.
- | ...
- |
- | clear_bank_1(self, bits)
- | Clears GPIO 0-31 if the corresponding bit in bits is set.
- |
- | bits:= a 32 bit mask with 1 set if the corresponding GPIO is
- | to be cleared.
- |
- | A returned status of PI_SOME_PERMITTED indicates that the user
- | is not allowed to write to one or more of the GPIO.
- |
- | ...
- | pi.clear_bank_1(int("111110010000",2))
- | ...
- |
- | clear_bank_2(self, bits)
- | Clears GPIO 32-53 if the corresponding bit (0-21) in bits is set.
- |
- | bits:= a 32 bit mask with 1 set if the corresponding GPIO is
- | to be cleared.
- |
- | A returned status of PI_SOME_PERMITTED indicates that the user
- | is not allowed to write to one or more of the GPIO.
- |
- | ...
- | pi.clear_bank_2(0x1010)
- | ...
- |
- | custom_1(self, arg1=0, arg2=0, argx=[])
- | Calls a pigpio function customised by the user.
- |
- | arg1:= >=0, default 0.
- | arg2:= >=0, default 0.
- | argx:= extra arguments (each 0-255), default empty.
- |
- | The returned value is an integer which by convention
- | should be >=0 for OK and <0 for error.
- |
- | ...
- | value = pi.custom_1()
- |
- | value = pi.custom_1(23)
- |
- | value = pi.custom_1(0, 55)
- |
- | value = pi.custom_1(23, 56, [1, 5, 7])
- |
- | value = pi.custom_1(23, 56, b"hello")
- |
- | value = pi.custom_1(23, 56, "hello")
- | ...
- |
- | custom_2(self, arg1=0, argx=[], retMax=8192)
- | Calls a pigpio function customised by the user.
- |
- | arg1:= >=0, default 0.
- | argx:= extra arguments (each 0-255), default empty.
- | retMax:= >=0, maximum number of bytes to return, default 8192.
- |
- | The returned value is a tuple of the number of bytes
- | returned and a bytearray containing the bytes. If
- | there was an error the number of bytes read will be
- | less than zero (and will contain the error code).
- |
- | ...
- | (count, data) = pi.custom_2()
- |
- | (count, data) = pi.custom_2(23)
- |
- | (count, data) = pi.custom_2(23, [1, 5, 7])
- |
- | (count, data) = pi.custom_2(23, b"hello")
- |
- | (count, data) = pi.custom_2(23, "hello", 128)
- | ...
- |
- | delete_script(self, script_id)
- | Deletes a stored script.
- |
- | script_id:= id of stored script.
- |
- | ...
- | status = pi.delete_script(sid)
- | ...
- |
- | event_callback(self, event, func=None)
- | Calls a user supplied function (a callback) whenever the
- | specified event is signalled.
- |
- | event:= 0-31.
- | func:= user supplied callback function.
- |
- | The user supplied callback receives two parameters, the event id,
- | and the tick.
- |
- | If a user callback is not specified a default tally callback is
- | provided which simply counts events. The count may be retrieved
- | 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.
- |
- | An event may have multiple callbacks (although I can't think of
- | a reason to do so).
- |
- | ...
- | def cbf(event, tick):
- | print(event, tick)
- |
- | cb1 = pi.event_callback(22, cbf)
- |
- | cb2 = pi.event_callback(4)
- |
- | print(cb2.tally())
- |
- | cb2.reset_tally()
- |
- | cb1.event_cancel() # To cancel callback cb1.
- | ...
- |
- | event_trigger(self, event)
- | This function signals the occurrence of an event.
- |
- | event:= 0-31, the event
- |
- | Returns 0 if OK, otherwise PI_BAD_EVENT_ID.
- |
- | An event is a signal used to inform one or more consumers
- | to start an action. Each consumer which has registered an
- | interest in the event (e.g. by calling [*event_callback*]) will
- | be informed by a callback.
- |
- | One event, EVENT_BSC (31) is predefined. This event is
- | auto generated on BSC slave activity.
- |
- | The meaning of other events is arbitrary.
- |
- | Note that other than its id and its tick there is no data associated
- | with an event.
- |
- | ...
- | pi.event_trigger(23)
- | ...
- |
- | file_close(self, handle)
- | Closes the file associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*file_open*]).
- |
- | ...
- | pi.file_close(handle)
- | ...
- |
- | file_list(self, fpattern)
- | Returns a list of files which match a pattern.
- |
- | fpattern:= file pattern to match.
- |
- | Returns the number of returned bytes if OK, otherwise
- | PI_NO_FILE_ACCESS, or PI_NO_FILE_MATCH.
- |
- | The pattern must match an entry in /opt/pigpio/access. The
- | pattern may contain wildcards. See [*file_open*].
- |
- | NOTE
- |
- | The returned value is not the number of files, it is the number
- | of bytes in the buffer. The file names are separated by newline
- | characters.
- |
- | ...
- | #!/usr/bin/env python
- |
- | import pigpio
- |
- | pi = pigpio.pi()
- |
- | if not pi.connected:
- | exit()
- |
- | # Assumes /opt/pigpio/access contains the following line:
- | # /ram/*.c r
- |
- | c, d = pi.file_list("/ram/p*.c")
- | if c > 0:
- | print(d)
- |
- | pi.stop()
- | ...
- |
- | file_open(self, file_name, file_mode)
- | This function returns a handle to a file opened in a specified mode.
- |
- | file_name:= the file to open.
- | file_mode:= the file open mode.
- |
- | Returns a handle (>=0) if OK, otherwise PI_NO_HANDLE,
- | PI_NO_FILE_ACCESS, PI_BAD_FILE_MODE,
- | PI_FILE_OPEN_FAILED, or PI_FILE_IS_A_DIR.
- |
- | ...
- | h = pi.file_open("/home/pi/shared/dir_3/file.txt",
- | pigpio.FILE_WRITE | pigpio.FILE_CREATE)
- |
- | pi.file_write(h, "Hello world")
- |
- | pi.file_close(h)
- | ...
- |
- | File
- |
- | A file may only be opened if permission is granted by an entry
- | in /opt/pigpio/access. This is intended to allow remote access
- | to files in a more or less controlled manner.
- |
- | Each entry in /opt/pigpio/access takes the form of a file path
- | which may contain wildcards followed by a single letter permission.
- | The permission may be R for read, W for write, U for read/write,
- | and N for no access.
- |
- | Where more than one entry matches a file the most specific rule
- | applies. If no entry matches a file then access is denied.
- |
- | Suppose /opt/pigpio/access contains the following entries:
- |
- | . .
- | /home/* n
- | /home/pi/shared/dir_1/* w
- | /home/pi/shared/dir_2/* r
- | /home/pi/shared/dir_3/* u
- | /home/pi/shared/dir_1/file.txt n
- | . .
- |
- | Files may be written in directory dir_1 with the exception
- | of file.txt.
- |
- | Files may be read in directory dir_2.
- |
- | Files may be read and written in directory dir_3.
- |
- | If a directory allows read, write, or read/write access then files
- | may be created in that directory.
- |
- | In an attempt to prevent risky permissions the following paths are
- | ignored in /opt/pigpio/access:
- |
- | . .
- | a path containing ..
- | a path containing only wildcards (*?)
- | a path containing less than two non-wildcard parts
- | . .
- |
- | Mode
- |
- | The mode may have the following values:
- |
- | Constant @ Value @ Meaning
- | FILE_READ @ 1 @ open file for reading
- | FILE_WRITE @ 2 @ open file for writing
- | FILE_RW @ 3 @ open file for reading and writing
- |
- | The following values may be or'd into the mode:
- |
- | Name @ Value @ Meaning
- | FILE_APPEND @ 4 @ All writes append data to the end of the file
- | FILE_CREATE @ 8 @ The file is created if it doesn't exist
- | FILE_TRUNC @ 16 @ The file is truncated
- |
- | Newly created files are owned by root with permissions owner
- | read and write.
- |
- | ...
- | #!/usr/bin/env python
- |
- | import pigpio
- |
- | pi = pigpio.pi()
- |
- | if not pi.connected:
- | exit()
- |
- | # Assumes /opt/pigpio/access contains the following line:
- | # /ram/*.c r
- |
- | handle = pi.file_open("/ram/pigpio.c", pigpio.FILE_READ)
- |
- | done = False
- |
- | while not done:
- | c, d = pi.file_read(handle, 60000)
- | if c > 0:
- | print(d)
- | else:
- | done = True
- |
- | pi.file_close(handle)
- |
- | pi.stop()
- | ...
- |
- | file_read(self, handle, count)
- | Reads up to count bytes from the file associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*file_open*]).
- | count:= >0, the number of bytes to read.
- |
- | The returned value is a tuple of the number of bytes read and a
- | bytearray containing the bytes. If there was an error the
- | number of bytes read will be less than zero (and will contain
- | the error code).
- |
- | ...
- | (b, d) = pi.file_read(h2, 100)
- | if b > 0:
- | # process read data
- | ...
- |
- | file_seek(self, handle, seek_offset, seek_from)
- | Seeks to a position relative to the start, current position,
- | or end of the file. Returns the new position.
- |
- | handle:= >=0 (as returned by a prior call to [*file_open*]).
- | seek_offset:= byte offset.
- | seek_from:= FROM_START, FROM_CURRENT, or FROM_END.
- |
- | ...
- | new_pos = pi.file_seek(h, 100, pigpio.FROM_START)
- |
- | cur_pos = pi.file_seek(h, 0, pigpio.FROM_CURRENT)
- |
- | file_size = pi.file_seek(h, 0, pigpio.FROM_END)
- | ...
- |
- | file_write(self, handle, data)
- | Writes the data bytes to the file associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*file_open*]).
- | data:= the bytes to write.
- |
- | ...
- | pi.file_write(h1, b'\x02\x03\x04')
- |
- | pi.file_write(h2, b'help')
- |
- | pi.file_write(h2, "hello")
- |
- | pi.file_write(h1, [2, 3, 4])
- | ...
- |
- | get_PWM_dutycycle(self, user_gpio)
- | Returns the PWM dutycycle being used on the GPIO.
- |
- | user_gpio:= 0-31.
- |
- | Returns the PWM dutycycle.
- |
- |
- | For normal PWM the dutycycle will be out of the defined range
- | for the GPIO (see [*get_PWM_range*]).
- |
- | If a hardware clock is active on the GPIO the reported
- | dutycycle will be 500000 (500k) out of 1000000 (1M).
- |
- | If hardware PWM is active on the GPIO the reported dutycycle
- | will be out of a 1000000 (1M).
- |
- | ...
- | pi.set_PWM_dutycycle(4, 25)
- | print(pi.get_PWM_dutycycle(4))
- | 25
- |
- | pi.set_PWM_dutycycle(4, 203)
- | print(pi.get_PWM_dutycycle(4))
- | 203
- | ...
- |
- | get_PWM_frequency(self, user_gpio)
- | Returns the frequency of PWM being used on the GPIO.
- |
- | user_gpio:= 0-31.
- |
- | Returns the frequency (in Hz) used for the GPIO.
- |
- | For normal PWM the frequency will be that defined for the GPIO
- | by [*set_PWM_frequency*].
- |
- | If a hardware clock is active on the GPIO the reported frequency
- | will be that set by [*hardware_clock*].
- |
- | If hardware PWM is active on the GPIO the reported frequency
- | will be that set by [*hardware_PWM*].
- |
- | ...
- | pi.set_PWM_frequency(4,0)
- | print(pi.get_PWM_frequency(4))
- | 10
- |
- | pi.set_PWM_frequency(4, 800)
- | print(pi.get_PWM_frequency(4))
- | 800
- | ...
- |
- | get_PWM_range(self, user_gpio)
- | Returns the range of PWM values being used on the GPIO.
- |
- | user_gpio:= 0-31.
- |
- | If a hardware clock or hardware PWM is active on the GPIO
- | the reported range will be 1000000 (1M).
- |
- | ...
- | pi.set_PWM_range(9, 500)
- | print(pi.get_PWM_range(9))
- | 500
- | ...
- |
- | get_PWM_real_range(self, user_gpio)
- | Returns the real (underlying) range of PWM values being
- | used on the GPIO.
- |
- | user_gpio:= 0-31.
- |
- | If a hardware clock is active on the GPIO the reported
- | real range will be 1000000 (1M).
- |
- | If hardware PWM is active on the GPIO the reported real range
- | will be approximately 250M divided by the set PWM frequency.
- |
- | ...
- | pi.set_PWM_frequency(4, 800)
- | print(pi.get_PWM_real_range(4))
- | 250
- | ...
- |
- | get_current_tick(self)
- | Returns the current system tick.
- |
- | Tick is the number of microseconds since system boot. As an
- | unsigned 32 bit quantity tick wraps around approximately
- | every 71.6 minutes.
- |
- | ...
- | t1 = pi.get_current_tick()
- | time.sleep(1)
- | t2 = pi.get_current_tick()
- | ...
- |
- | get_hardware_revision(self)
- | Returns the Pi's hardware revision number.
- |
- | The hardware revision is the last few characters on the
- | Revision line of /proc/cpuinfo.
- |
- | The revision number can be used to determine the assignment
- | of GPIO to pins (see [*gpio*]).
- |
- | There are at least three types of board.
- |
- | Type 1 boards have hardware revision numbers of 2 and 3.
- |
- | Type 2 boards have hardware revision numbers of 4, 5, 6, and 15.
- |
- | Type 3 boards have hardware revision numbers of 16 or greater.
- |
- | If the hardware revision can not be found or is not a valid
- | hexadecimal number the function returns 0.
- |
- | ...
- | print(pi.get_hardware_revision())
- | 2
- | ...
- |
- | get_mode(self, gpio)
- | Returns the GPIO mode.
- |
- | gpio:= 0-53.
- |
- | Returns a value as follows
- |
- | . .
- | 0 = INPUT
- | 1 = OUTPUT
- | 2 = ALT5
- | 3 = ALT4
- | 4 = ALT0
- | 5 = ALT1
- | 6 = ALT2
- | 7 = ALT3
- | . .
- |
- | ...
- | print(pi.get_mode(0))
- | 4
- | ...
- |
- | get_pad_strength(self, pad)
- | This function returns the pad drive strength in mA.
- |
- | pad:= 0-2, the pad to get.
- |
- | Returns the pad drive strength if OK, otherwise PI_BAD_PAD.
- |
- | Pad @ GPIO
- | 0 @ 0-27
- | 1 @ 28-45
- | 2 @ 46-53
- |
- | ...
- | strength = pi.get_pad_strength(0) # Get pad 0 strength.
- | ...
- |
- | get_pigpio_version(self)
- | Returns the pigpio software version.
- |
- | ...
- | v = pi.get_pigpio_version()
- | ...
- |
- | get_servo_pulsewidth(self, user_gpio)
- | Returns the servo pulsewidth being used on the GPIO.
- |
- | user_gpio:= 0-31.
- |
- | Returns the servo pulsewidth.
- |
- | ...
- | pi.set_servo_pulsewidth(4, 525)
- | print(pi.get_servo_pulsewidth(4))
- | 525
- |
- | pi.set_servo_pulsewidth(4, 2130)
- | print(pi.get_servo_pulsewidth(4))
- | 2130
- | ...
- |
- | gpio_trigger(self, user_gpio, pulse_len=10, level=1)
- | Send a trigger pulse to a GPIO. The GPIO is set to
- | level for pulse_len microseconds and then reset to not level.
- |
- | user_gpio:= 0-31
- | pulse_len:= 1-100
- | level:= 0-1
- |
- | ...
- | pi.gpio_trigger(23, 10, 1)
- | ...
- |
- | hardware_PWM(self, gpio, PWMfreq, PWMduty)
- | Starts hardware PWM on a GPIO at the specified frequency
- | and dutycycle. Frequencies above 30MHz are unlikely to work.
- |
- | NOTE: Any waveform started by [*wave_send_once*],
- | [*wave_send_repeat*], or [*wave_chain*] will be cancelled.
- |
- | This function is only valid if the pigpio main clock is PCM.
- | The main clock defaults to PCM but may be overridden when the
- | pigpio daemon is started (option -t).
- |
- | gpio:= see descripton
- | PWMfreq:= 0 (off) or 1-125M (1-187.5M for the BCM2711).
- | PWMduty:= 0 (off) to 1000000 (1M)(fully on).
- |
- | Returns 0 if OK, otherwise PI_NOT_PERMITTED, PI_BAD_GPIO,
- | PI_NOT_HPWM_GPIO, PI_BAD_HPWM_DUTY, PI_BAD_HPWM_FREQ.
- |
- | The same PWM channel is available on multiple GPIO.
- | The latest frequency and dutycycle setting will be used
- | by all GPIO which share a PWM channel.
- |
- | The GPIO must be one of the following:
- |
- | . .
- | 12 PWM channel 0 All models but A and B
- | 13 PWM channel 1 All models but A and B
- | 18 PWM channel 0 All models
- | 19 PWM channel 1 All models but A and B
- |
- | 40 PWM channel 0 Compute module only
- | 41 PWM channel 1 Compute module only
- | 45 PWM channel 1 Compute module only
- | 52 PWM channel 0 Compute module only
- | 53 PWM channel 1 Compute module only
- | . .
- |
- | The actual number of steps beween off and fully on is the
- | integral part of 250M/PWMfreq (375M/PWMfreq for the BCM2711).
- |
- | The actual frequency set is 250M/steps (375M/steps
- | for the BCM2711).
- |
- | There will only be a million steps for a PWMfreq of 250
- | (375 for the BCM2711). Lower frequencies will have more
- | steps and higher frequencies will have fewer steps.
- | PWMduty is automatically scaled to take this into account.
- |
- | ...
- | pi.hardware_PWM(18, 800, 250000) # 800Hz 25% dutycycle
- |
- | pi.hardware_PWM(18, 2000, 750000) # 2000Hz 75% dutycycle
- | ...
- |
- | hardware_clock(self, gpio, clkfreq)
- | Starts a hardware clock on a GPIO at the specified frequency.
- | Frequencies above 30MHz are unlikely to work.
- |
- | gpio:= see description
- | clkfreq:= 0 (off) or 4689-250M (13184-375M for the BCM2711)
- |
- |
- | Returns 0 if OK, otherwise PI_NOT_PERMITTED, PI_BAD_GPIO,
- | PI_NOT_HCLK_GPIO, PI_BAD_HCLK_FREQ,or PI_BAD_HCLK_PASS.
- |
- | The same clock is available on multiple GPIO. The latest
- | frequency setting will be used by all GPIO which share a clock.
- |
- | The GPIO must be one of the following:
- |
- | . .
- | 4 clock 0 All models
- | 5 clock 1 All models but A and B (reserved for system use)
- | 6 clock 2 All models but A and B
- | 20 clock 0 All models but A and B
- | 21 clock 1 All models but A and Rev.2 B (reserved for system use)
- |
- | 32 clock 0 Compute module only
- | 34 clock 0 Compute module only
- | 42 clock 1 Compute module only (reserved for system use)
- | 43 clock 2 Compute module only
- | 44 clock 1 Compute module only (reserved for system use)
- | . .
- |
- | Access to clock 1 is protected by a password as its use will
- | likely crash the Pi. The password is given by or'ing 0x5A000000
- | with the GPIO number.
- |
- | ...
- | pi.hardware_clock(4, 5000) # 5 KHz clock on GPIO 4
- |
- | pi.hardware_clock(4, 40000000) # 40 MHz clock on GPIO 4
- | ...
- |
- | i2c_block_process_call(self, handle, reg, data)
- | Writes data bytes to the specified register of the device
- | associated with handle and reads a device specified number
- | of bytes of data in return.
- |
- | handle:= >=0 (as returned by a prior call to [*i2c_open*]).
- | reg:= >=0, the device register.
- | data:= the bytes to write.
- |
- | The SMBus 2.0 documentation states that a minimum of 1 byte may
- | be sent and a minimum of 1 byte may be received. The total
- | number of bytes sent/received must be 32 or less.
- |
- | SMBus 2.0 5.5.8 - Block write-block read.
- | . .
- | S Addr Wr [A] reg [A] len(data) [A] data0 [A] ... datan [A]
- | S Addr Rd [A] [Count] A [Data] ... A P
- | . .
- |
- | The returned value is a tuple of the number of bytes read and a
- | bytearray containing the bytes. If there was an error the
- | number of bytes read will be less than zero (and will contain
- | the error code).
- |
- | ...
- | (b, d) = pi.i2c_block_process_call(h, 10, b'\x02\x05\x00')
- |
- | (b, d) = pi.i2c_block_process_call(h, 10, b'abcdr')
- |
- | (b, d) = pi.i2c_block_process_call(h, 10, "abracad")
- |
- | (b, d) = pi.i2c_block_process_call(h, 10, [2, 5, 16])
- | ...
- |
- | i2c_close(self, handle)
- | Closes the I2C device associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*i2c_open*]).
- |
- | ...
- | pi.i2c_close(h)
- | ...
- |
- | i2c_open(self, i2c_bus, i2c_address, i2c_flags=0)
- | Returns a handle (>=0) for the device at the I2C bus address.
- |
- | i2c_bus:= >=0.
- | i2c_address:= 0-0x7F.
- | i2c_flags:= 0, no flags are currently defined.
- |
- | Physically buses 0 and 1 are available on the Pi. Higher
- | numbered buses will be available if a kernel supported bus
- | multiplexor is being used.
- |
- | The GPIO used are given in the following table.
- |
- | @ SDA @ SCL
- | I2C 0 @ 0 @ 1
- | I2C 1 @ 2 @ 3
- |
- | For the SMBus commands the low level transactions are shown
- | at the end of the function description. The following
- | abbreviations are used:
- |
- | . .
- | S (1 bit) : Start bit
- | P (1 bit) : Stop bit
- | Rd/Wr (1 bit) : Read/Write bit. Rd equals 1, Wr equals 0.
- | A, NA (1 bit) : Accept and not accept bit.
- | Addr (7 bits): I2C 7 bit address.
- | reg (8 bits): Command byte, which often selects a register.
- | Data (8 bits): A data byte.
- | Count (8 bits): A byte defining the length of a block operation.
- |
- | [..]: Data sent by the device.
- | . .
- |
- | ...
- | h = pi.i2c_open(1, 0x53) # open device at address 0x53 on bus 1
- | ...
- |
- | i2c_process_call(self, handle, reg, word_val)
- | Writes 16 bits of data to the specified register of the device
- | associated with handle and reads 16 bits of data in return.
- |
- | handle:= >=0 (as returned by a prior call to [*i2c_open*]).
- | reg:= >=0, the device register.
- | word_val:= 0-65535, the value to write.
- |
- | SMBus 2.0 5.5.6 - Process call.
- | . .
- | S Addr Wr [A] reg [A] word_val_Low [A] word_val_High [A]
- | S Addr Rd [A] [DataLow] A [DataHigh] NA P
- | . .
- |
- | ...
- | r = pi.i2c_process_call(h, 4, 0x1231)
- | r = pi.i2c_process_call(h, 6, 0)
- | ...
- |
- | i2c_read_block_data(self, handle, reg)
- | Reads a block of up to 32 bytes from the specified register of
- | the device associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*i2c_open*]).
- | reg:= >=0, the device register.
- |
- | SMBus 2.0 5.5.7 - Block read.
- | . .
- | S Addr Wr [A] reg [A]
- | S Addr Rd [A] [Count] A [Data] A [Data] A ... A [Data] NA P
- | . .
- |
- | The amount of returned data is set by the device.
- |
- | The returned value is a tuple of the number of bytes read and a
- | bytearray containing the bytes. If there was an error the
- | number of bytes read will be less than zero (and will contain
- | the error code).
- |
- | ...
- | (b, d) = pi.i2c_read_block_data(h, 10)
- | if b >= 0:
- | # process data
- | else:
- | # process read failure
- | ...
- |
- | i2c_read_byte(self, handle)
- | Reads a single byte from the device associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*i2c_open*]).
- |
- | SMBus 2.0 5.5.3 - Receive byte.
- | . .
- | S Addr Rd [A] [Data] NA P
- | . .
- |
- | ...
- | b = pi.i2c_read_byte(2) # read a byte from device 2
- | ...
- |
- | i2c_read_byte_data(self, handle, reg)
- | Reads a single byte from the specified register of the device
- | associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*i2c_open*]).
- | reg:= >=0, the device register.
- |
- | SMBus 2.0 5.5.5 - Read byte.
- | . .
- | S Addr Wr [A] reg [A] S Addr Rd [A] [Data] NA P
- | . .
- |
- | ...
- | # read byte from reg 17 of device 2
- | b = pi.i2c_read_byte_data(2, 17)
- |
- | # read byte from reg 1 of device 0
- | b = pi.i2c_read_byte_data(0, 1)
- | ...
- |
- | i2c_read_device(self, handle, count)
- | Returns count bytes read from the raw device associated
- | with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*i2c_open*]).
- | count:= >0, the number of bytes to read.
- |
- | . .
- | S Addr Rd [A] [Data] A [Data] A ... A [Data] NA P
- | . .
- |
- | The returned value is a tuple of the number of bytes read and a
- | bytearray containing the bytes. If there was an error the
- | number of bytes read will be less than zero (and will contain
- | the error code).
- |
- | ...
- | (count, data) = pi.i2c_read_device(h, 12)
- | ...
- |
- | i2c_read_i2c_block_data(self, handle, reg, count)
- | Reads count bytes from the specified register of the device
- | associated with handle . The count may be 1-32.
- |
- | handle:= >=0 (as returned by a prior call to [*i2c_open*]).
- | reg:= >=0, the device register.
- | count:= >0, the number of bytes to read.
- |
- | . .
- | S Addr Wr [A] reg [A]
- | S Addr Rd [A] [Data] A [Data] A ... A [Data] NA P
- | . .
- |
- | The returned value is a tuple of the number of bytes read and a
- | bytearray containing the bytes. If there was an error the
- | number of bytes read will be less than zero (and will contain
- | the error code).
- |
- | ...
- | (b, d) = pi.i2c_read_i2c_block_data(h, 4, 32)
- | if b >= 0:
- | # process data
- | else:
- | # process read failure
- | ...
- |
- | i2c_read_word_data(self, handle, reg)
- | Reads a single 16 bit word from the specified register of the
- | device associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*i2c_open*]).
- | reg:= >=0, the device register.
- |
- | SMBus 2.0 5.5.5 - Read word.
- | . .
- | S Addr Wr [A] reg [A] S Addr Rd [A] [DataLow] A [DataHigh] NA P
- | . .
- |
- | ...
- | # read word from reg 2 of device 3
- | w = pi.i2c_read_word_data(3, 2)
- |
- | # read word from reg 7 of device 2
- | w = pi.i2c_read_word_data(2, 7)
- | ...
- |
- | i2c_write_block_data(self, handle, reg, data)
- | Writes up to 32 bytes to the specified register of the device
- | associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*i2c_open*]).
- | reg:= >=0, the device register.
- | data:= the bytes to write.
- |
- | SMBus 2.0 5.5.7 - Block write.
- | . .
- | S Addr Wr [A] reg [A] len(data) [A] data0 [A] data1 [A] ... [A]
- | datan [A] P
- | . .
- |
- | ...
- | pi.i2c_write_block_data(4, 5, b'hello')
- |
- | pi.i2c_write_block_data(4, 5, "data bytes")
- |
- | pi.i2c_write_block_data(5, 0, b'\x00\x01\x22')
- |
- | pi.i2c_write_block_data(6, 2, [0, 1, 0x22])
- | ...
- |
- | i2c_write_byte(self, handle, byte_val)
- | Sends a single byte to the device associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*i2c_open*]).
- | byte_val:= 0-255, the value to write.
- |
- | SMBus 2.0 5.5.2 - Send byte.
- | . .
- | S Addr Wr [A] byte_val [A] P
- | . .
- |
- | ...
- | pi.i2c_write_byte(1, 17) # send byte 17 to device 1
- | pi.i2c_write_byte(2, 0x23) # send byte 0x23 to device 2
- | ...
- |
- | i2c_write_byte_data(self, handle, reg, byte_val)
- | Writes a single byte to the specified register of the device
- | associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*i2c_open*]).
- | reg:= >=0, the device register.
- | byte_val:= 0-255, the value to write.
- |
- | SMBus 2.0 5.5.4 - Write byte.
- | . .
- | S Addr Wr [A] reg [A] byte_val [A] P
- | . .
- |
- | ...
- | # send byte 0xC5 to reg 2 of device 1
- | pi.i2c_write_byte_data(1, 2, 0xC5)
- |
- | # send byte 9 to reg 4 of device 2
- | pi.i2c_write_byte_data(2, 4, 9)
- | ...
- |
- | i2c_write_device(self, handle, data)
- | Writes the data bytes to the raw device associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*i2c_open*]).
- | data:= the bytes to write.
- |
- | . .
- | S Addr Wr [A] data0 [A] data1 [A] ... [A] datan [A] P
- | . .
- |
- | ...
- | pi.i2c_write_device(h, b"\x12\x34\xA8")
- |
- | pi.i2c_write_device(h, b"help")
- |
- | pi.i2c_write_device(h, 'help')
- |
- | pi.i2c_write_device(h, [23, 56, 231])
- | ...
- |
- | i2c_write_i2c_block_data(self, handle, reg, data)
- | Writes data bytes to the specified register of the device
- | associated with handle . 1-32 bytes may be written.
- |
- | handle:= >=0 (as returned by a prior call to [*i2c_open*]).
- | reg:= >=0, the device register.
- | data:= the bytes to write.
- |
- | . .
- | S Addr Wr [A] reg [A] data0 [A] data1 [A] ... [A] datan [NA] P
- | . .
- |
- | ...
- | pi.i2c_write_i2c_block_data(4, 5, 'hello')
- |
- | pi.i2c_write_i2c_block_data(4, 5, b'hello')
- |
- | pi.i2c_write_i2c_block_data(5, 0, b'\x00\x01\x22')
- |
- | pi.i2c_write_i2c_block_data(6, 2, [0, 1, 0x22])
- | ...
- |
- | i2c_write_quick(self, handle, bit)
- | Sends a single bit to the device associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*i2c_open*]).
- | bit:= 0 or 1, the value to write.
- |
- | SMBus 2.0 5.5.1 - Quick command.
- | . .
- | S Addr bit [A] P
- | . .
- |
- | ...
- | pi.i2c_write_quick(0, 1) # send 1 to device 0
- | pi.i2c_write_quick(3, 0) # send 0 to device 3
- | ...
- |
- | i2c_write_word_data(self, handle, reg, word_val)
- | Writes a single 16 bit word to the specified register of the
- | device associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*i2c_open*]).
- | reg:= >=0, the device register.
- | word_val:= 0-65535, the value to write.
- |
- | SMBus 2.0 5.5.4 - Write word.
- | . .
- | S Addr Wr [A] reg [A] word_val_Low [A] word_val_High [A] P
- | . .
- |
- | ...
- | # send word 0xA0C5 to reg 5 of device 4
- | pi.i2c_write_word_data(4, 5, 0xA0C5)
- |
- | # send word 2 to reg 2 of device 5
- | pi.i2c_write_word_data(5, 2, 23)
- | ...
- |
- | i2c_zip(self, handle, data)
- | This function executes a sequence of I2C operations. The
- | operations to be performed are specified by the contents of data
- | which contains the concatenated command codes and associated data.
- |
- | handle:= >=0 (as returned by a prior call to [*i2c_open*]).
- | data:= the concatenated I2C commands, see below
- |
- | The returned value is a tuple of the number of bytes read and a
- | bytearray containing the bytes. If there was an error the
- | number of bytes read will be less than zero (and will contain
- | the error code).
- |
- | ...
- | (count, data) = pi.i2c_zip(h, [4, 0x53, 7, 1, 0x32, 6, 6, 0])
- | ...
- |
- | The following command codes are supported:
- |
- | Name @ Cmd & Data @ Meaning
- | End @ 0 @ No more commands
- | Escape @ 1 @ Next P is two bytes
- | On @ 2 @ Switch combined flag on
- | Off @ 3 @ Switch combined flag off
- | Address @ 4 P @ Set I2C address to P
- | Flags @ 5 lsb msb @ Set I2C flags to lsb + (msb << 8)
- | Read @ 6 P @ Read P bytes of data
- | Write @ 7 P ... @ Write P bytes of data
- |
- | The address, read, and write commands take a parameter P.
- | Normally P is one byte (0-255). If the command is preceded by
- | the Escape command then P is two bytes (0-65535, least significant
- | byte first).
- |
- | The address defaults to that associated with the handle.
- | The flags default to 0. The address and flags maintain their
- | previous value until updated.
- |
- | Any read I2C data is concatenated in the returned bytearray.
- |
- | ...
- | Set address 0x53, write 0x32, read 6 bytes
- | Set address 0x1E, write 0x03, read 6 bytes
- | Set address 0x68, write 0x1B, read 8 bytes
- | End
- |
- | 0x04 0x53 0x07 0x01 0x32 0x06 0x06
- | 0x04 0x1E 0x07 0x01 0x03 0x06 0x06
- | 0x04 0x68 0x07 0x01 0x1B 0x06 0x08
- | 0x00
- | ...
- |
- | notify_begin(self, handle, bits)
- | Starts notifications on a handle.
- |
- | handle:= >=0 (as returned by a prior call to [*notify_open*])
- | bits:= a 32 bit mask indicating the GPIO to be notified.
- |
- | The notification sends state changes for each GPIO whose
- | corresponding bit in bits is set.
- |
- | The following code starts notifications for GPIO 1, 4,
- | 6, 7, and 10 (1234 = 0x04D2 = 0b0000010011010010).
- |
- | ...
- | h = pi.notify_open()
- | if h >= 0:
- | pi.notify_begin(h, 1234)
- | ...
- |
- | notify_close(self, handle)
- | Stops notifications on a handle and releases the handle for reuse.
- |
- | handle:= >=0 (as returned by a prior call to [*notify_open*])
- |
- | ...
- | h = pi.notify_open()
- | if h >= 0:
- | pi.notify_begin(h, 1234)
- | ...
- | pi.notify_close(h)
- | ...
- | ...
- |
- | notify_open(self)
- | Returns a notification handle (>=0).
- |
- | A notification is a method for being notified of GPIO state
- | changes via a pipe.
- |
- | Pipes are only accessible from the local machine so this
- | function serves no purpose if you are using Python from a
- | remote machine. The in-built (socket) notifications
- | provided by [*callback*] should be used instead.
- |
- | Notifications for handle x will be available at the pipe
- | named /dev/pigpiox (where x is the handle number).
- |
- | E.g. if the function returns 15 then the notifications must be
- | read from /dev/pigpio15.
- |
- | Notifications have the following structure:
- |
- | . .
- | H seqno
- | H flags
- | I tick
- | I level
- | . .
- |
- | seqno: starts at 0 each time the handle is opened and then
- | increments by one for each report.
- |
- | flags: three flags are defined, PI_NTFY_FLAGS_WDOG,
- | PI_NTFY_FLAGS_ALIVE, and PI_NTFY_FLAGS_EVENT.
- |
- | If bit 5 is set (PI_NTFY_FLAGS_WDOG) then bits 0-4 of the
- | flags indicate a GPIO which has had a watchdog timeout.
- |
- | If bit 6 is set (PI_NTFY_FLAGS_ALIVE) this indicates a keep
- | alive signal on the pipe/socket and is sent once a minute
- | in the absence of other notification activity.
- |
- | If bit 7 is set (PI_NTFY_FLAGS_EVENT) then bits 0-4 of the
- | flags indicate an event which has been triggered.
- |
- |
- | tick: the number of microseconds since system boot. It wraps
- | around after 1h12m.
- |
- | level: indicates the level of each GPIO. If bit 1<<x is set
- | then GPIO x is high.
- |
- | ...
- | h = pi.notify_open()
- | if h >= 0:
- | pi.notify_begin(h, 1234)
- | ...
- |
- | notify_pause(self, handle)
- | Pauses notifications on a handle.
- |
- | handle:= >=0 (as returned by a prior call to [*notify_open*])
- |
- | Notifications for the handle are suspended until
- | [*notify_begin*] is called again.
- |
- | ...
- | h = pi.notify_open()
- | if h >= 0:
- | pi.notify_begin(h, 1234)
- | ...
- | pi.notify_pause(h)
- | ...
- | pi.notify_begin(h, 1234)
- | ...
- | ...
- |
- | read(self, gpio)
- | Returns the GPIO level.
- |
- | gpio:= 0-53.
- |
- | ...
- | pi.set_mode(23, pigpio.INPUT)
- |
- | pi.set_pull_up_down(23, pigpio.PUD_DOWN)
- | print(pi.read(23))
- | 0
- |
- | pi.set_pull_up_down(23, pigpio.PUD_UP)
- | print(pi.read(23))
- | 1
- | ...
- |
- | read_bank_1(self)
- | Returns the levels of the bank 1 GPIO (GPIO 0-31).
- |
- | The returned 32 bit integer has a bit set if the corresponding
- | GPIO is high. GPIO n has bit value (1<<n).
- |
- | ...
- | print(bin(pi.read_bank_1()))
- | 0b10010100000011100100001001111
- | ...
- |
- | read_bank_2(self)
- | Returns the levels of the bank 2 GPIO (GPIO 32-53).
- |
- | The returned 32 bit integer has a bit set if the corresponding
- | GPIO is high. GPIO n has bit value (1<<(n-32)).
- |
- | ...
- | print(bin(pi.read_bank_2()))
- | 0b1111110000000000000000
- | ...
- |
- | run_script(self, script_id, params=None)
- | Runs a stored script.
- |
- | script_id:= id of stored script.
- | params:= up to 10 parameters required by the script.
- |
- | ...
- | s = pi.run_script(sid, [par1, par2])
- |
- | s = pi.run_script(sid)
- |
- | s = pi.run_script(sid, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
- | ...
- |
- | script_status(self, script_id)
- | Returns the run status of a stored script as well as the
- | current values of parameters 0 to 9.
- |
- | script_id:= id of stored script.
- |
- | The run status may be
- |
- | . .
- | PI_SCRIPT_INITING
- | PI_SCRIPT_HALTED
- | PI_SCRIPT_RUNNING
- | PI_SCRIPT_WAITING
- | PI_SCRIPT_FAILED
- | . .
- |
- | The return value is a tuple of run status and a list of
- | the 10 parameters. On error the run status will be negative
- | and the parameter list will be empty.
- |
- | ...
- | (s, pars) = pi.script_status(sid)
- | ...
- |
- | serial_close(self, handle)
- | Closes the serial device associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*serial_open*]).
- |
- | ...
- | pi.serial_close(h1)
- | ...
- |
- | serial_data_available(self, handle)
- | Returns the number of bytes available to be read from the
- | device associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*serial_open*]).
- |
- | ...
- | rdy = pi.serial_data_available(h1)
- |
- | if rdy > 0:
- | (b, d) = pi.serial_read(h1, rdy)
- | ...
- |
- | serial_open(self, tty, baud, ser_flags=0)
- | Returns a handle for the serial tty device opened
- | at baud bits per second. The device name must start
- | with /dev/tty or /dev/serial.
- |
- | tty:= the serial device to open.
- | baud:= baud rate in bits per second, see below.
- | ser_flags:= 0, no flags are currently defined.
- |
- | Normally you would only use the [*serial_**] functions if
- | you are or will be connecting to the Pi over a network. If
- | you will always run on the local Pi use the standard serial
- | module instead.
- |
- | The baud rate must be one of 50, 75, 110, 134, 150,
- | 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,
- | 38400, 57600, 115200, or 230400.
- |
- | ...
- | h1 = pi.serial_open("/dev/ttyAMA0", 300)
- |
- | h2 = pi.serial_open("/dev/ttyUSB1", 19200, 0)
- |
- | h3 = pi.serial_open("/dev/serial0", 9600)
- | ...
- |
- | serial_read(self, handle, count=1000)
- | Reads up to count bytes from the device associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*serial_open*]).
- | count:= >0, the number of bytes to read (defaults to 1000).
- |
- | The returned value is a tuple of the number of bytes read and
- | a bytearray containing the bytes. If there was an error the
- | number of bytes read will be less than zero (and will contain
- | the error code).
- |
- | If no data is ready a bytes read of zero is returned.
- | ...
- | (b, d) = pi.serial_read(h2, 100)
- | if b > 0:
- | # process read data
- | ...
- |
- | serial_read_byte(self, handle)
- | Returns a single byte from the device associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*serial_open*]).
- |
- | If no data is ready a negative error code will be returned.
- |
- | ...
- | b = pi.serial_read_byte(h1)
- | ...
- |
- | serial_write(self, handle, data)
- | Writes the data bytes to the device associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*serial_open*]).
- | data:= the bytes to write.
- |
- | ...
- | pi.serial_write(h1, b'\x02\x03\x04')
- |
- | pi.serial_write(h2, b'help')
- |
- | pi.serial_write(h2, "hello")
- |
- | pi.serial_write(h1, [2, 3, 4])
- | ...
- |
- | serial_write_byte(self, handle, byte_val)
- | Writes a single byte to the device associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*serial_open*]).
- | byte_val:= 0-255, the value to write.
- |
- | ...
- | pi.serial_write_byte(h1, 23)
- |
- | pi.serial_write_byte(h1, ord('Z'))
- | ...
- |
- | set_PWM_dutycycle(self, user_gpio, dutycycle)
- | Starts (non-zero dutycycle) or stops (0) PWM pulses on the GPIO.
- |
- | user_gpio:= 0-31.
- | dutycycle:= 0-range (range defaults to 255).
- |
- | The [*set_PWM_range*] function can change the default range of 255.
- |
- | ...
- | pi.set_PWM_dutycycle(4, 0) # PWM off
- | pi.set_PWM_dutycycle(4, 64) # PWM 1/4 on
- | pi.set_PWM_dutycycle(4, 128) # PWM 1/2 on
- | pi.set_PWM_dutycycle(4, 192) # PWM 3/4 on
- | pi.set_PWM_dutycycle(4, 255) # PWM full on
- | ...
- |
- | set_PWM_frequency(self, user_gpio, frequency)
- | Sets the frequency (in Hz) of the PWM to be used on the GPIO.
- |
- | user_gpio:= 0-31.
- | frequency:= >=0 Hz
- |
- | Returns the numerically closest frequency if OK, otherwise
- | PI_BAD_USER_GPIO or PI_NOT_PERMITTED.
- |
- | If PWM is currently active on the GPIO it will be switched
- | off and then back on at the new frequency.
- |
- | Each GPIO can be independently set to one of 18 different
- | PWM frequencies.
- |
- | The selectable frequencies depend upon the sample rate which
- | may be 1, 2, 4, 5, 8, or 10 microseconds (default 5). The
- | sample rate is set when the pigpio daemon is started.
- |
- | The frequencies for each sample rate are:
- |
- | . .
- | Hertz
- |
- | 1: 40000 20000 10000 8000 5000 4000 2500 2000 1600
- | 1250 1000 800 500 400 250 200 100 50
- |
- | 2: 20000 10000 5000 4000 2500 2000 1250 1000 800
- | 625 500 400 250 200 125 100 50 25
- |
- | 4: 10000 5000 2500 2000 1250 1000 625 500 400
- | 313 250 200 125 100 63 50 25 13
- | sample
- | rate
- | (us) 5: 8000 4000 2000 1600 1000 800 500 400 320
- | 250 200 160 100 80 50 40 20 10
- |
- | 8: 5000 2500 1250 1000 625 500 313 250 200
- | 156 125 100 63 50 31 25 13 6
- |
- | 10: 4000 2000 1000 800 500 400 250 200 160
- | 125 100 80 50 40 25 20 10 5
- | . .
- |
- | ...
- | pi.set_PWM_frequency(4,0)
- | print(pi.get_PWM_frequency(4))
- | 10
- |
- | pi.set_PWM_frequency(4,100000)
- | print(pi.get_PWM_frequency(4))
- | 8000
- | ...
- |
- | set_PWM_range(self, user_gpio, range_)
- | Sets the range of PWM values to be used on the GPIO.
- |
- | user_gpio:= 0-31.
- | range_:= 25-40000.
- |
- | ...
- | pi.set_PWM_range(9, 100) # now 25 1/4, 50 1/2, 75 3/4 on
- | pi.set_PWM_range(9, 500) # now 125 1/4, 250 1/2, 375 3/4 on
- | pi.set_PWM_range(9, 3000) # now 750 1/4, 1500 1/2, 2250 3/4 on
- | ...
- |
- | set_bank_1(self, bits)
- | Sets GPIO 0-31 if the corresponding bit in bits is set.
- |
- | bits:= a 32 bit mask with 1 set if the corresponding GPIO is
- | to be set.
- |
- | A returned status of PI_SOME_PERMITTED indicates that the user
- | is not allowed to write to one or more of the GPIO.
- |
- | ...
- | pi.set_bank_1(int("111110010000",2))
- | ...
- |
- | set_bank_2(self, bits)
- | Sets GPIO 32-53 if the corresponding bit (0-21) in bits is set.
- |
- | bits:= a 32 bit mask with 1 set if the corresponding GPIO is
- | to be set.
- |
- | A returned status of PI_SOME_PERMITTED indicates that the user
- | is not allowed to write to one or more of the GPIO.
- |
- | ...
- | pi.set_bank_2(0x303)
- | ...
- |
- | set_glitch_filter(self, user_gpio, steady)
- | Sets a glitch filter on a GPIO.
- |
- | Level changes on the GPIO are not reported unless the level
- | has been stable for at least [*steady*] microseconds. The
- | level is then reported. Level changes of less than [*steady*]
- | microseconds are ignored.
- |
- | user_gpio:= 0-31
- | steady:= 0-300000
- |
- | Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
- |
- | This filter affects the GPIO samples returned to callbacks set up
- | with [*callback*] and [*wait_for_edge*].
- |
- | It does not affect levels read by [*read*],
- | [*read_bank_1*], or [*read_bank_2*].
- |
- | Each (stable) edge will be timestamped [*steady*]
- | microseconds after it was first detected.
- |
- | ...
- | pi.set_glitch_filter(23, 100)
- | ...
- |
- | set_mode(self, gpio, mode)
- | Sets the GPIO mode.
- |
- | gpio:= 0-53.
- | mode:= INPUT, OUTPUT, ALT0, ALT1, ALT2, ALT3, ALT4, ALT5.
- |
- | ...
- | pi.set_mode( 4, pigpio.INPUT) # GPIO 4 as input
- | pi.set_mode(17, pigpio.OUTPUT) # GPIO 17 as output
- | pi.set_mode(24, pigpio.ALT2) # GPIO 24 as ALT2
- | ...
- |
- | set_noise_filter(self, user_gpio, steady, active)
- | Sets a noise filter on a GPIO.
- |
- | Level changes on the GPIO are ignored until a level which has
- | been stable for [*steady*] microseconds is detected. Level
- | changes on the GPIO are then reported for [*active*]
- | microseconds after which the process repeats.
- |
- | user_gpio:= 0-31
- | steady:= 0-300000
- | active:= 0-1000000
- |
- | Returns 0 if OK, otherwise PI_BAD_USER_GPIO, or PI_BAD_FILTER.
- |
- | This filter affects the GPIO samples returned to callbacks set up
- | with [*callback*] and [*wait_for_edge*].
- |
- | It does not affect levels read by [*read*],
- | [*read_bank_1*], or [*read_bank_2*].
- |
- | Level changes before and after the active period may
- | be reported. Your software must be designed to cope with
- | such reports.
- |
- | ...
- | pi.set_noise_filter(23, 1000, 5000)
- | ...
- |
- | set_pad_strength(self, pad, pad_strength)
- | This function sets the pad drive strength in mA.
- |
- |
- | pad:= 0-2, the pad to set.
- | pad_strength:= 1-16 mA.
- |
- | Returns 0 if OK, otherwise PI_BAD_PAD, or PI_BAD_STRENGTH.
- |
- | Pad @ GPIO
- | 0 @ 0-27
- | 1 @ 28-45
- | 2 @ 46-53
- |
- | ...
- | pi.set_pad_strength(2, 14) # Set pad 2 to 14 mA.
- | ...
- |
- | set_pull_up_down(self, gpio, pud)
- | Sets or clears the internal GPIO pull-up/down resistor.
- |
- | gpio:= 0-53.
- | pud:= PUD_UP, PUD_DOWN, PUD_OFF.
- |
- | ...
- | pi.set_pull_up_down(17, pigpio.PUD_OFF)
- | pi.set_pull_up_down(23, pigpio.PUD_UP)
- | pi.set_pull_up_down(24, pigpio.PUD_DOWN)
- | ...
- |
- | set_servo_pulsewidth(self, user_gpio, pulsewidth)
- | Starts (500-2500) or stops (0) servo pulses on the GPIO.
- |
- | user_gpio:= 0-31.
- | pulsewidth:= 0 (off),
- | 500 (most anti-clockwise) - 2500 (most clockwise).
- |
- | The selected pulsewidth will continue to be transmitted until
- | changed by a subsequent call to set_servo_pulsewidth.
- |
- | The pulsewidths supported by servos varies and should probably
- | be determined by experiment. A value of 1500 should always be
- | safe and represents the mid-point of rotation.
- |
- | You can DAMAGE a servo if you command it to move beyond its
- | limits.
- |
- | ...
- | pi.set_servo_pulsewidth(17, 0) # off
- | pi.set_servo_pulsewidth(17, 1000) # safe anti-clockwise
- | pi.set_servo_pulsewidth(17, 1500) # centre
- | pi.set_servo_pulsewidth(17, 2000) # safe clockwise
- | ...
- |
- | set_watchdog(self, user_gpio, wdog_timeout)
- | Sets a watchdog timeout for a GPIO.
- |
- | user_gpio:= 0-31.
- | wdog_timeout:= 0-60000.
- |
- | The watchdog is nominally in milliseconds.
- |
- | Only one watchdog may be registered per GPIO.
- |
- | The watchdog may be cancelled by setting timeout to 0.
- |
- | Once a watchdog has been started callbacks for the GPIO
- | will be triggered every timeout interval after the last
- | GPIO activity.
- |
- | The callback will receive the special level TIMEOUT.
- |
- | ...
- | pi.set_watchdog(23, 1000) # 1000 ms watchdog on GPIO 23
- | pi.set_watchdog(23, 0) # cancel watchdog on GPIO 23
- | ...
- |
- | shell(self, shellscr, pstring='')
- | This function uses the system call to execute a shell script
- | with the given string as its parameter.
- |
- | shellscr:= the name of the script, only alphanumerics,
- | '-' and '_' are allowed in the name
- | pstring := the parameter string to pass to the script
- |
- | The exit status of the system call is returned if OK,
- | otherwise PI_BAD_SHELL_STATUS.
- |
- | [*shellscr*] must exist in /opt/pigpio/cgi and must be executable.
- |
- | The returned exit status is normally 256 times that set by
- | the shell script exit function. If the script can't be
- | found 32512 will be returned.
- |
- | The following table gives some example returned statuses:
- |
- | Script exit status @ Returned system call status
- | 1 @ 256
- | 5 @ 1280
- | 10 @ 2560
- | 200 @ 51200
- | script not found @ 32512
- |
- | ...
- | // pass two parameters, hello and world
- | status = pi.shell("scr1", "hello world");
- |
- | // pass three parameters, hello, string with spaces, and world
- | status = pi.shell("scr1", "hello 'string with spaces' world");
- |
- | // pass one parameter, hello string with spaces world
- | status = pi.shell("scr1", "\"hello string with spaces world\"");
- | ...
- |
- | spi_close(self, handle)
- | Closes the SPI device associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*spi_open*]).
- |
- | ...
- | pi.spi_close(h)
- | ...
- |
- | spi_open(self, spi_channel, baud, spi_flags=0)
- | Returns a handle for the SPI device on the channel. Data
- | will be transferred at baud bits per second. The flags
- | may be used to modify the default behaviour of 4-wire
- | operation, mode 0, active low chip select.
- |
- | The Pi has two SPI peripherals: main and auxiliary.
- |
- | The main SPI has two chip selects (channels), the auxiliary
- | has three.
- |
- | The auxiliary SPI is available on all models but the A and B.
- |
- | The GPIO used are given in the following table.
- |
- | @ MISO @ MOSI @ SCLK @ CE0 @ CE1 @ CE2
- | Main SPI @ 9 @ 10 @ 11 @ 8 @ 7 @ -
- | Aux SPI @ 19 @ 20 @ 21 @ 18 @ 17 @ 16
- |
- | spi_channel:= 0-1 (0-2 for the auxiliary SPI).
- | baud:= 32K-125M (values above 30M are unlikely to work).
- | spi_flags:= see below.
- |
- | spi_flags consists of the least significant 22 bits.
- |
- | . .
- | 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
- | b b b b b b R T n n n n W A u2 u1 u0 p2 p1 p0 m m
- | . .
- |
- | mm defines the SPI mode.
- |
- | WARNING: modes 1 and 3 do not appear to work on
- | the auxiliary SPI.
- |
- | . .
- | Mode POL PHA
- | 0 0 0
- | 1 0 1
- | 2 1 0
- | 3 1 1
- | . .
- |
- | px is 0 if CEx is active low (default) and 1 for active high.
- |
- | ux is 0 if the CEx GPIO is reserved for SPI (default)
- | and 1 otherwise.
- |
- | A is 0 for the main SPI, 1 for the auxiliary SPI.
- |
- | W is 0 if the device is not 3-wire, 1 if the device is 3-wire.
- | Main SPI only.
- |
- | nnnn defines the number of bytes (0-15) to write before
- | switching the MOSI line to MISO to read data. This field
- | is ignored if W is not set. Main SPI only.
- |
- | T is 1 if the least significant bit is transmitted on MOSI
- | first, the default (0) shifts the most significant bit out
- | first. Auxiliary SPI only.
- |
- | R is 1 if the least significant bit is received on MISO
- | first, the default (0) receives the most significant bit
- | first. Auxiliary SPI only.
- |
- | bbbbbb defines the word size in bits (0-32). The default (0)
- | sets 8 bits per word. Auxiliary SPI only.
- |
- | The [*spi_read*], [*spi_write*], and [*spi_xfer*] functions
- | transfer data packed into 1, 2, or 4 bytes according to
- | the word size in bits.
- |
- | For bits 1-8 there will be one byte per character.
- | For bits 9-16 there will be two bytes per character.
- | For bits 17-32 there will be four bytes per character.
- |
- | Multi-byte transfers are made in least significant byte
- | first order.
- |
- | E.g. to transfer 32 11-bit words data should
- | contain 64 bytes.
- |
- | E.g. to transfer the 14 bit value 0x1ABC send the
- | bytes 0xBC followed by 0x1A.
- |
- | The other bits in flags should be set to zero.
- |
- | ...
- | # open SPI device on channel 1 in mode 3 at 50000 bits per second
- |
- | h = pi.spi_open(1, 50000, 3)
- | ...
- |
- | spi_read(self, handle, count)
- | Reads count bytes from the SPI device associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*spi_open*]).
- | count:= >0, the number of bytes to read.
- |
- | The returned value is a tuple of the number of bytes read and a
- | bytearray containing the bytes. If there was an error the
- | number of bytes read will be less than zero (and will contain
- | the error code).
- |
- | ...
- | (b, d) = pi.spi_read(h, 60) # read 60 bytes from device h
- | if b == 60:
- | # process read data
- | else:
- | # error path
- | ...
- |
- | spi_write(self, handle, data)
- | Writes the data bytes to the SPI device associated with handle.
- |
- | handle:= >=0 (as returned by a prior call to [*spi_open*]).
- | data:= the bytes to write.
- |
- | ...
- | pi.spi_write(0, b'\x02\xc0\x80') # write 3 bytes to device 0
- |
- | pi.spi_write(0, b'defgh') # write 5 bytes to device 0
- |
- | pi.spi_write(0, "def") # write 3 bytes to device 0
- |
- | pi.spi_write(1, [2, 192, 128]) # write 3 bytes to device 1
- | ...
- |
- | spi_xfer(self, handle, data)
- | Writes the data bytes to the SPI device associated with handle,
- | returning the data bytes read from the device.
- |
- | handle:= >=0 (as returned by a prior call to [*spi_open*]).
- | data:= the bytes to write.
- |
- | The returned value is a tuple of the number of bytes read and a
- | bytearray containing the bytes. If there was an error the
- | number of bytes read will be less than zero (and will contain
- | the error code).
- |
- | ...
- | (count, rx_data) = pi.spi_xfer(h, b'\x01\x80\x00')
- |
- | (count, rx_data) = pi.spi_xfer(h, [1, 128, 0])
- |
- | (count, rx_data) = pi.spi_xfer(h, b"hello")
- |
- | (count, rx_data) = pi.spi_xfer(h, "hello")
- | ...
- |
- | stop(self)
- | Release pigpio resources.
- |
- | ...
- | pi.stop()
- | ...
- |
- | stop_script(self, script_id)
- | Stops a running script.
- |
- | script_id:= id of stored script.
- |
- | ...
- | status = pi.stop_script(sid)
- | ...
- |
- | store_script(self, script)
- | Store a script for later execution.
- |
- | See [[http://abyz.me.uk/rpi/pigpio/pigs.html#Scripts]] for
- | details.
- |
- | script:= the script text as a series of bytes.
- |
- | Returns a >=0 script id if OK.
- |
- | ...
- | sid = pi.store_script(
- | b'tag 0 w 22 1 mils 100 w 22 0 mils 100 dcr p0 jp 0')
- | ...
- |
- | update_script(self, script_id, params=None)
- | Sets the parameters of a script. The script may or
- | may not be running. The first parameters of the script are
- | overwritten with the new values.
- |
- | script_id:= id of stored script.
- | params:= up to 10 parameters required by the script.
- |
- | ...
- | s = pi.update_script(sid, [par1, par2])
- |
- | s = pi.update_script(sid, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
- | ...
- |
- | wait_for_edge(self, user_gpio, edge=0, wait_timeout=60.0)
- | Wait for an edge event on a GPIO.
- |
- | user_gpio:= 0-31.
- | edge:= EITHER_EDGE, RISING_EDGE (default), or
- | FALLING_EDGE.
- | wait_timeout:= >=0.0 (default 60.0).
- |
- | The function returns when the edge is detected or after
- | the number of seconds specified by timeout has expired.
- |
- | Do not use this function for precise timing purposes,
- | the edge is only checked 20 times a second. Whenever
- | you need to know the accurate time of GPIO events use
- | a [*callback*] function.
- |
- | The function returns True if the edge is detected,
- | otherwise False.
- |
- | ...
- | if pi.wait_for_edge(23):
- | print("Rising edge detected")
- | else:
- | print("wait for edge timed out")
- |
- | if pi.wait_for_edge(23, pigpio.FALLING_EDGE, 5.0):
- | print("Falling edge detected")
- | else:
- | print("wait for falling edge timed out")
- | ...
- |
- | wait_for_event(self, event, wait_timeout=60.0)
- | Wait for an event.
- |
- | event:= 0-31.
- | wait_timeout:= >=0.0 (default 60.0).
- |
- | The function returns when the event is signalled or after
- | the number of seconds specified by timeout has expired.
- |
- | The function returns True if the event is detected,
- | otherwise False.
- |
- | ...
- | if pi.wait_for_event(23):
- | print("event detected")
- | else:
- | print("wait for event timed out")
- | ...
- |
- | wave_add_generic(self, pulses)
- | Adds a list of pulses to the current waveform.
- |
- | pulses:= list of pulses to add to the waveform.
- |
- | Returns the new total number of pulses in the current waveform.
- |
- | The pulses are interleaved in time order within the existing
- | waveform (if any).
- |
- | Merging allows the waveform to be built in parts, that is the
- | settings for GPIO#1 can be added, and then GPIO#2 etc.
- |
- | If the added waveform is intended to start after or within
- | the existing waveform then the first pulse should consist
- | solely of a delay.
- |
- | ...
- | G1=4
- | G2=24
- |
- | pi.set_mode(G1, pigpio.OUTPUT)
- | pi.set_mode(G2, pigpio.OUTPUT)
- |
- | flash_500=[] # flash every 500 ms
- | flash_100=[] # flash every 100 ms
- |
- | # ON OFF DELAY
- |
- | flash_500.append(pigpio.pulse(1<<G1, 1<<G2, 500000))
- | flash_500.append(pigpio.pulse(1<<G2, 1<<G1, 500000))
- |
- | flash_100.append(pigpio.pulse(1<<G1, 1<<G2, 100000))
- | flash_100.append(pigpio.pulse(1<<G2, 1<<G1, 100000))
- |
- | pi.wave_clear() # clear any existing waveforms
- |
- | pi.wave_add_generic(flash_500) # 500 ms flashes
- | f500 = pi.wave_create() # create and save id
- |
- | pi.wave_add_generic(flash_100) # 100 ms flashes
- | f100 = pi.wave_create() # create and save id
- |
- | pi.wave_send_repeat(f500)
- |
- | time.sleep(4)
- |
- | pi.wave_send_repeat(f100)
- |
- | time.sleep(4)
- |
- | pi.wave_send_repeat(f500)
- |
- | time.sleep(4)
- |
- | pi.wave_tx_stop() # stop waveform
- |
- | pi.wave_clear() # clear all waveforms
- | ...
- |
- | wave_add_new(self)
- | Starts a new empty waveform.
- |
- | You would not normally need to call this function as it is
- | automatically called after a waveform is created with the
- | [*wave_create*] function.
- |
- | ...
- | pi.wave_add_new()
- | ...
- |
- | wave_add_serial(self, user_gpio, baud, data, offset=0, bb_bits=8, bb_stop=2)
- | Adds a waveform representing serial data to the existing
- | waveform (if any). The serial data starts [*offset*]
- | microseconds from the start of the waveform.
- |
- | user_gpio:= GPIO to transmit data. You must set the GPIO mode
- | to output.
- | baud:= 50-1000000 bits per second.
- | data:= the bytes to write.
- | offset:= number of microseconds from the start of the
- | waveform, default 0.
- | bb_bits:= number of data bits, default 8.
- | bb_stop:= number of stop half bits, default 2.
- |
- | Returns the new total number of pulses in the current waveform.
- |
- | The serial data is formatted as one start bit, [*bb_bits*]
- | data bits, and [*bb_stop*]/2 stop bits.
- |
- | It is legal to add serial data streams with different baud
- | rates to the same waveform.
- |
- | The bytes required for each character depend upon [*bb_bits*].
- |
- | For [*bb_bits*] 1-8 there will be one byte per character.
- | For [*bb_bits*] 9-16 there will be two bytes per character.
- | For [*bb_bits*] 17-32 there will be four bytes per character.
- |
- | ...
- | pi.wave_add_serial(4, 300, 'Hello world')
- |
- | pi.wave_add_serial(4, 300, b"Hello world")
- |
- | pi.wave_add_serial(4, 300, b'\x23\x01\x00\x45')
- |
- | pi.wave_add_serial(17, 38400, [23, 128, 234], 5000)
- | ...
- |
- | wave_chain(self, data)
- | This function transmits a chain of waveforms.
- |
- | NOTE: Any hardware PWM started by [*hardware_PWM*]
- | will be cancelled.
- |
- | The waves to be transmitted are specified by the contents
- | of data which contains an ordered list of [*wave_id*]s
- | and optional command codes and related data.
- |
- | Returns 0 if OK, otherwise PI_CHAIN_NESTING,
- | PI_CHAIN_LOOP_CNT, PI_BAD_CHAIN_LOOP, PI_BAD_CHAIN_CMD,
- | PI_CHAIN_COUNTER, PI_BAD_CHAIN_DELAY, PI_CHAIN_TOO_BIG,
- | or PI_BAD_WAVE_ID.
- |
- | Each wave is transmitted in the order specified. A wave
- | may occur multiple times per chain.
- |
- | A blocks of waves may be transmitted multiple times by
- | using the loop commands. The block is bracketed by loop
- | start and end commands. Loops may be nested.
- |
- | Delays between waves may be added with the delay command.
- |
- | The following command codes are supported:
- |
- | Name @ Cmd & Data @ Meaning
- | Loop Start @ 255 0 @ Identify start of a wave block
- | Loop Repeat @ 255 1 x y @ loop x + y*256 times
- | Delay @ 255 2 x y @ delay x + y*256 microseconds
- | Loop Forever @ 255 3 @ loop forever
- |
- | If present Loop Forever must be the last entry in the chain.
- |
- | The code is currently dimensioned to support a chain with
- | roughly 600 entries and 20 loop counters.
- |
- | ...
- | #!/usr/bin/env python
- |
- | import time
- | import pigpio
- |
- | WAVES=5
- | GPIO=4
- |
- | wid=[0]*WAVES
- |
- | pi = pigpio.pi() # Connect to local Pi.
- |
- | pi.set_mode(GPIO, pigpio.OUTPUT);
- |
- | for i in range(WAVES):
- | pi.wave_add_generic([
- | pigpio.pulse(1<<GPIO, 0, 20),
- | pigpio.pulse(0, 1<<GPIO, (i+1)*200)]);
- |
- | wid[i] = pi.wave_create();
- |
- | pi.wave_chain([
- | wid[4], wid[3], wid[2], # transmit waves 4+3+2
- | 255, 0, # loop start
- | wid[0], wid[0], wid[0], # transmit waves 0+0+0
- | 255, 0, # loop start
- | wid[0], wid[1], # transmit waves 0+1
- | 255, 2, 0x88, 0x13, # delay 5000us
- | 255, 1, 30, 0, # loop end (repeat 30 times)
- | 255, 0, # loop start
- | wid[2], wid[3], wid[0], # transmit waves 2+3+0
- | wid[3], wid[1], wid[2], # transmit waves 3+1+2
- | 255, 1, 10, 0, # loop end (repeat 10 times)
- | 255, 1, 5, 0, # loop end (repeat 5 times)
- | wid[4], wid[4], wid[4], # transmit waves 4+4+4
- | 255, 2, 0x20, 0x4E, # delay 20000us
- | wid[0], wid[0], wid[0], # transmit waves 0+0+0
- | ])
- |
- | while pi.wave_tx_busy():
- | time.sleep(0.1);
- |
- | for i in range(WAVES):
- | pi.wave_delete(wid[i])
- |
- | pi.stop()
- | ...
- |
- | wave_clear(self)
- | Clears all waveforms and any data added by calls to the
- | [*wave_add_**] functions.
- |
- | ...
- | pi.wave_clear()
- | ...
- |
- | wave_create(self)
- | Creates a waveform from the data provided by the prior calls
- | to the [*wave_add_**] functions.
- |
- | Returns a wave id (>=0) if OK, otherwise PI_EMPTY_WAVEFORM,
- | PI_TOO_MANY_CBS, PI_TOO_MANY_OOL, or PI_NO_WAVEFORM_ID.
- |
- | The data provided by the [*wave_add_**] functions is consumed by
- | this function.
- |
- | As many waveforms may be created as there is space available.
- | The wave id is passed to [*wave_send_**] to specify the waveform
- | to transmit.
- |
- | Normal usage would be
- |
- | Step 1. [*wave_clear*] to clear all waveforms and added data.
- |
- | Step 2. [*wave_add_**] calls to supply the waveform data.
- |
- | Step 3. [*wave_create*] to create the waveform and get a unique id
- |
- | Repeat steps 2 and 3 as needed.
- |
- | Step 4. [*wave_send_**] with the id of the waveform to transmit.
- |
- | A waveform comprises one or more pulses.
- |
- | A pulse specifies
- |
- | 1) the GPIO to be switched on at the start of the pulse.
- | 2) the GPIO to be switched off at the start of the pulse.
- | 3) the delay in microseconds before the next pulse.
- |
- | Any or all the fields can be zero. It doesn't make any sense
- | to set all the fields to zero (the pulse will be ignored).
- |
- | When a waveform is started each pulse is executed in order with
- | the specified delay between the pulse and the next.
- |
- | ...
- | wid = pi.wave_create()
- | ...
- |
- | wave_create_and_pad(self, percent)
- | This function creates a waveform like [*wave_create*] but pads the consumed
- | resources. Where percent gives the percentage of the resources to use
- | (in terms of the theoretical maximum, not the current amount free).
- | This allows the reuse of deleted waves while a transmission is active.
- |
- | Upon success a wave id greater than or equal to 0 is returned, otherwise
- | PI_EMPTY_WAVEFORM, PI_TOO_MANY_CBS, PI_TOO_MANY_OOL, or PI_NO_WAVEFORM_ID.
- |
- | . .
- | percent: 0-100, size of waveform as percentage of maximum available.
- | . .
- |
- | The data provided by the [*wave_add_**] functions are consumed by this
- | function.
- |
- | As many waveforms may be created as there is space available. The
- | wave id is passed to [*wave_send_**] to specify the waveform to transmit.
- |
- | A usage would be the creation of two waves where one is filled while the
- | other is being transmitted. Each wave is assigned 50% of the resources.
- | This buffer structure allows the transmission of infinite wave sequences.
- |
- | Normal usage:
- |
- | Step 1. [*wave_clear*] to clear all waveforms and added data.
- |
- | Step 2. [*wave_add_**] calls to supply the waveform data.
- |
- | Step 3. [*wave_create_and_pad*] to create a waveform of uniform size.
- |
- | Step 4. [*wave_send_**] 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.
- |
- | ...
- | wid = pi.wave_create_and_pad(50)
- | ...
- |
- | wave_delete(self, wave_id)
- | This function deletes the waveform with id wave_id.
- |
- | wave_id:= >=0 (as returned by a prior call to [*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).
- |
- | ...
- | pi.wave_delete(6) # delete waveform with id 6
- |
- | pi.wave_delete(0) # delete waveform with id 0
- | ...
- |
- | wave_get_cbs(self)
- | Returns the length in DMA control blocks of the current
- | waveform.
- |
- | ...
- | cbs = pi.wave_get_cbs()
- | ...
- |
- | wave_get_max_cbs(self)
- | Returns the maximum possible size of a waveform in DMA
- | control blocks.
- |
- | ...
- | cbs = pi.wave_get_max_cbs()
- | ...
- |
- | wave_get_max_micros(self)
- | Returns the maximum possible size of a waveform in microseconds.
- |
- | ...
- | micros = pi.wave_get_max_micros()
- | ...
- |
- | wave_get_max_pulses(self)
- | Returns the maximum possible size of a waveform in pulses.
- |
- | ...
- | pulses = pi.wave_get_max_pulses()
- | ...
- |
- | wave_get_micros(self)
- | Returns the length in microseconds of the current waveform.
- |
- | ...
- | micros = pi.wave_get_micros()
- | ...
- |
- | wave_get_pulses(self)
- | Returns the length in pulses of the current waveform.
- |
- | ...
- | pulses = pi.wave_get_pulses()
- | ...
- |
- | wave_send_once(self, wave_id)
- | Transmits the waveform with id wave_id. The waveform is sent
- | once.
- |
- | NOTE: Any hardware PWM started by [*hardware_PWM*] will
- | be cancelled.
- |
- | wave_id:= >=0 (as returned by a prior call to [*wave_create*]).
- |
- | Returns the number of DMA control blocks used in the waveform.
- |
- | ...
- | cbs = pi.wave_send_once(wid)
- | ...
- |
- | wave_send_repeat(self, wave_id)
- | Transmits the waveform with id wave_id. The waveform repeats
- | until wave_tx_stop is called or another call to [*wave_send_**]
- | is made.
- |
- | NOTE: Any hardware PWM started by [*hardware_PWM*] will
- | be cancelled.
- |
- | wave_id:= >=0 (as returned by a prior call to [*wave_create*]).
- |
- | Returns the number of DMA control blocks used in the waveform.
- |
- | ...
- | cbs = pi.wave_send_repeat(wid)
- | ...
- |
- | wave_send_using_mode(self, wave_id, mode)
- | Transmits the waveform with id wave_id using mode mode.
- |
- | wave_id:= >=0 (as returned by a prior call to [*wave_create*]).
- | mode:= WAVE_MODE_ONE_SHOT, WAVE_MODE_REPEAT,
- | WAVE_MODE_ONE_SHOT_SYNC, or WAVE_MODE_REPEAT_SYNC.
- |
- | WAVE_MODE_ONE_SHOT: same as [*wave_send_once*].
- |
- | WAVE_MODE_REPEAT same as [*wave_send_repeat*].
- |
- | WAVE_MODE_ONE_SHOT_SYNC same as [*wave_send_once*] but tries
- | to sync with the previous waveform.
- |
- | WAVE_MODE_REPEAT_SYNC same as [*wave_send_repeat*] but tries
- | to sync with the previous waveform.
- |
- | WARNING: bad things may happen if you delete the previous
- | waveform before it has been synced to the new waveform.
- |
- | NOTE: Any hardware PWM started by [*hardware_PWM*] will
- | be cancelled.
- |
- | wave_id:= >=0 (as returned by a prior call to [*wave_create*]).
- |
- | Returns the number of DMA control blocks used in the waveform.
- |
- | ...
- | cbs = pi.wave_send_using_mode(wid, WAVE_MODE_REPEAT_SYNC)
- | ...
- |
- | wave_tx_at(self)
- | Returns the id of the waveform currently being
- | transmitted.
- |
- | Returns the waveform id or one of the following special
- | values:
- |
- | WAVE_NOT_FOUND (9998) - transmitted wave not found.
- | NO_TX_WAVE (9999) - no wave being transmitted.
- |
- | ...
- | wid = pi.wave_tx_at()
- | ...
- |
- | wave_tx_busy(self)
- | Returns 1 if a waveform is currently being transmitted,
- | otherwise 0.
- |
- | ...
- | pi.wave_send_once(0) # send first waveform
- |
- | while pi.wave_tx_busy(): # wait for waveform to be sent
- | time.sleep(0.1)
- |
- | pi.wave_send_once(1) # send next waveform
- | ...
- |
- | wave_tx_repeat(self)
- | This function is deprecated and has beeen removed.
- |
- | Use [*wave_create*]/[*wave_send_**] instead.
- |
- | wave_tx_start(self)
- | This function is deprecated and has been removed.
- |
- | Use [*wave_create*]/[*wave_send_**] instead.
- |
- | wave_tx_stop(self)
- | Stops the transmission of the current waveform.
- |
- | This function is intended to stop a waveform started with
- | wave_send_repeat.
- |
- | ...
- | pi.wave_send_repeat(3)
- |
- | time.sleep(5)
- |
- | pi.wave_tx_stop()
- | ...
- |
- | write(self, gpio, level)
- | Sets the GPIO level.
- |
- | GPIO:= 0-53.
- | level:= 0, 1.
- |
- | If PWM or servo pulses are active on the GPIO they are
- | switched off.
- |
- | ...
- | pi.set_mode(17, pigpio.OUTPUT)
- |
- | pi.write(17,0)
- | print(pi.read(17))
- | 0
- |
- | pi.write(17,1)
- | print(pi.read(17))
- | 1
- | ...
-
- class pulse
- | A class to store pulse information.
- |
- | Methods defined here:
- |
- | __init__(self, gpio_on, gpio_off, delay)
- | Initialises a pulse.
- |
- | gpio_on:= the GPIO to switch on at the start of the pulse.
- | gpio_off:= the GPIO to switch off at the start of the pulse.
- | delay:= the delay in microseconds before the next pulse.
-
-FUNCTIONS
- error_text(errnum)
- Returns a text description of a pigpio error.
-
- errnum:= <0, the error number
-
- ...
- print(pigpio.error_text(-5))
- level not 0-1
- ...
-
- tickDiff(t1, t2)
- Returns the microsecond difference between two ticks.
-
- t1:= the earlier tick
- t2:= the later tick
-
- ...
- print(pigpio.tickDiff(4294967272, 12))
- 36
- ...
-
- u2i(uint32)
- Converts a 32 bit unsigned number to signed.
-
- uint32:= an unsigned 32 bit number
-
- ...
- print(u2i(4294967272))
- -24
- print(u2i(37))
- 37
- ...
-
- xref()
- active: 0-1000000
- The number of microseconds level changes are reported for once
- a noise filter has been triggered (by [*steady*] microseconds of
- a stable level).
-
-
- arg1:
- An unsigned argument passed to a user customised function. Its
- meaning is defined by the customiser.
-
- arg2:
- An unsigned argument passed to a user customised function. Its
- meaning is defined by the customiser.
-
- argx:
- An array of bytes passed to a user customised function.
- Its meaning and content is defined by the customiser.
-
- baud:
- The speed of serial communication (I2C, SPI, serial link, waves)
- in bits per second.
-
- bb_bits: 1-32
- The number of data bits to be used when adding serial data to a
- waveform.
-
- bb_stop: 2-8
- The number of (half) stop bits to be used when adding serial data
- to a waveform.
-
- bit: 0-1
- A value of 0 or 1.
-
- bits: 32 bit number
- A mask used to select GPIO to be operated on. If bit n is set
- then GPIO n is selected. A convenient way of setting bit n is to
- bit or in the value (1<<n).
-
- To select GPIO 1, 7, 23
-
- bits = (1<<1) | (1<<7) | (1<<23)
-
- bsc_control:
-
- . .
- 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
- a a a a a a a - - IT HC TF IR RE TE BK EC ES PL PH I2 SP EN
- . .
-
- aaaaaaa defines the I2C slave address (only relevant in I2C mode)
-
- Bits 0-13 are copied unchanged to the BSC CR register. See
- pages 163-165 of the Broadcom peripherals document.
-
- byte_val: 0-255
- A whole number.
-
- clkfreq: 4689-250M (13184-375M for the BCM2711)
- The hardware clock frequency.
-
- connected:
- True if a connection was established, False otherwise.
-
- count:
- The number of bytes of data to be transferred.
-
- CS:
- The GPIO used for the slave select signal when bit banging SPI.
-
- data:
- Data to be transmitted, a series of bytes.
-
- delay: >=1
- The length of a pulse in microseconds.
-
- dutycycle: 0-range_
- A number between 0 and range_.
-
- The dutycycle sets the proportion of time on versus time off during each
- PWM cycle.
-
- Dutycycle @ On time
- 0 @ Off
- range_ * 0.25 @ 25% On
- range_ * 0.50 @ 50% On
- range_ * 0.75 @ 75% On
- range_ @ Fully On
-
- edge: 0-2
-
- . .
- EITHER_EDGE = 2
- FALLING_EDGE = 1
- RISING_EDGE = 0
- . .
-
- errnum: <0
-
- . .
- PI_BAD_USER_GPIO = -2
- PI_BAD_GPIO = -3
- PI_BAD_MODE = -4
- PI_BAD_LEVEL = -5
- PI_BAD_PUD = -6
- PI_BAD_PULSEWIDTH = -7
- PI_BAD_DUTYCYCLE = -8
- PI_BAD_WDOG_TIMEOUT = -15
- PI_BAD_DUTYRANGE = -21
- PI_NO_HANDLE = -24
- PI_BAD_HANDLE = -25
- PI_BAD_WAVE_BAUD = -35
- PI_TOO_MANY_PULSES = -36
- PI_TOO_MANY_CHARS = -37
- PI_NOT_SERIAL_GPIO = -38
- PI_NOT_PERMITTED = -41
- PI_SOME_PERMITTED = -42
- PI_BAD_WVSC_COMMND = -43
- PI_BAD_WVSM_COMMND = -44
- PI_BAD_WVSP_COMMND = -45
- PI_BAD_PULSELEN = -46
- PI_BAD_SCRIPT = -47
- PI_BAD_SCRIPT_ID = -48
- PI_BAD_SER_OFFSET = -49
- PI_GPIO_IN_USE = -50
- PI_BAD_SERIAL_COUNT = -51
- PI_BAD_PARAM_NUM = -52
- PI_DUP_TAG = -53
- PI_TOO_MANY_TAGS = -54
- PI_BAD_SCRIPT_CMD = -55
- PI_BAD_VAR_NUM = -56
- PI_NO_SCRIPT_ROOM = -57
- PI_NO_MEMORY = -58
- PI_SOCK_READ_FAILED = -59
- PI_SOCK_WRIT_FAILED = -60
- PI_TOO_MANY_PARAM = -61
- PI_SCRIPT_NOT_READY = -62
- PI_BAD_TAG = -63
- PI_BAD_MICS_DELAY = -64
- PI_BAD_MILS_DELAY = -65
- PI_BAD_WAVE_ID = -66
- PI_TOO_MANY_CBS = -67
- PI_TOO_MANY_OOL = -68
- PI_EMPTY_WAVEFORM = -69
- PI_NO_WAVEFORM_ID = -70
- PI_I2C_OPEN_FAILED = -71
- PI_SER_OPEN_FAILED = -72
- PI_SPI_OPEN_FAILED = -73
- PI_BAD_I2C_BUS = -74
- PI_BAD_I2C_ADDR = -75
- PI_BAD_SPI_CHANNEL = -76
- PI_BAD_FLAGS = -77
- PI_BAD_SPI_SPEED = -78
- PI_BAD_SER_DEVICE = -79
- PI_BAD_SER_SPEED = -80
- PI_BAD_PARAM = -81
- PI_I2C_WRITE_FAILED = -82
- PI_I2C_READ_FAILED = -83
- PI_BAD_SPI_COUNT = -84
- PI_SER_WRITE_FAILED = -85
- PI_SER_READ_FAILED = -86
- PI_SER_READ_NO_DATA = -87
- PI_UNKNOWN_COMMAND = -88
- PI_SPI_XFER_FAILED = -89
- PI_NO_AUX_SPI = -91
- PI_NOT_PWM_GPIO = -92
- PI_NOT_SERVO_GPIO = -93
- PI_NOT_HCLK_GPIO = -94
- PI_NOT_HPWM_GPIO = -95
- PI_BAD_HPWM_FREQ = -96
- PI_BAD_HPWM_DUTY = -97
- PI_BAD_HCLK_FREQ = -98
- PI_BAD_HCLK_PASS = -99
- PI_HPWM_ILLEGAL = -100
- PI_BAD_DATABITS = -101
- PI_BAD_STOPBITS = -102
- PI_MSG_TOOBIG = -103
- PI_BAD_MALLOC_MODE = -104
- PI_BAD_SMBUS_CMD = -107
- PI_NOT_I2C_GPIO = -108
- PI_BAD_I2C_WLEN = -109
- PI_BAD_I2C_RLEN = -110
- PI_BAD_I2C_CMD = -111
- PI_BAD_I2C_BAUD = -112
- PI_CHAIN_LOOP_CNT = -113
- PI_BAD_CHAIN_LOOP = -114
- PI_CHAIN_COUNTER = -115
- PI_BAD_CHAIN_CMD = -116
- PI_BAD_CHAIN_DELAY = -117
- PI_CHAIN_NESTING = -118
- PI_CHAIN_TOO_BIG = -119
- PI_DEPRECATED = -120
- PI_BAD_SER_INVERT = -121
- PI_BAD_FOREVER = -124
- PI_BAD_FILTER = -125
- PI_BAD_PAD = -126
- PI_BAD_STRENGTH = -127
- PI_FIL_OPEN_FAILED = -128
- PI_BAD_FILE_MODE = -129
- PI_BAD_FILE_FLAG = -130
- PI_BAD_FILE_READ = -131
- PI_BAD_FILE_WRITE = -132
- PI_FILE_NOT_ROPEN = -133
- PI_FILE_NOT_WOPEN = -134
- PI_BAD_FILE_SEEK = -135
- PI_NO_FILE_MATCH = -136
- PI_NO_FILE_ACCESS = -137
- PI_FILE_IS_A_DIR = -138
- PI_BAD_SHELL_STATUS = -139
- PI_BAD_SCRIPT_NAME = -140
- PI_BAD_SPI_BAUD = -141
- PI_NOT_SPI_GPIO = -142
- PI_BAD_EVENT_ID = -143
- PI_CMD_INTERRUPTED = -144
- PI_NOT_ON_BCM2711 = -145
- PI_ONLY_ON_BCM2711 = -146
- . .
-
- event:0-31
- An event is a signal used to inform one or more consumers
- to start an action.
-
- file_mode:
- The mode may have the following values
-
- . .
- FILE_READ 1
- FILE_WRITE 2
- FILE_RW 3
- . .
-
- The following values can be or'd into the file open mode
-
- . .
- FILE_APPEND 4
- FILE_CREATE 8
- FILE_TRUNC 16
- . .
-
- file_name:
- A full file path. To be accessible the path must match
- an entry in /opt/pigpio/access.
-
- fpattern:
- A file path which may contain wildcards. To be accessible the path
- must match an entry in /opt/pigpio/access.
-
- frequency: 0-40000
- Defines the frequency to be used for PWM on a GPIO.
- The closest permitted frequency will be used.
-
- func:
- A user supplied callback function.
-
- gpio: 0-53
- A Broadcom numbered GPIO. All the user GPIO are in the range 0-31.
-
- There are 54 General Purpose Input Outputs (GPIO) named GPIO0
- through GPIO53.
-
- They are split into two banks. Bank 1 consists of GPIO0
- through GPIO31. Bank 2 consists of GPIO32 through GPIO53.
-
- All the GPIO which are safe for the user to read and write are in
- bank 1. Not all GPIO in bank 1 are safe though. Type 1 boards
- have 17 safe GPIO. Type 2 boards have 21. Type 3 boards have 26.
-
- See [*get_hardware_revision*].
-
- The user GPIO are marked with an X in the following table
-
- . .
- 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
- Type 1 X X - - X - - X X X X X - - X X
- Type 2 - - X X X - - X X X X X - - X X
- Type 3 X X X X X X X X X X X X X X
-
- 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
- Type 1 - X X - - X X X X X - - - - - -
- Type 2 - X X - - - X X X X - X X X X X
- Type 3 X X X X X X X X X X X X - - - -
- . .
-
- gpio_off:
- A mask used to select GPIO to be operated on. See [*bits*].
-
- This mask selects the GPIO to be switched off at the start
- of a pulse.
-
- gpio_on:
- A mask used to select GPIO to be operated on. See [*bits*].
-
- This mask selects the GPIO to be switched on at the start
- of a pulse.
-
- handle: >=0
- A number referencing an object opened by one of the following
-
- [*file_open*]
- [*i2c_open*]
- [*notify_open*]
- [*serial_open*]
- [*spi_open*]
-
- host:
- The name or IP address of the Pi running the pigpio daemon.
-
- i2c_address: 0-0x7F
- The address of a device on the I2C bus.
-
- i2c_bus: >=0
- An I2C bus number.
-
- i2c_flags: 0
- No I2C flags are currently defined.
-
- invert: 0-1
- A flag used to set normal or inverted bit bang serial data
- level logic.
-
- level: 0-1 (2)
-
- . .
- CLEAR = 0
- HIGH = 1
- LOW = 0
- OFF = 0
- ON = 1
- SET = 1
- TIMEOUT = 2 # only returned for a watchdog timeout
- . .
-
- MISO:
- The GPIO used for the MISO signal when bit banging SPI.
-
- mode:
-
- 1.The operational mode of a GPIO, normally INPUT or OUTPUT.
-
- . .
- ALT0 = 4
- ALT1 = 5
- ALT2 = 6
- ALT3 = 7
- ALT4 = 3
- ALT5 = 2
- INPUT = 0
- OUTPUT = 1
- . .
-
- 2. The mode of waveform transmission.
-
- . .
- WAVE_MODE_ONE_SHOT = 0
- WAVE_MODE_REPEAT = 1
- WAVE_MODE_ONE_SHOT_SYNC = 2
- WAVE_MODE_REPEAT_SYNC = 3
- . .
-
- MOSI:
- The GPIO used for the MOSI signal when bit banging SPI.
-
- offset: >=0
- The offset wave data starts from the beginning of the waveform
- being currently defined.
-
- pad: 0-2
- A set of GPIO which share common drivers.
-
- Pad @ GPIO
- 0 @ 0-27
- 1 @ 28-45
- 2 @ 46-53
-
- pad_strength: 1-16
- The mA which may be drawn from each GPIO whilst still guaranteeing the
- high and low levels.
-
- params: 32 bit number
- When scripts are started they can receive up to 10 parameters
- to define their operation.
-
- percent:: 0-100
- The size of waveform as percentage of maximum available.
-
- port:
- The port used by the pigpio daemon, defaults to 8888.
-
- pstring:
- The string to be passed to a [*shell*] script to be executed.
-
- pud: 0-2
- . .
- PUD_DOWN = 1
- PUD_OFF = 0
- PUD_UP = 2
- . .
-
- pulse_len: 1-100
- The length of the trigger pulse in microseconds.
-
- pulses:
- A list of class pulse objects defining the characteristics of a
- waveform.
-
- pulsewidth:
- The servo pulsewidth in microseconds. 0 switches pulses off.
-
- PWMduty: 0-1000000 (1M)
- The hardware PWM dutycycle.
-
- PWMfreq: 1-125M (1-187.5M for the BCM2711)
- The hardware PWM frequency.
-
- range_: 25-40000
- Defines the limits for the [*dutycycle*] parameter.
-
- range_ defaults to 255.
-
- reg: 0-255
- An I2C device register. The usable registers depend on the
- actual device.
-
- retMax: >=0
- The maximum number of bytes a user customised function
- should return, default 8192.
-
- SCL:
- The user GPIO to use for the clock when bit banging I2C.
-
- SCLK::
- The GPIO used for the SCLK signal when bit banging SPI.
-
- script:
- The text of a script to store on the pigpio daemon.
-
- script_id: >=0
- A number referencing a script created by [*store_script*].
-
- SDA:
- The user GPIO to use for data when bit banging I2C.
-
- seek_from: 0-2
- Direction to seek for [*file_seek*].
-
- . .
- FROM_START=0
- FROM_CURRENT=1
- FROM_END=2
- . .
-
- seek_offset:
- The number of bytes to move forward (positive) or backwards
- (negative) from the seek position (start, current, or end of file).
-
- ser_flags: 32 bit
- No serial flags are currently defined.
-
- serial_*:
- One of the serial_ functions.
-
- shellscr:
- The name of a shell script. The script must exist
- in /opt/pigpio/cgi and must be executable.
-
- show_errors:
- Controls the display of pigpio daemon connection failures.
- The default of True prints the probable failure reasons to
- standard output.
-
- spi_channel: 0-2
- A SPI channel.
-
- spi_flags: 32 bit
- See [*spi_open*].
-
- steady: 0-300000
-
- The number of microseconds level changes must be stable for
- before reporting the level changed ([*set_glitch_filter*])
- or triggering the active part of a noise filter
- ([*set_noise_filter*]).
-
- t1:
- A tick (earlier).
-
- t2:
- A tick (later).
-
- tty:
- A Pi serial tty device, e.g. /dev/ttyAMA0, /dev/ttyUSB0
-
- uint32:
- An unsigned 32 bit number.
-
- user_gpio: 0-31
- A Broadcom numbered GPIO.
-
- All the user GPIO are in the range 0-31.
-
- Not all the GPIO within this range are usable, some are reserved
- for system use.
-
- See [*gpio*].
-
- wait_timeout: 0.0 -
- The number of seconds to wait in [*wait_for_edge*] before timing out.
-
- wave_add_*:
- One of the following
-
- [*wave_add_new*]
- [*wave_add_generic*]
- [*wave_add_serial*]
-
- wave_id: >=0
- A number referencing a wave created by [*wave_create*].
-
- wave_send_*:
- One of the following
-
- [*wave_send_once*]
- [*wave_send_repeat*]
-
- wdog_timeout: 0-60000
- Defines a GPIO watchdog timeout in milliseconds. If no level
- change is detected on the GPIO for timeout millisecond a watchdog
- timeout report is issued (with level TIMEOUT).
-
- word_val: 0-65535
- A whole number.
-
-DATA
- ALT0 = 4
- ALT1 = 5
- ALT2 = 6
- ALT3 = 7
- ALT4 = 3
- ALT5 = 2
- CLEAR = 0
- EITHER_EDGE = 2
- EVENT_BSC = 31
- FALLING_EDGE = 1
- FILE_APPEND = 4
- FILE_CREATE = 8
- FILE_READ = 1
- FILE_RW = 3
- FILE_TRUNC = 16
- FILE_WRITE = 2
- FROM_CURRENT = 1
- FROM_END = 2
- FROM_START = 0
- HIGH = 1
- INPUT = 0
- LOW = 0
- NO_TX_WAVE = 9999
- NTFY_FLAGS_ALIVE = 64
- NTFY_FLAGS_EVENT = 128
- NTFY_FLAGS_GPIO = 31
- NTFY_FLAGS_WDOG = 32
- OFF = 0
- ON = 1
- OUTPUT = 1
- PI_BAD_CHAIN_CMD = -116
- PI_BAD_CHAIN_DELAY = -117
- PI_BAD_CHAIN_LOOP = -114
- PI_BAD_DATABITS = -101
- PI_BAD_DUTYCYCLE = -8
- PI_BAD_DUTYRANGE = -21
- PI_BAD_EVENT_ID = -143
- PI_BAD_FILE_FLAG = -130
- PI_BAD_FILE_MODE = -129
- PI_BAD_FILE_READ = -131
- PI_BAD_FILE_SEEK = -135
- PI_BAD_FILE_WRITE = -132
- PI_BAD_FILTER = -125
- PI_BAD_FLAGS = -77
- PI_BAD_FOREVER = -124
- PI_BAD_GPIO = -3
- PI_BAD_HANDLE = -25
- PI_BAD_HCLK_FREQ = -98
- PI_BAD_HCLK_PASS = -99
- PI_BAD_HPWM_DUTY = -97
- PI_BAD_HPWM_FREQ = -96
- PI_BAD_I2C_ADDR = -75
- PI_BAD_I2C_BAUD = -112
- PI_BAD_I2C_BUS = -74
- PI_BAD_I2C_CMD = -111
- PI_BAD_I2C_RLEN = -110
- PI_BAD_I2C_WLEN = -109
- PI_BAD_LEVEL = -5
- PI_BAD_MALLOC_MODE = -104
- PI_BAD_MICS_DELAY = -64
- PI_BAD_MILS_DELAY = -65
- PI_BAD_MODE = -4
- PI_BAD_PAD = -126
- PI_BAD_PARAM = -81
- PI_BAD_PARAM_NUM = -52
- PI_BAD_PUD = -6
- PI_BAD_PULSELEN = -46
- PI_BAD_PULSEWIDTH = -7
- PI_BAD_SCRIPT = -47
- PI_BAD_SCRIPT_CMD = -55
- PI_BAD_SCRIPT_ID = -48
- PI_BAD_SCRIPT_NAME = -140
- PI_BAD_SERIAL_COUNT = -51
- PI_BAD_SER_DEVICE = -79
- PI_BAD_SER_INVERT = -121
- PI_BAD_SER_OFFSET = -49
- PI_BAD_SER_SPEED = -80
- PI_BAD_SHELL_STATUS = -139
- PI_BAD_SMBUS_CMD = -107
- PI_BAD_SPI_BAUD = -141
- PI_BAD_SPI_CHANNEL = -76
- PI_BAD_SPI_COUNT = -84
- PI_BAD_SPI_SPEED = -78
- PI_BAD_STOPBITS = -102
- PI_BAD_STRENGTH = -127
- PI_BAD_TAG = -63
- PI_BAD_USER_GPIO = -2
- PI_BAD_VAR_NUM = -56
- PI_BAD_WAVE_BAUD = -35
- PI_BAD_WAVE_ID = -66
- PI_BAD_WDOG_TIMEOUT = -15
- PI_BAD_WVSC_COMMND = -43
- PI_BAD_WVSM_COMMND = -44
- PI_BAD_WVSP_COMMND = -45
- PI_CHAIN_COUNTER = -115
- PI_CHAIN_LOOP_CNT = -113
- PI_CHAIN_NESTING = -118
- PI_CHAIN_TOO_BIG = -119
- PI_CMD_INTERRUPTED = -144
- PI_DEPRECATED = -120
- PI_DUP_TAG = -53
- PI_EMPTY_WAVEFORM = -69
- PI_FILE_IS_A_DIR = -138
- PI_FILE_NOT_ROPEN = -133
- PI_FILE_NOT_WOPEN = -134
- PI_FIL_OPEN_FAILED = -128
- PI_GPIO_IN_USE = -50
- PI_HPWM_ILLEGAL = -100
- PI_I2C_OPEN_FAILED = -71
- PI_I2C_READ_FAILED = -83
- PI_I2C_WRITE_FAILED = -82
- PI_MSG_TOOBIG = -103
- PI_NOT_HCLK_GPIO = -94
- PI_NOT_HPWM_GPIO = -95
- PI_NOT_I2C_GPIO = -108
- PI_NOT_ON_BCM2711 = -145
- PI_NOT_PERMITTED = -41
- PI_NOT_PWM_GPIO = -92
- PI_NOT_SERIAL_GPIO = -38
- PI_NOT_SERVO_GPIO = -93
- PI_NOT_SPI_GPIO = -142
- PI_NO_AUX_SPI = -91
- PI_NO_FILE_ACCESS = -137
- PI_NO_FILE_MATCH = -136
- PI_NO_HANDLE = -24
- PI_NO_MEMORY = -58
- PI_NO_SCRIPT_ROOM = -57
- PI_NO_WAVEFORM_ID = -70
- PI_ONLY_ON_BCM2711 = -146
- PI_SCRIPT_FAILED = 4
- PI_SCRIPT_HALTED = 1
- PI_SCRIPT_INITING = 0
- PI_SCRIPT_NOT_READY = -62
- PI_SCRIPT_RUNNING = 2
- PI_SCRIPT_WAITING = 3
- PI_SER_OPEN_FAILED = -72
- PI_SER_READ_FAILED = -86
- PI_SER_READ_NO_DATA = -87
- PI_SER_WRITE_FAILED = -85
- PI_SOCK_READ_FAILED = -59
- PI_SOCK_WRIT_FAILED = -60
- PI_SOME_PERMITTED = -42
- PI_SPI_OPEN_FAILED = -73
- PI_SPI_XFER_FAILED = -89
- PI_TOO_MANY_CBS = -67
- PI_TOO_MANY_CHARS = -37
- PI_TOO_MANY_OOL = -68
- PI_TOO_MANY_PARAM = -61
- PI_TOO_MANY_PULSES = -36
- PI_TOO_MANY_TAGS = -54
- PI_UNKNOWN_COMMAND = -88
- PUD_DOWN = 1
- PUD_OFF = 0
- PUD_UP = 2
- RISING_EDGE = 0
- SET = 1
- SPI_CPHA = 1
- SPI_CPOL = 2
- SPI_CS_HIGH_ACTIVE = 4
- SPI_MODE_0 = 0
- SPI_MODE_1 = 1
- SPI_MODE_2 = 2
- SPI_MODE_3 = 3
- SPI_RX_LSBFIRST = 32768
- SPI_TX_LSBFIRST = 16384
- TIMEOUT = 2
- VERSION = '1.46'
- WAVE_MODE_ONE_SHOT = 0
- WAVE_MODE_ONE_SHOT_SYNC = 2
- WAVE_MODE_REPEAT = 1
- WAVE_MODE_REPEAT_SYNC = 3
- WAVE_NOT_FOUND = 9998
- exceptions = True
-
-
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
-