diff options
Diffstat (limited to 'include/accelgyro.h')
-rw-r--r-- | include/accelgyro.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/include/accelgyro.h b/include/accelgyro.h index c85922f3ef..5d755b7eaa 100644 --- a/include/accelgyro.h +++ b/include/accelgyro.h @@ -22,11 +22,10 @@ struct accelgyro_drv { /** * Initialize accelerometers. - * @s Pointer to sensor data pointer. Sensor data will be - * allocated on success. + * @s Pointer to sensor data pointer. * @return EC_SUCCESS if successful, non-zero if error. */ - int (*init)(const struct motion_sensor_t *s); + int (*init)(struct motion_sensor_t *s); /** * Read all three accelerations of an accelerometer. Note that all @@ -48,19 +47,22 @@ struct accelgyro_drv { int (*read_temp)(const struct motion_sensor_t *s, int *temp); /** - * Setter and getter methods for the sensor range. The sensor range + * Setter method for the sensor range. The sensor range * defines the maximum value that can be returned from read(). As the * range increases, the resolution gets worse. * @s Pointer to sensor data. * @range Range (Units are +/- G's for accel, +/- deg/s for gyro) * @rnd Rounding flag. If true, it rounds up to nearest valid * value. Otherwise, it rounds down. + * + * sensor->current_range is updated. + * It will be preserved unless EC reboots or AP is shutdown (S5). + * * @return EC_SUCCESS if successful, non-zero if error. */ - int (*set_range)(const struct motion_sensor_t *s, + int (*set_range)(struct motion_sensor_t *s, int range, int rnd); - int (*get_range)(const struct motion_sensor_t *s); /** * Setter and getter methods for the sensor resolution. @@ -121,7 +123,7 @@ struct accelgyro_drv { * Either a one shot mode (enable is not used), * or enter/exit a calibration state. */ - int (*perform_calib)(const struct motion_sensor_t *s, + int (*perform_calib)(struct motion_sensor_t *s, int enable); /** * handler for interrupts triggered by the sensor: it runs in task and @@ -181,7 +183,6 @@ enum rgb_index { /* Used to save sensor information */ struct accelgyro_saved_data_t { int odr; - int range; uint16_t scale[3]; }; |