mirror of https://github.com/joan2937/pigpio
V53
This commit is contained in:
parent
09adafce0c
commit
3b56709a0e
|
@ -26,7 +26,7 @@ For more information, please refer to <http://unlicense.org/>
|
|||
*/
|
||||
|
||||
/*
|
||||
This version is for pigpio version 48+
|
||||
This version is for pigpio version 53+
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -426,7 +426,7 @@ static errInfo_t errInfo[]=
|
|||
{PI_SOCK_READ_FAILED , "socket read failed"},
|
||||
{PI_SOCK_WRIT_FAILED , "socket write failed"},
|
||||
{PI_TOO_MANY_PARAM , "too many script parameters (> 10)"},
|
||||
{PI_NOT_HALTED , "script already running or failed"},
|
||||
{PI_SCRIPT_NOT_READY , "script initialising"},
|
||||
{PI_BAD_TAG , "script has unresolved tag"},
|
||||
{PI_BAD_MICS_DELAY , "bad MICS delay (too large)"},
|
||||
{PI_BAD_MILS_DELAY , "bad MILS delay (too large)"},
|
||||
|
|
|
@ -26,7 +26,7 @@ For more information, please refer to <http://unlicense.org/>
|
|||
*/
|
||||
|
||||
/*
|
||||
This version is for pigpio version 23+
|
||||
This version is for pigpio version 53+
|
||||
*/
|
||||
|
||||
#ifndef COMMAND_H
|
||||
|
|
56
pigpio.3
56
pigpio.3
|
@ -112,7 +112,8 @@ This use was inspired by Richard Hirst's servoblaster kernel module.
|
|||
.br
|
||||
|
||||
.br
|
||||
https://github.com/richardghirst/PiBits/tree/master/ServoBlaster
|
||||
See \fBhttps://github.com/richardghirst/PiBits/tree/master/ServoBlaster\fP
|
||||
|
||||
.br
|
||||
|
||||
.br
|
||||
|
@ -450,7 +451,7 @@ Sets the GPIO level, on or off.
|
|||
.EX
|
||||
gpio: 0-53
|
||||
.br
|
||||
level: 0,1
|
||||
level: 0-1
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -749,8 +750,8 @@ PI_BAD_USER_GPIO.
|
|||
.br
|
||||
|
||||
.br
|
||||
The selectable frequencies depend upon the sample rate which
|
||||
may be 1, 2, 4, 5, 8, or 10 microseconds (default 5).
|
||||
If PWM is currently active on the GPIO it will be
|
||||
switched off and then back on at the new frequency.
|
||||
|
||||
.br
|
||||
|
||||
|
@ -761,8 +762,8 @@ frequencies.
|
|||
.br
|
||||
|
||||
.br
|
||||
If PWM is currently active on the GPIO it will be
|
||||
switched off and then back on at the new frequency.
|
||||
The selectable frequencies depend upon the sample rate which
|
||||
may be 1, 2, 4, 5, 8, or 10 microseconds (default 5).
|
||||
|
||||
.br
|
||||
|
||||
|
@ -1016,7 +1017,7 @@ user_gpio: 0-31
|
|||
.br
|
||||
|
||||
.br
|
||||
Returns , 0 (off), 500 (most anti-clockwise) to 2500 (most clockwise)
|
||||
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"
|
||||
|
@ -1138,7 +1139,7 @@ void aFunction(int gpio, int level, uint32_t tick)
|
|||
.br
|
||||
|
||||
.br
|
||||
gpioSetAlertFunc(4F, aFunction);
|
||||
gpioSetAlertFunc(4, aFunction);
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -1773,9 +1774,9 @@ data_bits: 1-32
|
|||
.br
|
||||
stop_bits: 2-8
|
||||
.br
|
||||
offset: 0-
|
||||
offset: >=0
|
||||
.br
|
||||
numBytes: 1-
|
||||
numBytes: >=1
|
||||
.br
|
||||
str: an array of chars (which may contain nulls)
|
||||
.br
|
||||
|
@ -2371,7 +2372,7 @@ normal logic. Default is PI_BB_SER_NORMAL.
|
|||
.EX
|
||||
user_gpio: 0-31
|
||||
.br
|
||||
invert: 0-1
|
||||
invert: 0-1
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -2402,7 +2403,7 @@ user_gpio: 0-31, previously opened with \fBgpioSerialReadOpen\fP
|
|||
.br
|
||||
buf: an array to receive the read bytes
|
||||
.br
|
||||
bufSize: 0-
|
||||
bufSize: >=0
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -2456,9 +2457,9 @@ This returns a handle for the device at the address on the I2C bus.
|
|||
.br
|
||||
|
||||
.EX
|
||||
i2cBus: 0-1
|
||||
i2cBus: >=0
|
||||
.br
|
||||
i2cAddr: 0x00-0x7F
|
||||
i2cAddr: 0-0x7F
|
||||
.br
|
||||
i2cFlags: 0
|
||||
.br
|
||||
|
@ -2472,6 +2473,12 @@ 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
|
||||
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.
|
||||
|
@ -4386,6 +4393,11 @@ This function stores a null terminated script for later execution.
|
|||
|
||||
.br
|
||||
|
||||
.br
|
||||
See \fBhttp://abyz.co.uk/rpi/pigpio/pigs.html#Scripts\fP for details.
|
||||
|
||||
.br
|
||||
|
||||
.br
|
||||
|
||||
.EX
|
||||
|
@ -6266,7 +6278,7 @@ A function.
|
|||
|
||||
.br
|
||||
|
||||
.IP "\fBfrequency\fP: 0-" 0
|
||||
.IP "\fBfrequency\fP: >=0" 0
|
||||
|
||||
.br
|
||||
|
||||
|
@ -6580,7 +6592,7 @@ One of
|
|||
|
||||
.br
|
||||
|
||||
.IP "\fBhandle\fP: 0-" 0
|
||||
.IP "\fBhandle\fP: >=0" 0
|
||||
|
||||
.br
|
||||
|
||||
|
@ -6602,19 +6614,19 @@ A number referencing an object opened by one of
|
|||
|
||||
.br
|
||||
|
||||
.IP "\fBi2cAddr\fP" 0
|
||||
.IP "\fBi2cAddr\fP: 0-0x7F" 0
|
||||
The address of a device on the I2C bus.
|
||||
|
||||
.br
|
||||
|
||||
.br
|
||||
|
||||
.IP "\fBi2cBus\fP: 0-1" 0
|
||||
.IP "\fBi2cBus\fP: >=0" 0
|
||||
|
||||
.br
|
||||
|
||||
.br
|
||||
An I2C bus, 0 or 1.
|
||||
An I2C bus number.
|
||||
|
||||
.br
|
||||
|
||||
|
@ -8097,7 +8109,9 @@ A 16-bit word value.
|
|||
.br
|
||||
#define PI_TOO_MANY_PARAM -61 // too many script parameters (> 10)
|
||||
.br
|
||||
#define PI_NOT_HALTED -62 // script already running or failed
|
||||
#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
|
||||
|
@ -8286,7 +8300,7 @@ A 16-bit word value.
|
|||
.br
|
||||
|
||||
.br
|
||||
#define PI_DEFAULT_CFG_INTERNALS 0
|
||||
#define PI_DEFAULT_CFG_INTERNALS 0
|
||||
.br
|
||||
|
||||
.br
|
||||
|
|
11
pigpio.c
11
pigpio.c
|
@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE.
|
|||
For more information, please refer to <http://unlicense.org/>
|
||||
*/
|
||||
|
||||
/* pigpio version 52 */
|
||||
/* pigpio version 53 */
|
||||
|
||||
/* include ------------------------------------------------------- */
|
||||
|
||||
|
@ -3645,9 +3645,6 @@ int i2cOpen(unsigned i2cBus, unsigned i2cAddr, unsigned i2cFlags)
|
|||
|
||||
CHECK_INITED;
|
||||
|
||||
if (i2cBus >= PI_NUM_I2C_BUS)
|
||||
SOFT_ERROR(PI_BAD_I2C_BUS, "bad I2C bus (%d)", i2cBus);
|
||||
|
||||
if (i2cAddr > PI_MAX_I2C_ADDR)
|
||||
SOFT_ERROR(PI_BAD_I2C_ADDR, "bad I2C address (%d)", i2cAddr);
|
||||
|
||||
|
@ -3683,7 +3680,7 @@ int i2cOpen(unsigned i2cBus, unsigned i2cAddr, unsigned i2cFlags)
|
|||
if ((fd = open(dev, O_RDWR)) < 0)
|
||||
{
|
||||
i2cInfo[slot].state = PI_I2C_CLOSED;
|
||||
return PI_I2C_OPEN_FAILED;
|
||||
return PI_BAD_I2C_BUS;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11026,7 +11023,7 @@ int gpioRunScript(unsigned script_id, unsigned numParam, uint32_t *param)
|
|||
{
|
||||
pthread_mutex_lock(&gpioScript[script_id].pthMutex);
|
||||
|
||||
if (gpioScript[script_id].run_state == PI_SCRIPT_HALTED)
|
||||
if (gpioScript[script_id].run_state != PI_SCRIPT_INITING)
|
||||
{
|
||||
if ((numParam > 0) && (param != 0))
|
||||
{
|
||||
|
@ -11040,7 +11037,7 @@ int gpioRunScript(unsigned script_id, unsigned numParam, uint32_t *param)
|
|||
}
|
||||
else
|
||||
{
|
||||
status = PI_NOT_HALTED;
|
||||
status = PI_SCRIPT_NOT_READY;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&gpioScript[script_id].pthMutex);
|
||||
|
|
51
pigpio.h
51
pigpio.h
|
@ -31,7 +31,7 @@ For more information, please refer to <http://unlicense.org/>
|
|||
#include <stdint.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#define PIGPIO_VERSION 52
|
||||
#define PIGPIO_VERSION 53
|
||||
|
||||
/*TEXT
|
||||
|
||||
|
@ -73,7 +73,7 @@ The PWM and servo pulses are timed using the DMA and PWM peripherals.
|
|||
|
||||
This use was inspired by Richard Hirst's servoblaster kernel module.
|
||||
|
||||
[https://github.com/richardghirst/PiBits/tree/master/ServoBlaster]
|
||||
See [[https://github.com/richardghirst/PiBits/tree/master/ServoBlaster]]
|
||||
|
||||
*Usage*
|
||||
|
||||
|
@ -623,7 +623,6 @@ typedef void *(gpioThreadFunc_t) (void *);
|
|||
#define PI_SPI_SLOTS 16
|
||||
#define PI_SER_SLOTS 8
|
||||
|
||||
#define PI_NUM_I2C_BUS 2
|
||||
#define PI_MAX_I2C_ADDR 0x7F
|
||||
|
||||
#define PI_NUM_AUX_SPI_CHANNEL 3
|
||||
|
@ -913,7 +912,7 @@ Sets the GPIO level, on or off.
|
|||
|
||||
. .
|
||||
gpio: 0-53
|
||||
level: 0,1
|
||||
level: 0-1
|
||||
. .
|
||||
|
||||
Returns 0 if OK, otherwise PI_BAD_GPIO or PI_BAD_LEVEL.
|
||||
|
@ -1073,14 +1072,14 @@ frequency: >=0
|
|||
Returns the numerically closest frequency if OK, otherwise
|
||||
PI_BAD_USER_GPIO.
|
||||
|
||||
The selectable frequencies depend upon the sample rate which
|
||||
may be 1, 2, 4, 5, 8, or 10 microseconds (default 5).
|
||||
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.
|
||||
|
||||
If PWM is currently active on the GPIO it will be
|
||||
switched off and then back on at the new frequency.
|
||||
The selectable frequencies depend upon the sample rate which
|
||||
may be 1, 2, 4, 5, 8, or 10 microseconds (default 5).
|
||||
|
||||
The frequencies for each sample rate are:
|
||||
|
||||
|
@ -1210,7 +1209,7 @@ Returns the servo pulsewidth setting for the GPIO.
|
|||
user_gpio: 0-31
|
||||
. .
|
||||
|
||||
Returns , 0 (off), 500 (most anti-clockwise) to 2500 (most clockwise)
|
||||
Returns 0 (off), 500 (most anti-clockwise) to 2500 (most clockwise)
|
||||
if OK, otherwise PI_BAD_USER_GPIO or PI_NOT_SERVO_GPIO.
|
||||
D*/
|
||||
|
||||
|
@ -1271,7 +1270,7 @@ void aFunction(int gpio, int level, uint32_t tick)
|
|||
|
||||
// call aFunction whenever GPIO 4 changes state
|
||||
|
||||
gpioSetAlertFunc(4F, aFunction);
|
||||
gpioSetAlertFunc(4, aFunction);
|
||||
...
|
||||
D*/
|
||||
|
||||
|
@ -1645,8 +1644,8 @@ user_gpio: 0-31
|
|||
baud: 50-1000000
|
||||
data_bits: 1-32
|
||||
stop_bits: 2-8
|
||||
offset: 0-
|
||||
numBytes: 1-
|
||||
offset: >=0
|
||||
numBytes: >=1
|
||||
str: an array of chars (which may contain nulls)
|
||||
. .
|
||||
|
||||
|
@ -2017,7 +2016,7 @@ normal logic. Default is PI_BB_SER_NORMAL.
|
|||
|
||||
. .
|
||||
user_gpio: 0-31
|
||||
invert: 0-1
|
||||
invert: 0-1
|
||||
. .
|
||||
|
||||
Returns 0 if OK, otherwise PI_BAD_USER_GPIO, PI_GPIO_IN_USE,
|
||||
|
@ -2037,7 +2036,7 @@ bit bang serial cyclic buffer to the buffer starting at buf.
|
|||
. .
|
||||
user_gpio: 0-31, previously opened with [*gpioSerialReadOpen*]
|
||||
buf: an array to receive the read bytes
|
||||
bufSize: 0-
|
||||
bufSize: >=0
|
||||
. .
|
||||
|
||||
Returns the number of bytes copied if OK, otherwise PI_BAD_USER_GPIO
|
||||
|
@ -2070,13 +2069,16 @@ int i2cOpen(unsigned i2cBus, unsigned i2cAddr, unsigned i2cFlags);
|
|||
This returns a handle for the device at the address on the I2C bus.
|
||||
|
||||
. .
|
||||
i2cBus: 0-1
|
||||
i2cAddr: 0x00-0x7F
|
||||
i2cBus: >=0
|
||||
i2cAddr: 0-0x7F
|
||||
i2cFlags: 0
|
||||
. .
|
||||
|
||||
No flags are currently defined. This parameter should be set to zero.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
|
@ -3189,6 +3191,8 @@ int gpioStoreScript(char *script);
|
|||
/*D
|
||||
This function stores a null terminated script for later execution.
|
||||
|
||||
See [[http://abyz.co.uk/rpi/pigpio/pigs.html#Scripts]] for details.
|
||||
|
||||
. .
|
||||
script: the text of the script
|
||||
. .
|
||||
|
@ -4260,7 +4264,7 @@ f::
|
|||
|
||||
A function.
|
||||
|
||||
frequency::0-
|
||||
frequency::>=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
|
||||
|
@ -4397,7 +4401,7 @@ One of
|
|||
[*gpioWaveAddGeneric*]
|
||||
[*gpioWaveAddSerial*]
|
||||
|
||||
handle::0-
|
||||
handle::>=0
|
||||
|
||||
A number referencing an object opened by one of
|
||||
|
||||
|
@ -4406,12 +4410,12 @@ A number referencing an object opened by one of
|
|||
[*serOpen*]
|
||||
[*spiOpen*]
|
||||
|
||||
i2cAddr::
|
||||
i2cAddr:: 0-0x7F
|
||||
The address of a device on the I2C bus.
|
||||
|
||||
i2cBus::0-1
|
||||
i2cBus::>=0
|
||||
|
||||
An I2C bus, 0 or 1.
|
||||
An I2C bus number.
|
||||
|
||||
i2cFlags::0
|
||||
|
||||
|
@ -5119,7 +5123,8 @@ after this command is issued.
|
|||
#define PI_SOCK_READ_FAILED -59 // socket read failed
|
||||
#define PI_SOCK_WRIT_FAILED -60 // socket write failed
|
||||
#define PI_TOO_MANY_PARAM -61 // too many script parameters (> 10)
|
||||
#define PI_NOT_HALTED -62 // script already running or failed
|
||||
#define PI_NOT_HALTED -62 // DEPRECATED
|
||||
#define PI_SCRIPT_NOT_READY -62 // script initialising
|
||||
#define PI_BAD_TAG -63 // script has unresolved tag
|
||||
#define PI_BAD_MICS_DELAY -64 // bad MICS delay (too large)
|
||||
#define PI_BAD_MILS_DELAY -65 // bad MILS delay (too large)
|
||||
|
@ -5214,7 +5219,7 @@ after this command is issued.
|
|||
#define PI_DEFAULT_UPDATE_MASK_COMPUTE 0x00FFFFFFFFFFFFLL
|
||||
#define PI_DEFAULT_MEM_ALLOC_MODE PI_MEM_ALLOC_AUTO
|
||||
|
||||
#define PI_DEFAULT_CFG_INTERNALS 0
|
||||
#define PI_DEFAULT_CFG_INTERNALS 0
|
||||
|
||||
/*DEF_E*/
|
||||
|
||||
|
|
98
pigpio.py
98
pigpio.py
|
@ -176,7 +176,7 @@ 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_delete Deletes one or more waveforms
|
||||
wave_delete Deletes a waveform
|
||||
|
||||
wave_send_once Transmits a waveform once
|
||||
wave_send_repeat Transmits a waveform repeatedly
|
||||
|
@ -270,7 +270,7 @@ import threading
|
|||
import os
|
||||
import atexit
|
||||
|
||||
VERSION = "1.30"
|
||||
VERSION = "1.31"
|
||||
|
||||
exceptions = True
|
||||
|
||||
|
@ -524,7 +524,7 @@ PI_NO_MEMORY =-58
|
|||
PI_SOCK_READ_FAILED =-59
|
||||
PI_SOCK_WRIT_FAILED =-60
|
||||
PI_TOO_MANY_PARAM =-61
|
||||
PI_NOT_HALTED =-62
|
||||
PI_SCRIPT_NOT_READY =-62
|
||||
PI_BAD_TAG =-63
|
||||
PI_BAD_MICS_DELAY =-64
|
||||
PI_BAD_MILS_DELAY =-65
|
||||
|
@ -652,7 +652,7 @@ _errors=[
|
|||
[PI_SOCK_READ_FAILED , "socket read failed"],
|
||||
[PI_SOCK_WRIT_FAILED , "socket write failed"],
|
||||
[PI_TOO_MANY_PARAM , "too many script parameters (> 10)"],
|
||||
[PI_NOT_HALTED , "script already running or failed"],
|
||||
[PI_SCRIPT_NOT_READY , "script initialising"],
|
||||
[PI_BAD_TAG , "script has unresolved tag"],
|
||||
[PI_BAD_MICS_DELAY , "bad MICS delay (too large)"],
|
||||
[PI_BAD_MILS_DELAY , "bad MILS delay (too large)"],
|
||||
|
@ -1247,7 +1247,43 @@ class pi():
|
|||
user_gpio:= 0-31.
|
||||
frequency:= >=0 Hz
|
||||
|
||||
Returns the frequency actually set.
|
||||
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)
|
||||
|
@ -2256,8 +2292,8 @@ class pi():
|
|||
"""
|
||||
Returns a handle (>=0) for the device at the I2C bus address.
|
||||
|
||||
i2c_bus:= 0-1.
|
||||
i2c_address:= 0x00-0x7F.
|
||||
i2c_bus:= >=0.
|
||||
i2c_address:= 0-0x7F.
|
||||
i2c_flags:= 0, no flags are currently defined.
|
||||
|
||||
Normally you would only use the [*i2c_**] functions if
|
||||
|
@ -2265,6 +2301,10 @@ class pi():
|
|||
you will always run on the local Pi use the standard SMBus
|
||||
module instead.
|
||||
|
||||
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.
|
||||
|
||||
For the SMBus commands the low level transactions are shown
|
||||
at the end of the function description. The following
|
||||
abbreviations are used.
|
||||
|
@ -3399,6 +3439,9 @@ class pi():
|
|||
"""
|
||||
Store a script for later execution.
|
||||
|
||||
See [[http://abyz.co.uk/rpi/pigpio/pigs.html#Scripts]] for
|
||||
details.
|
||||
|
||||
script:= the script text as a series of bytes.
|
||||
|
||||
Returns a >=0 script id if OK.
|
||||
|
@ -3595,7 +3638,7 @@ class pi():
|
|||
Invert serial logic.
|
||||
|
||||
user_gpio:= 0-31 (opened in a prior call to [*bb_serial_read_open*])
|
||||
invert:= 0-1 (1 invert, 0 normal)
|
||||
invert:= 0-1 (1 invert, 0 normal)
|
||||
|
||||
...
|
||||
status = pi.bb_serial_invert(17, 1)
|
||||
|
@ -3726,7 +3769,7 @@ class pi():
|
|||
user_gpio:= 0-31.
|
||||
edge:= EITHER_EDGE, RISING_EDGE (default), or
|
||||
FALLING_EDGE.
|
||||
wait_timeout:= 0.0- (default 60.0).
|
||||
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.
|
||||
|
@ -3772,10 +3815,18 @@ class pi():
|
|||
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()
|
||||
...
|
||||
"""
|
||||
self.connected = True
|
||||
|
@ -3892,13 +3943,16 @@ def xref():
|
|||
clkfreq: 4689-250M
|
||||
The hardware clock frequency.
|
||||
|
||||
connected:
|
||||
True if a connection was established, False otherwise.
|
||||
|
||||
count:
|
||||
The number of bytes of data to be transferred.
|
||||
|
||||
data:
|
||||
Data to be transmitted, a series of bytes.
|
||||
|
||||
delay: 1-
|
||||
delay: >=1
|
||||
The length of a pulse in microseconds.
|
||||
|
||||
dutycycle: 0-range_
|
||||
|
@ -3958,7 +4012,7 @@ def xref():
|
|||
PI_SOCK_READ_FAILED = -59
|
||||
PI_SOCK_WRIT_FAILED = -60
|
||||
PI_TOO_MANY_PARAM = -61
|
||||
PI_NOT_HALTED = -62
|
||||
PI_SCRIPT_NOT_READY = -62
|
||||
PI_BAD_TAG = -63
|
||||
PI_BAD_MICS_DELAY = -64
|
||||
PI_BAD_MILS_DELAY = -65
|
||||
|
@ -4029,11 +4083,11 @@ def xref():
|
|||
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.
|
||||
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.
|
||||
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
|
||||
|
@ -4067,7 +4121,7 @@ def xref():
|
|||
This mask selects the GPIO to be switched on at the start
|
||||
of a pulse.
|
||||
|
||||
handle: 0-
|
||||
handle: >=0
|
||||
A number referencing an object opened by one of [*i2c_open*],
|
||||
[*notify_open*], [*serial_open*], [*spi_open*].
|
||||
|
||||
|
@ -4077,13 +4131,13 @@ def xref():
|
|||
i2c_*:
|
||||
One of the i2c_ functions.
|
||||
|
||||
i2c_address:
|
||||
i2c_address: 0-0x7F
|
||||
The address of a device on the I2C bus.
|
||||
|
||||
i2c_bus: 0-1
|
||||
i2c_bus: >=0
|
||||
An I2C bus number.
|
||||
|
||||
i2c_flags: 32 bit
|
||||
i2c_flags: 0
|
||||
No I2C flags are currently defined.
|
||||
|
||||
invert: 0-1
|
||||
|
@ -4119,7 +4173,7 @@ def xref():
|
|||
WAVE_MODE_ONE_SHOT_SYNC = 2
|
||||
WAVE_MODE_REPEAT_SYNC = 3
|
||||
|
||||
offset: 0-
|
||||
offset: >=0
|
||||
The offset wave data starts from the beginning of the waveform
|
||||
being currently defined.
|
||||
|
||||
|
@ -4170,7 +4224,7 @@ def xref():
|
|||
script:
|
||||
The text of a script to store on the pigpio daemon.
|
||||
|
||||
script_id: 0-
|
||||
script_id: >=0
|
||||
A number referencing a script created by [*store_script*].
|
||||
|
||||
SDA:
|
||||
|
@ -4226,7 +4280,7 @@ def xref():
|
|||
wave_add_*:
|
||||
One of [*wave_add_new*] , [*wave_add_generic*], [*wave_add_serial*].
|
||||
|
||||
wave_id: 0-
|
||||
wave_id: >=0
|
||||
A number referencing a wave created by [*wave_create*].
|
||||
|
||||
wave_send_*:
|
||||
|
|
80
pigpiod_if.3
80
pigpiod_if.3
|
@ -615,7 +615,7 @@ Set the frequency (in Hz) of the PWM to be used on the GPIO.
|
|||
.EX
|
||||
user_gpio: 0-31.
|
||||
.br
|
||||
frequency: 0- (Hz).
|
||||
frequency: >=0 (Hz).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -629,9 +629,8 @@ PI_BAD_USER_GPIO or PI_NOT_PERMITTED.
|
|||
.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 C pigpio library is started.
|
||||
If PWM is currently active on the GPIO it will be switched
|
||||
off and then back on at the new frequency.
|
||||
|
||||
.br
|
||||
|
||||
|
@ -642,47 +641,59 @@ PWM frequencies.
|
|||
.br
|
||||
|
||||
.br
|
||||
If PWM is currently active on the GPIO it will be switched
|
||||
off and then back on at the new frequency.
|
||||
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
|
||||
1us 40000, 20000, 10000, 8000, 5000, 4000, 2500, 2000, 1600,
|
||||
.br
|
||||
1250, 1000, 800, 500, 400, 250, 200, 100, 50
|
||||
Hertz
|
||||
.br
|
||||
|
||||
.br
|
||||
2us 20000, 10000, 5000, 4000, 2500, 2000, 1250, 1000, 800,
|
||||
1: 40000 20000 10000 8000 5000 4000 2500 2000 1600
|
||||
.br
|
||||
625, 500, 400, 250, 200, 125, 100, 50 , 25
|
||||
1250 1000 800 500 400 250 200 100 50
|
||||
.br
|
||||
|
||||
.br
|
||||
4us 10000, 5000, 2500, 2000, 1250, 1000, 625, 500, 400,
|
||||
2: 20000 10000 5000 4000 2500 2000 1250 1000 800
|
||||
.br
|
||||
313, 250, 200, 125, 100, 63, 50, 25, 13
|
||||
625 500 400 250 200 125 100 50 25
|
||||
.br
|
||||
|
||||
.br
|
||||
5us 8000, 4000, 2000, 1600, 1000, 800, 500, 400, 320,
|
||||
4: 10000 5000 2500 2000 1250 1000 625 500 400
|
||||
.br
|
||||
250, 200, 160, 100 , 80, 50, 40, 20, 10
|
||||
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
|
||||
8us 5000, 2500, 1250, 1000, 625, 500, 313, 250, 200,
|
||||
8: 5000 2500 1250 1000 625 500 313 250 200
|
||||
.br
|
||||
156, 125, 100, 63, 50, 31, 25, 13, 6
|
||||
156 125 100 63 50 31 25 13 6
|
||||
.br
|
||||
|
||||
.br
|
||||
10us 4000, 2000, 1000, 800, 500, 400, 250, 200, 160,
|
||||
10: 4000 2000 1000 800 500 400 250 200 160
|
||||
.br
|
||||
125, 100, 80, 50, 40, 25, 20, 10, 5
|
||||
125 100 80 50 40 25 20 10 5
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -1519,9 +1530,9 @@ data_bits: number of data bits (1-32)
|
|||
.br
|
||||
stop_bits: number of stop half bits (2-8)
|
||||
.br
|
||||
offset: 0-
|
||||
offset: >=0
|
||||
.br
|
||||
numBytes: 1-
|
||||
numBytes: >=1
|
||||
.br
|
||||
str: an array of chars.
|
||||
.br
|
||||
|
@ -2049,6 +2060,11 @@ This function stores a script for later execution.
|
|||
|
||||
.br
|
||||
|
||||
.br
|
||||
See \fBhttp://abyz.co.uk/rpi/pigpio/pigs.html#Scripts\fP for details.
|
||||
|
||||
.br
|
||||
|
||||
.br
|
||||
|
||||
.EX
|
||||
|
@ -2232,7 +2248,7 @@ user_gpio: 0-31, previously opened with \fBbb_serial_read_open\fP.
|
|||
.br
|
||||
buf: an array to receive the read bytes.
|
||||
.br
|
||||
bufSize: 0-
|
||||
bufSize: >=0
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -2307,9 +2323,9 @@ This returns a handle for the device at address i2c_addr on bus i2c_bus.
|
|||
.br
|
||||
|
||||
.EX
|
||||
i2c_bus: 0-1.
|
||||
i2c_bus: >=0.
|
||||
.br
|
||||
i2c_addr: 0x00-0x7F.
|
||||
i2c_addr: 0-0x7F.
|
||||
.br
|
||||
i2c_flags: 0.
|
||||
.br
|
||||
|
@ -2323,6 +2339,12 @@ 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
|
||||
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.
|
||||
|
@ -4076,7 +4098,7 @@ A function.
|
|||
|
||||
.br
|
||||
|
||||
.IP "\fBfrequency\fP: 0-" 0
|
||||
.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
|
||||
|
@ -4186,7 +4208,7 @@ typedef void *(gpioThreadFunc_t) (void *);
|
|||
|
||||
.br
|
||||
|
||||
.IP "\fBhandle\fP: 0-" 0
|
||||
.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.
|
||||
|
||||
|
@ -4194,15 +4216,15 @@ A number referencing an object opened by one of \fBi2c_open\fP, \fBnotify_open\f
|
|||
|
||||
.br
|
||||
|
||||
.IP "\fBi2c_addr\fP" 0
|
||||
.IP "\fBi2c_addr\fP: 0-0x7F" 0
|
||||
The address of a device on the I2C bus.
|
||||
|
||||
.br
|
||||
|
||||
.br
|
||||
|
||||
.IP "\fBi2c_bus\fP: 0-1" 0
|
||||
An I2C bus, 0 or 1.
|
||||
.IP "\fBi2c_bus\fP: >=0" 0
|
||||
An I2C bus number.
|
||||
|
||||
.br
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE.
|
|||
For more information, please refer to <http://unlicense.org/>
|
||||
*/
|
||||
|
||||
/* PIGPIOD_IF_VERSION 21 */
|
||||
/* PIGPIOD_IF_VERSION 23 */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
68
pigpiod_if.h
68
pigpiod_if.h
|
@ -30,7 +30,7 @@ For more information, please refer to <http://unlicense.org/>
|
|||
|
||||
#include "pigpio.h"
|
||||
|
||||
#define PIGPIOD_IF_VERSION 22
|
||||
#define PIGPIOD_IF_VERSION 23
|
||||
|
||||
/*TEXT
|
||||
|
||||
|
@ -565,40 +565,45 @@ Set the frequency (in Hz) of the PWM to be used on the GPIO.
|
|||
|
||||
. .
|
||||
user_gpio: 0-31.
|
||||
frequency: 0- (Hz).
|
||||
frequency: >=0 (Hz).
|
||||
. .
|
||||
|
||||
Returns the numerically closest frequency if OK, otherwise
|
||||
PI_BAD_USER_GPIO or PI_NOT_PERMITTED.
|
||||
|
||||
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 C pigpio library is started.
|
||||
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.
|
||||
|
||||
If PWM is currently active on the GPIO it will be switched
|
||||
off and then back on at the new frequency.
|
||||
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:
|
||||
|
||||
. .
|
||||
1us 40000, 20000, 10000, 8000, 5000, 4000, 2500, 2000, 1600,
|
||||
1250, 1000, 800, 500, 400, 250, 200, 100, 50
|
||||
Hertz
|
||||
|
||||
2us 20000, 10000, 5000, 4000, 2500, 2000, 1250, 1000, 800,
|
||||
625, 500, 400, 250, 200, 125, 100, 50 , 25
|
||||
1: 40000 20000 10000 8000 5000 4000 2500 2000 1600
|
||||
1250 1000 800 500 400 250 200 100 50
|
||||
|
||||
4us 10000, 5000, 2500, 2000, 1250, 1000, 625, 500, 400,
|
||||
313, 250, 200, 125, 100, 63, 50, 25, 13
|
||||
2: 20000 10000 5000 4000 2500 2000 1250 1000 800
|
||||
625 500 400 250 200 125 100 50 25
|
||||
|
||||
5us 8000, 4000, 2000, 1600, 1000, 800, 500, 400, 320,
|
||||
250, 200, 160, 100 , 80, 50, 40, 20, 10
|
||||
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
|
||||
|
||||
8us 5000, 2500, 1250, 1000, 625, 500, 313, 250, 200,
|
||||
156, 125, 100, 63, 50, 31, 25, 13, 6
|
||||
8: 5000 2500 1250 1000 625 500 313 250 200
|
||||
156 125 100 63 50 31 25 13 6
|
||||
|
||||
10us 4000, 2000, 1000, 800, 500, 400, 250, 200, 160,
|
||||
125, 100, 80, 50, 40, 25, 20, 10, 5
|
||||
10: 4000 2000 1000 800 500 400 250 200 160
|
||||
125 100 80 50 40 25 20 10 5
|
||||
. .
|
||||
D*/
|
||||
|
||||
|
@ -1097,8 +1102,8 @@ user_gpio: 0-31.
|
|||
baud: 50-1000000
|
||||
data_bits: number of data bits (1-32)
|
||||
stop_bits: number of stop half bits (2-8)
|
||||
offset: 0-
|
||||
numBytes: 1-
|
||||
offset: >=0
|
||||
numBytes: >=1
|
||||
str: an array of chars.
|
||||
. .
|
||||
|
||||
|
@ -1421,6 +1426,8 @@ int store_script(char *script);
|
|||
/*D
|
||||
This function stores a script for later execution.
|
||||
|
||||
See [[http://abyz.co.uk/rpi/pigpio/pigs.html#Scripts]] for details.
|
||||
|
||||
. .
|
||||
script: the text of the script.
|
||||
. .
|
||||
|
@ -1528,7 +1535,7 @@ bit bang serial cyclic buffer to the buffer starting at buf.
|
|||
. .
|
||||
user_gpio: 0-31, previously opened with [*bb_serial_read_open*].
|
||||
buf: an array to receive the read bytes.
|
||||
bufSize: 0-
|
||||
bufSize: >=0
|
||||
. .
|
||||
|
||||
Returns the number of bytes copied if OK, otherwise PI_BAD_USER_GPIO
|
||||
|
@ -1573,13 +1580,16 @@ int i2c_open(unsigned i2c_bus, unsigned i2c_addr, unsigned i2c_flags);
|
|||
This returns a handle for the device at address i2c_addr on bus i2c_bus.
|
||||
|
||||
. .
|
||||
i2c_bus: 0-1.
|
||||
i2c_addr: 0x00-0x7F.
|
||||
i2c_bus: >=0.
|
||||
i2c_addr: 0-0x7F.
|
||||
i2c_flags: 0.
|
||||
. .
|
||||
|
||||
No flags are currently defined. This parameter should be set to zero.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
|
@ -2560,7 +2570,7 @@ of the error.
|
|||
f::
|
||||
A function.
|
||||
|
||||
frequency::0-
|
||||
frequency::>=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
|
||||
|
@ -2611,15 +2621,15 @@ gpioThreadFunc_t::
|
|||
typedef void *(gpioThreadFunc_t) (void *);
|
||||
. .
|
||||
|
||||
handle::0-
|
||||
handle::>=0
|
||||
A number referencing an object opened by one of [*i2c_open*], [*notify_open*],
|
||||
[*serial_open*], and [*spi_open*].
|
||||
|
||||
i2c_addr::
|
||||
i2c_addr:: 0-0x7F
|
||||
The address of a device on the I2C bus.
|
||||
|
||||
i2c_bus::0-1
|
||||
An I2C bus, 0 or 1.
|
||||
i2c_bus::>=0
|
||||
An I2C bus number.
|
||||
|
||||
i2c_flags::0
|
||||
Flags which modify an I2C open command. None are currently defined.
|
||||
|
|
286
pigpiod_if2.3
286
pigpiod_if2.3
|
@ -312,7 +312,7 @@ resources used by the library.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -326,7 +326,7 @@ Set the GPIO mode.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
gpio: 0-53.
|
||||
.br
|
||||
|
@ -352,7 +352,7 @@ Get the GPIO mode.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
gpio: 0-53.
|
||||
.br
|
||||
|
@ -373,7 +373,7 @@ Set or clear the GPIO pull-up/down resistor.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
gpio: 0-53.
|
||||
.br
|
||||
|
@ -397,7 +397,7 @@ Read the GPIO level.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
gpio:0-53.
|
||||
.br
|
||||
|
@ -418,7 +418,7 @@ Write the GPIO level.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
gpio: 0-53.
|
||||
.br
|
||||
|
@ -452,7 +452,7 @@ Start (non-zero dutycycle) or stop (0) PWM pulses on the GPIO.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
user_gpio: 0-31.
|
||||
.br
|
||||
|
@ -483,7 +483,7 @@ Return the PWM dutycycle in use on a GPIO.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
user_gpio: 0-31.
|
||||
.br
|
||||
|
@ -522,7 +522,7 @@ Set the range of PWM values to be used on the GPIO.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
user_gpio: 0-31.
|
||||
.br
|
||||
|
@ -582,7 +582,7 @@ Get the range of PWM values being used on the GPIO.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
user_gpio: 0-31.
|
||||
.br
|
||||
|
@ -610,7 +610,7 @@ Get the real underlying range of PWM values being used on the GPIO.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
user_gpio: 0-31.
|
||||
.br
|
||||
|
@ -648,11 +648,11 @@ Set the frequency (in Hz) of the PWM to be used on the GPIO.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
user_gpio: 0-31.
|
||||
.br
|
||||
frequency: 0- (Hz).
|
||||
frequency: >=0 (Hz).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -666,9 +666,8 @@ PI_BAD_USER_GPIO or PI_NOT_PERMITTED.
|
|||
.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 C pigpio library is started.
|
||||
If PWM is currently active on the GPIO it will be switched
|
||||
off and then back on at the new frequency.
|
||||
|
||||
.br
|
||||
|
||||
|
@ -679,47 +678,59 @@ PWM frequencies.
|
|||
.br
|
||||
|
||||
.br
|
||||
If PWM is currently active on the GPIO it will be switched
|
||||
off and then back on at the new frequency.
|
||||
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
|
||||
1us 40000, 20000, 10000, 8000, 5000, 4000, 2500, 2000, 1600,
|
||||
.br
|
||||
1250, 1000, 800, 500, 400, 250, 200, 100, 50
|
||||
Hertz
|
||||
.br
|
||||
|
||||
.br
|
||||
2us 20000, 10000, 5000, 4000, 2500, 2000, 1250, 1000, 800,
|
||||
1: 40000 20000 10000 8000 5000 4000 2500 2000 1600
|
||||
.br
|
||||
625, 500, 400, 250, 200, 125, 100, 50 , 25
|
||||
1250 1000 800 500 400 250 200 100 50
|
||||
.br
|
||||
|
||||
.br
|
||||
4us 10000, 5000, 2500, 2000, 1250, 1000, 625, 500, 400,
|
||||
2: 20000 10000 5000 4000 2500 2000 1250 1000 800
|
||||
.br
|
||||
313, 250, 200, 125, 100, 63, 50, 25, 13
|
||||
625 500 400 250 200 125 100 50 25
|
||||
.br
|
||||
|
||||
.br
|
||||
5us 8000, 4000, 2000, 1600, 1000, 800, 500, 400, 320,
|
||||
4: 10000 5000 2500 2000 1250 1000 625 500 400
|
||||
.br
|
||||
250, 200, 160, 100 , 80, 50, 40, 20, 10
|
||||
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
|
||||
8us 5000, 2500, 1250, 1000, 625, 500, 313, 250, 200,
|
||||
8: 5000 2500 1250 1000 625 500 313 250 200
|
||||
.br
|
||||
156, 125, 100, 63, 50, 31, 25, 13, 6
|
||||
156 125 100 63 50 31 25 13 6
|
||||
.br
|
||||
|
||||
.br
|
||||
10us 4000, 2000, 1000, 800, 500, 400, 250, 200, 160,
|
||||
10: 4000 2000 1000 800 500 400 250 200 160
|
||||
.br
|
||||
125, 100, 80, 50, 40, 25, 20, 10, 5
|
||||
125 100 80 50 40 25 20 10 5
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -733,7 +744,7 @@ Get the frequency of PWM being used on the GPIO.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
user_gpio: 0-31.
|
||||
.br
|
||||
|
@ -773,7 +784,7 @@ Start (500-2500) or stop (0) servo pulses on the GPIO.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
user_gpio: 0-31.
|
||||
.br
|
||||
|
@ -874,7 +885,7 @@ Return the servo pulsewidth in use on a GPIO.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
user_gpio: 0-31.
|
||||
.br
|
||||
|
@ -895,7 +906,7 @@ Get a free notification handle.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -937,7 +948,7 @@ Start notifications on a previously opened handle.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: 0-31 (as returned by \fBnotify_open\fP)
|
||||
.br
|
||||
|
@ -992,7 +1003,7 @@ Pause notifications on a previously opened handle.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: 0-31 (as returned by \fBnotify_open\fP)
|
||||
.br
|
||||
|
@ -1020,7 +1031,7 @@ release the handle for reuse.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: 0-31 (as returned by \fBnotify_open\fP)
|
||||
.br
|
||||
|
@ -1041,7 +1052,7 @@ Sets a watchdog for a GPIO.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
user_gpio: 0-31.
|
||||
.br
|
||||
|
@ -1101,7 +1112,7 @@ level is then reported. Level changes of less than
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
user_gpio: 0-31
|
||||
.br
|
||||
|
@ -1138,7 +1149,7 @@ which the process repeats.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
user_gpio: 0-31
|
||||
.br
|
||||
|
@ -1170,7 +1181,7 @@ Read the levels of the bank 1 GPIO (GPIO 0-31).
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -1190,7 +1201,7 @@ Read the levels of the bank 2 GPIO (GPIO 32-53).
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -1210,7 +1221,7 @@ Clears GPIO 0-31 if the corresponding bit in bits is set.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
bits: a bit mask with 1 set if the corresponding GPIO is
|
||||
.br
|
||||
|
@ -1239,7 +1250,7 @@ Clears GPIO 32-53 if the corresponding bit (0-21) in bits is set.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
bits: a bit mask with 1 set if the corresponding GPIO is
|
||||
.br
|
||||
|
@ -1268,7 +1279,7 @@ Sets GPIO 0-31 if the corresponding bit in bits is set.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
bits: a bit mask with 1 set if the corresponding GPIO is
|
||||
.br
|
||||
|
@ -1297,7 +1308,7 @@ Sets GPIO 32-53 if the corresponding bit (0-21) in bits is set.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
bits: a bit mask with 1 set if the corresponding GPIO is
|
||||
.br
|
||||
|
@ -1327,7 +1338,7 @@ Frequencies above 30MHz are unlikely to work.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
gpio: see description
|
||||
.br
|
||||
|
@ -1413,7 +1424,7 @@ daemon is started (option -t).
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
gpio: see descripton
|
||||
.br
|
||||
|
@ -1499,7 +1510,7 @@ Gets the current system tick.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -1528,7 +1539,7 @@ Get the Pi's hardware revision number.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -1580,7 +1591,7 @@ Returns the pigpio version.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -1595,7 +1606,7 @@ This function clears all waveforms and any data added by calls to the
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -1616,7 +1627,7 @@ created with the \fBwave_create\fP function.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -1635,7 +1646,7 @@ This function adds a number of pulses to the current waveform.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
numPulses: the number of pulses.
|
||||
.br
|
||||
|
@ -1679,7 +1690,7 @@ microseconds from the start of the waveform.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
user_gpio: 0-31.
|
||||
.br
|
||||
|
@ -1689,9 +1700,9 @@ data_bits: number of data bits (1-32)
|
|||
.br
|
||||
stop_bits: number of stop half bits (2-8)
|
||||
.br
|
||||
offset: 0-
|
||||
offset: >=0
|
||||
.br
|
||||
numBytes: 1-
|
||||
numBytes: >=1
|
||||
.br
|
||||
str: an array of chars.
|
||||
.br
|
||||
|
@ -1754,7 +1765,7 @@ PI_TOO_MANY_CBS, PI_TOO_MANY_OOL, or PI_NO_WAVEFORM_ID.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -1869,7 +1880,7 @@ This function deletes the waveform with id wave_id.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
wave_id: >=0, as returned by \fBwave_create\fP.
|
||||
.br
|
||||
|
@ -1901,7 +1912,7 @@ NOTE: Any hardware PWM started by \fBhardware_PWM\fP will be cancelled.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
wave_id: >=0, as returned by \fBwave_create\fP.
|
||||
.br
|
||||
|
@ -1930,7 +1941,7 @@ NOTE: Any hardware PWM started by \fBhardware_PWM\fP will be cancelled.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
wave_id: >=0, as returned by \fBwave_create\fP.
|
||||
.br
|
||||
|
@ -1952,7 +1963,7 @@ Transmits the waveform with id wave_id using mode mode.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
wave_id: >=0, as returned by \fBwave_create\fP.
|
||||
.br
|
||||
|
@ -2023,7 +2034,7 @@ codes and related data.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
buf: pointer to the wave_ids and optional command codes
|
||||
.br
|
||||
|
@ -2209,7 +2220,7 @@ transmitted.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -2236,7 +2247,7 @@ transmitted.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -2255,7 +2266,7 @@ This function stops the transmission of the current waveform.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -2280,7 +2291,7 @@ waveform.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -2295,7 +2306,7 @@ created since the pigpio daemon was started.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -2311,7 +2322,7 @@ microseconds.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -2325,7 +2336,7 @@ This function returns the length in pulses of the current waveform.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -2340,7 +2351,7 @@ created since the pigpio daemon was started.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -2354,7 +2365,7 @@ This function returns the maximum possible size of a waveform in pulses.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -2369,7 +2380,7 @@ waveform.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -2384,7 +2395,7 @@ waveform created since the pigpio daemon was started.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -2399,7 +2410,7 @@ control blocks.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -2414,7 +2425,7 @@ level for pulseLen microseconds and then reset to not level.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
user_gpio: 0-31.
|
||||
.br
|
||||
|
@ -2437,10 +2448,15 @@ This function stores a script for later execution.
|
|||
|
||||
.br
|
||||
|
||||
.br
|
||||
See \fBhttp://abyz.co.uk/rpi/pigpio/pigs.html#Scripts\fP for details.
|
||||
|
||||
.br
|
||||
|
||||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
script: the text of the script.
|
||||
.br
|
||||
|
@ -2462,7 +2478,7 @@ This function runs a stored script.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
script_id: >=0, as returned by \fBstore_script\fP.
|
||||
.br
|
||||
|
@ -2495,7 +2511,7 @@ as the current values of parameters 0 to 9.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
script_id: >=0, as returned by \fBstore_script\fP.
|
||||
.br
|
||||
|
@ -2547,7 +2563,7 @@ This function stops a running script.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
script_id: >=0, as returned by \fBstore_script\fP.
|
||||
.br
|
||||
|
@ -2568,7 +2584,7 @@ This function deletes a stored script.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
script_id: >=0, as returned by \fBstore_script\fP.
|
||||
.br
|
||||
|
@ -2589,7 +2605,7 @@ This function opens a GPIO for bit bang reading of serial data.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
user_gpio: 0-31.
|
||||
.br
|
||||
|
@ -2628,13 +2644,13 @@ bit bang serial cyclic buffer to the buffer starting at buf.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
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-
|
||||
bufSize: >=0
|
||||
.br
|
||||
|
||||
.EE
|
||||
|
@ -2669,7 +2685,7 @@ This function closes a GPIO for bit bang reading of serial data.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
user_gpio: 0-31, previously opened with \fBbb_serial_read_open\fP.
|
||||
.br
|
||||
|
@ -2690,7 +2706,7 @@ This function inverts serial logic for big bang serial reads.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
user_gpio: 0-31, previously opened with \fBbb_serial_read_open\fP.
|
||||
.br
|
||||
|
@ -2713,11 +2729,11 @@ This returns a handle for the device at address i2c_addr on bus i2c_bus.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
i2c_bus: 0-1.
|
||||
i2c_bus: >=0.
|
||||
.br
|
||||
i2c_addr: 0x00-0x7F.
|
||||
i2c_addr: 0-0x7F.
|
||||
.br
|
||||
i2c_flags: 0.
|
||||
.br
|
||||
|
@ -2731,6 +2747,12 @@ 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
|
||||
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.
|
||||
|
@ -2780,7 +2802,7 @@ This closes the I2C device associated with the handle.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBi2c_open\fP.
|
||||
.br
|
||||
|
@ -2802,7 +2824,7 @@ with handle.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBi2c_open\fP.
|
||||
.br
|
||||
|
@ -2837,7 +2859,7 @@ This sends a single byte to the device associated with handle.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBi2c_open\fP.
|
||||
.br
|
||||
|
@ -2872,7 +2894,7 @@ This reads a single byte from the device associated with handle.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBi2c_open\fP.
|
||||
.br
|
||||
|
@ -2906,7 +2928,7 @@ associated with handle.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBi2c_open\fP.
|
||||
.br
|
||||
|
@ -2944,7 +2966,7 @@ associated with handle.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBi2c_open\fP.
|
||||
.br
|
||||
|
@ -2982,7 +3004,7 @@ associated with handle.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBi2c_open\fP.
|
||||
.br
|
||||
|
@ -3018,7 +3040,7 @@ associated with handle.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBi2c_open\fP.
|
||||
.br
|
||||
|
@ -3056,7 +3078,7 @@ associated with handle and and reads 16 bits of data in return.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBi2c_open\fP.
|
||||
.br
|
||||
|
@ -3096,7 +3118,7 @@ associated with handle.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBi2c_open\fP.
|
||||
.br
|
||||
|
@ -3138,7 +3160,7 @@ the device associated with handle.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBi2c_open\fP.
|
||||
.br
|
||||
|
@ -3184,7 +3206,7 @@ of bytes of data in return.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBi2c_open\fP.
|
||||
.br
|
||||
|
@ -3237,7 +3259,7 @@ associated with handle . The count may be 1-32.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBi2c_open\fP.
|
||||
.br
|
||||
|
@ -3278,7 +3300,7 @@ associated with handle.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBi2c_open\fP.
|
||||
.br
|
||||
|
@ -3316,7 +3338,7 @@ This reads count bytes from the raw device into buf.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBi2c_open\fP.
|
||||
.br
|
||||
|
@ -3352,7 +3374,7 @@ This writes count bytes from buf to the raw device.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBi2c_open\fP.
|
||||
.br
|
||||
|
@ -3390,7 +3412,7 @@ which contains the concatenated command codes and associated data.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBi2cOpen\fP
|
||||
.br
|
||||
|
@ -3527,7 +3549,7 @@ o I2C on any pair of spare GPIO
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
SDA: 0-31
|
||||
.br
|
||||
|
@ -3565,7 +3587,7 @@ opened with \fBbb_i2c_open\fP.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
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
|
||||
|
@ -3588,7 +3610,7 @@ which contains the concatenated command codes and associated data.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
SDA: 0-31 (as used in a prior call to \fBbb_i2c_open\fP)
|
||||
.br
|
||||
|
@ -3737,7 +3759,7 @@ selectable word size in bits.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
spi_channel: 0-1 (0-2 for the auxiliary device).
|
||||
.br
|
||||
|
@ -3883,7 +3905,7 @@ This functions closes the SPI device identified by the handle.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBspi_open\fP.
|
||||
.br
|
||||
|
@ -3905,7 +3927,7 @@ device associated with the handle.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBspi_open\fP.
|
||||
.br
|
||||
|
@ -3932,7 +3954,7 @@ device associated with the handle.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBspi_open\fP.
|
||||
.br
|
||||
|
@ -3960,7 +3982,7 @@ data are read from the device and placed in rxBuf.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBspi_open\fP.
|
||||
.br
|
||||
|
@ -3989,7 +4011,7 @@ with specified flags.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
ser_tty: the serial device to open, /dev/tty*.
|
||||
.br
|
||||
|
@ -4027,7 +4049,7 @@ This function closes the serial device associated with handle.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBserial_open\fP.
|
||||
.br
|
||||
|
@ -4048,7 +4070,7 @@ This function writes bVal to the serial port associated with handle.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBserial_open\fP.
|
||||
.br
|
||||
|
@ -4070,7 +4092,7 @@ This function reads a byte from the serial port associated with handle.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBserial_open\fP.
|
||||
.br
|
||||
|
@ -4093,7 +4115,7 @@ associated with handle.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBserial_open\fP.
|
||||
.br
|
||||
|
@ -4120,7 +4142,7 @@ associated with handle and writes them to buf.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBserial_open\fP.
|
||||
.br
|
||||
|
@ -4147,7 +4169,7 @@ device associated with handle.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
handle: >=0, as returned by a call to \fBserial_open\fP.
|
||||
.br
|
||||
|
@ -4174,7 +4196,7 @@ It returns a single integer value.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
arg1: >=0
|
||||
.br
|
||||
|
@ -4208,7 +4230,7 @@ rather than just an integer.
|
|||
The return value is an integer indicating the number of returned bytes.
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
arg1: >=0
|
||||
.br
|
||||
|
@ -4242,7 +4264,7 @@ This function initialises a new callback.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
user_gpio: 0-31.
|
||||
.br
|
||||
|
@ -4274,7 +4296,7 @@ This function initialises a new callback.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
user_gpio: 0-31.
|
||||
.br
|
||||
|
@ -4328,7 +4350,7 @@ seconds.
|
|||
.br
|
||||
|
||||
.EX
|
||||
pi: 0- (as returned by \fBpigpio_start\fP).
|
||||
pi: >=0 (as returned by \fBpigpio_start\fP).
|
||||
.br
|
||||
user_gpio: 0-31.
|
||||
.br
|
||||
|
@ -4608,7 +4630,7 @@ A function.
|
|||
|
||||
.br
|
||||
|
||||
.IP "\fBfrequency\fP: 0-" 0
|
||||
.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
|
||||
|
@ -4718,7 +4740,7 @@ typedef void *(gpioThreadFunc_t) (void *);
|
|||
|
||||
.br
|
||||
|
||||
.IP "\fBhandle\fP: 0-" 0
|
||||
.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.
|
||||
|
||||
|
@ -4726,15 +4748,15 @@ A number referencing an object opened by one of \fBi2c_open\fP, \fBnotify_open\f
|
|||
|
||||
.br
|
||||
|
||||
.IP "\fBi2c_addr\fP" 0
|
||||
.IP "\fBi2c_addr\fP: 0-0x7F" 0
|
||||
The address of a device on the I2C bus.
|
||||
|
||||
.br
|
||||
|
||||
.br
|
||||
|
||||
.IP "\fBi2c_bus\fP: 0-1" 0
|
||||
An I2C bus, 0 or 1.
|
||||
.IP "\fBi2c_bus\fP: >=0" 0
|
||||
An I2C bus number.
|
||||
|
||||
.br
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE.
|
|||
For more information, please refer to <http://unlicense.org/>
|
||||
*/
|
||||
|
||||
/* PIGPIOD_IF2_VERSION 5 */
|
||||
/* PIGPIOD_IF2_VERSION 6 */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
274
pigpiod_if2.h
274
pigpiod_if2.h
|
@ -30,7 +30,7 @@ For more information, please refer to <http://unlicense.org/>
|
|||
|
||||
#include "pigpio.h"
|
||||
|
||||
#define PIGPIOD_IF2_VERSION 5
|
||||
#define PIGPIOD_IF2_VERSION 6
|
||||
|
||||
/*TEXT
|
||||
|
||||
|
@ -387,7 +387,7 @@ Terminates the connection to a pigpio daemon and releases
|
|||
resources used by the library.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
. .
|
||||
D*/
|
||||
|
||||
|
@ -397,7 +397,7 @@ int set_mode(int pi, unsigned gpio, unsigned mode);
|
|||
Set the GPIO mode.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
gpio: 0-53.
|
||||
mode: PI_INPUT, PI_OUTPUT, PI_ALT0, _ALT1,
|
||||
PI_ALT2, PI_ALT3, PI_ALT4, PI_ALT5.
|
||||
|
@ -413,7 +413,7 @@ int get_mode(int pi, unsigned gpio);
|
|||
Get the GPIO mode.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
gpio: 0-53.
|
||||
. .
|
||||
|
||||
|
@ -426,7 +426,7 @@ int set_pull_up_down(int pi, unsigned gpio, unsigned pud);
|
|||
Set or clear the GPIO pull-up/down resistor.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
gpio: 0-53.
|
||||
pud: PI_PUD_UP, PI_PUD_DOWN, PI_PUD_OFF.
|
||||
. .
|
||||
|
@ -441,7 +441,7 @@ int gpio_read(int pi, unsigned gpio);
|
|||
Read the GPIO level.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
gpio:0-53.
|
||||
. .
|
||||
|
||||
|
@ -454,7 +454,7 @@ int gpio_write(int pi, unsigned gpio, unsigned level);
|
|||
Write the GPIO level.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
gpio: 0-53.
|
||||
level: 0, 1.
|
||||
. .
|
||||
|
@ -473,7 +473,7 @@ int set_PWM_dutycycle(int pi, unsigned user_gpio, unsigned dutycycle);
|
|||
Start (non-zero dutycycle) or stop (0) PWM pulses on the GPIO.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
user_gpio: 0-31.
|
||||
dutycycle: 0-range (range defaults to 255).
|
||||
. .
|
||||
|
@ -492,7 +492,7 @@ int get_PWM_dutycycle(int pi, unsigned user_gpio);
|
|||
Return the PWM dutycycle in use on a GPIO.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
user_gpio: 0-31.
|
||||
. .
|
||||
|
||||
|
@ -514,7 +514,7 @@ int set_PWM_range(int pi, unsigned user_gpio, unsigned range);
|
|||
Set the range of PWM values to be used on the GPIO.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
user_gpio: 0-31.
|
||||
range: 25-40000.
|
||||
. .
|
||||
|
@ -545,7 +545,7 @@ int get_PWM_range(int pi, unsigned user_gpio);
|
|||
Get the range of PWM values being used on the GPIO.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
user_gpio: 0-31.
|
||||
. .
|
||||
|
||||
|
@ -562,7 +562,7 @@ int get_PWM_real_range(int pi, unsigned user_gpio);
|
|||
Get the real underlying range of PWM values being used on the GPIO.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
user_gpio: 0-31.
|
||||
. .
|
||||
|
||||
|
@ -583,42 +583,47 @@ int set_PWM_frequency(int pi, unsigned user_gpio, unsigned frequency);
|
|||
Set the frequency (in Hz) of the PWM to be used on the GPIO.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
user_gpio: 0-31.
|
||||
frequency: 0- (Hz).
|
||||
frequency: >=0 (Hz).
|
||||
. .
|
||||
|
||||
Returns the numerically closest frequency if OK, otherwise
|
||||
PI_BAD_USER_GPIO or PI_NOT_PERMITTED.
|
||||
|
||||
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 C pigpio library is started.
|
||||
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.
|
||||
|
||||
If PWM is currently active on the GPIO it will be switched
|
||||
off and then back on at the new frequency.
|
||||
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:
|
||||
|
||||
. .
|
||||
1us 40000, 20000, 10000, 8000, 5000, 4000, 2500, 2000, 1600,
|
||||
1250, 1000, 800, 500, 400, 250, 200, 100, 50
|
||||
Hertz
|
||||
|
||||
2us 20000, 10000, 5000, 4000, 2500, 2000, 1250, 1000, 800,
|
||||
625, 500, 400, 250, 200, 125, 100, 50 , 25
|
||||
1: 40000 20000 10000 8000 5000 4000 2500 2000 1600
|
||||
1250 1000 800 500 400 250 200 100 50
|
||||
|
||||
4us 10000, 5000, 2500, 2000, 1250, 1000, 625, 500, 400,
|
||||
313, 250, 200, 125, 100, 63, 50, 25, 13
|
||||
2: 20000 10000 5000 4000 2500 2000 1250 1000 800
|
||||
625 500 400 250 200 125 100 50 25
|
||||
|
||||
5us 8000, 4000, 2000, 1600, 1000, 800, 500, 400, 320,
|
||||
250, 200, 160, 100 , 80, 50, 40, 20, 10
|
||||
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
|
||||
|
||||
8us 5000, 2500, 1250, 1000, 625, 500, 313, 250, 200,
|
||||
156, 125, 100, 63, 50, 31, 25, 13, 6
|
||||
8: 5000 2500 1250 1000 625 500 313 250 200
|
||||
156 125 100 63 50 31 25 13 6
|
||||
|
||||
10us 4000, 2000, 1000, 800, 500, 400, 250, 200, 160,
|
||||
125, 100, 80, 50, 40, 25, 20, 10, 5
|
||||
10: 4000 2000 1000 800 500 400 250 200 160
|
||||
125 100 80 50 40 25 20 10 5
|
||||
. .
|
||||
D*/
|
||||
|
||||
|
@ -628,7 +633,7 @@ int get_PWM_frequency(int pi, unsigned user_gpio);
|
|||
Get the frequency of PWM being used on the GPIO.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
user_gpio: 0-31.
|
||||
. .
|
||||
|
||||
|
@ -651,7 +656,7 @@ int set_servo_pulsewidth(int pi, unsigned user_gpio, unsigned pulsewidth);
|
|||
Start (500-2500) or stop (0) servo pulses on the GPIO.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
user_gpio: 0-31.
|
||||
pulsewidth: 0 (off), 500 (anti-clockwise) - 2500 (clockwise).
|
||||
. .
|
||||
|
@ -701,7 +706,7 @@ int get_servo_pulsewidth(int pi, unsigned user_gpio);
|
|||
Return the servo pulsewidth in use on a GPIO.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
user_gpio: 0-31.
|
||||
. .
|
||||
|
||||
|
@ -714,7 +719,7 @@ int notify_open(int pi);
|
|||
Get a free notification handle.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
. .
|
||||
|
||||
Returns a handle greater than or equal to zero if OK,
|
||||
|
@ -740,7 +745,7 @@ int notify_begin(int pi, unsigned handle, uint32_t bits);
|
|||
Start notifications on a previously opened handle.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: 0-31 (as returned by [*notify_open*])
|
||||
bits: a mask indicating the GPIO to be notified.
|
||||
. .
|
||||
|
@ -768,7 +773,7 @@ int notify_pause(int pi, unsigned handle);
|
|||
Pause notifications on a previously opened handle.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: 0-31 (as returned by [*notify_open*])
|
||||
. .
|
||||
|
||||
|
@ -785,7 +790,7 @@ Stop notifications on a previously opened handle and
|
|||
release the handle for reuse.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: 0-31 (as returned by [*notify_open*])
|
||||
. .
|
||||
|
||||
|
@ -798,7 +803,7 @@ int set_watchdog(int pi, unsigned user_gpio, unsigned timeout);
|
|||
Sets a watchdog for a GPIO.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
user_gpio: 0-31.
|
||||
timeout: 0-60000.
|
||||
. .
|
||||
|
@ -831,7 +836,7 @@ level is then reported. Level changes of less than
|
|||
[*steady*] microseconds are ignored.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
user_gpio: 0-31
|
||||
steady: 0-300000
|
||||
. .
|
||||
|
@ -854,7 +859,7 @@ on the GPIO are then reported for [*active*] microseconds after
|
|||
which the process repeats.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
user_gpio: 0-31
|
||||
steady: 0-300000
|
||||
active: 0-1000000
|
||||
|
@ -873,7 +878,7 @@ uint32_t read_bank_1(int pi);
|
|||
Read the levels of the bank 1 GPIO (GPIO 0-31).
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
. .
|
||||
|
||||
The returned 32 bit integer has a bit set if the corresponding
|
||||
|
@ -886,7 +891,7 @@ uint32_t read_bank_2(int pi);
|
|||
Read the levels of the bank 2 GPIO (GPIO 32-53).
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
. .
|
||||
|
||||
The returned 32 bit integer has a bit set if the corresponding
|
||||
|
@ -899,7 +904,7 @@ int clear_bank_1(int pi, uint32_t bits);
|
|||
Clears GPIO 0-31 if the corresponding bit in bits is set.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
bits: a bit mask with 1 set if the corresponding GPIO is
|
||||
to be cleared.
|
||||
. .
|
||||
|
@ -916,7 +921,7 @@ int clear_bank_2(int pi, uint32_t bits);
|
|||
Clears GPIO 32-53 if the corresponding bit (0-21) in bits is set.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
bits: a bit mask with 1 set if the corresponding GPIO is
|
||||
to be cleared.
|
||||
. .
|
||||
|
@ -933,7 +938,7 @@ int set_bank_1(int pi, uint32_t bits);
|
|||
Sets GPIO 0-31 if the corresponding bit in bits is set.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
bits: a bit mask with 1 set if the corresponding GPIO is
|
||||
to be set.
|
||||
. .
|
||||
|
@ -950,7 +955,7 @@ int set_bank_2(int pi, uint32_t bits);
|
|||
Sets GPIO 32-53 if the corresponding bit (0-21) in bits is set.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
bits: a bit mask with 1 set if the corresponding GPIO is
|
||||
to be set.
|
||||
. .
|
||||
|
@ -969,7 +974,7 @@ Starts a hardware clock on a GPIO at the specified frequency.
|
|||
Frequencies above 30MHz are unlikely to work.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
gpio: see description
|
||||
frequency: 0 (off) or 4689-250000000 (250M)
|
||||
. .
|
||||
|
@ -1016,7 +1021,7 @@ main clock defaults to PCM but may be overridden when the pigpio
|
|||
daemon is started (option -t).
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
gpio: see descripton
|
||||
PWMfreq: 0 (off) or 1-125000000 (125M)
|
||||
PWMduty: 0 (off) to 1000000 (1M)(fully on)
|
||||
|
@ -1063,7 +1068,7 @@ uint32_t get_current_tick(int pi);
|
|||
Gets the current system tick.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
. .
|
||||
|
||||
Tick is the number of microseconds since system boot.
|
||||
|
@ -1079,7 +1084,7 @@ uint32_t get_hardware_revision(int pi);
|
|||
Get the Pi's hardware revision number.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
. .
|
||||
|
||||
The hardware revision is the last few characters on the Revision line
|
||||
|
@ -1106,7 +1111,7 @@ uint32_t get_pigpio_version(int pi);
|
|||
Returns the pigpio version.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
. .
|
||||
D*/
|
||||
|
||||
|
@ -1118,7 +1123,7 @@ This function clears all waveforms and any data added by calls to the
|
|||
[*wave_add_**] functions.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
. .
|
||||
|
||||
Returns 0 if OK.
|
||||
|
@ -1132,7 +1137,7 @@ to call this function as it is automatically called after a waveform is
|
|||
created with the [*wave_create*] function.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
. .
|
||||
|
||||
Returns 0 if OK.
|
||||
|
@ -1144,7 +1149,7 @@ int wave_add_generic(int pi, unsigned numPulses, gpioPulse_t *pulses);
|
|||
This function adds a number of pulses to the current waveform.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
numPulses: the number of pulses.
|
||||
pulses: an array of pulses.
|
||||
. .
|
||||
|
@ -1172,13 +1177,13 @@ existing waveform (if any). The serial data starts offset
|
|||
microseconds from the start of the waveform.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
user_gpio: 0-31.
|
||||
baud: 50-1000000
|
||||
data_bits: number of data bits (1-32)
|
||||
stop_bits: number of stop half bits (2-8)
|
||||
offset: 0-
|
||||
numBytes: 1-
|
||||
offset: >=0
|
||||
numBytes: >=1
|
||||
str: an array of chars.
|
||||
. .
|
||||
|
||||
|
@ -1213,7 +1218,7 @@ 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.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
. .
|
||||
|
||||
The data provided by the [*wave_add_**] functions is consumed by this
|
||||
|
@ -1269,7 +1274,7 @@ int wave_delete(int pi, unsigned wave_id);
|
|||
This function deletes the waveform with id wave_id.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
wave_id: >=0, as returned by [*wave_create*].
|
||||
. .
|
||||
|
||||
|
@ -1288,7 +1293,7 @@ is sent once.
|
|||
NOTE: Any hardware PWM started by [*hardware_PWM*] will be cancelled.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
wave_id: >=0, as returned by [*wave_create*].
|
||||
. .
|
||||
|
||||
|
@ -1307,7 +1312,7 @@ by [*wave_tx_stop*]).
|
|||
NOTE: Any hardware PWM started by [*hardware_PWM*] will be cancelled.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
wave_id: >=0, as returned by [*wave_create*].
|
||||
. .
|
||||
|
||||
|
@ -1322,7 +1327,7 @@ int wave_send_using_mode(int pi, unsigned wave_id, unsigned mode);
|
|||
Transmits the waveform with id wave_id using mode mode.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
wave_id: >=0, as returned by [*wave_create*].
|
||||
mode: PI_WAVE_MODE_ONE_SHOT, PI_WAVE_MODE_REPEAT,
|
||||
PI_WAVE_MODE_ONE_SHOT_SYNC, or PI_WAVE_MODE_REPEAT_SYNC.
|
||||
|
@ -1359,7 +1364,7 @@ which contains an ordered list of [*wave_id*]s and optional command
|
|||
codes and related data.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
buf: pointer to the wave_ids and optional command codes
|
||||
bufSize: the number of bytes in buf
|
||||
. .
|
||||
|
@ -1450,7 +1455,7 @@ This function returns the id of the waveform currently being
|
|||
transmitted.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
. .
|
||||
|
||||
Returns the waveform id or one of the following special values:
|
||||
|
@ -1466,7 +1471,7 @@ This function checks to see if a waveform is currently being
|
|||
transmitted.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
. .
|
||||
|
||||
Returns 1 if a waveform is currently being transmitted, otherwise 0.
|
||||
|
@ -1478,7 +1483,7 @@ int wave_tx_stop(int pi);
|
|||
This function stops the transmission of the current waveform.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
. .
|
||||
|
||||
Returns 0 if OK.
|
||||
|
@ -1493,7 +1498,7 @@ This function returns the length in microseconds of the current
|
|||
waveform.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
. .
|
||||
D*/
|
||||
|
||||
|
@ -1504,7 +1509,7 @@ This function returns the length in microseconds of the longest waveform
|
|||
created since the pigpio daemon was started.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
. .
|
||||
D*/
|
||||
|
||||
|
@ -1515,7 +1520,7 @@ This function returns the maximum possible size of a waveform in
|
|||
microseconds.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
. .
|
||||
D*/
|
||||
|
||||
|
@ -1525,7 +1530,7 @@ int wave_get_pulses(int pi);
|
|||
This function returns the length in pulses of the current waveform.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
. .
|
||||
D*/
|
||||
|
||||
|
@ -1536,7 +1541,7 @@ This function returns the length in pulses of the longest waveform
|
|||
created since the pigpio daemon was started.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
. .
|
||||
D*/
|
||||
|
||||
|
@ -1546,7 +1551,7 @@ int wave_get_max_pulses(int pi);
|
|||
This function returns the maximum possible size of a waveform in pulses.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
. .
|
||||
D*/
|
||||
|
||||
|
@ -1557,7 +1562,7 @@ This function returns the length in DMA control blocks of the current
|
|||
waveform.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
. .
|
||||
D*/
|
||||
|
||||
|
@ -1568,7 +1573,7 @@ This function returns the length in DMA control blocks of the longest
|
|||
waveform created since the pigpio daemon was started.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
. .
|
||||
D*/
|
||||
|
||||
|
@ -1579,7 +1584,7 @@ This function returns the maximum possible size of a waveform in DMA
|
|||
control blocks.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
. .
|
||||
D*/
|
||||
|
||||
|
@ -1590,7 +1595,7 @@ This function sends a trigger pulse to a GPIO. The GPIO is set to
|
|||
level for pulseLen microseconds and then reset to not level.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
user_gpio: 0-31.
|
||||
pulseLen: 1-100.
|
||||
level: 0,1.
|
||||
|
@ -1605,8 +1610,10 @@ int store_script(int pi, char *script);
|
|||
/*D
|
||||
This function stores a script for later execution.
|
||||
|
||||
See [[http://abyz.co.uk/rpi/pigpio/pigs.html#Scripts]] for details.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
script: the text of the script.
|
||||
. .
|
||||
|
||||
|
@ -1620,7 +1627,7 @@ int run_script(int pi, unsigned script_id, unsigned numPar, uint32_t *param);
|
|||
This function runs a stored script.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
script_id: >=0, as returned by [*store_script*].
|
||||
numPar: 0-10, the number of parameters.
|
||||
param: an array of parameters.
|
||||
|
@ -1640,7 +1647,7 @@ This function returns the run status of a stored script as well
|
|||
as the current values of parameters 0 to 9.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
script_id: >=0, as returned by [*store_script*].
|
||||
param: an array to hold the returned 10 parameters.
|
||||
. .
|
||||
|
@ -1667,7 +1674,7 @@ int stop_script(int pi, unsigned script_id);
|
|||
This function stops a running script.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
script_id: >=0, as returned by [*store_script*].
|
||||
. .
|
||||
|
||||
|
@ -1680,7 +1687,7 @@ int delete_script(int pi, unsigned script_id);
|
|||
This function deletes a stored script.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
script_id: >=0, as returned by [*store_script*].
|
||||
. .
|
||||
|
||||
|
@ -1693,7 +1700,7 @@ int bb_serial_read_open(int pi, unsigned user_gpio, unsigned baud, unsigned data
|
|||
This function opens a GPIO for bit bang reading of serial data.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
user_gpio: 0-31.
|
||||
baud: 50-250000
|
||||
data_bits: 1-32
|
||||
|
@ -1716,10 +1723,10 @@ This function copies up to bufSize bytes of data read from the
|
|||
bit bang serial cyclic buffer to the buffer starting at buf.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
user_gpio: 0-31, previously opened with [*bb_serial_read_open*].
|
||||
buf: an array to receive the read bytes.
|
||||
bufSize: 0-
|
||||
bufSize: >=0
|
||||
. .
|
||||
|
||||
Returns the number of bytes copied if OK, otherwise PI_BAD_USER_GPIO
|
||||
|
@ -1739,7 +1746,7 @@ int bb_serial_read_close(int pi, unsigned user_gpio);
|
|||
This function closes a GPIO for bit bang reading of serial data.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
user_gpio: 0-31, previously opened with [*bb_serial_read_open*].
|
||||
. .
|
||||
|
||||
|
@ -1752,7 +1759,7 @@ int bb_serial_invert(int pi, unsigned user_gpio, unsigned invert);
|
|||
This function inverts serial logic for big bang serial reads.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
user_gpio: 0-31, previously opened with [*bb_serial_read_open*].
|
||||
invert: 0-1, 1 invert, 0 normal.
|
||||
. .
|
||||
|
@ -1766,14 +1773,17 @@ int i2c_open(int pi, unsigned i2c_bus, unsigned i2c_addr, unsigned i2c_flags);
|
|||
This returns a handle for the device at address i2c_addr on bus i2c_bus.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
i2c_bus: 0-1.
|
||||
i2c_addr: 0x00-0x7F.
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
i2c_bus: >=0.
|
||||
i2c_addr: 0-0x7F.
|
||||
i2c_flags: 0.
|
||||
. .
|
||||
|
||||
No flags are currently defined. This parameter should be set to zero.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
|
@ -1800,7 +1810,7 @@ int i2c_close(int pi, unsigned handle);
|
|||
This closes the I2C device associated with the handle.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*i2c_open*].
|
||||
. .
|
||||
|
||||
|
@ -1814,7 +1824,7 @@ This sends a single bit (in the Rd/Wr bit) to the device associated
|
|||
with handle.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*i2c_open*].
|
||||
bit: 0-1, the value to write.
|
||||
. .
|
||||
|
@ -1834,7 +1844,7 @@ int i2c_write_byte(int pi, unsigned handle, unsigned bVal);
|
|||
This sends a single byte to the device associated with handle.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*i2c_open*].
|
||||
bVal: 0-0xFF, the value to write.
|
||||
. .
|
||||
|
@ -1854,7 +1864,7 @@ int i2c_read_byte(int pi, unsigned handle);
|
|||
This reads a single byte from the device associated with handle.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*i2c_open*].
|
||||
. .
|
||||
|
||||
|
@ -1875,7 +1885,7 @@ This writes a single byte to the specified register of the device
|
|||
associated with handle.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*i2c_open*].
|
||||
i2c_reg: 0-255, the register to write.
|
||||
bVal: 0-0xFF, the value to write.
|
||||
|
@ -1898,7 +1908,7 @@ This writes a single 16 bit word to the specified register of the device
|
|||
associated with handle.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*i2c_open*].
|
||||
i2c_reg: 0-255, the register to write.
|
||||
wVal: 0-0xFFFF, the value to write.
|
||||
|
@ -1920,7 +1930,7 @@ This reads a single byte from the specified register of the device
|
|||
associated with handle.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*i2c_open*].
|
||||
i2c_reg: 0-255, the register to read.
|
||||
. .
|
||||
|
@ -1941,7 +1951,7 @@ This reads a single 16 bit word from the specified register of the device
|
|||
associated with handle.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*i2c_open*].
|
||||
i2c_reg: 0-255, the register to read.
|
||||
. .
|
||||
|
@ -1963,7 +1973,7 @@ 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.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*i2c_open*].
|
||||
i2c_reg: 0-255, the register to write/read.
|
||||
wVal: 0-0xFFFF, the value to write.
|
||||
|
@ -1987,7 +1997,7 @@ This writes up to 32 bytes to the specified register of the device
|
|||
associated with handle.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*i2c_open*].
|
||||
i2c_reg: 0-255, the register to write.
|
||||
buf: an array with the data to send.
|
||||
|
@ -2011,7 +2021,7 @@ This reads a block of up to 32 bytes from the specified register of
|
|||
the device associated with handle.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*i2c_open*].
|
||||
i2c_reg: 0-255, the register to read.
|
||||
buf: an array to receive the read data.
|
||||
|
@ -2038,7 +2048,7 @@ associated with handle and reads a device specified number
|
|||
of bytes of data in return.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*i2c_open*].
|
||||
i2c_reg: 0-255, the register to write/read.
|
||||
buf: an array with the data to send and to receive the read data.
|
||||
|
@ -2068,7 +2078,7 @@ This reads count bytes from the specified register of the device
|
|||
associated with handle . The count may be 1-32.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*i2c_open*].
|
||||
i2c_reg: 0-255, the register to read.
|
||||
buf: an array to receive the read data.
|
||||
|
@ -2093,7 +2103,7 @@ This writes 1 to 32 bytes to the specified register of the device
|
|||
associated with handle.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*i2c_open*].
|
||||
i2c_reg: 0-255, the register to write.
|
||||
buf: the data to write.
|
||||
|
@ -2114,7 +2124,7 @@ int i2c_read_device(int pi, unsigned handle, char *buf, unsigned count);
|
|||
This reads count bytes from the raw device into buf.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*i2c_open*].
|
||||
buf: an array to receive the read data bytes.
|
||||
count: >0, the number of bytes to read.
|
||||
|
@ -2134,7 +2144,7 @@ int i2c_write_device(int pi, unsigned handle, char *buf, unsigned count);
|
|||
This writes count bytes from buf to the raw device.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*i2c_open*].
|
||||
buf: an array containing the data bytes to write.
|
||||
count: >0, the number of bytes to write.
|
||||
|
@ -2162,7 +2172,7 @@ operations to be performed are specified by the contents of inBuf
|
|||
which contains the concatenated command codes and associated data.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*i2cOpen*]
|
||||
inBuf: pointer to the concatenated I2C commands, see below
|
||||
inLen: size of command buffer
|
||||
|
@ -2226,7 +2236,7 @@ o clock stretching
|
|||
o I2C on any pair of spare GPIO
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
SDA: 0-31
|
||||
SCL: 0-31
|
||||
baud: 50-500000
|
||||
|
@ -2248,7 +2258,7 @@ This function stops bit banging I2C on a pair of GPIO previously
|
|||
opened with [*bb_i2c_open*].
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
SDA: 0-31, the SDA GPIO used in a prior call to [*bb_i2c_open*]
|
||||
. .
|
||||
|
||||
|
@ -2269,7 +2279,7 @@ operations to be performed are specified by the contents of inBuf
|
|||
which contains the concatenated command codes and associated data.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
SDA: 0-31 (as used in a prior call to [*bb_i2c_open*])
|
||||
inBuf: pointer to the concatenated I2C commands, see below
|
||||
inLen: size of command buffer
|
||||
|
@ -2342,7 +2352,7 @@ flags. The auxiliary device has 3 chip selects and a
|
|||
selectable word size in bits.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
spi_channel: 0-1 (0-2 for the auxiliary device).
|
||||
baud: 32K-125M (values above 30M are unlikely to work).
|
||||
spi_flags: see below.
|
||||
|
@ -2414,7 +2424,7 @@ int spi_close(int pi, unsigned handle);
|
|||
This functions closes the SPI device identified by the handle.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*spi_open*].
|
||||
. .
|
||||
|
||||
|
@ -2428,7 +2438,7 @@ This function reads count bytes of data from the SPI
|
|||
device associated with the handle.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*spi_open*].
|
||||
buf: an array to receive the read data bytes.
|
||||
count: the number of bytes to read.
|
||||
|
@ -2445,7 +2455,7 @@ This function writes count bytes of data from buf to the SPI
|
|||
device associated with the handle.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*spi_open*].
|
||||
buf: the data bytes to write.
|
||||
count: the number of bytes to write.
|
||||
|
@ -2464,7 +2474,7 @@ device associated with the handle. Simultaneously count bytes of
|
|||
data are read from the device and placed in rxBuf.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*spi_open*].
|
||||
txBuf: the data bytes to write.
|
||||
rxBuf: the received data bytes.
|
||||
|
@ -2482,7 +2492,7 @@ This function opens a serial device at a specified baud rate
|
|||
with specified flags.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
ser_tty: the serial device to open, /dev/tty*.
|
||||
baud: the baud rate in bits per second, see below.
|
||||
ser_flags: 0.
|
||||
|
@ -2504,7 +2514,7 @@ int serial_close(int pi, unsigned handle);
|
|||
This function closes the serial device associated with handle.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*serial_open*].
|
||||
. .
|
||||
|
||||
|
@ -2517,7 +2527,7 @@ int serial_write_byte(int pi, unsigned handle, unsigned bVal);
|
|||
This function writes bVal to the serial port associated with handle.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*serial_open*].
|
||||
. .
|
||||
|
||||
|
@ -2531,7 +2541,7 @@ int serial_read_byte(int pi, unsigned handle);
|
|||
This function reads a byte from the serial port associated with handle.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*serial_open*].
|
||||
. .
|
||||
|
||||
|
@ -2546,7 +2556,7 @@ This function writes count bytes from buf to the the serial port
|
|||
associated with handle.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*serial_open*].
|
||||
buf: the array of bytes to write.
|
||||
count: the number of bytes to write.
|
||||
|
@ -2563,7 +2573,7 @@ This function reads up to count bytes from the the serial port
|
|||
associated with handle and writes them to buf.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*serial_open*].
|
||||
buf: an array to receive the read data.
|
||||
count: the maximum number of bytes to read.
|
||||
|
@ -2580,7 +2590,7 @@ Returns the number of bytes available to be read from the
|
|||
device associated with handle.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
handle: >=0, as returned by a call to [*serial_open*].
|
||||
. .
|
||||
|
||||
|
@ -2596,7 +2606,7 @@ This function is available for user customisation.
|
|||
It returns a single integer value.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
arg1: >=0
|
||||
arg2: >=0
|
||||
argx: extra (byte) arguments
|
||||
|
@ -2618,7 +2628,7 @@ rather than just an integer.
|
|||
|
||||
The return value is an integer indicating the number of returned bytes.
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
arg1: >=0
|
||||
argc: extra (byte) arguments
|
||||
count: number of extra arguments
|
||||
|
@ -2638,7 +2648,7 @@ int callback(int pi, unsigned user_gpio, unsigned edge, CBFunc_t f);
|
|||
This function initialises a new callback.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
user_gpio: 0-31.
|
||||
edge: RISING_EDGE, FALLING_EDGE, or EITHER_EDGE.
|
||||
f: the callback function.
|
||||
|
@ -2658,7 +2668,7 @@ int callback_ex
|
|||
This function initialises a new callback.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
user_gpio: 0-31.
|
||||
edge: RISING_EDGE, FALLING_EDGE, or EITHER_EDGE.
|
||||
f: the callback function.
|
||||
|
@ -2691,7 +2701,7 @@ This function waits for edge on the GPIO for up to timeout
|
|||
seconds.
|
||||
|
||||
. .
|
||||
pi: 0- (as returned by [*pigpio_start*]).
|
||||
pi: >=0 (as returned by [*pigpio_start*]).
|
||||
user_gpio: 0-31.
|
||||
edge: RISING_EDGE, FALLING_EDGE, or EITHER_EDGE.
|
||||
timeout: >=0.
|
||||
|
@ -2821,7 +2831,7 @@ of the error.
|
|||
f::
|
||||
A function.
|
||||
|
||||
frequency::0-
|
||||
frequency::>=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
|
||||
|
@ -2872,15 +2882,15 @@ gpioThreadFunc_t::
|
|||
typedef void *(gpioThreadFunc_t) (void *);
|
||||
. .
|
||||
|
||||
handle::0-
|
||||
handle::>=0
|
||||
A number referencing an object opened by one of [*i2c_open*], [*notify_open*],
|
||||
[*serial_open*], and [*spi_open*].
|
||||
|
||||
i2c_addr::
|
||||
i2c_addr::0-0x7F
|
||||
The address of a device on the I2C bus.
|
||||
|
||||
i2c_bus::0-1
|
||||
An I2C bus, 0 or 1.
|
||||
i2c_bus::>=0
|
||||
An I2C bus number.
|
||||
|
||||
i2c_flags::0
|
||||
Flags which modify an I2C open command. None are currently defined.
|
||||
|
|
17
pigs.1
17
pigs.1
|
@ -881,6 +881,11 @@ ERROR: unknown handle
|
|||
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
|
||||
No flags are currently defined. The parameter \fBif\fP should be 0.
|
||||
|
||||
|
@ -3388,7 +3393,7 @@ pigs wvcha \
|
|||
.br
|
||||
|
||||
.br
|
||||
while [[ $(pigs wvbsy) -eq 1 ]]; do sleep 0.1; done
|
||||
while \fB $(pigs wvbsy) -eq 1 \fP; do sleep 0.1; done
|
||||
.br
|
||||
|
||||
.br
|
||||
|
@ -3953,12 +3958,12 @@ A handle is a number referencing an object opened by one of \fBI2CO\fP, \fBNO\fP
|
|||
|
||||
.br
|
||||
|
||||
.IP "\fBib\fP - I2C bus (0-1)" 0
|
||||
The command expects an I2C bus.
|
||||
.IP "\fBib\fP - I2C bus (>=0)" 0
|
||||
The command expects an I2C bus number.
|
||||
|
||||
.br
|
||||
|
||||
.IP "\fBid\fP - I2C device (0x08-0x77)" 0
|
||||
.IP "\fBid\fP - I2C device (0-0x7F)" 0
|
||||
The command expects the address of an I2C device.
|
||||
|
||||
.br
|
||||
|
@ -4309,7 +4314,7 @@ Again, ignore the details for now.
|
|||
.br
|
||||
|
||||
.EX
|
||||
time (pigs procr 0 10000000; while a=$(pigs procp 0); [[ ${a::1} -eq 2 ]];\
|
||||
time (pigs procr 0 10000000; while a=$(pigs procp 0); \fB ${a::1} -eq 2 \fP;\
|
||||
.br
|
||||
do sleep 0.2; done)
|
||||
.br
|
||||
|
@ -4349,7 +4354,7 @@ 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 ]];\
|
||||
time (pigs procr 0 10000000; while a=$(pigs procp 0); \fB ${a::1} -eq 2 \fP;\
|
||||
.br
|
||||
do sleep 0.2; done)
|
||||
.br
|
||||
|
|
Loading…
Reference in New Issue