From 930bd9d961b9a13259ffb4997be9fa6ebcdb9da9 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Sun, 18 Apr 2010 03:15:06 +0200 Subject: Python: Bugfixes (True/False != 1/0). --- scripts/i2c.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts/i2c.py') diff --git a/scripts/i2c.py b/scripts/i2c.py index 46c3381..973751b 100644 --- a/scripts/i2c.py +++ b/scripts/i2c.py @@ -84,8 +84,8 @@ def sigrokdecode_i2c(inbuf): # Get SCL/SDA bit values (0/1 for low/high) of the first sample. s = ord(inbuf[0]) - oldscl = (s & (1 << scl_bit)) != 0 - oldsda = (s & (1 << sda_bit)) != 0 + oldscl = (s & (1 << scl_bit)) >> scl_bit + oldsda = (s & (1 << sda_bit)) >> sda_bit # Loop over all samples. # TODO: Handle LAs with more/less than 8 channels. @@ -94,8 +94,8 @@ def sigrokdecode_i2c(inbuf): s = ord(s) # FIXME # Get SCL/SDA bit values (0/1 for low/high). - scl = (s & (1 << scl_bit)) != 0 - sda = (s & (1 << sda_bit)) != 0 + scl = (s & (1 << scl_bit)) >> scl_bit + sda = (s & (1 << sda_bit)) >> sda_bit # TODO: Wait until the bus is idle (SDA = SCL = 1) first? -- cgit v1.2.3-70-g09d2