19#define I2C_FREQ 400000UL
43 { 0, 0, 229.8f, 1125.0f,
"196,6 ; 229,8 ; 1125.0 " },
44 { 1, 0, 187.6f, 1125.0f,
"151,8 ; 187.6 ; 1125.0 " },
45 { 2, 0, 154.3f, 1125.0f,
"119,5 ; 154,3 ; 1125.0 " },
46 { 3, 2, 73.3f, 375.0f,
"51,2 ; 73,3 ; 375 " },
47 { 4, 5, 35.9f, 187.5f,
"23,9 ; 35,9 ; 187.5 " },
48 { 5, 14, 17.8f, 75.0f,
"11,6 ; 17,8 ; 75.0 " },
49 { 6, 29, 8.9f, 37.5f,
"5,7 ; 8,9 ; 37.5 " },
50 { 7, 0, 376.5f, 1125.0f,
"361,4 ; 376,5 ; 1125 " },
101void printLinea() { Serial.println(F(
"------------------------------------------------------------")); }
103void printDobleLinea() { Serial.println(F(
"============================================================")); }
111 Serial.println(F(
"ERROR: WHO_AM_I mismatch"));
112 while (1) delay(200);
114 Serial.printf(
"WHO_AM_I = 0x%02X OK\n", who);
152 Serial.println(F(
" ICM-20948 | UNIT Electronics"));
153 Serial.println(F(
" MODO VERIFICACION — FS=+-2g fijo, 3 lecturas por config"));
154 Serial.println(F(
" Sensor PLANO y QUIETO | Az esperado: ~+1.000g"));
156 for (uint8_t i = 0; i <
N_FS ; i++){
157 for(uint8_t d = 0; d <
N_DLPF; d++){
161 Serial.println(F(
"ERROR: applySettings fallo"));
165 uint32_t settle_ms = max((uint32_t)(10000.0f /
configsDLPF[d].odr_hz),
169 uint32_t periodo_ms = max((uint32_t)(1000.0f /
configsDLPF[d].odr_hz),
172 for (uint8_t r = 0; r < 100; r++) {
176 Serial.printf(
"%d ; %s ; %s ; %+.4f ; %+.4f ; %+.4f\n",
183 Serial.println(F(
" [?] readGyr() fallo"));
196 Serial.begin(115200);
200 Serial.println(F(
" ICM-20948 VALIDACION ACELEROMETRO"));
206 Serial.println(F(
"ERROR: beginI2C() fallo"));
207 while (1) delay(200);
220 Serial.println(F(
"ERROR: setSensors() fallo"));
223 Serial.println(F(
" Sensor listo.\n"));
224 Serial.println(F(
" Sensor PLANO y QUIETO sobre la mesa."));
225 Serial.println(F(
" Iniciando en 5 segundos..."));
226 for (
int i = 5; i > 0; i--) {
227 Serial.printf(
" %d...\n", i);
bool readGyro(float &x, float &y, float &z)
bool setDLPF(ICM20948_Gyro_DLPF dlpf, bool bypass)
bool setGyroDivRate(uint8_t divisor)
bool setGyroScale(ICM20948_Gyro_FullScale fullScale)
bool readWhoAmI(uint8_t &whoAmI)
bool beginI2C(uint8_t address=0x69, TwoWire &i2cPort=Wire, uint32_t i2cSpeed=400000)
bool setSensors(bool accel_on, bool gyro_on, bool temp_on)
#define SCL_PIN
I2C SCL pin used by the example board.
const uint8_t N_AVG
Number of gyroscope averaging settings.
void firstStage()
Verify the IMU identity register.
void printDobleLinea()
Print a double separator line to Serial.
const ICM20948_Gyro_Average gyroAVGCfg[]
Gyroscope averaging settings available for experiments.
void setup()
Initialize I2C, reset/wake the IMU, enable gyro, and start the sweep.
#define SDA_PIN
I2C SDA pin used by the example board.
void runSweep()
Run the gyroscope validation sweep and print each captured sample.
const uint8_t N_FS
Number of gyroscope full-scale ranges.
const ICM20948_Gyro_DLPF gyroDLPF[]
Gyroscope DLPF enum values matching configsDLPF.
const uint8_t N_DLPF
Number of gyroscope DLPF configurations.
void printLinea()
Print a separator line to Serial.
#define I2C_FREQ
I2C bus speed in hertz.
#define ICM_ADDR
ICM-20948 I2C address selected by the AD0 pin.
const ICM20948_Gyro_FullScale gyroFSCfg[]
Gyroscope full-scale ranges exercised by the sweep.
const configDLPF configsDLPF[]
DevLab_ICM20948 imu
Global ICM-20948 driver instance.
const char * etiquetasGyroFSCfg[]
Text labels matching gyroFSCfg.
const char * etiquetasGyroAVGCfg[]
Text labels matching gyroAVGCfg.
void loop()
Empty loop; this sketch runs the gyroscope sweep once in setup().
void applySettings()
Initialize the magnetometer and collect samples for each mode.
Gyroscope DLPF divider and timing configuration.
float odr_hz
Output data rate in hertz for timing calculations.
uint8_t dlpf_idx
Index into the gyroDLPF lookup table.
const char * nombre
Text label printed with each captured sample.
uint16_t div
Sample-rate divider written to the IMU register.
float nbw_hz
Noise bandwidth in hertz for reporting.