| ICM45605 eMD driver Documentation of the eMD Driver API

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

Files | Classes | Macros | Enumerations | Functions
EDMP

API to drive eDMP features. More...

## Files
file | inv_imu_edmp.h

## Classes
struct | inv_imu_edmp_int_state_t
| APEX interrupts definition. More...
struct | int_apex_statusx_t
| Registers to retrieve interrupts status for APEX. More...
struct | int_apex_configx_t
| Registers to configure interrupts for APEX. More...
struct | edmp_apex_enx_t
| Registers to enable APEX features. More...
struct | inv_imu_edmp_apex_parameters_t
| IMU APEX inputs parameters definition. More...
struct | inv_imu_edmp_pedometer_data_t
| Pedometer outputs. More...
struct | inv_imu_edmp_tap_data_t
| Tap outputs. More...

## Macros
#define | INV_IMU_WRITE_EDMP_SRAM(s, name, val) inv_imu_write_sram(s, (uint32_t)name, name##_SIZE, val)
| Writes in EDMP SRAM. More...
#define | INV_IMU_READ_EDMP_SRAM(s, name, val) inv_imu_read_sram(s, (uint32_t)name, name##_SIZE, val)
| Reads in EDMP SRAM. More...

## Enumerations
enum | inv_imu_edmp_int_t { INV_IMU_EDMP_INT0 = 0 , INV_IMU_EDMP_INT1 , INV_IMU_EDMP_INT2 }
| EDMP input interrupt lines definition. More...
enum | inv_imu_edmp_activity_class_t { INV_IMU_EDMP_UNKNOWN = 0 , INV_IMU_EDMP_WALK = 1 , INV_IMU_EDMP_RUN = 2 }
| Pedometer activity class. More...
enum | inv_imu_edmp_tap_num_t { INV_IMU_EDMP_TAP_DOUBLE = 0x02 , INV_IMU_EDMP_TAP_SINGLE = 0x01 }
| Tap number definition. More...
enum | inv_imu_edmp_tap_axis_t { INV_IMU_EDMP_TAP_AXIS_Z = 0x02 , INV_IMU_EDMP_TAP_AXIS_Y = 0x01 , INV_IMU_EDMP_TAP_AXIS_X = 0x00 }
| Tap axis definition. More...
enum | inv_imu_edmp_tap_dir_t { INV_IMU_EDMP_TAP_DIR_POSITIVE = 0x01 , INV_IMU_EDMP_TAP_DIR_NEGATIVE = 0x00 }
| Tap direction definition. More...

## Functions
int | inv_imu_edmp_set_frequency (inv_imu_device_t *s, const dmp_ext_sen_odr_cfg_apex_odr_t frequency)
| Configure EDMP Output Data Rate. More...
int | inv_imu_edmp_init_apex (inv_imu_device_t *s)
| Initialize EDMP APEX algorithms. More...
int | inv_imu_edmp_recompute_apex_decimation (inv_imu_device_t *s)
| Recompute EDMP APEX algorithms internal decimator based on new EDMP output Data Rate configured with `inv_imu_edmp_set_frequency`. More...
int | inv_imu_edmp_get_apex_parameters (inv_imu_device_t *s, inv_imu_edmp_apex_parameters_t *p)
| Returns current EDMP parameters for APEX algorithms. More...
int | inv_imu_edmp_set_apex_parameters (inv_imu_device_t *s, const inv_imu_edmp_apex_parameters_t *p)
| Configures EDMP parameters for APEX algorithms. More...
int | inv_imu_edmp_get_config_int_apex (inv_imu_device_t *s, inv_imu_edmp_int_state_t *it)
| Retrieve interrupts configuration. More...
int | inv_imu_edmp_set_config_int_apex (inv_imu_device_t *s, const inv_imu_edmp_int_state_t *it)
| Configure APEX interrupt. More...
int | inv_imu_edmp_enable (inv_imu_device_t *s)
| Enable EDMP. More...
int | inv_imu_edmp_disable (inv_imu_device_t *s)
| Disable EDMP. More...
int | inv_imu_edmp_enable_pedometer (inv_imu_device_t *s)
| Enable APEX algorithm Pedometer. More...
int | inv_imu_edmp_disable_pedometer (inv_imu_device_t *s)
| Disable APEX algorithm Pedometer. More...
int | inv_imu_edmp_enable_smd (inv_imu_device_t *s)
| Enable APEX algorithm Significant Motion Detection. More...
int | inv_imu_edmp_disable_smd (inv_imu_device_t *s)
| Disable APEX algorithm Significant Motion Detection. More...
int | inv_imu_edmp_enable_tilt (inv_imu_device_t *s)
| Enable APEX algorithm Tilt. More...
int | inv_imu_edmp_disable_tilt (inv_imu_device_t *s)
| Disable APEX algorithm Tilt. More...
int | inv_imu_edmp_enable_r2w (inv_imu_device_t *s)
| Enable APEX algorithm R2W. More...
int | inv_imu_edmp_disable_r2w (inv_imu_device_t *s)
| Disable APEX algorithm R2W. More...
int | inv_imu_edmp_enable_tap (inv_imu_device_t *s)
| Enable APEX algorithm Tap. More...
int | inv_imu_edmp_disable_tap (inv_imu_device_t *s)
| Disable APEX algorithm Tap. More...
int | inv_imu_edmp_enable_ff (inv_imu_device_t *s)
| Enable APEX algorithm Free Fall. More...
int | inv_imu_edmp_disable_ff (inv_imu_device_t *s)
| Disable APEX algorithm Free Fall. More...
int | inv_imu_edmp_get_int_apex_status (inv_imu_device_t *s, inv_imu_edmp_int_state_t *it)
| Read APEX interrupt status. More...
int | inv_imu_edmp_get_pedometer_data (inv_imu_device_t *s, inv_imu_edmp_pedometer_data_t *data)
| Retrieve pedometer outputs. More...
int | inv_imu_edmp_get_ff_data (inv_imu_device_t *s, uint16_t *freefall_duration)
| Retrieve APEX free fall outputs and format them. More...
int | inv_imu_edmp_get_tap_data (inv_imu_device_t *s, inv_imu_edmp_tap_data_t *data)
| Retrieve tap outputs. More...
int | inv_imu_edmp_mask_int_src (inv_imu_device_t *s, inv_imu_edmp_int_t edmp_int_nb, uint8_t int_mask)
| Mask requested interrupt sources for edmp interrupt line passed in parameter. More...
int | inv_imu_edmp_unmask_int_src (inv_imu_device_t *s, inv_imu_edmp_int_t edmp_int_nb, uint8_t int_mask)
| Unmask requested interrupt sources for edmp interrupt line passed in parameter. More...
int | inv_imu_edmp_configure (inv_imu_device_t *s)
| Setup EDMP to execute code in ROM. More...
int | inv_imu_edmp_run_ondemand (inv_imu_device_t *s, inv_imu_edmp_int_t edmp_int_nb)
| Run EDMP using the on-demand mechanism. More...
int | inv_imu_edmp_wait_for_idle (inv_imu_device_t *s)
| Wait until EDMP idle bit is set (means EDMP execution is completed). More...

## Detailed Description

API to drive eDMP features.

## Macro Definition Documentation

## ◆ INV_IMU_READ_EDMP_SRAM

#define INV_IMU_READ_EDMP_SRAM | ( |  | s,
|  |  | name,
|  |  | val
| ) |  | inv_imu_read_sram(s, (uint32_t)name, name##_SIZE, val)

Reads in EDMP SRAM.

Parameters

  [in] | s | Pointer to device.
  [in] | name | Name of the parameter.
  [in] | val | Value to be read.

Returns
  0 on success, negative value on error.

## ◆ INV_IMU_WRITE_EDMP_SRAM

#define INV_IMU_WRITE_EDMP_SRAM | ( |  | s,
|  |  | name,
|  |  | val
| ) |  | inv_imu_write_sram(s, (uint32_t)name, name##_SIZE, val)

Writes in EDMP SRAM.

Parameters

  [in] | s | Pointer to device.
  [in] | name | Name of the parameter.
  [in] | val | Value to be written.

Returns
  0 on success, negative value on error.

## Enumeration Type Documentation

## ◆ inv_imu_edmp_activity_class_t

enum inv_imu_edmp_activity_class_t

Pedometer activity class.

Enumerator
INV_IMU_EDMP_UNKNOWN |
INV_IMU_EDMP_WALK |
INV_IMU_EDMP_RUN |

## ◆ inv_imu_edmp_int_t

enum inv_imu_edmp_int_t

EDMP input interrupt lines definition.

Enumerator
INV_IMU_EDMP_INT0 |
INV_IMU_EDMP_INT1 |
INV_IMU_EDMP_INT2 |

## ◆ inv_imu_edmp_tap_axis_t

enum inv_imu_edmp_tap_axis_t

Tap axis definition.

Enumerator
INV_IMU_EDMP_TAP_AXIS_Z |
INV_IMU_EDMP_TAP_AXIS_Y |
INV_IMU_EDMP_TAP_AXIS_X |

## ◆ inv_imu_edmp_tap_dir_t

enum inv_imu_edmp_tap_dir_t

Tap direction definition.

Enumerator
INV_IMU_EDMP_TAP_DIR_POSITIVE |
INV_IMU_EDMP_TAP_DIR_NEGATIVE |

## ◆ inv_imu_edmp_tap_num_t

enum inv_imu_edmp_tap_num_t

Tap number definition.

Enumerator
INV_IMU_EDMP_TAP_DOUBLE |
INV_IMU_EDMP_TAP_SINGLE |

## Function Documentation

## ◆ inv_imu_edmp_configure()

int inv_imu_edmp_configure | ( | inv_imu_device_t * | s | ) |

Setup EDMP to execute code in ROM.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_imu_edmp_disable()

int inv_imu_edmp_disable | ( | inv_imu_device_t * | s | ) |

Disable EDMP.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_imu_edmp_disable_ff()

int inv_imu_edmp_disable_ff | ( | inv_imu_device_t * | s | ) |

Disable APEX algorithm Free Fall.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_imu_edmp_disable_pedometer()

int inv_imu_edmp_disable_pedometer | ( | inv_imu_device_t * | s | ) |

Disable APEX algorithm Pedometer.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_imu_edmp_disable_r2w()

int inv_imu_edmp_disable_r2w | ( | inv_imu_device_t * | s | ) |

Disable APEX algorithm R2W.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_imu_edmp_disable_smd()

int inv_imu_edmp_disable_smd | ( | inv_imu_device_t * | s | ) |

Disable APEX algorithm Significant Motion Detection.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_imu_edmp_disable_tap()

int inv_imu_edmp_disable_tap | ( | inv_imu_device_t * | s | ) |

Disable APEX algorithm Tap.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_imu_edmp_disable_tilt()

int inv_imu_edmp_disable_tilt | ( | inv_imu_device_t * | s | ) |

Disable APEX algorithm Tilt.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_imu_edmp_enable()

int inv_imu_edmp_enable | ( | inv_imu_device_t * | s | ) |

Enable EDMP.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.

## ◆ inv_imu_edmp_enable_ff()

int inv_imu_edmp_enable_ff | ( | inv_imu_device_t * | s | ) |

Enable APEX algorithm Free Fall.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success INV_IMU_ERROR_EDMP_ODR if user should have called `inv_imu_edmp_recompute_apex_decimation()` other negative value on error.

## ◆ inv_imu_edmp_enable_pedometer()

int inv_imu_edmp_enable_pedometer | ( | inv_imu_device_t * | s | ) |

Enable APEX algorithm Pedometer.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success INV_IMU_ERROR_EDMP_ODR if user should have called `inv_imu_edmp_recompute_apex_decimation()` other negative value on error.

## ◆ inv_imu_edmp_enable_r2w()

int inv_imu_edmp_enable_r2w | ( | inv_imu_device_t * | s | ) |

Enable APEX algorithm R2W.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success INV_IMU_ERROR_EDMP_ODR if user should have called `inv_imu_edmp_recompute_apex_decimation()` other negative value on error.

## ◆ inv_imu_edmp_enable_smd()

int inv_imu_edmp_enable_smd | ( | inv_imu_device_t * | s | ) |

Enable APEX algorithm Significant Motion Detection.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success INV_IMU_ERROR_EDMP_ODR if user should have called `inv_imu_edmp_recompute_apex_decimation()` other negative value on error.

## ◆ inv_imu_edmp_enable_tap()

int inv_imu_edmp_enable_tap | ( | inv_imu_device_t * | s | ) |

Enable APEX algorithm Tap.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success INV_IMU_ERROR_EDMP_ODR if user should have called `inv_imu_edmp_recompute_apex_decimation()` other negative value on error.

## ◆ inv_imu_edmp_enable_tilt()

int inv_imu_edmp_enable_tilt | ( | inv_imu_device_t * | s | ) |

Enable APEX algorithm Tilt.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success INV_IMU_ERROR_EDMP_ODR if user should have called `inv_imu_edmp_recompute_apex_decimation()` other negative value on error.

## ◆ inv_imu_edmp_get_apex_parameters()

int inv_imu_edmp_get_apex_parameters | ( | inv_imu_device_t * | s,
|  | inv_imu_edmp_apex_parameters_t * | p
| ) |  |

Returns current EDMP parameters for APEX algorithms.

Parameters

  [in] | s | Pointer to device.
  [out] | p | The current parameters read from registers.

Returns
  0 on success, negative value on error.

## ◆ inv_imu_edmp_get_config_int_apex()

int inv_imu_edmp_get_config_int_apex | ( | inv_imu_device_t * | s,
|  | inv_imu_edmp_int_state_t * | it
| ) |  |

Retrieve interrupts configuration.

Parameters

  [in] | s | Pointer to device.
  [out] | it | Configuration of each APEX interrupt.

Returns
  0 on success, negative value on error.

## ◆ inv_imu_edmp_get_ff_data()

int inv_imu_edmp_get_ff_data | ( | inv_imu_device_t * | s,
|  | uint16_t * | freefall_duration
| ) |  |

Retrieve APEX free fall outputs and format them.

Parameters

  [in] | s | Pointer to device.
  [out] | freefall_duration | Duration in number of sample.

Returns
  0 on success, negative value on error.

## ◆ inv_imu_edmp_get_int_apex_status()

int inv_imu_edmp_get_int_apex_status | ( | inv_imu_device_t * | s,
|  | inv_imu_edmp_int_state_t * | it
| ) |  |

Read APEX interrupt status.

Parameters

  [in] | s | Pointer to device.
  [out] | it | Status of each APEX interrupt.

Returns
  0 on success, negative value on error.

## ◆ inv_imu_edmp_get_pedometer_data()

int inv_imu_edmp_get_pedometer_data | ( | inv_imu_device_t * | s,
|  | inv_imu_edmp_pedometer_data_t * | data
| ) |  |

Retrieve pedometer outputs.

Parameters

  [in] | s | Pointer to device.
  [out] | data | Pedometer step count and activity data value.

Returns
  0 on success, negative value on error.

Return values

  INV_IMU_ERROR_EDMP_BUF_EMPTY | if step count buffer is empty.

## ◆ inv_imu_edmp_get_tap_data()

int inv_imu_edmp_get_tap_data | ( | inv_imu_device_t * | s,
|  | inv_imu_edmp_tap_data_t * | data
| ) |  |

Retrieve tap outputs.

Parameters

  [in] | s | Pointer to device.
  [out] | data | Tap number and direction.

Returns
  0 on success, negative value on error.

## ◆ inv_imu_edmp_init_apex()

int inv_imu_edmp_init_apex | ( | inv_imu_device_t * | s | ) |

Initialize EDMP APEX algorithms.

This function should be called before calling any other function (except for `inv_imu_edmp_set_frequency`).

Warning
  This function will power-up the SRAM. For power consumption consideration, you can manually call `inv_imu_adv_power_down_sram` if you don't need to preserve SRAM content.
  This function will reset all interrupt masks previously set with `inv_imu_edmp_unmask_int_src` and exit with `EDMP_INT_SRC_ACCEL_DRDY_MASK` unmasked on `INV_IMU_EDMP_INT0`.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error or if EDMP is enabled.

## ◆ inv_imu_edmp_mask_int_src()

int inv_imu_edmp_mask_int_src | ( | inv_imu_device_t * | s,
|  | inv_imu_edmp_int_t | edmp_int_nb,
|  | uint8_t | int_mask
| ) |  |

Mask requested interrupt sources for edmp interrupt line passed in parameter.

Parameters

  [in] | s | Pointer to device.
  [in] | edmp_int_nb | EDMP input interrupt line number that should be configured.
  [in] | int_mask | Interrupt sources to mask.

Returns
  0 on success, negative value on error.

## ◆ inv_imu_edmp_recompute_apex_decimation()

int inv_imu_edmp_recompute_apex_decimation | ( | inv_imu_device_t * | s | ) |

Recompute EDMP APEX algorithms internal decimator based on new EDMP output Data Rate configured with `inv_imu_edmp_set_frequency`.

Warning
  It is up to application level to save/restore previously configured APEX parameters, if any, with `inv_imu_edmp_set_apex_parameters`.
  EDMP must be disabled before calling this function.
  This function will reset all interrupt masks previously set with `inv_imu_edmp_unmask_int_src` and exit with `EDMP_INT_SRC_ACCEL_DRDY_MASK` unmasked on `INV_IMU_EDMP_INT0`.

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error or if EDMP is enabled.

## ◆ inv_imu_edmp_run_ondemand()

int inv_imu_edmp_run_ondemand | ( | inv_imu_device_t * | s,
|  | inv_imu_edmp_int_t | edmp_int_nb
| ) |  |

Run EDMP using the on-demand mechanism.

Parameters

  [in] | s | Pointer to device.
  [in] | edmp_int_nb | EDMP input interrupt line.

Returns
  0 on success, negative value on error.

## ◆ inv_imu_edmp_set_apex_parameters()

int inv_imu_edmp_set_apex_parameters | ( | inv_imu_device_t * | s,
|  | const inv_imu_edmp_apex_parameters_t * | p
| ) |  |

Configures EDMP parameters for APEX algorithms.

Warning
  This function should be called only when all EDMP algorithms are disabled.

Parameters

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

Returns
  0 on success, negative value on error.

## ◆ inv_imu_edmp_set_config_int_apex()

int inv_imu_edmp_set_config_int_apex | ( | inv_imu_device_t * | s,
|  | const inv_imu_edmp_int_state_t * | it
| ) |  |

Configure APEX interrupt.

Parameters

  [in] | s | Pointer to device.
  [in] | it | State of each APEX interrupt to configure.

Returns
  0 on success, negative value on error.

## ◆ inv_imu_edmp_set_frequency()

int inv_imu_edmp_set_frequency | ( | inv_imu_device_t * | s,
|  | const dmp_ext_sen_odr_cfg_apex_odr_t | frequency
| ) |  |

Configure EDMP Output Data Rate.

Warning
  Accel frequency must be higher or equal to EDMP frequency.
  If inv_imu_edmp_init_apex() was already called, application should call `inv_imu_edmp_recompute_apex_decimation()` afterwards if APEX algorithms are to be run.

Parameters

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

Returns
  0 on success, negative value on error.

## ◆ inv_imu_edmp_unmask_int_src()

int inv_imu_edmp_unmask_int_src | ( | inv_imu_device_t * | s,
|  | inv_imu_edmp_int_t | edmp_int_nb,
|  | uint8_t | int_mask
| ) |  |

Unmask requested interrupt sources for edmp interrupt line passed in parameter.

Parameters

  [in] | s | Pointer to device.
  [in] | edmp_int_nb | EDMP input interrupt line number that should be configured.
  [in] | int_mask | Interrupt sources to unmask.

Returns
  0 on success, negative value on error.

## ◆ inv_imu_edmp_wait_for_idle()

int inv_imu_edmp_wait_for_idle | ( | inv_imu_device_t * | s | ) |

Wait until EDMP idle bit is set (means EDMP execution is completed).

Parameters

  [in] | s | Pointer to device.

Returns
  0 on success, negative value on error.