From a3bc6ac54ba8c6aa91e7beb63844cf8b9e8e48b5 Mon Sep 17 00:00:00 2001 From: Zaltora Date: Thu, 1 Sep 2016 10:24:28 +0200 Subject: [PATCH] Update i2c.c --- extras/fast_i2c/i2c.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extras/fast_i2c/i2c.c b/extras/fast_i2c/i2c.c index 72ec26e..995497a 100644 --- a/extras/fast_i2c/i2c.c +++ b/extras/fast_i2c/i2c.c @@ -110,9 +110,9 @@ uint8_t i2c_read(uint8_t ack) { } _SCL0; if (ack) - _SDA0; // ACK - else _SDA1; // NACK + else + _SDA0; // ACK _DELAY; // Send clock _SCL1; @@ -134,9 +134,9 @@ bool i2c_slave_read(uint8_t slave_addr, uint8_t data, uint8_t *buf, uint16_t len if(!i2c_write((slave_addr<<1) | 1)) goto fail_send; // adress + R while(--len) { - *(buf++) = i2c_read(1); + *(buf++) = i2c_read(0); } - *buf = i2c_read(0); + *buf = i2c_read(1); i2c_stop(); return true;