summaryrefslogtreecommitdiff
path: root/decoders
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2020-01-10 20:41:57 +0100
committerUwe Hermann <uwe@hermann-uwe.de>2020-01-10 20:50:15 +0100
commit927e2ba624b780e8b846ce3cc2b013afac6fa751 (patch)
tree3aad6f18bfc4ccaaecf04cd454e99f76fd25686b /decoders
parentf3297f9887ec204f7769ee4b3339f30cd0bca520 (diff)
downloadlibsigrokdecode-927e2ba624b780e8b846ce3cc2b013afac6fa751.tar.gz
libsigrokdecode-927e2ba624b780e8b846ce3cc2b013afac6fa751.zip
sdcard_spi: Use ternary operator where possible.
Diffstat (limited to 'decoders')
-rw-r--r--decoders/sdcard_spi/pd.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/decoders/sdcard_spi/pd.py b/decoders/sdcard_spi/pd.py
index af896af..49cfdef 100644
--- a/decoders/sdcard_spi/pd.py
+++ b/decoders/sdcard_spi/pd.py
@@ -437,11 +437,9 @@ class Decoder(srd.Decoder):
elif miso == 0x0d:
self.put(m[3][1], m[1][2], self.out_ann, [Ann.BIT, ['Data rejected (write error)']])
self.put(m[0][1], m[0][2], self.out_ann, [Ann.BIT, ['Always 1']])
- ann_class = None
- if self.is_cmd24:
- ann_class = Ann.CMD24
- if ann_class is not None:
- self.put(self.ss, self.es, self.out_ann, [ann_class, ['Data Response']])
+ cls = Ann.CMD24 if self.is_cmd24 else None
+ if cls is not None:
+ self.put(self.ss, self.es, self.out_ann, [cls, ['Data Response']])
if self.is_cmd24:
# We just send a block of data to be written to the card,
# this takes some time.
@@ -452,11 +450,9 @@ class Decoder(srd.Decoder):
def wait_while_busy(self, miso):
if miso != 0x00:
- ann_class = None
- if self.is_cmd24:
- ann_class = Ann.CMD24
- if ann_class is not None:
- self.put(self.ss_busy, self.es_busy, self.out_ann, [Ann.CMD24, ['Card is busy']])
+ cls = Ann.CMD24 if self.is_cmd24 else None
+ if cls is not None:
+ self.put(self.ss_busy, self.es_busy, self.out_ann, [cls, ['Card is busy']])
self.state = 'IDLE'
return
else: