]> sigrok.org Git - libsigrokdecode.git/commitdiff
cc1101: Simplify format_command().
authorUwe Hermann <redacted>
Thu, 18 Apr 2019 22:02:54 +0000 (00:02 +0200)
committerUwe Hermann <redacted>
Thu, 18 Apr 2019 22:28:11 +0000 (00:28 +0200)
decoders/cc1101/pd.py

index 24352f6232add525a9e1e9b6935e98e8dd61b751..de0d74f998f911f59482909f7d098206a6aa1c67 100644 (file)
@@ -118,22 +118,17 @@ class Decoder(srd.Decoder):
     def format_command(self):
         '''Returns the label for the current command.'''
         if self.cmd == 'SINGLE_READ':
-            reg = regs[self.dat] if self.dat in regs else 'unknown register'
             return 'Read'
         if self.cmd == 'BURST_READ':
-            reg = regs[self.dat] if self.dat in regs else 'unknown register'
             return 'Burst read'
         if self.cmd == 'SINGLE_WRITE':
-            reg = regs[self.dat] if self.dat in regs else 'unknown register'
             return 'Write'
         if self.cmd == 'BURST_WRITE':
-            reg = regs[self.dat] if self.dat in regs else 'unknown register'
             return 'Burst write'
         if self.cmd == 'STATUS_READ':
-            reg = regs[self.dat] if self.dat in regs else 'unknown register'
             return 'Status read'
         if self.cmd == 'STROBE_CMD':
-            reg = strobes[self.dat] if self.dat in strobes else 'unknown strobe'
+            reg = strobes.get(self.dat, 'unknown strobe')
             return 'STROBE "{}"'.format(reg)
         else:
             return 'TODO Cmd {}'.format(self.cmd)