| ICM-4268x-V Driver API 1.0.1 ICM-4268x-V Driver API

Icm426xxDriver_HL.h
Go to the documentation of this file.
1 /*
2 * ________________________________________________________________________________________________________
3 * Copyright (c) 2017 InvenSense Inc. All rights reserved.
4 *
5 * This software, related documentation and any modifications thereto (collectively “Software”) is subject
6 * to InvenSense and its licensors' intellectual property rights under U.S. and international copyright
7 * and other intellectual property rights laws.
8 *
9 * InvenSense and its licensors retain all intellectual property and proprietary rights in and to the Software
10 * and any use, reproduction, disclosure or distribution of the Software without an express license agreement
11 * from InvenSense is strictly prohibited.
12 *
13 * EXCEPT AS OTHERWISE PROVIDED IN A LICENSE AGREEMENT BETWEEN THE PARTIES, THE SOFTWARE IS
14 * PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
15 * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
16 * EXCEPT AS OTHERWISE PROVIDED IN A LICENSE AGREEMENT BETWEEN THE PARTIES, IN NO EVENT SHALL
17 * INVENSENSE BE LIABLE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
18 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
19 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20 * OF THE SOFTWARE.
21 * ________________________________________________________________________________________________________
22 */
23
34 #ifndef _INV_ICM426xx_DRIVER_HL_H_
35 #define _INV_ICM426xx_DRIVER_HL_H_
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 #include "Invn/Drivers/Icm426xx/Icm426xxDefs.h"
42 #include "Invn/Drivers/Icm426xx/Icm426xxTransport.h"
43
44 #include "Invn/InvError.h"
45
46 #include <stdint.h>
47 #include <string.h>
48
57 #ifndef INV_ICM426XX_LIGHTWEIGHT_DRIVER
58 #define INV_ICM426XX_LIGHTWEIGHT_DRIVER 0
59 #endif
60
64 #if (defined(ICM42600) || defined(ICM42622) || defined(ICM42633) || defined(ICM42686P) || defined(ICM42688P) || defined(ICM42688V) || defined(ICM42686V))
65 /*
66 * For parts with maximum ODR of 32 KHz,
67 * PLL is running at 19.2 MHz instead of the nominal 20.48 MHz
68 * Time resolution has to be scaled by 20.48/19.2=1.06666667
69 * To prevent floating point usage, one can use 32/30
70 *
71 * The decimator also need to know the maximum ODR.
72 */
73 #define PLL_SCALE_FACTOR_Q24 ((32UL<<24)/30)
74 #define ICM_PART_DEFAULT_OIS_MODE ICM426XX_SENSOR_CONFIG2_OIS_MODE_32KHZ
75 #else
76 #define PLL_SCALE_FACTOR_Q24 (1UL<<24)
77 #define ICM_PART_DEFAULT_OIS_MODE ICM426XX_SENSOR_CONFIG2_OIS_MODE_8KHZ
78 #endif
79
83 #if defined(ICM42686P) || defined(ICM42686V)
84 #define ACCEL_CONFIG0_FS_SEL_MAX ICM426XX_ACCEL_CONFIG0_FS_SEL_32g
85 #define GYRO_CONFIG0_FS_SEL_MAX ICM426XX_GYRO_CONFIG0_FS_SEL_4000dps
86
87 #define ACCEL_OFFUSER_MAX_MG 2000
88 #define GYRO_OFFUSER_MAX_DPS 128
89 #else
90 #define ACCEL_CONFIG0_FS_SEL_MAX ICM426XX_ACCEL_CONFIG0_FS_SEL_16g
91 #define GYRO_CONFIG0_FS_SEL_MAX ICM426XX_GYRO_CONFIG0_FS_SEL_2000dps
92
93 #define ACCEL_OFFUSER_MAX_MG 1000
94 #define GYRO_OFFUSER_MAX_DPS 64
95 #endif
96
101 #if (defined(ICM42600) || defined(ICM42622) || defined(ICM42633) || defined(ICM42686P) || defined(ICM42688P) || defined(ICM42688V) || defined(ICM42686V))
102 #define RTC_SUPPORTED 1
103 #else
104 #define RTC_SUPPORTED 0
105 #endif
106
110 #define ICM426XX_FIFO_MIRRORING_SIZE 16 * 129 // packet size * max_count = 2064
111
115 #define ICM426XX_DEFAULT_WOM_THS_MG 52>>2 /* = 52mg/4 */
116
119 #define ICM426XX_ACC_STARTUP_TIME_US 20000U
120
123 #define ICM426XX_GYR_STARTUP_TIME_US 60000U
124
127 enum inv_icm426xx_sensor {
128 INV_ICM426XX_SENSOR_ACCEL,
129 INV_ICM426XX_SENSOR_GYRO,
130 INV_ICM426XX_SENSOR_FSYNC_EVENT,
131 INV_ICM426XX_SENSOR_OIS,
132 INV_ICM426XX_SENSOR_TEMPERATURE,
134 INV_ICM426XX_SENSOR_TAP,
135 INV_ICM426XX_SENSOR_DMP_PEDOMETER_EVENT,
136 INV_ICM426XX_SENSOR_DMP_PEDOMETER_COUNT,
137 INV_ICM426XX_SENSOR_DMP_TILT,
138 #if defined(ICM_FAMILY_BPLUS)
139 INV_ICM426XX_SENSOR_DMP_R2W,
140 #elif defined(ICM_FAMILY_CPLUS)
141 INV_ICM426XX_SENSOR_DMP_FF,
142 INV_ICM426XX_SENSOR_DMP_LOWG,
143 #endif
144 INV_ICM426XX_SENSOR_MAX
145 };
146
149 typedef enum {
150 INV_ICM426XX_FIFO_DISABLED = 0,
151 INV_ICM426XX_FIFO_ENABLED = 1,
152 }INV_ICM426XX_FIFO_CONFIG_t;
153
156 typedef struct {
157 int sensor_mask;
158 uint16_t timestamp_fsync;
159 int16_t accel[3];
160 int16_t gyro[3];
161 int16_t temperature;
162 int8_t accel_high_res[3];
163 int8_t gyro_high_res[3];
164 } inv_icm426xx_sensor_event_t;
165
168 struct inv_icm426xx {
169 struct inv_icm426xx_transport transport;
172 void (*sensor_event_cb)(inv_icm426xx_sensor_event_t * event);
177 int gyro_st_bias[3];
178 int accel_st_bias[3];
179 int st_result;
181 uint8_t fifo_data[ICM426XX_FIFO_MIRRORING_SIZE];
183 uint8_t tmst_to_reg_en_cnt;
185 uint8_t dmp_is_on;
186 uint8_t dmp_from_sram;
188 uint64_t gyro_start_time_us;
189 uint64_t accel_start_time_us;
190 uint8_t endianess_data;
191 uint8_t fifo_highres_enabled;
192 INV_ICM426XX_FIFO_CONFIG_t fifo_is_used;
194 #if (!INV_ICM426XX_LIGHTWEIGHT_DRIVER)
195 /* First FSYNC event after enable is irrelevant
196 * When the sensors are switched off and then on again, an FSYNC tag with incorrect FSYNC value can be generated
197 * on the next first ODR.
198 * Solution: FSYNC tag and FSYNC data should be ignored on this first ODR.
199 */
200 uint8_t fsync_to_be_ignored;
201 #endif
202
203 /* Accel Low Power could report with wrong ODR if internal counter for ODR changed overflowed
204 * WUOSC clock domain is informed through an 3bit counter that ODR
205 * has changed in RC/PLL mode. Every 8 event, this counter overflows
206 * and goes back to 0, same as 'no ODR changes', therefore previous ALP
207 * ODR is re-used.
208 * Solution: Keep track of ODR changes when WUOSC is disabled and perform dummy ODR changes when re-enabling WU after 8*n ODR changes.
209 */
210 uint32_t wu_off_acc_odr_changes;
211
212 uint8_t wom_smd_mask;
214 uint8_t wom_enable;
216 /* Software mirror of BW and AVG settings in hardware, to be re-applied on each enabling of sensor */
217 struct {
218 uint8_t acc_lp_avg;
219 uint8_t reserved;
220 uint8_t acc_ln_bw;
221 uint8_t gyr_ln_bw;
222 } avg_bw_setting;
223
224 uint64_t gyro_power_off_tmst;
225 };
226
227 /* Interrupt enum state for INT1, INT2, and IBI */
228 typedef enum{
229 INV_ICM426XX_DISABLE = 0,
230 INV_ICM426XX_ENABLE
231 }inv_icm426xx_interrupt_value;
232
235 typedef struct {
236 inv_icm426xx_interrupt_value INV_ICM426XX_UI_FSYNC;
237 inv_icm426xx_interrupt_value INV_ICM426XX_UI_DRDY;
238 inv_icm426xx_interrupt_value INV_ICM426XX_FIFO_THS;
239 inv_icm426xx_interrupt_value INV_ICM426XX_FIFO_FULL;
240 inv_icm426xx_interrupt_value INV_ICM426XX_SMD;
241 inv_icm426xx_interrupt_value INV_ICM426XX_WOM_X;
242 inv_icm426xx_interrupt_value INV_ICM426XX_WOM_Y;
243 inv_icm426xx_interrupt_value INV_ICM426XX_WOM_Z;
244 inv_icm426xx_interrupt_value INV_ICM426XX_STEP_DET;
245 inv_icm426xx_interrupt_value INV_ICM426XX_STEP_CNT_OVFL;
246 inv_icm426xx_interrupt_value INV_ICM426XX_TILT_DET;
247 #if defined(ICM_FAMILY_BPLUS)
248 inv_icm426xx_interrupt_value INV_ICM426XX_SLEEP_DET;
249 inv_icm426xx_interrupt_value INV_ICM426XX_WAKE_DET;
250 #elif defined(ICM_FAMILY_CPLUS)
251 inv_icm426xx_interrupt_value INV_ICM426XX_FF_DET;
252 inv_icm426xx_interrupt_value INV_ICM426XX_LOWG_DET;
253 #endif
254 inv_icm426xx_interrupt_value INV_ICM426XX_TAP_DET;
255 }inv_icm426xx_interrupt_parameter_t;
256
257 #if defined(ICM_FAMILY_CPLUS)
258 /* Possible interface configurations mode */
259 typedef enum {
260 INV_ICM426XX_SINGLE_INTERFACE = 0x01,
261 INV_ICM426XX_DUAL_INTERFACE = 0x02,
262 INV_ICM426XX_DUAL_INTERFACE_SPI4 = 0x06,
263 INV_ICM426XX_TRIPLE_INTERFACE = 0x08,
264 }inv_icm426xx_interface_mode_t;
265 #endif
266
271 int inv_icm426xx_set_reg_bank(struct inv_icm426xx * s, uint8_t bank);
272
309 int inv_icm426xx_init(struct inv_icm426xx * s, struct inv_icm426xx_serif * serif, void (*sensor_event_cb)(inv_icm426xx_sensor_event_t * event));
310
314 int inv_icm426xx_device_reset(struct inv_icm426xx * s);
315
320 int inv_icm426xx_get_who_am_i(struct inv_icm426xx * s, uint8_t * who_am_i);
321
329 int inv_icm426xx_force_clock_source(struct inv_icm426xx * s, ICM426XX_INTF_CONFIG1_ACCEL_LP_CLK_t clk_src);
330
341 int inv_icm426xx_enable_accel_low_power_mode(struct inv_icm426xx * s);
342
353 int inv_icm426xx_enable_accel_low_noise_mode(struct inv_icm426xx * s);
354
364 int inv_icm426xx_disable_accel(struct inv_icm426xx * s);
365
376 int inv_icm426xx_enable_gyro_low_noise_mode(struct inv_icm426xx * s);
377
387 int inv_icm426xx_disable_gyro(struct inv_icm426xx * s);
388
398 int inv_icm426xx_enable_fsync(struct inv_icm426xx * s);
399
409 int inv_icm426xx_disable_fsync(struct inv_icm426xx * s);
410
416 int inv_icm426xx_configure_timestamp_resolution(struct inv_icm426xx * s, ICM426XX_TMST_CONFIG_RESOL_t resol);
417
422 int inv_icm426xx_set_config_ibi(struct inv_icm426xx * s, inv_icm426xx_interrupt_parameter_t * interrupt_to_configure);
423
428 int inv_icm426xx_get_config_ibi(struct inv_icm426xx * s, inv_icm426xx_interrupt_parameter_t * interrupt_to_configure);
429
434 int inv_icm426xx_set_config_int1(struct inv_icm426xx * s, inv_icm426xx_interrupt_parameter_t * interrupt_to_configure);
435
440 int inv_icm426xx_get_config_int1(struct inv_icm426xx * s, inv_icm426xx_interrupt_parameter_t * interrupt_to_configure);
441
446 int inv_icm426xx_set_config_int2(struct inv_icm426xx * s, inv_icm426xx_interrupt_parameter_t * interrupt_to_configure);
447
452 int inv_icm426xx_get_config_int2(struct inv_icm426xx * s, inv_icm426xx_interrupt_parameter_t * interrupt_to_configure);
453
458 int inv_icm426xx_get_data_from_registers(struct inv_icm426xx * s);
459
466 int inv_icm426xx_get_data_from_fifo(struct inv_icm426xx * s);
467
472 uint32_t inv_icm426xx_convert_odr_bitfield_to_us(uint32_t odr_bitfield);
473
480 int inv_icm426xx_set_accel_frequency(struct inv_icm426xx * s, const ICM426XX_ACCEL_CONFIG0_ODR_t frequency);
481
488 int inv_icm426xx_set_gyro_frequency(struct inv_icm426xx * s, const ICM426XX_GYRO_CONFIG0_ODR_t frequency);
489
496 int inv_icm426xx_set_accel_fsr(struct inv_icm426xx * s, ICM426XX_ACCEL_CONFIG0_FS_SEL_t accel_fsr_g);
497
504 int inv_icm426xx_get_accel_fsr(struct inv_icm426xx * s, ICM426XX_ACCEL_CONFIG0_FS_SEL_t * accel_fsr_g);
505
512 int inv_icm426xx_set_gyro_fsr(struct inv_icm426xx * s, ICM426XX_GYRO_CONFIG0_FS_SEL_t gyro_fsr_dps);
513
520 int inv_icm426xx_get_gyro_fsr(struct inv_icm426xx * s, ICM426XX_GYRO_CONFIG0_FS_SEL_t * gyro_fsr_dps);
521
527 int inv_icm426xx_set_accel_lp_avg(struct inv_icm426xx * s, ICM426XX_GYRO_ACCEL_CONFIG0_ACCEL_FILT_AVG_t acc_avg);
528
534 int inv_icm426xx_set_accel_ln_bw(struct inv_icm426xx * s, ICM426XX_GYRO_ACCEL_CONFIG0_ACCEL_FILT_BW_t acc_bw);
535
541 int inv_icm426xx_set_gyro_ln_bw(struct inv_icm426xx * s, ICM426XX_GYRO_ACCEL_CONFIG0_GYRO_FILT_BW_t gyr_bw);
542
546 int inv_icm426xx_reset_fifo(struct inv_icm426xx * s);
547
551 int inv_icm426xx_enable_timestamp_to_register(struct inv_icm426xx * s);
552
556 int inv_icm426xx_disable_timestamp_to_register(struct inv_icm426xx * s);
557
563 int inv_icm426xx_get_current_timestamp(struct inv_icm426xx * s, uint32_t * icm_time);
564
572 int inv_icm426xx_enable_clkin_rtc(struct inv_icm426xx * s, uint8_t enable);
573
580 int inv_icm426xx_get_clkin_rtc_status(struct inv_icm426xx * s);
581
585 int inv_icm426xx_enable_high_resolution_fifo(struct inv_icm426xx * s);
586
590 int inv_icm426xx_disable_high_resolution_fifo(struct inv_icm426xx * s);
591
598 int inv_icm426xx_configure_fifo(struct inv_icm426xx * s, INV_ICM426XX_FIFO_CONFIG_t fifo_config);
599
603 int inv_icm426xx_configure_fifo_wm(struct inv_icm426xx * s, uint16_t wm);
604
608 uint32_t inv_icm426xx_get_fifo_timestamp_resolution_us_q24(struct inv_icm426xx * s);
609
613 uint32_t inv_icm426xx_get_reg_timestamp_resolution_us_q24(struct inv_icm426xx * s);
614
615
616 #if defined(ICM_FAMILY_CPLUS)
621 int inv_icm426xx_set_fifo_dec_rate(struct inv_icm426xx * s, uint8_t dec_rate);
622
627 int inv_icm426xx_interface_change_procedure(struct inv_icm426xx * s, inv_icm426xx_interface_mode_t interface_mode);
628 #endif
629
633 const char * inv_icm426xx_get_version(void);
634
635
636
637 #ifdef __cplusplus
638 }
639 #endif
640
641 #endif /* _INV_ICM426xx_DRIVER_HL_H_ */
642
Icm426xxDefs.h
File exposing the device register map.
ICM426XX_GYRO_CONFIG0_ODR_t
ICM426XX_GYRO_CONFIG0_ODR_t
Gyroscope ODR selection.
Definition: Icm426xxDefs.h:773
ICM426XX_ACCEL_CONFIG0_FS_SEL_t
ICM426XX_ACCEL_CONFIG0_FS_SEL_t
Accelerometer FSR selection.
Definition: Icm426xxDefs.h:800
ICM426XX_GYRO_CONFIG0_FS_SEL_t
ICM426XX_GYRO_CONFIG0_FS_SEL_t
Gyroscope FSR selection.
Definition: Icm426xxDefs.h:744
ICM426XX_ACCEL_CONFIG0_ODR_t
ICM426XX_ACCEL_CONFIG0_ODR_t
Accelerometer ODR selection.
Definition: Icm426xxDefs.h:823
Icm426xxTransport.h
Low-level Icm426xx register access.
inv_icm426xx_enable_high_resolution_fifo
int inv_icm426xx_enable_high_resolution_fifo(struct inv_icm426xx *s)
Enable 20 bits raw acc and raw gyr data in fifo.
Definition: Icm426xxDriver_HL.c:1436
inv_icm426xx_enable_clkin_rtc
int inv_icm426xx_enable_clkin_rtc(struct inv_icm426xx *s, uint8_t enable)
Enable or disable CLKIN/RTC capability.
Definition: Icm426xxDriver_HL.c:1387
inv_icm426xx_device_reset
int inv_icm426xx_device_reset(struct inv_icm426xx *s)
Perform a soft reset of the device.
Definition: Icm426xxDriver_HL.c:79
inv_icm426xx_disable_gyro
int inv_icm426xx_disable_gyro(struct inv_icm426xx *s)
Disable all 3 axes of gyro.
Definition: Icm426xxDriver_HL.c:485
inv_icm426xx_get_config_int1
int inv_icm426xx_get_config_int1(struct inv_icm426xx *s, inv_icm426xx_interrupt_parameter_t *interrupt_to_configure)
Retrieve interrupts configuration.
Definition: Icm426xxDriver_HL.c:620
inv_icm426xx_set_gyro_fsr
int inv_icm426xx_set_gyro_fsr(struct inv_icm426xx *s, ICM426XX_GYRO_CONFIG0_FS_SEL_t gyro_fsr_dps)
Set gyro full scale range.
Definition: Icm426xxDriver_HL.c:1205
inv_icm426xx_disable_timestamp_to_register
int inv_icm426xx_disable_timestamp_to_register(struct inv_icm426xx *s)
Disable the 20bits-timestamp register access.
Definition: Icm426xxDriver_HL.c:1352
inv_icm426xx_get_config_int2
int inv_icm426xx_get_config_int2(struct inv_icm426xx *s, inv_icm426xx_interrupt_parameter_t *interrupt_to_configure)
Retrieve interrupts configuration.
Definition: Icm426xxDriver_HL.c:658
inv_icm426xx_set_reg_bank
int inv_icm426xx_set_reg_bank(struct inv_icm426xx *s, uint8_t bank)
Set register bank index.
Definition: Icm426xxDriver_HL.c:35
inv_icm426xx_configure_timestamp_resolution
int inv_icm426xx_configure_timestamp_resolution(struct inv_icm426xx *s, ICM426XX_TMST_CONFIG_RESOL_t resol)
Configure timestamp resolution from FIFO.
Definition: Icm426xxDriver_HL.c:577
inv_icm426xx_init
int inv_icm426xx_init(struct inv_icm426xx *s, struct inv_icm426xx_serif *serif, void(*sensor_event_cb)(inv_icm426xx_sensor_event_t *event))
Configure the serial interface used to access the device and execute hardware initialization.
Definition: Icm426xxDriver_HL.c:40
inv_icm426xx_get_reg_timestamp_resolution_us_q24
uint32_t inv_icm426xx_get_reg_timestamp_resolution_us_q24(struct inv_icm426xx *s)
Get register timestamp resolution.
Definition: Icm426xxDriver_HL.c:1637
inv_icm426xx_set_config_int1
int inv_icm426xx_set_config_int1(struct inv_icm426xx *s, inv_icm426xx_interrupt_parameter_t *interrupt_to_configure)
Configure which interrupt source can trigger INT1.
Definition: Icm426xxDriver_HL.c:740
inv_icm426xx_get_config_ibi
int inv_icm426xx_get_config_ibi(struct inv_icm426xx *s, inv_icm426xx_interrupt_parameter_t *interrupt_to_configure)
Retrieve interrupts configuration.
Definition: Icm426xxDriver_HL.c:590
inv_icm426xx_set_gyro_frequency
int inv_icm426xx_set_gyro_frequency(struct inv_icm426xx *s, const ICM426XX_GYRO_CONFIG0_ODR_t frequency)
Configure gyro Output Data Rate.
Definition: Icm426xxDriver_HL.c:1181
INV_ICM426XX_FIFO_CONFIG_t
INV_ICM426XX_FIFO_CONFIG_t
Configure Fifo usage.
Definition: Icm426xxDriver_HL.h:149
inv_icm426xx_reset_fifo
int inv_icm426xx_reset_fifo(struct inv_icm426xx *s)
reset ICM426XX fifo
Definition: Icm426xxDriver_HL.c:1298
inv_icm426xx_configure_fifo_wm
int inv_icm426xx_configure_fifo_wm(struct inv_icm426xx *s, uint16_t wm)
Configure Fifo watermark (also referred to as fifo threshold)
Definition: Icm426xxDriver_HL.c:1548
inv_icm426xx_get_fifo_timestamp_resolution_us_q24
uint32_t inv_icm426xx_get_fifo_timestamp_resolution_us_q24(struct inv_icm426xx *s)
Get FIFO timestamp resolution.
Definition: Icm426xxDriver_HL.c:1606
inv_icm426xx_set_accel_frequency
int inv_icm426xx_set_accel_frequency(struct inv_icm426xx *s, const ICM426XX_ACCEL_CONFIG0_ODR_t frequency)
Configure accel Output Data Rate.
Definition: Icm426xxDriver_HL.c:1155
inv_icm426xx_force_clock_source
int inv_icm426xx_force_clock_source(struct inv_icm426xx *s, ICM426XX_INTF_CONFIG1_ACCEL_LP_CLK_t clk_src)
Configure Accel clock source.
Definition: Icm426xxDriver_HL.c:143
inv_icm426xx_get_accel_fsr
int inv_icm426xx_get_accel_fsr(struct inv_icm426xx *s, ICM426XX_ACCEL_CONFIG0_FS_SEL_t *accel_fsr_g)
Access accel full scale range.
Definition: Icm426xxDriver_HL.c:1217
inv_icm426xx_enable_accel_low_noise_mode
int inv_icm426xx_enable_accel_low_noise_mode(struct inv_icm426xx *s)
Enable/put accel in low noise mode.
Definition: Icm426xxDriver_HL.c:267
inv_icm426xx_disable_accel
int inv_icm426xx_disable_accel(struct inv_icm426xx *s)
Disable all 3 axes of accel.
Definition: Icm426xxDriver_HL.c:345
inv_icm426xx_enable_gyro_low_noise_mode
int inv_icm426xx_enable_gyro_low_noise_mode(struct inv_icm426xx *s)
Enable/put gyro in low noise mode.
Definition: Icm426xxDriver_HL.c:391
inv_icm426xx_disable_high_resolution_fifo
int inv_icm426xx_disable_high_resolution_fifo(struct inv_icm426xx *s)
Disable 20 bits raw acc and raw gyr data in fifo.
Definition: Icm426xxDriver_HL.c:1453
inv_icm426xx_set_config_ibi
int inv_icm426xx_set_config_ibi(struct inv_icm426xx *s, inv_icm426xx_interrupt_parameter_t *interrupt_to_configure)
Configure which interrupt source can trigger ibi interruptions.
Definition: Icm426xxDriver_HL.c:696
inv_icm426xx_set_accel_lp_avg
int inv_icm426xx_set_accel_lp_avg(struct inv_icm426xx *s, ICM426XX_GYRO_ACCEL_CONFIG0_ACCEL_FILT_AVG_t acc_avg)
Set accel Low-Power averaging value.
Definition: Icm426xxDriver_HL.c:1247
inv_icm426xx_enable_accel_low_power_mode
int inv_icm426xx_enable_accel_low_power_mode(struct inv_icm426xx *s)
Enable/put accel in low power mode.
Definition: Icm426xxDriver_HL.c:158
inv_icm426xx_get_who_am_i
int inv_icm426xx_get_who_am_i(struct inv_icm426xx *s, uint8_t *who_am_i)
return WHOAMI value
Definition: Icm426xxDriver_HL.c:138
inv_icm426xx_get_current_timestamp
int inv_icm426xx_get_current_timestamp(struct inv_icm426xx *s, uint32_t *icm_time)
Get the timestamp value of icm426xx from register.
Definition: Icm426xxDriver_HL.c:1369
inv_icm426xx_set_gyro_ln_bw
int inv_icm426xx_set_gyro_ln_bw(struct inv_icm426xx *s, ICM426XX_GYRO_ACCEL_CONFIG0_GYRO_FILT_BW_t gyr_bw)
Set gyro Low-Noise bandwidth value.
Definition: Icm426xxDriver_HL.c:1281
inv_icm426xx_get_version
const char * inv_icm426xx_get_version(void)
Return driver version x.y.z-suffix as a char array.
Definition: Icm426xxDriver_HL.c:1792
inv_icm426xx_set_config_int2
int inv_icm426xx_set_config_int2(struct inv_icm426xx *s, inv_icm426xx_interrupt_parameter_t *interrupt_to_configure)
Configure which interrupt source can trigger INT2.
Definition: Icm426xxDriver_HL.c:800
inv_icm426xx_get_gyro_fsr
int inv_icm426xx_get_gyro_fsr(struct inv_icm426xx *s, ICM426XX_GYRO_CONFIG0_FS_SEL_t *gyro_fsr_dps)
Access gyro full scale range.
Definition: Icm426xxDriver_HL.c:1232
inv_icm426xx_get_data_from_registers
int inv_icm426xx_get_data_from_registers(struct inv_icm426xx *s)
Read all registers containing data (temperature, accelerometer and gyroscope).
Definition: Icm426xxDriver_HL.c:860
inv_icm426xx_disable_fsync
int inv_icm426xx_disable_fsync(struct inv_icm426xx *s)
Disable fsync tagging functionality.
Definition: Icm426xxDriver_HL.c:562
inv_icm426xx_enable_timestamp_to_register
int inv_icm426xx_enable_timestamp_to_register(struct inv_icm426xx *s)
Enable the 20bits-timestamp register access to read in a reliable way the strobed timestamp.
Definition: Icm426xxDriver_HL.c:1331
inv_icm426xx_configure_fifo
int inv_icm426xx_configure_fifo(struct inv_icm426xx *s, INV_ICM426XX_FIFO_CONFIG_t fifo_config)
Configure Fifo to select the way data are gathered.
Definition: Icm426xxDriver_HL.c:1470
inv_icm426xx_sensor
inv_icm426xx_sensor
Sensor identifier for UI control and OIS function.
Definition: Icm426xxDriver_HL.h:127
inv_icm426xx_set_accel_ln_bw
int inv_icm426xx_set_accel_ln_bw(struct inv_icm426xx *s, ICM426XX_GYRO_ACCEL_CONFIG0_ACCEL_FILT_BW_t acc_bw)
Set accel Low-Noise bandwidth value.
Definition: Icm426xxDriver_HL.c:1264
ICM426XX_FIFO_MIRRORING_SIZE
#define ICM426XX_FIFO_MIRRORING_SIZE
Icm426xx maximum buffer size mirrored from FIFO at polling time.
Definition: Icm426xxDriver_HL.h:110
inv_icm426xx_set_accel_fsr
int inv_icm426xx_set_accel_fsr(struct inv_icm426xx *s, ICM426XX_ACCEL_CONFIG0_FS_SEL_t accel_fsr_g)
Set accel full scale range.
Definition: Icm426xxDriver_HL.c:1193
inv_icm426xx_get_clkin_rtc_status
int inv_icm426xx_get_clkin_rtc_status(struct inv_icm426xx *s)
Get CLKIN/RTC feature status.
Definition: Icm426xxDriver_HL.c:1424
inv_icm426xx_enable_fsync
int inv_icm426xx_enable_fsync(struct inv_icm426xx *s)
Enable fsync tagging functionality.
Definition: Icm426xxDriver_HL.c:548
inv_icm426xx_get_data_from_fifo
int inv_icm426xx_get_data_from_fifo(struct inv_icm426xx *s)
Read all available packets from the FIFO.
Definition: Icm426xxDriver_HL.c:906
inv_icm426xx_convert_odr_bitfield_to_us
uint32_t inv_icm426xx_convert_odr_bitfield_to_us(uint32_t odr_bitfield)
Converts ICM426XX_ACCEL_CONFIG0_ODR_t or ICM426XX_GYRO_CONFIG0_ODR_t enums to period expressed in us.
Definition: Icm426xxDriver_HL.c:1113
INV_ICM426XX_FIFO_ENABLED
@ INV_ICM426XX_FIFO_ENABLED
Fifo is used as data source.
Definition: Icm426xxDriver_HL.h:151
INV_ICM426XX_FIFO_DISABLED
@ INV_ICM426XX_FIFO_DISABLED
Fifo is disabled and data source is sensors registers.
Definition: Icm426xxDriver_HL.h:150
INV_ICM426XX_SENSOR_GYRO
@ INV_ICM426XX_SENSOR_GYRO
Gyroscope (UI control path)
Definition: Icm426xxDriver_HL.h:129
INV_ICM426XX_SENSOR_TAP
@ INV_ICM426XX_SENSOR_TAP
Tap and Double tap.
Definition: Icm426xxDriver_HL.h:134
INV_ICM426XX_SENSOR_DMP_PEDOMETER_COUNT
@ INV_ICM426XX_SENSOR_DMP_PEDOMETER_COUNT
Pedometer: step counter.
Definition: Icm426xxDriver_HL.h:136
INV_ICM426XX_SENSOR_OIS
@ INV_ICM426XX_SENSOR_OIS
Only used by OIS layer.
Definition: Icm426xxDriver_HL.h:131
INV_ICM426XX_SENSOR_ACCEL
@ INV_ICM426XX_SENSOR_ACCEL
Accelerometer (UI control path)
Definition: Icm426xxDriver_HL.h:128
INV_ICM426XX_SENSOR_DMP_PEDOMETER_EVENT
@ INV_ICM426XX_SENSOR_DMP_PEDOMETER_EVENT
Pedometer: step is detected.
Definition: Icm426xxDriver_HL.h:135
INV_ICM426XX_SENSOR_TEMPERATURE
@ INV_ICM426XX_SENSOR_TEMPERATURE
Chip temperature, enabled by default.
Definition: Icm426xxDriver_HL.h:132
INV_ICM426XX_SENSOR_FSYNC_EVENT
@ INV_ICM426XX_SENSOR_FSYNC_EVENT
Used by OIS and UI control layers.
Definition: Icm426xxDriver_HL.h:130
INV_ICM426XX_SENSOR_DMP_TILT
@ INV_ICM426XX_SENSOR_DMP_TILT
Tilt.
Definition: Icm426xxDriver_HL.h:137
inv_icm426xx_sensor_event_t
Sensor event structure definition.
Definition: Icm426xxDriver_HL.h:156
inv_icm426xx
Icm426xx driver states definition.
Definition: Icm426xxDriver_HL.h:168
inv_icm426xx::acc_ln_bw
uint8_t acc_ln_bw
Low-noise filter bandwidth setting for accelerometer.
Definition: Icm426xxDriver_HL.h:220
inv_icm426xx::wom_smd_mask
uint8_t wom_smd_mask
This variable keeps track if wom or smd is enabled.
Definition: Icm426xxDriver_HL.h:212
inv_icm426xx::gyr_ln_bw
uint8_t gyr_ln_bw
Low-noise filter bandwidth setting for gyroscope.
Definition: Icm426xxDriver_HL.h:221
inv_icm426xx::reserved
uint8_t reserved
reserved field
Definition: Icm426xxDriver_HL.h:219
inv_icm426xx::fifo_data
uint8_t fifo_data[ICM426XX_FIFO_MIRRORING_SIZE]
FIFO mirroring memory area.
Definition: Icm426xxDriver_HL.h:181
inv_icm426xx::acc_lp_avg
uint8_t acc_lp_avg
Low-power averaging setting for accelerometer.
Definition: Icm426xxDriver_HL.h:218
inv_icm426xx::transport
struct inv_icm426xx_transport transport
Warning : this field MUST be the first one of struct icm426xx.
Definition: Icm426xxDriver_HL.h:169
inv_icm426xx::gyro_start_time_us
uint64_t gyro_start_time_us
internal state needed to discard first gyro samples
Definition: Icm426xxDriver_HL.h:188
inv_icm426xx::dmp_from_sram
uint8_t dmp_from_sram
DMP executes from SRAM.
Definition: Icm426xxDriver_HL.h:186
inv_icm426xx::tmst_to_reg_en_cnt
uint8_t tmst_to_reg_en_cnt
internal counter to keep track of the timestamp to register access availability
Definition: Icm426xxDriver_HL.h:183
inv_icm426xx::fifo_is_used
INV_ICM426XX_FIFO_CONFIG_t fifo_is_used
Data are get from FIFO or from sensor registers.
Definition: Icm426xxDriver_HL.h:192
inv_icm426xx::gyro_power_off_tmst
uint64_t gyro_power_off_tmst
This variable keeps track of timestamp when gyro is power off.
Definition: Icm426xxDriver_HL.h:224
inv_icm426xx::sensor_event_cb
void(* sensor_event_cb)(inv_icm426xx_sensor_event_t *event)
callback executed by inv_icm426xx_get_data_from_fifo function for each data packet extracted from fif...
Definition: Icm426xxDriver_HL.h:172
inv_icm426xx::fifo_highres_enabled
uint8_t fifo_highres_enabled
FIFO packets are 20 bytes long.
Definition: Icm426xxDriver_HL.h:191
inv_icm426xx::accel_start_time_us
uint64_t accel_start_time_us
internal state needed to discard first accel samples
Definition: Icm426xxDriver_HL.h:189
inv_icm426xx::dmp_is_on
uint8_t dmp_is_on
DMP started status.
Definition: Icm426xxDriver_HL.h:185
inv_icm426xx::endianess_data
uint8_t endianess_data
internal status of data endianness mode to report correctly data
Definition: Icm426xxDriver_HL.h:190
inv_icm426xx::gyro_st_bias
int gyro_st_bias[3]
collected bias values (lsb) during self test
Definition: Icm426xxDriver_HL.h:177
inv_icm426xx::wom_enable
uint8_t wom_enable
This variable keeps track if wom is enabled.
Definition: Icm426xxDriver_HL.h:214
inv_icm426xx::st_result
int st_result
Flag to keep track if self-test has been already run by storing acc and gyr results.
Definition: Icm426xxDriver_HL.h:179
inv_icm426xx_interrupt_parameter_t
Icm426xx set of interrupt enable flag.
Definition: Icm426xxDriver_HL.h:235
inv_icm426xx_serif
base sensor serial interface
Definition: Icm426xxTransport.h:62
inv_icm426xx_transport
transport interface
Definition: Icm426xxTransport.h:74