\doxysection{test2.\+ino}
\hypertarget{test2_8ino_source}{}\label{test2_8ino_source}\index{examples/test2/test2.ino@{examples/test2/test2.ino}}
\mbox{\hyperlink{test2_8ino}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00001}00001\ /**}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00002}00002\ \ *\ @file\ test2.ino}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00003}00003\ \ *\ @brief\ Extended\ accelerometer\ DLPF,\ full-\/scale,\ and\ averaging\ sweep.}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00004}00004\ \ *\ @details\ Runs\ a\ larger\ I2C\ validation\ matrix\ for\ the\ 7Semi\ ICM-\/20948}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00005}00005\ \ *\ accelerometer\ and\ prints\ CSV-\/like\ samples\ for\ later\ analysis.}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00006}00006\ \ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00007}00007\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00008}00008\ \#include\ <Wire.h>}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00009}00009\ \#include\ <DevLab\_ICM20948.h>}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00010}00010\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00011}00011\ //\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00012}00012\ //\ PINES\ I2C\ —\ ESP32C6\ NANO\ Unit\ Electronics}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00013}00013\ //\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00014}00014\ /**\ @brief\ I2C\ SDA\ pin\ used\ by\ the\ example\ board.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00015}00015\ \#define\ SDA\_PIN\ \ \ 6}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00016}00016\ /**\ @brief\ I2C\ SCL\ pin\ used\ by\ the\ example\ board.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00017}00017\ \#define\ SCL\_PIN\ \ \ 7}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00018}00018\ /**\ @brief\ I2C\ bus\ speed\ in\ hertz.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00019}00019\ \#define\ I2C\_FREQ\ \ 400000UL}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00020}00020\ /**\ @brief\ ICM-\/20948\ I2C\ address\ selected\ by\ the\ AD0\ pin.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00021}00021\ \#define\ ICM\_ADDR\ \ 0x69}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00022}00022\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00023}00023\ //\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00024}00024\ //\ STRUCT}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00025}00025\ //\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00026}00026\ /**\ @brief\ Accelerometer\ DLPF\ divider\ and\ timing\ configuration.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00027}00027\ struct\ configDLPF\ \{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00028}00028\ \ \ /**\ @brief\ Index\ into\ the\ accelDLPF\ lookup\ table.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00029}00029\ \ \ uint8\_t\ \ \ \ \ dlpf\_idx;}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00030}00030\ \ \ /**\ @brief\ Sample-\/rate\ divider\ written\ to\ the\ IMU\ register.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00031}00031\ \ \ uint16\_t\ \ \ \ div;}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00032}00032\ \ \ /**\ @brief\ Noise\ bandwidth\ in\ hertz\ for\ reporting.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00033}00033\ \ \ float\ \ \ \ \ \ \ nbw\_hz;}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00034}00034\ \ \ /**\ @brief\ Output\ data\ rate\ in\ hertz\ for\ timing\ calculations.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00035}00035\ \ \ float\ \ \ \ \ \ \ odr\_hz;}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00036}00036\ \ \ /**\ @brief\ Text\ label\ printed\ with\ each\ captured\ sample.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00037}00037\ \ \ const\ char*\ nombre;}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00038}00038\ \};}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00039}00039\ //id,div,nbw\_hz,odr\_hz,nombre\ :\ \{DLPF,\ NBW\ ,\ ODR\}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00040}00040\ /**\ @brief\ Accelerometer\ DLPF\ configurations\ exercised\ by\ this\ sweep.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00041}00041\ const\ configDLPF\ configsDLPF[]\ =\ \{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00042}00042\ \ \ \{\ \ 0,\ \ \ 0,\ \ 265.0f,\ 1125.0f,\ "{}246\ ;\ 265\ ;\ 1125\ "{}\ \},}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00043}00043\ \ \ \{\ \ 1,\ \ \ 0,\ \ 265.0f,\ 1125.0f,\ "{}246\ ;\ 265\ ;\ 1125\ "{}\ \},}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00044}00044\ \ \ \{\ \ 2,\ \ \ 1,\ \ 136.0f,\ \ 562.5f,\ "{}111\ ;\ 136\ ;\ 562\ "{}\ \},}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00045}00045\ \ \ \{\ \ 3,\ \ \ 2,\ \ \ 68.8f,\ \ 375.0f,\ "{}50\ ;\ 69\ ;\ 375\ "{}\ \},}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00046}00046\ \ \ \{\ \ 4,\ \ \ 7,\ \ \ 34.4f,\ \ 140.6f,\ "{}24\ ;\ 34\ ;\ 141\ "{}\ \},}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00047}00047\ \ \ \{\ \ 5,\ \ 15,\ \ \ 17.0f,\ \ \ 70.3f,\ "{}12\ ;\ 17\ ;\ \ 70\ "{}\ \},}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00048}00048\ \ \ \{\ \ 6,\ \ 29,\ \ \ \ 8.3f,\ \ \ 37.5f,\ "{}6\ ;\ 8\ ;\ \ 35\ "{}\ \},}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00049}00049\ \ \ \{\ \ 7,\ \ \ 0,\ \ 499.0f,\ 1125.0f,\ "{}473\ ;\ 499\ ;\ 1125\ "{}\ \},}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00050}00050\ \};}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00051}00051\ /**\ @brief\ Number\ of\ accelerometer\ DLPF\ configurations.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00052}00052\ const\ uint8\_t\ N\_DLPF\ =\ sizeof(configsDLPF)\ /\ sizeof(configsDLPF[0]);}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00053}00053\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00054}00054\ //\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00055}00055\ //\ ARRAYS\ ORIGINALES}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00056}00056\ //\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00057}00057\ /**\ @brief\ Accelerometer\ full-\/scale\ ranges\ exercised\ by\ the\ sweep.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00058}00058\ const\ ICM20948\_Accel\_FullScale\ accelCfg[]\ =\ \{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00059}00059\ \ \ ICM20948\_Accel\_FullScale::G\_2,}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00060}00060\ \ \ ICM20948\_Accel\_FullScale::G\_4,}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00061}00061\ \ \ ICM20948\_Accel\_FullScale::G\_8,}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00062}00062\ \ \ ICM20948\_Accel\_FullScale::G\_16}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00063}00063\ \};}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00064}00064\ /**\ @brief\ Text\ labels\ matching\ accelCfg.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00065}00065\ const\ char*\ etiquetasAccelCfg[]\ =\ \{\ "{}+-\/2G"{},"{}+-\/4G"{},"{}+-\/8G"{},"{}+-\/16G"{}\ \};}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00066}00066\ /**\ @brief\ Number\ of\ accelerometer\ full-\/scale\ ranges.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00067}00067\ const\ uint8\_t\ N\_FS\ =\ 4;}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00068}00068\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00069}00069\ /**\ @brief\ Accelerometer\ DLPF\ enum\ values\ matching\ configsDLPF.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00070}00070\ const\ ICM20948\_Accel\_DLPFCFG\ accelDLPF[]\ =\ \{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00071}00071\ \ \ ICM20948\_Accel\_DLPFCFG::DLPF0\_246HZ,}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00072}00072\ \ \ ICM20948\_Accel\_DLPFCFG::DLPF\_246HZ,}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00073}00073\ \ \ ICM20948\_Accel\_DLPFCFG::DLPF\_111HZ,}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00074}00074\ \ \ ICM20948\_Accel\_DLPFCFG::DLPF\_50HZ,}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00075}00075\ \ \ ICM20948\_Accel\_DLPFCFG::DLPF\_24HZ,}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00076}00076\ \ \ ICM20948\_Accel\_DLPFCFG::DLPF\_12HZ,}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00077}00077\ \ \ ICM20948\_Accel\_DLPFCFG::DLPF\_6HZ,}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00078}00078\ \ \ ICM20948\_Accel\_DLPFCFG::DLPF\_473HZ}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00079}00079\ \};}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00080}00080\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00081}00081\ /**\ @brief\ Accelerometer\ averaging\ settings\ exercised\ by\ the\ sweep.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00082}00082\ const\ ICM20948\_Accel\_Average\ accelAVG[]\ =\ \{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00083}00083\ \ \ ICM20948\_Accel\_Average::AVG\_1\_OR\_4,}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00084}00084\ \ \ ICM20948\_Accel\_Average::AVG\_8,}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00085}00085\ \ \ ICM20948\_Accel\_Average::AVG\_16,}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00086}00086\ \ \ ICM20948\_Accel\_Average::AVG\_32}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00087}00087\ \};}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00088}00088\ /**\ @brief\ Text\ labels\ matching\ accelAVG.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00089}00089\ const\ char*\ etiquetasAccelAVG[]\ =\ \{\ "{}14"{},"{}8"{},"{}16"{},"{}32"{}\ \};}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00090}00090\ /**\ @brief\ Number\ of\ accelerometer\ averaging\ settings.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00091}00091\ const\ uint8\_t\ N\_AVG\ =\ 4;}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00092}00092\ /**\ @brief\ Raw\ accelerometer\ sample-\/rate\ divider\ values\ for\ experiments.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00093}00093\ const\ uint16\_t\ accelSR[]\ =\ \{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00094}00094\ \ \ 0,\ 1,\ 3,\ 5,\ 7,\ 10,\ 15,\ 22,\ 31,\ 63,\ 127,\ 255,\ 513,\ 1022,\ 2044,\ 4095}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00095}00095\ \};}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00096}00096\ /**\ @brief\ Text\ labels\ matching\ accelSR\ output\ data\ rates.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00097}00097\ const\ char*\ etiquetasSR[]\ =\ \{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00098}00098\ \ \ "{}1125.0"{},"{}562.5"{},"{}281.3"{},"{}187.5"{},"{}140.6"{},"{}102.3"{},"{}70.3"{},}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00099}00099\ \ \ "{}48.9"{},"{}35.2"{},"{}17.6"{},"{}8.8"{},"{}4.4"{},"{}2.2"{},"{}1.1"{},"{}0.55"{},"{}0.27"{}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00100}00100\ \};}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00101}00101\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00102}00102\ //\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00103}00103\ /**\ @brief\ Global\ ICM-\/20948\ driver\ instance.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00104}00104\ DevLab\_ICM20948\ imu;}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00105}00105\ /**\ @brief\ Count\ of\ validation\ passes\ reserved\ for\ future\ checks.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00106}00106\ uint8\_t\ total\_pass\ =\ 0;}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00107}00107\ /**\ @brief\ Count\ of\ validation\ failures\ reserved\ for\ future\ checks.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00108}00108\ uint8\_t\ total\_fail\ =\ 0;}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00109}00109\ /**\ @brief\ Count\ of\ validation\ warnings\ reserved\ for\ future\ checks.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00110}00110\ uint8\_t\ total\_warn\ =\ 0;}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00111}00111\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00112}00112\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00113}00113\ /**\ @brief\ Print\ a\ separator\ line\ to\ Serial.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00114}00114\ void\ printLinea()\ \ \ \ \ \ \{\ Serial.println(F("{}-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/"{}));\ \}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00115}00115\ /**\ @brief\ Print\ a\ double\ separator\ line\ to\ Serial.\ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00116}00116\ void\ printDobleLinea()\ \{\ Serial.println(F("{}============================================================"{}));\ \}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00117}00117\ //\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00118}00118\ //\ WHO\_AM\_I}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00119}00119\ //\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00120}00120\ /**}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00121}00121\ \ *\ @brief\ Verify\ the\ IMU\ identity\ register.}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00122}00122\ \ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00123}00123\ void\ firstStage()\ \{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00124}00124\ \ \ uint8\_t\ who;}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00125}00125\ \ \ if\ (!imu.readWhoAmI(who)\ ||\ who\ !=\ 0xEA)\ \{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00126}00126\ \ \ \ \ Serial.println(F("{}ERROR:\ WHO\_AM\_I\ mismatch"{}));}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00127}00127\ \ \ \ \ while\ (1)\ delay(200);}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00128}00128\ \ \ \}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00129}00129\ \ \ Serial.printf("{}WHO\_AM\_I\ =\ 0x\%02X\ \ OK\(\backslash\)n"{},\ who);}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00130}00130\ \}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00131}00131\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00132}00132\ //\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00133}00133\ //\ APLICAR\ CONFIGURACION}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00134}00134\ //}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00135}00135\ //\ FIX\ 1:\ Se\ agregan\ ambas\ llamadas\ a\ setAccelDLPF:}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00136}00136\ //\ \ \ Llamada\ 1\ (bypass=false):\ escribe\ bits\ DLPFCFG,\ deja\ FCHOICE=0}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00137}00137\ //\ \ \ Llamada\ 2\ (bypass=true):\ \ activa\ FCHOICE=1\ sin\ tocar\ DLPFCFG}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00138}00138\ //}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00139}00139\ //\ FIX\ 2:\ setAccelDivRate\ escribe\ el\ DIV\ directo\ al\ registro}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00140}00140\ //\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00141}00141\ /**}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00142}00142\ \ *\ @brief\ Apply\ one\ accelerometer\ full-\/scale,\ DLPF,\ and\ averaging\ configuration.}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00143}00143\ \ *}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00144}00144\ \ *\ @param\ fs\_idx\ Index\ into\ accelCfg.}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00145}00145\ \ *\ @param\ cfg\ DLPF\ timing\ and\ divider\ configuration.}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00146}00146\ \ *\ @param\ avg\ Index\ into\ accelAVG.}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00147}00147\ \ *\ @return\ true\ if\ all\ configuration\ writes\ succeeded,\ otherwise\ false.}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00148}00148\ \ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00149}00149\ bool\ applySettings(uint8\_t\ fs\_idx,\ const\ configDLPF\ \&cfg,uint8\_t\ avg)\ \{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00150}00150\ \ \ uint8\_t\ dlpf\_val\ =\ (uint8\_t)accelDLPF[cfg.dlpf\_idx];}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00151}00151\ \ \ bool\ ok\ =\ true;}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00152}00152\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00153}00153\ \ \ ok\ \&=\ imu.setAccelScale(accelCfg[fs\_idx]);}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00154}00154\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00155}00155\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00156}00156\ \ \ //\ Paso\ 1:\ escribe\ DLPFCFG\ en\ bits\ [5:3]}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00157}00157\ \ \ ok\ \&=\ imu.setAccelDLPF(dlpf\_val,\ false);}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00158}00158\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00159}00159\ \ \ ok\ \&=\ imu.setAccelAveraging(accelAVG[avg]);}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00160}00160\ \ \ //\ Paso\ 2:\ activa\ FCHOICE=1\ (DLPF\ activo)\ sin\ tocar\ DLPFCFG}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00161}00161\ \ \ //ok\ \&=\ imu.setAccelDLPF(0,\ true);}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00162}00162\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00163}00163\ \ \ //\ DIV\ directo\ al\ registro,\ sin\ conversion\ interna}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00164}00164\ \ \ ok\ \&=\ imu.setAccelDivRate(cfg.div);}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00165}00165\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00166}00166\ \ \ return\ ok;}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00167}00167\ \}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00168}00168\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00169}00169\ //\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00170}00170\ //\ SWEEP\ —\ MODO\ VERIFICACION}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00171}00171\ //}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00172}00172\ //\ Por\ cada\ configuracion\ DLPF:}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00173}00173\ //\ \ \ 1.\ Aplica\ la\ config\ (FS\ fijo\ en\ +-\/2g\ para\ verificacion)}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00174}00174\ //\ \ \ 2.\ Espera\ settle\ del\ filtro}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00175}00175\ //\ \ \ 3.\ Imprime\ 3\ lecturas\ reales}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00176}00176\ //}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00177}00177\ //\ Cuando\ las\ lecturas\ muestren\ Az\ \string~1g\ en\ reposo,}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00178}00178\ //\ el\ sensor\ esta\ funcionando\ y\ se\ puede\ activar\ el\ sweep\ completo.}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00179}00179\ //\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00180}00180\ /**}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00181}00181\ \ *\ @brief\ Run\ the\ full\ accelerometer\ validation\ matrix\ and\ print\ samples.}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00182}00182\ \ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00183}00183\ void\ runSweep()\ \{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00184}00184\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00185}00185\ \ \ uint16\_t\ n\ =\ 0;}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00186}00186\ \ \ printDobleLinea();}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00187}00187\ \ \ Serial.println(F("{}\ \ ICM-\/20948\ |\ UNIT\ Electronics"{}));}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00188}00188\ \ \ Serial.println(F("{}\ \ MODO\ VERIFICACION\ —\ FS=+-\/2g\ fijo,\ 3\ lecturas\ por\ config"{}));}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00189}00189\ \ \ Serial.println(F("{}\ \ Sensor\ PLANO\ y\ QUIETO\ |\ Az\ esperado:\ \string~+1.000g"{}));}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00190}00190\ \ \ printDobleLinea();}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00191}00191\ \ \ for(uint8\_t\ i\ =\ 0;\ i\ <\ N\_AVG;\ i++)\{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00192}00192\ \ \ \ \ for(uint8\_t\ j\ =\ 0;\ j\ <\ N\_FS;j++)\{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00193}00193\ \ \ \ \ \ \ for\ (uint8\_t\ d\ =\ 0;\ d\ <\ N\_DLPF;\ d++)\ \{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00194}00194\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00195}00195\ \ \ \ \ \ \ \ \ //Serial.println();}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00196}00196\ \ \ \ \ \ \ \ \ //printLinea();}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00197}00197\ \ \ \ \ \ \ \ \ /*Serial.printf("{}\ \ Config\ \%d/\%d:\ \%s\(\backslash\)n"{},\ d+1,\ N\_DLPF,\ configsDLPF[d].nombre);}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00198}00198\ \ \ \ \ \ \ \ \ Serial.printf("{}\ \ ODR=\%.1fHz\ |\ Periodo=\%.1fms\(\backslash\)n"{},}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00199}00199\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ configsDLPF[d].odr\_hz,}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00200}00200\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 1000.0f\ /\ configsDLPF[d].odr\_hz);*/}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00201}00201\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00202}00202\ \ \ \ \ \ \ \ \ //\ -\/-\/-\/\ FIX:\ aplicar\ la\ configuracion\ antes\ de\ leer\ -\/-\/-\/}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00203}00203\ \ \ \ \ \ \ \ \ bool\ cfg\_ok\ =\ applySettings(j,\ configsDLPF[d],i);\ \ //\ FS=0\ →\ +-\/2g}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00204}00204\ \ \ \ \ \ \ \ \ if\ (!cfg\_ok)\ \{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00205}00205\ \ \ \ \ \ \ \ \ \ \ Serial.println(F("{}\ \ ERROR:\ applySettings()\ fallo"{}));}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00206}00206\ \ \ \ \ \ \ \ \ \ \ continue;}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00207}00207\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00208}00208\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00209}00209\ \ \ \ \ \ \ \ \ //\ Esperar\ que\ el\ filtro\ estabilice\ (10\ periodos\ del\ ODR,\ min\ 50ms)}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00210}00210\ \ \ \ \ \ \ \ \ uint32\_t\ settle\_ms\ =\ max((uint32\_t)(10000.0f\ /\ configsDLPF[d].odr\_hz),}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00211}00211\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (uint32\_t)50);}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00212}00212\ \ \ \ \ \ \ \ \ delay(settle\_ms);}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00213}00213\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00214}00214\ \ \ \ \ \ \ \ \ //\ Tomar\ 3\ lecturas\ espaciadas\ por\ el\ periodo\ del\ ODR}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00215}00215\ \ \ \ \ \ \ \ \ uint32\_t\ periodo\_ms\ =\ max((uint32\_t)(1000.0f\ /\ configsDLPF[d].odr\_hz),}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00216}00216\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (uint32\_t)1);}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00217}00217\ \ \ \ \ \ \ \ \ float\ ax,\ ay,\ az;}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00218}00218\ \ \ \ \ \ \ \ \ for\ (uint8\_t\ r\ =\ 0;\ r\ <\ 100;\ r++)\ \{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00219}00219\ \ \ \ \ \ \ \ \ \ \ n++;}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00220}00220\ \ \ \ \ \ \ \ \ \ \ delay(periodo\_ms);}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00221}00221\ \ \ \ \ \ \ \ \ \ \ if\ (imu.readAccel(ax,\ ay,\ az))\ \{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00222}00222\ \ \ \ \ \ \ \ \ \ \ \ \ Serial.printf("{}\%d\ ;\ \%s\ ;\ \%s\ ;\ \%s\ ;\ \%+.4f\ ;\ \%+.4f\ ;\ \%+.4f\(\backslash\)n"{},}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00223}00223\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ n,}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00224}00224\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ configsDLPF[d].nombre,\ \ \ //\ "{}246\ ;\ 265\ ;\ 1125"{}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00225}00225\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ etiquetasAccelCfg[i],\ \ \ \ \ //\ "{}+-\/2G"{}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00226}00226\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ etiquetasAccelAVG[j],\ \ \ \ \ //\ "{}8"{}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00227}00227\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ax,\ ay,\ az);\ \ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00228}00228\ \ \ \ \ \ \ \ \ \ \ \}\ else\ \{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00229}00229\ \ \ \ \ \ \ \ \ \ \ \ \ Serial.println(F("{}\ \ [?]\ readAccel()\ fallo"{}));}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00230}00230\ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00231}00231\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00232}00232\ \ \ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00233}00233\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00234}00234\ \ \ \}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00235}00235\ \ \ Serial.println();}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00236}00236\ \ \ printDobleLinea();}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00237}00237\ \ \ Serial.println(F("{}\ \ VERIFICACION\ COMPLETA"{}));}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00238}00238\ \ \ Serial.println(F("{}\ \ Si\ Az\ \string~\ +1.0g\ en\ todos\ los\ bloques:"{}));}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00239}00239\ \ \ Serial.println(F("{}\ \ el\ sensor\ funciona\ correctamente."{}));}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00240}00240\ \ \ Serial.println(F("{}\ \ Activar\ sweep\ completo\ cuando\ este\ listo."{}));}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00241}00241\ \ \ printDobleLinea();}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00242}00242\ \}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00243}00243\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00244}00244\ //\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00245}00245\ //\ SETUP}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00246}00246\ //\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00247}00247\ /**}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00248}00248\ \ *\ @brief\ Initialize\ I2C,\ reset/wake\ the\ IMU,\ enable\ sensors,\ and\ start\ sweep.}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00249}00249\ \ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00250}00250\ void\ setup()\ \{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00251}00251\ \ \ Serial.begin(115200);}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00252}00252\ \ \ delay(200);}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00253}00253\ \ \ Serial.println(F("{}ICM-\/20948\ —\ Verificacion"{}));}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00254}00254\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00255}00255\ \ \ printDobleLinea();}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00256}00256\ \ \ Serial.println(F("{}\ \ ICM-\/20948\ VALIDACION\ ACELEROMETRO"{}));}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00257}00257\ \ \ printDobleLinea();}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00258}00258\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00259}00259\ \ \ Wire.begin(SDA\_PIN,\ SCL\_PIN);}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00260}00260\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00261}00261\ \ \ if\ (!imu.beginI2C(ICM\_ADDR,\ Wire,\ I2C\_FREQ))\ \{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00262}00262\ \ \ \ \ Serial.println(F("{}ERROR:\ beginI2C()\ fallo"{}));}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00263}00263\ \ \ \ \ while\ (1)\ delay(200);}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00264}00264\ \ \ \}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00265}00265\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00266}00266\ \ \ firstStage();}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00267}00267\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00268}00268\ \ \ //\ softReset\ pone\ el\ chip\ a\ dormir}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00269}00269\ \ \ //\ Despues\ del\ reset\ hay\ que\ despertar\ el\ dispositivo}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00270}00270\ \ \ imu.softReset();}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00271}00271\ \ \ delay(100);}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00272}00272\ \ \ imu.sleep(false);\ \ \ //\ limpia\ SLEEP\ bit,\ CLKSEL=1}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00273}00273\ \ \ delay(50);}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00274}00274\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00275}00275\ \ \ if\ (!imu.setSensors(true,\ true,\ true))\ \{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00276}00276\ \ \ \ \ Serial.println(F("{}ERROR:\ setSensors()\ fallo"{}));}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00277}00277\ \ \ \}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00278}00278\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00279}00279\ \ \ Serial.println(F("{}\ \ Sensor\ listo.\(\backslash\)n"{}));}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00280}00280\ \ \ Serial.println(F("{}\ \ Sensor\ PLANO\ y\ QUIETO\ sobre\ la\ mesa."{}));}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00281}00281\ \ \ Serial.println(F("{}\ \ Iniciando\ en\ 5\ segundos..."{}));}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00282}00282\ \ \ for\ (int\ i\ =\ 5;\ i\ >\ 0;\ i-\/-\/)\ \{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00283}00283\ \ \ \ \ Serial.printf("{}\ \ \%d...\(\backslash\)n"{},\ i);}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00284}00284\ \ \ \ \ delay(1000);}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00285}00285\ \ \ \}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00286}00286\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00287}00287\ \ \ //for\ (int\ runs\ =\ 0;\ runs\ <\ 20\ ;\ runs++)\{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00288}00288\ \ \ \ \ runSweep();}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00289}00289\ \ \ //\}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00290}00290\ \}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00291}00291\ }
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00292}00292\ //\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00293}00293\ //\ LOOP\ —\ lectura\ simple\ post-\/sweep}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00294}00294\ //\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00295}00295\ /**}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00296}00296\ \ *\ @brief\ Optional\ post-\/sweep\ loop\ for\ manual\ accelerometer\ reads.}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00297}00297\ \ */}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00298}00298\ void\ loop()\ \{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00299}00299\ \ \ /*float\ ax,\ ay,\ az;}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00300}00300\ \ \ if\ (imu.readAccel(ax,\ ay,\ az))\ \{}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00301}00301\ \ \ \ \ Serial.printf("{}X:\%+.3f\ \ Y:\%+.3f\ \ Z:\%+.3f\(\backslash\)n"{},\ ax,\ ay,\ az);}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00302}00302\ \ \ \}}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00303}00303\ \ \ delay(500);*/}
\DoxyCodeLine{\Hypertarget{test2_8ino_source_l00304}00304\ \}}

\end{DoxyCode}
