| ICM42688V eMD Driver 2.0.9 Documentation of the eMD Driver API

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

Files | Classes | Typedefs | Functions
APEX driver

High-level API to drive APEX-related features. More...

## Files
file | Icm426xxDriver_HL_apex.h

## Classes
struct | inv_icm426xx_tap_parameters_t
| Icm426xx TAP inputs parameters definition. More...
struct | inv_icm426xx_apex_parameters
| Icm426xx APEX inputs parameters definition. More...
struct | inv_icm426xx_apex_step_activity
| APEX pedometer outputs. More...
struct | inv_icm426xx_tap_data
| TAP outputs. More...

## Typedefs
typedef struct inv_icm426xx_apex_parameters | inv_icm426xx_apex_parameters_t
| Icm426xx APEX inputs parameters definition. More...
typedef struct inv_icm426xx_apex_step_activity | inv_icm426xx_apex_step_activity_t
| APEX pedometer outputs. More...
typedef struct inv_icm426xx_tap_data | inv_icm426xx_tap_data_t
| TAP outputs. More...

## Functions
int | inv_icm426xx_configure_smd_wom (struct inv_icm426xx *s, const uint8_t x_th, const uint8_t y_th, const uint8_t z_th, ICM426XX_SMD_CONFIG_WOM_INT_MODE_t wom_int, ICM426XX_SMD_CONFIG_WOM_MODE_t wom_mode)
| Configure Wake On Motion and SMD thresholds. More...
int | inv_icm426xx_enable_wom (struct inv_icm426xx *s)
| Enable Wake On Motion. More...
int | inv_icm426xx_disable_wom (struct inv_icm426xx *s)
| Disable Wake On Motion. More...
int | inv_icm426xx_enable_smd (struct inv_icm426xx *s)
| Enable Significant Motion Detection. More...
int | inv_icm426xx_disable_smd (struct inv_icm426xx *s)
| Disable Significant Motion Detection. More...
int | inv_icm426xx_init_tap_parameters_struct (struct inv_icm426xx *s, inv_icm426xx_tap_parameters_t *tap_inputs)
| Fill the TAP parameters structure with all the default parameters for TAP algorithm. More...
int | inv_icm426xx_configure_tap_parameters (struct inv_icm426xx *s, const inv_icm426xx_tap_parameters_t *tap_inputs)
| Configure TAP. More...
int | inv_icm426xx_get_tap_parameters (struct inv_icm426xx *s, inv_icm426xx_tap_parameters_t *tap_params)
| Returns current TAP parameters. More...
int | inv_icm426xx_enable_tap (struct inv_icm426xx *s)
| Enable TAP. More...
int | inv_icm426xx_disable_tap (struct inv_icm426xx *s)
| Disable TAP. More...
int | inv_icm426xx_init_apex_parameters_struct (struct inv_icm426xx *s, inv_icm426xx_apex_parameters_t *apex_inputs)
| Fill the APEX parameters structure with all the default parameters for APEX algorithms (pedometer, tilt) More...
int | inv_icm426xx_configure_apex_parameters (struct inv_icm426xx *s, const inv_icm426xx_apex_parameters_t *apex_inputs)
| Configures DMP parameters for APEX algorithms (pedometer, tilt). More...
int | inv_icm426xx_get_apex_parameters (struct inv_icm426xx *s, inv_icm426xx_apex_parameters_t *apex_params)
| Returns current DMP parameters for APEX algorithms (pedometer, tilt). More...
int | inv_icm426xx_set_apex_frequency (struct inv_icm426xx *s, const ICM426XX_APEX_CONFIG0_DMP_ODR_t frequency)
| Configure DMP Output Data Rate for APEX algorithms (pedometer, tilt) More...
int | inv_icm426xx_start_dmp (struct inv_icm426xx *s)
| Start DMP for APEX algorithms. More...
int | inv_icm426xx_reset_dmp (struct inv_icm426xx *s)
| Reset DMP memory. More...
int | inv_icm426xx_enable_apex_pedometer (struct inv_icm426xx *s)
| Enable APEX algorithm Pedometer. More...
int | inv_icm426xx_disable_apex_pedometer (struct inv_icm426xx *s)
| Disable APEX algorithm Pedometer. More...
int | inv_icm426xx_enable_apex_tilt (struct inv_icm426xx *s)
| Enable APEX algorithm Tilt. More...
int | inv_icm426xx_disable_apex_tilt (struct inv_icm426xx *s)
| Disable APEX algorithm Tilt. More...
int | inv_icm426xx_get_apex_data_activity (struct inv_icm426xx *s, inv_icm426xx_apex_step_activity_t *apex_activity)
| Retrieve APEX pedometer outputs and format them. More...
int | inv_icm426xx_get_tap_data (struct inv_icm426xx *s, inv_icm426xx_tap_data_t *tap_data)
| Retrieve tap outputs. More...
int | inv_icm426xx_load_dmp_sram_code (struct inv_icm426xx *s, const uint8_t *dmp_prog, const uint32_t start_offset, const uint32_t size)
| Load custom DMP image into SRAM. More...

## Detailed Description

High-level API to drive APEX-related features.

## Typedef Documentation

## ◆ inv_icm426xx_apex_parameters_t

typedef struct inv_icm426xx_apex_parameters inv_icm426xx_apex_parameters_t

Icm426xx APEX inputs parameters definition.

## ◆ inv_icm426xx_apex_step_activity_t

typedef struct inv_icm426xx_apex_step_activity inv_icm426xx_apex_step_activity_t

APEX pedometer outputs.

## ◆ inv_icm426xx_tap_data_t

typedef struct inv_icm426xx_tap_data inv_icm426xx_tap_data_t

TAP outputs.

## Function Documentation

## ◆ inv_icm426xx_configure_apex_parameters()

int inv_icm426xx_configure_apex_parameters | ( | struct inv_icm426xx * | s,
|  | const inv_icm426xx_apex_parameters_t * | apex_inputs
| ) |  |

Configures DMP parameters for APEX algorithms (pedometer, tilt).

This programmable parameters will be decoded and propagate to the SRAM to be executed at DMP start.

Parameters

  [in] | s | Pointer to device.
  [in] | apex_inputs | The requested input parameters. See

See also
  inv_icm426xx_apex_parameters_t

Warning
  APEX inputs can't change on the fly, this API should be called before enabling any APEX features.
  APEX configuration can't be done too frequently, but only once every 10ms. Otherwise it can create unknown behavior.

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_configure_smd_wom()

int inv_icm426xx_configure_smd_wom | ( | struct inv_icm426xx * | s,
|  | const uint8_t | x_th,
|  | const uint8_t | y_th,
|  | const uint8_t | z_th,
|  | ICM426XX_SMD_CONFIG_WOM_INT_MODE_t | wom_int,
|  | ICM426XX_SMD_CONFIG_WOM_MODE_t | wom_mode
| ) |  |

Configure Wake On Motion and SMD thresholds.

Parameters

  [in] | s | Pointer to device.
  [in] | x_th | Threshold value for the Wake on Motion Interrupt for X-axis accel.
  [in] | y_th | Threshold value for the Wake on Motion Interrupt for Y-axis accel.
  [in] | z_th | Threshold value for the Wake on Motion Interrupt for Z-axis accel.
  [in] | wom_int | Select which mode between AND/OR is used to generate interrupt.
  [in] | wom_mode | Select which comparison mode is used for WoM detection.

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_configure_tap_parameters()

int inv_icm426xx_configure_tap_parameters | ( | struct inv_icm426xx * | s,
|  | const inv_icm426xx_tap_parameters_t * | tap_inputs
| ) |  |

Configure TAP.

Parameters

  [in] | s | Pointer to device.
  [in] | tap_inputs | The requested input parameters.

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_disable_apex_pedometer()

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

Disable APEX algorithm Pedometer.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_disable_apex_tilt()

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

Disable APEX algorithm Tilt.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_disable_smd()

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

Disable Significant Motion Detection.

Disables SMD event generation and disables SMD interrupt.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_disable_tap()

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

Disable TAP.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_disable_wom()

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

Disable Wake On Motion.

Disables WoM event generation and reconfigures interrupt to fire on Fifo water-mark.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_enable_apex_pedometer()

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

Enable APEX algorithm Pedometer.

note : Pedometer request to have the accelerometer enabled to works with accelerometer frequency less than dmp frequency.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

Warning
  Pedometer must be turned OFF to reconfigure it

## ◆ inv_icm426xx_enable_apex_tilt()

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

Enable APEX algorithm Tilt.

note : Tilt request to have the accelerometer enabled to works with accelerometer frequency less than dmp frequency.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_enable_smd()

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

Enable Significant Motion Detection.

note : SMD requests to have the accelerometer enabled to work. Enables SMD event generation and configures interrupt to fire on SMD event. WoM event will also be generated. To have good performance, it's recommended to set accelerometer ODR (Output Data Rate) to 20ms and the accelerometer in Low Power Mode.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_enable_tap()

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

Enable TAP.

note : TAP requests to have the accelerometer enabled to work. To have good performance, it's recommended to set accelerometer ODR (Output Data Rate) to 1ms and the accelerometer in Low Noise Mode.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_enable_wom()

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

Enable Wake On Motion.

note : WoM requests to have the accelerometer enabled to work. Enables WoM event generation and configures interrupt to fire on WoM event. As a consequence Fifo water-mark interrupt is disabled. To have good performance, it's recommended to set accelerometer ODR (Output Data Rate) to 20ms and the accelerometer in Low Power Mode.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_get_apex_data_activity()

int inv_icm426xx_get_apex_data_activity | ( | struct inv_icm426xx * | s,
|  | inv_icm426xx_apex_step_activity_t * | apex_activity
| ) |  |

Retrieve APEX pedometer outputs and format them.

Parameters

  [in] | s | Pointer to device.
  [out] | apex_activity | Apex step and activity data value.

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_get_apex_parameters()

int inv_icm426xx_get_apex_parameters | ( | struct inv_icm426xx * | s,
|  | inv_icm426xx_apex_parameters_t * | apex_params
| ) |  |

Returns current DMP parameters for APEX algorithms (pedometer, tilt).

Parameters

  [in] | s | Pointer to device.
  [out] | apex_params | The current parameter, fetched from registers. See

See also
  inv_icm426xx_apex_parameters_t

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_get_tap_data()

int inv_icm426xx_get_tap_data | ( | struct inv_icm426xx * | s,
|  | inv_icm426xx_tap_data_t * | tap_data
| ) |  |

Retrieve tap outputs.

Parameters

  [in] | s | Pointer to device.
  [out] | tap_data | Tap axis, direction and type

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_get_tap_parameters()

int inv_icm426xx_get_tap_parameters | ( | struct inv_icm426xx * | s,
|  | inv_icm426xx_tap_parameters_t * | tap_params
| ) |  |

Returns current TAP parameters.

Parameters

  [in] | s | Pointer to device.
  [out] | tap_params | The current parameter, fetched from registers. See

See also
  inv_icm426xx_tap_parameters_t

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_init_apex_parameters_struct()

int inv_icm426xx_init_apex_parameters_struct | ( | struct inv_icm426xx * | s,
|  | inv_icm426xx_apex_parameters_t * | apex_inputs
| ) |  |

Fill the APEX parameters structure with all the default parameters for APEX algorithms (pedometer, tilt)

Parameters

  [in] | s | Pointer to device.
  [out] | apex_inputs | Default input parameters. See

See also
  inv_icm426xx_apex_parameters_t

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_init_tap_parameters_struct()

int inv_icm426xx_init_tap_parameters_struct | ( | struct inv_icm426xx * | s,
|  | inv_icm426xx_tap_parameters_t * | tap_inputs
| ) |  |

Fill the TAP parameters structure with all the default parameters for TAP algorithm.

Parameters

  [in] | s | Pointer to device.
  [out] | tap_inputs | Default input parameters.

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_load_dmp_sram_code()

int inv_icm426xx_load_dmp_sram_code | ( | struct inv_icm426xx * | s,
|  | const uint8_t * | dmp_prog,
|  | const uint32_t | start_offset,
|  | const uint32_t | size
| ) |  |

Load custom DMP image into SRAM.

Parameters

  [in] | s | Pointer to device.
  [in] | dmp_prog | DMP code to be loaded
  [in] | start_offset | SRAM offset to which program shall be loaded (typically 16).
  [in] | size | Total code size to be loaded into SRAM

Returns
  0 on success, negative value on error.

Return values

  INV_ERROR_SIZE | if image will not fit in 1024B SRAM
  INV_ERROR | if ICM sensors are not OFF
  INV_ERROR_MEM | if SRAM is not written correctly

## ◆ inv_icm426xx_reset_dmp()

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

Reset DMP memory.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_set_apex_frequency()

int inv_icm426xx_set_apex_frequency | ( | struct inv_icm426xx * | s,
|  | const ICM426XX_APEX_CONFIG0_DMP_ODR_t | frequency
| ) |  |

Configure DMP Output Data Rate for APEX algorithms (pedometer, tilt)

Parameters

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

Warning
  DMP_ODR can change on the fly, and the DMP code will accommodate necessary modifications.
  The user needs to take care to set Accel frequency >= DMP frequency. This is a hard constraint since HW will not handle incorrect setting.

Returns
  0 on success, negative value on error.

## ◆ inv_icm426xx_start_dmp()

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

Start DMP for APEX algorithms.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.