bma456.c
/*!
 *	@brief This API gets the water mark level set for step counter interrupt
 *	in the sensor
 */
@brief This API gets the water mark level set for step counter interrupt
in the sensor
@brief This API gets the water mark level set for step counter interrupt in the sensor
uint16_t bma456_step_counter_get_watermark(uint16_t *step_counter_wm, struct bma4_dev *dev)
{
	uint8_t feature_config[BMA456_FEATURE_SIZE] = {0};
	uint8_t index = BMA456_STEP_CNTR_OFFSET;
	uint16_t wm_lsb = 0;
	uint16_t wm_msb = 0;
	uint16_t rslt = BMA4_OK;
	uint16_t data = 0;
	if (dev != NULL) {
		if (dev->chip_id == BMA456_CHIP_ID) {
			rslt = bma4_read_regs(BMA4_FEATURE_CONFIG_ADDR, feature_config,
				BMA456_FEATURE_SIZE, dev);
			if (rslt == BMA4_OK) {
				wm_lsb = feature_config[index];
				wm_msb = feature_config[index + 1] << 8;
				data = wm_lsb | wm_msb;
				*step_counter_wm = BMA4_GET_BITS_POS_0(data, BMA456_STEP_CNTR_WM);
			}
		} else {
			rslt = BMA4_E_INVALID_SENSOR;
		}
	} else {
		rslt = BMA4_E_NULL_PTR;
	}
	return rslt;
}
uint16_t bma456_step_counter_get_watermark ( uint16_t * step_counter_wm , struct bma4_dev * dev ) { uint8_t feature_config [ BMA456_FEATURE_SIZE ] = { 0 } ; uint8_t index = BMA456_STEP_CNTR_OFFSET ; uint16_t wm_lsb = 0 ; uint16_t wm_msb = 0 ; uint16_t rslt = BMA4_OK ; uint16_t data = 0 ; if ( dev != NULL ) { if ( dev -> chip_id == BMA456_CHIP_ID ) { rslt = bma4_read_regs ( BMA4_FEATURE_CONFIG_ADDR , feature_config , BMA456_FEATURE_SIZE , dev ) ; if ( rslt == BMA4_OK ) { wm_lsb = feature_config [ index ] ; wm_msb = feature_config [ index + 1 ] << 8 ; data = wm_lsb | wm_msb ; * step_counter_wm = BMA4_GET_BITS_POS_0 ( data , BMA456_STEP_CNTR_WM ) ; } } else { rslt = BMA4_E_INVALID_SENSOR ; } } else { rslt = BMA4_E_NULL_PTR ; } return rslt ; }
@brief This API gets the water mark level set for step counter interrupt
      in the sensor
@brief This API gets the water mark level set for step counter interrupt in the sensor