| eMD IIM4265x Driver API 1.0.0

Files | Data Structures | Macros | Enumerations | Functions
Ixm42xxx driver high level functions

High-level function to setup an Ixm42xxx device. More...

## Files
file | Ixm42xxxDriver_HL.h

## Data Structures
struct | inv_ixm42xxx_sensor_event_t
| Sensor event structure definition. More...
struct | inv_ixm42xxx
| Ixm42xxx driver states definition. More...
struct | inv_ixm42xxx_interrupt_parameter_t
| Ixm42xxx set of interrupt enable flag. More...

## Macros
#define | INV_IXM42XXX_LIGHTWEIGHT_DRIVER 0
| Ligthen 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 IXM42XXX_SENSOR_CONFIG2_OIS_MODE_8KHZ
#define | ACCEL_CONFIG0_FS_SEL_MAX IXM42XXX_ACCEL_CONFIG0_FS_SEL_16g
| Max FSR values for accel and gyro Dependant of chip. More...
#define | GYRO_CONFIG0_FS_SEL_MAX IXM42XXX_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 | IXM42XXX_FIFO_MIRRORING_SIZE 16 * 129
| Ixm42xxx maximum buffer size mirrored from FIFO at polling time. More...
#define | IXM42XXX_DEFAULT_WOM_THS_MG 52>>2 /* = 52mg/4 */
| Default value for the WOM threshold Resolution of the threshold is ~= 4mg. More...
#define | IXM42XXX_ACC_STARTUP_TIME_US 20000U
| Ixm42xxx Accelerometer start-up time before having correct data. More...
#define | IXM42XXX_GYR_STARTUP_TIME_US 60000U
| Ixm42xxx Gyroscope start-up time before having correct data. More...

## Enumerations
enum | inv_ixm42xxx_sensor { INV_IXM42XXX_SENSOR_ACCEL, INV_IXM42XXX_SENSOR_GYRO, INV_IXM42XXX_SENSOR_FSYNC_EVENT, INV_IXM42XXX_SENSOR_OIS, INV_IXM42XXX_SENSOR_TEMPERATURE, INV_IXM42XXX_SENSOR_TAP, INV_IXM42XXX_SENSOR_DMP_PEDOMETER_EVENT, INV_IXM42XXX_SENSOR_DMP_PEDOMETER_COUNT, INV_IXM42XXX_SENSOR_DMP_TILT, INV_IXM42XXX_SENSOR_DMP_R2W, INV_IXM42XXX_SENSOR_MAX }
| Sensor identifier for UI control and OIS function. More...
enum | INV_IXM42XXX_FIFO_CONFIG_t { INV_IXM42XXX_FIFO_DISABLED = 0, INV_IXM42XXX_FIFO_ENABLED = 1 }
| Configure Fifo usage. More...
enum | inv_ixm42xxx_interrupt_value { INV_IXM42XXX_DISABLE = 0, INV_IXM42XXX_ENABLE }

## Functions
int | inv_ixm42xxx_set_reg_bank (struct inv_ixm42xxx *s, uint8_t bank)
| Set register bank index. More...
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. More...
int | inv_ixm42xxx_device_reset (struct inv_ixm42xxx *s)
| Perform a soft reset of the device. More...
int | inv_ixm42xxx_get_who_am_i (struct inv_ixm42xxx *s, uint8_t *who_am_i)
| return WHOAMI value More...
int | inv_ixm42xxx_force_clock_source (struct inv_ixm42xxx *s, IXM42XXX_INTF_CONFIG1_ACCEL_LP_CLK_t clk_src)
| Configure Accel clock source. More...
int | inv_ixm42xxx_enable_accel_low_power_mode (struct inv_ixm42xxx *s)
| Enable/put accel in low power mode. More...
int | inv_ixm42xxx_enable_accel_low_noise_mode (struct inv_ixm42xxx *s)
| Enable/put accel in low noise mode. More...
int | inv_ixm42xxx_disable_accel (struct inv_ixm42xxx *s)
| Disable all 3 axes of accel. More...
int | inv_ixm42xxx_enable_gyro_low_noise_mode (struct inv_ixm42xxx *s)
| Enable/put gyro in low noise mode. More...
int | inv_ixm42xxx_disable_gyro (struct inv_ixm42xxx *s)
| Disable all 3 axes of gyro. More...
int | inv_ixm42xxx_enable_fsync (struct inv_ixm42xxx *s)
| Enable fsync tagging functionnality. In details it: More...
int | inv_ixm42xxx_disable_fsync (struct inv_ixm42xxx *s)
| Disable fsync tagging functionnality. In details it: More...
int | inv_ixm42xxx_configure_timestamp_resolution (struct inv_ixm42xxx *s, IXM42XXX_TMST_CONFIG_RESOL_t resol)
| Configure timestamp resolution from FIFO. More...
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. More...
int | inv_ixm42xxx_get_config_ibi (struct inv_ixm42xxx *s, inv_ixm42xxx_interrupt_parameter_t *interrupt_to_configure)
| Retrieve interrupts configuration. More...
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. More...
int | inv_ixm42xxx_get_config_int1 (struct inv_ixm42xxx *s, inv_ixm42xxx_interrupt_parameter_t *interrupt_to_configure)
| Retrieve interrupts configuration. More...
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. More...
int | inv_ixm42xxx_get_config_int2 (struct inv_ixm42xxx *s, inv_ixm42xxx_interrupt_parameter_t *interrupt_to_configure)
| Retrieve interrupts configuration. More...
int | inv_ixm42xxx_get_data_from_registers (struct inv_ixm42xxx *s)
| Read all registers containing data (tempereature, accelerometer and gyroscope). Then it calls sensor_event_cb funtion passed in parameter of inv_ixm42xxx_init function for each packet. More...
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 packet data and validity information. Then it calls sensor_event_cb funtion passed in parameter of inv_ixm42xxx_init function for each packet. More...
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. More...
int | inv_ixm42xxx_set_accel_frequency (struct inv_ixm42xxx *s, const IXM42XXX_ACCEL_CONFIG0_ODR_t frequency)
| Configure accel Output Data Rate. More...
int | inv_ixm42xxx_set_gyro_frequency (struct inv_ixm42xxx *s, const IXM42XXX_GYRO_CONFIG0_ODR_t frequency)
| Configure gyro Output Data Rate. More...
int | inv_ixm42xxx_set_accel_fsr (struct inv_ixm42xxx *s, IXM42XXX_ACCEL_CONFIG0_FS_SEL_t accel_fsr_g)
| Set accel full scale range. More...
int | inv_ixm42xxx_get_accel_fsr (struct inv_ixm42xxx *s, IXM42XXX_ACCEL_CONFIG0_FS_SEL_t *accel_fsr_g)
| Access accel full scale range. More...
int | inv_ixm42xxx_set_gyro_fsr (struct inv_ixm42xxx *s, IXM42XXX_GYRO_CONFIG0_FS_SEL_t gyro_fsr_dps)
| Set gyro full scale range. More...
int | inv_ixm42xxx_get_gyro_fsr (struct inv_ixm42xxx *s, IXM42XXX_GYRO_CONFIG0_FS_SEL_t *gyro_fsr_dps)
| Access gyro full scale range. More...
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. More...
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. More...
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. More...
int | inv_ixm42xxx_reset_fifo (struct inv_ixm42xxx *s)
| reset IXM42XXX fifo More...
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. To do that, the fine clock is forced enabled at some power cost. More...
int | inv_ixm42xxx_disable_timestamp_to_register (struct inv_ixm42xxx *s)
| Disable the 20bits-timestamp register access. Register read always return 0's. More...
int | inv_ixm42xxx_get_current_timestamp (struct inv_ixm42xxx *s, uint32_t *icm_time)
| Get the timestamp value of ixm42xxx from register. More...
int | inv_ixm42xxx_enable_clkin_rtc (struct inv_ixm42xxx *s, uint8_t enable)
| Enable or disable CLKIN/RTC capability. More...
int | inv_ixm42xxx_get_clkin_rtc_status (struct inv_ixm42xxx *s)
| Get CLKIN/RTC feature status. More...
int | inv_ixm42xxx_enable_high_resolution_fifo (struct inv_ixm42xxx *s)
| Enable 20 bits raw acc and raw gyr data in fifo. More...
int | inv_ixm42xxx_disable_high_resolution_fifo (struct inv_ixm42xxx *s)
| Disable 20 bits raw acc and raw gyr data in fifo. More...
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. More...
int | inv_ixm42xxx_configure_fifo_wm (struct inv_ixm42xxx *s, uint16_t wm)
| Configure Fifo watermark (also refered to as fifo threshold) More...
uint32_t | inv_ixm42xxx_get_fifo_timestamp_resolution_us_q24 (struct inv_ixm42xxx *s)
| Get FIFO timestamp resolution. More...
uint32_t | inv_ixm42xxx_get_reg_timestamp_resolution_us_q24 (struct inv_ixm42xxx *s)
| Get register timestamp resolution. More...
const char * | inv_ixm42xxx_get_version (void)
| Return driver version x.y.z-suffix as a char array. More...

## Detailed Description

High-level function to setup an Ixm42xxx device.

## Macro Definition Documentation

## ◆ ACCEL_CONFIG0_FS_SEL_MAX

#define ACCEL_CONFIG0_FS_SEL_MAX IXM42XXX_ACCEL_CONFIG0_FS_SEL_16g

Max FSR values for accel and gyro Dependant of chip.

Definition at line 90 of file Ixm42xxxDriver_HL.h.

## ◆ ACCEL_OFFUSER_MAX_MG

#define ACCEL_OFFUSER_MAX_MG 1000

Definition at line 93 of file Ixm42xxxDriver_HL.h.

## ◆ GYRO_CONFIG0_FS_SEL_MAX

#define GYRO_CONFIG0_FS_SEL_MAX IXM42XXX_GYRO_CONFIG0_FS_SEL_2000dps

Definition at line 91 of file Ixm42xxxDriver_HL.h.

## ◆ GYRO_OFFUSER_MAX_DPS

#define GYRO_OFFUSER_MAX_DPS 64

Definition at line 94 of file Ixm42xxxDriver_HL.h.

## ◆ ICM_PART_DEFAULT_OIS_MODE

#define ICM_PART_DEFAULT_OIS_MODE IXM42XXX_SENSOR_CONFIG2_OIS_MODE_8KHZ

Definition at line 77 of file Ixm42xxxDriver_HL.h.

## ◆ INV_IXM42XXX_LIGHTWEIGHT_DRIVER

#define INV_IXM42XXX_LIGHTWEIGHT_DRIVER 0

Ligthen 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.

Definition at line 58 of file Ixm42xxxDriver_HL.h.

## ◆ IXM42XXX_ACC_STARTUP_TIME_US

#define IXM42XXX_ACC_STARTUP_TIME_US 20000U

Ixm42xxx Accelerometer start-up time before having correct data.

Definition at line 120 of file Ixm42xxxDriver_HL.h.

## ◆ IXM42XXX_DEFAULT_WOM_THS_MG

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

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

Definition at line 116 of file Ixm42xxxDriver_HL.h.

## ◆ IXM42XXX_FIFO_MIRRORING_SIZE

#define IXM42XXX_FIFO_MIRRORING_SIZE 16 * 129

Ixm42xxx maximum buffer size mirrored from FIFO at polling time.

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

Definition at line 111 of file Ixm42xxxDriver_HL.h.

## ◆ IXM42XXX_GYR_STARTUP_TIME_US

#define IXM42XXX_GYR_STARTUP_TIME_US 60000U

Ixm42xxx Gyroscope start-up time before having correct data.

Definition at line 124 of file Ixm42xxxDriver_HL.h.

## ◆ PLL_SCALE_FACTOR_Q24

#define PLL_SCALE_FACTOR_Q24 (1UL<<24)

Scale factor and max ODR Dependant of chip.

Definition at line 76 of file Ixm42xxxDriver_HL.h.

## ◆ RTC_SUPPORTED

#define RTC_SUPPORTED 0

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

Definition at line 104 of file Ixm42xxxDriver_HL.h.

## Enumeration Type Documentation

## ◆ INV_IXM42XXX_FIFO_CONFIG_t

enum INV_IXM42XXX_FIFO_CONFIG_t

Configure Fifo usage.

Enumerator
INV_IXM42XXX_FIFO_DISABLED | Fifo is disabled and data source is sensors registers
INV_IXM42XXX_FIFO_ENABLED | Fifo is used as data source

Definition at line 145 of file Ixm42xxxDriver_HL.h.

## ◆ inv_ixm42xxx_interrupt_value

enum inv_ixm42xxx_interrupt_value

Enumerator
INV_IXM42XXX_DISABLE |
INV_IXM42XXX_ENABLE |

Definition at line 223 of file Ixm42xxxDriver_HL.h.

## ◆ inv_ixm42xxx_sensor

enum inv_ixm42xxx_sensor

Sensor identifier for UI control and OIS function.

Enumerator
INV_IXM42XXX_SENSOR_ACCEL | Accelerometer (UI control path)
INV_IXM42XXX_SENSOR_GYRO | Gyroscope (UI control path)
INV_IXM42XXX_SENSOR_FSYNC_EVENT | Used by OIS and UI control layers
INV_IXM42XXX_SENSOR_OIS | Only used by OIS layer
INV_IXM42XXX_SENSOR_TEMPERATURE | Chip temperature, enabled by default. However, it 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_IXM42XXX_SENSOR_TAP | Tap and Double tap
INV_IXM42XXX_SENSOR_DMP_PEDOMETER_EVENT | Pedometer: step is detected
INV_IXM42XXX_SENSOR_DMP_PEDOMETER_COUNT | Pedometer: step counter
INV_IXM42XXX_SENSOR_DMP_TILT | Tilt
INV_IXM42XXX_SENSOR_DMP_R2W | Raise to wake
INV_IXM42XXX_SENSOR_MAX |

Definition at line 128 of file Ixm42xxxDriver_HL.h.

## Function Documentation

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

Parameters

  [in] | fifo_config | Fifo configuration method : if enabled data are comming from fifo and Interrupt is configured on Fifo Watermark if disabled data are comming from sensor registers and Interrupt is configured on Data ready

See also
  INV_IXM42XXX_FIFO_CONFIG_t

Definition at line 1442 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

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

Parameters

  [in] | wm | Watermark value

Definition at line 1514 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

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

Parameters

  [in] | resol | The expected resolution of the timestamp. See enum IXM42XXX_TMST_CONFIG_RESOL_t.

Returns
  0 on success, negative value on error.

Warning
  The resolution will have no effect if RTC is enabled

Definition at line 577 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:
Here is the caller graph for this function:

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

Parameters

  [in] | odr_bitfield | An IXM42XXX_ACCEL_CONFIG0_ODR_t or IXM42XXX_GYRO_CONFIG0_ODR_t enum

Returns
  The corresponding period expressed in us

Definition at line 1085 of file Ixm42xxxDriver_HL.c.

Here is the caller graph for this function:

## ◆ inv_ixm42xxx_device_reset()

int inv_ixm42xxx_device_reset | ( | struct inv_ixm42xxx * | s | ) |

Perform a soft reset of the device.

Returns
  0 on success, negative value on error.

Definition at line 79 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

## ◆ inv_ixm42xxx_disable_accel()

int inv_ixm42xxx_disable_accel | ( | struct inv_ixm42xxx * | s | ) |

Disable all 3 axes of accel.

Returns
  0 on success, negative value on error. If both accel and gyro are turned off as a result of this function, they will also be removed from the FIFO and a FIFO reset will be performed (to guarantee no side effects until the next enable sensor call)

Warning
  inv_ixm42xxx::register_cache::pwr_mngt_0_reg is modified by this function

Definition at line 345 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

## ◆ inv_ixm42xxx_disable_fsync()

int inv_ixm42xxx_disable_fsync | ( | struct inv_ixm42xxx * | s | ) |

Disable fsync tagging functionnality. In details it:

- 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
  Returns
    0 on success, negative value on error.

Definition at line 562 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

## ◆ inv_ixm42xxx_disable_gyro()

int inv_ixm42xxx_disable_gyro | ( | struct inv_ixm42xxx * | s | ) |

Disable all 3 axes of gyro.

Returns
  0 on success, negative value on error. If both accel and gyro are turned off as a result of this function, they will also be removed from the FIFO and a FIFO reset will be performed (to guarantee no side effects until the next enable sensor call)

Warning
  inv_ixm42xxx::register_cache::pwr_mngt_0_reg is modified by this function

Definition at line 485 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

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

Returns
  0 on success, negative return code otherwise

Definition at line 1425 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

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

Returns
  0 on success, negative value on error.

Definition at line 1324 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

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

Returns
  0 on success, negative value on error. It enables accel and gyro data in the FIFO (so the packet format is 16 bytes). If called first, the configuration will be applied, otherwise it will be ignored if the FIFO is not empty (but since the new configuration is identical it is not a issue).

Warning
  inv_ixm42xxx::register_cache::pwr_mngt_0_reg is modified by this function

Definition at line 267 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

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

Returns
  0 on success, negative value on error. It enables accel and gyro data in the FIFO (so the packet format is 16 bytes). If called first, the configuration will be applied, otherwise it will be ignored if the FIFO is not empty (but since the new configuration is identical it is not a issue).

Warning
  inv_ixm42xxx::register_cache::pwr_mngt_0_reg is modified by this function

Definition at line 158 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

## ◆ inv_ixm42xxx_enable_clkin_rtc()

int inv_ixm42xxx_enable_clkin_rtc | ( | struct inv_ixm42xxx * | s,
|  | uint8_t | enable
| ) |  |

Enable or disable CLKIN/RTC capability.

Parameters

  [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_ixm42xxx_configure_timestamp_resolution() just afterwards so that timestamp resolution is in line with system request
  inv_ixm42xxx::register_cache::intf_cfg_1_reg is modified by this function

Definition at line 1359 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

## ◆ inv_ixm42xxx_enable_fsync()

int inv_ixm42xxx_enable_fsync | ( | struct inv_ixm42xxx * | s | ) |

Enable fsync tagging functionnality. In details it:

- 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
  Returns
    0 on success, negative value on error.

Definition at line 548 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

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

Returns
  0 on success, negative value on error. It enables gyro and accel data in the FIFO (so the packet format is 16 bytes). If called first, the configuration will be applied, otherwise it will be ignored if the FIFO is not empty (but since the new configuration is identical it is not a issue).

Warning
  inv_ixm42xxx::register_cache::pwr_mngt_0_reg is modified by this function

Definition at line 391 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

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

Returns
  0 on success, negative return code otherwise

Definition at line 1408 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

## ◆ 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. To do that, the fine clock is forced enabled at some power cost.

Returns
  0 on success, negative value on error.

Definition at line 1303 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

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

Parameters

  [in] | 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 is here only to force a specific clock source and shall be used with care.

Definition at line 143 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:
Here is the caller graph for this function:

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

Parameters

  [out] | accel_fsr_g | current full scale range.

See also
  IXM42XXX_ACCEL_CONFIG0_FS_SEL_t.

Returns
  0 on success, negative value on error.

Warning
  inv_ixm42xxx::register_cache::accel_cfg_0_reg is relied upon by this function

Definition at line 1189 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

## ◆ inv_ixm42xxx_get_clkin_rtc_status()

int inv_ixm42xxx_get_clkin_rtc_status | ( | struct inv_ixm42xxx * | s | ) |

Get CLKIN/RTC feature status.

Returns
  0 if CLKIN is disabled, 1 if enabled.

Warning
  In case CLKIN is disabled, it is recommended to call inv_ixm42xxx_configure_timestamp_resolution() just afterwards so that timestamp resolution is in line with system request
  inv_ixm42xxx::register_cache::intf_cfg_1_reg is relied upon by this function

Definition at line 1396 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:
Here is the caller graph for this function:

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

Parameters

  [in] | interrupt_to_configure | structure with the corresponding state to manage IBI interruptions.

Returns
  0 on success, negative value on error.

Definition at line 590 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:
Here is the caller graph for this function:

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

Parameters

  [in] | interrupt_to_configure | structure with the corresponding state to manage INT1.

Returns
  0 on success, negative value on error.

Definition at line 620 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:
Here is the caller graph for this function:

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

Parameters

  [in] | interrupt_to_configure | structure with the corresponding state to manage INT2.

Returns
  0 on success, negative value on error.

Definition at line 653 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:
Here is the caller graph for this function:

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

Parameters

  [in] | icm_time | timestamp read from register

Returns
  0 on success, negative value on error.

Warning
  Prior to call this API, the read access to timestamp register must be enabled (see inv_ixm42xxx_enable_timestamp_to_register() function)

Definition at line 1341 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

## ◆ 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 packet data and validity information. Then it calls sensor_event_cb funtion passed in parameter of inv_ixm42xxx_init function for each packet.

Returns
  0 on success, negative value on error.

Definition at line 877 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

## ◆ 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_event_cb funtion passed in parameter of inv_ixm42xxx_init function for each packet.

Returns
  0 on success, negative value on error.

Definition at line 830 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

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

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

Definition at line 1572 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

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

Parameters

  [out] | gyro_fsr_dps | current full scale range.

See also
  IXM42XXX_GYRO_CONFIG0_FS_SEL_t.

Returns
  0 on success, negative value on error.

Warning
  inv_ixm42xxx::register_cache::gyro_cfg_0_reg is relied upon by this function

Definition at line 1204 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

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

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

Definition at line 1604 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

## ◆ inv_ixm42xxx_get_version()

const char* inv_ixm42xxx_get_version | ( | void |  | ) |

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

Return values

  driver | version a char array "x.y.z-suffix"

Definition at line 1621 of file Ixm42xxxDriver_HL.c.

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

Parameters

  [out] | who_am_i | WHOAMI for device

Returns
  0 on success, negative value on error

Definition at line 138 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

## ◆ inv_ixm42xxx_init()

int inv_ixm42xxx_init | ( | struct inv_ixm42xxx * | s,
|  | struct inv_ixm42xxx_serif * | serif,
|  | void(*)(inv_ixm42xxx_sensor_event_t *event) | sensor_event_cb
| ) |  |

Configure the serial interface used to access the device and execute hardware initialization.

This functions first configures serial interface passed in parameter to make sure device is accessible both in read and write. Thus no serial access should be done before succesfully executing the present function.

Then if requested serial interface is a primary interface (aka UI interface or AP interface), this function initializes the device using the following hardware settings:

- gyroscope fsr = 2000dps
- accelerometer fsr = 4g
- set timestamp resolution to 16us
- enable FIFO mechanism with the following configuration:
  - FIFO record mode i.e FIFO count unit is packet
  - FIFO snapshot mode i.e drop the data when the FIFO overflows
  - Timestamp is logged in FIFO
  - Little Endian fifo_count and fifo_data
  - generate FIFO threshold interrupt when packet count reaches FIFO watermark
  - set FIFO watermark to 1 packet
  - enable temperature and timestamp data to go to FIFO

In case requested serial interface is an auxliary interface (i.e. AUX1 or AUX2) this function returns an error.

Parameters

  [in] | s | driver structure. Note that first field of this structure MUST be a struct inv_ixm42xxx_serif.
  [in] | serif | pointer on serial interface structure to be used to access ixm42xxx.
  [in] | sensor_event_cb | callback executed by inv_ixm42xxx_get_data_from_fifo function each time it extracts some valid data from fifo. Or inv_ixm42xxx_get_data_from_registers read data from register. Thus this parameter is optional as long as inv_ixm42xxx_get_data_from_fifo/inv_ixm42xxx_get_data_from_registers function is not used.

Returns
  0 on success, negative value on error.

Definition at line 40 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

## ◆ inv_ixm42xxx_reset_fifo()

int inv_ixm42xxx_reset_fifo | ( | struct inv_ixm42xxx * | s | ) |

reset IXM42XXX fifo

Returns
  0 on success, negative value on error.

Definition at line 1270 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:
Here is the caller graph for this function:

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

Parameters

  [in] | frequency | The requested frequency.

See also
  IXM42XXX_ACCEL_CONFIG0_ODR_t

Returns
  0 on success, negative value on error.

Warning
  inv_ixm42xxx::register_cache::accel_cfg_0_reg is modified by this function

Definition at line 1127 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

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

Parameters

  [in] | accel_fsr_g | requested full scale range.

See also
  IXM42XXX_ACCEL_CONFIG0_FS_SEL_t.

Returns
  0 on success, negative value on error.

Warning
  inv_ixm42xxx::register_cache::accel_cfg_0_reg is modified by this function

Definition at line 1165 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

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

Parameters

  [in] | acc_bw | requested averaging value

See also
  IXM42XXX_GYRO_ACCEL_CONFIG0_ACCEL_FILT_BW_t

Returns
  0 on success, negative value on error.

Definition at line 1236 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

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

Parameters

  [in] | acc_avg | requested averaging value

See also
  IXM42XXX_GYRO_ACCEL_CONFIG0_ACCEL_FILT_AVG_t

Returns
  0 on success, negative value on error.

Definition at line 1219 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

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

Parameters

  [in] | interrupt_to_configure | structure with the corresponding state to manage ibi interruptions.

Returns
  0 on success, negative value on error.

Definition at line 686 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:
Here is the caller graph for this function:

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

Parameters

  [in] | interrupt_to_configure | structure with the corresponding state to manage INT1.

Returns
  0 on success, negative value on error.

Definition at line 730 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:
Here is the caller graph for this function:

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

Parameters

  [in] | interrupt_to_configure | structure with the corresponding state to INT2.

Returns
  0 on success, negative value on error.

Definition at line 780 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:
Here is the caller graph for this function:

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

Parameters

  [in] | frequency | The requested frequency.

See also
  IXM42XXX_GYRO_CONFIG0_ODR_t

Returns
  0 on success, negative value on error.

Warning
  inv_ixm42xxx::register_cache::gyro_cfg_0_reg is modified by this function

Definition at line 1153 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

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

Parameters

  [in] | gyro_fsr_dps | requested full scale range.

See also
  IXM42XXX_GYRO_CONFIG0_FS_SEL_t.

Returns
  0 on success, negative value on error.

Warning
  inv_ixm42xxx::register_cache::gyro_cfg_0_reg is modified by this function

Definition at line 1177 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

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

Parameters

  [in] | gyr_bw | requested averaging value

See also
  IXM42XXX_GYRO_ACCEL_CONFIG0_GYRO_FILT_BW_t

Returns
  0 on success, negative value on error.

Definition at line 1253 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:

## ◆ inv_ixm42xxx_set_reg_bank()

int inv_ixm42xxx_set_reg_bank | ( | struct inv_ixm42xxx * | s,
|  | uint8_t | bank
| ) |  |

Set register bank index.

Parameters

  bank | new bank to be set

Returns
  0 on success, negative value otherwise

Definition at line 35 of file Ixm42xxxDriver_HL.c.

Here is the call graph for this function:
Here is the caller graph for this function: