Skip to content

Commit

Permalink
drivers: sensors: bmi270: Add CRT support to sensor_attr_set
Browse files Browse the repository at this point in the history
Fixes: #62514
This change allows the bmi270 CRT feature methods
to be called through Zephyr's sensor api.
Using the sensor_attr_set function, with the following args:
-SENSOR_ATTR_CALIBRATION-run the crt.
-BMI270_SENSOR_ATTR_NVM_PROG-save the CRT results in nvm.
-BMI270_SENSOR_ATTR_GAIN_COMP-enable/disable gain compensation.

Signed-off-by: Pedro Machado <[email protected]>
  • Loading branch information
peter-axe committed Sep 24, 2023
1 parent 3a27e4b commit 36915e6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions drivers/sensor/bmi270/bmi270.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,19 @@ static int bmi270_attr_set(const struct device *dev, enum sensor_channel chan,
case SENSOR_ATTR_FULL_SCALE:
ret = set_gyro_range(dev, val);
break;
#ifdef CONFIG_BMI270_CRT
case SENSOR_ATTR_CALIBRATION:
ARG_UNUSED(val);
ret = bmi270_gyro_crt(dev);
break;
case BMI270_SENSOR_ATTR_NVM_PROG:
ARG_UNUSED(val);
ret = bmi270_nvm_prog(dev);
break;
case BMI270_SENSOR_ATTR_GAIN_COMP:
ret = bmi270_set_gyro_gain(dev, val);
break;
#endif /* CONFIG_BMI270_CRT */
default:
ret = -ENOTSUP;
}
Expand Down

0 comments on commit 36915e6

Please sign in to comment.