| ICM42605 eMD Driver 2.0.9 Documentation of the eMD Driver API

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

Files | Classes | Macros | Enumerations | Functions
Driver

High-level API to drive the device. More...

## Files
file | Icm426xxDriver_HL.h

## Classes
struct | inv_icm426xx_sensor_event_t
| Sensor event structure definition. More...
struct | inv_icm426xx
| Icm426xx driver states definition. More...
struct | inv_icm426xx_interrupt_parameter_t
| Icm426xx set of interrupt enable flag. More...

## Macros
#define | INV_ICM426XX_LIGHTWEIGHT_DRIVER 0
| Lighten driver logic by stripping out procedures on transitions. More...
#define | PLL_SCALE_FACTOR_Q24 (1UL << 24)
| Scale factor and max ODR Dependant of chip. More...
#define | ICM_PART_DEFAULT_OIS_MODE ICM426XX_SENSOR_CONFIG2_OIS_MODE_8KHZ
#define | ACCEL_CONFIG0_FS_SEL_MAX ICM426XX_ACCEL_CONFIG0_FS_SEL_16g
| Max FSR values for accel and gyro Dependant of chip. More...
#define | GYRO_CONFIG0_FS_SEL_MAX ICM426XX_GYRO_CONFIG0_FS_SEL_2000dps
#define | ACCEL_OFFUSER_MAX_MG 1000
#define | GYRO_OFFUSER_MAX_DPS 64
#define | RTC_SUPPORTED 0
| RTC Support flag Define whether the RTC mode is supported Dependant of chip. More...
#define | ICM426XX_FIFO_MIRRORING_SIZE 16 * 129
| Icm426xx maximum buffer size mirrored from FIFO at polling time. More...
#define | ICM426XX_DEFAULT_WOM_THS_MG 52 >> 2 /* = 52mg/4 */
| Default value for the WOM threshold Resolution of the threshold is ~= 4mg. More...
#define | ICM426XX_ACC_STARTUP_TIME_US 20000U
| Icm426xx Accelerometer start-up time before having correct data. More...
#define | ICM426XX_GYR_STARTUP_TIME_US 60000U
| Icm426xx Gyroscope start-up time before having correct data. More...

## Enumerations
enum | inv_icm426xx_sensor { INV_ICM426XX_SENSOR_ACCEL , INV_ICM426XX_SENSOR_GYRO , INV_ICM426XX_SENSOR_FSYNC_EVENT , INV_ICM426XX_SENSOR_OIS , INV_ICM426XX_SENSOR_TEMPERATURE , INV_ICM426XX_SENSOR_TAP , INV_ICM426XX_SENSOR_DMP_PEDOMETER_EVENT , INV_ICM426XX_SENSOR_DMP_PEDOMETER_COUNT , INV_ICM426XX_SENSOR_DMP_TILT , INV_ICM426XX_SENSOR_MAX }
| Sensor identifier for UI control and OIS function. More...
enum | INV_ICM426XX_FIFO_CONFIG_t { INV_ICM426XX_FIFO_DISABLED = 0 , INV_ICM426XX_FIFO_ENABLED = 1 }
| Configure Fifo usage. More...
enum | inv_icm426xx_interrupt_value { INV_ICM426XX_DISABLE = 0 , INV_ICM426XX_ENABLE }

## Functions
int | inv_icm426xx_set_reg_bank (struct inv_icm426xx *s, uint8_t bank)
| Set register bank index. More...
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. More...
int | inv_icm426xx_device_reset (struct inv_icm426xx *s)
| Perform a soft reset of the device. More...
int | inv_icm426xx_get_who_am_i (struct inv_icm426xx *s, uint8_t *who_am_i)
| return WHOAMI value More...
int | inv_icm426xx_force_clock_source (struct inv_icm426xx *s, ICM426XX_INTF_CONFIG1_ACCEL_LP_CLK_t clk_src)
| Configure Accel clock source. More...
int | inv_icm426xx_enable_accel_low_power_mode (struct inv_icm426xx *s)
| Enable accel in low power mode. More...
int | inv_icm426xx_enable_accel_low_noise_mode (struct inv_icm426xx *s)
| Enable accel in low noise mode. More...
int | inv_icm426xx_disable_accel (struct inv_icm426xx *s)
| Disable accel. More...
int | inv_icm426xx_enable_gyro_low_noise_mode (struct inv_icm426xx *s)
| Enable gyro in low noise mode. More...
int | inv_icm426xx_disable_gyro (struct inv_icm426xx *s)
| Disable gyro. More...
int | inv_icm426xx_enable_fsync (struct inv_icm426xx *s)
| Enable fsync tagging functionality. More...
int | inv_icm426xx_disable_fsync (struct inv_icm426xx *s)
| Disable fsync tagging functionality. More...
int | inv_icm426xx_configure_timestamp_resolution (struct inv_icm426xx *s, ICM426XX_TMST_CONFIG_RESOL_t resol)
| Configure timestamp resolution from FIFO. More...
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. More...
int | inv_icm426xx_get_config_ibi (struct inv_icm426xx *s, inv_icm426xx_interrupt_parameter_t *interrupt_to_configure)
| Retrieve interrupts configuration. More...
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. More...
int | inv_icm426xx_get_config_int1 (struct inv_icm426xx *s, inv_icm426xx_interrupt_parameter_t *interrupt_to_configure)
| Retrieve interrupts configuration. More...
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. More...
int | inv_icm426xx_get_config_int2 (struct inv_icm426xx *s, inv_icm426xx_interrupt_parameter_t *interrupt_to_configure)
| Retrieve interrupts configuration. More...
int | inv_icm426xx_get_data_from_registers (struct inv_icm426xx *s)
| Read all registers containing data (temperature, accelerometer and gyroscope). More...
int | inv_icm426xx_get_data_from_fifo (struct inv_icm426xx *s)
| Read all available packets from the FIFO. More...
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. More...
int | inv_icm426xx_set_accel_frequency (struct inv_icm426xx *s, const ICM426XX_ACCEL_CONFIG0_ODR_t frequency)
| Configure accel Output Data Rate. More...
int | inv_icm426xx_set_gyro_frequency (struct inv_icm426xx *s, const ICM426XX_GYRO_CONFIG0_ODR_t frequency)
| Configure gyro Output Data Rate. More...
int | inv_icm426xx_set_accel_fsr (struct inv_icm426xx *s, ICM426XX_ACCEL_CONFIG0_FS_SEL_t accel_fsr_g)
| Set accel full scale range. More...
int | inv_icm426xx_get_accel_fsr (struct inv_icm426xx *s, ICM426XX_ACCEL_CONFIG0_FS_SEL_t *accel_fsr_g)
| Access accel full scale range. More...
int | inv_icm426xx_set_gyro_fsr (struct inv_icm426xx *s, ICM426XX_GYRO_CONFIG0_FS_SEL_t gyro_fsr_dps)
| Set gyro full scale range. More...
int | inv_icm426xx_get_gyro_fsr (struct inv_icm426xx *s, ICM426XX_GYRO_CONFIG0_FS_SEL_t *gyro_fsr_dps)
| Access gyro full scale range. More...
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. More...
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. More...
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. More...
int | inv_icm426xx_reset_fifo (struct inv_icm426xx *s)
| reset ICM426XX fifo More...
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. More...
int | inv_icm426xx_disable_timestamp_to_register (struct inv_icm426xx *s)
| Disable the 20bits-timestamp register access. More...
int | inv_icm426xx_get_current_timestamp (struct inv_icm426xx *s, uint32_t *icm_time)
| Get the timestamp value of icm426xx from register. More...
int | inv_icm426xx_enable_clkin_rtc (struct inv_icm426xx *s, uint8_t enable)
| Enable or disable CLKIN/RTC capability. More...
int | inv_icm426xx_get_clkin_rtc_status (struct inv_icm426xx *s)
| Get CLKIN/RTC feature status. More...
int | inv_icm426xx_enable_high_resolution_fifo (struct inv_icm426xx *s)
| Enable 20 bits raw acc and raw gyr data in fifo. More...
int | inv_icm426xx_disable_high_resolution_fifo (struct inv_icm426xx *s)
| Disable 20 bits raw acc and raw gyr data in fifo. More...
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. More...
int | inv_icm426xx_configure_fifo_wm (struct inv_icm426xx *s, uint16_t wm)
| Configure Fifo watermark (also referred to as fifo threshold). More...
uint32_t | inv_icm426xx_get_fifo_timestamp_resolution_us_q24 (struct inv_icm426xx *s)
| Get FIFO timestamp resolution. More...
uint32_t | inv_icm426xx_get_reg_timestamp_resolution_us_q24 (struct inv_icm426xx *s)
| Get register timestamp resolution. More...
const char * | inv_icm426xx_get_version (void)
| Return driver version x.y.z-suffix as a char array. More...

## Detailed Description

High-level API to drive the device.

## Macro Definition Documentation

## ◆ ACCEL_CONFIG0_FS_SEL_MAX

#define ACCEL_CONFIG0_FS_SEL_MAX ICM426XX_ACCEL_CONFIG0_FS_SEL_16g

Max FSR values for accel and gyro Dependant of chip.

## ◆ ACCEL_OFFUSER_MAX_MG

#define ACCEL_OFFUSER_MAX_MG 1000

## ◆ GYRO_CONFIG0_FS_SEL_MAX

#define GYRO_CONFIG0_FS_SEL_MAX ICM426XX_GYRO_CONFIG0_FS_SEL_2000dps

## ◆ GYRO_OFFUSER_MAX_DPS

#define GYRO_OFFUSER_MAX_DPS 64

## ◆ ICM426XX_ACC_STARTUP_TIME_US

#define ICM426XX_ACC_STARTUP_TIME_US 20000U

Icm426xx Accelerometer start-up time before having correct data.

## ◆ ICM426XX_DEFAULT_WOM_THS_MG

#define ICM426XX_DEFAULT_WOM_THS_MG 52 >> 2 /* = 52mg/4 */

Default value for the WOM threshold Resolution of the threshold is ~= 4mg.

## ◆ ICM426XX_FIFO_MIRRORING_SIZE

#define ICM426XX_FIFO_MIRRORING_SIZE 16 * 129

Icm426xx maximum buffer size mirrored from FIFO at polling time.

Warning
  fifo_idx type variable must be large enough to parse the FIFO_MIRRORING_SIZE

## ◆ ICM426XX_GYR_STARTUP_TIME_US

#define ICM426XX_GYR_STARTUP_TIME_US 60000U

Icm426xx Gyroscope start-up time before having correct data.

## ◆ ICM_PART_DEFAULT_OIS_MODE

#define ICM_PART_DEFAULT_OIS_MODE ICM426XX_SENSOR_CONFIG2_OIS_MODE_8KHZ

## ◆ INV_ICM426XX_LIGHTWEIGHT_DRIVER

#define INV_ICM426XX_LIGHTWEIGHT_DRIVER 0

Lighten driver logic by stripping out procedures on transitions.

In the nominal case, ie. when sensors are enabled and their output has settled, ICM-426XX will not need the logic to handle each transition. They are part of each API function so this code will be linked in regardless. This might not be desirable for the most size-constrained platforms and it can be avoided by setting this define to 1.

## ◆ PLL_SCALE_FACTOR_Q24

#define PLL_SCALE_FACTOR_Q24 (1UL << 24)

Scale factor and max ODR Dependant of chip.

## ◆ RTC_SUPPORTED

#define RTC_SUPPORTED 0

RTC Support flag Define whether the RTC mode is supported Dependant of chip.

## Enumeration Type Documentation

## ◆ INV_ICM426XX_FIFO_CONFIG_t

enum INV_ICM426XX_FIFO_CONFIG_t

Configure Fifo usage.

Enumerator
INV_ICM426XX_FIFO_DISABLED | Fifo is disabled and data source is sensors registers.
INV_ICM426XX_FIFO_ENABLED | Fifo is used as data source.

## ◆ inv_icm426xx_interrupt_value

enum inv_icm426xx_interrupt_value

Enumerator
INV_ICM426XX_DISABLE |
INV_ICM426XX_ENABLE |

## ◆ inv_icm426xx_sensor

enum inv_icm426xx_sensor

Sensor identifier for UI control and OIS function.

Enumerator
INV_ICM426XX_SENSOR_ACCEL | Accelerometer (UI control path)
INV_ICM426XX_SENSOR_GYRO | Gyroscope (UI control path)
INV_ICM426XX_SENSOR_FSYNC_EVENT | Used by OIS and UI control layers.
INV_ICM426XX_SENSOR_OIS | Only used by OIS layer.
INV_ICM426XX_SENSOR_TEMPERATURE | Chip temperature, enabled by default. Will be reported only if Accel and/or Gyro are also enabled. The Temperature's ODR (Output Data Rate) will match the ODR of Accel or Gyro, or the fastest if both are enabled
INV_ICM426XX_SENSOR_TAP | Tap and Double tap.
INV_ICM426XX_SENSOR_DMP_PEDOMETER_EVENT | Pedometer: step is detected.
INV_ICM426XX_SENSOR_DMP_PEDOMETER_COUNT | Pedometer: step counter.
INV_ICM426XX_SENSOR_DMP_TILT | Tilt.
INV_ICM426XX_SENSOR_MAX |

## Function Documentation

## ◆ 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.

Parameters

  [in] | s | Pointer to device.
  [in] | fifo_config | Fifo configuration method: If enabled data are coming from fifo and interrupt is configured on Fifo Watermark. If disabled data are coming from sensor registers and interrupt is configured on Data ready.

Returns
  0 on success, negative value on error.

## ◆ 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).

Parameters

  [in] | s | Pointer to device.
  [in] | wm | Watermark value.

Returns
  0 on success, negative value on error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.
  [in] | resol | The expected resolution of the timestamp. See enum ICM426XX_TMST_CONFIG_RESOL_t.

Returns
  0 on success, negative value on error.

Warning
  The resolution will have no effect if RTC is enabled

## ◆ 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.

Parameters

  [in] | odr_bitfield | An ICM426XX_ACCEL_CONFIG0_ODR_t or ICM426XX_GYRO_CONFIG0_ODR_t enum

Returns
  The corresponding period expressed in us

## ◆ inv_icm426xx_device_reset()

int inv_icm426xx_device_reset | ( | struct inv_icm426xx * | s | ) |

Perform a soft reset of the device.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_disable_accel()

int inv_icm426xx_disable_accel | ( | struct inv_icm426xx * | s | ) |

Disable accel.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_disable_fsync()

int inv_icm426xx_disable_fsync | ( | struct inv_icm426xx * | s | ) |

Disable fsync tagging functionality.

- disables fsync
- disables timestamp to registers. Once fysnc is disabled timestamp is pushed to fifo instead of fsync counter. So in order to decrease power consumption, timestamp is no more available in registers.
- disables fsync related interrupt
  Parameters

    [in] | s | Pointer to device.

  Returns
    0 on success, negative value on error.

## ◆ inv_icm426xx_disable_gyro()

int inv_icm426xx_disable_gyro | ( | struct inv_icm426xx * | s | ) |

Disable gyro.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_disable_timestamp_to_register()

int inv_icm426xx_disable_timestamp_to_register | ( | struct inv_icm426xx * | s | ) |

Disable the 20bits-timestamp register access.

Register read always return 0's.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_enable_clkin_rtc()

int inv_icm426xx_enable_clkin_rtc | ( | struct inv_icm426xx * | s,
|  | uint8_t | enable
| ) |  |

Enable or disable CLKIN/RTC capability.

Parameters

  [in] | s | Pointer to device.
  [in] | enable | 1 if external 32kHz is provided to ICM, 0 otherwise

Returns
  0 on success, negative value on error.

Warning
  In case CLKIN is disabled, it is recommended to call `inv_icm426xx_configure_timestamp_resolution` just afterwards so that timestamp resolution is in line with system request.

## ◆ inv_icm426xx_enable_fsync()

int inv_icm426xx_enable_fsync | ( | struct inv_icm426xx * | s | ) |

Enable fsync tagging functionality.

- enables fsync
- enables timestamp to registers. Once fysnc is enabled fsync counter is pushed to fifo instead of timestamp. So timestamp is made available in registers. Note that this increase power consumption.
- enables fsync related interrupt
  Parameters

    [in] | s | Pointer to device.

  Returns
    0 on success, negative value on error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ 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.

To do that, the fine clock is forced enabled at some power cost.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.
  [in] | clk_src | new clock source to use

Returns
  0 on success, negative value on error

Note
  Transitions when enabling/disabling sensors are already handled by the driver. This function forces a specific 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.

Parameters

  [in] | s | Pointer to device.
  [out] | accel_fsr_g | Current full scale range.

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_get_clkin_rtc_status()

int inv_icm426xx_get_clkin_rtc_status | ( | struct inv_icm426xx * | s | ) |

Get CLKIN/RTC feature status.

Parameters

  [in] | s | Pointer to device.

Returns
  0 if CLKIN is disabled, 1 if enabled.

Warning
  In case CLKIN is disabled, it is recommended to call `inv_icm426xx_configure_timestamp_resolution` just afterwards so that timestamp resolution is in line with system request.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.
  [in] | interrupt_to_configure | Structure with the corresponding state to manage IBI interruptions.

Returns
  0 on success, negative value on error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.
  [in] | interrupt_to_configure | Structure with the corresponding state to manage INT1.

Returns
  0 on success, negative value on error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.
  [in] | interrupt_to_configure | Structure with the corresponding state to manage INT2.

Returns
  0 on success, negative value on error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.
  [in] | icm_time | Timestamp read from register.

Returns
  0 on success, negative value on error.

Warning
  Timestamp register must be enabled before calling this API (see `inv_icm426xx_enable_timestamp_to_register` function)

## ◆ inv_icm426xx_get_data_from_fifo()

int inv_icm426xx_get_data_from_fifo | ( | struct inv_icm426xx * | s | ) |

Read all available packets from the FIFO.

For each packet function builds a sensor event containing packet data and validity information. Then calls `sensor_event_cb` function for each packet.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ 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).

Then calls `sensor_event_cb` function for each packet.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.

Returns
  The timestamp resolution in us as a q24 or 0 in case of error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.
  [out] | gyro_fsr_dps | Current full scale range.

Returns
  0 on success, negative value on error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.

Returns
  The timestamp resolution in us as a q24 or 0 in case of error.

## ◆ inv_icm426xx_get_version()

const char* inv_icm426xx_get_version | ( | void |  | ) |

Return driver version x.y.z-suffix as a char array.

Returns
  Driver version a char array "x.y.z-suffix".

## ◆ 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

Parameters

  [in] | s | Pointer to device.
  [out] | who_am_i | WHOAMI for device

Returns
  0 on success, negative value on error

## ◆ inv_icm426xx_init()

int inv_icm426xx_init | ( | struct inv_icm426xx * | s,
|  | struct inv_icm426xx_serif * | serif,
|  | void(*)(inv_icm426xx_sensor_event_t *event) | sensor_event_cb
| ) |  |

Initializes device.

Parameters

  [in] | s | Pointer to device.
  [in] | serif | Pointer on serial interface structure to be used to access icm426xx.
  [in] | sensor_event_cb | Callback executed when reading data from FIFO or registers. Can be NULL if `inv_icm426xx_get_data_from_fifo` and `inv_icm426xx_get_data_from_registers` are not used by the application.

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_reset_fifo()

int inv_icm426xx_reset_fifo | ( | struct inv_icm426xx * | s | ) |

reset ICM426XX fifo

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.
  [in] | frequency | The requested frequency.

Returns
  0 on success, negative value on error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.
  [in] | accel_fsr_g | Requested full scale range.

Returns
  0 on success, negative value on error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.
  [in] | acc_bw | Requested averaging value

Returns
  0 on success, negative value on error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.
  [in] | acc_avg | Requested averaging value

Returns
  0 on success, negative value on error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.
  [in] | interrupt_to_configure | Structure with the corresponding state to manage IBI interruptions.

Returns
  0 on success, negative value on error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.
  [in] | interrupt_to_configure | Structure with the corresponding state to manage INT1.

Returns
  0 on success, negative value on error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.
  [in] | interrupt_to_configure | Structure with the corresponding state to INT2.

Returns
  0 on success, negative value on error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.
  [in] | frequency | The requested frequency.

Returns
  0 on success, negative value on error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.
  [in] | gyro_fsr_dps | Requested full scale range.

Returns
  0 on success, negative value on error.

## ◆ 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.

Parameters

  [in] | s | Pointer to device.
  [in] | gyr_bw | Requested averaging value

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_set_reg_bank()

int inv_icm426xx_set_reg_bank | ( | struct inv_icm426xx * | s,
|  | uint8_t | bank
| ) |  |

Set register bank index.

Parameters

  [in] | s | Pointer to device.
  [in] | bank | New bank to be set.

Returns
  0 on success, negative value on error.