summaryrefslogtreecommitdiff
path: root/decoders/spi
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2012-01-25 22:11:38 +0100
committerUwe Hermann <uwe@hermann-uwe.de>2012-01-25 23:49:32 +0100
commitdecde15ecb51b3326b31019af61e0a729b9c61d0 (patch)
tree362aefd1a9759731bdf8ee2cc3d533c83a7faa9a /decoders/spi
parent385508e9b12d87519f9144a67e7682b46a592200 (diff)
downloadlibsigrokdecode-decde15ecb51b3326b31019af61e0a729b9c61d0.tar.gz
libsigrokdecode-decde15ecb51b3326b31019af61e0a729b9c61d0.zip
srd: All PDs: Various fixes, cosmetics.
- List all API methods and metadata variables in all PDs to make things easier and more consistent for new PD writers. - Fix probe assignment in a few PDs. - Raise exceptions upon invalid states of the PD state machines (bug).
Diffstat (limited to 'decoders/spi')
-rw-r--r--decoders/spi/spi.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/decoders/spi/spi.py b/decoders/spi/spi.py
index 57f5562..7789e34 100644
--- a/decoders/spi/spi.py
+++ b/decoders/spi/spi.py
@@ -59,13 +59,14 @@ class Decoder(srd.Decoder):
inputs = ['logic']
outputs = ['spi']
probes = [
- {'id': 'mosi', 'name': 'MOSI',
- 'desc': 'SPI MOSI line (Master out, slave in)'},
{'id': 'miso', 'name': 'MISO',
'desc': 'SPI MISO line (Master in, slave out)'},
+ {'id': 'mosi', 'name': 'MOSI',
+ 'desc': 'SPI MOSI line (Master out, slave in)'},
{'id': 'sck', 'name': 'CLK', 'desc': 'SPI clock line'},
{'id': 'cs', 'name': 'CS#', 'desc': 'SPI CS (chip select) line'},
]
+ extra_probes = [] # TODO
options = {
'cs_polarity': ['CS# polarity', ACTIVE_LOW],
'cpol': ['Clock polarity', CPOL_0],
@@ -94,11 +95,8 @@ class Decoder(srd.Decoder):
return 'SPI: %d bytes received' % self.bytesreceived
def decode(self, ss, es, data):
- # HACK! At the moment the number of probes is not handled correctly.
- # E.g. if an input file (-i foo.sr) has more than two probes enabled.
- # for (samplenum, (mosi, sck, x, y, z, a)) in data:
- # for (samplenum, (cs, miso, sck, mosi, wp, hold)) in data:
- for (samplenum, (cs, miso, sck, mosi, wp, hold)) in data:
+ # TODO: Either MISO or MOSI could be optional. CS# is optional.
+ for (samplenum, (miso, mosi, sck, cs)) in data:
self.samplenum += 1 # FIXME