mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-06-10 16:55:58 +00:00
Added timeout to I2C
This commit is contained in:
parent
e811292ffc
commit
5cad092f74
@ -13,6 +13,7 @@ namespace sta
|
||||
: I2C{mutex}
|
||||
{
|
||||
Wire.begin(sda, scl, frequency);
|
||||
Wire.setTimeOut(10);
|
||||
}
|
||||
#else
|
||||
ArduinoI2C::ArduinoI2C(Mutex * mutex /* = nullptr */)
|
||||
@ -56,6 +57,11 @@ namespace sta
|
||||
{
|
||||
size_t count = Wire.requestFrom((uint8_t)address_, (uint8_t)size);
|
||||
|
||||
if (count != size)
|
||||
{
|
||||
STA_DEBUG_PRINTLN("Bullshit");
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < min(size, count); ++i)
|
||||
{
|
||||
buffer[i] = Wire.read();
|
||||
|
Loading…
x
Reference in New Issue
Block a user