bma456.c
/*!
 *	@brief This API gets the number of counted steps of the step counter
 *	feature from the sensor.
 */
@brief This API gets the number of counted steps of the step counter
feature from the sensor.
@brief This API gets the number of counted steps of the step counter feature from the sensor .
uint16_t bma456_step_counter_output(uint32_t *step_count, struct bma4_dev *dev)
{
	uint8_t data[BMA456_STEP_CNTR_DATA_SIZE] = {0};
	uint16_t rslt = BMA4_OK;
	uint32_t step_count_0 = 0;
	uint32_t step_count_1 = 0;
	uint32_t step_count_2 = 0;
	uint32_t step_count_3 = 0;
	if (dev != NULL) {
		if (dev->chip_id == BMA456_CHIP_ID) {
			rslt = bma4_read_regs(BMA4_STEP_CNT_OUT_0_ADDR, data,
					BMA456_STEP_CNTR_DATA_SIZE, dev);
			if (rslt == BMA4_OK) {
				step_count_0 = (uint32_t)data[0];
				step_count_1 = (uint32_t)data[1] << 8;
				step_count_2 = (uint32_t)data[2] << 16;
				step_count_3 = (uint32_t)data[3] << 24;
				*step_count = step_count_0 | step_count_1 | step_count_2 | step_count_3;
			}
		} else {
			rslt = BMA4_E_INVALID_SENSOR;
		}
	} else {
		rslt = BMA4_E_NULL_PTR;
	}
	return rslt;
}
uint16_t bma456_step_counter_output ( uint32_t * step_count , struct bma4_dev * dev ) { uint8_t data [ BMA456_STEP_CNTR_DATA_SIZE ] = { 0 } ; uint16_t rslt = BMA4_OK ; uint32_t step_count_0 = 0 ; uint32_t step_count_1 = 0 ; uint32_t step_count_2 = 0 ; uint32_t step_count_3 = 0 ; if ( dev != NULL ) { if ( dev -> chip_id == BMA456_CHIP_ID ) { rslt = bma4_read_regs ( BMA4_STEP_CNT_OUT_0_ADDR , data , BMA456_STEP_CNTR_DATA_SIZE , dev ) ; if ( rslt == BMA4_OK ) { step_count_0 = ( uint32_t ) data [ 0 ] ; step_count_1 = ( uint32_t ) data [ 1 ] << 8 ; step_count_2 = ( uint32_t ) data [ 2 ] << 16 ; step_count_3 = ( uint32_t ) data [ 3 ] << 24 ; * step_count = step_count_0 | step_count_1 | step_count_2 | step_count_3 ; } } else { rslt = BMA4_E_INVALID_SENSOR ; } } else { rslt = BMA4_E_NULL_PTR ; } return rslt ; }
@brief This API gets the number of counted steps of the step counter
      feature from the sensor.
@brief This API gets the number of counted steps of the step counter feature from the sensor .
/* Reads the step counter output data from the
			gpio register */