mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
NACK last byte when read
The TCS34725 RGB color sensor works reliably with this change. See #535 for details.
This commit is contained in:
parent
dece240830
commit
87001fea23
@ -166,7 +166,8 @@ unsigned char twi_readFrom(unsigned char address, unsigned char* buf, unsigned i
|
||||
unsigned int i;
|
||||
if(!twi_write_start()) return 4;//line busy
|
||||
if(!twi_write_byte(((address << 1) | 1) & 0xFF)) return 2;//received NACK on transmit of address
|
||||
for(i=0; i<len; i++) buf[i] = twi_read_byte(false);
|
||||
for(i=0; i<(len-1); i++) buf[i] = twi_read_byte(false);
|
||||
buf[len-1] = twi_read_byte(true);
|
||||
if(sendStop) twi_write_stop();
|
||||
i = 0;
|
||||
while(SDA_READ() == 0 && (i++) < 10){
|
||||
|
Loading…
x
Reference in New Issue
Block a user