diff options
Diffstat (limited to 'driver/stm_mems_common.h')
-rw-r--r-- | driver/stm_mems_common.h | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/driver/stm_mems_common.h b/driver/stm_mems_common.h index 848c3d4825..b708812d63 100644 --- a/driver/stm_mems_common.h +++ b/driver/stm_mems_common.h @@ -14,14 +14,13 @@ #include "console.h" #include "i2c.h" -/* Common debug funcions */ -#define CPRINTF(format, args...) cprintf(CC_ACCEL, format "\n", ## args) - /* X, Y, Z axis data len */ #define OUT_XYZ_SIZE 6 +#define ST_NORMALIZE_RATE(_fS) (1 << __fls(_fs)) + #ifdef CONFIG_ACCEL_FIFO -#define FIFO_BUFFER_NUM_PATTERN 16 +#define FIFO_BUFFER_NUM_PATTERN 32 /* Define number of data to be read from FIFO each time * It must be a multiple of OUT_XYZ_SIZE. * In case of LSM6DSM FIFO contains pattern depending ODR @@ -45,13 +44,19 @@ extern inline int raw_write8(const int port, const int addr, const int reg, int data); /** - * Read n bytes for read + * st_raw_read_n - Read n bytes for read */ int st_raw_read_n(const int port, const int addr, const uint8_t reg, uint8_t *data_ptr, const int len); +/** + * st_raw_read_n_noinc - Read n bytes for read (no auto inc address) + */ +int st_raw_read_n_noinc(const int port, const int addr, const uint8_t reg, + uint8_t *data_ptr, const int len); + /** - * write_data_with_mask - Write register with mask + * st_write_data_with_mask - Write register with mask * @s: Motion sensor pointer * @reg: Device register * @mask: The mask to search @@ -61,15 +66,13 @@ int st_write_data_with_mask(const struct motion_sensor_t *s, int reg, uint8_t mask, uint8_t data); /** - * get_resolution - Get bit resolution + * st_get_resolution - Get bit resolution * @s: Motion sensor pointer - * - * TODO: must support multiple resolution */ int st_get_resolution(const struct motion_sensor_t *s); /** - * set_offset - Set data offset + * st_set_offset - Set data offset * @s: Motion sensor pointer * @offset: offset vector * @temp: Temp @@ -78,7 +81,7 @@ int st_set_offset(const struct motion_sensor_t *s, const int16_t *offset, int16_t temp); /** - * get_offset - Get data offset + * st_get_offset - Get data offset * @s: Motion sensor pointer * @offset: offset vector * @temp: Temp @@ -87,13 +90,13 @@ int st_get_offset(const struct motion_sensor_t *s, int16_t *offset, int16_t *temp); /** - * get_data_rate - Get data rate (ODR) + * st_get_data_rate - Get data rate (ODR) * @s: Motion sensor pointer */ int st_get_data_rate(const struct motion_sensor_t *s); /** - * normalize - Apply to LSB data sensitivity and rotation + * st_normalize - Apply to LSB data sensitivity and rotation * @s: Motion sensor pointer * @v: vector * @data: LSB raw data |