|
Sensor Fusion Library 0.6.1
Orientation sensing for Espressif (ESP32, ESP8266) processors
|
The hal_i2c.cc file contains definitions for low-level interface functions for reading and writing data from/to sensor using I2C. More...

Go to the source code of this file.
Functions | |
| bool | I2CInitialize (int pin_sda, int pin_scl) |
| Initialize the I2C system at max clock rate supported by sensors. pin_sda and pin_scl indicate the pin numbers to which the I2C SDA and SCL lines of the sensors are connected. Pass -1 to use the default Arduino pins. | |
| bool | I2CReadByte (byte address, byte reg, byte *destination) |
| Read single byte from address and place in destination Returns true if successful, false if error. | |
| bool | I2CReadBytes (byte address, byte reg, byte *destination, int num_bytes) |
| Read num_bytes bytes from address starting at register. Assumes device auto-increments the register. Bytes read are placed in destination. Returns true if successful, false if error. | |
| bool | I2CWriteByte (byte address, byte reg, byte value) |
| Write single byte to register at address Returns true if successful, false if error. | |
| bool | I2CWriteBytes (byte address, byte reg, const byte *value, unsigned int num_bytes) |
| Write multiple bytes starting at register to I2C address Assumes device auto-increments the I2C register being written to. Returns true if successful, false if error. | |
| int8_t | Sensor_I2C_Write_List (registerDeviceInfo_t *devInfo, uint16_t peripheralAddress, const registerwritelist_t *pRegWriteList) |
| Write register data to a sensor. | |
| int32_t | Sensor_I2C_Read (registerDeviceInfo_t *devInfo, uint16_t peripheralAddress, const registerReadlist_t *pReadList, uint8_t *pOutBuffer) |
| Read register data from a sensor. | |
| int32_t | Sensor_I2C_Read_Register (registerDeviceInfo_t *devInfo, uint16_t peripheralAddress, uint8_t offset, uint8_t length, uint8_t *pOutBuffer) |
The hal_i2c.cc file contains definitions for low-level interface functions for reading and writing data from/to sensor using I2C.
Definition in file hal_i2c.cc.
| bool I2CInitialize | ( | int | pin_sda, |
| int | pin_scl | ||
| ) |
Initialize the I2C system at max clock rate supported by sensors. pin_sda and pin_scl indicate the pin numbers to which the I2C SDA and SCL lines of the sensors are connected. Pass -1 to use the default Arduino pins.
Returns true if successful, false if problem initializing I2C.
Definition at line 37 of file hal_i2c.cc.
| bool I2CReadByte | ( | byte | address, |
| byte | reg, | ||
| byte * | destination | ||
| ) |
Read single byte from address and place in destination Returns true if successful, false if error.
Definition at line 57 of file hal_i2c.cc.
| bool I2CReadBytes | ( | byte | address, |
| byte | reg, | ||
| byte * | destination, | ||
| int | num_bytes | ||
| ) |
Read num_bytes bytes from address starting at register. Assumes device auto-increments the register. Bytes read are placed in destination. Returns true if successful, false if error.
Definition at line 69 of file hal_i2c.cc.
| bool I2CWriteByte | ( | byte | address, |
| byte | reg, | ||
| byte | value | ||
| ) |
Write single byte to register at address Returns true if successful, false if error.
Definition at line 102 of file hal_i2c.cc.
| bool I2CWriteBytes | ( | byte | address, |
| byte | reg, | ||
| const byte * | value, | ||
| unsigned int | num_bytes | ||
| ) |
Write multiple bytes starting at register to I2C address Assumes device auto-increments the I2C register being written to. Returns true if successful, false if error.
Definition at line 120 of file hal_i2c.cc.
| int32_t Sensor_I2C_Read | ( | registerDeviceInfo_t * | devInfo, |
| uint16_t | slaveAddress, | ||
| const registerReadlist_t * | pReadList, | ||
| uint8_t * | pOutBuffer | ||
| ) |
Read register data from a sensor.
| [in] | pCommDrv | pointer to the I2C ARM driver to use |
| [in] | devInfo | The I2C device number and idle function. |
| [in] | slaveAddress | the I2C slave address to read from |
| [in] | pReadList | a list of one or more register addresses and lengths to read |
| [in] | pOutBuffer | a pointer of sufficient size to contain the requested read data |
Definition at line 177 of file hal_i2c.cc.
| int32_t Sensor_I2C_Read_Register | ( | registerDeviceInfo_t * | devInfo, |
| uint16_t | peripheralAddress, | ||
| uint8_t | offset, | ||
| uint8_t | length, | ||
| uint8_t * | pOutBuffer | ||
| ) |
Definition at line 204 of file hal_i2c.cc.
| int8_t Sensor_I2C_Write_List | ( | registerDeviceInfo_t * | devInfo, |
| uint16_t | slaveAddress, | ||
| const registerwritelist_t * | pRegWriteList | ||
| ) |
Write register data to a sensor.
| [in] | pCommDrv | pointer to the I2C ARM driver to use |
| [in] | devInfo | The I2C device number and idle function. |
| [in] | slaveAddress | the I2C slave address to write to |
| [in] | pRegWriteList | a list of one or more register/value pairs to write |
Definition at line 145 of file hal_i2c.cc.