| ICM42688V eMD Driver 2.0.9 Documentation of the eMD Driver API

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

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
31 #ifndef _INV_ICM426xx_DRIVER_HL_H_
32 #define _INV_ICM426xx_DRIVER_HL_H_
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 #include "Invn/Drivers/Icm426xx/Icm426xxDefs.h"
39 #include "Invn/Drivers/Icm426xx/Icm426xxTransport.h"
40
41 #include "Invn/InvError.h"
42
43 #include <stdint.h>
44 #include <string.h>
45
54 #ifndef INV_ICM426XX_LIGHTWEIGHT_DRIVER
55 #define INV_ICM426XX_LIGHTWEIGHT_DRIVER 0
56 #endif
57
61 #if (defined(ICM42600) || defined(ICM42622) || defined(ICM42633) || defined(ICM42686P) || \
62 defined(ICM42688P) || defined(ICM42688V) || defined(ICM42686V))
63 /*
64 * For parts with maximum ODR of 32 KHz,
65 * PLL is running at 19.2 MHz instead of the nominal 20.48 MHz
66 * Time resolution has to be scaled by 20.48/19.2=1.06666667
67 * To prevent floating point usage, one can use 32/30
68 *
69 * The decimator also need to know the maximum ODR.
70 */
71 #define PLL_SCALE_FACTOR_Q24 ((32UL << 24) / 30)
72 #define ICM_PART_DEFAULT_OIS_MODE ICM426XX_SENSOR_CONFIG2_OIS_MODE_32KHZ
73 #else
74 #define PLL_SCALE_FACTOR_Q24 (1UL << 24)
75 #define ICM_PART_DEFAULT_OIS_MODE ICM426XX_SENSOR_CONFIG2_OIS_MODE_8KHZ
76 #endif
77
81 #if defined(ICM42686P) || defined(ICM42686V)
82 #define ACCEL_CONFIG0_FS_SEL_MAX ICM426XX_ACCEL_CONFIG0_FS_SEL_32g
83 #define GYRO_CONFIG0_FS_SEL_MAX ICM426XX_GYRO_CONFIG0_FS_SEL_4000dps
84
85 #define ACCEL_OFFUSER_MAX_MG 2000
86 #define GYRO_OFFUSER_MAX_DPS 128
87 #else
88 #define ACCEL_CONFIG0_FS_SEL_MAX ICM426XX_ACCEL_CONFIG0_FS_SEL_16g
89 #define GYRO_CONFIG0_FS_SEL_MAX ICM426XX_GYRO_CONFIG0_FS_SEL_2000dps
90
91 #define ACCEL_OFFUSER_MAX_MG 1000
92 #define GYRO_OFFUSER_MAX_DPS 64
93 #endif
94
99 #if (defined(ICM42600) || defined(ICM42622) || defined(ICM42633) || defined(ICM42686P) || \
100 defined(ICM42688P) || defined(ICM42688V) || defined(ICM42686V))
101 #define RTC_SUPPORTED 1
102 #else
103 #define RTC_SUPPORTED 0
104 #endif
105
109 #define ICM426XX_FIFO_MIRRORING_SIZE 16 * 129 // packet size * max_count = 2064
110
114 #define ICM426XX_DEFAULT_WOM_THS_MG 52 >> 2 /* = 52mg/4 */
115
118 #define ICM426XX_ACC_STARTUP_TIME_US 20000U
119
122 #define ICM426XX_GYR_STARTUP_TIME_US 60000U
123
126 enum inv_icm426xx_sensor {
127 INV_ICM426XX_SENSOR_ACCEL,
128 INV_ICM426XX_SENSOR_GYRO,
129 INV_ICM426XX_SENSOR_FSYNC_EVENT,
130 INV_ICM426XX_SENSOR_OIS,
131 INV_ICM426XX_SENSOR_TEMPERATURE,
137 INV_ICM426XX_SENSOR_TAP,
138 INV_ICM426XX_SENSOR_DMP_PEDOMETER_EVENT,
139 INV_ICM426XX_SENSOR_DMP_PEDOMETER_COUNT,
140 INV_ICM426XX_SENSOR_DMP_TILT,
141 #if defined(ICM_FAMILY_BPLUS)
142 INV_ICM426XX_SENSOR_DMP_R2W,
143 #elif defined(ICM_FAMILY_CPLUS)
144 INV_ICM426XX_SENSOR_DMP_FF,
145 INV_ICM426XX_SENSOR_DMP_LOWG,
146 #endif
147 INV_ICM426XX_SENSOR_MAX
148 };
149
152 typedef enum {
153 INV_ICM426XX_FIFO_DISABLED = 0,
154 INV_ICM426XX_FIFO_ENABLED = 1,
155 } INV_ICM426XX_FIFO_CONFIG_t;
156
159 typedef struct {
160 int sensor_mask;
161 uint16_t timestamp_fsync;
162 int16_t accel[3];
163 int16_t gyro[3];
164 int16_t temperature;
165 int8_t accel_high_res[3];
166 int8_t gyro_high_res[3];
167 } inv_icm426xx_sensor_event_t;
168
171 struct inv_icm426xx {
173 struct inv_icm426xx_transport transport;
174
180 void (*sensor_event_cb)(inv_icm426xx_sensor_event_t *event);
181
183 int gyro_st_bias[3];
184
186 int accel_st_bias[3];
187
189 int st_result;
190
192 uint8_t fifo_data[ICM426XX_FIFO_MIRRORING_SIZE];
193
195 uint8_t tmst_to_reg_en_cnt;
196
198 uint8_t dmp_is_on;
199
201 uint8_t dmp_from_sram;
202
204 uint64_t gyro_start_time_us;
205
207 uint64_t accel_start_time_us;
208
210 uint8_t endianess_data;
211
213 uint8_t fifo_highres_enabled;
214
216 INV_ICM426XX_FIFO_CONFIG_t fifo_is_used;
217
218 #if (!INV_ICM426XX_LIGHTWEIGHT_DRIVER)
224 uint8_t fsync_to_be_ignored;
225 #endif
226
235 uint32_t wu_off_acc_odr_changes;
236
238 uint8_t wom_smd_mask;
239
241 uint8_t wom_enable;
242
246 struct {
247 uint8_t acc_lp_avg;
248 uint8_t reserved;
249 uint8_t acc_ln_bw;
250 uint8_t gyr_ln_bw;
251 } avg_bw_setting;
252
254 uint64_t gyro_power_off_tmst;
255 };
256
257 /* Interrupt enum state for INT1, INT2, and IBI */
258 typedef enum { INV_ICM426XX_DISABLE = 0, INV_ICM426XX_ENABLE } inv_icm426xx_interrupt_value;
259
262 typedef struct {
263 inv_icm426xx_interrupt_value INV_ICM426XX_UI_FSYNC;
264 inv_icm426xx_interrupt_value INV_ICM426XX_UI_DRDY;
265 inv_icm426xx_interrupt_value INV_ICM426XX_FIFO_THS;
266 inv_icm426xx_interrupt_value INV_ICM426XX_FIFO_FULL;
267 inv_icm426xx_interrupt_value INV_ICM426XX_SMD;
268 inv_icm426xx_interrupt_value INV_ICM426XX_WOM_X;
269 inv_icm426xx_interrupt_value INV_ICM426XX_WOM_Y;
270 inv_icm426xx_interrupt_value INV_ICM426XX_WOM_Z;
271 inv_icm426xx_interrupt_value INV_ICM426XX_STEP_DET;
272 inv_icm426xx_interrupt_value INV_ICM426XX_STEP_CNT_OVFL;
273 inv_icm426xx_interrupt_value INV_ICM426XX_TILT_DET;
274 #if defined(ICM_FAMILY_BPLUS)
275 inv_icm426xx_interrupt_value INV_ICM426XX_SLEEP_DET;
276 inv_icm426xx_interrupt_value INV_ICM426XX_WAKE_DET;
277 #elif defined(ICM_FAMILY_CPLUS)
278 inv_icm426xx_interrupt_value INV_ICM426XX_FF_DET;
279 inv_icm426xx_interrupt_value INV_ICM426XX_LOWG_DET;
280 #endif
281 inv_icm426xx_interrupt_value INV_ICM426XX_TAP_DET;
282 } inv_icm426xx_interrupt_parameter_t;
283
284 #if defined(ICM_FAMILY_CPLUS)
285 /* Possible interface configurations mode */
286 typedef enum {
287 INV_ICM426XX_SINGLE_INTERFACE = 0x01,
288 INV_ICM426XX_DUAL_INTERFACE = 0x02,
289 INV_ICM426XX_DUAL_INTERFACE_SPI4 = 0x06,
290 INV_ICM426XX_TRIPLE_INTERFACE = 0x08,
291 } inv_icm426xx_interface_mode_t;
292 #endif
293
299 int inv_icm426xx_set_reg_bank(struct inv_icm426xx *s, uint8_t bank);
300
310 int inv_icm426xx_init(struct inv_icm426xx *s, struct inv_icm426xx_serif *serif,
311 void (*sensor_event_cb)(inv_icm426xx_sensor_event_t *event));
312
317 int inv_icm426xx_device_reset(struct inv_icm426xx *s);
318
324 int inv_icm426xx_get_who_am_i(struct inv_icm426xx *s, uint8_t *who_am_i);
325
333 int inv_icm426xx_force_clock_source(struct inv_icm426xx * s,
334 ICM426XX_INTF_CONFIG1_ACCEL_LP_CLK_t clk_src);
335
340 int inv_icm426xx_enable_accel_low_power_mode(struct inv_icm426xx *s);
341
346 int inv_icm426xx_enable_accel_low_noise_mode(struct inv_icm426xx *s);
347
352 int inv_icm426xx_disable_accel(struct inv_icm426xx *s);
353
358 int inv_icm426xx_enable_gyro_low_noise_mode(struct inv_icm426xx *s);
359
364 int inv_icm426xx_disable_gyro(struct inv_icm426xx *s);
365
375 int inv_icm426xx_enable_fsync(struct inv_icm426xx *s);
376
386 int inv_icm426xx_disable_fsync(struct inv_icm426xx *s);
387
395 int inv_icm426xx_configure_timestamp_resolution(struct inv_icm426xx * s,
396 ICM426XX_TMST_CONFIG_RESOL_t resol);
397
404 int inv_icm426xx_set_config_ibi(struct inv_icm426xx * s,
405 inv_icm426xx_interrupt_parameter_t *interrupt_to_configure);
406
413 int inv_icm426xx_get_config_ibi(struct inv_icm426xx * s,
414 inv_icm426xx_interrupt_parameter_t *interrupt_to_configure);
415
421 int inv_icm426xx_set_config_int1(struct inv_icm426xx * s,
422 inv_icm426xx_interrupt_parameter_t *interrupt_to_configure);
423
429 int inv_icm426xx_get_config_int1(struct inv_icm426xx * s,
430 inv_icm426xx_interrupt_parameter_t *interrupt_to_configure);
431
437 int inv_icm426xx_set_config_int2(struct inv_icm426xx * s,
438 inv_icm426xx_interrupt_parameter_t *interrupt_to_configure);
439
445 int inv_icm426xx_get_config_int2(struct inv_icm426xx * s,
446 inv_icm426xx_interrupt_parameter_t *interrupt_to_configure);
447
453 int inv_icm426xx_get_data_from_registers(struct inv_icm426xx *s);
454
461 int inv_icm426xx_get_data_from_fifo(struct inv_icm426xx *s);
462
468 uint32_t inv_icm426xx_convert_odr_bitfield_to_us(uint32_t odr_bitfield);
469
475 int inv_icm426xx_set_accel_frequency(struct inv_icm426xx * s,
476 const ICM426XX_ACCEL_CONFIG0_ODR_t frequency);
477
483 int inv_icm426xx_set_gyro_frequency(struct inv_icm426xx * s,
484 const ICM426XX_GYRO_CONFIG0_ODR_t frequency);
485
491 int inv_icm426xx_set_accel_fsr(struct inv_icm426xx *s, ICM426XX_ACCEL_CONFIG0_FS_SEL_t accel_fsr_g);
492
498 int inv_icm426xx_get_accel_fsr(struct inv_icm426xx * s,
499 ICM426XX_ACCEL_CONFIG0_FS_SEL_t *accel_fsr_g);
500
506 int inv_icm426xx_set_gyro_fsr(struct inv_icm426xx *s, ICM426XX_GYRO_CONFIG0_FS_SEL_t gyro_fsr_dps);
507
513 int inv_icm426xx_get_gyro_fsr(struct inv_icm426xx *s, ICM426XX_GYRO_CONFIG0_FS_SEL_t *gyro_fsr_dps);
514
520 int inv_icm426xx_set_accel_lp_avg(struct inv_icm426xx * s,
521 ICM426XX_GYRO_ACCEL_CONFIG0_ACCEL_FILT_AVG_t acc_avg);
522
528 int inv_icm426xx_set_accel_ln_bw(struct inv_icm426xx * s,
529 ICM426XX_GYRO_ACCEL_CONFIG0_ACCEL_FILT_BW_t acc_bw);
530
536 int inv_icm426xx_set_gyro_ln_bw(struct inv_icm426xx * s,
537 ICM426XX_GYRO_ACCEL_CONFIG0_GYRO_FILT_BW_t gyr_bw);
538
543 int inv_icm426xx_reset_fifo(struct inv_icm426xx *s);
544
550 int inv_icm426xx_enable_timestamp_to_register(struct inv_icm426xx *s);
551
556 int inv_icm426xx_disable_timestamp_to_register(struct inv_icm426xx *s);
557
565 int inv_icm426xx_get_current_timestamp(struct inv_icm426xx *s, uint32_t *icm_time);
566
575 int inv_icm426xx_enable_clkin_rtc(struct inv_icm426xx *s, uint8_t enable);
576
584 int inv_icm426xx_get_clkin_rtc_status(struct inv_icm426xx *s);
585
590 int inv_icm426xx_enable_high_resolution_fifo(struct inv_icm426xx *s);
591
596 int inv_icm426xx_disable_high_resolution_fifo(struct inv_icm426xx *s);
597
607 int inv_icm426xx_configure_fifo(struct inv_icm426xx *s, INV_ICM426XX_FIFO_CONFIG_t fifo_config);
608
614 int inv_icm426xx_configure_fifo_wm(struct inv_icm426xx *s, uint16_t wm);
615
620 uint32_t inv_icm426xx_get_fifo_timestamp_resolution_us_q24(struct inv_icm426xx *s);
621
626 uint32_t inv_icm426xx_get_reg_timestamp_resolution_us_q24(struct inv_icm426xx *s);
627
628 #if defined(ICM_FAMILY_CPLUS)
635 int inv_icm426xx_set_fifo_dec_rate(struct inv_icm426xx *s, uint8_t dec_rate);
636
643 int inv_icm426xx_interface_change_procedure(struct inv_icm426xx * s,
644 inv_icm426xx_interface_mode_t interface_mode);
645 #endif
646
650 const char *inv_icm426xx_get_version(void);
651
652 #ifdef __cplusplus
653 }
654 #endif
655
656 #endif /* _INV_ICM426xx_DRIVER_HL_H_ */
657
Icm426xxDefs.h
File exposing the device register map.
ICM426XX_GYRO_ACCEL_CONFIG0_ACCEL_FILT_BW_t
ICM426XX_GYRO_ACCEL_CONFIG0_ACCEL_FILT_BW_t
Definition: Icm426xxDefs.h:840
ICM426XX_GYRO_ACCEL_CONFIG0_GYRO_FILT_BW_t
ICM426XX_GYRO_ACCEL_CONFIG0_GYRO_FILT_BW_t
Definition: Icm426xxDefs.h:860
ICM426XX_GYRO_ACCEL_CONFIG0_ACCEL_FILT_AVG_t
ICM426XX_GYRO_ACCEL_CONFIG0_ACCEL_FILT_AVG_t
Definition: Icm426xxDefs.h:851
ICM426XX_GYRO_CONFIG0_ODR_t
ICM426XX_GYRO_CONFIG0_ODR_t
Gyroscope ODR selection.
Definition: Icm426xxDefs.h:739
ICM426XX_ACCEL_CONFIG0_FS_SEL_t
ICM426XX_ACCEL_CONFIG0_FS_SEL_t
Accelerometer FSR selection.
Definition: Icm426xxDefs.h:765
ICM426XX_GYRO_CONFIG0_FS_SEL_t
ICM426XX_GYRO_CONFIG0_FS_SEL_t
Gyroscope FSR selection.
Definition: Icm426xxDefs.h:711
ICM426XX_INTF_CONFIG1_ACCEL_LP_CLK_t
ICM426XX_INTF_CONFIG1_ACCEL_LP_CLK_t
Definition: Icm426xxDefs.h:643
ICM426XX_ACCEL_CONFIG0_ODR_t
ICM426XX_ACCEL_CONFIG0_ODR_t
Accelerometer ODR selection.
Definition: Icm426xxDefs.h:787
ICM426XX_TMST_CONFIG_RESOL_t
ICM426XX_TMST_CONFIG_RESOL_t
Definition: Icm426xxDefs.h:911
Icm426xxTransport.h
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.
inv_icm426xx_enable_clkin_rtc
int inv_icm426xx_enable_clkin_rtc(struct inv_icm426xx *s, uint8_t enable)
Enable or disable CLKIN/RTC capability.
inv_icm426xx_device_reset
int inv_icm426xx_device_reset(struct inv_icm426xx *s)
Perform a soft reset of the device.
inv_icm426xx_disable_gyro
int inv_icm426xx_disable_gyro(struct inv_icm426xx *s)
Disable gyro.
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.
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.
inv_icm426xx_disable_timestamp_to_register
int inv_icm426xx_disable_timestamp_to_register(struct inv_icm426xx *s)
Disable the 20bits-timestamp register access.
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.
inv_icm426xx_set_reg_bank
int inv_icm426xx_set_reg_bank(struct inv_icm426xx *s, uint8_t bank)
Set register bank index.
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.
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))
Initializes device.
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.
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.
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.
inv_icm426xx_interrupt_value
inv_icm426xx_interrupt_value
Definition: Icm426xxDriver_HL.h:258
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.
INV_ICM426XX_FIFO_CONFIG_t
INV_ICM426XX_FIFO_CONFIG_t
Configure Fifo usage.
Definition: Icm426xxDriver_HL.h:152
inv_icm426xx_reset_fifo
int inv_icm426xx_reset_fifo(struct inv_icm426xx *s)
reset ICM426XX fifo
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).
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.
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.
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.
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.
inv_icm426xx_enable_accel_low_noise_mode
int inv_icm426xx_enable_accel_low_noise_mode(struct inv_icm426xx *s)
Enable accel in low noise mode.
inv_icm426xx_disable_accel
int inv_icm426xx_disable_accel(struct inv_icm426xx *s)
Disable accel.
inv_icm426xx_enable_gyro_low_noise_mode
int inv_icm426xx_enable_gyro_low_noise_mode(struct inv_icm426xx *s)
Enable gyro in low noise mode.
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.
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.
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.
inv_icm426xx_enable_accel_low_power_mode
int inv_icm426xx_enable_accel_low_power_mode(struct inv_icm426xx *s)
Enable accel in low power mode.
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
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.
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.
inv_icm426xx_get_version
const char * inv_icm426xx_get_version(void)
Return driver version x.y.z-suffix as a char array.
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.
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.
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).
inv_icm426xx_disable_fsync
int inv_icm426xx_disable_fsync(struct inv_icm426xx *s)
Disable fsync tagging functionality.
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.
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.
inv_icm426xx_sensor
inv_icm426xx_sensor
Sensor identifier for UI control and OIS function.
Definition: Icm426xxDriver_HL.h:126
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.
ICM426XX_FIFO_MIRRORING_SIZE
#define ICM426XX_FIFO_MIRRORING_SIZE
Icm426xx maximum buffer size mirrored from FIFO at polling time.
Definition: Icm426xxDriver_HL.h:109
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.
inv_icm426xx_get_clkin_rtc_status
int inv_icm426xx_get_clkin_rtc_status(struct inv_icm426xx *s)
Get CLKIN/RTC feature status.
inv_icm426xx_enable_fsync
int inv_icm426xx_enable_fsync(struct inv_icm426xx *s)
Enable fsync tagging functionality.
inv_icm426xx_get_data_from_fifo
int inv_icm426xx_get_data_from_fifo(struct inv_icm426xx *s)
Read all available packets from the FIFO.
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.
INV_ICM426XX_ENABLE
@ INV_ICM426XX_ENABLE
Definition: Icm426xxDriver_HL.h:258
INV_ICM426XX_DISABLE
@ INV_ICM426XX_DISABLE
Definition: Icm426xxDriver_HL.h:258
INV_ICM426XX_FIFO_ENABLED
@ INV_ICM426XX_FIFO_ENABLED
Fifo is used as data source.
Definition: Icm426xxDriver_HL.h:154
INV_ICM426XX_FIFO_DISABLED
@ INV_ICM426XX_FIFO_DISABLED
Fifo is disabled and data source is sensors registers.
Definition: Icm426xxDriver_HL.h:153
INV_ICM426XX_SENSOR_GYRO
@ INV_ICM426XX_SENSOR_GYRO
Gyroscope (UI control path)
Definition: Icm426xxDriver_HL.h:128
INV_ICM426XX_SENSOR_TAP
@ INV_ICM426XX_SENSOR_TAP
Tap and Double tap.
Definition: Icm426xxDriver_HL.h:137
INV_ICM426XX_SENSOR_DMP_PEDOMETER_COUNT
@ INV_ICM426XX_SENSOR_DMP_PEDOMETER_COUNT
Pedometer: step counter.
Definition: Icm426xxDriver_HL.h:139
INV_ICM426XX_SENSOR_OIS
@ INV_ICM426XX_SENSOR_OIS
Only used by OIS layer.
Definition: Icm426xxDriver_HL.h:130
INV_ICM426XX_SENSOR_ACCEL
@ INV_ICM426XX_SENSOR_ACCEL
Accelerometer (UI control path)
Definition: Icm426xxDriver_HL.h:127
INV_ICM426XX_SENSOR_DMP_PEDOMETER_EVENT
@ INV_ICM426XX_SENSOR_DMP_PEDOMETER_EVENT
Pedometer: step is detected.
Definition: Icm426xxDriver_HL.h:138
INV_ICM426XX_SENSOR_MAX
@ INV_ICM426XX_SENSOR_MAX
Definition: Icm426xxDriver_HL.h:147
INV_ICM426XX_SENSOR_TEMPERATURE
@ INV_ICM426XX_SENSOR_TEMPERATURE
Chip temperature, enabled by default.
Definition: Icm426xxDriver_HL.h:131
INV_ICM426XX_SENSOR_FSYNC_EVENT
@ INV_ICM426XX_SENSOR_FSYNC_EVENT
Used by OIS and UI control layers.
Definition: Icm426xxDriver_HL.h:129
INV_ICM426XX_SENSOR_DMP_TILT
@ INV_ICM426XX_SENSOR_DMP_TILT
Tilt.
Definition: Icm426xxDriver_HL.h:140
inv_icm426xx_sensor_event_t
Sensor event structure definition.
Definition: Icm426xxDriver_HL.h:159
inv_icm426xx_sensor_event_t::temperature
int16_t temperature
Definition: Icm426xxDriver_HL.h:164
inv_icm426xx_sensor_event_t::timestamp_fsync
uint16_t timestamp_fsync
Definition: Icm426xxDriver_HL.h:161
inv_icm426xx_sensor_event_t::sensor_mask
int sensor_mask
Definition: Icm426xxDriver_HL.h:160
inv_icm426xx
Icm426xx driver states definition.
Definition: Icm426xxDriver_HL.h:171
inv_icm426xx::acc_ln_bw
uint8_t acc_ln_bw
Low-noise filter bandwidth setting for accelerometer.
Definition: Icm426xxDriver_HL.h:249
inv_icm426xx::wom_smd_mask
uint8_t wom_smd_mask
Keeps track if wom or smd is enabled.
Definition: Icm426xxDriver_HL.h:238
inv_icm426xx::gyr_ln_bw
uint8_t gyr_ln_bw
Low-noise filter bandwidth setting for gyroscope.
Definition: Icm426xxDriver_HL.h:250
inv_icm426xx::reserved
uint8_t reserved
reserved field
Definition: Icm426xxDriver_HL.h:248
inv_icm426xx::fifo_data
uint8_t fifo_data[ICM426XX_FIFO_MIRRORING_SIZE]
FIFO mirroring memory area.
Definition: Icm426xxDriver_HL.h:192
inv_icm426xx::acc_lp_avg
uint8_t acc_lp_avg
Low-power averaging setting for accelerometer.
Definition: Icm426xxDriver_HL.h:247
inv_icm426xx::wu_off_acc_odr_changes
uint32_t wu_off_acc_odr_changes
Accel Low Power could report with wrong ODR if internal counter for ODR changed overflowed.
Definition: Icm426xxDriver_HL.h:235
inv_icm426xx::transport
struct inv_icm426xx_transport transport
Transport structure.
Definition: Icm426xxDriver_HL.h:173
inv_icm426xx::gyro_start_time_us
uint64_t gyro_start_time_us
Internal state needed to discard first gyro samples.
Definition: Icm426xxDriver_HL.h:204
inv_icm426xx::dmp_from_sram
uint8_t dmp_from_sram
DMP executes from SRAM.
Definition: Icm426xxDriver_HL.h:201
inv_icm426xx::avg_bw_setting
struct inv_icm426xx::@1 avg_bw_setting
Software mirror of BW and AVG settings in hardware.
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:195
inv_icm426xx::fifo_is_used
INV_ICM426XX_FIFO_CONFIG_t fifo_is_used
Indicates if data are retrieved from FIFO or registers.
Definition: Icm426xxDriver_HL.h:216
inv_icm426xx::gyro_power_off_tmst
uint64_t gyro_power_off_tmst
Keeps track of timestamp when gyro is power off.
Definition: Icm426xxDriver_HL.h:254
inv_icm426xx::sensor_event_cb
void(* sensor_event_cb)(inv_icm426xx_sensor_event_t *event)
Callback executed when retrieving data from FIFO or registers.
Definition: Icm426xxDriver_HL.h:180
inv_icm426xx::fifo_highres_enabled
uint8_t fifo_highres_enabled
Indicates if highres mode is used for FIFO.
Definition: Icm426xxDriver_HL.h:213
inv_icm426xx::accel_start_time_us
uint64_t accel_start_time_us
Internal state needed to discard first accel samples.
Definition: Icm426xxDriver_HL.h:207
inv_icm426xx::dmp_is_on
uint8_t dmp_is_on
DMP started status.
Definition: Icm426xxDriver_HL.h:198
inv_icm426xx::endianess_data
uint8_t endianess_data
Internal status of data endianness mode to report correctly data.
Definition: Icm426xxDriver_HL.h:210
inv_icm426xx::gyro_st_bias
int gyro_st_bias[3]
Gyro bias values (lsb) collected during self test.
Definition: Icm426xxDriver_HL.h:183
inv_icm426xx::wom_enable
uint8_t wom_enable
Keeps track if wom is enabled.
Definition: Icm426xxDriver_HL.h:241
inv_icm426xx::fsync_to_be_ignored
uint8_t fsync_to_be_ignored
Indicates if the next FSYNC should be ignored.
Definition: Icm426xxDriver_HL.h:224
inv_icm426xx::accel_st_bias
int accel_st_bias[3]
Accel bias values (lsb) collected during self test.
Definition: Icm426xxDriver_HL.h:186
inv_icm426xx::st_result
int st_result
Flag to keep track if self-test has already been executed.
Definition: Icm426xxDriver_HL.h:189
inv_icm426xx_interrupt_parameter_t
Icm426xx set of interrupt enable flag.
Definition: Icm426xxDriver_HL.h:262
inv_icm426xx_interrupt_parameter_t::INV_ICM426XX_WOM_Y
inv_icm426xx_interrupt_value INV_ICM426XX_WOM_Y
Definition: Icm426xxDriver_HL.h:269
inv_icm426xx_interrupt_parameter_t::INV_ICM426XX_SMD
inv_icm426xx_interrupt_value INV_ICM426XX_SMD
Definition: Icm426xxDriver_HL.h:267
inv_icm426xx_interrupt_parameter_t::INV_ICM426XX_UI_DRDY
inv_icm426xx_interrupt_value INV_ICM426XX_UI_DRDY
Definition: Icm426xxDriver_HL.h:264
inv_icm426xx_interrupt_parameter_t::INV_ICM426XX_UI_FSYNC
inv_icm426xx_interrupt_value INV_ICM426XX_UI_FSYNC
Definition: Icm426xxDriver_HL.h:263
inv_icm426xx_interrupt_parameter_t::INV_ICM426XX_WOM_X
inv_icm426xx_interrupt_value INV_ICM426XX_WOM_X
Definition: Icm426xxDriver_HL.h:268
inv_icm426xx_interrupt_parameter_t::INV_ICM426XX_STEP_CNT_OVFL
inv_icm426xx_interrupt_value INV_ICM426XX_STEP_CNT_OVFL
Definition: Icm426xxDriver_HL.h:272
inv_icm426xx_interrupt_parameter_t::INV_ICM426XX_TILT_DET
inv_icm426xx_interrupt_value INV_ICM426XX_TILT_DET
Definition: Icm426xxDriver_HL.h:273
inv_icm426xx_interrupt_parameter_t::INV_ICM426XX_STEP_DET
inv_icm426xx_interrupt_value INV_ICM426XX_STEP_DET
Definition: Icm426xxDriver_HL.h:271
inv_icm426xx_interrupt_parameter_t::INV_ICM426XX_TAP_DET
inv_icm426xx_interrupt_value INV_ICM426XX_TAP_DET
Definition: Icm426xxDriver_HL.h:281
inv_icm426xx_interrupt_parameter_t::INV_ICM426XX_FIFO_THS
inv_icm426xx_interrupt_value INV_ICM426XX_FIFO_THS
Definition: Icm426xxDriver_HL.h:265
inv_icm426xx_interrupt_parameter_t::INV_ICM426XX_FIFO_FULL
inv_icm426xx_interrupt_value INV_ICM426XX_FIFO_FULL
Definition: Icm426xxDriver_HL.h:266
inv_icm426xx_interrupt_parameter_t::INV_ICM426XX_WOM_Z
inv_icm426xx_interrupt_value INV_ICM426XX_WOM_Z
Definition: Icm426xxDriver_HL.h:270
inv_icm426xx_serif
base sensor serial interface
Definition: Icm426xxTransport.h:59
inv_icm426xx_transport
transport interface
Definition: Icm426xxTransport.h:72