| eMD IIM4265x Driver API 1.0.0

Ixm42xxxDriver_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_IXM42XXX_DRIVER_HL_H_
35 #define _INV_IXM42XXX_DRIVER_HL_H_
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 #include "Invn/Drivers/Ixm42xxx/Ixm42xxxDefs.h"
42 #include "Invn/Drivers/Ixm42xxx/Ixm42xxxTransport.h"
43
44 #include "Invn/InvError.h"
45
46 #include <stdint.h>
47 #include <string.h>
48
57 #ifndef INV_IXM42XXX_LIGHTWEIGHT_DRIVER
58 #define INV_IXM42XXX_LIGHTWEIGHT_DRIVER 0
59 #endif
60
64 #if (defined(ICM42600) || defined(ICM42622) || defined(ICM42686) || defined(ICM42688))
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 IXM42XXX_SENSOR_CONFIG2_OIS_MODE_32KHZ
75 #else
76 #define PLL_SCALE_FACTOR_Q24 (1UL<<24)
77 #define ICM_PART_DEFAULT_OIS_MODE IXM42XXX_SENSOR_CONFIG2_OIS_MODE_8KHZ
78 #endif
79
83 #if defined(ICM42686)
84 #define ACCEL_CONFIG0_FS_SEL_MAX IXM42XXX_ACCEL_CONFIG0_FS_SEL_32g
85 #define GYRO_CONFIG0_FS_SEL_MAX IXM42XXX_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 IXM42XXX_ACCEL_CONFIG0_FS_SEL_16g
91 #define GYRO_CONFIG0_FS_SEL_MAX IXM42XXX_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(ICM42686) || defined(ICM42688))
102 #define RTC_SUPPORTED 1
103 #else
104 #define RTC_SUPPORTED 0
105 #endif
106
107
111 #define IXM42XXX_FIFO_MIRRORING_SIZE 16 * 129 // packet size * max_count = 2064
112
116 #define IXM42XXX_DEFAULT_WOM_THS_MG 52>>2 /* = 52mg/4 */
117
120 #define IXM42XXX_ACC_STARTUP_TIME_US 20000U
121
124 #define IXM42XXX_GYR_STARTUP_TIME_US 60000U
125
128 enum inv_ixm42xxx_sensor {
129 INV_IXM42XXX_SENSOR_ACCEL,
130 INV_IXM42XXX_SENSOR_GYRO,
131 INV_IXM42XXX_SENSOR_FSYNC_EVENT,
132 INV_IXM42XXX_SENSOR_OIS,
133 INV_IXM42XXX_SENSOR_TEMPERATURE,
135 INV_IXM42XXX_SENSOR_TAP,
136 INV_IXM42XXX_SENSOR_DMP_PEDOMETER_EVENT,
137 INV_IXM42XXX_SENSOR_DMP_PEDOMETER_COUNT,
138 INV_IXM42XXX_SENSOR_DMP_TILT,
139 INV_IXM42XXX_SENSOR_DMP_R2W,
140 INV_IXM42XXX_SENSOR_MAX
141 };
142
145 typedef enum {
146 INV_IXM42XXX_FIFO_DISABLED = 0,
147 INV_IXM42XXX_FIFO_ENABLED = 1,
148 }INV_IXM42XXX_FIFO_CONFIG_t;
149
152 typedef struct {
153 int sensor_mask;
154 uint16_t timestamp_fsync;
155 int16_t accel[3];
156 int16_t gyro[3];
157 int16_t temperature;
158 int8_t accel_high_res[3];
159 int8_t gyro_high_res[3];
160 } inv_ixm42xxx_sensor_event_t;
161
164 struct inv_ixm42xxx {
165 struct inv_ixm42xxx_transport transport;
168 void (*sensor_event_cb)(inv_ixm42xxx_sensor_event_t * event);
173 int gyro_st_bias[3];
174 int accel_st_bias[3];
175 int st_result;
177 uint8_t fifo_data[IXM42XXX_FIFO_MIRRORING_SIZE];
179 uint8_t tmst_to_reg_en_cnt;
181 uint8_t dmp_is_on;
183 uint64_t gyro_start_time_us;
184 uint64_t accel_start_time_us;
185 uint8_t endianess_data;
186 uint8_t fifo_highres_enabled;
187 INV_IXM42XXX_FIFO_CONFIG_t fifo_is_used;
189 #if (!INV_IXM42XXX_LIGHTWEIGHT_DRIVER)
190 /* First FSYNC event after enable is irrelevant
191 * When the sensors are switched off and then on again, an FSYNC tag with incorrect FSYNC value can be generated
192 * on the next first ODR.
193 * Solution: FSYNC tag and FSYNC data should be ignored on this first ODR.
194 */
195 uint8_t fsync_to_be_ignored;
196 #endif
197
198 /* Accel Low Power could report with wrong ODR if internal counter for ODR changed overflowed
199 * WUOSC clock domain is informed through an 3bit counter that ODR
200 * has changed in RC/PLL mode. Every 8 event, this counter overflows
201 * and goes back to 0, same as 'no ODR changes', therefore previous ALP
202 * ODR is re-used.
203 * Solution: Keep track of ODR changes when WUOSC is disabled and perform dummy ODR changes when re-enabling WU after 8*n ODR changes.
204 */
205 uint32_t wu_off_acc_odr_changes;
206
207 uint8_t wom_smd_mask;
209 uint8_t wom_enable;
211 /* Software mirror of BW and AVG settings in hardware, to be re-applied on each enabling of sensor */
212 struct {
213 uint8_t acc_lp_avg;
214 uint8_t reserved;
215 uint8_t acc_ln_bw;
216 uint8_t gyr_ln_bw;
217 } avg_bw_setting;
218
219 uint64_t gyro_power_off_tmst;
220 };
221
222 /* Interrupt enum state for INT1, INT2, and IBI */
223 typedef enum{
224 INV_IXM42XXX_DISABLE = 0,
225 INV_IXM42XXX_ENABLE
226 }inv_ixm42xxx_interrupt_value;
227
230 typedef struct {
231 inv_ixm42xxx_interrupt_value INV_IXM42XXX_UI_FSYNC;
232 inv_ixm42xxx_interrupt_value INV_IXM42XXX_UI_DRDY;
233 inv_ixm42xxx_interrupt_value INV_IXM42XXX_FIFO_THS;
234 inv_ixm42xxx_interrupt_value INV_IXM42XXX_FIFO_FULL;
235 inv_ixm42xxx_interrupt_value INV_IXM42XXX_SMD;
236 inv_ixm42xxx_interrupt_value INV_IXM42XXX_WOM_X;
237 inv_ixm42xxx_interrupt_value INV_IXM42XXX_WOM_Y;
238 inv_ixm42xxx_interrupt_value INV_IXM42XXX_WOM_Z;
239 inv_ixm42xxx_interrupt_value INV_IXM42XXX_STEP_DET;
240 inv_ixm42xxx_interrupt_value INV_IXM42XXX_STEP_CNT_OVFL;
241 inv_ixm42xxx_interrupt_value INV_IXM42XXX_TILT_DET;
242 inv_ixm42xxx_interrupt_value INV_IXM42XXX_SLEEP_DET;
243 inv_ixm42xxx_interrupt_value INV_IXM42XXX_WAKE_DET;
244 inv_ixm42xxx_interrupt_value INV_IXM42XXX_TAP_DET;
245 }inv_ixm42xxx_interrupt_parameter_t;
246
251 int inv_ixm42xxx_set_reg_bank(struct inv_ixm42xxx * s, uint8_t bank);
252
289 int inv_ixm42xxx_init(struct inv_ixm42xxx * s, struct inv_ixm42xxx_serif * serif, void (*sensor_event_cb)(inv_ixm42xxx_sensor_event_t * event));
290
294 int inv_ixm42xxx_device_reset(struct inv_ixm42xxx * s);
295
300 int inv_ixm42xxx_get_who_am_i(struct inv_ixm42xxx * s, uint8_t * who_am_i);
301
309 int inv_ixm42xxx_force_clock_source(struct inv_ixm42xxx * s, IXM42XXX_INTF_CONFIG1_ACCEL_LP_CLK_t clk_src);
310
321 int inv_ixm42xxx_enable_accel_low_power_mode(struct inv_ixm42xxx * s);
322
333 int inv_ixm42xxx_enable_accel_low_noise_mode(struct inv_ixm42xxx * s);
334
344 int inv_ixm42xxx_disable_accel(struct inv_ixm42xxx * s);
345
356 int inv_ixm42xxx_enable_gyro_low_noise_mode(struct inv_ixm42xxx * s);
357
367 int inv_ixm42xxx_disable_gyro(struct inv_ixm42xxx * s);
368
378 int inv_ixm42xxx_enable_fsync(struct inv_ixm42xxx * s);
379
389 int inv_ixm42xxx_disable_fsync(struct inv_ixm42xxx * s);
390
396 int inv_ixm42xxx_configure_timestamp_resolution(struct inv_ixm42xxx * s, IXM42XXX_TMST_CONFIG_RESOL_t resol);
397
402 int inv_ixm42xxx_set_config_ibi(struct inv_ixm42xxx * s, inv_ixm42xxx_interrupt_parameter_t * interrupt_to_configure);
403
408 int inv_ixm42xxx_get_config_ibi(struct inv_ixm42xxx * s, inv_ixm42xxx_interrupt_parameter_t * interrupt_to_configure);
409
414 int inv_ixm42xxx_set_config_int1(struct inv_ixm42xxx * s, inv_ixm42xxx_interrupt_parameter_t * interrupt_to_configure);
415
420 int inv_ixm42xxx_get_config_int1(struct inv_ixm42xxx * s, inv_ixm42xxx_interrupt_parameter_t * interrupt_to_configure);
421
426 int inv_ixm42xxx_set_config_int2(struct inv_ixm42xxx * s, inv_ixm42xxx_interrupt_parameter_t * interrupt_to_configure);
427
432 int inv_ixm42xxx_get_config_int2(struct inv_ixm42xxx * s, inv_ixm42xxx_interrupt_parameter_t * interrupt_to_configure);
433
438 int inv_ixm42xxx_get_data_from_registers(struct inv_ixm42xxx * s);
439
446 int inv_ixm42xxx_get_data_from_fifo(struct inv_ixm42xxx * s);
447
452 uint32_t inv_ixm42xxx_convert_odr_bitfield_to_us(uint32_t odr_bitfield);
453
460 int inv_ixm42xxx_set_accel_frequency(struct inv_ixm42xxx * s, const IXM42XXX_ACCEL_CONFIG0_ODR_t frequency);
461
468 int inv_ixm42xxx_set_gyro_frequency(struct inv_ixm42xxx * s, const IXM42XXX_GYRO_CONFIG0_ODR_t frequency);
469
476 int inv_ixm42xxx_set_accel_fsr(struct inv_ixm42xxx * s, IXM42XXX_ACCEL_CONFIG0_FS_SEL_t accel_fsr_g);
477
484 int inv_ixm42xxx_get_accel_fsr(struct inv_ixm42xxx * s, IXM42XXX_ACCEL_CONFIG0_FS_SEL_t * accel_fsr_g);
485
492 int inv_ixm42xxx_set_gyro_fsr(struct inv_ixm42xxx * s, IXM42XXX_GYRO_CONFIG0_FS_SEL_t gyro_fsr_dps);
493
500 int inv_ixm42xxx_get_gyro_fsr(struct inv_ixm42xxx * s, IXM42XXX_GYRO_CONFIG0_FS_SEL_t * gyro_fsr_dps);
501
507 int inv_ixm42xxx_set_accel_lp_avg(struct inv_ixm42xxx * s, IXM42XXX_GYRO_ACCEL_CONFIG0_ACCEL_FILT_AVG_t acc_avg);
508
514 int inv_ixm42xxx_set_accel_ln_bw(struct inv_ixm42xxx * s, IXM42XXX_GYRO_ACCEL_CONFIG0_ACCEL_FILT_BW_t acc_bw);
515
521 int inv_ixm42xxx_set_gyro_ln_bw(struct inv_ixm42xxx * s, IXM42XXX_GYRO_ACCEL_CONFIG0_GYRO_FILT_BW_t gyr_bw);
522
526 int inv_ixm42xxx_reset_fifo(struct inv_ixm42xxx * s);
527
531 int inv_ixm42xxx_enable_timestamp_to_register(struct inv_ixm42xxx * s);
532
536 int inv_ixm42xxx_disable_timestamp_to_register(struct inv_ixm42xxx * s);
537
543 int inv_ixm42xxx_get_current_timestamp(struct inv_ixm42xxx * s, uint32_t * icm_time);
544
552 int inv_ixm42xxx_enable_clkin_rtc(struct inv_ixm42xxx * s, uint8_t enable);
553
560 int inv_ixm42xxx_get_clkin_rtc_status(struct inv_ixm42xxx * s);
561
565 int inv_ixm42xxx_enable_high_resolution_fifo(struct inv_ixm42xxx * s);
566
570 int inv_ixm42xxx_disable_high_resolution_fifo(struct inv_ixm42xxx * s);
571
578 int inv_ixm42xxx_configure_fifo(struct inv_ixm42xxx * s, INV_IXM42XXX_FIFO_CONFIG_t fifo_config);
579
583 int inv_ixm42xxx_configure_fifo_wm(struct inv_ixm42xxx * s, uint16_t wm);
584
588 uint32_t inv_ixm42xxx_get_fifo_timestamp_resolution_us_q24(struct inv_ixm42xxx * s);
589
593 uint32_t inv_ixm42xxx_get_reg_timestamp_resolution_us_q24(struct inv_ixm42xxx * s);
594
598 const char * inv_ixm42xxx_get_version(void);
599
600
601
602 #ifdef __cplusplus
603 }
604 #endif
605
606 #endif /* _INV_IXM42XXX_DRIVER_HL_H_ */
607
inv_ixm42xxx_configure_fifo_wm
int inv_ixm42xxx_configure_fifo_wm(struct inv_ixm42xxx *s, uint16_t wm)
Configure Fifo watermark (also refered to as fifo threshold)
Definition: Ixm42xxxDriver_HL.c:1514
IXM42XXX_GYRO_ACCEL_CONFIG0_GYRO_FILT_BW_t
IXM42XXX_GYRO_ACCEL_CONFIG0_GYRO_FILT_BW_t
Definition: Ixm42xxxDefs.h:848
inv_ixm42xxx_interrupt_parameter_t
Ixm42xxx set of interrupt enable flag.
Definition: Ixm42xxxDriver_HL.h:230
inv_ixm42xxx_interrupt_parameter_t::INV_IXM42XXX_WAKE_DET
inv_ixm42xxx_interrupt_value INV_IXM42XXX_WAKE_DET
Definition: Ixm42xxxDriver_HL.h:243
inv_ixm42xxx_disable_gyro
int inv_ixm42xxx_disable_gyro(struct inv_ixm42xxx *s)
Disable all 3 axes of gyro.
Definition: Ixm42xxxDriver_HL.c:485
inv_ixm42xxx_set_accel_frequency
int inv_ixm42xxx_set_accel_frequency(struct inv_ixm42xxx *s, const IXM42XXX_ACCEL_CONFIG0_ODR_t frequency)
Configure accel Output Data Rate.
Definition: Ixm42xxxDriver_HL.c:1127
inv_ixm42xxx::fifo_is_used
INV_IXM42XXX_FIFO_CONFIG_t fifo_is_used
Definition: Ixm42xxxDriver_HL.h:187
INV_IXM42XXX_SENSOR_MAX
@ INV_IXM42XXX_SENSOR_MAX
Definition: Ixm42xxxDriver_HL.h:140
INV_IXM42XXX_SENSOR_DMP_R2W
@ INV_IXM42XXX_SENSOR_DMP_R2W
Definition: Ixm42xxxDriver_HL.h:139
inv_ixm42xxx::accel_start_time_us
uint64_t accel_start_time_us
Definition: Ixm42xxxDriver_HL.h:184
inv_ixm42xxx_enable_accel_low_noise_mode
int inv_ixm42xxx_enable_accel_low_noise_mode(struct inv_ixm42xxx *s)
Enable/put accel in low noise mode.
Definition: Ixm42xxxDriver_HL.c:267
inv_ixm42xxx_get_accel_fsr
int inv_ixm42xxx_get_accel_fsr(struct inv_ixm42xxx *s, IXM42XXX_ACCEL_CONFIG0_FS_SEL_t *accel_fsr_g)
Access accel full scale range.
Definition: Ixm42xxxDriver_HL.c:1189
INV_IXM42XXX_ENABLE
@ INV_IXM42XXX_ENABLE
Definition: Ixm42xxxDriver_HL.h:225
inv_ixm42xxx_get_config_int2
int inv_ixm42xxx_get_config_int2(struct inv_ixm42xxx *s, inv_ixm42xxx_interrupt_parameter_t *interrupt_to_configure)
Retrieve interrupts configuration.
Definition: Ixm42xxxDriver_HL.c:653
Ixm42xxxDefs.h
inv_ixm42xxx
Ixm42xxx driver states definition.
Definition: Ixm42xxxDriver_HL.h:164
INV_IXM42XXX_SENSOR_TEMPERATURE
@ INV_IXM42XXX_SENSOR_TEMPERATURE
Definition: Ixm42xxxDriver_HL.h:133
inv_ixm42xxx::tmst_to_reg_en_cnt
uint8_t tmst_to_reg_en_cnt
Definition: Ixm42xxxDriver_HL.h:179
inv_ixm42xxx_set_accel_fsr
int inv_ixm42xxx_set_accel_fsr(struct inv_ixm42xxx *s, IXM42XXX_ACCEL_CONFIG0_FS_SEL_t accel_fsr_g)
Set accel full scale range.
Definition: Ixm42xxxDriver_HL.c:1165
inv_ixm42xxx_interrupt_parameter_t::INV_IXM42XXX_UI_FSYNC
inv_ixm42xxx_interrupt_value INV_IXM42XXX_UI_FSYNC
Definition: Ixm42xxxDriver_HL.h:231
inv_ixm42xxx_interrupt_parameter_t::INV_IXM42XXX_FIFO_THS
inv_ixm42xxx_interrupt_value INV_IXM42XXX_FIFO_THS
Definition: Ixm42xxxDriver_HL.h:233
inv_ixm42xxx::wu_off_acc_odr_changes
uint32_t wu_off_acc_odr_changes
Definition: Ixm42xxxDriver_HL.h:205
IXM42XXX_INTF_CONFIG1_ACCEL_LP_CLK_t
IXM42XXX_INTF_CONFIG1_ACCEL_LP_CLK_t
Definition: Ixm42xxxDefs.h:620
inv_ixm42xxx_sensor_event_t
Sensor event structure definition.
Definition: Ixm42xxxDriver_HL.h:152
inv_ixm42xxx_reset_fifo
int inv_ixm42xxx_reset_fifo(struct inv_ixm42xxx *s)
reset IXM42XXX fifo
Definition: Ixm42xxxDriver_HL.c:1270
inv_ixm42xxx_enable_accel_low_power_mode
int inv_ixm42xxx_enable_accel_low_power_mode(struct inv_ixm42xxx *s)
Enable/put accel in low power mode.
Definition: Ixm42xxxDriver_HL.c:158
INV_IXM42XXX_SENSOR_ACCEL
@ INV_IXM42XXX_SENSOR_ACCEL
Definition: Ixm42xxxDriver_HL.h:129
inv_ixm42xxx_configure_timestamp_resolution
int inv_ixm42xxx_configure_timestamp_resolution(struct inv_ixm42xxx *s, IXM42XXX_TMST_CONFIG_RESOL_t resol)
Configure timestamp resolution from FIFO.
Definition: Ixm42xxxDriver_HL.c:577
inv_ixm42xxx_interrupt_parameter_t::INV_IXM42XXX_WOM_X
inv_ixm42xxx_interrupt_value INV_IXM42XXX_WOM_X
Definition: Ixm42xxxDriver_HL.h:236
inv_ixm42xxx::acc_lp_avg
uint8_t acc_lp_avg
Definition: Ixm42xxxDriver_HL.h:213
inv_ixm42xxx_enable_fsync
int inv_ixm42xxx_enable_fsync(struct inv_ixm42xxx *s)
Enable fsync tagging functionnality. In details it:
Definition: Ixm42xxxDriver_HL.c:548
inv_ixm42xxx_interrupt_value
inv_ixm42xxx_interrupt_value
Definition: Ixm42xxxDriver_HL.h:223
IXM42XXX_GYRO_ACCEL_CONFIG0_ACCEL_FILT_BW_t
IXM42XXX_GYRO_ACCEL_CONFIG0_ACCEL_FILT_BW_t
Definition: Ixm42xxxDefs.h:826
INV_IXM42XXX_FIFO_CONFIG_t
INV_IXM42XXX_FIFO_CONFIG_t
Configure Fifo usage.
Definition: Ixm42xxxDriver_HL.h:145
inv_ixm42xxx_sensor_event_t::sensor_mask
int sensor_mask
Definition: Ixm42xxxDriver_HL.h:153
inv_ixm42xxx::fifo_highres_enabled
uint8_t fifo_highres_enabled
Definition: Ixm42xxxDriver_HL.h:186
inv_ixm42xxx_set_gyro_fsr
int inv_ixm42xxx_set_gyro_fsr(struct inv_ixm42xxx *s, IXM42XXX_GYRO_CONFIG0_FS_SEL_t gyro_fsr_dps)
Set gyro full scale range.
Definition: Ixm42xxxDriver_HL.c:1177
inv_ixm42xxx_disable_fsync
int inv_ixm42xxx_disable_fsync(struct inv_ixm42xxx *s)
Disable fsync tagging functionnality. In details it:
Definition: Ixm42xxxDriver_HL.c:562
inv_ixm42xxx::st_result
int st_result
Definition: Ixm42xxxDriver_HL.h:175
IXM42XXX_GYRO_CONFIG0_FS_SEL_t
IXM42XXX_GYRO_CONFIG0_FS_SEL_t
Gyroscope FSR selection.
Definition: Ixm42xxxDefs.h:694
inv_ixm42xxx_interrupt_parameter_t::INV_IXM42XXX_SLEEP_DET
inv_ixm42xxx_interrupt_value INV_IXM42XXX_SLEEP_DET
Definition: Ixm42xxxDriver_HL.h:242
inv_ixm42xxx::reserved
uint8_t reserved
Definition: Ixm42xxxDriver_HL.h:214
inv_ixm42xxx::wom_smd_mask
uint8_t wom_smd_mask
Definition: Ixm42xxxDriver_HL.h:207
inv_ixm42xxx::accel_st_bias
int accel_st_bias[3]
Definition: Ixm42xxxDriver_HL.h:174
inv_ixm42xxx_interrupt_parameter_t::INV_IXM42XXX_STEP_CNT_OVFL
inv_ixm42xxx_interrupt_value INV_IXM42XXX_STEP_CNT_OVFL
Definition: Ixm42xxxDriver_HL.h:240
inv_ixm42xxx_interrupt_parameter_t::INV_IXM42XXX_TILT_DET
inv_ixm42xxx_interrupt_value INV_IXM42XXX_TILT_DET
Definition: Ixm42xxxDriver_HL.h:241
inv_ixm42xxx::acc_ln_bw
uint8_t acc_ln_bw
Definition: Ixm42xxxDriver_HL.h:215
inv_ixm42xxx_get_clkin_rtc_status
int inv_ixm42xxx_get_clkin_rtc_status(struct inv_ixm42xxx *s)
Get CLKIN/RTC feature status.
Definition: Ixm42xxxDriver_HL.c:1396
IXM42XXX_FIFO_MIRRORING_SIZE
#define IXM42XXX_FIFO_MIRRORING_SIZE
Ixm42xxx maximum buffer size mirrored from FIFO at polling time.
Definition: Ixm42xxxDriver_HL.h:111
inv_ixm42xxx_interrupt_parameter_t::INV_IXM42XXX_SMD
inv_ixm42xxx_interrupt_value INV_IXM42XXX_SMD
Definition: Ixm42xxxDriver_HL.h:235
inv_ixm42xxx::fifo_data
uint8_t fifo_data[IXM42XXX_FIFO_MIRRORING_SIZE]
Definition: Ixm42xxxDriver_HL.h:177
INV_IXM42XXX_FIFO_DISABLED
@ INV_IXM42XXX_FIFO_DISABLED
Definition: Ixm42xxxDriver_HL.h:146
INV_IXM42XXX_SENSOR_OIS
@ INV_IXM42XXX_SENSOR_OIS
Definition: Ixm42xxxDriver_HL.h:132
inv_ixm42xxx_configure_fifo
int inv_ixm42xxx_configure_fifo(struct inv_ixm42xxx *s, INV_IXM42XXX_FIFO_CONFIG_t fifo_config)
Configure Fifo to select the way data are gathered.
Definition: Ixm42xxxDriver_HL.c:1442
inv_ixm42xxx_set_accel_lp_avg
int inv_ixm42xxx_set_accel_lp_avg(struct inv_ixm42xxx *s, IXM42XXX_GYRO_ACCEL_CONFIG0_ACCEL_FILT_AVG_t acc_avg)
Set accel Low-Power averaging value.
Definition: Ixm42xxxDriver_HL.c:1219
inv_ixm42xxx_set_accel_ln_bw
int inv_ixm42xxx_set_accel_ln_bw(struct inv_ixm42xxx *s, IXM42XXX_GYRO_ACCEL_CONFIG0_ACCEL_FILT_BW_t acc_bw)
Set accel Low-Noise bandwidth value.
Definition: Ixm42xxxDriver_HL.c:1236
inv_ixm42xxx_interrupt_parameter_t::INV_IXM42XXX_FIFO_FULL
inv_ixm42xxx_interrupt_value INV_IXM42XXX_FIFO_FULL
Definition: Ixm42xxxDriver_HL.h:234
Ixm42xxxTransport.h
inv_ixm42xxx_interrupt_parameter_t::INV_IXM42XXX_WOM_Z
inv_ixm42xxx_interrupt_value INV_IXM42XXX_WOM_Z
Definition: Ixm42xxxDriver_HL.h:238
inv_ixm42xxx_get_version
const char * inv_ixm42xxx_get_version(void)
Return driver version x.y.z-suffix as a char array.
Definition: Ixm42xxxDriver_HL.c:1621
inv_ixm42xxx_disable_accel
int inv_ixm42xxx_disable_accel(struct inv_ixm42xxx *s)
Disable all 3 axes of accel.
Definition: Ixm42xxxDriver_HL.c:345
inv_ixm42xxx_get_config_int1
int inv_ixm42xxx_get_config_int1(struct inv_ixm42xxx *s, inv_ixm42xxx_interrupt_parameter_t *interrupt_to_configure)
Retrieve interrupts configuration.
Definition: Ixm42xxxDriver_HL.c:620
inv_ixm42xxx_device_reset
int inv_ixm42xxx_device_reset(struct inv_ixm42xxx *s)
Perform a soft reset of the device.
Definition: Ixm42xxxDriver_HL.c:79
inv_ixm42xxx_interrupt_parameter_t::INV_IXM42XXX_UI_DRDY
inv_ixm42xxx_interrupt_value INV_IXM42XXX_UI_DRDY
Definition: Ixm42xxxDriver_HL.h:232
inv_ixm42xxx::dmp_is_on
uint8_t dmp_is_on
Definition: Ixm42xxxDriver_HL.h:181
inv_ixm42xxx_interrupt_parameter_t::INV_IXM42XXX_WOM_Y
inv_ixm42xxx_interrupt_value INV_IXM42XXX_WOM_Y
Definition: Ixm42xxxDriver_HL.h:237
inv_ixm42xxx_transport
transport interface
Definition: Ixm42xxxTransport.h:73
INV_IXM42XXX_SENSOR_DMP_PEDOMETER_EVENT
@ INV_IXM42XXX_SENSOR_DMP_PEDOMETER_EVENT
Definition: Ixm42xxxDriver_HL.h:136
inv_ixm42xxx::sensor_event_cb
void(* sensor_event_cb)(inv_ixm42xxx_sensor_event_t *event)
Definition: Ixm42xxxDriver_HL.h:168
inv_ixm42xxx::avg_bw_setting
struct inv_ixm42xxx::@0 avg_bw_setting
inv_ixm42xxx_get_gyro_fsr
int inv_ixm42xxx_get_gyro_fsr(struct inv_ixm42xxx *s, IXM42XXX_GYRO_CONFIG0_FS_SEL_t *gyro_fsr_dps)
Access gyro full scale range.
Definition: Ixm42xxxDriver_HL.c:1204
INV_IXM42XXX_DISABLE
@ INV_IXM42XXX_DISABLE
Definition: Ixm42xxxDriver_HL.h:224
inv_ixm42xxx_interrupt_parameter_t::INV_IXM42XXX_TAP_DET
inv_ixm42xxx_interrupt_value INV_IXM42XXX_TAP_DET
Definition: Ixm42xxxDriver_HL.h:244
inv_ixm42xxx_get_current_timestamp
int inv_ixm42xxx_get_current_timestamp(struct inv_ixm42xxx *s, uint32_t *icm_time)
Get the timestamp value of ixm42xxx from register.
Definition: Ixm42xxxDriver_HL.c:1341
inv_ixm42xxx_serif
basesensor serial interface
Definition: Ixm42xxxTransport.h:61
inv_ixm42xxx_disable_timestamp_to_register
int inv_ixm42xxx_disable_timestamp_to_register(struct inv_ixm42xxx *s)
Disable the 20bits-timestamp register access. Register read always return 0's.
Definition: Ixm42xxxDriver_HL.c:1324
inv_ixm42xxx::wom_enable
uint8_t wom_enable
Definition: Ixm42xxxDriver_HL.h:209
inv_ixm42xxx_get_who_am_i
int inv_ixm42xxx_get_who_am_i(struct inv_ixm42xxx *s, uint8_t *who_am_i)
return WHOAMI value
Definition: Ixm42xxxDriver_HL.c:138
inv_ixm42xxx_set_gyro_frequency
int inv_ixm42xxx_set_gyro_frequency(struct inv_ixm42xxx *s, const IXM42XXX_GYRO_CONFIG0_ODR_t frequency)
Configure gyro Output Data Rate.
Definition: Ixm42xxxDriver_HL.c:1153
inv_ixm42xxx::fsync_to_be_ignored
uint8_t fsync_to_be_ignored
Definition: Ixm42xxxDriver_HL.h:195
inv_ixm42xxx::transport
struct inv_ixm42xxx_transport transport
Definition: Ixm42xxxDriver_HL.h:165
INV_IXM42XXX_SENSOR_TAP
@ INV_IXM42XXX_SENSOR_TAP
Definition: Ixm42xxxDriver_HL.h:135
IXM42XXX_GYRO_CONFIG0_ODR_t
IXM42XXX_GYRO_CONFIG0_ODR_t
Gyroscope ODR selection.
Definition: Ixm42xxxDefs.h:723
inv_ixm42xxx_disable_high_resolution_fifo
int inv_ixm42xxx_disable_high_resolution_fifo(struct inv_ixm42xxx *s)
Disable 20 bits raw acc and raw gyr data in fifo.
Definition: Ixm42xxxDriver_HL.c:1425
inv_ixm42xxx::gyr_ln_bw
uint8_t gyr_ln_bw
Definition: Ixm42xxxDriver_HL.h:216
inv_ixm42xxx_get_data_from_fifo
int inv_ixm42xxx_get_data_from_fifo(struct inv_ixm42xxx *s)
Read all available packets from the FIFO. For each packet function builds a sensor event containing p...
Definition: Ixm42xxxDriver_HL.c:877
inv_ixm42xxx_get_config_ibi
int inv_ixm42xxx_get_config_ibi(struct inv_ixm42xxx *s, inv_ixm42xxx_interrupt_parameter_t *interrupt_to_configure)
Retrieve interrupts configuration.
Definition: Ixm42xxxDriver_HL.c:590
IXM42XXX_ACCEL_CONFIG0_ODR_t
IXM42XXX_ACCEL_CONFIG0_ODR_t
Accelerometer ODR selection.
Definition: Ixm42xxxDefs.h:773
IXM42XXX_ACCEL_CONFIG0_FS_SEL_t
IXM42XXX_ACCEL_CONFIG0_FS_SEL_t
Accelerometer FSR selection.
Definition: Ixm42xxxDefs.h:750
inv_ixm42xxx_enable_gyro_low_noise_mode
int inv_ixm42xxx_enable_gyro_low_noise_mode(struct inv_ixm42xxx *s)
Enable/put gyro in low noise mode.
Definition: Ixm42xxxDriver_HL.c:391
INV_IXM42XXX_FIFO_ENABLED
@ INV_IXM42XXX_FIFO_ENABLED
Definition: Ixm42xxxDriver_HL.h:147
INV_IXM42XXX_SENSOR_DMP_TILT
@ INV_IXM42XXX_SENSOR_DMP_TILT
Definition: Ixm42xxxDriver_HL.h:138
inv_ixm42xxx::gyro_st_bias
int gyro_st_bias[3]
Definition: Ixm42xxxDriver_HL.h:173
inv_ixm42xxx_sensor_event_t::temperature
int16_t temperature
Definition: Ixm42xxxDriver_HL.h:157
inv_ixm42xxx_convert_odr_bitfield_to_us
uint32_t inv_ixm42xxx_convert_odr_bitfield_to_us(uint32_t odr_bitfield)
Converts IXM42XXX_ACCEL_CONFIG0_ODR_t or IXM42XXX_GYRO_CONFIG0_ODR_t enums to period expressed in us.
Definition: Ixm42xxxDriver_HL.c:1085
inv_ixm42xxx_set_config_int2
int inv_ixm42xxx_set_config_int2(struct inv_ixm42xxx *s, inv_ixm42xxx_interrupt_parameter_t *interrupt_to_configure)
Configure which interrupt source can trigger INT2.
Definition: Ixm42xxxDriver_HL.c:780
inv_ixm42xxx_set_gyro_ln_bw
int inv_ixm42xxx_set_gyro_ln_bw(struct inv_ixm42xxx *s, IXM42XXX_GYRO_ACCEL_CONFIG0_GYRO_FILT_BW_t gyr_bw)
Set gyro Low-Noise bandwidth value.
Definition: Ixm42xxxDriver_HL.c:1253
inv_ixm42xxx_sensor
inv_ixm42xxx_sensor
Sensor identifier for UI control and OIS function.
Definition: Ixm42xxxDriver_HL.h:128
inv_ixm42xxx_set_reg_bank
int inv_ixm42xxx_set_reg_bank(struct inv_ixm42xxx *s, uint8_t bank)
Set register bank index.
Definition: Ixm42xxxDriver_HL.c:35
IXM42XXX_TMST_CONFIG_RESOL_t
IXM42XXX_TMST_CONFIG_RESOL_t
Definition: Ixm42xxxDefs.h:899
inv_ixm42xxx_sensor_event_t::timestamp_fsync
uint16_t timestamp_fsync
Definition: Ixm42xxxDriver_HL.h:154
inv_ixm42xxx_enable_timestamp_to_register
int inv_ixm42xxx_enable_timestamp_to_register(struct inv_ixm42xxx *s)
Enable the 20bits-timestamp register access to read in a reliable way the strobed timestamp....
Definition: Ixm42xxxDriver_HL.c:1303
inv_ixm42xxx_get_reg_timestamp_resolution_us_q24
uint32_t inv_ixm42xxx_get_reg_timestamp_resolution_us_q24(struct inv_ixm42xxx *s)
Get register timestamp resolution.
Definition: Ixm42xxxDriver_HL.c:1604
INV_IXM42XXX_SENSOR_DMP_PEDOMETER_COUNT
@ INV_IXM42XXX_SENSOR_DMP_PEDOMETER_COUNT
Definition: Ixm42xxxDriver_HL.h:137
inv_ixm42xxx_get_data_from_registers
int inv_ixm42xxx_get_data_from_registers(struct inv_ixm42xxx *s)
Read all registers containing data (tempereature, accelerometer and gyroscope). Then it calls sensor_...
Definition: Ixm42xxxDriver_HL.c:830
inv_ixm42xxx::gyro_start_time_us
uint64_t gyro_start_time_us
Definition: Ixm42xxxDriver_HL.h:183
IXM42XXX_GYRO_ACCEL_CONFIG0_ACCEL_FILT_AVG_t
IXM42XXX_GYRO_ACCEL_CONFIG0_ACCEL_FILT_AVG_t
Definition: Ixm42xxxDefs.h:838
inv_ixm42xxx_get_fifo_timestamp_resolution_us_q24
uint32_t inv_ixm42xxx_get_fifo_timestamp_resolution_us_q24(struct inv_ixm42xxx *s)
Get FIFO timestamp resolution.
Definition: Ixm42xxxDriver_HL.c:1572
INV_IXM42XXX_SENSOR_FSYNC_EVENT
@ INV_IXM42XXX_SENSOR_FSYNC_EVENT
Definition: Ixm42xxxDriver_HL.h:131
inv_ixm42xxx_init
int inv_ixm42xxx_init(struct inv_ixm42xxx *s, struct inv_ixm42xxx_serif *serif, void(*sensor_event_cb)(inv_ixm42xxx_sensor_event_t *event))
Configure the serial interface used to access the device and execute hardware initialization.
Definition: Ixm42xxxDriver_HL.c:40
inv_ixm42xxx::gyro_power_off_tmst
uint64_t gyro_power_off_tmst
Definition: Ixm42xxxDriver_HL.h:219
inv_ixm42xxx::endianess_data
uint8_t endianess_data
Definition: Ixm42xxxDriver_HL.h:185
INV_IXM42XXX_SENSOR_GYRO
@ INV_IXM42XXX_SENSOR_GYRO
Definition: Ixm42xxxDriver_HL.h:130
inv_ixm42xxx_set_config_int1
int inv_ixm42xxx_set_config_int1(struct inv_ixm42xxx *s, inv_ixm42xxx_interrupt_parameter_t *interrupt_to_configure)
Configure which interrupt source can trigger INT1.
Definition: Ixm42xxxDriver_HL.c:730
inv_ixm42xxx_enable_high_resolution_fifo
int inv_ixm42xxx_enable_high_resolution_fifo(struct inv_ixm42xxx *s)
Enable 20 bits raw acc and raw gyr data in fifo.
Definition: Ixm42xxxDriver_HL.c:1408
inv_ixm42xxx_set_config_ibi
int inv_ixm42xxx_set_config_ibi(struct inv_ixm42xxx *s, inv_ixm42xxx_interrupt_parameter_t *interrupt_to_configure)
Configure which interrupt source can trigger ibi interruptions.
Definition: Ixm42xxxDriver_HL.c:686
inv_ixm42xxx_enable_clkin_rtc
int inv_ixm42xxx_enable_clkin_rtc(struct inv_ixm42xxx *s, uint8_t enable)
Enable or disable CLKIN/RTC capability.
Definition: Ixm42xxxDriver_HL.c:1359
inv_ixm42xxx_force_clock_source
int inv_ixm42xxx_force_clock_source(struct inv_ixm42xxx *s, IXM42XXX_INTF_CONFIG1_ACCEL_LP_CLK_t clk_src)
Configure Accel clock source.
Definition: Ixm42xxxDriver_HL.c:143
inv_ixm42xxx_interrupt_parameter_t::INV_IXM42XXX_STEP_DET
inv_ixm42xxx_interrupt_value INV_IXM42XXX_STEP_DET
Definition: Ixm42xxxDriver_HL.h:239