DevLab_ICM20948 1.0.2
ICM-20948 9-Axis Motion Sensor Driver
Loading...
Searching...
No Matches
mag_test.ino File Reference

Magnetometer operation-mode sweep for the DevLab ICM-20948. More...

#include <Wire.h>
#include <DevLab_ICM20948.h>
Include dependency graph for mag_test.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.
 

Functions

void printLinea ()
 Print a separator line to Serial.
 
void printDobleLinea ()
 Print a double separator line to Serial.
 
void applySettings ()
 Initialize the magnetometer and collect samples for each mode.
 
void setup ()
 Initialize I2C, verify the IMU, enable sensors, and start the sweep.
 
void loop ()
 Empty loop; this sketch runs the magnetometer sweep once in setup().
 

Variables

DevLab_ICM20948 imu
 Global ICM-20948 driver instance.
 
const ICM20948_Op_Mode opMode []
 Magnetometer operating modes tested by the sweep.
 
const char * etiquetasOpModeCfg []
 Text labels matching the operating modes printed in the sweep.
 
const uint8_t N_OPM = 6
 Number of printable magnetometer operation modes.
 

Detailed Description

Magnetometer operation-mode sweep for the DevLab ICM-20948.

Author
Jonathan Mejorado Lopez

Initializes the AK09916 magnetometer through the ICM-20948 internal I2C master, iterates through continuous measurement modes, and prints CSV-like magnetic field samples to the Serial monitor.

Definition in file mag_test.ino.

Macro Definition Documentation

◆ I2C_FREQ

#define I2C_FREQ   400000UL

I2C bus speed in hertz.

Definition at line 20 of file mag_test.ino.

◆ ICM_ADDR

#define ICM_ADDR   0x69

ICM-20948 I2C address selected by the AD0 pin.

Definition at line 22 of file mag_test.ino.

◆ SCL_PIN

#define SCL_PIN   7

I2C SCL pin used by the example board.

Definition at line 18 of file mag_test.ino.

◆ SDA_PIN

#define SDA_PIN   6

I2C SDA pin used by the example board.

Definition at line 16 of file mag_test.ino.

Function Documentation

◆ applySettings()

void applySettings ( )

Initialize the magnetometer and collect samples for each mode.

Definition at line 53 of file mag_test.ino.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loop()

void loop ( )

Empty loop; this sketch runs the magnetometer sweep once in setup().

Definition at line 138 of file mag_test.ino.

◆ printDobleLinea()

void printDobleLinea ( )

Print a double separator line to Serial.

Definition at line 30 of file mag_test.ino.

◆ printLinea()

void printLinea ( )

Print a separator line to Serial.

Definition at line 28 of file mag_test.ino.

◆ setup()

void setup ( )

Initialize I2C, verify the IMU, enable sensors, and start the sweep.

Definition at line 91 of file mag_test.ino.

Here is the call graph for this function:

Variable Documentation

◆ etiquetasOpModeCfg

const char* etiquetasOpModeCfg[]
Initial value:
= {
"PowerDown","SingleMeasure","Continuo1","Continuo2","Continuo3","Continuo4"
}

Text labels matching the operating modes printed in the sweep.

Definition at line 44 of file mag_test.ino.

◆ imu

Global ICM-20948 driver instance.

Definition at line 25 of file mag_test.ino.

◆ N_OPM

const uint8_t N_OPM = 6

Number of printable magnetometer operation modes.

Definition at line 48 of file mag_test.ino.

◆ opMode