mirror of https://github.com/joan2937/pigpio
merge develop
This commit is contained in:
commit
e41470c51a
Binary file not shown.
|
@ -511,6 +511,13 @@ pip install nrf24
|
||||||
?4|https://github.com/bjarne-hansen/py-nrf24|2020-04-20|NRF24
|
?4|https://github.com/bjarne-hansen/py-nrf24|2020-04-20|NRF24
|
||||||
Code and example usage of the Pypi NRF24 module. Cleaned up and added support for reading from multiple pipes using open_reading_pipe(pipe, address) and open_writing_pipe(address) in order to be more "compatible" with the way NRF24 is used on Arduinos.
|
Code and example usage of the Pypi NRF24 module. Cleaned up and added support for reading from multiple pipes using open_reading_pipe(pipe, address) and open_writing_pipe(address) in order to be more "compatible" with the way NRF24 is used on Arduinos.
|
||||||
|
|
||||||
|
?4|https://github.com/paulvee/pigpio-serial-bb-examples|2020-11-16|bit bang serial RX
|
||||||
|
Example code showing how to use the bit banged serial links.
|
||||||
|
|
||||||
|
One example shows how to read the serial data from an Arduino based counter, that sends results every 1,000 or 10,000 seconds.
|
||||||
|
|
||||||
|
Another example shows how to parse into sentences the NMEA stream coming from a U-Blox GPS module.
|
||||||
|
|
||||||
?4|https://github.com/stripcode/pigpio-stepper-motor|2016-08-12|Stepper Motor
|
?4|https://github.com/stripcode/pigpio-stepper-motor|2016-08-12|Stepper Motor
|
||||||
Stepper motor code.
|
Stepper motor code.
|
||||||
|
|
||||||
|
|
|
@ -524,9 +524,6 @@ The output process is simple. You simply append data to the FIFO
|
||||||
buffer on the chip. This works like a queue, you add data to the
|
buffer on the chip. This works like a queue, you add data to the
|
||||||
queue and the master removes it.
|
queue and the master removes it.
|
||||||
|
|
||||||
I can't get SPI to work properly. I tried with a
|
|
||||||
control word of 0x303 and swapped MISO and MOSI.
|
|
||||||
|
|
||||||
The command sets the BSC mode and writes any data [*bvs*]
|
The command sets the BSC mode and writes any data [*bvs*]
|
||||||
to the BSC transmit FIFO. It returns the data count (at least 1
|
to the BSC transmit FIFO. It returns the data count (at least 1
|
||||||
for the status word), the status word, followed by any data bytes
|
for the status word), the status word, followed by any data bytes
|
||||||
|
@ -543,13 +540,13 @@ GPIO used for models other than those based on the BCM2711.
|
||||||
|
|
||||||
@ SDA @ SCL @ MOSI @ SCLK @ MISO @ CE
|
@ SDA @ SCL @ MOSI @ SCLK @ MISO @ CE
|
||||||
I2C @ 18 @ 19 @ - @ - @ - @ -
|
I2C @ 18 @ 19 @ - @ - @ - @ -
|
||||||
SPI @ - @ - @ 18 @ 19 @ 20 @ 21
|
SPI @ - @ - @ 20 @ 19 @ 18 @ 21
|
||||||
|
|
||||||
GPIO used for models based on the BCM2711 (e.g. the Pi4B).
|
GPIO used for models based on the BCM2711 (e.g. the Pi4B).
|
||||||
|
|
||||||
@ SDA @ SCL @ MOSI @ SCLK @ MISO @ CE
|
@ SDA @ SCL @ MOSI @ SCLK @ MISO @ CE
|
||||||
I2C @ 10 @ 11 @ - @ - @ - @ -
|
I2C @ 10 @ 11 @ - @ - @ - @ -
|
||||||
SPI @ - @ - @ 10 @ 11 @ 9 @ 8
|
SPI @ - @ - @ 9 @ 11 @ 10 @ 8
|
||||||
|
|
||||||
When a zero control word is received the used GPIO will be reset
|
When a zero control word is received the used GPIO will be reset
|
||||||
to INPUT mode.
|
to INPUT mode.
|
||||||
|
@ -647,6 +644,35 @@ $ pigs i2crd 0 5
|
||||||
5 22 33 44 55 66
|
5 22 33 44 55 66
|
||||||
...
|
...
|
||||||
|
|
||||||
|
The BSC slave in SPI mode deserializes data from the MOSI pin into its receiver/
|
||||||
|
FIFO when the LSB of the first byte is a 0. No data is output on the MISO pin.
|
||||||
|
When the LSB of the first byte on MOSI is a 1, the transmitter/FIFO data is
|
||||||
|
serialized onto the MISO pin while all other data on the MOSI pin is ignored.
|
||||||
|
|
||||||
|
The BK bit of the BSC control register is non-functional when in the SPI mode.
|
||||||
|
The transmitter along with its FIFO can be dequeued by successively disabling
|
||||||
|
and re-enabling the TE bit on the BSC control register while in SPI mode.
|
||||||
|
|
||||||
|
This example demonstrates a SPI master talking to the BSC as SPI slave:
|
||||||
|
Requires SPI master SCLK / MOSI / MISO / CE GPIO are connected to
|
||||||
|
BSC peripheral GPIO 11 / 9 / 10 / 8 respectively, on a Pi4B (BCM2711).
|
||||||
|
|
||||||
|
...
|
||||||
|
$ pigs bspio 15 26 13 14 10000 0 # open bit-bang spi master on random gpio
|
||||||
|
|
||||||
|
$ pigs bscx 0x303 # start BSC as SPI slave, both rx and tx enabled
|
||||||
|
1 18
|
||||||
|
|
||||||
|
$ pigs bspix 15 0 0xd 0xe 0xa 0xd # write 0xdead to BSC
|
||||||
|
5 0 0 0 0 0
|
||||||
|
|
||||||
|
$ pigs bscx 0x303 0xb 0xe 0xe 0xf # place 0xbeef in BSC tx FIFO, read rx FIFO
|
||||||
|
5 262338 13 14 10 13
|
||||||
|
|
||||||
|
$ pigs bspix 15 1 0 0 0 0 # read four bytes from BSC
|
||||||
|
5 0 11 14 14 15
|
||||||
|
...
|
||||||
|
|
||||||
BSPIC ::
|
BSPIC ::
|
||||||
|
|
||||||
This command stops bit banging SPI on a set of GPIO
|
This command stops bit banging SPI on a set of GPIO
|
||||||
|
|
|
@ -622,33 +622,50 @@ Languages</h3>
|
||||||
for pigpio.<br></p>
|
for pigpio.<br></p>
|
||||||
<p>Some are listed here:<br></p>
|
<p>Some are listed here:<br></p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="https://github.com/skvamme/pigpio">Erlang</a>
|
|
||||||
(skvamme)</li>
|
<li><a href="https://hub.docker.com/r/zinen2/alpine-pigpiod">Docker</a>
|
||||||
|
Note that pigpio does not support or accept issues relating to problems of running in docker. Use the docker projects own <a href="https://github.com/zinen/docker-alpine-pigpiod/issues">issue tracker</a> for that (zinen)</li>
|
||||||
|
|
||||||
|
<li><a href="https://github.com/skvamme/pigpio">Erlang</a>(skvamme)</li>
|
||||||
|
|
||||||
|
<li><a href="https://elinux.org/Forth#PIGPIO">Forth</a>(skvamme)</li>
|
||||||
|
|
||||||
<li><a href="https://github.com/mattjlewis/pigpioj">Java</a> JNI
|
<li><a href="https://github.com/mattjlewis/pigpioj">Java</a> JNI
|
||||||
wrapper around the pigpio C library (mattlewis)</li>
|
wrapper around the pigpio C library (mattlewis)</li>
|
||||||
|
|
||||||
<li><a href="https://github.com/mattjlewis/diozero">Java</a> via
|
<li><a href="https://github.com/mattjlewis/diozero">Java</a> via
|
||||||
diozero, a high level wrapper around pigpio, Pi4J, wiringPi etc
|
diozero, a high level wrapper around pigpio, Pi4J, wiringPi etc
|
||||||
(mattlewis)</li>
|
(mattlewis)</li>
|
||||||
|
|
||||||
<li><a href="https://github.com/nkolban/jpigpio">Java</a>
|
<li><a href="https://github.com/nkolban/jpigpio">Java</a>
|
||||||
(nkolban)</li>
|
(nkolban)</li>
|
||||||
|
|
||||||
<li><a href=
|
<li><a href=
|
||||||
"https://github.com/unosquare/pigpio-dotnet">.NET/mono</a>
|
"https://github.com/unosquare/pigpio-dotnet">.NET/mono</a>
|
||||||
(unosquare)</li>
|
(unosquare)</li>
|
||||||
|
|
||||||
<li><a href="https://github.com/fivdi/pigpio">Node.js</a>
|
<li><a href="https://github.com/fivdi/pigpio">Node.js</a>
|
||||||
A wrapper for the pigpio C library (fivdi)</li>
|
A wrapper for the pigpio C library (fivdi)</li>
|
||||||
|
|
||||||
<li><a href="https://github.com/guymcswain/pigpio-client">Node.js</a>
|
<li><a href="https://github.com/guymcswain/pigpio-client">Node.js</a>
|
||||||
A client for pigpio socket interface (guymcswain)</li>
|
A client for pigpio socket interface (guymcswain)</li>
|
||||||
|
|
||||||
<li><a href="https://metacpan.org/pod/RPi::PIGPIO">Perl</a> (Gligan
|
<li><a href="https://metacpan.org/pod/RPi::PIGPIO">Perl</a> (Gligan
|
||||||
Calin Horea)</li>
|
Calin Horea)</li>
|
||||||
|
|
||||||
<li><a href=
|
<li><a href=
|
||||||
"https://github.com/nak1114/ruby-extension-pigpio">Ruby</a>
|
"https://github.com/nak1114/ruby-extension-pigpio">Ruby</a>
|
||||||
(Nak)</li>
|
(Nak)</li>
|
||||||
|
|
||||||
<li><a href=
|
<li><a href=
|
||||||
"https://github.com/vasmalltalk/pigpio-vast">Smalltalk</a>(Instantiations)</li>
|
"https://github.com/vasmalltalk/pigpio-vast">Smalltalk</a>(Instantiations)</li>
|
||||||
|
|
||||||
<li><a href=
|
<li><a href=
|
||||||
"https://github.com/UBogun/Xojo-pigpio">Xojo</a>(UBogun)</li>
|
"https://github.com/UBogun/Xojo-pigpio">Xojo</a>(UBogun)</li>
|
||||||
|
|
||||||
<li><a href=
|
<li><a href=
|
||||||
"https://github.com/eugenedakin/pigpio-GPIO">Xojo</a>(Eugene Dakin)</li>
|
"https://github.com/eugenedakin/pigpio-GPIO">Xojo</a>(Eugene Dakin)</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
<hr style="width: 100%; height: 2px;">
|
<hr style="width: 100%; height: 2px;">
|
||||||
<p><font size="-2">The PWM and servo pulses are timed using the DMA
|
<p><font size="-2">The PWM and servo pulses are timed using the DMA
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Python Class for Reading Single Edge Nibble Transmission (SENT) using the Raspberry Pi
|
||||||
|
|
||||||
|
A full description of this Python script is described at [www.surfncircuits.com](https://surfncircuits.com) in the blog entry: [Implementing a Single Edge Nibble Transmission (SENT) protocol in Python for the Raspberry Pi Zero](https://surfncircuits.com/?p=3725)
|
||||||
|
|
||||||
|
|
||||||
|
This python library will read a Raspberry Pi GPIO pin connected. Start the pigpiod daemon with one microsecond sampling to read SENT transmissions with three microsecond tick times.
|
||||||
|
|
||||||
|
## To start the daemon on Raspberry Pi
|
||||||
|
- sudo pigpiod -s 1
|
||||||
|
|
||||||
|
## SENT packet frame summary
|
||||||
|
|
||||||
|
- Sync Pulse: 56 ticks
|
||||||
|
- 4 bit Status and Message Pulse: 17-32 ticks
|
||||||
|
- 4 bit (9:12) Data1 Field: 17-32 ticks
|
||||||
|
- 4 bit (5:8) Data1 Field: 17-32 ticks
|
||||||
|
- 4 bit (1:4) Data1 Field: 17-32 ticks
|
||||||
|
- 4 bit (9-12) Data2 Field: 17-32 ticks
|
||||||
|
- 4 bit (5-8) Data2 Field: 17-32 ticks
|
||||||
|
- 4 bit (1-4) Data2 Field: 17-32 ticks
|
||||||
|
- 4 bit CRC: 17-32 ticks
|
||||||
|
|
||||||
|
|
||||||
|
## requirements
|
||||||
|
[pigpiod](http://abyz.me.uk/rpi/pigpio/) library required
|
||||||
|
|
||||||
|
## To run the script for a signal attached to GPIO BCD 18 (pin 12)
|
||||||
|
- python3 sent_READ.py
|
|
@ -0,0 +1,322 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
# read_PWM.py
|
||||||
|
# Public Domain by mark smith, www.surfncircuits.com
|
||||||
|
# blog:https://surfncircuits.com/2020/11/27/implementing-a-single-edge-nibble-transmission-sent-protocol-in-python-for-the-raspberry-pi-zero/
|
||||||
|
|
||||||
|
import time
|
||||||
|
import pigpio # http://abyz.co.uk/rpi/pigpio/python.html
|
||||||
|
import threading
|
||||||
|
|
||||||
|
class SENTReader:
|
||||||
|
"""
|
||||||
|
A class to read short Format SENT frames
|
||||||
|
(see the LX3302A datasheet for a SENT reference from Microchip)
|
||||||
|
(also using sent transmission mode where )
|
||||||
|
from wikiPedia: The SAE J2716 SENT (Single Edge Nibble Transmission) protocol
|
||||||
|
is a point-to-point scheme for transmitting signal values
|
||||||
|
from a sensor to a controller. It is intended to allow for
|
||||||
|
transmission of high resolution data with a low system cost.
|
||||||
|
|
||||||
|
Short sensor format:
|
||||||
|
The first is the SYNC pulse (56 ticks)
|
||||||
|
first Nibble : Status (4 bits)
|
||||||
|
2nd NIbble : DAta1 (4 bits)
|
||||||
|
3nd Nibble : Data2 (4 bits)
|
||||||
|
4th Nibble : Data3 (4 bits)
|
||||||
|
5th Nibble : Data1 (4 bits)
|
||||||
|
6th Nibble : Data2 (4 bits)
|
||||||
|
7th Nibble : Data3 (4 bits)
|
||||||
|
8th Nibble : CRC (4 bits)
|
||||||
|
"""
|
||||||
|
def __init__(self, pi, gpio, Mode = 0):
|
||||||
|
"""
|
||||||
|
Instantiate with the Pi and gpio of the SENT signal
|
||||||
|
to monitor.
|
||||||
|
SENT mode = A0: Microchip LX3302A where the two 12 bit data values are identical. there are other modes
|
||||||
|
|
||||||
|
"""
|
||||||
|
self.pi = pi
|
||||||
|
self.gpio = gpio
|
||||||
|
self.SENTMode = Mode
|
||||||
|
|
||||||
|
# the time that pulse goes high
|
||||||
|
self._high_tick = 0
|
||||||
|
# the period of the low tick
|
||||||
|
self._low_tick = 0
|
||||||
|
# the period of the pulse (total data)
|
||||||
|
self._period = 0
|
||||||
|
# the time the item was low during the period
|
||||||
|
self._low = 0
|
||||||
|
# the time the output was high during the period
|
||||||
|
self._high = 0
|
||||||
|
# setting initial value to 100
|
||||||
|
self.syncTick = 100
|
||||||
|
|
||||||
|
|
||||||
|
#keep track of the periods
|
||||||
|
self.syncWidth = 0
|
||||||
|
self.status = 0
|
||||||
|
self.data1 = 0
|
||||||
|
self.data2 = 0
|
||||||
|
self.data3 = 0
|
||||||
|
self.data4 = 0
|
||||||
|
self.data5 = 0
|
||||||
|
self.data6 = 0
|
||||||
|
self.crc = 0
|
||||||
|
#initize the sent frame . Need to use hex for data
|
||||||
|
#self.frame = [0,0,0,'0x0','0x0','0x0','0x0','0x0','0x0',0]
|
||||||
|
self.frame = [0,0,0,0,0,0,0,0,0,0]
|
||||||
|
self.syncFound = False
|
||||||
|
self.frameComplete = False
|
||||||
|
self.nibble = 0
|
||||||
|
self.numberFrames = 0
|
||||||
|
self.SampleStopped = False
|
||||||
|
|
||||||
|
self.pi.set_mode(gpio, pigpio.INPUT)
|
||||||
|
|
||||||
|
#self._cb = pi.callback(gpio, pigpio.EITHER_EDGE, self._cbf)
|
||||||
|
#sleep enougth to start reading SENT
|
||||||
|
#time.sleep(0.05)
|
||||||
|
|
||||||
|
#start thread to sample the SENT property
|
||||||
|
# this is needed for piGPIO sample of 1us and sensing the 3us
|
||||||
|
self.OutputSampleThread = threading.Thread(target = self.SampleCallBack)
|
||||||
|
self.OutputSampleThread.daemon = True
|
||||||
|
self.OutputSampleThread.start()
|
||||||
|
|
||||||
|
#give time for thread to start capturing data
|
||||||
|
time.sleep(.05)
|
||||||
|
|
||||||
|
|
||||||
|
def SampleCallBack(self):
|
||||||
|
|
||||||
|
# this will run in a loop and sample the SENT path
|
||||||
|
# this sampling is required when 1us sample rate for SENT 3us tick time
|
||||||
|
while True:
|
||||||
|
|
||||||
|
self.SampleStopped = False
|
||||||
|
self._cb = self.pi.callback(self.gpio, pigpio.EITHER_EDGE, self._cbf)
|
||||||
|
# wait until sample stopped
|
||||||
|
while self.SampleStopped == False:
|
||||||
|
#do nothing
|
||||||
|
time.sleep(.001)
|
||||||
|
|
||||||
|
# gives the callback time to cancel so we can start again.
|
||||||
|
time.sleep(0.20)
|
||||||
|
|
||||||
|
def _cbf(self, gpio, level, tick):
|
||||||
|
# depending on the system state set the tick times.
|
||||||
|
# first look for sync pulse. this is found when duty ratio >90
|
||||||
|
#print(pgio)
|
||||||
|
#print("inside _cpf")
|
||||||
|
#print(tick)
|
||||||
|
if self.syncFound == False:
|
||||||
|
if level == 1:
|
||||||
|
self._high_tick = tick
|
||||||
|
self._low = pigpio.tickDiff(self._low_tick,tick)
|
||||||
|
elif level == 0:
|
||||||
|
# this may be a syncpulse if the duty is 51/56
|
||||||
|
self._period = pigpio.tickDiff(self._low_tick,tick)
|
||||||
|
# not reset the self._low_tick
|
||||||
|
self._low_tick = tick
|
||||||
|
self._high = pigpio.tickDiff(self._high_tick,tick)
|
||||||
|
# sync pulse is detected by finding duty ratio. 51/56
|
||||||
|
# but also filter if period is > 90us*56 = 5040
|
||||||
|
if (100*self._high/self._period) > 87 and (self._period<5100):
|
||||||
|
self.syncFound = True
|
||||||
|
self.syncWidth = self._high
|
||||||
|
self.syncPeriod = self._period
|
||||||
|
#self.syncTick = round(self.syncPeriod/56.0,2)
|
||||||
|
self.syncTick = self.syncPeriod
|
||||||
|
# reset the nibble to zero
|
||||||
|
self.nibble = 0
|
||||||
|
self.SampleStopped = False
|
||||||
|
else:
|
||||||
|
# now look for the nibble information for each nibble (8 Nibbles)
|
||||||
|
if level == 1:
|
||||||
|
self._high_tick = tick
|
||||||
|
self._low = pigpio.tickDiff(self._low_tick,tick)
|
||||||
|
elif level == 0:
|
||||||
|
# This will be a data nibble
|
||||||
|
self._period = pigpio.tickDiff(self._low_tick,tick)
|
||||||
|
# not reset the self._low_tick
|
||||||
|
self._low_tick = tick
|
||||||
|
self._high = pigpio.tickDiff(self._high_tick,tick)
|
||||||
|
self.nibble = self.nibble + 1
|
||||||
|
if self.nibble == 1:
|
||||||
|
self.status = self._period
|
||||||
|
elif self.nibble == 2:
|
||||||
|
#self.data1 = hex(int(round(self._period / self.syncTick)-12))
|
||||||
|
self.data1 = self._period
|
||||||
|
elif self.nibble == 3:
|
||||||
|
self.data2 = self._period
|
||||||
|
elif self.nibble == 4:
|
||||||
|
self.data3 = self._period
|
||||||
|
elif self.nibble == 5:
|
||||||
|
self.data4 = self._period
|
||||||
|
elif self.nibble == 6:
|
||||||
|
self.data5 = self._period
|
||||||
|
elif self.nibble == 7:
|
||||||
|
self.data6 = self._period
|
||||||
|
elif self.nibble == 8:
|
||||||
|
self.crc = self._period
|
||||||
|
# now send all to the SENT Frame
|
||||||
|
self.frame = [self.syncPeriod,self.syncTick,self.status,self.data1,self.data2,self.data3,self.data4,self.data5,self.data6,self.crc]
|
||||||
|
self.syncFound = False
|
||||||
|
self.nibble = 0
|
||||||
|
self.numberFrames += 1
|
||||||
|
if self.numberFrames > 2:
|
||||||
|
self.cancel()
|
||||||
|
self.SampleStopped = True
|
||||||
|
self.numberFrames = 0
|
||||||
|
|
||||||
|
def ConvertData(self,tickdata,tickTime):
|
||||||
|
if tickdata == 0:
|
||||||
|
t = '0x0'
|
||||||
|
else:
|
||||||
|
t = hex(int(round(tickdata / tickTime)-12))
|
||||||
|
if t[0] =='-':
|
||||||
|
t='0x0'
|
||||||
|
return t
|
||||||
|
|
||||||
|
def SENTData(self):
|
||||||
|
# check that data1 = Data2 if they are not equal return fault = True
|
||||||
|
# will check the CRC code for faults. if fault, return = true
|
||||||
|
# returns status, data1, data2, crc, fault
|
||||||
|
#self._cb = self.pi.callback(self.gpio, pigpio.EITHER_EDGE, self._cbf)
|
||||||
|
#time.sleep(0.1)
|
||||||
|
fault = False
|
||||||
|
SentFrame = self.frame[:]
|
||||||
|
SENTTick = round(SentFrame[1]/56.0,2)
|
||||||
|
|
||||||
|
# the greatest SYNC sync is 90us. So trip a fault if this occurs
|
||||||
|
if SENTTick > 90:
|
||||||
|
fault = True
|
||||||
|
|
||||||
|
#print(SentFrame)
|
||||||
|
# convert SentFrame to HEX Format including the status and Crc bits
|
||||||
|
for x in range (2,10):
|
||||||
|
SentFrame[x] = self.ConvertData(SentFrame[x],SENTTick)
|
||||||
|
SENTCrc = SentFrame[9]
|
||||||
|
SENTStatus = SentFrame[2]
|
||||||
|
SENTPeriod = SentFrame[0]
|
||||||
|
#print(SentFrame)
|
||||||
|
# combine the datafield nibbles
|
||||||
|
datanibble = '0x'
|
||||||
|
datanibble2 = '0x'
|
||||||
|
for x in range (3,6):
|
||||||
|
datanibble = datanibble + str((SentFrame[x]))[2:]
|
||||||
|
for x in range (6,9):
|
||||||
|
datanibble2 = datanibble2 + str((SentFrame[x]))[2:]
|
||||||
|
# if using SENT mode 0, then data nibbles should be equal
|
||||||
|
#if self.SENTMode == 0 :
|
||||||
|
# if datanibble != datanibble2:
|
||||||
|
# fault = True
|
||||||
|
# if datanibble or datanibble2 == 0 then fault = true
|
||||||
|
if (int(datanibble,16) == 0) or (int(datanibble2,16) ==0):
|
||||||
|
fault = True
|
||||||
|
# if datanibble or datanibble2 > FFF (4096) then fault = True
|
||||||
|
if ( (int(datanibble,16) > 0xFFF) or (int(datanibble2,16) > 0xFFF)):
|
||||||
|
fault = True
|
||||||
|
#print(datanibble)
|
||||||
|
# CRC checking
|
||||||
|
# converting the datanibble values to a binary bit string.
|
||||||
|
# remove the first two characters. Not needed for crcCheck
|
||||||
|
InputBitString = bin(int((datanibble + datanibble2[2:]),16))[2:]
|
||||||
|
# converting Crcvalue to bin but remove the first two characters 0b
|
||||||
|
# format is set to remove the leading 0b, 4 charactors long
|
||||||
|
crcBitValue = format(int(str(SENTCrc),16),'04b')
|
||||||
|
#checking the crcValue
|
||||||
|
# polybitstring is 1*X^4+1*X^3+1*x^2+0*X+1 = '11101'
|
||||||
|
if self.crcCheck(InputBitString,'11101',crcBitValue) == False:
|
||||||
|
fault = True
|
||||||
|
|
||||||
|
# converter to decimnal
|
||||||
|
returnData = int(datanibble,16)
|
||||||
|
returnData2 = int(datanibble2,16)
|
||||||
|
#returns both Data values and if there is a FAULT
|
||||||
|
return (SENTStatus, returnData, returnData2,SENTTick, SENTCrc, fault, SENTPeriod)
|
||||||
|
|
||||||
|
def tick(self):
|
||||||
|
status, data1, data2, ticktime, crc, errors, syncPulse = self.SENTData()
|
||||||
|
return ticktime
|
||||||
|
|
||||||
|
def crcNibble(self):
|
||||||
|
status, data1, data2, ticktime, crc, errors, syncPulse = self.SENTData()
|
||||||
|
return crc
|
||||||
|
|
||||||
|
def dataField1(self):
|
||||||
|
status, data1, data2, ticktime, crc, errors, syncPulse = self.SENTData()
|
||||||
|
return data1
|
||||||
|
|
||||||
|
def dataField2(self):
|
||||||
|
status, data1, data2, ticktime, crc, errors, syncPulse = self.SENTData()
|
||||||
|
return data2
|
||||||
|
|
||||||
|
def statusNibble(self):
|
||||||
|
status, data1, data2, ticktime, crc, errors, syncPulse = self.SENTData()
|
||||||
|
return status
|
||||||
|
|
||||||
|
def syncPulse(self):
|
||||||
|
status, data1, data2, ticktime, crc, errors, syncPulse = self.SENTData()
|
||||||
|
return syncPulse
|
||||||
|
|
||||||
|
def errorFrame(self):
|
||||||
|
status, data1, data2, ticktime, crc, errors, syncPulse = self.SENTData()
|
||||||
|
return errors
|
||||||
|
|
||||||
|
def cancel(self):
|
||||||
|
self._cb.cancel()
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
self.OutputSampleThread.stop()
|
||||||
|
|
||||||
|
def crcCheck(self, InputBitString, PolyBitString, crcValue ):
|
||||||
|
# the input string will be a binary string all 6 nibbles of the SENT data
|
||||||
|
# the seed value ( = '0101) is appended to the input string. Do not use zeros for SENT protocal
|
||||||
|
# this uses the SENT CRC recommended implementation.
|
||||||
|
checkOK = False
|
||||||
|
|
||||||
|
LenPolyBitString = len(PolyBitString)
|
||||||
|
PolyBitString = PolyBitString.lstrip('0')
|
||||||
|
LenInput = len(InputBitString)
|
||||||
|
InputPaddedArray = list(InputBitString + '0101')
|
||||||
|
while '1' in InputPaddedArray[:LenInput]:
|
||||||
|
cur_shift = InputPaddedArray.index('1')
|
||||||
|
for i in range(len(PolyBitString)):
|
||||||
|
InputPaddedArray[cur_shift + i] = str(int(PolyBitString[i] != InputPaddedArray[cur_shift + i]))
|
||||||
|
|
||||||
|
if (InputPaddedArray[LenInput:] == list(crcValue)):
|
||||||
|
checkOK = True
|
||||||
|
|
||||||
|
return checkOK
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
import time
|
||||||
|
import pigpio
|
||||||
|
import read_SENT
|
||||||
|
|
||||||
|
SENT_GPIO = 18
|
||||||
|
RUN_TIME = 6000000000.0
|
||||||
|
SAMPLE_TIME = 0.1
|
||||||
|
|
||||||
|
pi = pigpio.pi()
|
||||||
|
|
||||||
|
p = read_SENT.SENTReader(pi, SENT_GPIO)
|
||||||
|
|
||||||
|
start = time.time()
|
||||||
|
|
||||||
|
while (time.time() - start) < RUN_TIME:
|
||||||
|
|
||||||
|
time.sleep(SAMPLE_TIME)
|
||||||
|
|
||||||
|
status, data1, data2, ticktime, crc, errors, syncPulse = p.SENTData()
|
||||||
|
print("Sent Status= %s - 12-bit DATA 1= %4.0f - DATA 2= %4.0f - tickTime(uS)= %4.2f - CRC= %s - Errors= %s - PERIOD = %s" % (status,data1,data2,ticktime,crc,errors,syncPulse))
|
||||||
|
print("Sent Stat2s= %s - 12-bit DATA 1= %4.0f - DATA 2= %4.0f - tickTime(uS)= %4.2f - CRC= %s - Errors= %s - PERIOD = %s" % (p.statusNibble(),p.dataField1(),p.dataField2(),p.tick(),p.crcNibble(),p.errorFrame(),p.syncPulse()))
|
||||||
|
|
||||||
|
# stop the thread in SENTReader
|
||||||
|
p.stop()
|
||||||
|
# clear the pi object instance
|
||||||
|
pi.stop()
|
59
pigpio.3
59
pigpio.3
|
@ -4295,12 +4295,6 @@ queue and the master removes it.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
|
|
||||||
.br
|
|
||||||
I can't get SPI to work properly. I tried with a
|
|
||||||
control word of 0x303 and swapped MISO and MOSI.
|
|
||||||
|
|
||||||
.br
|
|
||||||
|
|
||||||
.br
|
.br
|
||||||
The function sets the BSC mode, writes any data in
|
The function sets the BSC mode, writes any data in
|
||||||
the transmit buffer to the BSC transmit FIFO, and
|
the transmit buffer to the BSC transmit FIFO, and
|
||||||
|
@ -4366,7 +4360,7 @@ GPIO used for models other than those based on the BCM2711.
|
||||||
.br
|
.br
|
||||||
I2C 18 19 - - - -
|
I2C 18 19 - - - -
|
||||||
.br
|
.br
|
||||||
SPI - - 18 19 20 21
|
SPI - - 20 19 18 21
|
||||||
.br
|
.br
|
||||||
|
|
||||||
.br
|
.br
|
||||||
|
@ -4381,7 +4375,7 @@ GPIO used for models based on the BCM2711 (e.g. the Pi4B).
|
||||||
.br
|
.br
|
||||||
I2C 10 11 - - - -
|
I2C 10 11 - - - -
|
||||||
.br
|
.br
|
||||||
SPI - - 10 11 9 8
|
SPI - - 9 11 10 8
|
||||||
.br
|
.br
|
||||||
|
|
||||||
.br
|
.br
|
||||||
|
@ -4495,7 +4489,7 @@ details.
|
||||||
.br
|
.br
|
||||||
SSSSS number of bytes successfully copied to transmit FIFO
|
SSSSS number of bytes successfully copied to transmit FIFO
|
||||||
.br
|
.br
|
||||||
RRRRR number of bytes in receieve FIFO
|
RRRRR number of bytes in receive FIFO
|
||||||
.br
|
.br
|
||||||
TTTTT number of bytes in transmit FIFO
|
TTTTT number of bytes in transmit FIFO
|
||||||
.br
|
.br
|
||||||
|
@ -4554,6 +4548,23 @@ if (status >= 0)
|
||||||
|
|
||||||
.EE
|
.EE
|
||||||
|
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
|
The BSC slave in SPI mode deserializes data from the MOSI pin into its
|
||||||
|
receiver/FIFO when the LSB of the first byte is a 0. No data is output on
|
||||||
|
the MISO pin. When the LSB of the first byte on MOSI is a 1, the
|
||||||
|
transmitter/FIFO data is serialized onto the MISO pin while all other data
|
||||||
|
on the MOSI pin is ignored.
|
||||||
|
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
|
The BK bit of the BSC control register is non-functional when in the SPI
|
||||||
|
mode. The transmitter along with its FIFO can be dequeued by successively
|
||||||
|
disabling and re-enabling the TE bit on the BSC control register while in
|
||||||
|
SPI mode.
|
||||||
|
|
||||||
.IP "\fBint bbSPIOpen(unsigned CS, unsigned MISO, unsigned MOSI, unsigned SCLK, unsigned baud, unsigned spiFlags)\fP"
|
.IP "\fBint bbSPIOpen(unsigned CS, unsigned MISO, unsigned MOSI, unsigned SCLK, unsigned baud, unsigned spiFlags)\fP"
|
||||||
.IP "" 4
|
.IP "" 4
|
||||||
This function selects a set of GPIO for bit banging SPI with
|
This function selects a set of GPIO for bit banging SPI with
|
||||||
|
@ -5908,36 +5919,6 @@ PI_TOO_MANY_PARAM.
|
||||||
param is an array of up to 10 parameters which may be referenced in
|
param is an array of up to 10 parameters which may be referenced in
|
||||||
the script as p0 to p9.
|
the script as p0 to p9.
|
||||||
|
|
||||||
.IP "\fBint gpioRunScript(unsigned script_id, unsigned numPar, uint32_t *param)\fP"
|
|
||||||
.IP "" 4
|
|
||||||
This function runs a stored script.
|
|
||||||
|
|
||||||
.br
|
|
||||||
|
|
||||||
.br
|
|
||||||
|
|
||||||
.EX
|
|
||||||
script_id: >=0, as returned by \fBgpioStoreScript\fP
|
|
||||||
.br
|
|
||||||
numPar: 0-10, the number of parameters
|
|
||||||
.br
|
|
||||||
param: an array of parameters
|
|
||||||
.br
|
|
||||||
|
|
||||||
.EE
|
|
||||||
|
|
||||||
.br
|
|
||||||
|
|
||||||
.br
|
|
||||||
The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID, or
|
|
||||||
PI_TOO_MANY_PARAM.
|
|
||||||
|
|
||||||
.br
|
|
||||||
|
|
||||||
.br
|
|
||||||
param is an array of up to 10 parameters which may be referenced in
|
|
||||||
the script as p0 to p9.
|
|
||||||
|
|
||||||
.IP "\fBint gpioUpdateScript(unsigned script_id, unsigned numPar, uint32_t *param)\fP"
|
.IP "\fBint gpioUpdateScript(unsigned script_id, unsigned numPar, uint32_t *param)\fP"
|
||||||
.IP "" 4
|
.IP "" 4
|
||||||
This function sets the parameters of a script. The script may or
|
This function sets the parameters of a script. The script may or
|
||||||
|
|
48
pigpio.c
48
pigpio.c
|
@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE.
|
||||||
For more information, please refer to <http://unlicense.org/>
|
For more information, please refer to <http://unlicense.org/>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* pigpio version 78 */
|
/* pigpio version 79 */
|
||||||
|
|
||||||
/* include ------------------------------------------------------- */
|
/* include ------------------------------------------------------- */
|
||||||
|
|
||||||
|
@ -4116,7 +4116,7 @@ int i2cOpen(unsigned i2cBus, unsigned i2cAddr, unsigned i2cFlags)
|
||||||
i2cInfo[slot].addr = i2cAddr;
|
i2cInfo[slot].addr = i2cAddr;
|
||||||
i2cInfo[slot].flags = i2cFlags;
|
i2cInfo[slot].flags = i2cFlags;
|
||||||
i2cInfo[slot].funcs = funcs;
|
i2cInfo[slot].funcs = funcs;
|
||||||
i2cInfo[i].state = PI_I2C_OPENED;
|
i2cInfo[slot].state = PI_I2C_OPENED;
|
||||||
|
|
||||||
return slot;
|
return slot;
|
||||||
}
|
}
|
||||||
|
@ -10924,7 +10924,7 @@ int bbI2CZip(
|
||||||
|
|
||||||
void bscInit(int mode)
|
void bscInit(int mode)
|
||||||
{
|
{
|
||||||
int sda, scl, miso, ce;
|
int sda, scl, mosi, miso, ce;
|
||||||
|
|
||||||
bscsReg[BSC_CR]=0; /* clear device */
|
bscsReg[BSC_CR]=0; /* clear device */
|
||||||
bscsReg[BSC_RSR]=0; /* clear underrun and overrun errors */
|
bscsReg[BSC_RSR]=0; /* clear underrun and overrun errors */
|
||||||
|
@ -10934,32 +10934,39 @@ void bscInit(int mode)
|
||||||
|
|
||||||
if (pi_is_2711)
|
if (pi_is_2711)
|
||||||
{
|
{
|
||||||
sda = BSC_SDA_MOSI_2711;
|
sda = BSC_SDA_2711;
|
||||||
scl = BSC_SCL_SCLK_2711;
|
scl = BSC_SCL_SCLK_2711;
|
||||||
|
mosi = BSC_MOSI_2711;
|
||||||
miso = BSC_MISO_2711;
|
miso = BSC_MISO_2711;
|
||||||
ce = BSC_CE_N_2711;
|
ce = BSC_CE_N_2711;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sda = BSC_SDA_MOSI;
|
sda = BSC_SDA;
|
||||||
scl = BSC_SCL_SCLK;
|
scl = BSC_SCL_SCLK;
|
||||||
|
mosi = BSC_MOSI;
|
||||||
miso = BSC_MISO;
|
miso = BSC_MISO;
|
||||||
ce = BSC_CE_N;
|
ce = BSC_CE_N;
|
||||||
}
|
}
|
||||||
|
|
||||||
gpioSetMode(sda, PI_ALT3);
|
|
||||||
gpioSetMode(scl, PI_ALT3);
|
|
||||||
|
|
||||||
if (mode > 1) /* SPI uses all GPIO */
|
if (mode > 1) /* SPI uses all GPIO */
|
||||||
{
|
{
|
||||||
|
gpioSetMode(scl, PI_ALT3);
|
||||||
|
gpioSetMode(mosi, PI_ALT3);
|
||||||
gpioSetMode(miso, PI_ALT3);
|
gpioSetMode(miso, PI_ALT3);
|
||||||
gpioSetMode(ce, PI_ALT3);
|
gpioSetMode(ce, PI_ALT3);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gpioSetMode(scl, PI_ALT3);
|
||||||
|
gpioSetMode(sda, PI_ALT3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void bscTerm(int mode)
|
void bscTerm(int mode)
|
||||||
{
|
{
|
||||||
int sda, scl, miso, ce;
|
int sda, scl, mosi, miso, ce;
|
||||||
|
|
||||||
bscsReg[BSC_CR] = 0; /* clear device */
|
bscsReg[BSC_CR] = 0; /* clear device */
|
||||||
bscsReg[BSC_RSR]=0; /* clear underrun and overrun errors */
|
bscsReg[BSC_RSR]=0; /* clear underrun and overrun errors */
|
||||||
|
@ -10967,27 +10974,35 @@ void bscTerm(int mode)
|
||||||
|
|
||||||
if (pi_is_2711)
|
if (pi_is_2711)
|
||||||
{
|
{
|
||||||
sda = BSC_SDA_MOSI_2711;
|
sda = BSC_SDA_2711;
|
||||||
scl = BSC_SCL_SCLK_2711;
|
scl = BSC_SCL_SCLK_2711;
|
||||||
|
mosi = BSC_MOSI_2711;
|
||||||
miso = BSC_MISO_2711;
|
miso = BSC_MISO_2711;
|
||||||
ce = BSC_CE_N_2711;
|
ce = BSC_CE_N_2711;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sda = BSC_SDA_MOSI;
|
sda = BSC_SDA;
|
||||||
scl = BSC_SCL_SCLK;
|
scl = BSC_SCL_SCLK;
|
||||||
|
mosi = BSC_MOSI;
|
||||||
miso = BSC_MISO;
|
miso = BSC_MISO;
|
||||||
ce = BSC_CE_N;
|
ce = BSC_CE_N;
|
||||||
}
|
}
|
||||||
|
|
||||||
gpioSetMode(sda, PI_INPUT);
|
|
||||||
gpioSetMode(scl, PI_INPUT);
|
|
||||||
|
|
||||||
if (mode > 1)
|
if (mode > 1)
|
||||||
{
|
{
|
||||||
|
gpioSetMode(scl, PI_INPUT);
|
||||||
|
gpioSetMode(mosi, PI_INPUT);
|
||||||
gpioSetMode(miso, PI_INPUT);
|
gpioSetMode(miso, PI_INPUT);
|
||||||
gpioSetMode(ce, PI_INPUT);
|
gpioSetMode(ce, PI_INPUT);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gpioSetMode(sda, PI_INPUT);
|
||||||
|
gpioSetMode(scl, PI_INPUT);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int bscXfer(bsc_xfer_t *xfer)
|
int bscXfer(bsc_xfer_t *xfer)
|
||||||
|
@ -12488,8 +12503,11 @@ int gpioSetTimerFunc(unsigned id, unsigned millis, gpioTimerFunc_t f)
|
||||||
if (id > PI_MAX_TIMER)
|
if (id > PI_MAX_TIMER)
|
||||||
SOFT_ERROR(PI_BAD_TIMER, "bad timer id (%d)", id);
|
SOFT_ERROR(PI_BAD_TIMER, "bad timer id (%d)", id);
|
||||||
|
|
||||||
if ((millis < PI_MIN_MS) || (millis > PI_MAX_MS))
|
if (f)
|
||||||
SOFT_ERROR(PI_BAD_MS, "timer %d, bad millis (%d)", id, millis);
|
{
|
||||||
|
if ((millis < PI_MIN_MS) || (millis > PI_MAX_MS))
|
||||||
|
SOFT_ERROR(PI_BAD_MS, "timer %d, bad millis (%d)", id, millis);
|
||||||
|
}
|
||||||
|
|
||||||
intGpioSetTimerFunc(id, millis, f, 0, NULL);
|
intGpioSetTimerFunc(id, millis, f, 0, NULL);
|
||||||
|
|
||||||
|
@ -13754,7 +13772,7 @@ unsigned gpioHardwareRevision(void)
|
||||||
|
|
||||||
if ((rev & 0x800000) == 0) /* old rev code */
|
if ((rev & 0x800000) == 0) /* old rev code */
|
||||||
{
|
{
|
||||||
if (rev < 0x0016) /* all BCM2835 */
|
if ((rev > 0) && (rev < 0x0016)) /* all BCM2835 */
|
||||||
{
|
{
|
||||||
pi_ispi = 1;
|
pi_ispi = 1;
|
||||||
piCores = 1;
|
piCores = 1;
|
||||||
|
|
51
pigpio.h
51
pigpio.h
|
@ -27,10 +27,11 @@ For more information, please refer to <http://unlicense.org/>
|
||||||
#ifndef PIGPIO_H
|
#ifndef PIGPIO_H
|
||||||
#define PIGPIO_H
|
#define PIGPIO_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
#define PIGPIO_VERSION 78
|
#define PIGPIO_VERSION 79
|
||||||
|
|
||||||
/*TEXT
|
/*TEXT
|
||||||
|
|
||||||
|
@ -802,14 +803,16 @@ typedef void *(gpioThreadFunc_t) (void *);
|
||||||
|
|
||||||
/* BSC GPIO */
|
/* BSC GPIO */
|
||||||
|
|
||||||
#define BSC_SDA_MOSI 18
|
#define BSC_SDA 18
|
||||||
|
#define BSC_MOSI 20
|
||||||
#define BSC_SCL_SCLK 19
|
#define BSC_SCL_SCLK 19
|
||||||
#define BSC_MISO 20
|
#define BSC_MISO 18
|
||||||
#define BSC_CE_N 21
|
#define BSC_CE_N 21
|
||||||
|
|
||||||
#define BSC_SDA_MOSI_2711 10
|
#define BSC_SDA_2711 10
|
||||||
|
#define BSC_MOSI_2711 9
|
||||||
#define BSC_SCL_SCLK_2711 11
|
#define BSC_SCL_SCLK_2711 11
|
||||||
#define BSC_MISO_2711 9
|
#define BSC_MISO_2711 10
|
||||||
#define BSC_CE_N_2711 8
|
#define BSC_CE_N_2711 8
|
||||||
|
|
||||||
/* Longest busy delay */
|
/* Longest busy delay */
|
||||||
|
@ -2977,9 +2980,6 @@ The output process is simple. You simply append data to the FIFO
|
||||||
buffer on the chip. This works like a queue, you add data to the
|
buffer on the chip. This works like a queue, you add data to the
|
||||||
queue and the master removes it.
|
queue and the master removes it.
|
||||||
|
|
||||||
I can't get SPI to work properly. I tried with a
|
|
||||||
control word of 0x303 and swapped MISO and MOSI.
|
|
||||||
|
|
||||||
The function sets the BSC mode, writes any data in
|
The function sets the BSC mode, writes any data in
|
||||||
the transmit buffer to the BSC transmit FIFO, and
|
the transmit buffer to the BSC transmit FIFO, and
|
||||||
copies any data in the BSC receive FIFO to the
|
copies any data in the BSC receive FIFO to the
|
||||||
|
@ -3012,13 +3012,13 @@ GPIO used for models other than those based on the BCM2711.
|
||||||
|
|
||||||
@ SDA @ SCL @ MOSI @ SCLK @ MISO @ CE
|
@ SDA @ SCL @ MOSI @ SCLK @ MISO @ CE
|
||||||
I2C @ 18 @ 19 @ - @ - @ - @ -
|
I2C @ 18 @ 19 @ - @ - @ - @ -
|
||||||
SPI @ - @ - @ 18 @ 19 @ 20 @ 21
|
SPI @ - @ - @ 20 @ 19 @ 18 @ 21
|
||||||
|
|
||||||
GPIO used for models based on the BCM2711 (e.g. the Pi4B).
|
GPIO used for models based on the BCM2711 (e.g. the Pi4B).
|
||||||
|
|
||||||
@ SDA @ SCL @ MOSI @ SCLK @ MISO @ CE
|
@ SDA @ SCL @ MOSI @ SCLK @ MISO @ CE
|
||||||
I2C @ 10 @ 11 @ - @ - @ - @ -
|
I2C @ 10 @ 11 @ - @ - @ - @ -
|
||||||
SPI @ - @ - @ 10 @ 11 @ 9 @ 8
|
SPI @ - @ - @ 9 @ 11 @ 10 @ 8
|
||||||
|
|
||||||
When a zero control word is received the used GPIO will be reset
|
When a zero control word is received the used GPIO will be reset
|
||||||
to INPUT mode.
|
to INPUT mode.
|
||||||
|
@ -3071,7 +3071,7 @@ pages 165-166 of the Broadcom peripherals document for full
|
||||||
details.
|
details.
|
||||||
|
|
||||||
SSSSS @ number of bytes successfully copied to transmit FIFO
|
SSSSS @ number of bytes successfully copied to transmit FIFO
|
||||||
RRRRR @ number of bytes in receieve FIFO
|
RRRRR @ number of bytes in receive FIFO
|
||||||
TTTTT @ number of bytes in transmit FIFO
|
TTTTT @ number of bytes in transmit FIFO
|
||||||
RB @ receive busy
|
RB @ receive busy
|
||||||
TE @ transmit FIFO empty
|
TE @ transmit FIFO empty
|
||||||
|
@ -3098,6 +3098,17 @@ if (status >= 0)
|
||||||
// process transfer
|
// process transfer
|
||||||
}
|
}
|
||||||
...
|
...
|
||||||
|
|
||||||
|
The BSC slave in SPI mode deserializes data from the MOSI pin into its
|
||||||
|
receiver/FIFO when the LSB of the first byte is a 0. No data is output on
|
||||||
|
the MISO pin. When the LSB of the first byte on MOSI is a 1, the
|
||||||
|
transmitter/FIFO data is serialized onto the MISO pin while all other data
|
||||||
|
on the MOSI pin is ignored.
|
||||||
|
|
||||||
|
The BK bit of the BSC control register is non-functional when in the SPI
|
||||||
|
mode. The transmitter along with its FIFO can be dequeued by successively
|
||||||
|
disabling and re-enabling the TE bit on the BSC control register while in
|
||||||
|
SPI mode.
|
||||||
D*/
|
D*/
|
||||||
|
|
||||||
/*F*/
|
/*F*/
|
||||||
|
@ -3862,24 +3873,6 @@ param is an array of up to 10 parameters which may be referenced in
|
||||||
the script as p0 to p9.
|
the script as p0 to p9.
|
||||||
D*/
|
D*/
|
||||||
|
|
||||||
/*F*/
|
|
||||||
int gpioRunScript(unsigned script_id, unsigned numPar, uint32_t *param);
|
|
||||||
/*D
|
|
||||||
This function runs a stored script.
|
|
||||||
|
|
||||||
. .
|
|
||||||
script_id: >=0, as returned by [*gpioStoreScript*]
|
|
||||||
numPar: 0-10, the number of parameters
|
|
||||||
param: an array of parameters
|
|
||||||
. .
|
|
||||||
|
|
||||||
The function returns 0 if OK, otherwise PI_BAD_SCRIPT_ID, or
|
|
||||||
PI_TOO_MANY_PARAM.
|
|
||||||
|
|
||||||
param is an array of up to 10 parameters which may be referenced in
|
|
||||||
the script as p0 to p9.
|
|
||||||
D*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*F*/
|
/*F*/
|
||||||
|
|
56
pigpio.py
56
pigpio.py
|
@ -3604,9 +3604,6 @@ class pi():
|
||||||
buffer on the chip. This works like a queue, you add data to the
|
buffer on the chip. This works like a queue, you add data to the
|
||||||
queue and the master removes it.
|
queue and the master removes it.
|
||||||
|
|
||||||
I can't get SPI to work properly. I tried with a
|
|
||||||
control word of 0x303 and swapped MISO and MOSI.
|
|
||||||
|
|
||||||
The function sets the BSC mode, writes any data in
|
The function sets the BSC mode, writes any data in
|
||||||
the transmit buffer to the BSC transmit FIFO, and
|
the transmit buffer to the BSC transmit FIFO, and
|
||||||
copies any data in the BSC receive FIFO to the
|
copies any data in the BSC receive FIFO to the
|
||||||
|
@ -3627,13 +3624,13 @@ class pi():
|
||||||
|
|
||||||
@ SDA @ SCL @ MOSI @ SCLK @ MISO @ CE
|
@ SDA @ SCL @ MOSI @ SCLK @ MISO @ CE
|
||||||
I2C @ 18 @ 19 @ - @ - @ - @ -
|
I2C @ 18 @ 19 @ - @ - @ - @ -
|
||||||
SPI @ - @ - @ 18 @ 19 @ 20 @ 21
|
SPI @ - @ - @ 20 @ 19 @ 18 @ 21
|
||||||
|
|
||||||
GPIO used for models based on the BCM2711 (e.g. the Pi4B).
|
GPIO used for models based on the BCM2711 (e.g. the Pi4B).
|
||||||
|
|
||||||
@ SDA @ SCL @ MOSI @ SCLK @ MISO @ CE
|
@ SDA @ SCL @ MOSI @ SCLK @ MISO @ CE
|
||||||
I2C @ 10 @ 11 @ - @ - @ - @ -
|
I2C @ 10 @ 11 @ - @ - @ - @ -
|
||||||
SPI @ - @ - @ 10 @ 11 @ 9 @ 8
|
SPI @ - @ - @ 9 @ 11 @ 10 @ 8
|
||||||
|
|
||||||
When a zero control word is received the used GPIO will be reset
|
When a zero control word is received the used GPIO will be reset
|
||||||
to INPUT mode.
|
to INPUT mode.
|
||||||
|
@ -3677,7 +3674,7 @@ class pi():
|
||||||
details.
|
details.
|
||||||
|
|
||||||
SSSSS @ number of bytes successfully copied to transmit FIFO
|
SSSSS @ number of bytes successfully copied to transmit FIFO
|
||||||
RRRRR @ number of bytes in receieve FIFO
|
RRRRR @ number of bytes in receive FIFO
|
||||||
TTTTT @ number of bytes in transmit FIFO
|
TTTTT @ number of bytes in transmit FIFO
|
||||||
RB @ receive busy
|
RB @ receive busy
|
||||||
TE @ transmit FIFO empty
|
TE @ transmit FIFO empty
|
||||||
|
@ -3689,6 +3686,50 @@ class pi():
|
||||||
...
|
...
|
||||||
(status, count, data) = pi.bsc_xfer(0x330305, "Hello!")
|
(status, count, data) = pi.bsc_xfer(0x330305, "Hello!")
|
||||||
...
|
...
|
||||||
|
|
||||||
|
The BSC slave in SPI mode deserializes data from the MOSI pin into its
|
||||||
|
receiver/FIFO when the LSB of the first byte is a 0. No data is output on
|
||||||
|
the MISO pin. When the LSB of the first byte on MOSI is a 1, the
|
||||||
|
transmitter/FIFO data is serialized onto the MISO pin while all other data
|
||||||
|
on the MOSI pin is ignored.
|
||||||
|
|
||||||
|
The BK bit of the BSC control register is non-functional when in the SPI
|
||||||
|
mode. The transmitter along with its FIFO can be dequeued by successively
|
||||||
|
disabling and re-enabling the TE bit on the BSC control register while in
|
||||||
|
SPI mode.
|
||||||
|
|
||||||
|
This example demonstrates a SPI master talking to the BSC as SPI slave:
|
||||||
|
Requires SPI master SCLK / MOSI / MISO / CE GPIO are connected to
|
||||||
|
BSC peripheral GPIO 11 / 9 / 10 / 8 respectively, on a Pi4B (BCM2711).
|
||||||
|
|
||||||
|
...
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import pigpio
|
||||||
|
|
||||||
|
# Choose some random GPIO for the bit-bang SPI master
|
||||||
|
CE=15
|
||||||
|
MISO=26
|
||||||
|
MOSI=13
|
||||||
|
SCLK=14
|
||||||
|
|
||||||
|
pi = pigpio.pi()
|
||||||
|
if not pi.connected:
|
||||||
|
exit()
|
||||||
|
|
||||||
|
pi.bb_spi_open(CE, MISO, MOSI, SCLK, 10000, 0) # open SPI master
|
||||||
|
pi.bsc_xfer(0x303, []) # start BSC as SPI slave
|
||||||
|
pi.bb_spi_xfer(CE, '\0' + 'hello') # write 'hello' to BSC
|
||||||
|
status, count, bsc_data = pi.bsc_xfer(0x303, 'world')
|
||||||
|
print bsc_data # hello
|
||||||
|
count, spi_data = pi.bb_spi_xfer(CE, [1,0,0,0,0,0])
|
||||||
|
print spi_data # world
|
||||||
|
|
||||||
|
pi.bsc_xfer(0, [])
|
||||||
|
pi.bb_spi_close(CE)
|
||||||
|
|
||||||
|
pi.stop()
|
||||||
|
...
|
||||||
"""
|
"""
|
||||||
# I p1 control
|
# I p1 control
|
||||||
# I p2 0
|
# I p2 0
|
||||||
|
@ -3716,9 +3757,6 @@ class pi():
|
||||||
"""
|
"""
|
||||||
This function allows the Pi to act as a slave I2C device.
|
This function allows the Pi to act as a slave I2C device.
|
||||||
|
|
||||||
This function is not available on the BCM2711 (e.g. as
|
|
||||||
used in the Pi4B).
|
|
||||||
|
|
||||||
The data bytes (if any) are written to the BSC transmit
|
The data bytes (if any) are written to the BSC transmit
|
||||||
FIFO and the bytes in the BSC receive FIFO are returned.
|
FIFO and the bytes in the BSC receive FIFO are returned.
|
||||||
|
|
||||||
|
|
|
@ -716,7 +716,7 @@ No value is returned.
|
||||||
.br
|
.br
|
||||||
The thread to be stopped should have been started with \fBstart_thread\fP.
|
The thread to be stopped should have been started with \fBstart_thread\fP.
|
||||||
|
|
||||||
.IP "\fBint pigpio_start(char *addrStr, char *portStr)\fP"
|
.IP "\fBint pigpio_start(const char *addrStr, const char *portStr)\fP"
|
||||||
.IP "" 4
|
.IP "" 4
|
||||||
Connect to the pigpio daemon. Reserving command and
|
Connect to the pigpio daemon. Reserving command and
|
||||||
notification streams.
|
notification streams.
|
||||||
|
@ -949,7 +949,8 @@ user_gpio: 0-31.
|
||||||
.br
|
.br
|
||||||
|
|
||||||
.br
|
.br
|
||||||
Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_NOT_PWM_GPIO.
|
Returns current PWM dutycycle if OK,
|
||||||
|
otherwise PI_BAD_USER_GPIO or PI_NOT_PWM_GPIO.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
|
|
||||||
|
@ -6215,12 +6216,6 @@ queue and the master removes it.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
|
|
||||||
.br
|
|
||||||
I can't get SPI to work properly. I tried with a
|
|
||||||
control word of 0x303 and swapped MISO and MOSI.
|
|
||||||
|
|
||||||
.br
|
|
||||||
|
|
||||||
.br
|
.br
|
||||||
The function sets the BSC mode, writes any data in
|
The function sets the BSC mode, writes any data in
|
||||||
the transmit buffer to the BSC transmit FIFO, and
|
the transmit buffer to the BSC transmit FIFO, and
|
||||||
|
@ -6306,7 +6301,7 @@ GPIO used for models other than those based on the BCM2711.
|
||||||
.br
|
.br
|
||||||
I2C 18 19 - - - -
|
I2C 18 19 - - - -
|
||||||
.br
|
.br
|
||||||
SPI - - 18 19 20 21
|
SPI - - 20 19 18 21
|
||||||
.br
|
.br
|
||||||
|
|
||||||
.br
|
.br
|
||||||
|
@ -6321,7 +6316,7 @@ GPIO used for models based on the BCM2711 (e.g. the Pi4B).
|
||||||
.br
|
.br
|
||||||
I2C 10 11 - - - -
|
I2C 10 11 - - - -
|
||||||
.br
|
.br
|
||||||
SPI - - 10 11 9 8
|
SPI - - 9 11 10 8
|
||||||
.br
|
.br
|
||||||
|
|
||||||
.br
|
.br
|
||||||
|
@ -6417,7 +6412,7 @@ details.
|
||||||
.br
|
.br
|
||||||
SSSSS number of bytes successfully copied to transmit FIFO
|
SSSSS number of bytes successfully copied to transmit FIFO
|
||||||
.br
|
.br
|
||||||
RRRRR number of bytes in receieve FIFO
|
RRRRR number of bytes in receive FIFO
|
||||||
.br
|
.br
|
||||||
TTTTT number of bytes in transmit FIFO
|
TTTTT number of bytes in transmit FIFO
|
||||||
.br
|
.br
|
||||||
|
@ -6476,6 +6471,23 @@ if (status >= 0)
|
||||||
|
|
||||||
.EE
|
.EE
|
||||||
|
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
|
The BSC slave in SPI mode deserializes data from the MOSI pin into its
|
||||||
|
receiver/FIFO when the LSB of the first byte is a 0. No data is output on
|
||||||
|
the MISO pin. When the LSB of the first byte on MOSI is a 1, the
|
||||||
|
transmitter/FIFO data is serialized onto the MISO pin while all other data
|
||||||
|
on the MOSI pin is ignored.
|
||||||
|
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
|
The BK bit of the BSC control register is non-functional when in the SPI
|
||||||
|
mode. The transmitter along with its FIFO can be dequeued by successively
|
||||||
|
disabling and re-enabling the TE bit on the BSC control register while in
|
||||||
|
SPI mode.
|
||||||
|
|
||||||
.IP "\fBint bsc_i2c(int pi, int i2c_addr, bsc_xfer_t *bscxfer)\fP"
|
.IP "\fBint bsc_i2c(int pi, int i2c_addr, bsc_xfer_t *bscxfer)\fP"
|
||||||
.IP "" 4
|
.IP "" 4
|
||||||
This function allows the Pi to act as a slave I2C device.
|
This function allows the Pi to act as a slave I2C device.
|
||||||
|
|
|
@ -234,7 +234,7 @@ static int pigpio_command_ext
|
||||||
return cmd.res;
|
return cmd.res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pigpioOpenSocket(char *addrStr, char *portStr)
|
static int pigpioOpenSocket(const char *addrStr, const char *portStr)
|
||||||
{
|
{
|
||||||
int sock, err, opt;
|
int sock, err, opt;
|
||||||
struct addrinfo hints, *res, *rp;
|
struct addrinfo hints, *res, *rp;
|
||||||
|
@ -685,7 +685,7 @@ void stop_thread(pthread_t *pth)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int pigpio_start(char *addrStr, char *portStr)
|
int pigpio_start(const char *addrStr, const char *portStr)
|
||||||
{
|
{
|
||||||
int pi;
|
int pi;
|
||||||
int *userdata;
|
int *userdata;
|
||||||
|
@ -2122,5 +2122,5 @@ int wait_for_event(int pi, unsigned event, double timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
int event_trigger(int pi, unsigned event)
|
int event_trigger(int pi, unsigned event)
|
||||||
{return pigpio_command(pi, PI_CMD_EVM, event, 0, 1);}
|
{return pigpio_command(pi, PI_CMD_EVT, event, 0, 1);}
|
||||||
|
|
||||||
|
|
|
@ -429,7 +429,7 @@ The thread to be stopped should have been started with [*start_thread*].
|
||||||
D*/
|
D*/
|
||||||
|
|
||||||
/*F*/
|
/*F*/
|
||||||
int pigpio_start(char *addrStr, char *portStr);
|
int pigpio_start(const char *addrStr, const char *portStr);
|
||||||
/*D
|
/*D
|
||||||
Connect to the pigpio daemon. Reserving command and
|
Connect to the pigpio daemon. Reserving command and
|
||||||
notification streams.
|
notification streams.
|
||||||
|
@ -568,7 +568,8 @@ Return the PWM dutycycle in use on a GPIO.
|
||||||
user_gpio: 0-31.
|
user_gpio: 0-31.
|
||||||
. .
|
. .
|
||||||
|
|
||||||
Returns 0 if OK, otherwise PI_BAD_USER_GPIO or PI_NOT_PWM_GPIO.
|
Returns current PWM dutycycle if OK,
|
||||||
|
otherwise PI_BAD_USER_GPIO or PI_NOT_PWM_GPIO.
|
||||||
|
|
||||||
For normal PWM the dutycycle will be out of the defined range
|
For normal PWM the dutycycle will be out of the defined range
|
||||||
for the GPIO (see [*get_PWM_range*]).
|
for the GPIO (see [*get_PWM_range*]).
|
||||||
|
@ -3517,9 +3518,6 @@ The output process is simple. You simply append data to the FIFO
|
||||||
buffer on the chip. This works like a queue, you add data to the
|
buffer on the chip. This works like a queue, you add data to the
|
||||||
queue and the master removes it.
|
queue and the master removes it.
|
||||||
|
|
||||||
I can't get SPI to work properly. I tried with a
|
|
||||||
control word of 0x303 and swapped MISO and MOSI.
|
|
||||||
|
|
||||||
The function sets the BSC mode, writes any data in
|
The function sets the BSC mode, writes any data in
|
||||||
the transmit buffer to the BSC transmit FIFO, and
|
the transmit buffer to the BSC transmit FIFO, and
|
||||||
copies any data in the BSC receive FIFO to the
|
copies any data in the BSC receive FIFO to the
|
||||||
|
@ -3562,13 +3560,13 @@ GPIO used for models other than those based on the BCM2711.
|
||||||
|
|
||||||
@ SDA @ SCL @ MOSI @ SCLK @ MISO @ CE
|
@ SDA @ SCL @ MOSI @ SCLK @ MISO @ CE
|
||||||
I2C @ 18 @ 19 @ - @ - @ - @ -
|
I2C @ 18 @ 19 @ - @ - @ - @ -
|
||||||
SPI @ - @ - @ 18 @ 19 @ 20 @ 21
|
SPI @ - @ - @ 20 @ 19 @ 18 @ 21
|
||||||
|
|
||||||
GPIO used for models based on the BCM2711 (e.g. the Pi4B).
|
GPIO used for models based on the BCM2711 (e.g. the Pi4B).
|
||||||
|
|
||||||
@ SDA @ SCL @ MOSI @ SCLK @ MISO @ CE
|
@ SDA @ SCL @ MOSI @ SCLK @ MISO @ CE
|
||||||
I2C @ 10 @ 11 @ - @ - @ - @ -
|
I2C @ 10 @ 11 @ - @ - @ - @ -
|
||||||
SPI @ - @ - @ 10 @ 11 @ 9 @ 8
|
SPI @ - @ - @ 9 @ 11 @ 10 @ 8
|
||||||
|
|
||||||
When a zero control word is received the used GPIO will be reset
|
When a zero control word is received the used GPIO will be reset
|
||||||
to INPUT mode.
|
to INPUT mode.
|
||||||
|
@ -3612,7 +3610,7 @@ pages 165-166 of the Broadcom peripherals document for full
|
||||||
details.
|
details.
|
||||||
|
|
||||||
SSSSS @ number of bytes successfully copied to transmit FIFO
|
SSSSS @ number of bytes successfully copied to transmit FIFO
|
||||||
RRRRR @ number of bytes in receieve FIFO
|
RRRRR @ number of bytes in receive FIFO
|
||||||
TTTTT @ number of bytes in transmit FIFO
|
TTTTT @ number of bytes in transmit FIFO
|
||||||
RB @ receive busy
|
RB @ receive busy
|
||||||
TE @ transmit FIFO empty
|
TE @ transmit FIFO empty
|
||||||
|
@ -3639,6 +3637,17 @@ if (status >= 0)
|
||||||
// process transfer
|
// process transfer
|
||||||
}
|
}
|
||||||
...
|
...
|
||||||
|
|
||||||
|
The BSC slave in SPI mode deserializes data from the MOSI pin into its
|
||||||
|
receiver/FIFO when the LSB of the first byte is a 0. No data is output on
|
||||||
|
the MISO pin. When the LSB of the first byte on MOSI is a 1, the
|
||||||
|
transmitter/FIFO data is serialized onto the MISO pin while all other data
|
||||||
|
on the MOSI pin is ignored.
|
||||||
|
|
||||||
|
The BK bit of the BSC control register is non-functional when in the SPI
|
||||||
|
mode. The transmitter along with its FIFO can be dequeued by successively
|
||||||
|
disabling and re-enabling the TE bit on the BSC control register while in
|
||||||
|
SPI mode.
|
||||||
D*/
|
D*/
|
||||||
|
|
||||||
/*F*/
|
/*F*/
|
||||||
|
|
59
pigs.1
59
pigs.1
|
@ -928,10 +928,6 @@ The output process is simple. You simply append data to the FIFO
|
||||||
buffer on the chip. This works like a queue, you add data to the
|
buffer on the chip. This works like a queue, you add data to the
|
||||||
queue and the master removes it.
|
queue and the master removes it.
|
||||||
|
|
||||||
.br
|
|
||||||
I can't get SPI to work properly. I tried with a
|
|
||||||
control word of 0x303 and swapped MISO and MOSI.
|
|
||||||
|
|
||||||
.br
|
.br
|
||||||
The command sets the BSC mode and writes any data \fBbvs\fP
|
The command sets the BSC mode and writes any data \fBbvs\fP
|
||||||
to the BSC transmit FIFO. It returns the data count (at least 1
|
to the BSC transmit FIFO. It returns the data count (at least 1
|
||||||
|
@ -956,7 +952,7 @@ GPIO used for models other than those based on the BCM2711.
|
||||||
.EX
|
.EX
|
||||||
SDA SCL MOSI SCLK MISO CE
|
SDA SCL MOSI SCLK MISO CE
|
||||||
I2C 18 19 - - - -
|
I2C 18 19 - - - -
|
||||||
SPI - - 18 19 20 21
|
SPI - - 20 19 18 21
|
||||||
|
|
||||||
.EE
|
.EE
|
||||||
|
|
||||||
|
@ -968,7 +964,7 @@ GPIO used for models based on the BCM2711 (e.g. the Pi4B).
|
||||||
.EX
|
.EX
|
||||||
SDA SCL MOSI SCLK MISO CE
|
SDA SCL MOSI SCLK MISO CE
|
||||||
I2C 10 11 - - - -
|
I2C 10 11 - - - -
|
||||||
SPI - - 10 11 9 8
|
SPI - - 9 11 10 8
|
||||||
|
|
||||||
.EE
|
.EE
|
||||||
|
|
||||||
|
@ -1139,6 +1135,57 @@ $ pigs i2crd 0 5
|
||||||
|
|
||||||
.EE
|
.EE
|
||||||
|
|
||||||
|
.br
|
||||||
|
The BSC slave in SPI mode deserializes data from the MOSI pin into its receiver/
|
||||||
|
FIFO when the LSB of the first byte is a 0. No data is output on the MISO pin.
|
||||||
|
When the LSB of the first byte on MOSI is a 1, the transmitter/FIFO data is
|
||||||
|
serialized onto the MISO pin while all other data on the MOSI pin is ignored.
|
||||||
|
|
||||||
|
.br
|
||||||
|
The BK bit of the BSC control register is non-functional when in the SPI mode.
|
||||||
|
The transmitter along with its FIFO can be dequeued by successively disabling
|
||||||
|
and re-enabling the TE bit on the BSC control register while in SPI mode.
|
||||||
|
|
||||||
|
.br
|
||||||
|
This example demonstrates a SPI master talking to the BSC as SPI slave:
|
||||||
|
Requires SPI master SCLK / MOSI / MISO / CE GPIO are connected to
|
||||||
|
BSC peripheral GPIO 11 / 9 / 10 / 8 respectively, on a Pi4B (BCM2711).
|
||||||
|
|
||||||
|
.br
|
||||||
|
|
||||||
|
\fBExample\fP
|
||||||
|
.br
|
||||||
|
|
||||||
|
.EX
|
||||||
|
$ pigs bspio 15 26 13 14 10000 0 # open bit-bang spi master on random gpio
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
|
$ pigs bscx 0x303 # start BSC as SPI slave, both rx and tx enabled
|
||||||
|
.br
|
||||||
|
1 18
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
|
$ pigs bspix 15 0 0xd 0xe 0xa 0xd # write 0xdead to BSC
|
||||||
|
.br
|
||||||
|
5 0 0 0 0 0
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
|
$ pigs bscx 0x303 0xb 0xe 0xe 0xf # place 0xbeef in BSC tx FIFO, read rx FIFO
|
||||||
|
.br
|
||||||
|
5 262338 13 14 10 13
|
||||||
|
.br
|
||||||
|
|
||||||
|
.br
|
||||||
|
$ pigs bspix 15 1 0 0 0 0 # read four bytes from BSC
|
||||||
|
.br
|
||||||
|
5 0 11 14 14 15
|
||||||
|
.br
|
||||||
|
|
||||||
|
.EE
|
||||||
|
|
||||||
.br
|
.br
|
||||||
|
|
||||||
.IP "\fBBSPIC cs\fP - Close bit bang SPI"
|
.IP "\fBBSPIC cs\fP - Close bit bang SPI"
|
||||||
|
|
|
@ -77,6 +77,10 @@ void t1(int pi)
|
||||||
gpio_write(pi, GPIO, PI_HIGH);
|
gpio_write(pi, GPIO, PI_HIGH);
|
||||||
v = gpio_read(pi, GPIO);
|
v = gpio_read(pi, GPIO);
|
||||||
CHECK(1, 6, v, 1, 0, "write, read");
|
CHECK(1, 6, v, 1, 0, "write, read");
|
||||||
|
|
||||||
|
v = pigpio_start(PI_DEFAULT_SOCKET_ADDR_STR, PI_DEFAULT_SOCKET_PORT_STR);
|
||||||
|
CHECK(1, 7, v, 31, 100, "pigpio_start with non-default arguments");
|
||||||
|
pigpio_stop(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
int t2_count=0;
|
int t2_count=0;
|
||||||
|
|
Loading…
Reference in New Issue