Bosch Sensortec Community

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

    BMX160 Power Mode - Transitions

    BMX160 Power Mode - Transitions

    Nikosant03
    Long-established Member

    Hi everyone,

    I have a question regarding the switching in Power Modes. What can I understand is that there are two ways to change power mode:

    EITHER 

    sensor.accel_cfg.power = BMI160_ACCEL_NORMAL_MODE;
    sensor.gyro_cfg.power = BMI160_GYRO_NORMAL_MODE; 
    
    rslt = bmi160_set_sens_conf(&sensor);

    OR

    sensor.accel_cfg.power = BMI160_ACCEL_NORMAL_MODE;
    sensor.gyro_cfg.power = BMI160_GYRO_NORMAL_MODE; 
    
    rslt = bmi160_set_power_mode(&sensor);

     

    Which function should I use in order to change properly power mode?  Should I should both functions? Should I use both functions but in a particular order?

    Please advice

    Thanks in advance

    Nick

    3 REPLIES 3

    fish
    Community Moderator
    Community Moderator

    Hello,

    From API code as bellow, two function are different. So you could follow example code to make configuration.

    /*!
     * @brief This API configures the power mode, range and bandwidth
     * of sensor.
     */
    int8_t bmi160_set_sens_conf(struct bmi160_dev *dev)
    {
        int8_t rslt = BMI160_OK;
    
        /* Null-pointer check */
        if ((dev == NULL) || (dev->delay_ms == NULL))
        {
            rslt = BMI160_E_NULL_PTR;
        }
        else
        {
            rslt = set_accel_conf(dev);
            if (rslt == BMI160_OK)
            {
                rslt = set_gyro_conf(dev);
                if (rslt == BMI160_OK)
                {
                    /* write power mode for accel and gyro */
                    rslt = bmi160_set_power_mode(dev);
                    if (rslt == BMI160_OK)
                    {
                        rslt = check_invalid_settg(dev);
                    }
                }
            }
        }
    
        return rslt;
    }
    
    /*!
     * @brief This API sets the power mode of the sensor.
     */
    int8_t bmi160_set_power_mode(struct bmi160_dev *dev)
    {
        int8_t rslt = 0;
    
        /* Null-pointer check */
        if ((dev == NULL) || (dev->delay_ms == NULL))
        {
            rslt = BMI160_E_NULL_PTR;
        }
        else
        {
            rslt = set_accel_pwr(dev);
            if (rslt == BMI160_OK)
            {
                rslt = set_gyro_pwr(dev);
            }
        }
    
        return rslt;
    }
    

     

    Nikosant03
    Long-established Member

    Thank you for your reply fish

    Actually the bmi160_set_sens_conf() includes the bmi160_set_power_mode().. 

    So I could use either the bmi160_set_sens_conf() or the bmi160_set_power_mode() to switch power mode right? It is identical isn't it?

    Screenshot_56.png

     

    Vincent
    Community Moderator
    Community Moderator

    Yes, they are identical if you put correct power mode value into configure data group already.

    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