Compare commits

...

1 Commits

Author SHA1 Message Date
8af5afd00d Add writeBytes function to allow writing multiple bytes 2020-05-16 16:57:06 +02:00

11
i2c.hpp
View File

@@ -25,6 +25,17 @@ struct I2c {
return Driver::write(data);
}
template <size_t Bytes>
static bool writeBytes(const uint8_t *buffer)
{
for (size_t i = 0; i < Bytes; ++i) {
if (!write(buffer[i]))
return false;
}
return true;
}
template <bool LastByte = false>
static uint8_t read()
{