11/**
2- * Copyright (c) 2020 Bosch Sensortec GmbH. All rights reserved.
2+ * Copyright (c) 2021 Bosch Sensortec GmbH. All rights reserved.
33*
44* BSD-3-Clause
55*
3131* POSSIBILITY OF SUCH DAMAGE.
3232*
3333* @file bmi160.c
34- * @date 2021-03-12
35- * @version v3.9.1
34+ * @date 2021-10-05
35+ * @version v3.9.2
3636*
3737*/
3838
@@ -1383,7 +1383,7 @@ int8_t bmi160_get_regs(uint8_t reg_addr, uint8_t *data, uint16_t len, const stru
13831383 }
13841384 else if (len == 0 )
13851385 {
1386- rslt = BMI160_READ_WRITE_LENGHT_INVALID ;
1386+ rslt = BMI160_E_READ_WRITE_LENGTH_INVALID ;
13871387 }
13881388 else
13891389 {
@@ -1415,7 +1415,7 @@ int8_t bmi160_set_regs(uint8_t reg_addr, uint8_t *data, uint16_t len, const stru
14151415 }
14161416 else if (len == 0 )
14171417 {
1418- rslt = BMI160_READ_WRITE_LENGHT_INVALID ;
1418+ rslt = BMI160_E_READ_WRITE_LENGTH_INVALID ;
14191419 }
14201420 else
14211421 {
@@ -1627,7 +1627,7 @@ int8_t bmi160_set_power_mode(struct bmi160_dev *dev)
16271627/*!
16281628 * @brief This API gets the power mode of the sensor.
16291629 */
1630- int8_t bmi160_get_power_mode (struct bmi160_pmu_status * pmu_status , const struct bmi160_dev * dev )
1630+ int8_t bmi160_get_power_mode (struct bmi160_dev * dev )
16311631{
16321632 int8_t rslt = 0 ;
16331633 uint8_t power_mode = 0 ;
@@ -1642,10 +1642,9 @@ int8_t bmi160_get_power_mode(struct bmi160_pmu_status *pmu_status, const struct
16421642 rslt = bmi160_get_regs (BMI160_PMU_STATUS_ADDR , & power_mode , 1 , dev );
16431643 if (rslt == BMI160_OK )
16441644 {
1645- /* Power mode of the accel,gyro,aux sensor is obtained */
1646- pmu_status -> aux_pmu_status = BMI160_GET_BITS_POS_0 (power_mode , BMI160_MAG_POWER_MODE );
1647- pmu_status -> gyro_pmu_status = BMI160_GET_BITS (power_mode , BMI160_GYRO_POWER_MODE );
1648- pmu_status -> accel_pmu_status = BMI160_GET_BITS (power_mode , BMI160_ACCEL_POWER_MODE );
1645+ /* Power mode of the accel, gyro sensor is obtained */
1646+ dev -> gyro_cfg .power = BMI160_GET_BITS (power_mode , BMI160_GYRO_POWER_MODE );
1647+ dev -> accel_cfg .power = BMI160_GET_BITS (power_mode , BMI160_ACCEL_POWER_MODE );
16491648 }
16501649 }
16511650
@@ -3523,7 +3522,7 @@ static int8_t set_accel_pwr(struct bmi160_dev *dev)
35233522 }
35243523 else
35253524 {
3526- rslt = BMI160_E_OUT_OF_RANGE ;
3525+ rslt = BMI160_E_INVALID_CONFIG ;
35273526 }
35283527
35293528 return rslt ;
@@ -3536,7 +3535,7 @@ static int8_t process_under_sampling(uint8_t *data, const struct bmi160_dev *dev
35363535{
35373536 int8_t rslt ;
35383537 uint8_t temp = 0 ;
3539- uint8_t pre_filter = 0 ;
3538+ uint8_t pre_filter [ 2 ] = { 0 } ;
35403539
35413540 rslt = bmi160_get_regs (BMI160_ACCEL_CONFIG_ADDR , data , 1 , dev );
35423541 if (rslt == BMI160_OK )
@@ -3551,20 +3550,18 @@ static int8_t process_under_sampling(uint8_t *data, const struct bmi160_dev *dev
35513550 /* Write data */
35523551 rslt = bmi160_set_regs (BMI160_ACCEL_CONFIG_ADDR , data , 1 , dev );
35533552
3554- /* disable the pre-filter data in
3555- * low power mode */
3553+ /* Disable the pre-filter data in low power mode */
35563554 if (rslt == BMI160_OK )
35573555 {
35583556 /* Disable the Pre-filter data*/
3559- rslt = bmi160_set_regs (BMI160_INT_DATA_0_ADDR , & pre_filter , 2 , dev );
3557+ rslt = bmi160_set_regs (BMI160_INT_DATA_0_ADDR , pre_filter , 2 , dev );
35603558 }
35613559 }
35623560 else if (* data & BMI160_ACCEL_UNDERSAMPLING_MASK )
35633561 {
35643562 temp = * data & ~BMI160_ACCEL_UNDERSAMPLING_MASK ;
35653563
3566- /* disable under-sampling parameter
3567- * if already enabled */
3564+ /* Disable under-sampling parameter if already enabled */
35683565 * data = temp ;
35693566
35703567 /* Write data */
@@ -3611,7 +3608,7 @@ static int8_t set_gyro_pwr(struct bmi160_dev *dev)
36113608 }
36123609 else
36133610 {
3614- rslt = BMI160_E_OUT_OF_RANGE ;
3611+ rslt = BMI160_E_INVALID_CONFIG ;
36153612 }
36163613
36173614 return rslt ;
@@ -6379,6 +6376,7 @@ static int8_t configure_offset_enable(const struct bmi160_foc_conf *foc_conf, st
63796376
63806377 return rslt ;
63816378}
6379+
63826380static int8_t trigger_foc (struct bmi160_offsets * offset , struct bmi160_dev const * dev )
63836381{
63846382 int8_t rslt ;
@@ -6415,7 +6413,7 @@ static int8_t trigger_foc(struct bmi160_offsets *offset, struct bmi160_dev const
64156413 else
64166414 {
64176415 /* FOC failure case */
6418- rslt = BMI160_FOC_FAILURE ;
6416+ rslt = BMI160_E_FOC_FAILURE ;
64196417 }
64206418 }
64216419
0 commit comments