srd: onewire_network: Fix typo, command is 0x69.
[libsigrokdecode.git] / decoders / onewire_transport / onewire_transport.py
index 67f5193deda48e76f79c4b336dc30204c598b325..e7870914aaf81ecce92ea359c9544bf8074e9fc9 100644 (file)
 import sigrokdecode as srd
 
 # a dictionary of FUNCTION commands and their names
-command = {0x44: "TEMPERATURE CONVERSION",
-           0xbe: "READ SCRATCHPAD"}
+command = {
+    # scratchpad
+    0x4e: "WRITE SCRATCHPAD",
+    0xbe: "READ SCRATCHPAD",
+    0x48: "COPY SCRATCHPAD",
+    # thermometer
+    0x44: "CONVERT TEMPERATURE",
+    0xb4: "READ POWER MODE",
+    0xb8: "RECALL EEPROM",
+    0xf5: "PIO ACCESS READ",
+    0xA5: "PIO ACCESS WRITE",
+    0x99: "CHAIN",
+    # memory
+    0xf0: "READ MEMORY",
+    0xa5: "EXTENDED READ MEMORY",
+    0x0f: "WRITE MEMORY",
+    0x55: "WRITE STATUS",
+    0xaa: "READ STATUS",
+    0xf5: "CHANNEL ACCESS"
+}
 
 class Decoder(srd.Decoder):
     api_version = 1
@@ -77,9 +95,11 @@ class Decoder(srd.Decoder):
                         self.state = "UNRECOGNIZED"
             elif (self.state == "READ SCRATCHPAD"):
                 self.put(ss, es, self.out_ann, [0, ['SCRATCHPAD DATA: 0x%02x' % (val)]])
-            elif (self.state == "TEMPERATURE CONVERSION"):
+            elif (self.state == "CONVERT TEMPERATURE"):
                 self.put(ss, es, self.out_ann, [0, ['TEMPERATURE CONVERSION STATUS: 0x%02x' % (val)]])
+            elif (self.state in command.values()):
+                self.put(ss, es, self.out_ann, [0, ['TODO "%s": 0x%02x' % (self.state, val)]])
             elif (self.state == "UNRECOGNIZED"):
-                self.put(ss, es, self.out_ann, [0, ['UNRECOGNIZED: 0x%02x' % (val)]])
+                self.put(ss, es, self.out_ann, [0, ['UNRECOGNIZED COMMAND: 0x%02x' % (val)]])
             else:
                 raise Exception('Invalid state: %s' % self.state)