bma456.c
/*!
 *	@brief This API enables the any motion feature according to the axis
 *	set by the user in the sensor.
 */
@brief This API enables the any motion feature according to the axis
set by the user in the sensor.
@brief This API enables the any motion feature according to the axis set by the user in the sensor .
uint16_t bma456_anymotion_enable_axis(uint8_t axis, struct bma4_dev *dev)
{
	uint8_t feature_config[BMA456_ANYMOTION_EN_LEN + 2] = {0};
	uint8_t index = 3;
	uint16_t rslt = BMA4_OK;
	if (dev != NULL) {
		if (dev->chip_id == BMA456_CHIP_ID) {
			rslt = bma4_read_regs(BMA4_FEATURE_CONFIG_ADDR, feature_config,
						BMA456_ANYMOTION_EN_LEN + 2, dev);
			if (rslt == BMA4_OK) {
				feature_config[index] = BMA4_SET_BITSLICE(feature_config[index],
									BMA456_ANY_NO_MOTION_AXIS_EN, axis);
				rslt |= bma4_write_regs(BMA4_FEATURE_CONFIG_ADDR, feature_config,
							BMA456_ANYMOTION_EN_LEN + 2, dev);
			}
		} else {
			rslt = BMA4_E_INVALID_SENSOR;
		}
	} else {
		rslt = BMA4_E_NULL_PTR;
	}
	return rslt;
}
uint16_t bma456_anymotion_enable_axis ( uint8_t axis , struct bma4_dev * dev ) { uint8_t feature_config [ BMA456_ANYMOTION_EN_LEN + 2 ] = { 0 } ; uint8_t index = 3 ; uint16_t rslt = BMA4_OK ; if ( dev != NULL ) { if ( dev -> chip_id == BMA456_CHIP_ID ) { rslt = bma4_read_regs ( BMA4_FEATURE_CONFIG_ADDR , feature_config , BMA456_ANYMOTION_EN_LEN + 2 , dev ) ; if ( rslt == BMA4_OK ) { feature_config [ index ] = BMA4_SET_BITSLICE ( feature_config [ index ] , BMA456_ANY_NO_MOTION_AXIS_EN , axis ) ; rslt |= bma4_write_regs ( BMA4_FEATURE_CONFIG_ADDR , feature_config , BMA456_ANYMOTION_EN_LEN + 2 , dev ) ; } } else { rslt = BMA4_E_INVALID_SENSOR ; } } else { rslt = BMA4_E_NULL_PTR ; } return rslt ; }
@brief This API enables the any motion feature according to the axis
      set by the user in the sensor.
@brief This API enables the any motion feature according to the axis set by the user in the sensor .
/* Anymotion axis enable bit pos. is 3 byte ahead of the
	  anymotion base address(0x00) */