#include <pas-co2-i2c.hpp>
◆ I2C()
I2C interface constructor.
- Parameters
-
[in] | *i2cpal | I2C pal interface |
[in] | freqHz | I2C bus frequency in Hz. Default is 400000. |
- Precondition
- None
◆ ~I2C()
I2C interface destructor.
- Precondition
- None
◆ init()
Initializes the I2C interface.
Initiliazes the host I2C peripheral and set its clock frequency
- Returns
- PAS CO2 error code
- Return values
-
OK | if success |
INTF_ERROR | if hardware interface error |
- Precondition
- None
Implements pasco2::SBus.
◆ deinit()
Deinitializes the I2C interface.
- Returns
- PAS CO2 error code
- Return values
-
OK | if success |
INTF_ERROR | if hardware interface error |
- Precondition
- None
Implements pasco2::SBus.
◆ write()
Error_t I2C::write |
( |
const uint8_t |
regAddr, |
|
|
const uint8_t * |
data, |
|
|
uint16_t |
length |
|
) |
| |
|
virtual |
Writes data to a register or set of consecutive registers.
- Parameters
-
[in] | regAddr | Register start write address |
[in] | *data | Pointer to the data array to be written |
[in] | length | Number of registers to be written in the bus |
- Returns
- PAS CO2 error code
- Return values
-
OK | if success |
INTF_ERROR | if error |
- Precondition
- init()
Implements pasco2::SBus.
◆ read()
Error_t I2C::read |
( |
const uint8_t |
regAddr, |
|
|
uint8_t * |
data, |
|
|
uint16_t |
length |
|
) |
| |
|
virtual |
Reads data from a register or set of consecutive registers.
- Parameters
-
[in] | regAddr | Register start read address |
[out] | *data | Pointer to the array that will store the read data |
[in] | length | Number of registers to be read from the bus |
- Returns
- PAS CO2 error code
- Return values
-
OK | if success |
INTF_ERROR | if error |
- Precondition
- init()
Implements pasco2::SBus.
◆ getProtocol()
Proto_t pasco2::I2C::getProtocol |
( |
void |
| ) |
|
|
inlinevirtual |
Returns the bus protocol.
- Return values
-
Implements pasco2::SBus.
◆ dfltFreq
const uint32_t pasco2::I2C::dfltFreq = 400000 |
|
static |
Default I2C SCKL frequency
The documentation for this class was generated from the following files: