The bytes required for each character depend upon [*bb_bits*].
- For [*bb_bits*] 1-8 there will be one byte per character.
- For [*bb_bits*] 9-16 there will be two bytes per character.
+ For [*bb_bits*] 1-8 there will be one byte per character.
+ For [*bb_bits*] 9-16 there will be two bytes per character.
For [*bb_bits*] 17-32 there will be four bytes per character.
...
A pulse specifies
- 1) the GPIO to be switched on at the start of the pulse.
- 2) the GPIO to be switched off at the start of the pulse.
+ 1) the GPIO to be switched on at the start of the pulse.
+ 2) the GPIO to be switched off at the start of the pulse.
3) the delay in microseconds before the next pulse.
Any or all the fields can be zero. It doesn't make any sense
Returns the waveform id or one of the following special
values:
- WAVE_NOT_FOUND (9998) - transmitted wave not found.
+ WAVE_NOT_FOUND (9998) - transmitted wave not found.
NO_TX_WAVE (9999) - no wave being transmitted.
...
S (1 bit) : Start bit
P (1 bit) : Stop bit
Rd/Wr (1 bit) : Read/Write bit. Rd equals 1, Wr equals 0.
- A, NA (1 bit) : Accept and not accept bit.
+ A, NA (1 bit) : Accept and not accept bit.
Addr (7 bits): I2C 7 bit address.
reg (8 bits): Command byte, which often selects a register.
Data (8 bits): A data byte.
SCLK := 0-31
baud := 50-250000
spiFlags := see below
-
+
spiFlags consists of the least significant 22 bits.
. .
# I SCLK
# I baud
# I spi_flags
-
+
extents = [struct.pack("IIIII", MISO, MOSI, SCLK, baud, spi_flags)]
return _u2i(_pigpio_command_ext(
self.sl, _PI_CMD_BSPIO, CS, 0, 20, extents))
Bit banging I2C allows for certain operations which are not possible
with the standard I2C driver.
- o baud rates as low as 50
- o repeated starts
- o clock stretching
+ o baud rates as low as 50
+ o repeated starts
+ o clock stretching
o I2C on any pair of spare GPIO
SDA:= 0-31
transfer data packed into 1, 2, or 4 bytes according to
the word size in bits.
- For bits 1-8 there will be one byte per character.
- For bits 9-16 there will be two bytes per character.
+ For bits 1-8 there will be one byte per character.
+ For bits 9-16 there will be two bytes per character.
For bits 17-32 there will be four bytes per character.
Multi-byte transfers are made in least significant byte
data bits [*bb_bits*] specified in the [*bb_serial_read_open*]
command.
- For [*bb_bits*] 1-8 there will be one byte per character.
- For [*bb_bits*] 9-16 there will be two bytes per character.
+ For [*bb_bits*] 1-8 there will be one byte per character.
+ For [*bb_bits*] 9-16 there will be two bytes per character.
For [*bb_bits*] 17-32 there will be four bytes per character.
...
rdata = self._rxbuf(bytes)
return bytes, rdata
-
+
def bb_serial_read_close(self, user_gpio):
"""
Closes a GPIO for bit bang reading of serial data.
host:= the host name of the Pi on which the pigpio daemon is
running. The default is localhost unless overridden by
the PIGPIO_ADDR environment variable.
-
+
port:= the port number on which the pigpio daemon is listening.
The default is 8888 unless overridden by the PIGPIO_PORT
environment variable. The pigpio daemon must have been
s = "Can't connect to pigpio at {}({})".format(host, str(port))
-
+
print(_except_a.format(s))
if exception == 1:
print(_except_1)
print(_except_3)
print(_except_z)
+ def __repr__(self):
+ return "<pipio.pi host={} port={}>".format(self._host, self._port)
+
def stop(self):
"""Release pigpio resources.
edge: 0-2
. .
- EITHER_EDGE = 2
- FALLING_EDGE = 1
+ EITHER_EDGE = 2
+ FALLING_EDGE = 1
RISING_EDGE = 0
. .
handle: >=0
A number referencing an object opened by one of the following
- [*file_open*]
- [*i2c_open*]
- [*notify_open*]
- [*serial_open*]
+ [*file_open*]
+ [*i2c_open*]
+ [*notify_open*]
+ [*serial_open*]
[*spi_open*]
host:
level: 0-1 (2)
. .
- CLEAR = 0
- HIGH = 1
- LOW = 0
- OFF = 0
- ON = 1
- SET = 1
+ CLEAR = 0
+ HIGH = 1
+ LOW = 0
+ OFF = 0
+ ON = 1
+ SET = 1
TIMEOUT = 2 # only returned for a watchdog timeout
. .
1.The operational mode of a GPIO, normally INPUT or OUTPUT.
. .
- ALT0 = 4
- ALT1 = 5
- ALT2 = 6
- ALT3 = 7
- ALT4 = 3
- ALT5 = 2
- INPUT = 0
+ ALT0 = 4
+ ALT1 = 5
+ ALT2 = 6
+ ALT3 = 7
+ ALT4 = 3
+ ALT5 = 2
+ INPUT = 0
OUTPUT = 1
. .
2. The mode of waveform transmission.
. .
- WAVE_MODE_ONE_SHOT = 0
- WAVE_MODE_REPEAT = 1
- WAVE_MODE_ONE_SHOT_SYNC = 2
+ WAVE_MODE_ONE_SHOT = 0
+ WAVE_MODE_REPEAT = 1
+ WAVE_MODE_ONE_SHOT_SYNC = 2
WAVE_MODE_REPEAT_SYNC = 3
. .
When scripts are started they can receive up to 10 parameters
to define their operation.
- port:
+ port:
The port used by the pigpio daemon, defaults to 8888.
pstring:
pud: 0-2
. .
- PUD_DOWN = 1
- PUD_OFF = 0
- PUD_UP = 2
+ PUD_DOWN = 1
+ PUD_OFF = 0
+ PUD_UP = 2
. .
pulse_len: 1-100
Direction to seek for [*file_seek*].
. .
- FROM_START=0
- FROM_CURRENT=1
- FROM_END=2
+ FROM_START=0
+ FROM_CURRENT=1
+ FROM_END=2
. .
seek_offset:
wave_add_*:
One of the following
- [*wave_add_new*]
- [*wave_add_generic*]
+ [*wave_add_new*]
+ [*wave_add_generic*]
[*wave_add_serial*]
wave_id: >=0
wave_send_*:
One of the following
- [*wave_send_once*]
+ [*wave_send_once*]
[*wave_send_repeat*]
wdog_timeout: 0-60000