Add writeBytes function to allow writing multiple bytes
This commit is contained in:
parent
ff131d92a1
commit
8af5afd00d
11
i2c.hpp
11
i2c.hpp
@ -25,6 +25,17 @@ struct I2c {
|
|||||||
return Driver::write(data);
|
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>
|
template <bool LastByte = false>
|
||||||
static uint8_t read()
|
static uint8_t read()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user