Interface to the TI-RTOS I2C driver.
Simplified access to the I2C driver and switching between the two I2C buses.
This header file should be included in an application as follows:
#include "stdbool.h"
Go to the source code of this file.
Macros | |
#define | SENSOR_I2C_0 0 |
#define | SENSOR_I2C_1 1 |
#define | SENSOR_I2C_NONE -1 |
Functions | |
bool | SensorI2C_open (void) |
Initialize the RTOS I2C driver (must be called only once) More... | |
bool | SensorI2C_select (uint8_t i2cInterface, uint8_t i2cAddr) |
Select an I2C interface and I2C device. More... | |
bool | SensorI2C_readReg (uint8_t regAddr, uint8_t *pData, uint8_t nBytes) |
Read from an I2C device starting at regAddr. More... | |
bool | SensorI2C_writeReg (uint8_t regAddr, uint8_t *pData, uint8_t nBytes) |
Write to an I2C device starting at regAddr. More... | |
bool | SensorI2C_read (uint8_t *pData, uint8_t nBytes) |
Burst read from an I2C device. More... | |
bool | SensorI2C_write (uint8_t *pData, uint8_t nBytes) |
Burst write to an I2C device. More... | |
void | SensorI2C_deselect (void) |
Allow other tasks to access the I2C driver. More... | |
void | SensorI2C_close (void) |
Close the I2C interface and release the data lines. More... | |
#define SENSOR_I2C_0 0 |
I2C interface 0: humidity, temperature, pressure, light, humidity
#define SENSOR_I2C_1 1 |
I2C interface 1: movement sensor
#define SENSOR_I2C_NONE -1 |
I2C interface not selected
bool SensorI2C_open | ( | void | ) |
Initialize the RTOS I2C driver (must be called only once)
bool SensorI2C_select | ( | uint8_t | i2cInterface, |
uint8_t | i2cAddr | ||
) |
Select an I2C interface and I2C device.
i2cInterface | - selected interface (1 for MPU9250, 0 for other sensors) |
i2cAddr | - I2C slave address of device |
bool SensorI2C_readReg | ( | uint8_t | regAddr, |
uint8_t * | pData, | ||
uint8_t | nBytes | ||
) |
Read from an I2C device starting at regAddr.
regAddr | - which register to read |
pData | - pointer to data buffer |
nBytes | - number of bytes to read |
bool SensorI2C_writeReg | ( | uint8_t | regAddr, |
uint8_t * | pData, | ||
uint8_t | nBytes | ||
) |
Write to an I2C device starting at regAddr.
regAddr | - which register to write |
pData | - pointer to data buffer |
nBytes | - number of bytes to write |
bool SensorI2C_read | ( | uint8_t * | pData, |
uint8_t | nBytes | ||
) |
Burst read from an I2C device.
pData | - pointer to data buffer |
nBytes | - number of bytes to write |
bool SensorI2C_write | ( | uint8_t * | pData, |
uint8_t | nBytes | ||
) |
Burst write to an I2C device.
pData | - pointer to data buffer |
nBytes | - number of bytes to write |
void SensorI2C_deselect | ( | void | ) |
Allow other tasks to access the I2C driver.
void SensorI2C_close | ( | void | ) |
Close the I2C interface and release the data lines.