diff options
author | Daniel Friesel <derf@finalrewind.org> | 2013-06-07 22:29:48 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2013-06-07 22:29:48 +0200 |
commit | 77545d2d340ea29a93b8fdadce32138904c087a3 (patch) | |
tree | 4150e008a8dfcb0c159828d286d2d314de85e8a7 | |
parent | e201adfc82af126291878f101690b25caf239f2e (diff) |
leave space for ninth i2c (ack) bit
-rw-r--r-- | commandline/i2c.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/commandline/i2c.c b/commandline/i2c.c index ce29dde..a7201fe 100644 --- a/commandline/i2c.c +++ b/commandline/i2c.c @@ -181,9 +181,9 @@ unsigned char buffer[8]; while (fgets(line, 8, stdin) != NULL) { if (sscanf(line, "%hi\n", &number) == 1) { if ((number >= 0) && (number <= 255)) { - for (i = 7; i >= 0; i--) { + for (i = 7; i >= -1; i--) { usleep(3); - if (number & (1 << i)) { + if ((i < 0) || (number & (1 << i))) { SDA_1; } else { SDA_0; |