software/libbase/i2c/i2c_poll: Also test for write when polling since some I2C devices do not respond to read or require a specific protocol.

This commit is contained in:
Florent Kermarrec 2022-04-11 09:52:00 +02:00
parent 9806f76619
commit 1989d85b91
1 changed files with 2 additions and 1 deletions

View File

@ -261,7 +261,8 @@ bool i2c_poll(unsigned char slave_addr)
bool result;
i2c_start();
result = i2c_transmit_byte(I2C_ADDR_RD(slave_addr));
result = i2c_transmit_byte(I2C_ADDR_WR(slave_addr));
result |= i2c_transmit_byte(I2C_ADDR_RD(slave_addr));
i2c_stop();
return result;