X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=decoders%2Fdali%2Fpd.py;h=419e364b39d9a1c3c5b8b95280f1ee85272ccb74;hb=e144452bcdd5f2abbe6b6f3da41ad64f67e39def;hp=904adc7fbdc72ad628be5187bc07d3736090a72c;hpb=1b9ef18be867133e721681cbc20272cf5c669504;p=libsigrokdecode.git diff --git a/decoders/dali/pd.py b/decoders/dali/pd.py index 904adc7..419e364 100644 --- a/decoders/dali/pd.py +++ b/decoders/dali/pd.py @@ -28,10 +28,11 @@ class Decoder(srd.Decoder): id = 'dali' name = 'DALI' longname = 'Digital Addressable Lighting Interface' - desc = 'DALI lighting control protocol.' + desc = 'Digital Addressable Lighting Interface (DALI) protocol.' license = 'gplv2+' inputs = ['logic'] - outputs = ['dali'] + outputs = [] + tags = ['Embedded/industrial', 'Lighting'] channels = ( {'id': 'dali', 'name': 'DALI', 'desc': 'DALI data line'}, ) @@ -41,7 +42,7 @@ class Decoder(srd.Decoder): ) annotations = ( ('bit', 'Bit'), - ('startbit', 'Startbit'), + ('startbit', 'Start bit'), ('sbit', 'Select bit'), ('ybit', 'Individual or group'), ('address', 'Address'), @@ -51,16 +52,18 @@ class Decoder(srd.Decoder): ) annotation_rows = ( ('bits', 'Bits', (0,)), - ('raw', 'Raw data', (7,)), + ('raw-data', 'Raw data', (7,)), ('fields', 'Fields', (1, 2, 3, 4, 5, 6)), ) def __init__(self): + self.reset() + + def reset(self): self.samplerate = None - self.samplenum = None self.edges, self.bits, self.ss_es_bits = [], [], [] self.state = 'IDLE' - self.devType = None + self.dev_type = None def start(self): self.out_ann = self.register(srd.OUTPUT_ANN) @@ -130,8 +133,8 @@ class Decoder(srd.Decoder): self.putb(1, 7, [5, s]) elif f >= 160: # Extended command 0b10100000 if f == 0xC1: # DALI_ENABLE_DEVICE_TYPE_X - self.devType = -1 - x = extendedCommands.get(f, ['Unknown', 'Unk']) + self.dev_type = -1 + x = extended_commands.get(f, ['Unknown', 'Unk']) s = ['Extended Command: %02X (%s)' % (f, x[0]), 'XC: %02X (%s)' % (f, x[1]), 'XC: %02X' % f, 'X: %02X' % f, 'X'] @@ -155,12 +158,12 @@ class Decoder(srd.Decoder): # Bits[9:16]: Command/data (MSB-first) if f >= 160 and f < 254: - if self.devType == -1: - self.devType = c + if self.dev_type == -1: + self.dev_type = c s = ['Type: %d' % c, 'Typ: %d' % c, 'Typ: %d' % c, 'T: %d' % c, 'D'] else: - self.devType = None + self.dev_type = None s = ['Data: %d' % c, 'Dat: %d' % c, 'Dat: %d' % c, 'D: %d' % c, 'D'] elif b[8][1] == 1: @@ -179,12 +182,12 @@ class Decoder(srd.Decoder): elif un == 0xB0: x = ['Query Scene %d Level' % ln, 'Sc %d Level' % ln] elif c >= 224: # Application specific commands - if self.devType == 8: - x = DALIDeviceType8.get(c, ['Unknown App', 'Unk']) + if self.dev_type == 8: + x = dali_device_type8.get(c, ['Unknown App', 'Unk']) else: x = ['Application Specific Command %d' % c, 'App Cmd %d' % c] else: - x = DALICommands.get(c, ['Unknown', 'Unk']) + x = dali_commands.get(c, ['Unknown', 'Unk']) s = ['Command: %d (%s)' % (c, x[0]), 'Com: %d (%s)' % (c, x[1]), 'Com: %d' % c, 'C: %d' % c, 'C'] else: