diff --git a/bmi2.c b/bmi2.c index fa3f4bb..13b8b9a 100644 --- a/bmi2.c +++ b/bmi2.c @@ -31,8 +31,8 @@ * POSSIBILITY OF SUCH DAMAGE. * * @file bmi2.c - * @date 2020-04-29 - * @version v2.53.0 + * @date 2020-06-05 + * @version v2.53.2 * */ @@ -42,348 +42,6 @@ /******************************************************************************/ #include "bmi2.h" -/******************************************************************************/ -/*! @name Macros */ -/******************************************************************************/ -/*! @name Offsets from feature start address for BMI2 feature enable/disable */ -#define BMI2_ANY_MOT_FEAT_EN_OFFSET UINT8_C(0x03) -#define BMI2_NO_MOT_FEAT_EN_OFFSET UINT8_C(0x03) -#define BMI2_SIG_MOT_FEAT_EN_OFFSET UINT8_C(0x0A) -#define BMI2_STEP_COUNT_FEAT_EN_OFFSET UINT8_C(0x01) -#define BMI2_GYR_USER_GAIN_FEAT_EN_OFFSET UINT8_C(0x05) -#define BMI2_HIGH_G_FEAT_EN_OFFSET UINT8_C(0x03) -#define BMI2_LOW_G_FEAT_EN_OFFSET UINT8_C(0x03) - -/*! @name Mask definitions for BMI2 feature enable/disable */ -#define BMI2_ANY_NO_MOT_EN_MASK UINT8_C(0x80) -#define BMI2_TILT_FEAT_EN_MASK UINT8_C(0x01) -#define BMI2_ORIENT_FEAT_EN_MASK UINT8_C(0x01) -#define BMI2_SIG_MOT_FEAT_EN_MASK UINT8_C(0x01) -#define BMI2_STEP_DET_FEAT_EN_MASK UINT8_C(0x08) -#define BMI2_STEP_COUNT_FEAT_EN_MASK UINT8_C(0x10) -#define BMI2_STEP_ACT_FEAT_EN_MASK UINT8_C(0x20) -#define BMI2_GYR_USER_GAIN_FEAT_EN_MASK UINT8_C(0x08) -#define BMI2_UP_HOLD_TO_WAKE_FEAT_EN_MASK UINT8_C(0x01) -#define BMI2_GLANCE_FEAT_EN_MASK UINT8_C(0x01) -#define BMI2_WAKE_UP_FEAT_EN_MASK UINT8_C(0x01) -#define BMI2_HIGH_G_FEAT_EN_MASK UINT8_C(0x80) -#define BMI2_LOW_G_FEAT_EN_MASK UINT8_C(0x10) -#define BMI2_FLAT_FEAT_EN_MASK UINT8_C(0x01) -#define BMI2_EXT_SENS_SYNC_FEAT_EN_MASK UINT8_C(0x01) -#define BMI2_GYR_SELF_OFF_CORR_FEAT_EN_MASK UINT8_C(0x02) -#define BMI2_WRIST_GEST_FEAT_EN_MASK UINT8_C(0x20) -#define BMI2_WRIST_WEAR_WAKE_UP_FEAT_EN_MASK UINT8_C(0x10) -#define BMI2_ACTIVITY_RECOG_EN_MASK UINT8_C(0x01) -#define BMI2_ACC_SELF_TEST_FEAT_EN_MASK UINT8_C(0x02) -#define BMI2_GYRO_SELF_TEST_CRT_EN_MASK UINT8_C(0x01) -#define BMI2_ABORT_FEATURE_EN_MASK UINT8_C(0x02) -#define BMI2_NVM_PREP_FEATURE_EN_MASK UINT8_C(0x04) -#define BMI2_FREE_FALL_DET_FEAT_EN_MASK UINT8_C(0x01) - -/*! @name Bit position definitions for BMI2 feature enable/disable */ -#define BMI2_ANY_NO_MOT_EN_POS UINT8_C(0x07) -#define BMI2_STEP_DET_FEAT_EN_POS UINT8_C(0x03) -#define BMI2_STEP_COUNT_FEAT_EN_POS UINT8_C(0x04) -#define BMI2_STEP_ACT_FEAT_EN_POS UINT8_C(0x05) -#define BMI2_GYR_USER_GAIN_FEAT_EN_POS UINT8_C(0x03) -#define BMI2_HIGH_G_FEAT_EN_POS UINT8_C(0x07) -#define BMI2_LOW_G_FEAT_EN_POS UINT8_C(0x04) -#define BMI2_GYR_SELF_OFF_CORR_FEAT_EN_POS UINT8_C(0x01) -#define BMI2_WRIST_GEST_FEAT_EN_POS UINT8_C(0x05) -#define BMI2_WRIST_WEAR_WAKE_UP_FEAT_EN_POS UINT8_C(0x04) -#define BMI2_ACC_SELF_TEST_FEAT_EN_POS UINT8_C(0x01) -#define BMI2_ABORT_FEATURE_EN_POS UINT8_C(0x1) -#define BMI2_NVM_PREP_FEATURE_EN_POS UINT8_C(0x02) - -/*! Primary OIS low pass filter configuration position and mask */ -#define BMI2_LP_FILTER_EN_MASK UINT8_C(0x01) - -#define BMI2_LP_FILTER_CONFIG_POS UINT8_C(0x01) -#define BMI2_LP_FILTER_CONFIG_MASK UINT8_C(0x06) - -#define BMI2_PRIMARY_OIS_GYR_EN_POS UINT8_C(0x06) -#define BMI2_PRIMARY_OIS_GYR_EN_MASK UINT8_C(0x40) - -#define BMI2_PRIMARY_OIS_ACC_EN_POS UINT8_C(0x07) -#define BMI2_PRIMARY_OIS_ACC_EN_MASK UINT8_C(0x80) - -/*! @name Mask definitions for BMI2 any and no-motion feature configuration */ -#define BMI2_ANY_NO_MOT_DUR_MASK UINT16_C(0x1FFF) -#define BMI2_ANY_NO_MOT_X_SEL_MASK UINT16_C(0x2000) -#define BMI2_ANY_NO_MOT_Y_SEL_MASK UINT16_C(0x4000) -#define BMI2_ANY_NO_MOT_Z_SEL_MASK UINT16_C(0x8000) -#define BMI2_ANY_NO_MOT_THRES_MASK UINT16_C(0x07FF) -#define BMI2_ANY_NO_MOT_OUT_CONF_MASK UINT16_C(0x7800) - -/*! @name Bit position definitions for BMI2 any and no-motion feature - * configuration - */ -#define BMI2_ANY_NO_MOT_X_SEL_POS UINT8_C(0x0D) -#define BMI2_ANY_NO_MOT_Y_SEL_POS UINT8_C(0x0E) -#define BMI2_ANY_NO_MOT_Z_SEL_POS UINT8_C(0x0F) -#define BMI2_ANY_NO_MOT_OUT_CONF_POS UINT8_C(0x0B) - -/*! @name Mask definitions for BMI2 tilt feature configuration */ -#define BMI2_TILT_OUT_CONF_MASK UINT16_C(0x001E) - -/*! @name Bit position definitions for BMI2 tilt feature configuration */ -#define BMI2_TILT_OUT_CONF_POS UINT8_C(0x01) - -/*! @name Mask definitions for BMI2 orientation feature configuration */ -#define BMI2_ORIENT_UP_DOWN_MASK UINT16_C(0x0002) -#define BMI2_ORIENT_SYMM_MODE_MASK UINT16_C(0x000C) -#define BMI2_ORIENT_BLOCK_MODE_MASK UINT16_C(0x0030) -#define BMI2_ORIENT_THETA_MASK UINT16_C(0x0FC0) -#define BMI2_ORIENT_HYST_MASK UINT16_C(0x07FF) -#define BMI2_ORIENT_OUT_CONF_MASK UINT16_C(0x7800) - -/*! @name Bit position definitions for BMI2 orientation feature configuration */ -#define BMI2_ORIENT_UP_DOWN_POS UINT8_C(0x01) -#define BMI2_ORIENT_SYMM_MODE_POS UINT8_C(0x02) -#define BMI2_ORIENT_BLOCK_MODE_POS UINT8_C(0x04) -#define BMI2_ORIENT_THETA_POS UINT8_C(0x06) -#define BMI2_ORIENT_OUT_CONF_POS UINT8_C(0x0B) - -/*! @name Mask definitions for BMI2 sig-motion feature configuration */ -#define BMI2_SIG_MOT_PARAM_1_MASK UINT16_C(0xFFFF) -#define BMI2_SIG_MOT_PARAM_2_MASK UINT16_C(0xFFFF) -#define BMI2_SIG_MOT_PARAM_3_MASK UINT16_C(0xFFFF) -#define BMI2_SIG_MOT_PARAM_4_MASK UINT16_C(0xFFFF) -#define BMI2_SIG_MOT_PARAM_5_MASK UINT16_C(0xFFFF) -#define BMI2_SIG_MOT_OUT_CONF_MASK UINT16_C(0x001E) - -/*! @name Bit position definitions for BMI2 sig-motion feature configuration */ -#define BMI2_SIG_MOT_OUT_CONF_POS UINT8_C(0x01) - -/*! @name Mask definitions for BMI2 parameter configurations */ -#define BMI2_STEP_COUNT_PARAMS_MASK UINT16_C(0xFFFF) - -/*! @name Mask definitions for BMI2 step-counter/detector feature configuration */ -#define BMI2_STEP_COUNT_WM_LEVEL_MASK UINT16_C(0x03FF) -#define BMI2_STEP_COUNT_RST_CNT_MASK UINT16_C(0x0400) -#define BMI2_STEP_DET_OUT_CONF_MASK UINT16_C(0x000F) -#define BMI2_STEP_ACT_OUT_CONF_MASK UINT16_C(0x00F0) -#define BMI2_STEP_BUFFER_SIZE_MASK UINT16_C(0XFF00) - -/*! @name Bit position definitions for BMI2 step-counter/detector feature - * configuration - */ -#define BMI2_STEP_COUNT_RST_CNT_POS UINT8_C(0x0A) -#define BMI2_STEP_ACT_OUT_CONF_POS UINT8_C(0x04) -#define BMI2_STEP_BUFFER_SIZE_POS UINT8_C(0X08) - -/*! @name Mask definitions for BMI2 gyroscope user gain feature - * configuration - */ -#define BMI2_GYR_USER_GAIN_RATIO_X_MASK UINT16_C(0x07FF) -#define BMI2_GYR_USER_GAIN_RATIO_Y_MASK UINT16_C(0x07FF) -#define BMI2_GYR_USER_GAIN_RATIO_Z_MASK UINT16_C(0x07FF) - -/*! @name Mask definitions for BMI2 gyroscope user gain saturation status */ -#define BMI2_GYR_USER_GAIN_SAT_STAT_X_MASK UINT8_C(0x01) -#define BMI2_GYR_USER_GAIN_SAT_STAT_Y_MASK UINT8_C(0x02) -#define BMI2_GYR_USER_GAIN_SAT_STAT_Z_MASK UINT8_C(0x04) -#define BMI2_G_TRIGGER_STAT_MASK UINT8_C(0x38) - -/*! @name Bit position definitions for BMI2 gyroscope user gain saturation status */ -#define BMI2_GYR_USER_GAIN_SAT_STAT_Y_POS UINT8_C(0x01) -#define BMI2_GYR_USER_GAIN_SAT_STAT_Z_POS UINT8_C(0x02) -#define BMI2_G_TRIGGER_STAT_POS UINT8_C(0x03) - -/*! @name Mask definitions for MSB values of BMI2 gyroscope compensation */ -#define BMI2_GYR_OFF_COMP_MSB_X_MASK UINT8_C(0x03) -#define BMI2_GYR_OFF_COMP_MSB_Y_MASK UINT8_C(0x0C) -#define BMI2_GYR_OFF_COMP_MSB_Z_MASK UINT8_C(0x30) - -/*! @name Bit positions for MSB values of BMI2 gyroscope compensation */ -#define BMI2_GYR_OFF_COMP_MSB_Y_POS UINT8_C(0x02) -#define BMI2_GYR_OFF_COMP_MSB_Z_POS UINT8_C(0x04) - -/*! @name Mask definitions for MSB values of BMI2 gyroscope compensation from user input */ -#define BMI2_GYR_OFF_COMP_MSB_MASK UINT16_C(0x0300) -#define BMI2_GYR_OFF_COMP_LSB_MASK UINT16_C(0x00FF) - -/*! @name Mask definitions for BMI2 orientation status */ -#define BMI2_ORIENT_DETECT_MASK UINT8_C(0x03) -#define BMI2_ORIENT_FACE_UP_DWN_MASK UINT8_C(0x04) - -/*! @name Bit position definitions for BMI2 orientation status */ -#define BMI2_ORIENT_FACE_UP_DWN_POS UINT8_C(0x02) - -/*! @name Mask definitions for NVM-VFRM error status */ -#define BMI2_NVM_LOAD_ERR_STATUS_MASK UINT8_C(0x01) -#define BMI2_NVM_PROG_ERR_STATUS_MASK UINT8_C(0x02) -#define BMI2_NVM_ERASE_ERR_STATUS_MASK UINT8_C(0x04) -#define BMI2_NVM_END_EXCEED_STATUS_MASK UINT8_C(0x08) -#define BMI2_NVM_PRIV_ERR_STATUS_MASK UINT8_C(0x10) -#define BMI2_VFRM_LOCK_ERR_STATUS_MASK UINT8_C(0x20) -#define BMI2_VFRM_WRITE_ERR_STATUS_MASK UINT8_C(0x40) -#define BMI2_VFRM_FATAL_ERR_STATUS_MASK UINT8_C(0x80) - -/*! @name Bit positions for NVM-VFRM error status */ -#define BMI2_NVM_PROG_ERR_STATUS_POS UINT8_C(0x01) -#define BMI2_NVM_ERASE_ERR_STATUS_POS UINT8_C(0x02) -#define BMI2_NVM_END_EXCEED_STATUS_POS UINT8_C(0x03) -#define BMI2_NVM_PRIV_ERR_STATUS_POS UINT8_C(0x04) -#define BMI2_VFRM_LOCK_ERR_STATUS_POS UINT8_C(0x05) -#define BMI2_VFRM_WRITE_ERR_STATUS_POS UINT8_C(0x06) -#define BMI2_VFRM_FATAL_ERR_STATUS_POS UINT8_C(0x07) - -/*! @name Mask definitions for accelerometer self-test status */ -#define BMI2_ACC_SELF_TEST_DONE_MASK UINT8_C(0x01) -#define BMI2_ACC_X_OK_MASK UINT8_C(0x02) -#define BMI2_ACC_Y_OK_MASK UINT8_C(0x04) -#define BMI2_ACC_Z_OK_MASK UINT8_C(0x08) - -/*! @name Bit Positions for accelerometer self-test status */ -#define BMI2_ACC_X_OK_POS UINT8_C(0x01) -#define BMI2_ACC_Y_OK_POS UINT8_C(0x02) -#define BMI2_ACC_Z_OK_POS UINT8_C(0x03) - -/*! @name Mask definitions for BMI2 uphold to wake feature configuration */ -#define BMI2_UP_HOLD_TO_WAKE_OUT_CONF_MASK UINT16_C(0x001E) - -/*! @name Bit position definitions for BMI2 uphold to wake feature configuration */ -#define BMI2_UP_HOLD_TO_WAKE_OUT_CONF_POS UINT8_C(0x01) - -/*! @name Mask definitions for BMI2 glance detector feature configuration */ -#define BMI2_GLANCE_DET_OUT_CONF_MASK UINT16_C(0x001E) - -/*! @name Bit position definitions for BMI2 glance detector feature - * configuration - */ -#define BMI2_GLANCE_DET_OUT_CONF_POS UINT8_C(0x01) - -/*! @name Mask definitions for BMI2 high-g feature configuration */ -#define BMI2_HIGH_G_THRES_MASK UINT16_C(0x7FFF) -#define BMI2_HIGH_G_HYST_MASK UINT16_C(0x0FFF) -#define BMI2_HIGH_G_X_SEL_MASK UINT16_C(0x1000) -#define BMI2_HIGH_G_Y_SEL_MASK UINT16_C(0x2000) -#define BMI2_HIGH_G_Z_SEL_MASK UINT16_C(0x4000) -#define BMI2_HIGH_G_DUR_MASK UINT16_C(0x0FFF) -#define BMI2_HIGH_G_OUT_CONF_MASK UINT16_C(0xF000) - -/*! @name Bit position definitions for BMI2 high-g feature configuration */ -#define BMI2_HIGH_G_OUT_CONF_POS UINT8_C(0x0C) -#define BMI2_HIGH_G_X_SEL_POS UINT8_C(0x0C) -#define BMI2_HIGH_G_Y_SEL_POS UINT8_C(0x0D) -#define BMI2_HIGH_G_Z_SEL_POS UINT8_C(0x0E) - -/*! @name Mask definitions for BMI2 low-g feature configuration */ -#define BMI2_LOW_G_THRES_MASK UINT16_C(0x7FFF) -#define BMI2_LOW_G_HYST_MASK UINT16_C(0x0FFF) -#define BMI2_LOW_G_DUR_MASK UINT16_C(0x0FFF) -#define BMI2_LOW_G_OUT_CONF_MASK UINT16_C(0xF000) - -/*! @name Mask definitions for BMI2 free-fall detection feature configuration */ -#define BMI2_FREE_FALL_OUT_CONF_MASK UINT16_C(0x001E) -#define BMI2_FREE_FALL_ACCEL_SETT_MASK UINT16_C(0xFFFF) - -/*! @name Bit position definitions for BMI2 free-fall detection feature configuration */ -#define BMI2_FREE_FALL_OUT_CONF_POS UINT8_C(0x01) - -/*! @name Bit position definitions for BMI2 low-g feature configuration */ -#define BMI2_LOW_G_OUT_CONF_POS UINT8_C(0x0C) - -/*! @name Mask definitions for BMI2 flat feature configuration */ -#define BMI2_FLAT_THETA_MASK UINT16_C(0x007E) -#define BMI2_FLAT_BLOCK_MASK UINT16_C(0x0180) -#define BMI2_FLAT_OUT_CONF_MASK UINT16_C(0x1E00) -#define BMI2_FLAT_HYST_MASK UINT16_C(0x003F) -#define BMI2_FLAT_HOLD_TIME_MASK UINT16_C(0x3FC0) - -/*! @name Bit position definitions for BMI2 flat feature configuration */ -#define BMI2_FLAT_THETA_POS UINT8_C(0x01) -#define BMI2_FLAT_BLOCK_POS UINT8_C(0x07) -#define BMI2_FLAT_OUT_CONF_POS UINT8_C(0x09) -#define BMI2_FLAT_HOLD_TIME_POS UINT8_C(0x06) - -/*! @name Mask definitions for BMI2 external sensor sync configuration */ -#define BMI2_EXT_SENS_SYNC_OUT_CONF_MASK UINT16_C(0x001E) - -/*! @name Bit position definitions for external sensor sync configuration */ -#define BMI2_EXT_SENS_SYNC_OUT_CONF_POS UINT8_C(0x01) - -/*! @name Mask definitions for BMI2 wrist gesture configuration */ -#define BMI2_WRIST_GEST_WEAR_ARM_MASK UINT16_C(0x0010) -#define BMI2_WRIST_GEST_OUT_CONF_MASK UINT16_C(0x000F) - -/*! @name Bit position definitions for wrist gesture configuration */ -#define BMI2_WRIST_GEST_WEAR_ARM_POS UINT8_C(0x04) - -/*! @name Mask definitions for BMI2 wrist wear wake-up configuration */ -#define BMI2_WRIST_WAKE_UP_OUT_CONF_MASK UINT16_C(0x000F) - -/*! @name Mask definition for BMI2 wrist wear wake-up configuration for wearable variant */ -#define BMI2_WRIST_WAKE_UP_ANGLE_LR_MASK UINT16_C(0x00FF) -#define BMI2_WRIST_WAKE_UP_ANGLE_LL_MASK UINT16_C(0xFF00) -#define BMI2_WRIST_WAKE_UP_ANGLE_PD_MASK UINT16_C(0x00FF) -#define BMI2_WRIST_WAKE_UP_ANGLE_PU_MASK UINT16_C(0xFF00) -#define BMI2_WRIST_WAKE_UP_MIN_DUR_MOVED_MASK UINT16_C(0x00FF) -#define BMI2_WRIST_WAKE_UP_MIN_DUR_QUITE_MASK UINT16_C(0xFF00) - -/*! @name Bit position definition for BMI2 wrist wear wake-up configuration for wearable variant */ -#define BMI2_WRIST_WAKE_UP_ANGLE_LL_POS UINT16_C(0x0008) -#define BMI2_WRIST_WAKE_UP_ANGLE_PU_POS UINT16_C(0x0008) -#define BMI2_WRIST_WAKE_UP_MIN_DUR_QUITE_POS UINT16_C(0x0008) - -/*! @name Macros to define values of BMI2 axis and its sign for re-map - * settings - */ -#define BMI2_MAP_X_AXIS UINT8_C(0x00) -#define BMI2_MAP_Y_AXIS UINT8_C(0x01) -#define BMI2_MAP_Z_AXIS UINT8_C(0x02) -#define BMI2_MAP_POSITIVE UINT8_C(0x00) -#define BMI2_MAP_NEGATIVE UINT8_C(0x01) - -/*! @name Mask definitions of BMI2 axis re-mapping */ -#define BMI2_X_AXIS_MASK UINT8_C(0x03) -#define BMI2_X_AXIS_SIGN_MASK UINT8_C(0x04) -#define BMI2_Y_AXIS_MASK UINT8_C(0x18) -#define BMI2_Y_AXIS_SIGN_MASK UINT8_C(0x20) -#define BMI2_Z_AXIS_MASK UINT8_C(0xC0) -#define BMI2_Z_AXIS_SIGN_MASK UINT8_C(0x01) - -/*! @name Bit position definitions of BMI2 axis re-mapping */ -#define BMI2_X_AXIS_SIGN_POS UINT8_C(0x02) -#define BMI2_Y_AXIS_POS UINT8_C(0x03) -#define BMI2_Y_AXIS_SIGN_POS UINT8_C(0x05) -#define BMI2_Z_AXIS_POS UINT8_C(0x06) - -/*! @name Macros to define polarity */ -#define BMI2_NEG_SIGN INT16_C(-1) -#define BMI2_POS_SIGN INT16_C(1) - -/*! @name Macro to define related to CRT */ -#define BMI2_CRT_READY_FOR_DOWNLOAD_US UINT16_C(2000) -#define BMI2_CRT_READY_FOR_DOWNLOAD_RETRY UINT8_C(100) - -#define BMI2_CRT_WAIT_RUNNING_US UINT16_C(10000) -#define BMI2_CRT_WAIT_RUNNING_RETRY_EXECUTION UINT8_C(200) - -#define BMI2_CRT_MIN_BURST_WORD_LENGTH UINT8_C(2) -#define BMI2_CRT_MAX_BURST_WORD_LENGTH UINT16_C(255) - -#define BMI2_ACC_FOC_2G_REF UINT16_C(16384) -#define BMI2_ACC_FOC_4G_REF UINT16_C(8192) -#define BMI2_ACC_FOC_8G_REF UINT16_C(4096) -#define BMI2_ACC_FOC_16G_REF UINT16_C(2048) - -#define BMI2_GYRO_FOC_NOISE_LIMIT_NEGATIVE INT8_C(-20) -#define BMI2_GYRO_FOC_NOISE_LIMIT_POSITIVE INT8_C(20) - -/* reference value with positive and negative noise range in lsb */ -#define BMI2_ACC_2G_MAX_NOISE_LIMIT (BMI2_ACC_FOC_2G_REF + UINT16_C(255)) -#define BMI2_ACC_2G_MIN_NOISE_LIMIT (BMI2_ACC_FOC_2G_REF - UINT16_C(255)) -#define BMI2_ACC_4G_MAX_NOISE_LIMIT (BMI2_ACC_FOC_4G_REF + UINT16_C(255)) -#define BMI2_ACC_4G_MIN_NOISE_LIMIT (BMI2_ACC_FOC_4G_REF - UINT16_C(255)) -#define BMI2_ACC_8G_MAX_NOISE_LIMIT (BMI2_ACC_FOC_8G_REF + UINT16_C(255)) -#define BMI2_ACC_8G_MIN_NOISE_LIMIT (BMI2_ACC_FOC_8G_REF - UINT16_C(255)) -#define BMI2_ACC_16G_MAX_NOISE_LIMIT (BMI2_ACC_FOC_16G_REF + UINT16_C(255)) -#define BMI2_ACC_16G_MIN_NOISE_LIMIT (BMI2_ACC_FOC_16G_REF - UINT16_C(255)) - -#define BMI2_FOC_SAMPLE_LIMIT UINT8_C(128) - /***************************************************************************/ /*! Local structures @@ -402,30 +60,6 @@ struct bmi2_selftest_delta_limit int32_t z; }; -/*! @name Structure to store the local copy of the re-mapped axis and - * the value of its sign for register settings - */ -struct axes_remap -{ - /*! Re-mapped x-axis */ - uint8_t x_axis; - - /*! Re-mapped y-axis */ - uint8_t y_axis; - - /*! Re-mapped z-axis */ - uint8_t z_axis; - - /*! Re-mapped x-axis sign */ - uint8_t x_axis_sign; - - /*! Re-mapped y-axis sign */ - uint8_t y_axis_sign; - - /*! Re-mapped z-axis sign */ - uint8_t z_axis_sign; -}; - /*! @name Structure to store temporary accelerometer/gyroscope values */ struct bmi2_foc_temp_value { @@ -3496,7 +3130,7 @@ static int8_t validate_self_test(const struct bmi2_selftest_delta_limit *accel_d * @retval BMI2_E_INVALID_SENSOR - Error: Invalid sensor * @retval BMI2_E_INVALID_PAGE - Error: Invalid Page */ -static int8_t get_remap_axes(struct axes_remap *remap, struct bmi2_dev *dev); +static int8_t get_remap_axes(struct bmi2_axes_remap *remap, struct bmi2_dev *dev); /*! * @brief This internal API sets the re-mapped x, y and z axes in the sensor. @@ -3511,7 +3145,7 @@ static int8_t get_remap_axes(struct axes_remap *remap, struct bmi2_dev *dev); * @retval BMI2_E_INVALID_SENSOR - Error: Invalid sensor * @retval BMI2_E_INVALID_PAGE - Error: Invalid Page */ -static int8_t set_remap_axes(const struct axes_remap *remap, struct bmi2_dev *dev); +static int8_t set_remap_axes(const struct bmi2_axes_remap *remap, struct bmi2_dev *dev); /*! * @brief Interface to get max burst length @@ -4436,12 +4070,6 @@ int8_t bmi2_get_regs(uint8_t reg_addr, uint8_t *data, uint16_t len, struct bmi2_ /* Variable to define error */ int8_t rslt; - /* Variable to define temporary length */ - uint16_t temp_len = len + dev->dummy_byte; - - /* Variable to define temporary buffer */ - uint8_t temp_buf[temp_len]; - /* Variable to define loop */ uint16_t index = 0; @@ -4449,6 +4077,12 @@ int8_t bmi2_get_regs(uint8_t reg_addr, uint8_t *data, uint16_t len, struct bmi2_ rslt = null_ptr_check(dev); if ((rslt == BMI2_OK) && (data != NULL)) { + /* Variable to define temporary length */ + uint16_t temp_len = len + dev->dummy_byte; + + /* Variable to define temporary buffer */ + uint8_t temp_buf[temp_len]; + /* Configuring reg_addr for SPI Interface */ if (dev->intf == BMI2_SPI_INTF) { @@ -4710,22 +4344,18 @@ int8_t bmi2_set_sensor_config(struct bmi2_sens_config *sens_cfg, uint8_t n_sens, { /* Get status of advance power save mode */ aps_stat = dev->aps_status; + for (loop = 0; loop < n_sens; loop++) { /* Disable Advance power save if enabled for auxiliary * and feature configurations */ - if ((sens_cfg[loop].type != BMI2_ACCEL) || (sens_cfg[loop].type != BMI2_GYRO) || - (sens_cfg[loop].type != BMI2_TEMP) || (sens_cfg[loop].type != BMI2_AUX)) + if (aps_stat == BMI2_ENABLE) { - - if (aps_stat == BMI2_ENABLE) - { - /* Disable advance power save if - * enabled - */ - rslt = bmi2_set_adv_power_save(BMI2_DISABLE, dev); - } + /* Disable advance power save if + * enabled + */ + rslt = bmi2_set_adv_power_save(BMI2_DISABLE, dev); } if (rslt == BMI2_OK) @@ -6927,7 +6557,7 @@ int8_t bmi2_get_remap_axes(struct bmi2_remap *remapped_axis, struct bmi2_dev *de int8_t rslt; /* Initialize the local structure for axis re-mapping */ - struct axes_remap remap = { 0, 0, 0, 0, 0, 0 }; + struct bmi2_axes_remap remap = { 0, 0, 0, 0, 0, 0 }; /* Null-pointer check */ rslt = null_ptr_check(dev); @@ -7091,7 +6721,7 @@ int8_t bmi2_set_remap_axes(const struct bmi2_remap *remapped_axis, struct bmi2_d uint8_t remap_z = 0; /* Initialize the local structure for axis re-mapping */ - struct axes_remap remap = { 0, 0, 0, 0, 0, 0 }; + struct bmi2_axes_remap remap = { 0, 0, 0, 0, 0, 0 }; /* Null-pointer check */ rslt = null_ptr_check(dev); @@ -14846,16 +14476,43 @@ static void get_remapped_data(struct bmi2_sens_axes_data *data, const struct bmi { /* Array to defined the re-mapped sensor data */ int16_t remap_data[3] = { 0 }; + int16_t pos_multiplier = INT16_C(1); + int16_t neg_multiplier = INT16_C(-1); /* Fill the array with the un-mapped sensor data */ remap_data[0] = data->x; remap_data[1] = data->y; remap_data[2] = data->z; - /* Get the re-mapped x, y and z axes data */ - data->x = (int16_t)(remap_data[dev->remap.x_axis] * dev->remap.x_axis_sign); - data->y = (int16_t)(remap_data[dev->remap.y_axis] * dev->remap.y_axis_sign); - data->z = (int16_t)(remap_data[dev->remap.z_axis] * dev->remap.z_axis_sign); + /* Get the re-mapped x axis data */ + if (dev->remap.x_axis_sign == BMI2_POS_SIGN) + { + data->x = (int16_t)(remap_data[dev->remap.x_axis] * pos_multiplier); + } + else + { + data->x = (int16_t)(remap_data[dev->remap.x_axis] * neg_multiplier); + } + + /* Get the re-mapped y axis data */ + if (dev->remap.y_axis_sign == BMI2_POS_SIGN) + { + data->y = (int16_t)(remap_data[dev->remap.y_axis] * pos_multiplier); + } + else + { + data->y = (int16_t)(remap_data[dev->remap.y_axis] * neg_multiplier); + } + + /* Get the re-mapped z axis data */ + if (dev->remap.z_axis_sign == BMI2_POS_SIGN) + { + data->z = (int16_t)(remap_data[dev->remap.z_axis] * pos_multiplier); + } + else + { + data->z = (int16_t)(remap_data[dev->remap.z_axis] * neg_multiplier); + } } /*! @@ -15975,9 +15632,6 @@ static void unpack_accel_data(struct bmi2_sens_axes_data *acc, /* Variables to store MSB value */ uint16_t data_msb; - /* Array to defined the re-mapped accelerometer data */ - int16_t remap_data[3] = { 0 }; - /* Accelerometer raw x data */ data_lsb = fifo->data[data_start_index++]; data_msb = fifo->data[data_start_index++]; @@ -15993,15 +15647,8 @@ static void unpack_accel_data(struct bmi2_sens_axes_data *acc, data_msb = fifo->data[data_start_index++]; acc->z = (int16_t)((data_msb << 8) | data_lsb); - /* Fill the array with the un-mapped accelerometer data */ - remap_data[0] = acc->x; - remap_data[1] = acc->y; - remap_data[2] = acc->z; - - /* Get the re-mapped x, y and z accelerometer data */ - acc->x = (int16_t)(remap_data[dev->remap.x_axis] * dev->remap.x_axis_sign); - acc->y = (int16_t)(remap_data[dev->remap.y_axis] * dev->remap.y_axis_sign); - acc->z = (int16_t)(remap_data[dev->remap.z_axis] * dev->remap.z_axis_sign); + /* Get the re-mapped accelerometer data */ + get_remapped_data(acc, dev); } /*! @@ -16389,9 +16036,6 @@ static void unpack_gyro_data(struct bmi2_sens_axes_data *gyr, /* Variables to store MSB value */ uint16_t data_msb; - /* Array to defined the re-mapped gyroscope data */ - int16_t remap_data[3] = { 0 }; - /* Gyroscope raw x data */ data_lsb = fifo->data[data_start_index++]; data_msb = fifo->data[data_start_index++]; @@ -16410,15 +16054,8 @@ static void unpack_gyro_data(struct bmi2_sens_axes_data *gyr, /* Get the compensated gyroscope data */ comp_gyro_cross_axis_sensitivity(gyr, dev); - /* Fill the array with the un-mapped gyroscope data */ - remap_data[0] = gyr->x; - remap_data[1] = gyr->y; - remap_data[2] = gyr->z; - - /* Get the re-mapped x, y and z gyroscope data */ - gyr->x = (int16_t)(remap_data[dev->remap.x_axis] * dev->remap.x_axis_sign); - gyr->y = (int16_t)(remap_data[dev->remap.y_axis] * dev->remap.y_axis_sign); - gyr->z = (int16_t)(remap_data[dev->remap.z_axis] * dev->remap.z_axis_sign); + /* Get the re-mapped gyroscope data */ + get_remapped_data(gyr, dev); } /*! @@ -17460,7 +17097,7 @@ static int8_t validate_self_test(const struct bmi2_selftest_delta_limit *accel_d /*! * @brief This internal API gets the re-mapped x, y and z axes from the sensor. */ -static int8_t get_remap_axes(struct axes_remap *remap, struct bmi2_dev *dev) +static int8_t get_remap_axes(struct bmi2_axes_remap *remap, struct bmi2_dev *dev) { /* Variable to define error */ int8_t rslt = BMI2_OK; @@ -17542,7 +17179,7 @@ static int8_t get_remap_axes(struct axes_remap *remap, struct bmi2_dev *dev) /*! * @brief This internal API sets the re-mapped x, y and z axes in the sensor. */ -static int8_t set_remap_axes(const struct axes_remap *remap, struct bmi2_dev *dev) +static int8_t set_remap_axes(const struct bmi2_axes_remap *remap, struct bmi2_dev *dev) { /* Variable to define error */ int8_t rslt = BMI2_OK; diff --git a/bmi2.h b/bmi2.h index 836b3fb..e483eba 100644 --- a/bmi2.h +++ b/bmi2.h @@ -31,8 +31,8 @@ * POSSIBILITY OF SUCH DAMAGE. * * @file bmi2.h - * @date 2020-04-29 - * @version v2.53.0 + * @date 2020-06-05 + * @version v2.53.2 * */ diff --git a/bmi270.c b/bmi270.c index a362789..92ecb43 100644 --- a/bmi270.c +++ b/bmi270.c @@ -31,8 +31,8 @@ * POSSIBILITY OF SUCH DAMAGE. * * @file bmi270.c - * @date 2020-04-29 - * @version v2.53.0 + * @date 2020-06-05 + * @version v2.53.2 * */ diff --git a/bmi270.h b/bmi270.h index 50857ca..356749c 100644 --- a/bmi270.h +++ b/bmi270.h @@ -31,8 +31,8 @@ * POSSIBILITY OF SUCH DAMAGE. * * @file bmi270.h - * @date 2020-04-29 - * @version v2.53.0 + * @date 2020-06-05 + * @version v2.53.2 * */ @@ -62,49 +62,49 @@ extern "C" { ****************************************************************************/ /*! @name BMI270 Chip identifier */ -#define BMI270_CHIP_ID UINT8_C(0x24) +#define BMI270_CHIP_ID UINT8_C(0x24) /*! @name BMI270 feature input start addresses */ -#define BMI270_MAX_BURST_LEN_STRT_ADDR UINT8_C(0x02) -#define BMI270_CRT_GYRO_SELF_TEST_STRT_ADDR UINT8_C(0x03) -#define BMI270_ABORT_STRT_ADDR UINT8_C(0x03) -#define BMI270_AXIS_MAP_STRT_ADDR UINT8_C(0x04) -#define BMI270_GYRO_SELF_OFF_STRT_ADDR UINT8_C(0x05) -#define BMI270_NVM_PROG_PREP_STRT_ADDR UINT8_C(0x05) -#define BMI270_GYRO_GAIN_UPDATE_STRT_ADDR UINT8_C(0x06) -#define BMI270_ANY_MOT_STRT_ADDR UINT8_C(0x0C) -#define BMI270_NO_MOT_STRT_ADDR UINT8_C(0x00) -#define BMI270_SIG_MOT_STRT_ADDR UINT8_C(0x04) -#define BMI270_STEP_CNT_1_STRT_ADDR UINT8_C(0x00) -#define BMI270_STEP_CNT_4_STRT_ADDR UINT8_C(0x02) -#define BMI270_WRIST_GEST_STRT_ADDR UINT8_C(0x06) -#define BMI270_WRIST_WEAR_WAKE_UP_STRT_ADDR UINT8_C(0x00) +#define BMI270_MAX_BURST_LEN_STRT_ADDR UINT8_C(0x02) +#define BMI270_CRT_GYRO_SELF_TEST_STRT_ADDR UINT8_C(0x03) +#define BMI270_ABORT_STRT_ADDR UINT8_C(0x03) +#define BMI270_AXIS_MAP_STRT_ADDR UINT8_C(0x04) +#define BMI270_GYRO_SELF_OFF_STRT_ADDR UINT8_C(0x05) +#define BMI270_NVM_PROG_PREP_STRT_ADDR UINT8_C(0x05) +#define BMI270_GYRO_GAIN_UPDATE_STRT_ADDR UINT8_C(0x06) +#define BMI270_ANY_MOT_STRT_ADDR UINT8_C(0x0C) +#define BMI270_NO_MOT_STRT_ADDR UINT8_C(0x00) +#define BMI270_SIG_MOT_STRT_ADDR UINT8_C(0x04) +#define BMI270_STEP_CNT_1_STRT_ADDR UINT8_C(0x00) +#define BMI270_STEP_CNT_4_STRT_ADDR UINT8_C(0x02) +#define BMI270_WRIST_GEST_STRT_ADDR UINT8_C(0x06) +#define BMI270_WRIST_WEAR_WAKE_UP_STRT_ADDR UINT8_C(0x00) /*! @name BMI270 feature output start addresses */ -#define BMI270_STEP_CNT_OUT_STRT_ADDR UINT8_C(0x00) -#define BMI270_STEP_ACT_OUT_STRT_ADDR UINT8_C(0x04) -#define BMI270_WRIST_GEST_OUT_STRT_ADDR UINT8_C(0x06) -#define BMI270_GYR_USER_GAIN_OUT_STRT_ADDR UINT8_C(0x08) -#define BMI270_GYRO_CROSS_SENSE_STRT_ADDR UINT8_C(0x0C) -#define BMI270_NVM_VFRM_OUT_STRT_ADDR UINT8_C(0x0E) +#define BMI270_STEP_CNT_OUT_STRT_ADDR UINT8_C(0x00) +#define BMI270_STEP_ACT_OUT_STRT_ADDR UINT8_C(0x04) +#define BMI270_WRIST_GEST_OUT_STRT_ADDR UINT8_C(0x06) +#define BMI270_GYR_USER_GAIN_OUT_STRT_ADDR UINT8_C(0x08) +#define BMI270_GYRO_CROSS_SENSE_STRT_ADDR UINT8_C(0x0C) +#define BMI270_NVM_VFRM_OUT_STRT_ADDR UINT8_C(0x0E) /*! @name Defines maximum number of pages */ -#define BMI270_MAX_PAGE_NUM UINT8_C(8) +#define BMI270_MAX_PAGE_NUM UINT8_C(8) /*! @name Defines maximum number of feature input configurations */ -#define BMI270_MAX_FEAT_IN UINT8_C(16) +#define BMI270_MAX_FEAT_IN UINT8_C(16) /*! @name Defines maximum number of feature outputs */ -#define BMI270_MAX_FEAT_OUT UINT8_C(7) +#define BMI270_MAX_FEAT_OUT UINT8_C(7) /*! @name Mask definitions for feature interrupt status bits */ -#define BMI270_SIG_MOT_STATUS_MASK UINT8_C(0x01) -#define BMI270_STEP_CNT_STATUS_MASK UINT8_C(0x02) -#define BMI270_STEP_ACT_STATUS_MASK UINT8_C(0x04) -#define BMI270_WRIST_WAKE_UP_STATUS_MASK UINT8_C(0x08) -#define BMI270_WRIST_GEST_STATUS_MASK UINT8_C(0x10) -#define BMI270_NO_MOT_STATUS_MASK UINT8_C(0x20) -#define BMI270_ANY_MOT_STATUS_MASK UINT8_C(0x40) +#define BMI270_SIG_MOT_STATUS_MASK UINT8_C(0x01) +#define BMI270_STEP_CNT_STATUS_MASK UINT8_C(0x02) +#define BMI270_STEP_ACT_STATUS_MASK UINT8_C(0x04) +#define BMI270_WRIST_WAKE_UP_STATUS_MASK UINT8_C(0x08) +#define BMI270_WRIST_GEST_STATUS_MASK UINT8_C(0x10) +#define BMI270_NO_MOT_STATUS_MASK UINT8_C(0x20) +#define BMI270_ANY_MOT_STATUS_MASK UINT8_C(0x40) /***************************************************************************/ diff --git a/bmi270_context.c b/bmi270_context.c index 38f03b9..7ec5a14 100644 --- a/bmi270_context.c +++ b/bmi270_context.c @@ -31,8 +31,8 @@ * POSSIBILITY OF SUCH DAMAGE. * * @file bmi270_context.c - * @date 2020-04-29 - * @version v2.53.0 + * @date 2020-06-05 + * @version v2.53.2 * */ diff --git a/bmi270_context.h b/bmi270_context.h index 6874b5f..2e7f97c 100644 --- a/bmi270_context.h +++ b/bmi270_context.h @@ -31,8 +31,8 @@ * POSSIBILITY OF SUCH DAMAGE. * * @file bmi270_context.h - * @date 2020-04-29 - * @version v2.53.0 + * @date 2020-06-05 + * @version v2.53.2 * */ @@ -62,35 +62,35 @@ extern "C" { ****************************************************************************/ /*! @name BMI270_CONTEXT Chip identifier */ -#define BMI270_CONTEXT_CHIP_ID UINT8_C(0x24) +#define BMI270_CONTEXT_CHIP_ID UINT8_C(0x24) /*! @name BMI270_CONTEXT feature input start addresses */ -#define BMI270_CONTEXT_STEP_CNT_1_STRT_ADDR UINT8_C(0x00) -#define BMI270_CONTEXT_STEP_CNT_4_STRT_ADDR UINT8_C(0x02) -#define BMI270_CONTEXT_MAX_BURST_LEN_STRT_ADDR UINT8_C(0x08) -#define BMI270_CONTEXT_CRT_GYRO_SELF_TEST_STRT_ADDR UINT8_C(0x09) -#define BMI270_CONTEXT_ABORT_STRT_ADDR UINT8_C(0x09) -#define BMI270_CONTEXT_NVM_PROG_PREP_STRT_ADDR UINT8_C(0x0A) -#define BMI270_CONTEXT_ACT_RGN_SETT_STRT_ADDR UINT8_C(0x00) -#define BMI270_CONTEXT_ACT_RGN_STRT_ADDR UINT8_C(0x0A) +#define BMI270_CONTEXT_STEP_CNT_1_STRT_ADDR UINT8_C(0x00) +#define BMI270_CONTEXT_STEP_CNT_4_STRT_ADDR UINT8_C(0x02) +#define BMI270_CONTEXT_MAX_BURST_LEN_STRT_ADDR UINT8_C(0x08) +#define BMI270_CONTEXT_CRT_GYRO_SELF_TEST_STRT_ADDR UINT8_C(0x09) +#define BMI270_CONTEXT_ABORT_STRT_ADDR UINT8_C(0x09) +#define BMI270_CONTEXT_NVM_PROG_PREP_STRT_ADDR UINT8_C(0x0A) +#define BMI270_CONTEXT_ACT_RGN_SETT_STRT_ADDR UINT8_C(0x00) +#define BMI270_CONTEXT_ACT_RGN_STRT_ADDR UINT8_C(0x0A) /*! @name BMI270_CONTEXT feature output start addresses */ -#define BMI270_CONTEXT_STEP_CNT_OUT_STRT_ADDR UINT8_C(0x00) -#define BMI270_CONTEXT_GYR_USER_GAIN_OUT_STRT_ADDR UINT8_C(0x04) -#define BMI270_CONTEXT_GYRO_CROSS_SENSE_STRT_ADDR UINT8_C(0x0C) -#define BMI270_CONTEXT_NVM_VFRM_OUT_STRT_ADDR UINT8_C(0x0E) +#define BMI270_CONTEXT_STEP_CNT_OUT_STRT_ADDR UINT8_C(0x00) +#define BMI270_CONTEXT_GYR_USER_GAIN_OUT_STRT_ADDR UINT8_C(0x04) +#define BMI270_CONTEXT_GYRO_CROSS_SENSE_STRT_ADDR UINT8_C(0x0C) +#define BMI270_CONTEXT_NVM_VFRM_OUT_STRT_ADDR UINT8_C(0x0E) /*! @name Defines maximum number of pages */ -#define BMI270_CONTEXT_MAX_PAGE_NUM UINT8_C(8) +#define BMI270_CONTEXT_MAX_PAGE_NUM UINT8_C(8) /*! @name Defines maximum number of feature input configurations */ -#define BMI270_CONTEXT_MAX_FEAT_IN UINT8_C(9) +#define BMI270_CONTEXT_MAX_FEAT_IN UINT8_C(9) /*! @name Defines maximum number of feature outputs */ -#define BMI270_CONTEXT_MAX_FEAT_OUT UINT8_C(5) +#define BMI270_CONTEXT_MAX_FEAT_OUT UINT8_C(5) /*! @name Mask definitions for feature interrupt status bits */ -#define BMI270_CONTEXT_STEP_CNT_STATUS_MASK UINT8_C(0x01) +#define BMI270_CONTEXT_STEP_CNT_STATUS_MASK UINT8_C(0x01) /***************************************************************************/ diff --git a/bmi2_defs.h b/bmi2_defs.h index 4b15569..34d5d66 100644 --- a/bmi2_defs.h +++ b/bmi2_defs.h @@ -31,8 +31,8 @@ * POSSIBILITY OF SUCH DAMAGE. * * @file bmi2_defs.h - * @date 2020-04-29 - * @version v2.53.0 + * @date 2020-06-05 + * @version v2.53.2 * */ @@ -55,32 +55,32 @@ /******************************************************************************/ #ifdef __KERNEL__ #if !defined(UINT8_C) && !defined(INT8_C) -#define INT8_C(x) S8_C(x) -#define UINT8_C(x) U8_C(x) +#define INT8_C(x) S8_C(x) +#define UINT8_C(x) U8_C(x) #endif #if !defined(UINT16_C) && !defined(INT16_C) -#define INT16_C(x) S16_C(x) -#define UINT16_C(x) U16_C(x) +#define INT16_C(x) S16_C(x) +#define UINT16_C(x) U16_C(x) #endif #if !defined(INT32_C) && !defined(UINT32_C) -#define INT32_C(x) S32_C(x) -#define UINT32_C(x) U32_C(x) +#define INT32_C(x) S32_C(x) +#define UINT32_C(x) U32_C(x) #endif #if !defined(INT64_C) && !defined(UINT64_C) -#define INT64_C(x) S64_C(x) -#define UINT64_C(x) U64_C(x) +#define INT64_C(x) S64_C(x) +#define UINT64_C(x) U64_C(x) #endif #endif /*! @name C standard macros */ #ifndef NULL #ifdef __cplusplus -#define NULL 0 +#define NULL 0 #else -#define NULL ((void *) 0) +#define NULL ((void *) 0) #endif #endif @@ -100,391 +100,731 @@ ((reg_data & ~(bitname##_MASK)) | \ (data & bitname##_MASK)) -#define BMI2_GET_BIT_POS0(reg_data, bitname) (reg_data & (bitname##_MASK)) -#define BMI2_SET_BIT_VAL0(reg_data, bitname) (reg_data & ~(bitname##_MASK)) +#define BMI2_GET_BIT_POS0(reg_data, bitname) (reg_data & (bitname##_MASK)) +#define BMI2_SET_BIT_VAL0(reg_data, bitname) (reg_data & ~(bitname##_MASK)) /*! @name For getting LSB and MSB */ -#define BMI2_GET_LSB(var) (uint8_t)(var & BMI2_SET_LOW_BYTE) -#define BMI2_GET_MSB(var) (uint8_t)((var & BMI2_SET_HIGH_BYTE) >> 8) +#define BMI2_GET_LSB(var) (uint8_t)(var & BMI2_SET_LOW_BYTE) +#define BMI2_GET_MSB(var) (uint8_t)((var & BMI2_SET_HIGH_BYTE) >> 8) #ifndef BMI2_INTF_RETURN_TYPE -#define BMI2_INTF_RETURN_TYPE int8_t +#define BMI2_INTF_RETURN_TYPE int8_t #endif /*! @name For defining absolute values */ -#define BMI2_ABS(a) ((a) > 0 ? (a) : -(a)) +#define BMI2_ABS(a) ((a) > 0 ? (a) : -(a)) /*! @name LSB and MSB mask definitions */ -#define BMI2_SET_LOW_BYTE UINT16_C(0x00FF) -#define BMI2_SET_HIGH_BYTE UINT16_C(0xFF00) -#define BMI2_SET_LOW_NIBBLE UINT8_C(0x0F) +#define BMI2_SET_LOW_BYTE UINT16_C(0x00FF) +#define BMI2_SET_HIGH_BYTE UINT16_C(0xFF00) +#define BMI2_SET_LOW_NIBBLE UINT8_C(0x0F) /*! @name For enable and disable */ -#define BMI2_ENABLE UINT8_C(1) -#define BMI2_DISABLE UINT8_C(0) +#define BMI2_ENABLE UINT8_C(1) +#define BMI2_DISABLE UINT8_C(0) /*! @name To define TRUE or FALSE */ -#define BMI2_TRUE UINT8_C(1) -#define BMI2_FALSE UINT8_C(0) +#define BMI2_TRUE UINT8_C(1) +#define BMI2_FALSE UINT8_C(0) /*! @name To define sensor interface success code */ -#define BMI2_INTF_RET_SUCCESS INT8_C(0) +#define BMI2_INTF_RET_SUCCESS INT8_C(0) /*! @name To define success code */ -#define BMI2_OK INT8_C(0) +#define BMI2_OK INT8_C(0) /*! @name To define error codes */ -#define BMI2_E_NULL_PTR INT8_C(-1) -#define BMI2_E_COM_FAIL INT8_C(-2) -#define BMI2_E_DEV_NOT_FOUND INT8_C(-3) -#define BMI2_E_OUT_OF_RANGE INT8_C(-4) -#define BMI2_E_ACC_INVALID_CFG INT8_C(-5) -#define BMI2_E_GYRO_INVALID_CFG INT8_C(-6) -#define BMI2_E_ACC_GYR_INVALID_CFG INT8_C(-7) -#define BMI2_E_INVALID_SENSOR INT8_C(-8) -#define BMI2_E_CONFIG_LOAD INT8_C(-9) -#define BMI2_E_INVALID_PAGE INT8_C(-10) -#define BMI2_E_INVALID_FEAT_BIT INT8_C(-11) -#define BMI2_E_INVALID_INT_PIN INT8_C(-12) -#define BMI2_E_SET_APS_FAIL INT8_C(-13) -#define BMI2_E_AUX_INVALID_CFG INT8_C(-14) -#define BMI2_E_AUX_BUSY INT8_C(-15) -#define BMI2_E_SELF_TEST_FAIL INT8_C(-16) -#define BMI2_E_REMAP_ERROR INT8_C(-17) -#define BMI2_E_GYR_USER_GAIN_UPD_FAIL INT8_C(-18) -#define BMI2_E_SELF_TEST_NOT_DONE INT8_C(-19) -#define BMI2_E_INVALID_INPUT INT8_C(-20) -#define BMI2_E_INVALID_STATUS INT8_C(-21) -#define BMI2_E_CRT_ERROR INT8_C(-22) -#define BMI2_E_ST_ALREADY_RUNNING INT8_C(-23) -#define BMI2_E_CRT_READY_FOR_DL_FAIL_ABORT INT8_C(-24) -#define BMI2_E_DL_ERROR INT8_C(-25) -#define BMI2_E_PRECON_ERROR INT8_C(-26) -#define BMI2_E_ABORT_ERROR INT8_C(-27) -#define BMI2_E_GYRO_SELF_TEST_ERROR INT8_C(-28) -#define BMI2_E_GYRO_SELF_TEST_TIMEOUT INT8_C(-29) -#define BMI2_E_WRITE_CYCLE_ONGOING INT8_C(-30) -#define BMI2_E_WRITE_CYCLE_TIMEOUT INT8_C(-31) -#define BMI2_E_ST_NOT_RUNING INT8_C(-32) -#define BMI2_E_DATA_RDY_INT_FAILED INT8_C(-33) -#define BMI2_E_INVALID_FOC_POSITION INT8_C(-34) +#define BMI2_E_NULL_PTR INT8_C(-1) +#define BMI2_E_COM_FAIL INT8_C(-2) +#define BMI2_E_DEV_NOT_FOUND INT8_C(-3) +#define BMI2_E_OUT_OF_RANGE INT8_C(-4) +#define BMI2_E_ACC_INVALID_CFG INT8_C(-5) +#define BMI2_E_GYRO_INVALID_CFG INT8_C(-6) +#define BMI2_E_ACC_GYR_INVALID_CFG INT8_C(-7) +#define BMI2_E_INVALID_SENSOR INT8_C(-8) +#define BMI2_E_CONFIG_LOAD INT8_C(-9) +#define BMI2_E_INVALID_PAGE INT8_C(-10) +#define BMI2_E_INVALID_FEAT_BIT INT8_C(-11) +#define BMI2_E_INVALID_INT_PIN INT8_C(-12) +#define BMI2_E_SET_APS_FAIL INT8_C(-13) +#define BMI2_E_AUX_INVALID_CFG INT8_C(-14) +#define BMI2_E_AUX_BUSY INT8_C(-15) +#define BMI2_E_SELF_TEST_FAIL INT8_C(-16) +#define BMI2_E_REMAP_ERROR INT8_C(-17) +#define BMI2_E_GYR_USER_GAIN_UPD_FAIL INT8_C(-18) +#define BMI2_E_SELF_TEST_NOT_DONE INT8_C(-19) +#define BMI2_E_INVALID_INPUT INT8_C(-20) +#define BMI2_E_INVALID_STATUS INT8_C(-21) +#define BMI2_E_CRT_ERROR INT8_C(-22) +#define BMI2_E_ST_ALREADY_RUNNING INT8_C(-23) +#define BMI2_E_CRT_READY_FOR_DL_FAIL_ABORT INT8_C(-24) +#define BMI2_E_DL_ERROR INT8_C(-25) +#define BMI2_E_PRECON_ERROR INT8_C(-26) +#define BMI2_E_ABORT_ERROR INT8_C(-27) +#define BMI2_E_GYRO_SELF_TEST_ERROR INT8_C(-28) +#define BMI2_E_GYRO_SELF_TEST_TIMEOUT INT8_C(-29) +#define BMI2_E_WRITE_CYCLE_ONGOING INT8_C(-30) +#define BMI2_E_WRITE_CYCLE_TIMEOUT INT8_C(-31) +#define BMI2_E_ST_NOT_RUNING INT8_C(-32) +#define BMI2_E_DATA_RDY_INT_FAILED INT8_C(-33) +#define BMI2_E_INVALID_FOC_POSITION INT8_C(-34) /*! @name To define warnings for FIFO activity */ -#define BMI2_W_FIFO_EMPTY INT8_C(1) -#define BMI2_W_PARTIAL_READ INT8_C(2) +#define BMI2_W_FIFO_EMPTY INT8_C(1) +#define BMI2_W_PARTIAL_READ INT8_C(2) /*! @name Bit wise to define information */ -#define BMI2_I_MIN_VALUE UINT8_C(1) -#define BMI2_I_MAX_VALUE UINT8_C(2) +#define BMI2_I_MIN_VALUE UINT8_C(1) +#define BMI2_I_MAX_VALUE UINT8_C(2) /*! @name BMI2 register addresses */ -#define BMI2_CHIP_ID_ADDR UINT8_C(0x00) -#define BMI2_STATUS_ADDR UINT8_C(0x03) -#define BMI2_AUX_X_LSB_ADDR UINT8_C(0x04) -#define BMI2_ACC_X_LSB_ADDR UINT8_C(0x0C) -#define BMI2_GYR_X_LSB_ADDR UINT8_C(0x12) -#define BMI2_EVENT_ADDR UINT8_C(0x1B) -#define BMI2_INT_STATUS_0_ADDR UINT8_C(0x1C) -#define BMI2_INT_STATUS_1_ADDR UINT8_C(0x1D) -#define BMI2_SC_OUT_0_ADDR UINT8_C(0x1E) -#define BMI2_SYNC_COMMAND_ADDR UINT8_C(0x1E) -#define BMI2_GYR_CAS_GPIO0_ADDR UINT8_C(0x1E) -#define BMI2_INTERNAL_STATUS_ADDR UINT8_C(0x21) -#define BMI2_FIFO_LENGTH_0_ADDR UINT8_C(0X24) -#define BMI2_FIFO_DATA_ADDR UINT8_C(0X26) -#define BMI2_FEAT_PAGE_ADDR UINT8_C(0x2F) -#define BMI2_FEATURES_REG_ADDR UINT8_C(0x30) -#define BMI2_ACC_CONF_ADDR UINT8_C(0x40) -#define BMI2_GYR_CONF_ADDR UINT8_C(0x42) -#define BMI2_AUX_CONF_ADDR UINT8_C(0x44) -#define BMI2_FIFO_DOWNS_ADDR UINT8_C(0X45) -#define BMI2_FIFO_WTM_0_ADDR UINT8_C(0X46) -#define BMI2_FIFO_WTM_1_ADDR UINT8_C(0X47) -#define BMI2_FIFO_CONFIG_0_ADDR UINT8_C(0X48) -#define BMI2_FIFO_CONFIG_1_ADDR UINT8_C(0X49) -#define BMI2_AUX_DEV_ID_ADDR UINT8_C(0x4B) -#define BMI2_AUX_IF_CONF_ADDR UINT8_C(0x4C) -#define BMI2_AUX_RD_ADDR UINT8_C(0x4D) -#define BMI2_AUX_WR_ADDR UINT8_C(0x4E) -#define BMI2_AUX_WR_DATA_ADDR UINT8_C(0x4F) -#define BMI2_INT1_IO_CTRL_ADDR UINT8_C(0x53) -#define BMI2_INT2_IO_CTRL_ADDR UINT8_C(0x54) -#define BMI2_INT_LATCH_ADDR UINT8_C(0x55) -#define BMI2_INT1_MAP_FEAT_ADDR UINT8_C(0x56) -#define BMI2_INT2_MAP_FEAT_ADDR UINT8_C(0x57) -#define BMI2_INT_MAP_DATA_ADDR UINT8_C(0x58) -#define BMI2_INIT_CTRL_ADDR UINT8_C(0x59) -#define BMI2_INIT_ADDR_0 UINT8_C(0x5B) -#define BMI2_INIT_ADDR_1 UINT8_C(0x5C) -#define BMI2_INIT_DATA_ADDR UINT8_C(0x5E) -#define BMI2_AUX_IF_TRIM UINT8_C(0x68) -#define BMI2_GYR_CRT_CONF_ADDR UINT8_C(0X69) -#define BMI2_NVM_CONF_ADDR UINT8_C(0x6A) -#define BMI2_IF_CONF_ADDR UINT8_C(0X6B) -#define BMI2_ACC_SELF_TEST_ADDR UINT8_C(0X6D) -#define BMI2_GYR_SELF_TEST_AXES_ADDR UINT8_C(0x6E) -#define BMI2_SELF_TEST_MEMS_ADDR UINT8_C(0X6F) -#define BMI2_NV_CONF_ADDR UINT8_C(0x70) -#define BMI2_ACC_OFF_COMP_0_ADDR UINT8_C(0X71) -#define BMI2_GYR_OFF_COMP_3_ADDR UINT8_C(0X74) -#define BMI2_GYR_OFF_COMP_6_ADDR UINT8_C(0X77) -#define BMI2_GYR_USR_GAIN_0_ADDR UINT8_C(0X78) -#define BMI2_PWR_CONF_ADDR UINT8_C(0x7C) -#define BMI2_PWR_CTRL_ADDR UINT8_C(0x7D) -#define BMI2_CMD_REG_ADDR UINT8_C(0x7E) +#define BMI2_CHIP_ID_ADDR UINT8_C(0x00) +#define BMI2_STATUS_ADDR UINT8_C(0x03) +#define BMI2_AUX_X_LSB_ADDR UINT8_C(0x04) +#define BMI2_ACC_X_LSB_ADDR UINT8_C(0x0C) +#define BMI2_GYR_X_LSB_ADDR UINT8_C(0x12) +#define BMI2_EVENT_ADDR UINT8_C(0x1B) +#define BMI2_INT_STATUS_0_ADDR UINT8_C(0x1C) +#define BMI2_INT_STATUS_1_ADDR UINT8_C(0x1D) +#define BMI2_SC_OUT_0_ADDR UINT8_C(0x1E) +#define BMI2_SYNC_COMMAND_ADDR UINT8_C(0x1E) +#define BMI2_GYR_CAS_GPIO0_ADDR UINT8_C(0x1E) +#define BMI2_INTERNAL_STATUS_ADDR UINT8_C(0x21) +#define BMI2_FIFO_LENGTH_0_ADDR UINT8_C(0X24) +#define BMI2_FIFO_DATA_ADDR UINT8_C(0X26) +#define BMI2_FEAT_PAGE_ADDR UINT8_C(0x2F) +#define BMI2_FEATURES_REG_ADDR UINT8_C(0x30) +#define BMI2_ACC_CONF_ADDR UINT8_C(0x40) +#define BMI2_GYR_CONF_ADDR UINT8_C(0x42) +#define BMI2_AUX_CONF_ADDR UINT8_C(0x44) +#define BMI2_FIFO_DOWNS_ADDR UINT8_C(0X45) +#define BMI2_FIFO_WTM_0_ADDR UINT8_C(0X46) +#define BMI2_FIFO_WTM_1_ADDR UINT8_C(0X47) +#define BMI2_FIFO_CONFIG_0_ADDR UINT8_C(0X48) +#define BMI2_FIFO_CONFIG_1_ADDR UINT8_C(0X49) +#define BMI2_AUX_DEV_ID_ADDR UINT8_C(0x4B) +#define BMI2_AUX_IF_CONF_ADDR UINT8_C(0x4C) +#define BMI2_AUX_RD_ADDR UINT8_C(0x4D) +#define BMI2_AUX_WR_ADDR UINT8_C(0x4E) +#define BMI2_AUX_WR_DATA_ADDR UINT8_C(0x4F) +#define BMI2_INT1_IO_CTRL_ADDR UINT8_C(0x53) +#define BMI2_INT2_IO_CTRL_ADDR UINT8_C(0x54) +#define BMI2_INT_LATCH_ADDR UINT8_C(0x55) +#define BMI2_INT1_MAP_FEAT_ADDR UINT8_C(0x56) +#define BMI2_INT2_MAP_FEAT_ADDR UINT8_C(0x57) +#define BMI2_INT_MAP_DATA_ADDR UINT8_C(0x58) +#define BMI2_INIT_CTRL_ADDR UINT8_C(0x59) +#define BMI2_INIT_ADDR_0 UINT8_C(0x5B) +#define BMI2_INIT_ADDR_1 UINT8_C(0x5C) +#define BMI2_INIT_DATA_ADDR UINT8_C(0x5E) +#define BMI2_AUX_IF_TRIM UINT8_C(0x68) +#define BMI2_GYR_CRT_CONF_ADDR UINT8_C(0X69) +#define BMI2_NVM_CONF_ADDR UINT8_C(0x6A) +#define BMI2_IF_CONF_ADDR UINT8_C(0X6B) +#define BMI2_ACC_SELF_TEST_ADDR UINT8_C(0X6D) +#define BMI2_GYR_SELF_TEST_AXES_ADDR UINT8_C(0x6E) +#define BMI2_SELF_TEST_MEMS_ADDR UINT8_C(0X6F) +#define BMI2_NV_CONF_ADDR UINT8_C(0x70) +#define BMI2_ACC_OFF_COMP_0_ADDR UINT8_C(0X71) +#define BMI2_GYR_OFF_COMP_3_ADDR UINT8_C(0X74) +#define BMI2_GYR_OFF_COMP_6_ADDR UINT8_C(0X77) +#define BMI2_GYR_USR_GAIN_0_ADDR UINT8_C(0X78) +#define BMI2_PWR_CONF_ADDR UINT8_C(0x7C) +#define BMI2_PWR_CTRL_ADDR UINT8_C(0x7D) +#define BMI2_CMD_REG_ADDR UINT8_C(0x7E) /*! @name BMI2 I2C address */ -#define BMI2_I2C_PRIM_ADDR UINT8_C(0x68) -#define BMI2_I2C_SEC_ADDR UINT8_C(0x69) +#define BMI2_I2C_PRIM_ADDR UINT8_C(0x68) +#define BMI2_I2C_SEC_ADDR UINT8_C(0x69) /*! @name BMI2 Commands */ -#define BMI2_G_TRIGGER_CMD UINT8_C(0x02) -#define BMI2_USR_GAIN_CMD UINT8_C(0x03) -#define BMI2_NVM_PROG_CMD UINT8_C(0xA0) -#define BMI2_SOFT_RESET_CMD UINT8_C(0xB6) -#define BMI2_FIFO_FLUSH_CMD UINT8_C(0xB0) - -/*! @name Mask definitions for ..... */ -#define BMI2_GYR_RDY_FOR_DL_MASK UINT8_C(0x08) -#define BMI2_GYR_CRT_RUNNING_MASK UINT8_C(0x04) - -/*! @name Bit position definitions..... */ -#define BMI2_GYR_RDY_FOR_DL_POS UINT8_C(0x03) -#define BMI2_GYR_CRT_RUNNING_POS UINT8_C(0x02) +#define BMI2_G_TRIGGER_CMD UINT8_C(0x02) +#define BMI2_USR_GAIN_CMD UINT8_C(0x03) +#define BMI2_NVM_PROG_CMD UINT8_C(0xA0) +#define BMI2_SOFT_RESET_CMD UINT8_C(0xB6) +#define BMI2_FIFO_FLUSH_CMD UINT8_C(0xB0) /*! @name BMI2 sensor data bytes */ -#define BMI2_ACC_GYR_NUM_BYTES UINT8_C(6) -#define BMI2_AUX_NUM_BYTES UINT8_C(8) -#define BMI2_CRT_CONFIG_FILE_SIZE UINT16_C(2048) -#define BMI2_FEAT_SIZE_IN_BYTES UINT8_C(16) -#define BMI2_ACC_CONFIG_LENGTH UINT8_C(2) +#define BMI2_ACC_GYR_NUM_BYTES UINT8_C(6) +#define BMI2_AUX_NUM_BYTES UINT8_C(8) +#define BMI2_CRT_CONFIG_FILE_SIZE UINT16_C(2048) +#define BMI2_FEAT_SIZE_IN_BYTES UINT8_C(16) +#define BMI2_ACC_CONFIG_LENGTH UINT8_C(2) /*! @name BMI2 configuration load status */ -#define BMI2_CONFIG_LOAD_SUCCESS UINT8_C(1) +#define BMI2_CONFIG_LOAD_SUCCESS UINT8_C(1) /*! @name To define BMI2 pages */ -#define BMI2_PAGE_0 UINT8_C(0) -#define BMI2_PAGE_1 UINT8_C(1) -#define BMI2_PAGE_2 UINT8_C(2) -#define BMI2_PAGE_3 UINT8_C(3) -#define BMI2_PAGE_4 UINT8_C(4) -#define BMI2_PAGE_5 UINT8_C(5) -#define BMI2_PAGE_6 UINT8_C(6) -#define BMI2_PAGE_7 UINT8_C(7) +#define BMI2_PAGE_0 UINT8_C(0) +#define BMI2_PAGE_1 UINT8_C(1) +#define BMI2_PAGE_2 UINT8_C(2) +#define BMI2_PAGE_3 UINT8_C(3) +#define BMI2_PAGE_4 UINT8_C(4) +#define BMI2_PAGE_5 UINT8_C(5) +#define BMI2_PAGE_6 UINT8_C(6) +#define BMI2_PAGE_7 UINT8_C(7) /*! @name Array Parameter DefinItions */ -#define BMI2_SENSOR_TIME_LSB_BYTE UINT8_C(0) -#define BMI2_SENSOR_TIME_XLSB_BYTE UINT8_C(1) -#define BMI2_SENSOR_TIME_MSB_BYTE UINT8_C(2) +#define BMI2_SENSOR_TIME_LSB_BYTE UINT8_C(0) +#define BMI2_SENSOR_TIME_XLSB_BYTE UINT8_C(1) +#define BMI2_SENSOR_TIME_MSB_BYTE UINT8_C(2) -/*! @name mask definition for status register */ -#define BMI2_AUX_BUSY_MASK UINT8_C(0x04) -#define BMI2_CMD_RDY_MASK UINT8_C(0x10) -#define BMI2_DRDY_AUX_MASK UINT8_C(0x20) -#define BMI2_DRDY_GYR_MASK UINT8_C(0x40) -#define BMI2_DRDY_ACC_MASK UINT8_C(0x80) +/*! @name Mask definitions for Gyro CRT */ +#define BMI2_GYR_RDY_FOR_DL_MASK UINT8_C(0x08) +#define BMI2_GYR_CRT_RUNNING_MASK UINT8_C(0x04) -/*! @name Bit position for status register*/ -#define BMI2_AUX_BUSY_POS UINT8_C(0x02) -#define BMI2_CMD_RDY_POS UINT8_C(0x04) -#define BMI2_DRDY_AUX_POS UINT8_C(0x05) -#define BMI2_DRDY_GYR_POS UINT8_C(0x06) -#define BMI2_DRDY_ACC_POS UINT8_C(0x07) +/*! @name mask definition for status register */ +#define BMI2_AUX_BUSY_MASK UINT8_C(0x04) +#define BMI2_CMD_RDY_MASK UINT8_C(0x10) +#define BMI2_DRDY_AUX_MASK UINT8_C(0x20) +#define BMI2_DRDY_GYR_MASK UINT8_C(0x40) +#define BMI2_DRDY_ACC_MASK UINT8_C(0x80) /*! @name Mask definitions for SPI read/write address */ -#define BMI2_SPI_RD_MASK UINT8_C(0x80) -#define BMI2_SPI_WR_MASK UINT8_C(0x7F) +#define BMI2_SPI_RD_MASK UINT8_C(0x80) +#define BMI2_SPI_WR_MASK UINT8_C(0x7F) /*! @name Mask definitions for power configuration register */ -#define BMI2_ADV_POW_EN_MASK UINT8_C(0x01) +#define BMI2_ADV_POW_EN_MASK UINT8_C(0x01) /*! @name Mask definitions for initialization control register */ -#define BMI2_CONF_LOAD_EN_MASK UINT8_C(0x01) +#define BMI2_CONF_LOAD_EN_MASK UINT8_C(0x01) /*! @name Mask definitions for power control register */ -#define BMI2_AUX_EN_MASK UINT8_C(0x01) -#define BMI2_GYR_EN_MASK UINT8_C(0x02) -#define BMI2_ACC_EN_MASK UINT8_C(0x04) -#define BMI2_TEMP_EN_MASK UINT8_C(0x08) - -/*! @name Bit position definitions for power control register */ -#define BMI2_GYR_EN_POS UINT8_C(0x01) -#define BMI2_ACC_EN_POS UINT8_C(0x02) -#define BMI2_TEMP_EN_POS UINT8_C(0x03) +#define BMI2_AUX_EN_MASK UINT8_C(0x01) +#define BMI2_GYR_EN_MASK UINT8_C(0x02) +#define BMI2_ACC_EN_MASK UINT8_C(0x04) +#define BMI2_TEMP_EN_MASK UINT8_C(0x08) /*! @name Mask definitions for sensor event flags */ -#define BMI2_EVENT_FLAG_MASK UINT8_C(0x1C) - -/*! @name Bit position definitions for sensor event flags */ -#define BMI2_EVENT_FLAG_POS UINT8_C(0x02) +#define BMI2_EVENT_FLAG_MASK UINT8_C(0x1C) /*! @name Mask definitions to switch page */ -#define BMI2_SWITCH_PAGE_EN_MASK UINT8_C(0x07) +#define BMI2_SWITCH_PAGE_EN_MASK UINT8_C(0x07) -/*! @name Accelerometer and Gyroscope Filter/Noise performance modes */ -/* Power optimized mode */ -#define BMI2_POWER_OPT_MODE UINT8_C(0) +/*! @name Mask definitions of NVM register */ +#define BMI2_NV_ACC_OFFSET_MASK UINT8_C(0x08) -/* Performance optimized */ -#define BMI2_PERF_OPT_MODE UINT8_C(1) +/*! @name Mask definition for config version */ +#define BMI2_CONFIG_MAJOR_MASK UINT16_C(0x3C0) +#define BMI2_CONFIG_MINOR_MASK UINT8_C(0x3F) -/*! @name Mask definitions of NVM register */ -#define BMI2_NV_ACC_OFFSET_MASK UINT8_C(0x08) +/*! @name mask and bit position for activity recognition settings */ +#define BMI2_ACT_RECG_POST_PROS_EN_DIS_MASK UINT8_C(0x01) +#define BMI2_ACT_RECG_BUFF_SIZE_MASK UINT8_C(0x0F) +#define BMI2_ACT_RECG_MIN_SEG_CONF_MASK UINT8_C(0x0F) -/*! @name Bit position definitions of NVM register */ -#define BMI2_NV_ACC_OFFSET_POS UINT8_C(0x03) +#define BMI2_GYRO_CROSS_AXES_SENSE_MASK UINT8_C(0x7F) +#define BMI2_GYRO_CROSS_AXES_SENSE_SIGN_BIT_MASK UINT8_C(0x40) -/*! @name Mask definition for config version */ -#define BMI2_CONFIG_MAJOR_MASK UINT16_C(0x3C0) -#define BMI2_CONFIG_MINOR_MASK UINT8_C(0x3F) +/*! @name Bit position definitions for Gyro CRT */ +#define BMI2_GYR_RDY_FOR_DL_POS UINT8_C(0x03) +#define BMI2_GYR_CRT_RUNNING_POS UINT8_C(0x02) + +/*! @name Bit position for status register*/ +#define BMI2_AUX_BUSY_POS UINT8_C(0x02) +#define BMI2_CMD_RDY_POS UINT8_C(0x04) +#define BMI2_DRDY_AUX_POS UINT8_C(0x05) +#define BMI2_DRDY_GYR_POS UINT8_C(0x06) +#define BMI2_DRDY_ACC_POS UINT8_C(0x07) + +/*! @name Bit position definitions for power control register */ +#define BMI2_GYR_EN_POS UINT8_C(0x01) +#define BMI2_ACC_EN_POS UINT8_C(0x02) +#define BMI2_TEMP_EN_POS UINT8_C(0x03) + +/*! @name Bit position definitions for sensor event flags */ +#define BMI2_EVENT_FLAG_POS UINT8_C(0x02) + +/*! @name Bit position definitions of NVM register */ +#define BMI2_NV_ACC_OFFSET_POS UINT8_C(0x03) /*! @name Bit position for major version from config */ -#define BMI2_CONFIG_MAJOR_POS UINT8_C(0x06) +#define BMI2_CONFIG_MAJOR_POS UINT8_C(0x06) -#define BMI2_GYRO_CROSS_AXES_SENSE_MASK UINT8_C(0x7F) -#define BMI2_GYRO_CROSS_AXES_SENSE_SIGN_BIT_MASK UINT8_C(0x40) +/*! @name Accelerometer and Gyroscope Filter/Noise performance modes */ +/* Power optimized mode */ +#define BMI2_POWER_OPT_MODE UINT8_C(0) + +/* Performance optimized */ +#define BMI2_PERF_OPT_MODE UINT8_C(1) /*! @name index for config major minor information */ -#define BMI2_CONFIG_INFO_LOWER UINT8_C(52) -#define BMI2_CONFIG_INFO_HIGHER UINT8_C(53) +#define BMI2_CONFIG_INFO_LOWER UINT8_C(52) +#define BMI2_CONFIG_INFO_HIGHER UINT8_C(53) /*! @name Sensor status */ -#define BMI2_DRDY_ACC UINT8_C(0x80) -#define BMI2_DRDY_GYR UINT8_C(0x40) -#define BMI2_DRDY_AUX UINT8_C(0x20) -#define BMI2_CMD_RDY UINT8_C(0x10) -#define BMI2_AUX_BUSY UINT8_C(0x04) +#define BMI2_DRDY_ACC UINT8_C(0x80) +#define BMI2_DRDY_GYR UINT8_C(0x40) +#define BMI2_DRDY_AUX UINT8_C(0x20) +#define BMI2_CMD_RDY UINT8_C(0x10) +#define BMI2_AUX_BUSY UINT8_C(0x04) /*! @name Macro to define accelerometer configuration value for FOC */ -#define BMI2_FOC_ACC_CONF_VAL UINT8_C(0xB7) +#define BMI2_FOC_ACC_CONF_VAL UINT8_C(0xB7) /*! @name Macro to define gyroscope configuration value for FOC */ -#define BMI2_FOC_GYR_CONF_VAL UINT8_C(0xB6) +#define BMI2_FOC_GYR_CONF_VAL UINT8_C(0xB6) /*! @name Macro to define X Y and Z axis for an array */ -#define BMI2_X_AXIS UINT8_C(0) -#define BMI2_Y_AXIS UINT8_C(1) -#define BMI2_Z_AXIS UINT8_C(2) - -/*! @name mask and bit position for activity recognition settings */ -#define BMI2_ACT_RECG_POST_PROS_EN_DIS_MASK UINT8_C(0x01) -#define BMI2_ACT_RECG_BUFF_SIZE_MASK UINT8_C(0x0F) -#define BMI2_ACT_RECG_MIN_SEG_CONF_MASK UINT8_C(0x0F) +#define BMI2_X_AXIS UINT8_C(0) +#define BMI2_Y_AXIS UINT8_C(1) +#define BMI2_Z_AXIS UINT8_C(2) /******************************************************************************/ /*! @name Sensor Macro Definitions */ /******************************************************************************/ /*! @name Macros to define BMI2 sensor/feature types */ -#define BMI2_ACCEL UINT8_C(0) -#define BMI2_GYRO UINT8_C(1) -#define BMI2_AUX UINT8_C(2) -#define BMI2_SIG_MOTION UINT8_C(3) -#define BMI2_ANY_MOTION UINT8_C(4) -#define BMI2_NO_MOTION UINT8_C(5) -#define BMI2_STEP_DETECTOR UINT8_C(6) -#define BMI2_STEP_COUNTER UINT8_C(7) -#define BMI2_STEP_ACTIVITY UINT8_C(8) -#define BMI2_GYRO_GAIN_UPDATE UINT8_C(9) -#define BMI2_TILT UINT8_C(10) -#define BMI2_UP_HOLD_TO_WAKE UINT8_C(11) -#define BMI2_GLANCE_DETECTOR UINT8_C(12) -#define BMI2_WAKE_UP UINT8_C(13) -#define BMI2_ORIENTATION UINT8_C(14) -#define BMI2_HIGH_G UINT8_C(15) -#define BMI2_LOW_G UINT8_C(16) -#define BMI2_FLAT UINT8_C(17) -#define BMI2_EXT_SENS_SYNC UINT8_C(18) -#define BMI2_WRIST_GESTURE UINT8_C(19) -#define BMI2_WRIST_WEAR_WAKE_UP UINT8_C(20) -#define BMI2_WRIST_WEAR_WAKE_UP_WH UINT8_C(21) -#define BMI2_WRIST_GESTURE_WH UINT8_C(22) -#define BMI2_PRIMARY_OIS UINT8_C(23) -#define BMI2_FREE_FALL_DET UINT8_C(24) -#define BMI2_SINGLE_TAP UINT8_C(25) -#define BMI2_DOUBLE_TAP UINT8_C(26) -#define BMI2_TRIPLE_TAP UINT8_C(27) +#define BMI2_ACCEL UINT8_C(0) +#define BMI2_GYRO UINT8_C(1) +#define BMI2_AUX UINT8_C(2) +#define BMI2_SIG_MOTION UINT8_C(3) +#define BMI2_ANY_MOTION UINT8_C(4) +#define BMI2_NO_MOTION UINT8_C(5) +#define BMI2_STEP_DETECTOR UINT8_C(6) +#define BMI2_STEP_COUNTER UINT8_C(7) +#define BMI2_STEP_ACTIVITY UINT8_C(8) +#define BMI2_GYRO_GAIN_UPDATE UINT8_C(9) +#define BMI2_TILT UINT8_C(10) +#define BMI2_UP_HOLD_TO_WAKE UINT8_C(11) +#define BMI2_GLANCE_DETECTOR UINT8_C(12) +#define BMI2_WAKE_UP UINT8_C(13) +#define BMI2_ORIENTATION UINT8_C(14) +#define BMI2_HIGH_G UINT8_C(15) +#define BMI2_LOW_G UINT8_C(16) +#define BMI2_FLAT UINT8_C(17) +#define BMI2_EXT_SENS_SYNC UINT8_C(18) +#define BMI2_WRIST_GESTURE UINT8_C(19) +#define BMI2_WRIST_WEAR_WAKE_UP UINT8_C(20) +#define BMI2_WRIST_WEAR_WAKE_UP_WH UINT8_C(21) +#define BMI2_WRIST_GESTURE_WH UINT8_C(22) +#define BMI2_PRIMARY_OIS UINT8_C(23) +#define BMI2_FREE_FALL_DET UINT8_C(24) +#define BMI2_SINGLE_TAP UINT8_C(25) +#define BMI2_DOUBLE_TAP UINT8_C(26) +#define BMI2_TRIPLE_TAP UINT8_C(27) /* Non virtual sensor features */ -#define BMI2_STEP_COUNTER_PARAMS UINT8_C(28) -#define BMI2_TAP_DETECTOR_1 UINT8_C(29) -#define BMI2_TAP_DETECTOR_2 UINT8_C(30) -#define BMI2_TEMP UINT8_C(31) -#define BMI2_ACCEL_SELF_TEST UINT8_C(32) -#define BMI2_GYRO_SELF_OFF UINT8_C(33) -#define BMI2_ACTIVITY_RECOGNITION UINT8_C(34) -#define BMI2_MAX_BURST_LEN UINT8_C(35) -#define BMI2_SENS_MAX_NUM UINT8_C(36) -#define BMI2_AXIS_MAP UINT8_C(37) -#define BMI2_NVM_STATUS UINT8_C(38) -#define BMI2_VFRM_STATUS UINT8_C(39) -#define BMI2_GYRO_CROSS_SENSE UINT8_C(40) -#define BMI2_CRT_GYRO_SELF_TEST UINT8_C(41) -#define BMI2_ABORT_CRT_GYRO_SELF_TEST UINT8_C(42) -#define BMI2_NVM_PROG_PREP UINT8_C(43) -#define BMI2_ACTIVITY_RECOGNITION_SETTINGS UINT8_C(44) -#define BMI2_OIS_OUTPUT UINT8_C(45) -#define BMI2_CONFIG_ID UINT8_C(46) +#define BMI2_STEP_COUNTER_PARAMS UINT8_C(28) +#define BMI2_TAP_DETECTOR_1 UINT8_C(29) +#define BMI2_TAP_DETECTOR_2 UINT8_C(30) +#define BMI2_TEMP UINT8_C(31) +#define BMI2_ACCEL_SELF_TEST UINT8_C(32) +#define BMI2_GYRO_SELF_OFF UINT8_C(33) +#define BMI2_ACTIVITY_RECOGNITION UINT8_C(34) +#define BMI2_MAX_BURST_LEN UINT8_C(35) +#define BMI2_SENS_MAX_NUM UINT8_C(36) +#define BMI2_AXIS_MAP UINT8_C(37) +#define BMI2_NVM_STATUS UINT8_C(38) +#define BMI2_VFRM_STATUS UINT8_C(39) +#define BMI2_GYRO_CROSS_SENSE UINT8_C(40) +#define BMI2_CRT_GYRO_SELF_TEST UINT8_C(41) +#define BMI2_ABORT_CRT_GYRO_SELF_TEST UINT8_C(42) +#define BMI2_NVM_PROG_PREP UINT8_C(43) +#define BMI2_ACTIVITY_RECOGNITION_SETTINGS UINT8_C(44) +#define BMI2_OIS_OUTPUT UINT8_C(45) +#define BMI2_CONFIG_ID UINT8_C(46) /*! @name Bit wise for selecting BMI2 sensors/features */ -#define BMI2_ACCEL_SENS_SEL (1) -#define BMI2_GYRO_SENS_SEL (1 << BMI2_GYRO) -#define BMI2_AUX_SENS_SEL (1 << BMI2_AUX) -#define BMI2_TEMP_SENS_SEL ((uint64_t)1 << BMI2_TEMP) -#define BMI2_ANY_MOT_SEL (1 << BMI2_ANY_MOTION) -#define BMI2_NO_MOT_SEL (1 << BMI2_NO_MOTION) -#define BMI2_TILT_SEL (1 << BMI2_TILT) -#define BMI2_ORIENT_SEL (1 << BMI2_ORIENTATION) -#define BMI2_SIG_MOTION_SEL (1 << BMI2_SIG_MOTION) -#define BMI2_STEP_DETECT_SEL (1 << BMI2_STEP_DETECTOR) -#define BMI2_STEP_COUNT_SEL (1 << BMI2_STEP_COUNTER) -#define BMI2_STEP_ACT_SEL (1 << BMI2_STEP_ACTIVITY) -#define BMI2_GYRO_GAIN_UPDATE_SEL (1 << BMI2_GYRO_GAIN_UPDATE) -#define BMI2_UP_HOLD_TO_WAKE_SEL (1 << BMI2_UP_HOLD_TO_WAKE) -#define BMI2_GLANCE_DET_SEL (1 << BMI2_GLANCE_DETECTOR) -#define BMI2_WAKE_UP_SEL (1 << BMI2_WAKE_UP) -#define BMI2_HIGH_G_SEL (1 << BMI2_HIGH_G) -#define BMI2_LOW_G_SEL (1 << BMI2_LOW_G) -#define BMI2_FLAT_SEL (1 << BMI2_FLAT) -#define BMI2_EXT_SENS_SEL (1 << BMI2_EXT_SENS_SYNC) -#define BMI2_SINGLE_TAP_SEL (1 << BMI2_SINGLE_TAP) -#define BMI2_DOUBLE_TAP_SEL (1 << BMI2_DOUBLE_TAP) -#define BMI2_TRIPLE_TAP_SEL (1 << BMI2_TRIPLE_TAP) -#define BMI2_GYRO_SELF_OFF_SEL ((uint64_t)1 << BMI2_GYRO_SELF_OFF) -#define BMI2_WRIST_GEST_SEL (1 << BMI2_WRIST_GESTURE) -#define BMI2_WRIST_WEAR_WAKE_UP_SEL (1 << BMI2_WRIST_WEAR_WAKE_UP) -#define BMI2_ACTIVITY_RECOGNITION_SEL ((uint64_t)1 << BMI2_ACTIVITY_RECOGNITION) -#define BMI2_ACCEL_SELF_TEST_SEL ((uint64_t)1 << BMI2_ACCEL_SELF_TEST) -#define BMI2_WRIST_GEST_W_SEL (1 << BMI2_WRIST_GESTURE_WH) -#define BMI2_WRIST_WEAR_WAKE_UP_WH_SEL (1 << BMI2_WRIST_WEAR_WAKE_UP_WH) -#define BMI2_PRIMARY_OIS_SEL (1 << BMI2_PRIMARY_OIS) -#define BMI2_FREE_FALL_DET_SEL (1 << BMI2_FREE_FALL_DET) +#define BMI2_ACCEL_SENS_SEL (1) +#define BMI2_GYRO_SENS_SEL (1 << BMI2_GYRO) +#define BMI2_AUX_SENS_SEL (1 << BMI2_AUX) +#define BMI2_TEMP_SENS_SEL ((uint64_t)1 << BMI2_TEMP) +#define BMI2_ANY_MOT_SEL (1 << BMI2_ANY_MOTION) +#define BMI2_NO_MOT_SEL (1 << BMI2_NO_MOTION) +#define BMI2_TILT_SEL (1 << BMI2_TILT) +#define BMI2_ORIENT_SEL (1 << BMI2_ORIENTATION) +#define BMI2_SIG_MOTION_SEL (1 << BMI2_SIG_MOTION) +#define BMI2_STEP_DETECT_SEL (1 << BMI2_STEP_DETECTOR) +#define BMI2_STEP_COUNT_SEL (1 << BMI2_STEP_COUNTER) +#define BMI2_STEP_ACT_SEL (1 << BMI2_STEP_ACTIVITY) +#define BMI2_GYRO_GAIN_UPDATE_SEL (1 << BMI2_GYRO_GAIN_UPDATE) +#define BMI2_UP_HOLD_TO_WAKE_SEL (1 << BMI2_UP_HOLD_TO_WAKE) +#define BMI2_GLANCE_DET_SEL (1 << BMI2_GLANCE_DETECTOR) +#define BMI2_WAKE_UP_SEL (1 << BMI2_WAKE_UP) +#define BMI2_HIGH_G_SEL (1 << BMI2_HIGH_G) +#define BMI2_LOW_G_SEL (1 << BMI2_LOW_G) +#define BMI2_FLAT_SEL (1 << BMI2_FLAT) +#define BMI2_EXT_SENS_SEL (1 << BMI2_EXT_SENS_SYNC) +#define BMI2_SINGLE_TAP_SEL (1 << BMI2_SINGLE_TAP) +#define BMI2_DOUBLE_TAP_SEL (1 << BMI2_DOUBLE_TAP) +#define BMI2_TRIPLE_TAP_SEL (1 << BMI2_TRIPLE_TAP) +#define BMI2_GYRO_SELF_OFF_SEL ((uint64_t)1 << BMI2_GYRO_SELF_OFF) +#define BMI2_WRIST_GEST_SEL (1 << BMI2_WRIST_GESTURE) +#define BMI2_WRIST_WEAR_WAKE_UP_SEL (1 << BMI2_WRIST_WEAR_WAKE_UP) +#define BMI2_ACTIVITY_RECOGNITION_SEL ((uint64_t)1 << BMI2_ACTIVITY_RECOGNITION) +#define BMI2_ACCEL_SELF_TEST_SEL ((uint64_t)1 << BMI2_ACCEL_SELF_TEST) +#define BMI2_WRIST_GEST_W_SEL (1 << BMI2_WRIST_GESTURE_WH) +#define BMI2_WRIST_WEAR_WAKE_UP_WH_SEL (1 << BMI2_WRIST_WEAR_WAKE_UP_WH) +#define BMI2_PRIMARY_OIS_SEL (1 << BMI2_PRIMARY_OIS) +#define BMI2_FREE_FALL_DET_SEL (1 << BMI2_FREE_FALL_DET) /*! @name Mask definitions for BMI2 wake-up feature configuration for bmi260 */ -#define BMI2_WAKEUP_SENSITIVITY_MASK UINT8_C(0x0E) -#define BMI2_WAKEUP_SINGLE_TAP_EN_MASK UINT8_C(0x01) -#define BMI2_WAKEUP_DOUBLE_TAP_EN_MASK UINT8_C(0x02) -#define BMI2_WAKEUP_TRIPLE_TAP_EN_MASK UINT8_C(0x04) -#define BMI2_WAKEUP_DATA_REG_EN_MASK UINT8_C(0x08) -#define BMI2_WAKEUP_OUT_CONF_MASK UINT8_C(0xF0) -#define BMI2_WAKEUP_AXIS_SEL_MASK UINT8_C(0x03) +#define BMI2_WAKEUP_SENSITIVITY_MASK UINT8_C(0x0E) +#define BMI2_WAKEUP_SINGLE_TAP_EN_MASK UINT8_C(0x01) +#define BMI2_WAKEUP_DOUBLE_TAP_EN_MASK UINT8_C(0x02) +#define BMI2_WAKEUP_TRIPLE_TAP_EN_MASK UINT8_C(0x04) +#define BMI2_WAKEUP_DATA_REG_EN_MASK UINT8_C(0x08) +#define BMI2_WAKEUP_OUT_CONF_MASK UINT8_C(0xF0) +#define BMI2_WAKEUP_AXIS_SEL_MASK UINT8_C(0x03) /*! @name Bit position definitions for BMI2 wake-up feature configuration for bmi260 */ -#define BMI2_WAKEUP_SENSITIVITY_POS UINT8_C(0x01) -#define BMI2_WAKEUP_DOUBLE_TAP_EN_POS UINT8_C(0x01) -#define BMI2_WAKEUP_TRIPLE_TAP_EN_POS UINT8_C(0x02) -#define BMI2_WAKEUP_DATA_REG_EN_POS UINT8_C(0x03) -#define BMI2_WAKEUP_OUT_CONF_POS UINT8_C(0x04) +#define BMI2_WAKEUP_SENSITIVITY_POS UINT8_C(0x01) +#define BMI2_WAKEUP_DOUBLE_TAP_EN_POS UINT8_C(0x01) +#define BMI2_WAKEUP_TRIPLE_TAP_EN_POS UINT8_C(0x02) +#define BMI2_WAKEUP_DATA_REG_EN_POS UINT8_C(0x03) +#define BMI2_WAKEUP_OUT_CONF_POS UINT8_C(0x04) /*! @name Mask definitions for BMI2 wake-up feature configuration for other than bmi261 */ -#define BMI2_WAKE_UP_SENSITIVITY_MASK UINT16_C(0x000E) -#define BMI2_WAKE_UP_SINGLE_TAP_EN_MASK UINT16_C(0x0010) -#define BMI2_WAKE_UP_OUT_CONF_MASK UINT16_C(0x01E0) +#define BMI2_WAKE_UP_SENSITIVITY_MASK UINT16_C(0x000E) +#define BMI2_WAKE_UP_SINGLE_TAP_EN_MASK UINT16_C(0x0010) +#define BMI2_WAKE_UP_OUT_CONF_MASK UINT16_C(0x01E0) /*! @name Bit position definitions for BMI2 wake-up feature configuration for other than bmi261 */ -#define BMI2_WAKE_UP_SENSITIVITY_POS UINT8_C(0x01) -#define BMI2_WAKE_UP_SINGLE_TAP_EN_POS UINT8_C(0x04) -#define BMI2_WAKE_UP_OUT_CONF_POS UINT8_C(0x05) +#define BMI2_WAKE_UP_SENSITIVITY_POS UINT8_C(0x01) +#define BMI2_WAKE_UP_SINGLE_TAP_EN_POS UINT8_C(0x04) +#define BMI2_WAKE_UP_OUT_CONF_POS UINT8_C(0x05) + +/*! @name Offsets from feature start address for BMI2 feature enable/disable */ +#define BMI2_ANY_MOT_FEAT_EN_OFFSET UINT8_C(0x03) +#define BMI2_NO_MOT_FEAT_EN_OFFSET UINT8_C(0x03) +#define BMI2_SIG_MOT_FEAT_EN_OFFSET UINT8_C(0x0A) +#define BMI2_STEP_COUNT_FEAT_EN_OFFSET UINT8_C(0x01) +#define BMI2_GYR_USER_GAIN_FEAT_EN_OFFSET UINT8_C(0x05) +#define BMI2_HIGH_G_FEAT_EN_OFFSET UINT8_C(0x03) +#define BMI2_LOW_G_FEAT_EN_OFFSET UINT8_C(0x03) +#define BMI2_TILT_FEAT_EN_OFFSET UINT8_C(0x00) + +/*! @name Mask definitions for BMI2 feature enable/disable */ +#define BMI2_ANY_NO_MOT_EN_MASK UINT8_C(0x80) +#define BMI2_TILT_FEAT_EN_MASK UINT8_C(0x01) +#define BMI2_ORIENT_FEAT_EN_MASK UINT8_C(0x01) +#define BMI2_SIG_MOT_FEAT_EN_MASK UINT8_C(0x01) +#define BMI2_STEP_DET_FEAT_EN_MASK UINT8_C(0x08) +#define BMI2_STEP_COUNT_FEAT_EN_MASK UINT8_C(0x10) +#define BMI2_STEP_ACT_FEAT_EN_MASK UINT8_C(0x20) +#define BMI2_GYR_USER_GAIN_FEAT_EN_MASK UINT8_C(0x08) +#define BMI2_UP_HOLD_TO_WAKE_FEAT_EN_MASK UINT8_C(0x01) +#define BMI2_GLANCE_FEAT_EN_MASK UINT8_C(0x01) +#define BMI2_WAKE_UP_FEAT_EN_MASK UINT8_C(0x01) +#define BMI2_HIGH_G_FEAT_EN_MASK UINT8_C(0x80) +#define BMI2_LOW_G_FEAT_EN_MASK UINT8_C(0x10) +#define BMI2_FLAT_FEAT_EN_MASK UINT8_C(0x01) +#define BMI2_EXT_SENS_SYNC_FEAT_EN_MASK UINT8_C(0x01) +#define BMI2_GYR_SELF_OFF_CORR_FEAT_EN_MASK UINT8_C(0x02) +#define BMI2_WRIST_GEST_FEAT_EN_MASK UINT8_C(0x20) +#define BMI2_WRIST_WEAR_WAKE_UP_FEAT_EN_MASK UINT8_C(0x10) +#define BMI2_ACTIVITY_RECOG_EN_MASK UINT8_C(0x01) +#define BMI2_ACC_SELF_TEST_FEAT_EN_MASK UINT8_C(0x02) +#define BMI2_GYRO_SELF_TEST_CRT_EN_MASK UINT8_C(0x01) +#define BMI2_ABORT_FEATURE_EN_MASK UINT8_C(0x02) +#define BMI2_NVM_PREP_FEATURE_EN_MASK UINT8_C(0x04) +#define BMI2_FREE_FALL_DET_FEAT_EN_MASK UINT8_C(0x01) + +/*! @name Bit position definitions for BMI2 feature enable/disable */ +#define BMI2_ANY_NO_MOT_EN_POS UINT8_C(0x07) +#define BMI2_STEP_DET_FEAT_EN_POS UINT8_C(0x03) +#define BMI2_STEP_COUNT_FEAT_EN_POS UINT8_C(0x04) +#define BMI2_STEP_ACT_FEAT_EN_POS UINT8_C(0x05) +#define BMI2_GYR_USER_GAIN_FEAT_EN_POS UINT8_C(0x03) +#define BMI2_HIGH_G_FEAT_EN_POS UINT8_C(0x07) +#define BMI2_LOW_G_FEAT_EN_POS UINT8_C(0x04) +#define BMI2_GYR_SELF_OFF_CORR_FEAT_EN_POS UINT8_C(0x01) +#define BMI2_WRIST_GEST_FEAT_EN_POS UINT8_C(0x05) +#define BMI2_WRIST_WEAR_WAKE_UP_FEAT_EN_POS UINT8_C(0x04) +#define BMI2_ACC_SELF_TEST_FEAT_EN_POS UINT8_C(0x01) +#define BMI2_ABORT_FEATURE_EN_POS UINT8_C(0x1) +#define BMI2_NVM_PREP_FEATURE_EN_POS UINT8_C(0x02) + +/*! Primary OIS low pass filter configuration position and mask */ +#define BMI2_LP_FILTER_EN_MASK UINT8_C(0x01) + +#define BMI2_LP_FILTER_CONFIG_POS UINT8_C(0x01) +#define BMI2_LP_FILTER_CONFIG_MASK UINT8_C(0x06) + +#define BMI2_PRIMARY_OIS_GYR_EN_POS UINT8_C(0x06) +#define BMI2_PRIMARY_OIS_GYR_EN_MASK UINT8_C(0x40) + +#define BMI2_PRIMARY_OIS_ACC_EN_POS UINT8_C(0x07) +#define BMI2_PRIMARY_OIS_ACC_EN_MASK UINT8_C(0x80) + +/*! @name Mask definitions for BMI2 any and no-motion feature configuration */ +#define BMI2_ANY_NO_MOT_DUR_MASK UINT16_C(0x1FFF) +#define BMI2_ANY_NO_MOT_X_SEL_MASK UINT16_C(0x2000) +#define BMI2_ANY_NO_MOT_Y_SEL_MASK UINT16_C(0x4000) +#define BMI2_ANY_NO_MOT_Z_SEL_MASK UINT16_C(0x8000) +#define BMI2_ANY_NO_MOT_THRES_MASK UINT16_C(0x07FF) +#define BMI2_ANY_NO_MOT_OUT_CONF_MASK UINT16_C(0x7800) + +/*! @name Bit position definitions for BMI2 any and no-motion feature + * configuration + */ +#define BMI2_ANY_NO_MOT_X_SEL_POS UINT8_C(0x0D) +#define BMI2_ANY_NO_MOT_Y_SEL_POS UINT8_C(0x0E) +#define BMI2_ANY_NO_MOT_Z_SEL_POS UINT8_C(0x0F) +#define BMI2_ANY_NO_MOT_OUT_CONF_POS UINT8_C(0x0B) + +/*! @name Mask definitions for BMI2 tilt feature configuration */ +#define BMI2_TILT_OUT_CONF_MASK UINT16_C(0x001E) + +/*! @name Bit position definitions for BMI2 tilt feature configuration */ +#define BMI2_TILT_OUT_CONF_POS UINT8_C(0x01) + +/*! @name Mask definitions for BMI2 orientation feature configuration */ +#define BMI2_ORIENT_UP_DOWN_MASK UINT16_C(0x0002) +#define BMI2_ORIENT_SYMM_MODE_MASK UINT16_C(0x000C) +#define BMI2_ORIENT_BLOCK_MODE_MASK UINT16_C(0x0030) +#define BMI2_ORIENT_THETA_MASK UINT16_C(0x0FC0) +#define BMI2_ORIENT_HYST_MASK UINT16_C(0x07FF) +#define BMI2_ORIENT_OUT_CONF_MASK UINT16_C(0x7800) + +/*! @name Bit position definitions for BMI2 orientation feature configuration */ +#define BMI2_ORIENT_UP_DOWN_POS UINT8_C(0x01) +#define BMI2_ORIENT_SYMM_MODE_POS UINT8_C(0x02) +#define BMI2_ORIENT_BLOCK_MODE_POS UINT8_C(0x04) +#define BMI2_ORIENT_THETA_POS UINT8_C(0x06) +#define BMI2_ORIENT_OUT_CONF_POS UINT8_C(0x0B) + +/*! @name Mask definitions for BMI2 sig-motion feature configuration */ +#define BMI2_SIG_MOT_PARAM_1_MASK UINT16_C(0xFFFF) +#define BMI2_SIG_MOT_PARAM_2_MASK UINT16_C(0xFFFF) +#define BMI2_SIG_MOT_PARAM_3_MASK UINT16_C(0xFFFF) +#define BMI2_SIG_MOT_PARAM_4_MASK UINT16_C(0xFFFF) +#define BMI2_SIG_MOT_PARAM_5_MASK UINT16_C(0xFFFF) +#define BMI2_SIG_MOT_OUT_CONF_MASK UINT16_C(0x001E) + +/*! @name Bit position definitions for BMI2 sig-motion feature configuration */ +#define BMI2_SIG_MOT_OUT_CONF_POS UINT8_C(0x01) + +/*! @name Mask definitions for BMI2 parameter configurations */ +#define BMI2_STEP_COUNT_PARAMS_MASK UINT16_C(0xFFFF) + +/*! @name Mask definitions for BMI2 step-counter/detector feature configuration */ +#define BMI2_STEP_COUNT_WM_LEVEL_MASK UINT16_C(0x03FF) +#define BMI2_STEP_COUNT_RST_CNT_MASK UINT16_C(0x0400) +#define BMI2_STEP_DET_OUT_CONF_MASK UINT16_C(0x000F) +#define BMI2_STEP_ACT_OUT_CONF_MASK UINT16_C(0x00F0) +#define BMI2_STEP_BUFFER_SIZE_MASK UINT16_C(0XFF00) + +/*! @name Bit position definitions for BMI2 step-counter/detector feature + * configuration + */ +#define BMI2_STEP_COUNT_RST_CNT_POS UINT8_C(0x0A) +#define BMI2_STEP_ACT_OUT_CONF_POS UINT8_C(0x04) +#define BMI2_STEP_BUFFER_SIZE_POS UINT8_C(0X08) + +/*! @name Mask definitions for BMI2 gyroscope user gain feature + * configuration + */ +#define BMI2_GYR_USER_GAIN_RATIO_X_MASK UINT16_C(0x07FF) +#define BMI2_GYR_USER_GAIN_RATIO_Y_MASK UINT16_C(0x07FF) +#define BMI2_GYR_USER_GAIN_RATIO_Z_MASK UINT16_C(0x07FF) + +/*! @name Mask definitions for BMI2 gyroscope user gain saturation status */ +#define BMI2_GYR_USER_GAIN_SAT_STAT_X_MASK UINT8_C(0x01) +#define BMI2_GYR_USER_GAIN_SAT_STAT_Y_MASK UINT8_C(0x02) +#define BMI2_GYR_USER_GAIN_SAT_STAT_Z_MASK UINT8_C(0x04) +#define BMI2_G_TRIGGER_STAT_MASK UINT8_C(0x38) + +/*! @name Bit position definitions for BMI2 gyroscope user gain saturation status */ +#define BMI2_GYR_USER_GAIN_SAT_STAT_Y_POS UINT8_C(0x01) +#define BMI2_GYR_USER_GAIN_SAT_STAT_Z_POS UINT8_C(0x02) +#define BMI2_G_TRIGGER_STAT_POS UINT8_C(0x03) + +/*! @name Mask definitions for MSB values of BMI2 gyroscope compensation */ +#define BMI2_GYR_OFF_COMP_MSB_X_MASK UINT8_C(0x03) +#define BMI2_GYR_OFF_COMP_MSB_Y_MASK UINT8_C(0x0C) +#define BMI2_GYR_OFF_COMP_MSB_Z_MASK UINT8_C(0x30) + +/*! @name Bit positions for MSB values of BMI2 gyroscope compensation */ +#define BMI2_GYR_OFF_COMP_MSB_Y_POS UINT8_C(0x02) +#define BMI2_GYR_OFF_COMP_MSB_Z_POS UINT8_C(0x04) + +/*! @name Mask definitions for MSB values of BMI2 gyroscope compensation from user input */ +#define BMI2_GYR_OFF_COMP_MSB_MASK UINT16_C(0x0300) +#define BMI2_GYR_OFF_COMP_LSB_MASK UINT16_C(0x00FF) + +/*! @name Mask definitions for BMI2 orientation status */ +#define BMI2_ORIENT_DETECT_MASK UINT8_C(0x03) +#define BMI2_ORIENT_FACE_UP_DWN_MASK UINT8_C(0x04) + +/*! @name Bit position definitions for BMI2 orientation status */ +#define BMI2_ORIENT_FACE_UP_DWN_POS UINT8_C(0x02) + +/*! @name Mask definitions for NVM-VFRM error status */ +#define BMI2_NVM_LOAD_ERR_STATUS_MASK UINT8_C(0x01) +#define BMI2_NVM_PROG_ERR_STATUS_MASK UINT8_C(0x02) +#define BMI2_NVM_ERASE_ERR_STATUS_MASK UINT8_C(0x04) +#define BMI2_NVM_END_EXCEED_STATUS_MASK UINT8_C(0x08) +#define BMI2_NVM_PRIV_ERR_STATUS_MASK UINT8_C(0x10) +#define BMI2_VFRM_LOCK_ERR_STATUS_MASK UINT8_C(0x20) +#define BMI2_VFRM_WRITE_ERR_STATUS_MASK UINT8_C(0x40) +#define BMI2_VFRM_FATAL_ERR_STATUS_MASK UINT8_C(0x80) + +/*! @name Bit positions for NVM-VFRM error status */ +#define BMI2_NVM_PROG_ERR_STATUS_POS UINT8_C(0x01) +#define BMI2_NVM_ERASE_ERR_STATUS_POS UINT8_C(0x02) +#define BMI2_NVM_END_EXCEED_STATUS_POS UINT8_C(0x03) +#define BMI2_NVM_PRIV_ERR_STATUS_POS UINT8_C(0x04) +#define BMI2_VFRM_LOCK_ERR_STATUS_POS UINT8_C(0x05) +#define BMI2_VFRM_WRITE_ERR_STATUS_POS UINT8_C(0x06) +#define BMI2_VFRM_FATAL_ERR_STATUS_POS UINT8_C(0x07) + +/*! @name Mask definitions for accelerometer self-test status */ +#define BMI2_ACC_SELF_TEST_DONE_MASK UINT8_C(0x01) +#define BMI2_ACC_X_OK_MASK UINT8_C(0x02) +#define BMI2_ACC_Y_OK_MASK UINT8_C(0x04) +#define BMI2_ACC_Z_OK_MASK UINT8_C(0x08) + +/*! @name Bit Positions for accelerometer self-test status */ +#define BMI2_ACC_X_OK_POS UINT8_C(0x01) +#define BMI2_ACC_Y_OK_POS UINT8_C(0x02) +#define BMI2_ACC_Z_OK_POS UINT8_C(0x03) + +/*! @name Mask definitions for BMI2 uphold to wake feature configuration */ +#define BMI2_UP_HOLD_TO_WAKE_OUT_CONF_MASK UINT16_C(0x001E) + +/*! @name Bit position definitions for BMI2 uphold to wake feature configuration */ +#define BMI2_UP_HOLD_TO_WAKE_OUT_CONF_POS UINT8_C(0x01) + +/*! @name Mask definitions for BMI2 glance detector feature configuration */ +#define BMI2_GLANCE_DET_OUT_CONF_MASK UINT16_C(0x001E) + +/*! @name Bit position definitions for BMI2 glance detector feature + * configuration + */ +#define BMI2_GLANCE_DET_OUT_CONF_POS UINT8_C(0x01) + +/*! @name Mask definitions for BMI2 high-g feature configuration */ +#define BMI2_HIGH_G_THRES_MASK UINT16_C(0x7FFF) +#define BMI2_HIGH_G_HYST_MASK UINT16_C(0x0FFF) +#define BMI2_HIGH_G_X_SEL_MASK UINT16_C(0x1000) +#define BMI2_HIGH_G_Y_SEL_MASK UINT16_C(0x2000) +#define BMI2_HIGH_G_Z_SEL_MASK UINT16_C(0x4000) +#define BMI2_HIGH_G_DUR_MASK UINT16_C(0x0FFF) +#define BMI2_HIGH_G_OUT_CONF_MASK UINT16_C(0xF000) + +/*! @name Bit position definitions for BMI2 high-g feature configuration */ +#define BMI2_HIGH_G_OUT_CONF_POS UINT8_C(0x0C) +#define BMI2_HIGH_G_X_SEL_POS UINT8_C(0x0C) +#define BMI2_HIGH_G_Y_SEL_POS UINT8_C(0x0D) +#define BMI2_HIGH_G_Z_SEL_POS UINT8_C(0x0E) + +/*! @name Mask definitions for BMI2 low-g feature configuration */ +#define BMI2_LOW_G_THRES_MASK UINT16_C(0x7FFF) +#define BMI2_LOW_G_HYST_MASK UINT16_C(0x0FFF) +#define BMI2_LOW_G_DUR_MASK UINT16_C(0x0FFF) +#define BMI2_LOW_G_OUT_CONF_MASK UINT16_C(0xF000) + +/*! @name Mask definitions for BMI2 free-fall detection feature configuration */ +#define BMI2_FREE_FALL_OUT_CONF_MASK UINT16_C(0x001E) +#define BMI2_FREE_FALL_ACCEL_SETT_MASK UINT16_C(0xFFFF) + +/*! @name Bit position definitions for BMI2 free-fall detection feature configuration */ +#define BMI2_FREE_FALL_OUT_CONF_POS UINT8_C(0x01) + +/*! @name Bit position definitions for BMI2 low-g feature configuration */ +#define BMI2_LOW_G_OUT_CONF_POS UINT8_C(0x0C) + +/*! @name Mask definitions for BMI2 flat feature configuration */ +#define BMI2_FLAT_THETA_MASK UINT16_C(0x007E) +#define BMI2_FLAT_BLOCK_MASK UINT16_C(0x0180) +#define BMI2_FLAT_OUT_CONF_MASK UINT16_C(0x1E00) +#define BMI2_FLAT_HYST_MASK UINT16_C(0x003F) +#define BMI2_FLAT_HOLD_TIME_MASK UINT16_C(0x3FC0) + +/*! @name Bit position definitions for BMI2 flat feature configuration */ +#define BMI2_FLAT_THETA_POS UINT8_C(0x01) +#define BMI2_FLAT_BLOCK_POS UINT8_C(0x07) +#define BMI2_FLAT_OUT_CONF_POS UINT8_C(0x09) +#define BMI2_FLAT_HOLD_TIME_POS UINT8_C(0x06) + +/*! @name Mask definitions for BMI2 external sensor sync configuration */ +#define BMI2_EXT_SENS_SYNC_OUT_CONF_MASK UINT16_C(0x001E) + +/*! @name Bit position definitions for external sensor sync configuration */ +#define BMI2_EXT_SENS_SYNC_OUT_CONF_POS UINT8_C(0x01) + +/*! @name Mask definitions for BMI2 wrist gesture configuration */ +#define BMI2_WRIST_GEST_WEAR_ARM_MASK UINT16_C(0x0010) +#define BMI2_WRIST_GEST_OUT_CONF_MASK UINT16_C(0x000F) + +/*! @name Bit position definitions for wrist gesture configuration */ +#define BMI2_WRIST_GEST_WEAR_ARM_POS UINT8_C(0x04) + +/*! @name Mask definitions for BMI2 wrist wear wake-up configuration */ +#define BMI2_WRIST_WAKE_UP_OUT_CONF_MASK UINT16_C(0x000F) + +/*! @name Mask definition for BMI2 wrist wear wake-up configuration for wearable variant */ +#define BMI2_WRIST_WAKE_UP_ANGLE_LR_MASK UINT16_C(0x00FF) +#define BMI2_WRIST_WAKE_UP_ANGLE_LL_MASK UINT16_C(0xFF00) +#define BMI2_WRIST_WAKE_UP_ANGLE_PD_MASK UINT16_C(0x00FF) +#define BMI2_WRIST_WAKE_UP_ANGLE_PU_MASK UINT16_C(0xFF00) +#define BMI2_WRIST_WAKE_UP_MIN_DUR_MOVED_MASK UINT16_C(0x00FF) +#define BMI2_WRIST_WAKE_UP_MIN_DUR_QUITE_MASK UINT16_C(0xFF00) + +/*! @name Bit position definition for BMI2 wrist wear wake-up configuration for wearable variant */ +#define BMI2_WRIST_WAKE_UP_ANGLE_LL_POS UINT16_C(0x0008) +#define BMI2_WRIST_WAKE_UP_ANGLE_PU_POS UINT16_C(0x0008) +#define BMI2_WRIST_WAKE_UP_MIN_DUR_QUITE_POS UINT16_C(0x0008) + +/*! @name Macros to define values of BMI2 axis and its sign for re-map + * settings + */ +#define BMI2_MAP_X_AXIS UINT8_C(0x00) +#define BMI2_MAP_Y_AXIS UINT8_C(0x01) +#define BMI2_MAP_Z_AXIS UINT8_C(0x02) +#define BMI2_MAP_POSITIVE UINT8_C(0x00) +#define BMI2_MAP_NEGATIVE UINT8_C(0x01) + +/*! @name Mask definitions of BMI2 axis re-mapping */ +#define BMI2_X_AXIS_MASK UINT8_C(0x03) +#define BMI2_X_AXIS_SIGN_MASK UINT8_C(0x04) +#define BMI2_Y_AXIS_MASK UINT8_C(0x18) +#define BMI2_Y_AXIS_SIGN_MASK UINT8_C(0x20) +#define BMI2_Z_AXIS_MASK UINT8_C(0xC0) +#define BMI2_Z_AXIS_SIGN_MASK UINT8_C(0x01) + +/*! @name Bit position definitions of BMI2 axis re-mapping */ +#define BMI2_X_AXIS_SIGN_POS UINT8_C(0x02) +#define BMI2_Y_AXIS_POS UINT8_C(0x03) +#define BMI2_Y_AXIS_SIGN_POS UINT8_C(0x05) +#define BMI2_Z_AXIS_POS UINT8_C(0x06) + +/*! @name Macros to define polarity */ +#define BMI2_NEG_SIGN UINT8_C(1) +#define BMI2_POS_SIGN UINT8_C(0) + +/*! @name Macro to define related to CRT */ +#define BMI2_CRT_READY_FOR_DOWNLOAD_US UINT16_C(2000) +#define BMI2_CRT_READY_FOR_DOWNLOAD_RETRY UINT8_C(100) + +#define BMI2_CRT_WAIT_RUNNING_US UINT16_C(10000) +#define BMI2_CRT_WAIT_RUNNING_RETRY_EXECUTION UINT8_C(200) + +#define BMI2_CRT_MIN_BURST_WORD_LENGTH UINT8_C(2) +#define BMI2_CRT_MAX_BURST_WORD_LENGTH UINT16_C(255) + +#define BMI2_ACC_FOC_2G_REF UINT16_C(16384) +#define BMI2_ACC_FOC_4G_REF UINT16_C(8192) +#define BMI2_ACC_FOC_8G_REF UINT16_C(4096) +#define BMI2_ACC_FOC_16G_REF UINT16_C(2048) + +#define BMI2_GYRO_FOC_NOISE_LIMIT_NEGATIVE INT8_C(-20) +#define BMI2_GYRO_FOC_NOISE_LIMIT_POSITIVE INT8_C(20) + +/* reference value with positive and negative noise range in lsb */ +#define BMI2_ACC_2G_MAX_NOISE_LIMIT (BMI2_ACC_FOC_2G_REF + UINT16_C(255)) +#define BMI2_ACC_2G_MIN_NOISE_LIMIT (BMI2_ACC_FOC_2G_REF - UINT16_C(255)) +#define BMI2_ACC_4G_MAX_NOISE_LIMIT (BMI2_ACC_FOC_4G_REF + UINT16_C(255)) +#define BMI2_ACC_4G_MIN_NOISE_LIMIT (BMI2_ACC_FOC_4G_REF - UINT16_C(255)) +#define BMI2_ACC_8G_MAX_NOISE_LIMIT (BMI2_ACC_FOC_8G_REF + UINT16_C(255)) +#define BMI2_ACC_8G_MIN_NOISE_LIMIT (BMI2_ACC_FOC_8G_REF - UINT16_C(255)) +#define BMI2_ACC_16G_MAX_NOISE_LIMIT (BMI2_ACC_FOC_16G_REF + UINT16_C(255)) +#define BMI2_ACC_16G_MIN_NOISE_LIMIT (BMI2_ACC_FOC_16G_REF - UINT16_C(255)) + +#define BMI2_FOC_SAMPLE_LIMIT UINT8_C(128) /*! @name Bit wise selection of BMI2 sensors */ #define BMI2_MAIN_SENSORS \ @@ -492,458 +832,458 @@ | BMI2_AUX_SENS_SEL | BMI2_TEMP_SENS_SEL) /*! @name Maximum number of BMI2 main sensors */ -#define BMI2_MAIN_SENS_MAX_NUM UINT8_C(4) +#define BMI2_MAIN_SENS_MAX_NUM UINT8_C(4) /*! @name Macro to specify the number of step counter parameters */ -#define BMI2_STEP_CNT_N_PARAMS UINT8_C(25) +#define BMI2_STEP_CNT_N_PARAMS UINT8_C(25) /*! @name Macro to specify the number of free-fall accel setting parameters */ -#define BMI2_FREE_FALL_ACCEL_SET_PARAMS UINT8_C(7) +#define BMI2_FREE_FALL_ACCEL_SET_PARAMS UINT8_C(7) -#define BMI2_SELECT_GYRO_SELF_TEST UINT8_C(0) -#define BMI2_SELECT_CRT UINT8_C(1) +#define BMI2_SELECT_GYRO_SELF_TEST UINT8_C(0) +#define BMI2_SELECT_CRT UINT8_C(1) /*! @name Macro for NVM enable */ -#define BMI2_NVM_UNLOCK_ENABLE UINT8_C(0x02) -#define BMI2_NVM_UNLOCK_DISABLE UINT8_C(0x00) +#define BMI2_NVM_UNLOCK_ENABLE UINT8_C(0x02) +#define BMI2_NVM_UNLOCK_DISABLE UINT8_C(0x00) /*! @name macro to select between gyro self test and CRT */ -#define BMI2_GYRO_SELF_TEST_SEL UINT8_C(0) -#define BMI2_CRT_SEL UINT8_C(1) +#define BMI2_GYRO_SELF_TEST_SEL UINT8_C(0) +#define BMI2_CRT_SEL UINT8_C(1) /******************************************************************************/ /*! @name Accelerometer Macro Definitions */ /******************************************************************************/ /*! @name Accelerometer Bandwidth parameters */ -#define BMI2_ACC_OSR4_AVG1 UINT8_C(0x00) -#define BMI2_ACC_OSR2_AVG2 UINT8_C(0x01) -#define BMI2_ACC_NORMAL_AVG4 UINT8_C(0x02) -#define BMI2_ACC_CIC_AVG8 UINT8_C(0x03) -#define BMI2_ACC_RES_AVG16 UINT8_C(0x04) -#define BMI2_ACC_RES_AVG32 UINT8_C(0x05) -#define BMI2_ACC_RES_AVG64 UINT8_C(0x06) -#define BMI2_ACC_RES_AVG128 UINT8_C(0x07) +#define BMI2_ACC_OSR4_AVG1 UINT8_C(0x00) +#define BMI2_ACC_OSR2_AVG2 UINT8_C(0x01) +#define BMI2_ACC_NORMAL_AVG4 UINT8_C(0x02) +#define BMI2_ACC_CIC_AVG8 UINT8_C(0x03) +#define BMI2_ACC_RES_AVG16 UINT8_C(0x04) +#define BMI2_ACC_RES_AVG32 UINT8_C(0x05) +#define BMI2_ACC_RES_AVG64 UINT8_C(0x06) +#define BMI2_ACC_RES_AVG128 UINT8_C(0x07) /*! @name Accelerometer Output Data Rate */ -#define BMI2_ACC_ODR_0_78HZ UINT8_C(0x01) -#define BMI2_ACC_ODR_1_56HZ UINT8_C(0x02) -#define BMI2_ACC_ODR_3_12HZ UINT8_C(0x03) -#define BMI2_ACC_ODR_6_25HZ UINT8_C(0x04) -#define BMI2_ACC_ODR_12_5HZ UINT8_C(0x05) -#define BMI2_ACC_ODR_25HZ UINT8_C(0x06) -#define BMI2_ACC_ODR_50HZ UINT8_C(0x07) -#define BMI2_ACC_ODR_100HZ UINT8_C(0x08) -#define BMI2_ACC_ODR_200HZ UINT8_C(0x09) -#define BMI2_ACC_ODR_400HZ UINT8_C(0x0A) -#define BMI2_ACC_ODR_800HZ UINT8_C(0x0B) -#define BMI2_ACC_ODR_1600HZ UINT8_C(0x0C) +#define BMI2_ACC_ODR_0_78HZ UINT8_C(0x01) +#define BMI2_ACC_ODR_1_56HZ UINT8_C(0x02) +#define BMI2_ACC_ODR_3_12HZ UINT8_C(0x03) +#define BMI2_ACC_ODR_6_25HZ UINT8_C(0x04) +#define BMI2_ACC_ODR_12_5HZ UINT8_C(0x05) +#define BMI2_ACC_ODR_25HZ UINT8_C(0x06) +#define BMI2_ACC_ODR_50HZ UINT8_C(0x07) +#define BMI2_ACC_ODR_100HZ UINT8_C(0x08) +#define BMI2_ACC_ODR_200HZ UINT8_C(0x09) +#define BMI2_ACC_ODR_400HZ UINT8_C(0x0A) +#define BMI2_ACC_ODR_800HZ UINT8_C(0x0B) +#define BMI2_ACC_ODR_1600HZ UINT8_C(0x0C) /*! @name Accelerometer G Range */ -#define BMI2_ACC_RANGE_2G UINT8_C(0x00) -#define BMI2_ACC_RANGE_4G UINT8_C(0x01) -#define BMI2_ACC_RANGE_8G UINT8_C(0x02) -#define BMI2_ACC_RANGE_16G UINT8_C(0x03) +#define BMI2_ACC_RANGE_2G UINT8_C(0x00) +#define BMI2_ACC_RANGE_4G UINT8_C(0x01) +#define BMI2_ACC_RANGE_8G UINT8_C(0x02) +#define BMI2_ACC_RANGE_16G UINT8_C(0x03) /*! @name Mask definitions for accelerometer configuration register */ -#define BMI2_ACC_RANGE_MASK UINT8_C(0x03) -#define BMI2_ACC_ODR_MASK UINT8_C(0x0F) -#define BMI2_ACC_BW_PARAM_MASK UINT8_C(0x70) -#define BMI2_ACC_FILTER_PERF_MODE_MASK UINT8_C(0x80) +#define BMI2_ACC_RANGE_MASK UINT8_C(0x03) +#define BMI2_ACC_ODR_MASK UINT8_C(0x0F) +#define BMI2_ACC_BW_PARAM_MASK UINT8_C(0x70) +#define BMI2_ACC_FILTER_PERF_MODE_MASK UINT8_C(0x80) /*! @name Bit position definitions for accelerometer configuration register */ -#define BMI2_ACC_BW_PARAM_POS UINT8_C(0x04) -#define BMI2_ACC_FILTER_PERF_MODE_POS UINT8_C(0x07) +#define BMI2_ACC_BW_PARAM_POS UINT8_C(0x04) +#define BMI2_ACC_FILTER_PERF_MODE_POS UINT8_C(0x07) /*! @name Self test macro to define range */ -#define BMI2_ACC_SELF_TEST_RANGE UINT8_C(16) +#define BMI2_ACC_SELF_TEST_RANGE UINT8_C(16) /*! @name Self test macro to show resulting minimum and maximum difference * signal of the axes in mg */ -#define BMI2_ST_ACC_X_SIG_MIN_DIFF INT16_C(16000) -#define BMI2_ST_ACC_Y_SIG_MIN_DIFF INT16_C(-15000) -#define BMI2_ST_ACC_Z_SIG_MIN_DIFF INT16_C(10000) +#define BMI2_ST_ACC_X_SIG_MIN_DIFF INT16_C(16000) +#define BMI2_ST_ACC_Y_SIG_MIN_DIFF INT16_C(-15000) +#define BMI2_ST_ACC_Z_SIG_MIN_DIFF INT16_C(10000) /*! @name Mask definitions for accelerometer self-test */ -#define BMI2_ACC_SELF_TEST_EN_MASK UINT8_C(0x01) -#define BMI2_ACC_SELF_TEST_SIGN_MASK UINT8_C(0x04) -#define BMI2_ACC_SELF_TEST_AMP_MASK UINT8_C(0x08) +#define BMI2_ACC_SELF_TEST_EN_MASK UINT8_C(0x01) +#define BMI2_ACC_SELF_TEST_SIGN_MASK UINT8_C(0x04) +#define BMI2_ACC_SELF_TEST_AMP_MASK UINT8_C(0x08) /*! @name Bit Positions for accelerometer self-test */ -#define BMI2_ACC_SELF_TEST_SIGN_POS UINT8_C(0x02) -#define BMI2_ACC_SELF_TEST_AMP_POS UINT8_C(0x03) +#define BMI2_ACC_SELF_TEST_SIGN_POS UINT8_C(0x02) +#define BMI2_ACC_SELF_TEST_AMP_POS UINT8_C(0x03) /*! @name MASK definition for gyro self test status */ -#define BMI2_GYR_ST_AXES_DONE_MASK UINT8_C(0X01) -#define BMI2_GYR_AXIS_X_OK_MASK UINT8_C(0x02) -#define BMI2_GYR_AXIS_Y_OK_MASK UINT8_C(0x04) -#define BMI2_GYR_AXIS_Z_OK_MASK UINT8_C(0x08) +#define BMI2_GYR_ST_AXES_DONE_MASK UINT8_C(0X01) +#define BMI2_GYR_AXIS_X_OK_MASK UINT8_C(0x02) +#define BMI2_GYR_AXIS_Y_OK_MASK UINT8_C(0x04) +#define BMI2_GYR_AXIS_Z_OK_MASK UINT8_C(0x08) /*! @name Bit position for gyro self test status */ -#define BMI2_GYR_AXIS_X_OK_POS UINT8_C(0x01) -#define BMI2_GYR_AXIS_Y_OK_POS UINT8_C(0x02) -#define BMI2_GYR_AXIS_Z_OK_POS UINT8_C(0x03) +#define BMI2_GYR_AXIS_X_OK_POS UINT8_C(0x01) +#define BMI2_GYR_AXIS_Y_OK_POS UINT8_C(0x02) +#define BMI2_GYR_AXIS_Z_OK_POS UINT8_C(0x03) /******************************************************************************/ /*! @name Gyroscope Macro Definitions */ /******************************************************************************/ /*! @name Gyroscope Bandwidth parameters */ -#define BMI2_GYR_OSR4_MODE UINT8_C(0x00) -#define BMI2_GYR_OSR2_MODE UINT8_C(0x01) -#define BMI2_GYR_NORMAL_MODE UINT8_C(0x02) -#define BMI2_GYR_CIC_MODE UINT8_C(0x03) +#define BMI2_GYR_OSR4_MODE UINT8_C(0x00) +#define BMI2_GYR_OSR2_MODE UINT8_C(0x01) +#define BMI2_GYR_NORMAL_MODE UINT8_C(0x02) +#define BMI2_GYR_CIC_MODE UINT8_C(0x03) /*! @name Gyroscope Output Data Rate */ -#define BMI2_GYR_ODR_25HZ UINT8_C(0x06) -#define BMI2_GYR_ODR_50HZ UINT8_C(0x07) -#define BMI2_GYR_ODR_100HZ UINT8_C(0x08) -#define BMI2_GYR_ODR_200HZ UINT8_C(0x09) -#define BMI2_GYR_ODR_400HZ UINT8_C(0x0A) -#define BMI2_GYR_ODR_800HZ UINT8_C(0x0B) -#define BMI2_GYR_ODR_1600HZ UINT8_C(0x0C) -#define BMI2_GYR_ODR_3200HZ UINT8_C(0x0D) +#define BMI2_GYR_ODR_25HZ UINT8_C(0x06) +#define BMI2_GYR_ODR_50HZ UINT8_C(0x07) +#define BMI2_GYR_ODR_100HZ UINT8_C(0x08) +#define BMI2_GYR_ODR_200HZ UINT8_C(0x09) +#define BMI2_GYR_ODR_400HZ UINT8_C(0x0A) +#define BMI2_GYR_ODR_800HZ UINT8_C(0x0B) +#define BMI2_GYR_ODR_1600HZ UINT8_C(0x0C) +#define BMI2_GYR_ODR_3200HZ UINT8_C(0x0D) /*! @name Gyroscope OIS Range */ -#define BMI2_GYR_OIS_250 UINT8_C(0x00) -#define BMI2_GYR_OIS_2000 UINT8_C(0x01) +#define BMI2_GYR_OIS_250 UINT8_C(0x00) +#define BMI2_GYR_OIS_2000 UINT8_C(0x01) /*! @name Gyroscope Angular Rate Measurement Range */ -#define BMI2_GYR_RANGE_2000 UINT8_C(0x00) -#define BMI2_GYR_RANGE_1000 UINT8_C(0x01) -#define BMI2_GYR_RANGE_500 UINT8_C(0x02) -#define BMI2_GYR_RANGE_250 UINT8_C(0x03) -#define BMI2_GYR_RANGE_125 UINT8_C(0x04) +#define BMI2_GYR_RANGE_2000 UINT8_C(0x00) +#define BMI2_GYR_RANGE_1000 UINT8_C(0x01) +#define BMI2_GYR_RANGE_500 UINT8_C(0x02) +#define BMI2_GYR_RANGE_250 UINT8_C(0x03) +#define BMI2_GYR_RANGE_125 UINT8_C(0x04) /*! @name Mask definitions for gyroscope configuration register */ -#define BMI2_GYR_RANGE_MASK UINT8_C(0x07) -#define BMI2_GYR_OIS_RANGE_MASK UINT8_C(0x08) -#define BMI2_GYR_ODR_MASK UINT8_C(0x0F) -#define BMI2_GYR_BW_PARAM_MASK UINT8_C(0x30) -#define BMI2_GYR_NOISE_PERF_MODE_MASK UINT8_C(0x40) -#define BMI2_GYR_FILTER_PERF_MODE_MASK UINT8_C(0x80) +#define BMI2_GYR_RANGE_MASK UINT8_C(0x07) +#define BMI2_GYR_OIS_RANGE_MASK UINT8_C(0x08) +#define BMI2_GYR_ODR_MASK UINT8_C(0x0F) +#define BMI2_GYR_BW_PARAM_MASK UINT8_C(0x30) +#define BMI2_GYR_NOISE_PERF_MODE_MASK UINT8_C(0x40) +#define BMI2_GYR_FILTER_PERF_MODE_MASK UINT8_C(0x80) /*! @name Bit position definitions for gyroscope configuration register */ -#define BMI2_GYR_OIS_RANGE_POS UINT8_C(0x03) -#define BMI2_GYR_BW_PARAM_POS UINT8_C(0x04) -#define BMI2_GYR_NOISE_PERF_MODE_POS UINT8_C(0x06) -#define BMI2_GYR_FILTER_PERF_MODE_POS UINT8_C(0x07) +#define BMI2_GYR_OIS_RANGE_POS UINT8_C(0x03) +#define BMI2_GYR_BW_PARAM_POS UINT8_C(0x04) +#define BMI2_GYR_NOISE_PERF_MODE_POS UINT8_C(0x06) +#define BMI2_GYR_FILTER_PERF_MODE_POS UINT8_C(0x07) /******************************************************************************/ /*! @name Auxiliary Macro Definitions */ /******************************************************************************/ /*! @name Auxiliary Output Data Rate */ -#define BMI2_AUX_ODR_RESERVED UINT8_C(0x00) -#define BMI2_AUX_ODR_0_78HZ UINT8_C(0x01) -#define BMI2_AUX_ODR_1_56HZ UINT8_C(0x02) -#define BMI2_AUX_ODR_3_12HZ UINT8_C(0x03) -#define BMI2_AUX_ODR_6_25HZ UINT8_C(0x04) -#define BMI2_AUX_ODR_12_5HZ UINT8_C(0x05) -#define BMI2_AUX_ODR_25HZ UINT8_C(0x06) -#define BMI2_AUX_ODR_50HZ UINT8_C(0x07) -#define BMI2_AUX_ODR_100HZ UINT8_C(0x08) -#define BMI2_AUX_ODR_200HZ UINT8_C(0x09) -#define BMI2_AUX_ODR_400HZ UINT8_C(0x0A) -#define BMI2_AUX_ODR_800HZ UINT8_C(0x0B) +#define BMI2_AUX_ODR_RESERVED UINT8_C(0x00) +#define BMI2_AUX_ODR_0_78HZ UINT8_C(0x01) +#define BMI2_AUX_ODR_1_56HZ UINT8_C(0x02) +#define BMI2_AUX_ODR_3_12HZ UINT8_C(0x03) +#define BMI2_AUX_ODR_6_25HZ UINT8_C(0x04) +#define BMI2_AUX_ODR_12_5HZ UINT8_C(0x05) +#define BMI2_AUX_ODR_25HZ UINT8_C(0x06) +#define BMI2_AUX_ODR_50HZ UINT8_C(0x07) +#define BMI2_AUX_ODR_100HZ UINT8_C(0x08) +#define BMI2_AUX_ODR_200HZ UINT8_C(0x09) +#define BMI2_AUX_ODR_400HZ UINT8_C(0x0A) +#define BMI2_AUX_ODR_800HZ UINT8_C(0x0B) /*! @name Macro to define burst read lengths for both manual and auto modes */ -#define BMI2_AUX_READ_LEN_0 UINT8_C(0x00) -#define BMI2_AUX_READ_LEN_1 UINT8_C(0x01) -#define BMI2_AUX_READ_LEN_2 UINT8_C(0x02) -#define BMI2_AUX_READ_LEN_3 UINT8_C(0x03) +#define BMI2_AUX_READ_LEN_0 UINT8_C(0x00) +#define BMI2_AUX_READ_LEN_1 UINT8_C(0x01) +#define BMI2_AUX_READ_LEN_2 UINT8_C(0x02) +#define BMI2_AUX_READ_LEN_3 UINT8_C(0x03) /*! @name Mask definitions for auxiliary interface configuration register */ -#define BMI2_AUX_SET_I2C_ADDR_MASK UINT8_C(0xFE) -#define BMI2_AUX_MAN_MODE_EN_MASK UINT8_C(0x80) -#define BMI2_AUX_FCU_WR_EN_MASK UINT8_C(0x40) -#define BMI2_AUX_MAN_READ_BURST_MASK UINT8_C(0x0C) -#define BMI2_AUX_READ_BURST_MASK UINT8_C(0x03) -#define BMI2_AUX_ODR_EN_MASK UINT8_C(0x0F) -#define BMI2_AUX_OFFSET_READ_OUT_MASK UINT8_C(0xF0) +#define BMI2_AUX_SET_I2C_ADDR_MASK UINT8_C(0xFE) +#define BMI2_AUX_MAN_MODE_EN_MASK UINT8_C(0x80) +#define BMI2_AUX_FCU_WR_EN_MASK UINT8_C(0x40) +#define BMI2_AUX_MAN_READ_BURST_MASK UINT8_C(0x0C) +#define BMI2_AUX_READ_BURST_MASK UINT8_C(0x03) +#define BMI2_AUX_ODR_EN_MASK UINT8_C(0x0F) +#define BMI2_AUX_OFFSET_READ_OUT_MASK UINT8_C(0xF0) /*! @name Bit positions for auxiliary interface configuration register */ -#define BMI2_AUX_SET_I2C_ADDR_POS UINT8_C(0x01) -#define BMI2_AUX_MAN_MODE_EN_POS UINT8_C(0x07) -#define BMI2_AUX_FCU_WR_EN_POS UINT8_C(0x06) -#define BMI2_AUX_MAN_READ_BURST_POS UINT8_C(0x02) -#define BMI2_AUX_OFFSET_READ_OUT_POS UINT8_C(0x04) +#define BMI2_AUX_SET_I2C_ADDR_POS UINT8_C(0x01) +#define BMI2_AUX_MAN_MODE_EN_POS UINT8_C(0x07) +#define BMI2_AUX_FCU_WR_EN_POS UINT8_C(0x06) +#define BMI2_AUX_MAN_READ_BURST_POS UINT8_C(0x02) +#define BMI2_AUX_OFFSET_READ_OUT_POS UINT8_C(0x04) /******************************************************************************/ /*! @name FIFO Macro Definitions */ /******************************************************************************/ /*! @name Macros to define virtual FIFO frame mode */ -#define BMI2_FIFO_VIRT_FRM_MODE UINT8_C(0x03) +#define BMI2_FIFO_VIRT_FRM_MODE UINT8_C(0x03) /*! @name FIFO Header Mask definitions */ -#define BMI2_FIFO_HEADER_ACC_FRM UINT8_C(0x84) -#define BMI2_FIFO_HEADER_AUX_FRM UINT8_C(0x90) -#define BMI2_FIFO_HEADER_GYR_FRM UINT8_C(0x88) -#define BMI2_FIFO_HEADER_GYR_ACC_FRM UINT8_C(0x8C) -#define BMI2_FIFO_HEADER_AUX_ACC_FRM UINT8_C(0x94) -#define BMI2_FIFO_HEADER_AUX_GYR_FRM UINT8_C(0x98) -#define BMI2_FIFO_HEADER_ALL_FRM UINT8_C(0x9C) -#define BMI2_FIFO_HEADER_SENS_TIME_FRM UINT8_C(0x44) -#define BMI2_FIFO_HEADER_SKIP_FRM UINT8_C(0x40) -#define BMI2_FIFO_HEADER_INPUT_CFG_FRM UINT8_C(0x48) -#define BMI2_FIFO_HEAD_OVER_READ_MSB UINT8_C(0x80) -#define BMI2_FIFO_VIRT_ACT_RECOG_FRM UINT8_C(0xC8) +#define BMI2_FIFO_HEADER_ACC_FRM UINT8_C(0x84) +#define BMI2_FIFO_HEADER_AUX_FRM UINT8_C(0x90) +#define BMI2_FIFO_HEADER_GYR_FRM UINT8_C(0x88) +#define BMI2_FIFO_HEADER_GYR_ACC_FRM UINT8_C(0x8C) +#define BMI2_FIFO_HEADER_AUX_ACC_FRM UINT8_C(0x94) +#define BMI2_FIFO_HEADER_AUX_GYR_FRM UINT8_C(0x98) +#define BMI2_FIFO_HEADER_ALL_FRM UINT8_C(0x9C) +#define BMI2_FIFO_HEADER_SENS_TIME_FRM UINT8_C(0x44) +#define BMI2_FIFO_HEADER_SKIP_FRM UINT8_C(0x40) +#define BMI2_FIFO_HEADER_INPUT_CFG_FRM UINT8_C(0x48) +#define BMI2_FIFO_HEAD_OVER_READ_MSB UINT8_C(0x80) +#define BMI2_FIFO_VIRT_ACT_RECOG_FRM UINT8_C(0xC8) /*! @name BMI2 sensor selection for header-less frames */ -#define BMI2_FIFO_HEAD_LESS_ACC_FRM UINT8_C(0x40) -#define BMI2_FIFO_HEAD_LESS_AUX_FRM UINT8_C(0x20) -#define BMI2_FIFO_HEAD_LESS_GYR_FRM UINT8_C(0x80) -#define BMI2_FIFO_HEAD_LESS_GYR_AUX_FRM UINT8_C(0xA0) -#define BMI2_FIFO_HEAD_LESS_GYR_ACC_FRM UINT8_C(0xC0) -#define BMI2_FIFO_HEAD_LESS_AUX_ACC_FRM UINT8_C(0x60) -#define BMI2_FIFO_HEAD_LESS_ALL_FRM UINT8_C(0xE0) +#define BMI2_FIFO_HEAD_LESS_ACC_FRM UINT8_C(0x40) +#define BMI2_FIFO_HEAD_LESS_AUX_FRM UINT8_C(0x20) +#define BMI2_FIFO_HEAD_LESS_GYR_FRM UINT8_C(0x80) +#define BMI2_FIFO_HEAD_LESS_GYR_AUX_FRM UINT8_C(0xA0) +#define BMI2_FIFO_HEAD_LESS_GYR_ACC_FRM UINT8_C(0xC0) +#define BMI2_FIFO_HEAD_LESS_AUX_ACC_FRM UINT8_C(0x60) +#define BMI2_FIFO_HEAD_LESS_ALL_FRM UINT8_C(0xE0) /*! @name Mask definitions for FIFO frame content configuration */ -#define BMI2_FIFO_STOP_ON_FULL UINT16_C(0x0001) -#define BMI2_FIFO_TIME_EN UINT16_C(0x0002) -#define BMI2_FIFO_TAG_INT1 UINT16_C(0x0300) -#define BMI2_FIFO_TAG_INT2 UINT16_C(0x0C00) -#define BMI2_FIFO_HEADER_EN UINT16_C(0x1000) -#define BMI2_FIFO_AUX_EN UINT16_C(0x2000) -#define BMI2_FIFO_ACC_EN UINT16_C(0x4000) -#define BMI2_FIFO_GYR_EN UINT16_C(0x8000) -#define BMI2_FIFO_ALL_EN UINT16_C(0xE000) +#define BMI2_FIFO_STOP_ON_FULL UINT16_C(0x0001) +#define BMI2_FIFO_TIME_EN UINT16_C(0x0002) +#define BMI2_FIFO_TAG_INT1 UINT16_C(0x0300) +#define BMI2_FIFO_TAG_INT2 UINT16_C(0x0C00) +#define BMI2_FIFO_HEADER_EN UINT16_C(0x1000) +#define BMI2_FIFO_AUX_EN UINT16_C(0x2000) +#define BMI2_FIFO_ACC_EN UINT16_C(0x4000) +#define BMI2_FIFO_GYR_EN UINT16_C(0x8000) +#define BMI2_FIFO_ALL_EN UINT16_C(0xE000) /*! @name FIFO sensor data lengths */ -#define BMI2_FIFO_ACC_LENGTH UINT8_C(6) -#define BMI2_FIFO_GYR_LENGTH UINT8_C(6) -#define BMI2_FIFO_AUX_LENGTH UINT8_C(8) -#define BMI2_FIFO_ACC_AUX_LENGTH UINT8_C(14) -#define BMI2_FIFO_GYR_AUX_LENGTH UINT8_C(14) -#define BMI2_FIFO_ACC_GYR_LENGTH UINT8_C(12) -#define BMI2_FIFO_ALL_LENGTH UINT8_C(20) -#define BMI2_SENSOR_TIME_LENGTH UINT8_C(3) -#define BMI2_FIFO_CONFIG_LENGTH UINT8_C(2) -#define BMI2_FIFO_WM_LENGTH UINT8_C(2) -#define BMI2_MAX_VALUE_FIFO_FILTER UINT8_C(1) -#define BMI2_FIFO_DATA_LENGTH UINT8_C(2) -#define BMI2_FIFO_LENGTH_MSB_BYTE UINT8_C(1) -#define BMI2_FIFO_INPUT_CFG_LENGTH UINT8_C(4) -#define BMI2_FIFO_SKIP_FRM_LENGTH UINT8_C(1) +#define BMI2_FIFO_ACC_LENGTH UINT8_C(6) +#define BMI2_FIFO_GYR_LENGTH UINT8_C(6) +#define BMI2_FIFO_AUX_LENGTH UINT8_C(8) +#define BMI2_FIFO_ACC_AUX_LENGTH UINT8_C(14) +#define BMI2_FIFO_GYR_AUX_LENGTH UINT8_C(14) +#define BMI2_FIFO_ACC_GYR_LENGTH UINT8_C(12) +#define BMI2_FIFO_ALL_LENGTH UINT8_C(20) +#define BMI2_SENSOR_TIME_LENGTH UINT8_C(3) +#define BMI2_FIFO_CONFIG_LENGTH UINT8_C(2) +#define BMI2_FIFO_WM_LENGTH UINT8_C(2) +#define BMI2_MAX_VALUE_FIFO_FILTER UINT8_C(1) +#define BMI2_FIFO_DATA_LENGTH UINT8_C(2) +#define BMI2_FIFO_LENGTH_MSB_BYTE UINT8_C(1) +#define BMI2_FIFO_INPUT_CFG_LENGTH UINT8_C(4) +#define BMI2_FIFO_SKIP_FRM_LENGTH UINT8_C(1) /*! @name FIFO sensor virtual data lengths: sensor data plus sensor time */ -#define BMI2_FIFO_VIRT_ACC_LENGTH UINT8_C(9) -#define BMI2_FIFO_VIRT_GYR_LENGTH UINT8_C(9) -#define BMI2_FIFO_VIRT_AUX_LENGTH UINT8_C(11) -#define BMI2_FIFO_VIRT_ACC_AUX_LENGTH UINT8_C(17) -#define BMI2_FIFO_VIRT_GYR_AUX_LENGTH UINT8_C(17) -#define BMI2_FIFO_VIRT_ACC_GYR_LENGTH UINT8_C(15) -#define BMI2_FIFO_VIRT_ALL_LENGTH UINT8_C(23) +#define BMI2_FIFO_VIRT_ACC_LENGTH UINT8_C(9) +#define BMI2_FIFO_VIRT_GYR_LENGTH UINT8_C(9) +#define BMI2_FIFO_VIRT_AUX_LENGTH UINT8_C(11) +#define BMI2_FIFO_VIRT_ACC_AUX_LENGTH UINT8_C(17) +#define BMI2_FIFO_VIRT_GYR_AUX_LENGTH UINT8_C(17) +#define BMI2_FIFO_VIRT_ACC_GYR_LENGTH UINT8_C(15) +#define BMI2_FIFO_VIRT_ALL_LENGTH UINT8_C(23) /*! @name FIFO sensor virtual data lengths: activity recognition */ -#define BMI2_FIFO_VIRT_ACT_DATA_LENGTH UINT8_C(6) -#define BMI2_FIFO_VIRT_ACT_TIME_LENGTH UINT8_C(4) -#define BMI2_FIFO_VIRT_ACT_TYPE_LENGTH UINT8_C(1) -#define BMI2_FIFO_VIRT_ACT_STAT_LENGTH UINT8_C(1) +#define BMI2_FIFO_VIRT_ACT_DATA_LENGTH UINT8_C(6) +#define BMI2_FIFO_VIRT_ACT_TIME_LENGTH UINT8_C(4) +#define BMI2_FIFO_VIRT_ACT_TYPE_LENGTH UINT8_C(1) +#define BMI2_FIFO_VIRT_ACT_STAT_LENGTH UINT8_C(1) /*! @name BMI2 FIFO data filter modes */ -#define BMI2_FIFO_UNFILTERED_DATA UINT8_C(0) -#define BMI2_FIFO_FILTERED_DATA UINT8_C(1) +#define BMI2_FIFO_UNFILTERED_DATA UINT8_C(0) +#define BMI2_FIFO_FILTERED_DATA UINT8_C(1) /*! @name FIFO frame masks */ -#define BMI2_FIFO_LSB_CONFIG_CHECK UINT8_C(0x00) -#define BMI2_FIFO_MSB_CONFIG_CHECK UINT8_C(0x80) -#define BMI2_FIFO_TAG_INTR_MASK UINT8_C(0xFF) +#define BMI2_FIFO_LSB_CONFIG_CHECK UINT8_C(0x00) +#define BMI2_FIFO_MSB_CONFIG_CHECK UINT8_C(0x80) +#define BMI2_FIFO_TAG_INTR_MASK UINT8_C(0xFF) /*! @name BMI2 Mask definitions of FIFO configuration registers */ -#define BMI2_FIFO_CONFIG_0_MASK UINT16_C(0x0003) -#define BMI2_FIFO_CONFIG_1_MASK UINT16_C(0xFF00) +#define BMI2_FIFO_CONFIG_0_MASK UINT16_C(0x0003) +#define BMI2_FIFO_CONFIG_1_MASK UINT16_C(0xFF00) /*! @name FIFO self wake-up mask definition */ -#define BMI2_FIFO_SELF_WAKE_UP_MASK UINT8_C(0x02) +#define BMI2_FIFO_SELF_WAKE_UP_MASK UINT8_C(0x02) /*! @name FIFO down sampling mask definition */ -#define BMI2_ACC_FIFO_DOWNS_MASK UINT8_C(0x70) -#define BMI2_GYR_FIFO_DOWNS_MASK UINT8_C(0x07) +#define BMI2_ACC_FIFO_DOWNS_MASK UINT8_C(0x70) +#define BMI2_GYR_FIFO_DOWNS_MASK UINT8_C(0x07) /*! @name FIFO down sampling bit positions */ -#define BMI2_ACC_FIFO_DOWNS_POS UINT8_C(0x04) +#define BMI2_ACC_FIFO_DOWNS_POS UINT8_C(0x04) /*! @name FIFO filter mask definition */ -#define BMI2_ACC_FIFO_FILT_DATA_MASK UINT8_C(0x80) -#define BMI2_GYR_FIFO_FILT_DATA_MASK UINT8_C(0x08) +#define BMI2_ACC_FIFO_FILT_DATA_MASK UINT8_C(0x80) +#define BMI2_GYR_FIFO_FILT_DATA_MASK UINT8_C(0x08) /*! @name FIFO filter bit positions */ -#define BMI2_ACC_FIFO_FILT_DATA_POS UINT8_C(0x07) -#define BMI2_GYR_FIFO_FILT_DATA_POS UINT8_C(0x03) +#define BMI2_ACC_FIFO_FILT_DATA_POS UINT8_C(0x07) +#define BMI2_GYR_FIFO_FILT_DATA_POS UINT8_C(0x03) /*! @name FIFO byte counter mask definition */ -#define BMI2_FIFO_BYTE_COUNTER_MSB_MASK UINT8_C(0x3F) +#define BMI2_FIFO_BYTE_COUNTER_MSB_MASK UINT8_C(0x3F) /*! @name FIFO self wake-up bit positions */ -#define BMI2_FIFO_SELF_WAKE_UP_POS UINT8_C(0x01) +#define BMI2_FIFO_SELF_WAKE_UP_POS UINT8_C(0x01) /*! @name Mask Definitions for Virtual FIFO frames */ -#define BMI2_FIFO_VIRT_FRM_MODE_MASK UINT8_C(0xC0) -#define BMI2_FIFO_VIRT_PAYLOAD_MASK UINT8_C(0x3C) +#define BMI2_FIFO_VIRT_FRM_MODE_MASK UINT8_C(0xC0) +#define BMI2_FIFO_VIRT_PAYLOAD_MASK UINT8_C(0x3C) /*! @name Bit Positions for Virtual FIFO frames */ -#define BMI2_FIFO_VIRT_FRM_MODE_POS UINT8_C(0x06) -#define BMI2_FIFO_VIRT_PAYLOAD_POS UINT8_C(0x02) +#define BMI2_FIFO_VIRT_FRM_MODE_POS UINT8_C(0x06) +#define BMI2_FIFO_VIRT_PAYLOAD_POS UINT8_C(0x02) /******************************************************************************/ /*! @name Interrupt Macro Definitions */ /******************************************************************************/ /*! @name BMI2 Interrupt Modes */ /* Non latched */ -#define BMI2_INT_NON_LATCH UINT8_C(0) +#define BMI2_INT_NON_LATCH UINT8_C(0) /* Permanently latched */ -#define BMI2_INT_LATCH UINT8_C(1) +#define BMI2_INT_LATCH UINT8_C(1) /*! @name BMI2 Interrupt Pin Behavior */ -#define BMI2_INT_PUSH_PULL UINT8_C(0) -#define BMI2_INT_OPEN_DRAIN UINT8_C(1) +#define BMI2_INT_PUSH_PULL UINT8_C(0) +#define BMI2_INT_OPEN_DRAIN UINT8_C(1) /*! @name BMI2 Interrupt Pin Level */ -#define BMI2_INT_ACTIVE_LOW UINT8_C(0) -#define BMI2_INT_ACTIVE_HIGH UINT8_C(1) +#define BMI2_INT_ACTIVE_LOW UINT8_C(0) +#define BMI2_INT_ACTIVE_HIGH UINT8_C(1) /*! @name BMI2 Interrupt Output Enable */ -#define BMI2_INT_OUTPUT_DISABLE UINT8_C(0) -#define BMI2_INT_OUTPUT_ENABLE UINT8_C(1) +#define BMI2_INT_OUTPUT_DISABLE UINT8_C(0) +#define BMI2_INT_OUTPUT_ENABLE UINT8_C(1) /*! @name BMI2 Interrupt Input Enable */ -#define BMI2_INT_INPUT_DISABLE UINT8_C(0) -#define BMI2_INT_INPUT_ENABLE UINT8_C(1) +#define BMI2_INT_INPUT_DISABLE UINT8_C(0) +#define BMI2_INT_INPUT_ENABLE UINT8_C(1) /*! @name Mask definitions for interrupt pin configuration */ -#define BMI2_INT_LATCH_MASK UINT8_C(0x01) -#define BMI2_INT_LEVEL_MASK UINT8_C(0x02) -#define BMI2_INT_OPEN_DRAIN_MASK UINT8_C(0x04) -#define BMI2_INT_OUTPUT_EN_MASK UINT8_C(0x08) -#define BMI2_INT_INPUT_EN_MASK UINT8_C(0x10) +#define BMI2_INT_LATCH_MASK UINT8_C(0x01) +#define BMI2_INT_LEVEL_MASK UINT8_C(0x02) +#define BMI2_INT_OPEN_DRAIN_MASK UINT8_C(0x04) +#define BMI2_INT_OUTPUT_EN_MASK UINT8_C(0x08) +#define BMI2_INT_INPUT_EN_MASK UINT8_C(0x10) /*! @name Bit position definitions for interrupt pin configuration */ -#define BMI2_INT_LEVEL_POS UINT8_C(0x01) -#define BMI2_INT_OPEN_DRAIN_POS UINT8_C(0x02) -#define BMI2_INT_OUTPUT_EN_POS UINT8_C(0x03) -#define BMI2_INT_INPUT_EN_POS UINT8_C(0x04) +#define BMI2_INT_LEVEL_POS UINT8_C(0x01) +#define BMI2_INT_OPEN_DRAIN_POS UINT8_C(0x02) +#define BMI2_INT_OUTPUT_EN_POS UINT8_C(0x03) +#define BMI2_INT_INPUT_EN_POS UINT8_C(0x04) /*! @name Mask definitions for data interrupt mapping */ -#define BMI2_FFULL_INT UINT8_C(0x01) -#define BMI2_FWM_INT UINT8_C(0x02) -#define BMI2_DRDY_INT UINT8_C(0x04) -#define BMI2_ERR_INT UINT8_C(0x08) +#define BMI2_FFULL_INT UINT8_C(0x01) +#define BMI2_FWM_INT UINT8_C(0x02) +#define BMI2_DRDY_INT UINT8_C(0x04) +#define BMI2_ERR_INT UINT8_C(0x08) /*! @name Mask definitions for data interrupt status bits */ -#define BMI2_FFULL_INT_STATUS_MASK UINT16_C(0x0100) -#define BMI2_FWM_INT_STATUS_MASK UINT16_C(0x0200) -#define BMI2_ERR_INT_STATUS_MASK UINT16_C(0x0400) -#define BMI2_AUX_DRDY_INT_MASK UINT16_C(0x2000) -#define BMI2_GYR_DRDY_INT_MASK UINT16_C(0x4000) -#define BMI2_ACC_DRDY_INT_MASK UINT16_C(0x8000) +#define BMI2_FFULL_INT_STATUS_MASK UINT16_C(0x0100) +#define BMI2_FWM_INT_STATUS_MASK UINT16_C(0x0200) +#define BMI2_ERR_INT_STATUS_MASK UINT16_C(0x0400) +#define BMI2_AUX_DRDY_INT_MASK UINT16_C(0x2000) +#define BMI2_GYR_DRDY_INT_MASK UINT16_C(0x4000) +#define BMI2_ACC_DRDY_INT_MASK UINT16_C(0x8000) /*! @name Maximum number of interrupt pins */ -#define BMI2_INT_PIN_MAX_NUM UINT8_C(2) +#define BMI2_INT_PIN_MAX_NUM UINT8_C(2) /*! @name Macro for mapping feature interrupts */ -#define BMI2_FEAT_BIT_DISABLE UINT8_C(0) -#define BMI2_FEAT_BIT0 UINT8_C(1) -#define BMI2_FEAT_BIT1 UINT8_C(2) -#define BMI2_FEAT_BIT2 UINT8_C(3) -#define BMI2_FEAT_BIT3 UINT8_C(4) -#define BMI2_FEAT_BIT4 UINT8_C(5) -#define BMI2_FEAT_BIT5 UINT8_C(6) -#define BMI2_FEAT_BIT6 UINT8_C(7) -#define BMI2_FEAT_BIT7 UINT8_C(8) -#define BMI2_FEAT_BIT_MAX UINT8_C(9) +#define BMI2_FEAT_BIT_DISABLE UINT8_C(0) +#define BMI2_FEAT_BIT0 UINT8_C(1) +#define BMI2_FEAT_BIT1 UINT8_C(2) +#define BMI2_FEAT_BIT2 UINT8_C(3) +#define BMI2_FEAT_BIT3 UINT8_C(4) +#define BMI2_FEAT_BIT4 UINT8_C(5) +#define BMI2_FEAT_BIT5 UINT8_C(6) +#define BMI2_FEAT_BIT6 UINT8_C(7) +#define BMI2_FEAT_BIT7 UINT8_C(8) +#define BMI2_FEAT_BIT_MAX UINT8_C(9) /******************************************************************************/ /*! @name OIS Interface Macro Definitions */ /******************************************************************************/ /*! @name Mask definitions for interface configuration register */ -#define BMI2_OIS_IF_EN_MASK UINT8_C(0x10) -#define BMI2_AUX_IF_EN_MASK UINT8_C(0x20) +#define BMI2_OIS_IF_EN_MASK UINT8_C(0x10) +#define BMI2_AUX_IF_EN_MASK UINT8_C(0x20) /*! @name Bit positions for OIS interface enable */ -#define BMI2_OIS_IF_EN_POS UINT8_C(0x04) -#define BMI2_AUX_IF_EN_POS UINT8_C(0x05) +#define BMI2_OIS_IF_EN_POS UINT8_C(0x04) +#define BMI2_AUX_IF_EN_POS UINT8_C(0x05) /******************************************************************************/ /*! @name Macro Definitions for Axes re-mapping */ /******************************************************************************/ /*! @name Macros for the user-defined values of axes and their polarities */ -#define BMI2_X UINT8_C(0x01) -#define BMI2_NEG_X UINT8_C(0x09) -#define BMI2_Y UINT8_C(0x02) -#define BMI2_NEG_Y UINT8_C(0x0A) -#define BMI2_Z UINT8_C(0x04) -#define BMI2_NEG_Z UINT8_C(0x0C) -#define BMI2_AXIS_MASK UINT8_C(0x07) -#define BMI2_AXIS_SIGN UINT8_C(0x08) +#define BMI2_X UINT8_C(0x01) +#define BMI2_NEG_X UINT8_C(0x09) +#define BMI2_Y UINT8_C(0x02) +#define BMI2_NEG_Y UINT8_C(0x0A) +#define BMI2_Z UINT8_C(0x04) +#define BMI2_NEG_Z UINT8_C(0x0C) +#define BMI2_AXIS_MASK UINT8_C(0x07) +#define BMI2_AXIS_SIGN UINT8_C(0x08) /******************************************************************************/ /*! @name Macro Definitions for offset and gain compensation */ /******************************************************************************/ /*! @name Mask definitions of gyroscope offset compensation registers */ -#define BMI2_GYR_GAIN_EN_MASK UINT8_C(0x80) -#define BMI2_GYR_OFF_COMP_EN_MASK UINT8_C(0x40) +#define BMI2_GYR_GAIN_EN_MASK UINT8_C(0x80) +#define BMI2_GYR_OFF_COMP_EN_MASK UINT8_C(0x40) /*! @name Bit positions of gyroscope offset compensation registers */ -#define BMI2_GYR_OFF_COMP_EN_POS UINT8_C(0x06) +#define BMI2_GYR_OFF_COMP_EN_POS UINT8_C(0x06) /*! @name Mask definitions of gyroscope user-gain registers */ -#define BMI2_GYR_USR_GAIN_X_MASK UINT8_C(0x7F) -#define BMI2_GYR_USR_GAIN_Y_MASK UINT8_C(0x7F) -#define BMI2_GYR_USR_GAIN_Z_MASK UINT8_C(0x7F) +#define BMI2_GYR_USR_GAIN_X_MASK UINT8_C(0x7F) +#define BMI2_GYR_USR_GAIN_Y_MASK UINT8_C(0x7F) +#define BMI2_GYR_USR_GAIN_Z_MASK UINT8_C(0x7F) /*! @name Bit positions of gyroscope offset compensation registers */ -#define BMI2_GYR_GAIN_EN_POS UINT8_C(0x07) +#define BMI2_GYR_GAIN_EN_POS UINT8_C(0x07) /******************************************************************************/ /*! @name Macro Definitions for internal status */ /******************************************************************************/ -#define BMI2_NOT_INIT UINT8_C(0x00) -#define BMI2_INIT_OK UINT8_C(0x01) -#define BMI2_INIT_ERR UINT8_C(0x02) -#define BMI2_DRV_ERR UINT8_C(0x03) -#define BMI2_SNS_STOP UINT8_C(0x04) -#define BMI2_NVM_ERROR UINT8_C(0x05) -#define BMI2_START_UP_ERROR UINT8_C(0x06) -#define BMI2_COMPAT_ERROR UINT8_C(0x07) -#define BMI2_VFM_SKIPPED UINT8_C(0x10) -#define BMI2_AXES_MAP_ERROR UINT8_C(0x20) -#define BMI2_ODR_50_HZ_ERROR UINT8_C(0x40) -#define BMI2_ODR_HIGH_ERROR UINT8_C(0x80) +#define BMI2_NOT_INIT UINT8_C(0x00) +#define BMI2_INIT_OK UINT8_C(0x01) +#define BMI2_INIT_ERR UINT8_C(0x02) +#define BMI2_DRV_ERR UINT8_C(0x03) +#define BMI2_SNS_STOP UINT8_C(0x04) +#define BMI2_NVM_ERROR UINT8_C(0x05) +#define BMI2_START_UP_ERROR UINT8_C(0x06) +#define BMI2_COMPAT_ERROR UINT8_C(0x07) +#define BMI2_VFM_SKIPPED UINT8_C(0x10) +#define BMI2_AXES_MAP_ERROR UINT8_C(0x20) +#define BMI2_ODR_50_HZ_ERROR UINT8_C(0x40) +#define BMI2_ODR_HIGH_ERROR UINT8_C(0x80) /******************************************************************************/ /*! @name error status form gyro gain update status. */ /******************************************************************************/ -#define BMI2_G_TRIGGER_NO_ERROR UINT8_C(0x00) +#define BMI2_G_TRIGGER_NO_ERROR UINT8_C(0x00) -#define BMI2_G_TRIGGER_PRECON_ERROR UINT8_C(0x01) -#define BMI2_G_TRIGGER_DL_ERROR UINT8_C(0x02) -#define BMI2_G_TRIGGER_ABORT_ERROR UINT8_C(0x03) +#define BMI2_G_TRIGGER_PRECON_ERROR UINT8_C(0x01) +#define BMI2_G_TRIGGER_DL_ERROR UINT8_C(0x02) +#define BMI2_G_TRIGGER_ABORT_ERROR UINT8_C(0x03) /******************************************************************************/ /*! @name Variant specific features selection macros */ /******************************************************************************/ -#define BMI2_CRT_RTOSK_ENABLE UINT8_C(0x01) -#define BMI2_GYRO_CROSS_SENS_ENABLE UINT8_C(0x02) -#define BMI2_GYRO_USER_GAIN_ENABLE UINT8_C(0x08) -#define BMI2_NO_FEATURE_ENABLE UINT8_C(0x00) -#define BMI2_CRT_IN_FIFO_NOT_REQ UINT8_C(0x10) -#define BMI2_MAXIMUM_FIFO_VARIANT UINT8_C(0x20) +#define BMI2_CRT_RTOSK_ENABLE UINT8_C(0x01) +#define BMI2_GYRO_CROSS_SENS_ENABLE UINT8_C(0x02) +#define BMI2_GYRO_USER_GAIN_ENABLE UINT8_C(0x08) +#define BMI2_NO_FEATURE_ENABLE UINT8_C(0x00) +#define BMI2_CRT_IN_FIFO_NOT_REQ UINT8_C(0x10) +#define BMI2_MAXIMUM_FIFO_VARIANT UINT8_C(0x20) /*! Pull-up configuration for ASDA */ -#define BMI2_ASDA_PUPSEL_OFF UINT8_C(0x00) -#define BMI2_ASDA_PUPSEL_40K UINT8_C(0x01) -#define BMI2_ASDA_PUPSEL_10K UINT8_C(0x02) -#define BMI2_ASDA_PUPSEL_2K UINT8_C(0x03) +#define BMI2_ASDA_PUPSEL_OFF UINT8_C(0x00) +#define BMI2_ASDA_PUPSEL_40K UINT8_C(0x01) +#define BMI2_ASDA_PUPSEL_10K UINT8_C(0x02) +#define BMI2_ASDA_PUPSEL_2K UINT8_C(0x03) /******************************************************************************/ /*! @name CHIP ID MACROS */ /******************************************************************************/ /*! @name BMI260 chip identifier */ -#define BMI260_CHIP_IDENTIFIER UINT8_C(0x27) +#define BMI260_CHIP_IDENTIFIER UINT8_C(0x27) /*! @name BMI261 chip identifier */ -#define BMI261_CHIP_IDENTIFIER UINT8_C(0x21) +#define BMI261_CHIP_IDENTIFIER UINT8_C(0x21) /******************************************************************************/ /*! @name Function Pointers */ @@ -1104,13 +1444,13 @@ struct bmi2_axes_remap uint8_t z_axis; /*! Re-mapped x-axis sign */ - int16_t x_axis_sign; + uint8_t x_axis_sign; /*! Re-mapped y-axis sign */ - int16_t y_axis_sign; + uint8_t y_axis_sign; /*! Re-mapped z-axis sign */ - int16_t z_axis_sign; + uint8_t z_axis_sign; }; /*! @name Structure to define the type of sensor and its interrupt pin */ diff --git a/bmi2_ois.c b/bmi2_ois.c index 5ad4963..dd318c0 100644 --- a/bmi2_ois.c +++ b/bmi2_ois.c @@ -32,7 +32,7 @@ * * @file bmi2_ois.c * @date 2020-05-05 - * @version v2.53.0 + * @version v2.53.2 * */ diff --git a/bmi2_ois.h b/bmi2_ois.h index 225b369..443d4dc 100644 --- a/bmi2_ois.h +++ b/bmi2_ois.h @@ -32,7 +32,7 @@ * * @file bmi2_ois.h * @date 2020-05-05 - * @version v2.53.0 + * @version v2.53.2 * */ @@ -66,7 +66,7 @@ extern "C" { /******************************************************************************/ #ifndef BMI2_INTF_RETURN_TYPE -#define BMI2_INTF_RETURN_TYPE int8_t +#define BMI2_INTF_RETURN_TYPE int8_t #endif /*! @name Utility macros */ @@ -82,52 +82,56 @@ extern "C" { ((reg_data & ~(bitname##_MASK)) | \ (data & bitname##_MASK)) -#define BMI2_GET_BIT_POS0(reg_data, bitname) (reg_data & (bitname##_MASK)) +#define BMI2_GET_BIT_POS0(reg_data, bitname) (reg_data & (bitname##_MASK)) + +/*! @name For enable and disable */ +#define BMI2_OIS_ENABLE UINT8_C(1) +#define BMI2_OIS_DISABLE UINT8_C(0) /*! @name To define sensor interface success code */ -#define BMI2_INTF_RET_SUCCESS INT8_C(0) +#define BMI2_INTF_RET_SUCCESS INT8_C(0) /*! @name To define success code */ -#define BMI2_OIS_OK UINT8_C(0) +#define BMI2_OIS_OK UINT8_C(0) /*! @name To define error codes */ -#define BMI2_OIS_E_NULL_PTR INT8_C(-1) -#define BMI2_OIS_E_COM_FAIL INT8_C(-2) -#define BMI2_OIS_E_INVALID_SENSOR INT8_C(-8) +#define BMI2_OIS_E_NULL_PTR INT8_C(-1) +#define BMI2_OIS_E_COM_FAIL INT8_C(-2) +#define BMI2_OIS_E_INVALID_SENSOR INT8_C(-8) /*! @name Mask definitions for SPI read/write address for OIS */ -#define BMI2_OIS_SPI_RD_MASK UINT8_C(0x80) -#define BMI2_OIS_SPI_WR_MASK UINT8_C(0x7F) +#define BMI2_OIS_SPI_RD_MASK UINT8_C(0x80) +#define BMI2_OIS_SPI_WR_MASK UINT8_C(0x7F) /*! @name BMI2 OIS data bytes */ -#define BMI2_OIS_ACC_GYR_NUM_BYTES UINT8_C(6) +#define BMI2_OIS_ACC_GYR_NUM_BYTES UINT8_C(6) /*! @name Macros to select sensor for OIS data read */ -#define BMI2_OIS_ACCEL UINT8_C(0x01) -#define BMI2_OIS_GYRO UINT8_C(0x02) +#define BMI2_OIS_ACCEL UINT8_C(0x01) +#define BMI2_OIS_GYRO UINT8_C(0x02) /*! @name Macros to define OIS register addresses */ -#define BMI2_OIS_CONFIG_ADDR UINT8_C(0x40) -#define BMI2_OIS_ACC_X_LSB_ADDR UINT8_C(0x0C) -#define BMI2_OIS_GYR_X_LSB_ADDR UINT8_C(0x12) +#define BMI2_OIS_CONFIG_ADDR UINT8_C(0x40) +#define BMI2_OIS_ACC_X_LSB_ADDR UINT8_C(0x0C) +#define BMI2_OIS_GYR_X_LSB_ADDR UINT8_C(0x12) /*! @name Mask definitions for OIS configurations */ -#define BMI2_OIS_GYR_EN_MASK UINT8_C(0x40) -#define BMI2_OIS_ACC_EN_MASK UINT8_C(0x80) +#define BMI2_OIS_GYR_EN_MASK UINT8_C(0x40) +#define BMI2_OIS_ACC_EN_MASK UINT8_C(0x80) /*! @name Bit Positions for OIS configurations */ -#define BMI2_OIS_GYR_EN_POS UINT8_C(0x06) -#define BMI2_OIS_ACC_EN_POS UINT8_C(0x07) +#define BMI2_OIS_GYR_EN_POS UINT8_C(0x06) +#define BMI2_OIS_ACC_EN_POS UINT8_C(0x07) /*! Low pass filter configuration position and mask */ -#define BMI2_OIS_LP_FILTER_EN_POS UINT8_C(0x00) -#define BMI2_OIS_LP_FILTER_EN_MASK UINT8_C(0x01) +#define BMI2_OIS_LP_FILTER_EN_POS UINT8_C(0x00) +#define BMI2_OIS_LP_FILTER_EN_MASK UINT8_C(0x01) -#define BMI2_OIS_LP_FILTER_CONFIG_POS UINT8_C(0x01) -#define BMI2_OIS_LP_FILTER_CONFIG_MASK UINT8_C(0x06) +#define BMI2_OIS_LP_FILTER_CONFIG_POS UINT8_C(0x01) +#define BMI2_OIS_LP_FILTER_CONFIG_MASK UINT8_C(0x06) -#define BMI2_OIS_LP_FILTER_MUTE_POS UINT8_C(0x05) -#define BMI2_OIS_LP_FILTER_MUTE_MASK UINT8_C(0x20) +#define BMI2_OIS_LP_FILTER_MUTE_POS UINT8_C(0x05) +#define BMI2_OIS_LP_FILTER_MUTE_MASK UINT8_C(0x20) /******************************************************************************/ /*! @name Function Pointers */ diff --git a/examples/bmi270/generic/accel.c b/examples/bmi270/generic/accel.c index 6e02c32..c8f1289 100644 --- a/examples/bmi270/generic/accel.c +++ b/examples/bmi270/generic/accel.c @@ -15,7 +15,7 @@ /*! Macro definition */ /*! Earth's gravity in m/s^2 */ -#define GRAVITY_EARTH (9.80665f) +#define GRAVITY_EARTH (9.80665f) /******************************************************************************/ /*! Static Function Declaration */ diff --git a/examples/bmi270/generic/fifo_full_header_mode.c b/examples/bmi270/generic/fifo_full_header_mode.c index 0a6eedf..d31b393 100644 --- a/examples/bmi270/generic/fifo_full_header_mode.c +++ b/examples/bmi270/generic/fifo_full_header_mode.c @@ -15,23 +15,23 @@ /*! Macros */ /*! Buffer size allocated to store raw FIFO data. */ -#define BMI270_FIFO_RAW_DATA_BUFFER_SIZE UINT16_C(2048) +#define BMI270_FIFO_RAW_DATA_BUFFER_SIZE UINT16_C(2048) /*! Length of data to be read from FIFO. */ -#define BMI270_FIFO_RAW_DATA_USER_LENGTH UINT16_C(2048) +#define BMI270_FIFO_RAW_DATA_USER_LENGTH UINT16_C(2048) /*! Number of accel frames to be extracted from FIFO. */ /*! Calculation for frame count: Total frame count = Fifo buffer size(2048)/ Total frames(6 Accel, 6 Gyro and 1 header, * totaling to 13) which equals to 157. */ -#define BMI270_FIFO_ACCEL_FRAME_COUNT UINT8_C(157) +#define BMI270_FIFO_ACCEL_FRAME_COUNT UINT8_C(157) /*! Number of gyro frames to be extracted from FIFO. */ -#define BMI270_FIFO_GYRO_FRAME_COUNT UINT8_C(157) +#define BMI270_FIFO_GYRO_FRAME_COUNT UINT8_C(157) /*! Macro to read sensortime byte in FIFO. */ -#define SENSORTIME_OVERHEAD_BYTE UINT8_C(3) +#define SENSORTIME_OVERHEAD_BYTE UINT8_C(3) /******************************************************************************/ /*! Static Function Declaration */ diff --git a/examples/bmi270/generic/fifo_full_headerless_mode.c b/examples/bmi270/generic/fifo_full_headerless_mode.c index ce0991c..2eb209a 100644 --- a/examples/bmi270/generic/fifo_full_headerless_mode.c +++ b/examples/bmi270/generic/fifo_full_headerless_mode.c @@ -15,20 +15,20 @@ /*! Macros */ /*! Buffer size allocated to store raw FIFO data */ -#define BMI270_FIFO_RAW_DATA_BUFFER_SIZE UINT16_C(2048) +#define BMI270_FIFO_RAW_DATA_BUFFER_SIZE UINT16_C(2048) /*! Length of data to be read from FIFO */ -#define BMI270_FIFO_RAW_DATA_USER_LENGTH UINT16_C(2048) +#define BMI270_FIFO_RAW_DATA_USER_LENGTH UINT16_C(2048) /*! Number of accel frames to be extracted from FIFO */ /*! Calculation for frame count: Total frame count = Fifo buffer size(2048)/ Total frames(6 Accel, 6 Gyro totaling to * 12) which equals to 170. */ -#define BMI270_FIFO_ACCEL_FRAME_COUNT UINT8_C(167) +#define BMI270_FIFO_ACCEL_FRAME_COUNT UINT8_C(167) /*! Number of gyro frames to be extracted from FIFO */ -#define BMI270_FIFO_GYRO_FRAME_COUNT UINT8_C(167) +#define BMI270_FIFO_GYRO_FRAME_COUNT UINT8_C(167) /******************************************************************************/ /*! Static Function Declaration */ diff --git a/examples/bmi270/generic/fifo_watermark_header_mode.c b/examples/bmi270/generic/fifo_watermark_header_mode.c index 3a8691c..a5d7668 100644 --- a/examples/bmi270/generic/fifo_watermark_header_mode.c +++ b/examples/bmi270/generic/fifo_watermark_header_mode.c @@ -15,10 +15,10 @@ /*! Macros */ /*! Buffer size allocated to store raw FIFO data */ -#define BMI270_FIFO_RAW_DATA_BUFFER_SIZE UINT16_C(2048) +#define BMI270_FIFO_RAW_DATA_BUFFER_SIZE UINT16_C(2048) /*! Length of data to be read from FIFO */ -#define BMI270_FIFO_RAW_DATA_USER_LENGTH UINT16_C(2048) +#define BMI270_FIFO_RAW_DATA_USER_LENGTH UINT16_C(2048) /*! Number of accel frames to be extracted from FIFO */ @@ -28,16 +28,16 @@ * fifo_accel_frame_count = (650 / (6 + 6 + 1 )) = 50 frames * NOTE: Extra frames are read in order to get sensor time */ -#define BMI270_FIFO_ACCEL_FRAME_COUNT UINT8_C(55) +#define BMI270_FIFO_ACCEL_FRAME_COUNT UINT8_C(55) /*! Number of gyro frames to be extracted from FIFO */ -#define BMI270_FIFO_GYRO_FRAME_COUNT UINT8_C(55) +#define BMI270_FIFO_GYRO_FRAME_COUNT UINT8_C(55) /*! Setting a watermark level in FIFO */ -#define BMI270_FIFO_WATERMARK_LEVEL UINT16_C(650) +#define BMI270_FIFO_WATERMARK_LEVEL UINT16_C(650) /*! Macro to read sensortime byte in FIFO */ -#define SENSORTIME_OVERHEAD_BYTE UINT8_C(3) +#define SENSORTIME_OVERHEAD_BYTE UINT8_C(3) /******************************************************************************/ /*! Static Function Declaration */ diff --git a/examples/bmi270/generic/fifo_watermark_headerless_mode.c b/examples/bmi270/generic/fifo_watermark_headerless_mode.c index f3295b1..b29ac49 100644 --- a/examples/bmi270/generic/fifo_watermark_headerless_mode.c +++ b/examples/bmi270/generic/fifo_watermark_headerless_mode.c @@ -15,10 +15,10 @@ /*! Macros */ /*! Buffer size allocated to store raw FIFO data */ -#define BMI270_FIFO_RAW_DATA_BUFFER_SIZE UINT16_C(2048) +#define BMI270_FIFO_RAW_DATA_BUFFER_SIZE UINT16_C(2048) /*! Length of data to be read from FIFO */ -#define BMI270_FIFO_RAW_DATA_USER_LENGTH UINT16_C(2048) +#define BMI270_FIFO_RAW_DATA_USER_LENGTH UINT16_C(2048) /*! Number of accel frames to be extracted from FIFO */ @@ -27,13 +27,13 @@ * fifo_watermark_level = 650, accel_frame_len = 6, gyro_frame_len = 6. * fifo_accel_frame_count = (650 / (6 + 6 )) = 50 frames */ -#define BMI270_FIFO_ACCEL_FRAME_COUNT UINT8_C(50) +#define BMI270_FIFO_ACCEL_FRAME_COUNT UINT8_C(50) /*! Number of gyro frames to be extracted from FIFO */ -#define BMI270_FIFO_GYRO_FRAME_COUNT UINT8_C(50) +#define BMI270_FIFO_GYRO_FRAME_COUNT UINT8_C(50) /*! Setting a watermark level in FIFO */ -#define BMI270_FIFO_WATERMARK_LEVEL UINT16_C(650) +#define BMI270_FIFO_WATERMARK_LEVEL UINT16_C(650) /******************************************************************************/ /*! Static Function Declaration */ diff --git a/examples/ois/generic/ois_accel_gyro.c b/examples/ois/generic/ois_accel_gyro.c index ad592f8..ef05b60 100644 --- a/examples/ois/generic/ois_accel_gyro.c +++ b/examples/ois/generic/ois_accel_gyro.c @@ -13,7 +13,7 @@ /*! Macro definition */ /*! Macro that holds the total number of accel x,y and z axes sample counts to be printed */ -#define ACCEL_GYRO_SAMPLE_COUNT UINT8_C(50) +#define ACCEL_GYRO_SAMPLE_COUNT UINT8_C(50) /******************************************************************************/ /*! Functions */