/* CLI command to set the sampling rate of the device.  */
int32_t ad7124_8pmdz_odr_set(struct ad7124_8pmdz_dev *dev, uint8_t *arg)
/* CLI command to set the sampling rate of the device.  */
int32_t ad7124_8pmdz_odr_set(struct ad7124_8pmdz_dev *dev, uint8_t *arg)
{
	int32_t ret;
	float odr;
	uint8_t *err_ptr;
	if (!arg || *arg == 0) {
		cli_write_string(dev->cli_handler,
				 (uint8_t *)"ERROR: Incorrect parameters.\n\r");
		return FAILURE;
	}
	odr = strtod((char *)arg, (char **)&err_ptr);
	if (err_ptr == arg) {
		cli_write_string(dev->cli_handler,
				 (uint8_t *)"ERROR: Incorrect parameters.\n\r");
		return FAILURE;
	}
	ret = ad7124_8pmdz_odr_logic_set(dev, odr);
	if (ret != SUCCESS) {
		cli_write_string(dev->cli_handler,
				 (uint8_t *)"ERROR: Can't set ODR.");
		return FAILURE;
	}
	return ad7124_8pmdz_odr_get(dev, NULL);
}