/* Set the threshold for activity detection for a single axis  */
static int adxl372_set_activity_threshold(const struct device *dev, uint8_t axis_reg_h, const struct adxl372_activity_threshold *act)
/* Set the threshold for activity detection for a single axis  */
static int adxl372_set_activity_threshold(const struct device *dev, uint8_t axis_reg_h, const struct adxl372_activity_threshold *act)
{
	int ret;
	uint8_t val;
	struct adxl372_data *data = dev->data;
	ret = data->hw_tf->write_reg(dev, axis_reg_h++, act->thresh >> 3);
	if (ret) {
		return ret;
	}
	switch (axis_reg_h) {
	case ADXL372_X_THRESH_ACT_L:
	case ADXL372_X_THRESH_INACT_L:
	case ADXL372_X_THRESH_ACT2_L:
		val = (act->thresh << 5) | (act->referenced << 1) | act->enable;
		break;
	default:
		val = (act->thresh << 5) | act->enable;
	}
	return data->hw_tf->write_reg(dev, axis_reg_h, val);
}