DevLab_ICM20948 1.0.2 ICM-20948 9-Axis Motion Sensor Driver

Loading...
Searching...
No Matches
Macros | Functions | Variables
interrupt.ino File Reference

I2C interrupt example for the DevLab ICM-20948. More...

`#include <Wire.h>`
`#include <DevLab_ICM20948.h>`
Include dependency graph for interrupt.ino:

Go to the source code of this file.

## Macros
#define | SDA_PIN 6
| I2C SDA pin used by the example board.
#define | SCL_PIN 7
| I2C SCL pin used by the example board.
#define | I2C_FREQ 400000UL
| I2C bus speed in hertz.
#define | ICM_ADDR 0x69
| ICM-20948 I2C address selected by the AD0 pin.
#define | PIN_INT D7
| MCU pin connected to the IMU interrupt output.

## Functions
void | printLinea ()
| Print a separator line to Serial.
void | printDobleLinea ()
| Print a double separator line to Serial.
void IRAM_ATTR | isrHandler ()
| Interrupt service routine for the IMU data-ready signal.
void | setup ()
| Initialize I2C, verify the IMU, configure interrupts, and attach ISR.
void | loop ()
| Report interrupt events when the ISR count changes.

## Variables
DevLab_ICM20948 | imu
| Global ICM-20948 driver instance.
ICM20948_IntPinConfig | pinCfg
| Interrupt pin electrical and latch configuration.
ICM20948_IntEnableConfig | intEn
| Interrupt enable flags used by this example.
volatile uint32_t | isrCount = 0
| Number of interrupt events observed by the ISR.

## Detailed Description

I2C interrupt example for the DevLab ICM-20948.

Author
  Jonathan Mejorado Lopez

Configures the IMU raw-data-ready interrupt pin and counts ISR events on an Arduino-compatible board.

Definition in file interrupt.ino.

## Macro Definition Documentation

## ◆ I2C_FREQ

#define I2C_FREQ 400000UL

I2C bus speed in hertz.

Definition at line 17 of file interrupt.ino.

## ◆ ICM_ADDR

#define ICM_ADDR 0x69

ICM-20948 I2C address selected by the AD0 pin.

Definition at line 19 of file interrupt.ino.

## ◆ PIN_INT

#define PIN_INT D7

MCU pin connected to the IMU interrupt output.

Definition at line 21 of file interrupt.ino.

## ◆ SCL_PIN

#define SCL_PIN 7

I2C SCL pin used by the example board.

Definition at line 15 of file interrupt.ino.

## ◆ SDA_PIN

#define SDA_PIN 6

I2C SDA pin used by the example board.

Definition at line 13 of file interrupt.ino.

## Function Documentation

## ◆ isrHandler()

void IRAM_ATTR isrHandler | ( |  | ) |

Interrupt service routine for the IMU data-ready signal.

Definition at line 53 of file interrupt.ino.

Here is the caller graph for this function:

## ◆ loop()

void loop | ( |  | ) |

Report interrupt events when the ISR count changes.

Definition at line 95 of file interrupt.ino.

## ◆ printDobleLinea()

void printDobleLinea | ( |  | ) |

Print a double separator line to Serial.

Definition at line 29 of file interrupt.ino.

## ◆ printLinea()

void printLinea | ( |  | ) |

Print a separator line to Serial.

Definition at line 27 of file interrupt.ino.

## ◆ setup()

void setup | ( |  | ) |

Initialize I2C, verify the IMU, configure interrupts, and attach ISR.

Definition at line 60 of file interrupt.ino.

Here is the call graph for this function:

## Variable Documentation

## ◆ imu

DevLab_ICM20948 imu

Global ICM-20948 driver instance.

Definition at line 24 of file interrupt.ino.

## ◆ intEn

ICM20948_IntEnableConfig intEn

Initial value:
= {
.rawDataRdyEn = 1
}

Interrupt enable flags used by this example.

Definition at line 43 of file interrupt.ino.

## ◆ isrCount

volatile uint32_t isrCount = 0

Number of interrupt events observed by the ISR.

Definition at line 48 of file interrupt.ino.

## ◆ pinCfg

ICM20948_IntPinConfig pinCfg

Initial value:
= {
.activeLevel = 1,
.driveMode = 0,
.latchMode = 0,
.clearMode = 1,
.fsyncActLevel = 0,
.fsyncIntEn = 0,
.bypassEn = 0
}

Interrupt pin electrical and latch configuration.

Definition at line 32 of file interrupt.ino.