Fixed arduino i2c fill implementation

This commit is contained in:
dario 2024-02-12 14:45:26 +01:00
parent 027484ef5e
commit 56de6ac3e2

View File

@ -51,14 +51,12 @@ namespace sta
void ArduinoI2C::fill(uint8_t value, size_t count)
{
// Initialize a buffer of size count and fill it with the value.
uint8_t *buffer = new uint8_t[count];
uint8_t buffer[count];
memset(buffer, value, count);
Wire.beginTransmission((uint8_t)address_);
Wire.write(buffer, count);
Wire.endTransmission();
delete[] buffer;
}
ArduinoI2CDevice::ArduinoI2CDevice(I2C * intf, uint8_t address, bool master /* = true */, bool blocking /* = true */)