diff options
Diffstat (limited to 'include/accelerometer.h')
-rw-r--r-- | include/accelerometer.h | 50 |
1 files changed, 47 insertions, 3 deletions
diff --git a/include/accelerometer.h b/include/accelerometer.h index a69c227401..0c8703f3ae 100644 --- a/include/accelerometer.h +++ b/include/accelerometer.h @@ -29,15 +29,59 @@ enum accel_id; * * @return EC_SUCCESS if successful, non-zero if error. */ -int accel_read(enum accel_id id, int *x_acc, int *y_acc, int *z_acc); +int accel_read(const enum accel_id id, int * const x_acc, int * const y_acc, + int * const z_acc); /** - * Initiailze accelerometers. + * Initialize accelerometers. * * @param id Target accelerometer * * @return EC_SUCCESS if successful, non-zero if error. */ -int accel_init(enum accel_id id); +int accel_init(const enum accel_id id); + +/** + * Setter and getter methods for the sensor range. The sensor range defines + * the maximum value that can be returned from accel_read(). As the range + * increases, the resolution gets worse. + * + * @param id Target accelerometer + * @param range Range (Units are +/- G's for accel, +/- deg/s for gyro) + * @param rnd Rounding flag. If true, it rounds up to nearest valid value. + * Otherwise, it rounds down. + * + * @return EC_SUCCESS if successful, non-zero if error. + */ +int accel_set_range(const enum accel_id id, const int range, const int rnd); +int accel_get_range(const enum accel_id id, int * const range); + + +/** + * Setter and getter methods for the sensor resolution. + * + * @param id Target accelerometer + * @param range Resolution (Units are number of bits) + * param rnd Rounding flag. If true, it rounds up to nearest valid value. + * Otherwise, it rounds down. + * + * @return EC_SUCCESS if successful, non-zero if error. + */ +int accel_set_resolution(const enum accel_id id, const int res, const int rnd); +int accel_get_resolution(const enum accel_id id, int * const res); + +/** + * Setter and getter methods for the sensor output data range. As the ODR + * increases, the LPF roll-off frequency also increases. + * + * @param id Target accelerometer + * @param rate Output data rate (units are mHz) + * @param rnd Rounding flag. If true, it rounds up to nearest valid value. + * Otherwise, it rounds down. + * + * @return EC_SUCCESS if successful, non-zero if error. + */ +int accel_set_datarate(const enum accel_id id, const int rate, const int rnd); +int accel_get_datarate(const enum accel_id id, int * const rate); #endif /* __CROS_EC_ACCELEROMETER_H */ |