Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    How to use BNO055 API's

    How to use BNO055 API's

    rbtics
    Member

    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

    BSTRobin
    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;
    }
    https://github.com/BoschSensortec/BNO055_driver/blob/master/bno055_support.c

    Hi

    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:

    bnO055_init(&myBNO);

    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:

    bnO055_init(&myBNO_2);

    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?

    BSTRobin
    Community Moderator
    Community Moderator

    There was same topic in community. We could only discuss in one topic: https://community.bosch-sensortec.com/t5/MEMS-sensors-forum/How-to-use-the-same-sensor-API-with-seve...

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist