Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    How to use the same sensor API with several sensors (BNO055)

    How to use the same sensor API with several sensors (BNO055)

    gcb
    Member

    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?

    5 REPLIES 5

    BSTRobin
    Community Moderator
    Community Moderator

    Hi gcb,

    Let us to check it and give you feedback later.

    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