summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2019-04-19 00:24:28 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2019-04-19 00:29:10 +0200
commita782243ca99896030aa9004533b7140b860e8049 (patch)
tree5a9410f7ff7f4051d943c46503abdd7fd29fe0a8
parent26ec08816bee43c4271ea1ee985bbf1dc1b150b4 (diff)
downloadlibsigrokdecode-a782243ca99896030aa9004533b7140b860e8049.tar.gz
libsigrokdecode-a782243ca99896030aa9004533b7140b860e8049.zip
cc1101: Shorten decode_register() to decode_reg().
-rw-r--r--decoders/cc1101/pd.py22
1 files changed, 8 insertions, 14 deletions
diff --git a/decoders/cc1101/pd.py b/decoders/cc1101/pd.py
index 418d1bd..8c4c631 100644
--- a/decoders/cc1101/pd.py
+++ b/decoders/cc1101/pd.py
@@ -155,7 +155,7 @@ class Decoder(srd.Decoder):
else:
self.warn(pos, 'unknown address/command combination')
- def decode_register(self, pos, ann, regid, data):
+ def decode_reg(self, pos, ann, regid, data):
'''Decodes a register.
pos -- start and end sample numbers of the register
@@ -222,23 +222,17 @@ class Decoder(srd.Decoder):
'''Decodes the remaining data bytes at position 'pos'.'''
if self.cmd == 'Write':
- self.decode_register(pos, ANN_SINGLE_WRITE,
- self.dat, self.mosi_bytes())
+ self.decode_reg(pos, ANN_SINGLE_WRITE, self.dat, self.mosi_bytes())
elif self.cmd == 'Burst write':
- self.decode_register(pos, ANN_BURST_WRITE,
- self.dat, self.mosi_bytes())
+ self.decode_reg(pos, ANN_BURST_WRITE, self.dat, self.mosi_bytes())
elif self.cmd == 'Read':
- self.decode_register(pos, ANN_SINGLE_READ,
- self.dat, self.miso_bytes())
+ self.decode_reg(pos, ANN_SINGLE_READ, self.dat, self.miso_bytes())
elif self.cmd == 'Burst read':
- self.decode_register(pos, ANN_BURST_READ,
- self.dat, self.miso_bytes())
+ self.decode_reg(pos, ANN_BURST_READ, self.dat, self.miso_bytes())
elif self.cmd == 'Strobe':
- self.decode_register(pos, ANN_STROBE,
- self.dat, self.mosi_bytes())
+ self.decode_reg(pos, ANN_STROBE, self.dat, self.mosi_bytes())
elif self.cmd == 'Status read':
- self.decode_register(pos, ANN_STATUS_READ,
- self.dat, self.miso_bytes())
+ self.decode_reg(pos, ANN_STATUS_READ, self.dat, self.miso_bytes())
else:
self.warn(pos, 'unhandled command')
@@ -283,7 +277,7 @@ class Decoder(srd.Decoder):
# First MOSI byte is always the command.
self.decode_command(pos, mosi)
# First MISO byte is always the status register.
- self.decode_register(pos, ANN_STATUS, 'STATUS', [miso])
+ self.decode_reg(pos, ANN_STATUS, 'STATUS', [miso])
else:
if not self.cmd or len(self.mb) >= self.max:
self.warn(pos, 'excess byte')