03-25-2021 07:42 PM - edited 03-25-2021 07:45 PM
I am trying to understand the provided firmware for the bno055 sensor and I have a few questions:
1) To be able to use the API's over I2C, I would need to edit the s8 BNO055_I2C_bus_read(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt) function in the support.c file correct so that it includes the I2C functions?
2) It is possible to just replace the BNO055_I2C_bus_read and BNO055_I2C_bus_write functions with the I2C write and read functions for the API's in the .c file?
3) Are the BNO055_RETURN_FUNCTION_TYPE and BNO055_INIT_VALUE just arbitrary macros that we replace with values that we want to use?
Solved! Go to Solution.
03-29-2021 10:47 AM
Hello rbtics,
BNO055_I2C_bus_read and BNO055_I2C_bus_write are example functions, if you used them you could modify them and implement actually I2C read and write communication in these functions.
s8 I2C_routine(void)
{
bno055.bus_write = BNO055_I2C_bus_write;
bno055.bus_read = BNO055_I2C_bus_read;
bno055.delay_msec = BNO055_delay_msek;
bno055.dev_addr = BNO055_I2C_ADDR1;
return BNO055_INIT_VALUE;
}
You can also choose not to use this function name BNO055_I2C_bus_read and BNO055_I2C_bus_write, as long as the function type meets the type BNO055_RD_FUNC_PTR, BNO055_WR_FUNC_PTR. Attachment is my example code on STM32, you could refer it.
When you migrate BNO055 API to your platform, it allow you to modify BNO055_RETURN_FUNCTION_TYPE and BNO055_INIT_VALUE in your system.
11-15-2022 01:32 PM
do you have source code or header files for standard c++ via i2c please?