DevLab_ICM20948 1.0.2 ICM-20948 9-Axis Motion Sensor Driver

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

Gyroscope DLPF and full-scale sweep for the DevLab ICM-20948. More...

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

Go to the source code of this file.

## Classes
struct | configDLPF
| Gyroscope DLPF divider and timing configuration. More...

## 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 | firstStage ()
| Verify the IMU identity register.
bool | applySettings (uint8_t fs_idx, const configDLPF &cfg)
| Apply one gyroscope full-scale and DLPF configuration.
void | runSweep ()
| Run the gyroscope validation sweep and print each captured sample.
void | setup ()
| Initialize I2C, reset/wake the IMU, enable gyro, and start the sweep.
void | loop ()
| Empty loop; this sketch runs the gyroscope sweep once in setup().

## Variables
const configDLPF | configsDLPF []
const uint8_t | N_DLPF = sizeof(configsDLPF) / sizeof(configsDLPF[0])
| Number of gyroscope DLPF configurations.
const ICM20948_Gyro_FullScale | gyroFSCfg []
| Gyroscope full-scale ranges exercised by the sweep.
const char * | etiquetasGyroFSCfg [] = {"250", "500", "1000", "2000"}
| Text labels matching gyroFSCfg.
const uint8_t | N_FS = 4
| Number of gyroscope full-scale ranges.
const ICM20948_Gyro_DLPF | gyroDLPF []
| Gyroscope DLPF enum values matching configsDLPF.
const ICM20948_Gyro_Average | gyroAVGCfg []
| Gyroscope averaging settings available for experiments.
const char * | etiquetasGyroAVGCfg [] = {"1","2","4","8","16","32","64","128"}
| Text labels matching gyroAVGCfg.
const uint8_t | N_AVG = 8
| Number of gyroscope averaging settings.
DevLab_ICM20948 | imu
| Global ICM-20948 driver instance.

## Detailed Description

Gyroscope DLPF and full-scale sweep for the DevLab ICM-20948.

Author
  Jonathan Mejorado Lopez

Applies each gyroscope filter/full-scale configuration over I2C and prints repeated samples for validation and noise comparison.

Definition in file gyr_test.ino.

## Macro Definition Documentation

## ◆ I2C_FREQ

#define I2C_FREQ 400000UL

I2C bus speed in hertz.

Definition at line 19 of file gyr_test.ino.

## ◆ ICM_ADDR

#define ICM_ADDR 0x69

ICM-20948 I2C address selected by the AD0 pin.

Definition at line 21 of file gyr_test.ino.

## ◆ SCL_PIN

#define SCL_PIN 7

I2C SCL pin used by the example board.

Definition at line 17 of file gyr_test.ino.

## ◆ SDA_PIN

#define SDA_PIN 6

I2C SDA pin used by the example board.

Definition at line 15 of file gyr_test.ino.

## Function Documentation

## ◆ applySettings()

bool applySettings | ( | uint8_t | fs_idx,
|  | const configDLPF & | cfg
| ) |  |

Apply one gyroscope full-scale and DLPF configuration.

Parameters

  fs_idx | Index into gyroFSCfg.
  cfg | DLPF timing and divider configuration.

Returns
  true if all configuration writes succeeded, otherwise false.

Definition at line 124 of file gyr_test.ino.

Here is the call graph for this function:

## ◆ firstStage()

void firstStage | ( |  | ) |

Verify the IMU identity register.

Definition at line 108 of file gyr_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 gyroscope sweep once in setup().

Definition at line 239 of file gyr_test.ino.

## ◆ printDobleLinea()

void printDobleLinea | ( |  | ) |

Print a double separator line to Serial.

Definition at line 103 of file gyr_test.ino.

Here is the caller graph for this function:

## ◆ printLinea()

void printLinea | ( |  | ) |

Print a separator line to Serial.

Definition at line 101 of file gyr_test.ino.

## ◆ runSweep()

void runSweep | ( |  | ) |

Run the gyroscope validation sweep and print each captured sample.

Definition at line 149 of file gyr_test.ino.

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

## ◆ setup()

void setup | ( |  | ) |

Initialize I2C, reset/wake the IMU, enable gyro, and start the sweep.

Definition at line 194 of file gyr_test.ino.

Here is the call graph for this function:

## Variable Documentation

## ◆ configsDLPF

const configDLPF configsDLPF[]

Initial value:
= {
{ 0, 0, 229.8f, 1125.0f, "196,6 ; 229,8 ; 1125.0 " },
{ 1, 0, 187.6f, 1125.0f, "151,8 ; 187.6 ; 1125.0 " },
{ 2, 0, 154.3f, 1125.0f, "119,5 ; 154,3 ; 1125.0 " },
{ 3, 2, 73.3f, 375.0f, "51,2 ; 73,3 ; 375 " },
{ 4, 5, 35.9f, 187.5f, "23,9 ; 35,9 ; 187.5 " },
{ 5, 14, 17.8f, 75.0f, "11,6 ; 17,8 ; 75.0 " },
{ 6, 29, 8.9f, 37.5f, "5,7 ; 8,9 ; 37.5 " },
{ 7, 0, 376.5f, 1125.0f, "361,4 ; 376,5 ; 1125 " },
}

Definition at line 42 of file gyr_test.ino.

## ◆ etiquetasGyroAVGCfg

const char* etiquetasGyroAVGCfg[] = {"1","2","4","8","16","32","64","128"}

Text labels matching gyroAVGCfg.

Definition at line 93 of file gyr_test.ino.

## ◆ etiquetasGyroFSCfg

const char* etiquetasGyroFSCfg[] = {"250", "500", "1000", "2000"}

Text labels matching gyroFSCfg.

Definition at line 64 of file gyr_test.ino.

## ◆ gyroAVGCfg

const ICM20948_Gyro_Average gyroAVGCfg[]

Initial value:
= {
ICM20948_Gyro_Average::AVG_1,
ICM20948_Gyro_Average::AVG_2,
ICM20948_Gyro_Average::AVG_4,
ICM20948_Gyro_Average::AVG_8,
ICM20948_Gyro_Average::AVG_16,
ICM20948_Gyro_Average::AVG_32,
ICM20948_Gyro_Average::AVG_64,
ICM20948_Gyro_Average::AVG_128
}
ICM20948_Gyro_Average::AVG_1
@ AVG_1
ICM20948_Gyro_Average::AVG_128
@ AVG_128
ICM20948_Gyro_Average::AVG_4
@ AVG_4
ICM20948_Gyro_Average::AVG_32
@ AVG_32
ICM20948_Gyro_Average::AVG_8
@ AVG_8
ICM20948_Gyro_Average::AVG_2
@ AVG_2
ICM20948_Gyro_Average::AVG_64
@ AVG_64
ICM20948_Gyro_Average::AVG_16
@ AVG_16

Gyroscope averaging settings available for experiments.

Definition at line 81 of file gyr_test.ino.

## ◆ gyroDLPF

const ICM20948_Gyro_DLPF gyroDLPF[]

Initial value:
= {
ICM20948_Gyro_DLPF::DLPF_196HZ,
ICM20948_Gyro_DLPF::DLPF_151HZ,
ICM20948_Gyro_DLPF::DLPF_119HZ,
ICM20948_Gyro_DLPF::DLPF_51HZ,
ICM20948_Gyro_DLPF::DLPF_23HZ,
ICM20948_Gyro_DLPF::DLPF_11HZ,
ICM20948_Gyro_DLPF::DLPF_5HZ,
ICM20948_Gyro_DLPF::DLPF_361HZ
}
ICM20948_Gyro_DLPF::DLPF_5HZ
@ DLPF_5HZ
ICM20948_Gyro_DLPF::DLPF_151HZ
@ DLPF_151HZ
ICM20948_Gyro_DLPF::DLPF_11HZ
@ DLPF_11HZ
ICM20948_Gyro_DLPF::DLPF_196HZ
@ DLPF_196HZ
ICM20948_Gyro_DLPF::DLPF_119HZ
@ DLPF_119HZ
ICM20948_Gyro_DLPF::DLPF_51HZ
@ DLPF_51HZ
ICM20948_Gyro_DLPF::DLPF_361HZ
@ DLPF_361HZ
ICM20948_Gyro_DLPF::DLPF_23HZ
@ DLPF_23HZ

Gyroscope DLPF enum values matching configsDLPF.

Definition at line 69 of file gyr_test.ino.

## ◆ gyroFSCfg

const ICM20948_Gyro_FullScale gyroFSCfg[]

Initial value:
= {
ICM20948_Gyro_FullScale::DPS_250,
ICM20948_Gyro_FullScale::DPS_500,
ICM20948_Gyro_FullScale::DPS_1000,
ICM20948_Gyro_FullScale::DPS_2000
}
ICM20948_Gyro_FullScale::DPS_250
@ DPS_250
ICM20948_Gyro_FullScale::DPS_2000
@ DPS_2000
ICM20948_Gyro_FullScale::DPS_500
@ DPS_500
ICM20948_Gyro_FullScale::DPS_1000
@ DPS_1000

Gyroscope full-scale ranges exercised by the sweep.

Definition at line 56 of file gyr_test.ino.

## ◆ imu

DevLab_ICM20948 imu

Global ICM-20948 driver instance.

Definition at line 98 of file gyr_test.ino.

## ◆ N_AVG

const uint8_t N_AVG = 8

Number of gyroscope averaging settings.

Definition at line 95 of file gyr_test.ino.

## ◆ N_DLPF

const uint8_t N_DLPF = sizeof(configsDLPF) / sizeof(configsDLPF[0])

Number of gyroscope DLPF configurations.

Definition at line 53 of file gyr_test.ino.

## ◆ N_FS

const uint8_t N_FS = 4

Number of gyroscope full-scale ranges.

Definition at line 66 of file gyr_test.ino.