Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    Using BNO055 over I2C

    Using BNO055 over I2C

    rbtics
    Member

    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?

     

    2 REPLIES 2

    BSTRobin
    Community Moderator
    Community Moderator

    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.

    do you have source code or header files for standard c++ via i2c please?

     

    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