]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/i2c/pd.py
i2c: Drop unneeded 'addressing' option.
[libsigrokdecode.git] / decoders / i2c / pd.py
index 2500ae4cc6e036a7620a1dd5e2c0c830a3b05af7..0aed1ffe505a3a95e4167ebc0d4003869e1e04fe 100644 (file)
 # I2C protocol decoder
 
 # TODO: Look into arbitration, collision detection, clock synchronisation, etc.
-# TODO: Handle clock stretching.
-# TODO: Handle combined messages / repeated START.
-# TODO: Implement support for 7bit and 10bit slave addresses.
+# TODO: Implement support for 10bit slave addresses.
 # TODO: Implement support for inverting SDA/SCL levels (0->1 and 1->0).
 # TODO: Implement support for detecting various bus errors.
-# TODO: I2C address of slaves.
-# TODO: Handle multiple different I2C devices on same bus
-#       -> we need to decode multiple protocols at the same time.
 
 import sigrokdecode as srd
 
+'''
+Protocol output format:
+
+I2C packet:
+[<cmd>, <data>]
+
+<cmd> is one of:
+ - 'START' (START condition)
+ - 'START REPEAT' (Repeated START condition)
+ - 'ADDRESS READ' (Slave address, read)
+ - 'ADDRESS WRITE' (Slave address, write)
+ - 'DATA READ' (Data, read)
+ - 'DATA WRITE' (Data, write)
+ - 'STOP' (STOP condition)
+ - 'ACK' (ACK bit)
+ - 'NACK' (NACK bit)
+
+<data> is the data or address byte associated with the 'ADDRESS*' and 'DATA*'
+command. Slave addresses do not include bit 0 (the READ/WRITE indication bit).
+For example, a slave address field could be 0x51 (instead of 0xa2).
+For 'START', 'START REPEAT', 'STOP', 'ACK', and 'NACK' <data> is None.
+'''
+
 # CMD: [annotation-type-index, long annotation, short annotation]
 proto = {
     'START':           [0, 'Start',         'S'],
@@ -60,7 +78,6 @@ class Decoder(srd.Decoder):
     ]
     optional_probes = []
     options = {
-        'addressing': ['Slave addressing (in bits)', 7], # 7 or 10
         'address_format': ['Displayed slave address format', 'shifted'],
     }
     annotations = [