MAV'RIC
|
I2C peripheral driver using ChibiOS/HAL. More...
#include <i2c_chibios.hpp>
Classes | |
struct | conf_t |
Configuration structure. More... | |
Public Member Functions | |
I2c_chibios (conf_t config) | |
Constructor. | |
bool | init (void) |
Hardware initialization. | |
bool | probe (uint32_t address) |
Test if a chip answers for a given I2C address. | |
bool | write (const uint8_t *buffer, uint32_t nbytes, uint32_t address) |
Write multiple bytes to a I2C slave device. | |
bool | read (uint8_t *buffer, uint32_t nbytes, uint32_t address) |
Read multiple bytes to a I2C slave device. | |
bool | transfer (uint8_t *out_buffer, uint32_t ntxbytes, uint8_t *in_buffer, uint32_t nrxbytes, uint32_t address) |
Write then Read data to/from an I2C device. |
I2C peripheral driver using ChibiOS/HAL.
I2c_chibios::I2c_chibios | ( | conf_t | config | ) |
Constructor.
config | Device configuration |
bool I2c_chibios::init | ( | void | ) | [virtual] |
Hardware initialization.
Implements I2c.
bool I2c_chibios::probe | ( | uint32_t | address | ) | [virtual] |
Test if a chip answers for a given I2C address.
address | Slave adress |
Implements I2c.
bool I2c_chibios::read | ( | uint8_t * | buffer, |
uint32_t | nbytes, | ||
uint32_t | address | ||
) | [virtual] |
Read multiple bytes to a I2C slave device.
buffer | Data buffer |
nbytes | Number of bytes to read |
address | Slave adress |
Implements I2c.
bool I2c_chibios::transfer | ( | uint8_t * | out_buffer, |
uint32_t | ntxbytes, | ||
uint8_t * | in_buffer, | ||
uint32_t | nrxbytes, | ||
uint32_t | address | ||
) | [virtual] |
Write then Read data to/from an I2C device.
out_buffer | Data buffer (output) |
ntxbytes | Number of bytes to write |
in_buffer | Data buffer (input) |
nrxbytes | Number of bytes to read |
Reimplemented from I2c.
bool I2c_chibios::write | ( | const uint8_t * | buffer, |
uint32_t | nbytes, | ||
uint32_t | address | ||
) | [virtual] |
Write multiple bytes to a I2C slave device.
buffer | Data buffer |
nbytes | Number of bytes to write |
address | Slave adress |
Implements I2c.