|
ICM42670 Portable Driver
Public API reference for the ICM-42670-P IMU driver
|
Simple FIFO and interrupt routing API for the ICM-42670-P. More...


Go to the source code of this file.
Data Structures | |
| struct | ICM42670_FifoPacket_t |
| Parsed FIFO packet using the default 16-bit FIFO format. More... | |
Macros | |
| #define | ICM42670_FIFO_DEFAULT_WATERMARK_BYTES 64U |
| Default FIFO watermark used by ICM42670_FIFO_Init(). | |
| #define | ICM42670_FIFO_DEFAULT_PACKET_BYTES 16U |
| Maximum bytes in the default 16-bit accel + gyro FIFO packet. | |
Enumerations | |
| enum | ICM42670_IntPin_t { ICM42670_INT_PIN1 = 0U , ICM42670_INT_PIN2 = 1U } |
| ICM-42670-P interrupt output pins. More... | |
| enum | ICM42670_FifoIntSource_t { ICM42670_FIFO_INT_NONE = 0x00U , ICM42670_FIFO_INT_THRESHOLD = 0x04U , ICM42670_FIFO_INT_FULL = 0x02U , ICM42670_FIFO_INT_THRESHOLD_AND_FULL } |
| FIFO interrupt sources that can be routed to INT1 or INT2. More... | |
Functions | |
| ICM42670_Status_t | ICM42670_FIFO_Init (const ICM42670_Config *config) |
| Initialize the FIFO with simple 16-bit accel and gyro packet defaults. | |
| ICM42670_Status_t | ICM42670_FIFO_UseFullBuffer (const ICM42670_Config *config) |
| Disable APEX features so the FIFO can use the full 2.25 KB buffer. | |
| ICM42670_Status_t | ICM42670_FIFO_SetWatermark (const ICM42670_Config *config, uint16_t watermark_bytes) |
| Set the FIFO watermark level in bytes. | |
| ICM42670_Status_t | ICM42670_FIFO_Flush (const ICM42670_Config *config) |
| Flush all unread FIFO data. | |
| ICM42670_Status_t | ICM42670_FIFO_Read (const ICM42670_Config *config, ICM42670_FifoPacket_t *packets, uint16_t max_packets, uint16_t *packets_read) |
| Read and parse available FIFO packets. | |
| ICM42670_Status_t | ICM42670_FIFO_RouteInterrupt (const ICM42670_Config *config, ICM42670_IntPin_t pin, ICM42670_FifoIntSource_t sources) |
| Route FIFO threshold and/or FIFO full interrupts to INT1 or INT2. | |
Simple FIFO and interrupt routing API for the ICM-42670-P.
| enum ICM42670_IntPin_t |
| ICM42670_Status_t ICM42670_FIFO_Flush | ( | const ICM42670_Config * | config | ) |
Flush all unread FIFO data.
| config | Driver configuration with write and delay callbacks. |
References ICM42670_Config::delay_ms, ICM42670_ERROR, and ICM42670_OK.
Referenced by ICM42670_FIFO_Init().
| ICM42670_Status_t ICM42670_FIFO_Init | ( | const ICM42670_Config * | config | ) |
Initialize the FIFO with simple 16-bit accel and gyro packet defaults.
Configures stream mode, disables FIFO bypass, enables accel and gyro FIFO packets, uses byte-based FIFO counts, applies a small watermark, and flushes stale FIFO data before use.
| config | Driver configuration with read, write, and delay callbacks. |
References ICM42670_ERROR, ICM42670_FIFO_DEFAULT_WATERMARK_BYTES, ICM42670_FIFO_Flush(), ICM42670_FIFO_SetWatermark(), and ICM42670_OK.
| ICM42670_Status_t ICM42670_FIFO_Read | ( | const ICM42670_Config * | config, |
| ICM42670_FifoPacket_t * | packets, | ||
| uint16_t | max_packets, | ||
| uint16_t * | packets_read | ||
| ) |
Read and parse available FIFO packets.
Reads up to max_packets parsed FIFO records into packets and writes the number of parsed packets to packets_read.
| config | Driver configuration with a read callback. |
| packets | Destination array for parsed packets. |
| max_packets | Maximum number of packets to parse into packets. |
| packets_read | Number of packets parsed by this call. |
References ICM42670_ERROR, ICM42670_FIFO_DEFAULT_PACKET_BYTES, and ICM42670_OK.
| ICM42670_Status_t ICM42670_FIFO_RouteInterrupt | ( | const ICM42670_Config * | config, |
| ICM42670_IntPin_t | pin, | ||
| ICM42670_FifoIntSource_t | sources | ||
| ) |
Route FIFO threshold and/or FIFO full interrupts to INT1 or INT2.
Passing ICM42670_FIFO_INT_NONE clears FIFO routing for the selected pin while preserving other interrupt sources.
| config | Driver configuration with read and write callbacks. |
| pin | Target interrupt pin. |
| sources | FIFO interrupt sources to route. |
References ICM42670_ERROR, ICM42670_FIFO_INT_FULL, ICM42670_FIFO_INT_THRESHOLD, ICM42670_INT_PIN1, ICM42670_INT_PIN2, and ICM42670_OK.
| ICM42670_Status_t ICM42670_FIFO_SetWatermark | ( | const ICM42670_Config * | config, |
| uint16_t | watermark_bytes | ||
| ) |
Set the FIFO watermark level in bytes.
The watermark is used by the FIFO threshold interrupt source. Values larger than the 12-bit FIFO watermark field are clamped.
| config | Driver configuration with read and write callbacks. |
| watermark_bytes | FIFO threshold in bytes. |
References ICM42670_ERROR, and ICM42670_OK.
Referenced by ICM42670_FIFO_Init().
| ICM42670_Status_t ICM42670_FIFO_UseFullBuffer | ( | const ICM42670_Config * | config | ) |
Disable APEX features so the FIFO can use the full 2.25 KB buffer.
APEX and full FIFO capacity share SRAM. Call this only when APEX features are not needed.
| config | Driver configuration with read, write, and delay callbacks. |
References ICM42670_ERROR, and ICM42670_OK.