summaryrefslogtreecommitdiff
path: root/decoders
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2020-01-01 14:50:12 +0100
committerUwe Hermann <uwe@hermann-uwe.de>2020-01-10 18:55:24 +0100
commit64594a5fdaaee32aa10e5c3704cdb41c15acce3f (patch)
tree1e74ad34afede2608fe949de1bdbdcefc3db27dc /decoders
parentfe89c3b4d410c8f4203470cb412bf8f03279c391 (diff)
downloadlibsigrokdecode-64594a5fdaaee32aa10e5c3704cdb41c15acce3f.tar.gz
libsigrokdecode-64594a5fdaaee32aa10e5c3704cdb41c15acce3f.zip
amulet_ascii: Use SrdIntEnum for annotation classes.
Also, automate construction of the Ann SrdIntEnum. This avoids having to remember to manually keep two lists in sync.
Diffstat (limited to 'decoders')
-rw-r--r--decoders/amulet_ascii/pd.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/decoders/amulet_ascii/pd.py b/decoders/amulet_ascii/pd.py
index 41fbcad..7195323 100644
--- a/decoders/amulet_ascii/pd.py
+++ b/decoders/amulet_ascii/pd.py
@@ -19,18 +19,15 @@
import sigrokdecode as srd
from math import ceil
+from common.srdhelper import SrdIntEnum
from .lists import *
L = len(cmds)
RX = 0
TX = 1
-# Don't forget to keep this in sync with 'cmds' is lists.py.
-class Ann:
- PAGE, GBV, GWV, GSV, GLV, GRPC, SBV, SWV, SSV, RPC, LINE, RECT, FRECT, \
- PIXEL, GBVA, GWVA, SBVA, GBVR, GWVR, GSVR, GLVR, GRPCR, SBVR, SWVR, SSVR, \
- RPCR, LINER, RECTR, FRECTR, PIXELR, GBVAR, GWVAR, SBVAR, ACK, NACK, SWVA, \
- SWVAR, GCV, GCVR, SCV, SCVR, BIT, FIELD, WARN = range(L + 3)
+Ann = SrdIntEnum.from_list('Ann',
+ [c[0] for c in cmds.values()] + ['BIT', 'FIELD', 'WARN'])
def cmd_annotation_classes():
return tuple([tuple([cmd[0].lower(), cmd[1]]) for cmd in cmds.values()])