Class Device¶
Defined in File BlackBox_I2C.hpp
Inheritance Relationships¶
Class Documentation¶
-
class
I2C
::
Device
¶ Base class for I2C devices.
Subclassed by BlackBox::LDC, BlackBox::MPU, BlackBox::RTC
Public Functions
-
virtual
~Device
() = default¶
-
std::uint8_t
readByte
(std::uint8_t registerAddress)¶ Read a single byte from device.
- Parameters
registerAddress –
- Returns
read data
-
void
readBytes
(std::uint8_t registerAddress, std::uint8_t *data, size_t dataLength)¶ Read multiple bytes from device.
- Parameters
registerAddress –
data – Pointer to variable where to store read data
dataLength – Length of data to be read
-
std::uint16_t
readWord
(std::uint8_t registerAddress)¶ Read a single word (2 bytes) from device.
- Parameters
registerAddress –
- Returns
read data
-
void
writeByte
(std::uint8_t registerAddress, std::uint8_t data)¶ Write a single byte to device.
- Parameters
registerAddress –
data –
-
void
writeBytes
(std::uint8_t registerAddress, std::uint8_t *data, size_t dataLength)¶ Write multiple bytes to device.
- Parameters
registerAddress –
data – Pointer to the data variable
dataLength – Length of data to be written
-
void
writeWord
(std::uint8_t registerAddress, std::uint16_t data)¶ Write a single word (2 bytes) to device.
- Parameters
registerAddress –
data –
-
Device
(std::uint16_t address, i2c_port_t)¶ Construct a new Device object.
- Parameters
address – address of device
port – i2c port on which device is connected
-
std::uint16_t
address
() const¶ Returns address of I2C device specified on initialization.
- Returns
address
-
i2c_port_t
port
() const¶
-
virtual void
init
()¶
Protected Functions
-
Device
() = delete¶
-
virtual