/* lis2dw12_set_odr - set new sampling frequency @dev: Pointer to instance of struct device (I2C or SPI) @odr: Output data rate  */
static int lis2dw12_set_odr(const struct device *dev, uint16_t odr)
/* lis2dw12_set_odr - set new sampling frequency @dev: Pointer to instance of struct device (I2C or SPI) @odr: Output data rate  */
static int lis2dw12_set_odr(const struct device *dev, uint16_t odr)
{
	const struct lis2dw12_device_config *cfg = dev->config;
	stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx;
	struct lis2dw12_data *lis2dw12 = dev->data;
	uint8_t val;
	if (odr == 0U) {
		return lis2dw12_data_rate_set(ctx, LIS2DW12_XL_ODR_OFF);
	}
	val =  LIS2DW12_ODR_TO_REG(odr);
	if (val > LIS2DW12_XL_ODR_1k6Hz) {
		LOG_ERR("ODR too high");
		return -ENOTSUP;
	}
	lis2dw12->odr = odr;
	return lis2dw12_data_rate_set(ctx, val);
}