Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    How to use BNO055 API's

    How to use BNO055 API's


    I am fairly new to coding and so I've been looking at the provided API's from github but I am confused as to which ones I actually need since there are a lot of functions. I only need to read linear acceleration and absolute orientation but there are a lot of API's that are listed which is why I am not sure which ones I will need. If it helps, I am using this over I2C and I am using PSoC 4

    3 REPLIES 3

    Community Moderator
    Community Moderator

    Hello rbtics,

    The API of BNO055 is very convenient to migrate to different MCU platforms. We mainly refer to the interface transplant in the following function, set the device address of BNO055, implement the read and write interface of I2C, and implement the delay function.
    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;


    I'm trying to use the Bosch Sensortech API for the BNO055 sensor. The API can be found here. I would like to use two BNO055 sensors on the same I2C bus (each with different addresses) or in different I2C buses (in this case with the same address).

    1. After reading the API, I understood I can create a structure to store the device information:

    struct bno055_t myBNO;

    2. Then link my MCU I2C driver functions to the API communication function pointers:

    myBNO.bus_read = BNO055_I2C_bus_read();
    myBNO.bus_write = BNO055_I2C_bus_write();
    myBNO.delay_msec = delay;

    3. Configure the correct I2C address of my device:

    myBNO.dev_addr = BNO055_I2C_ADDR1;

    4. And finally do API initialization by passing the reference of my object with device information:


    Inside of the API file (bno055.c) we can se a pointer of type bno055_t that will point to my myBNO device. And from now on, all API Calls are related to this device. So if I try to do the point 4) again but with the reference to my second sensor, lets say:


    The API just lost the information of the first device and will work only for the second one.

    So if I have another BNO055 sensor with another I2C address how can I use this API?
    Or if I have another BNO55 sensor with the same address but in a different I2C bus how can I use this API?

    Creating multiple objects of type bno055_t is possible. Setting a different address and linking different I2C driver functions (depends on which I2C0 or I2C1 bus I am using) is also possible. But then when I initialize the API using bnO055_init(), I am only able to do this once with only one device's information.

    Any suggestion?

    Community Moderator
    Community Moderator

    There was same topic in community. We could only discuss in one topic: