I2C
Platform independent interface for I2C drivers.
Public Functions
| I2C(uint8_t ch) | |
| Initializes a new instance of the I2C class. | |
| virtual void | init() =0 |
| Initializes the I2C driver. | |
| virtual bool | readRegister(uint8_t addr, uint8_t reg, uint8_t * data, uint32_t cnt) =0 |
| Reads the specified register on the device with the specified address. | |
| virtual bool | writeRegister(uint8_t addr, uint8_t reg, uint8_t val) =0 |
| Writes the specified value in a register. | |
| virtual | ~I2C() |
| Finalizes an instance of the I2C class. | |
Protected Attributes
Public Functions Documentation
I2C
| I2C | ( | uint8_t | ch | ) | |
init
readRegister
| virtual bool readRegister | ( | uint8_t | addr , | =0 | |
| uint8_t | reg , | =0 | |||
| uint8_t * | data , | =0 | |||
| uint32_t | cnt | =0 | |||
| ) | =0 |
Reads the specified register on the device with the specified address.
Parameters:
| addr | The I2C device address. |
| reg | The register. |
| data | Pointer to buffer in which to place the result. |
| cnt | Size of buffer in bytes. |
Returns:
true on success, false otherwise.
writeRegister
| virtual bool writeRegister | ( | uint8_t | addr , | =0 | |
| uint8_t | reg , | =0 | |||
| uint8_t | val | =0 | |||
| ) | =0 |
Writes the specified value in a register.
Parameters:
| addr | The I2C device address. |
| reg | The register. |
| val | The new value. |
Returns:
true on success, false otherwise.
~I2C
Protected Attributes Documentation
channel
uint8_t channel
I2c channel is stored in order to initialize and recover a specific I2C channel.