ICM42670 Portable Driver
Public API reference for the ICM-42670-P IMU driver
Loading...
Searching...
No Matches
ICM42670_fsync.h File Reference

Simple FSYNC API for the ICM-42670-P. More...

#include "ICM42670_driver.h"
#include <stdint.h>
Include dependency graph for ICM42670_fsync.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ICM42670_FsyncConfig_t
 FSYNC configuration passed to ICM42670_Enable_Fsync(). More...
 
struct  ICM42670_FsyncData_t
 FSYNC event status and timestamp data. More...
 

Enumerations

enum  ICM42670_FsyncPolarity_t { ICM42670_FSYNC_RISING_EDGE = 0U , ICM42670_FSYNC_FALLING_EDGE = 1U }
 FSYNC input edge selection. More...
 
enum  ICM42670_FsyncTag_t {
  ICM42670_FSYNC_TAG_NONE = 0U , ICM42670_FSYNC_TAG_TEMP = 1U , ICM42670_FSYNC_TAG_GYRO_X = 2U , ICM42670_FSYNC_TAG_GYRO_Y = 3U ,
  ICM42670_FSYNC_TAG_GYRO_Z = 4U , ICM42670_FSYNC_TAG_ACCEL_X = 5U , ICM42670_FSYNC_TAG_ACCEL_Y = 6U , ICM42670_FSYNC_TAG_ACCEL_Z = 7U
}
 Optional UI data LSB tag for FSYNC events. More...
 
enum  ICM42670_FsyncClearMode_t { ICM42670_FSYNC_CLEAR_ON_SENSOR_UPDATE = 0U , ICM42670_FSYNC_CLEAR_ON_TAGGED_LSB_READ = 1U }
 FSYNC event flag clear behavior. More...
 
enum  ICM42670_FsyncInterrupt_t { ICM42670_FSYNC_INT_NONE = 0U , ICM42670_FSYNC_INT1 = 1U , ICM42670_FSYNC_INT2 = 2U }
 FSYNC interrupt routing target. More...
 

Functions

ICM42670_Status_t ICM42670_Enable_Fsync (const ICM42670_Config *config, const ICM42670_FsyncConfig_t *fsync_config)
 Enable FSYNC timestamp capture with simple defaults.
 
ICM42670_Status_t ICM42670_Disable_Fsync (const ICM42670_Config *config)
 Disable FSYNC timestamp capture and clear FSYNC interrupt routing.
 
ICM42670_Status_t ICM42670_Read_Fsync (const ICM42670_Config *config, ICM42670_FsyncData_t *fsync_data)
 Read the read-clear FSYNC event status and latest FSYNC timestamp.
 

Detailed Description

Simple FSYNC API for the ICM-42670-P.

Enumeration Type Documentation

◆ ICM42670_FsyncClearMode_t

FSYNC event flag clear behavior.

Enumerator
ICM42670_FSYNC_CLEAR_ON_SENSOR_UPDATE 

Clear at next sensor update.

ICM42670_FSYNC_CLEAR_ON_TAGGED_LSB_READ 

Clear when tagged LSB is read.

◆ ICM42670_FsyncInterrupt_t

FSYNC interrupt routing target.

Enumerator
ICM42670_FSYNC_INT_NONE 

Do not route FSYNC to an interrupt pin.

ICM42670_FSYNC_INT1 

Route FSYNC to INT1.

ICM42670_FSYNC_INT2 

Route FSYNC to INT2.

◆ ICM42670_FsyncPolarity_t

FSYNC input edge selection.

Enumerator
ICM42670_FSYNC_RISING_EDGE 

Capture rising-edge FSYNC events.

ICM42670_FSYNC_FALLING_EDGE 

Capture falling-edge FSYNC events.

◆ ICM42670_FsyncTag_t

Optional UI data LSB tag for FSYNC events.

Enumerator
ICM42670_FSYNC_TAG_NONE 

Do not tag sensor data LSBs.

ICM42670_FSYNC_TAG_TEMP 

Tag temperature LSB.

ICM42670_FSYNC_TAG_GYRO_X 

Tag gyro X LSB.

ICM42670_FSYNC_TAG_GYRO_Y 

Tag gyro Y LSB.

ICM42670_FSYNC_TAG_GYRO_Z 

Tag gyro Z LSB.

ICM42670_FSYNC_TAG_ACCEL_X 

Tag accel X LSB.

ICM42670_FSYNC_TAG_ACCEL_Y 

Tag accel Y LSB.

ICM42670_FSYNC_TAG_ACCEL_Z 

Tag accel Z LSB.

Function Documentation

◆ ICM42670_Disable_Fsync()

ICM42670_Status_t ICM42670_Disable_Fsync ( const ICM42670_Config config)

Disable FSYNC timestamp capture and clear FSYNC interrupt routing.

Parameters
configDriver configuration with read, write, and delay callbacks.
Returns
ICM42670_OK on success, otherwise ICM42670_ERROR or ICM42670_BUSY.

References ICM42670_ERROR, ICM42670_FSYNC_INT_NONE, and ICM42670_OK.

◆ ICM42670_Enable_Fsync()

ICM42670_Status_t ICM42670_Enable_Fsync ( const ICM42670_Config config,
const ICM42670_FsyncConfig_t fsync_config 
)

Enable FSYNC timestamp capture with simple defaults.

Passing NULL for fsync_config selects rising-edge FSYNC, no UI data LSB tag, clear-on-sensor-update behavior, and no interrupt routing.

Parameters
configDriver configuration with read, write, and delay callbacks.
fsync_configOptional FSYNC configuration, or NULL for defaults.
Returns
ICM42670_OK on success, otherwise ICM42670_ERROR or ICM42670_BUSY.

References ICM42670_FsyncConfig_t::clear_mode, ICM42670_ERROR, ICM42670_FSYNC_CLEAR_ON_TAGGED_LSB_READ, ICM42670_FSYNC_FALLING_EDGE, ICM42670_OK, ICM42670_FsyncConfig_t::interrupt_pin, ICM42670_FsyncConfig_t::polarity, and ICM42670_FsyncConfig_t::tag.

◆ ICM42670_Read_Fsync()

ICM42670_Status_t ICM42670_Read_Fsync ( const ICM42670_Config config,
ICM42670_FsyncData_t fsync_data 
)

Read the read-clear FSYNC event status and latest FSYNC timestamp.

Parameters
configDriver configuration with a read callback.
fsync_dataDestination for event status and timestamp data.
Returns
ICM42670_OK on success, otherwise ICM42670_ERROR.

References ICM42670_FsyncData_t::event_detected, ICM42670_ERROR, ICM42670_OK, ICM42670_FsyncData_t::raw_status, and ICM42670_FsyncData_t::timestamp_delta_us.