\doxysection{Dev\+Lab\+\_\+\+ICM20948.\+cpp}
\hypertarget{DevLab__ICM20948_8cpp_source}{}\label{DevLab__ICM20948_8cpp_source}\index{src/DevLab\_ICM20948.cpp@{src/DevLab\_ICM20948.cpp}}
\doxymbox{\hyperlink{DevLab__ICM20948_8cpp}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00001}00001\ \textcolor{preprocessor}{\#include\ "{}\doxymbox{\hyperlink{DevLab__ICM20948_8h}{DevLab\_ICM20948.h}}"{}}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00002}00002\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00003}00003\ \textcolor{comment}{/**\ -\/\ Construct\ with\ default\ I2C\ address;\ call\ begin()\ to\ attach\ bus\ */}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00004}\doxymbox{\hyperlink{classDevLab__ICM20948_ad71f3c89c3edb515b8cfb3f4b3073e95}{00004}}\ \doxymbox{\hyperlink{classDevLab__ICM20948_ad71f3c89c3edb515b8cfb3f4b3073e95}{DevLab\_ICM20948::DevLab\_ICM20948}}()\ \{\}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00005}00005\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00006}\doxymbox{\hyperlink{classDevLab__ICM20948_a91147b3cd4c45bffc8e024f985be7b21}{00006}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a91147b3cd4c45bffc8e024f985be7b21}{DevLab\_ICM20948::beginI2C}}(uint8\_t\ address,\ TwoWire\ \&i2cPort,\ uint32\_t\ i2cSpeed)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00007}00007\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00008}00008\ \ \ \textcolor{comment}{//\ Free\ previous\ BusIO\ instance\ }}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00009}00009\ \ \ \textcolor{keywordflow}{if}\ (bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00010}00010\ \ \ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00011}00011\ \ \ \ \ \textcolor{keyword}{delete}\ bus;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00012}00012\ \ \ \ \ bus\ =\ \textcolor{keyword}{nullptr};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00013}00013\ \ \ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00014}00014\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00015}00015\ \ \ \textcolor{comment}{//\ Assign\ I2C\ interface\ implementation}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00016}00016\ \ \ iface\ =\ \&i2c;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00017}00017\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00018}00018\ \ \ \textcolor{comment}{//\ Initialize\ I2C\ (400kHz)\ and\ probe\ device}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00019}00019\ \ \ \textcolor{keywordflow}{if}\ (!i2c.beginI2C(address,\ i2cPort,\ i2cSpeed))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00020}00020\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00021}00021\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00022}00022\ \ \ \textcolor{comment}{//\ Create\ BusIO\ abstraction\ layer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00023}00023\ \ \ bus\ =\ \textcolor{keyword}{new}\ \doxymbox{\hyperlink{classBusIO__7Semi}{BusIO\_7Semi<Interface\_7Semi>}}(*iface);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00024}00024\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00025}00025\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00026}00026\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00027}00027\ \ \ \textcolor{comment}{//\ Allow\ device\ to\ stabilize\ after\ power-\/up}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00028}00028\ \ \ delay(100);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00029}00029\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00030}00030\ \ \ \textcolor{comment}{//\ Read\ WHO\_AM\_I\ register}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00031}00031\ \ \ uint8\_t\ who\_am\_i;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00032}00032\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_a8bef7eafb3b67eb736f491d0df453b9e}{readWhoAmI}}(who\_am\_i))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00033}00033\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00034}00034\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00035}00035\ \ \ \textcolor{comment}{//\ Validate\ device\ ID\ (expected\ 0xEA)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00036}00036\ \ \ \textcolor{keywordflow}{if}\ (who\_am\_i\ !=\ \doxymbox{\hyperlink{ICM20948__regs_8h_a4a6eb6d34106490a76e78b008ee463db}{WHO\_AM\_I\_VAL}})}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00037}00037\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00038}00038\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00039}00039\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00040}00040\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00041}00041\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00042}00042\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a1dcde6e84d00fa3afb68212a81350de6}{ODR\_ALIGN\_EN}},\ (uint8\_t)0x01))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00043}00043\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00044}00044\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00045}00045\ \ \ \textcolor{comment}{//\ Enable\ I2C\ interface\ (I2C\_IF\_DIS\ =\ 0)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00046}00046\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>writeBit(\doxymbox{\hyperlink{ICM20948__regs_8h_abd9eebb35aad7616fe0414952e2d477d}{USER\_CTRL}},\ 4,\ (uint8\_t)0x00))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00047}00047\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00048}00048\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00049}00049\ \ \ \textcolor{comment}{//\ Set\ clock\ source\ to\ PLL\ (auto\ select\ best\ clock)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00050}00050\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a96169eb207e721c1546cea9ffd8a35e4}{PWR\_MGMT\_1}},\ (uint8\_t)0x01))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00051}00051\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00052}00052\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00053}00053\ \ \ \textcolor{keywordflow}{if}(!\doxymbox{\hyperlink{classDevLab__ICM20948_a31460c48549b1d3081e253706f8b15e6}{applyBasicDefaults}}())}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00054}00054\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00055}00055\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00056}00056\ \ \ \textcolor{comment}{//\ Initialization\ successful}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00057}00057\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00058}00058\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00059}00059\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00060}\doxymbox{\hyperlink{classDevLab__ICM20948_a4386f310503153f3e28935cbdda75b18}{00060}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a4386f310503153f3e28935cbdda75b18}{DevLab\_ICM20948::beginSPI}}(uint8\_t\ csPin,\ SPIClass\ \&spiPort,\ uint32\_t\ spiSpeed)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00061}00061\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00062}00062\ \textcolor{comment}{//\ Free\ previous\ BusIO\ instance\ }}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00063}00063\ \ \ \textcolor{keywordflow}{if}\ (bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00064}00064\ \ \ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00065}00065\ \ \ \ \ \textcolor{keyword}{delete}\ bus;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00066}00066\ \ \ \ \ bus\ =\ \textcolor{keyword}{nullptr};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00067}00067\ \ \ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00068}00068\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00069}00069\ \ \ \textcolor{comment}{//\ Assign\ SPI\ interface\ implementation}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00070}00070\ \ \ iface\ =\ \&spi;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00071}00071\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00072}00072\ \ \ \textcolor{comment}{//\ Initialize\ SPI\ (1MHz)\ and\ probe\ device}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00073}00073\ \ \ \textcolor{keywordflow}{if}\ (!spi.beginSPI(csPin,\ spiPort,\ spiSpeed))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00074}00074\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00075}00075\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00076}00076\ \ \ \textcolor{comment}{//\ Create\ BusIO\ abstraction\ layer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00077}00077\ \ \ bus\ =\ \textcolor{keyword}{new}\ \doxymbox{\hyperlink{classBusIO__7Semi}{BusIO\_7Semi<Interface\_7Semi>}}(*iface);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00078}00078\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00079}00079\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00080}00080\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00081}00081\ \ \ \ \ \doxymbox{\hyperlink{classDevLab__ICM20948_a0d6774b76298645ee45ec0e9065a8891}{softReset}}();}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00082}00082\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00083}00083\ \ \ \textcolor{comment}{//\ Allow\ device\ to\ stabilize\ after\ power-\/up}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00084}00084\ \ \ delay(100);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00085}00085\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00086}00086\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00087}00087\ \ \ \textcolor{comment}{//\ Read\ WHO\_AM\_I\ register}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00088}00088\ \ \ uint8\_t\ who\_am\_i;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00089}00089\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00090}00090\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_a8bef7eafb3b67eb736f491d0df453b9e}{readWhoAmI}}(who\_am\_i))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00091}00091\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00092}00092\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00093}00093\ \ \ \textcolor{comment}{//\ Validate\ device\ ID\ (expected\ 0xEA)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00094}00094\ \ \ \textcolor{keywordflow}{if}\ (who\_am\_i\ !=\ \doxymbox{\hyperlink{ICM20948__regs_8h_a4a6eb6d34106490a76e78b008ee463db}{WHO\_AM\_I\_VAL}})}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00095}00095\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00096}00096\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00097}00097\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00098}00098\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00099}00099\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00100}00100\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a1dcde6e84d00fa3afb68212a81350de6}{ODR\_ALIGN\_EN}},\ (uint8\_t)0x01))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00101}00101\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00102}00102\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00103}00103\ \ \ \textcolor{comment}{//\ Enable\ I2C\ interface\ (I2C\_IF\_DIS\ =\ 0)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00104}00104\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>writeBit(\doxymbox{\hyperlink{ICM20948__regs_8h_abd9eebb35aad7616fe0414952e2d477d}{USER\_CTRL}},\ 4,\ (uint8\_t)0x01))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00105}00105\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00106}00106\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00107}00107\ \ \ \textcolor{comment}{//\ Wake\ device\ from\ sleep\ mode\ (SLEEP\ =\ 0)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00108}00108\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a96169eb207e721c1546cea9ffd8a35e4}{PWR\_MGMT\_1}},(uint8\_t)0x01))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00109}00109\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00110}00110\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00111}00111\ \ \ \textcolor{keywordflow}{if}(!\doxymbox{\hyperlink{classDevLab__ICM20948_a31460c48549b1d3081e253706f8b15e6}{applyBasicDefaults}}())}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00112}00112\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00113}00113\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00114}00114\ \ \ \textcolor{comment}{//\ Initialization\ successful}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00115}00115\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00116}00116\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00117}00117\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00118}\doxymbox{\hyperlink{classDevLab__ICM20948_a8bef7eafb3b67eb736f491d0df453b9e}{00118}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a8bef7eafb3b67eb736f491d0df453b9e}{DevLab\_ICM20948::readWhoAmI}}(uint8\_t\ \&whoAmI)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00119}00119\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00120}00120\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 0}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00121}00121\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00122}00122\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00123}00123\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00124}00124\ \ \ \textcolor{comment}{//\ Read\ WHO\_AM\_I\ register}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00125}00125\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_a9fcb9e460d175bfc7ab4d80bf788b43a}{WHO\_AM\_I}},\ whoAmI))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00126}00126\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00127}00127\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00128}00128\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00129}00129\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00130}00130\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00131}00131\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00132}\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{00132}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{DevLab\_ICM20948::selectBank}}(uint8\_t\ bank)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00133}00133\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00134}00134\ \ \ \textcolor{keywordflow}{if}\ (bank\ >\ 3)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00135}00135\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00136}00136\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00137}00137\ \ \ \textcolor{comment}{//\ Mask\ bank\ value\ to\ valid\ range\ (0–3)\ and\ shift\ to\ bits\ [5:4]}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00138}00138\ \ \ uint8\_t\ v\ =\ (bank\ \&\ 0x03)\ <<\ 4;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00139}00139\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00140}00140\ \ \ \textcolor{comment}{//\ Write\ bank\ selection\ to\ REG\_BANK\_SEL\ register}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00141}00141\ \ \ \textcolor{keywordflow}{return}\ bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a9b16c1c2367ca3fbe185cd375ff247e0}{REG\_BANK\_SEL}},\ v);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00142}00142\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00143}00143\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00144}\doxymbox{\hyperlink{classDevLab__ICM20948_a0d6774b76298645ee45ec0e9065a8891}{00144}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a0d6774b76298645ee45ec0e9065a8891}{DevLab\_ICM20948::softReset}}()}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00145}00145\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00146}00146\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 0}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00147}00147\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00148}00148\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00149}00149\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00150}00150\ \ \ \textcolor{comment}{//\ Set\ DEVICE\_RESET\ bit\ (bit\ 7)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00151}00151\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a96169eb207e721c1546cea9ffd8a35e4}{PWR\_MGMT\_1}},\ (uint8\_t)0x80))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00152}00152\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00153}00153\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00154}00154\ \ \ \textcolor{comment}{//\ Allow\ device\ to\ reset}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00155}00155\ \ \ delay(100);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00156}00156\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00157}00157\ \ \ \doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00158}00158\ \ \ bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a1dcde6e84d00fa3afb68212a81350de6}{ODR\_ALIGN\_EN}},\ (uint8\_t)0x01);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00159}00159\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00160}00160\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00161}00161\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00162}00162\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00163}00163\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00164}\doxymbox{\hyperlink{classDevLab__ICM20948_a4210e842050486637a5967b2a9ef7b57}{00164}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a4210e842050486637a5967b2a9ef7b57}{DevLab\_ICM20948::sleep}}(\textcolor{keywordtype}{bool}\ en)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00165}00165\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00166}00166\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 0}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00167}00167\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00168}00168\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00169}00169\ \ uint8\_t\ v\ =\ 1;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00170}00170\ \ \ \ \ \textcolor{keywordflow}{if}(en)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00171}00171\ \ \ \ v|=\ 1<<6;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00172}00172\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00173}00173\ \ \ \textcolor{comment}{//\ Set\ or\ clear\ SLEEP\ bit\ (bit\ 6)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00174}00174\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a96169eb207e721c1546cea9ffd8a35e4}{PWR\_MGMT\_1}},\ v))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00175}00175\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00176}00176\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00177}00177\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00178}00178\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00179}00179\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00180}00180\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00181}\doxymbox{\hyperlink{classDevLab__ICM20948_a31460c48549b1d3081e253706f8b15e6}{00181}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a31460c48549b1d3081e253706f8b15e6}{DevLab\_ICM20948::applyBasicDefaults}}()}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00182}00182\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00183}00183\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 0}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00184}00184\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00185}00185\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00186}00186\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00187}00187\ \ \ \textcolor{comment}{//\ Wake\ device\ and\ set\ clock\ source\ (CLKSEL=1,\ SLEEP=0)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00188}00188\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a96169eb207e721c1546cea9ffd8a35e4}{PWR\_MGMT\_1}},\ (uint8\_t)0x01))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00189}00189\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00190}00190\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00191}00191\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a23cfbcfd19dc88eb631309970f138e65}{PWR\_MGMT\_2}},\ (uint8\_t)0x00))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00192}00192\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00193}00193\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00194}00194\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00195}00195\ \ \ \textcolor{comment}{//\ Allow\ device\ to\ stabilize}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00196}00196\ \ \ delay(10);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00197}00197\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00198}00198\ \ \ \textcolor{comment}{//\ Disable\ duty-\/cycling\ (LP\ mode\ off)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00199}00199\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a9ae692fa86d432d9edd89eefd79c969d}{LP\_CONFIG}},\ (uint8\_t)0x00))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00200}00200\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00201}00201\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00202}00202\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 2}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00203}00203\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00204}00204\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00205}00205\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00206}00206\ \ \ \textcolor{comment}{//\ Configure\ gyro\ (DLPF\ enabled,\ FS\ =\ 2000\ dps)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00207}00207\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_ac972e7c28645c461e84f63b7f3a6100a}{GYRO\_CONFIG\_1}},\ (uint8\_t)0x1F))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00208}00208\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00209}00209\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00210}00210\ \ \ \textcolor{comment}{//\ Set\ gyro\ sample\ rate\ divider\ (SRD\ =\ 0\ →\ max\ rate)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00211}00211\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_ad4b8489fa75f9ee976be1fc77a1470e5}{GYRO\_SMPLRT\_DIV}},\ (uint8\_t)0x00))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00212}00212\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00213}00213\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00214}00214\ \ \ \textcolor{comment}{//\ Configure\ accel\ (DLPF\ enabled,\ FS\ =\ 16g)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00215}00215\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_ab7336e26f8947086e41a375f1e1e74d4}{ACCEL\_CONFIG}},\ (uint8\_t)0x1F))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00216}00216\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00217}00217\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00218}00218\ \ \ \textcolor{comment}{//\ Set\ accel\ sample\ rate\ divider\ high\ byte}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00219}00219\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_ad063fc542e8600d8c86200f55762a5a9}{ACCEL\_SMPLRT\_DIV\_1}},\ (uint8\_t)0x00))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00220}00220\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00221}00221\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00222}00222\ \ \ \textcolor{comment}{//\ Set\ accel\ sample\ rate\ divider\ low\ byte}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00223}00223\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a5fc41bb3a5697245421fe42fe14d8bac}{ACCEL\_SMPLRT\_DIV\_2}},\ (uint8\_t)0x00))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00224}00224\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00225}00225\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00226}00226\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 0}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00227}00227\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00228}00228\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00229}00229\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00230}00230\ \ \ \textcolor{comment}{//\ Configure\ interrupt\ pin\ (open-\/drain,\ active-\/low,\ latch)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00231}00231\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_ab00fdfba66092d2d869031629c092dad}{INT\_PIN\_CFG}},\ (uint8\_t)0x30))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00232}00232\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00233}00233\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00234}00234\ \ \ \textcolor{comment}{//\ Configuration\ successful}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00235}00235\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00236}00236\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00237}00237\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00238}\doxymbox{\hyperlink{classDevLab__ICM20948_a3b58edd0915cff118ca81daa6944a27b}{00238}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a3b58edd0915cff118ca81daa6944a27b}{DevLab\_ICM20948::readAccel}}(\textcolor{keywordtype}{float}\ \&x,\ \textcolor{keywordtype}{float}\ \&y,\ \textcolor{keywordtype}{float}\ \&z)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00239}00239\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00240}00240\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 0}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00241}00241\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00242}00242\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00243}00243\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00244}00244\ \ \ \textcolor{comment}{//\ Read\ 6\ bytes\ (X,\ Y,\ Z)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00245}00245\ \ \ uint8\_t\ raw[6];}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00246}00246\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_a94b93aa4aabbe7caec7884ddb46b531b}{ACCEL\_XOUT\_H}},\ raw,\ 6))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00247}00247\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00248}00248\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00249}00249\ \ \ \textcolor{comment}{//\ Convert\ raw\ data\ to\ g}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00250}00250\ \ \ x\ =\ (int16\_t)((raw[0]\ <<\ 8)\ |\ raw[1])\ /\ mg\_per\_lsb;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00251}00251\ \ \ y\ =\ (int16\_t)((raw[2]\ <<\ 8)\ |\ raw[3])\ /\ mg\_per\_lsb;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00252}00252\ \ \ z\ =\ (int16\_t)((raw[4]\ <<\ 8)\ |\ raw[5])\ /\ mg\_per\_lsb;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00253}00253\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00254}00254\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00255}00255\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00256}00256\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00257}00257\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00258}\doxymbox{\hyperlink{classDevLab__ICM20948_a006c131f860f1fc81c587b3d8a77522d}{00258}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a006c131f860f1fc81c587b3d8a77522d}{DevLab\_ICM20948::readGyro}}(\textcolor{keywordtype}{float}\ \&x,\ \textcolor{keywordtype}{float}\ \&y,\ \textcolor{keywordtype}{float}\ \&z)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00259}00259\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00260}00260\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 0}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00261}00261\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00262}00262\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00263}00263\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00264}00264\ \ \ \textcolor{comment}{//\ Read\ 6\ bytes\ (X,\ Y,\ Z)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00265}00265\ \ \ uint8\_t\ raw[6];}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00266}00266\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_a0016198ccf5ca2b7f41d7a23e6554373}{GYRO\_XOUT\_H}},\ raw,\ 6))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00267}00267\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00268}00268\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00269}00269\ \ \ \textcolor{comment}{//\ Convert\ raw\ data\ to\ dps}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00270}00270\ \ \ x\ =\ (int16\_t)((raw[0]\ <<\ 8)\ |\ raw[1])\ /\ degree\_per\_second;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00271}00271\ \ \ y\ =\ (int16\_t)((raw[2]\ <<\ 8)\ |\ raw[3])\ /\ degree\_per\_second;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00272}00272\ \ \ z\ =\ (int16\_t)((raw[4]\ <<\ 8)\ |\ raw[5])\ /\ degree\_per\_second;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00273}00273\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00274}00274\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00275}00275\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00276}00276\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00277}00277\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00278}\doxymbox{\hyperlink{classDevLab__ICM20948_aa5c2ecd855cebb1934bbbe020128ab5e}{00278}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_aa5c2ecd855cebb1934bbbe020128ab5e}{DevLab\_ICM20948::readTemperature}}(\textcolor{keywordtype}{float}\ \&temperature)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00279}00279\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00280}00280\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 0}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00281}00281\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00282}00282\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00283}00283\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00284}00284\ \ \ \textcolor{comment}{//\ Initialize\ accumulator}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00285}00285\ \ \ temperature\ =\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00286}00286\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00287}00287\ \ \ \textcolor{comment}{//\ Read\ and\ average\ 5\ samples}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00288}00288\ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ 5;\ i++)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00289}00289\ \ \ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00290}00290\ \ \ \ \ \textcolor{comment}{//\ Read\ temperature\ registers}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00291}00291\ \ \ \ \ uint8\_t\ raw[2];}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00292}00292\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_ae8c4c28fe604535a3a57d0536c6e8175}{TEMP\_OUT\_H}},\ raw,\ 2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00293}00293\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00294}00294\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00295}00295\ \ \ \ \ \textcolor{comment}{//\ Convert\ raw\ to\ signed\ value}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00296}00296\ \ \ \ \ int16\_t\ temp\ =\ (int16\_t)((raw[0]\ <<\ 8)\ |\ raw[1]);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00297}00297\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00298}00298\ \ \ \ \ \textcolor{comment}{//\ Convert\ to\ °C\ and\ accumulate}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00299}00299\ \ \ \ \ temperature\ +=\ temp\ /\ 333.87f\ +\ 21.0f;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00300}00300\ \ \ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00301}00301\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00302}00302\ \ \ \textcolor{comment}{//\ Compute\ average\ temperature}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00303}00303\ \ \ temperature\ /=\ 5.0f;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00304}00304\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00305}00305\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00306}00306\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00307}00307\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00308}00308\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00309}00309\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00310}\doxymbox{\hyperlink{classDevLab__ICM20948_a9f9b29867c2b78efef3ef9688f886314}{00310}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a9f9b29867c2b78efef3ef9688f886314}{DevLab\_ICM20948::readMag}}(\textcolor{keywordtype}{float}\ \&x,\ \textcolor{keywordtype}{float}\ \&y,\ \textcolor{keywordtype}{float}\ \&z)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00311}00311\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00312}00312\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 0}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00313}00313\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00314}00314\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00315}00315\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00316}00316\ \ \ \textcolor{comment}{//\ Read\ 8\ bytes\ (ST1\ +\ XYZ\ +\ ST2)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00317}00317\ \ \ uint8\_t\ buf[8];}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00318}00318\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_a3cc8ba7b3d13ace76a3d4bfd9101de76}{EXT\_SLV\_SENS\_DATA\_00}},\ buf,\ 8))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00319}00319\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00320}00320\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00321}00321\ \ \ int16\_t\ mx\ =\ (int16\_t)(buf[1]\ |\ (buf[2]\ <<\ 8));}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00322}00322\ \ \ int16\_t\ my\ =\ (int16\_t)(buf[3]\ |\ (buf[4]\ <<\ 8));}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00323}00323\ \ \ int16\_t\ mz\ =\ (int16\_t)(buf[5]\ |\ (buf[6]\ <<\ 8));}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00324}00324\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00325}00325\ \ \ \textcolor{comment}{//\ Convert\ to\ µT\ (AK09916\ sensitivity)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00326}00326\ \ \ x\ =\ mx\ *\ 0.15f;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00327}00327\ \ \ y\ =\ my\ *\ 0.15f;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00328}00328\ \ \ z\ =\ mz\ *\ 0.15f;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00329}00329\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00330}00330\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00331}00331\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00332}00332\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00333}00333\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00334}\doxymbox{\hyperlink{classDevLab__ICM20948_a7b137192f8eb987cd221808c2c6c3561}{00334}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a7b137192f8eb987cd221808c2c6c3561}{DevLab\_ICM20948::initMag}}()}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00335}00335\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00336}00336\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00337}00337\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00338}00338\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00339}00339\ \ \ \doxymbox{\hyperlink{classDevLab__ICM20948_a0d6774b76298645ee45ec0e9065a8891}{softReset}}();}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00340}00340\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00341}00341\ \ \ \doxymbox{\hyperlink{classDevLab__ICM20948_a4210e842050486637a5967b2a9ef7b57}{sleep}}(\textcolor{keyword}{false});}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00342}00342\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00343}00343\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00344}00344\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00345}00345\ \ \ \textcolor{comment}{//\ Enable\ I2C\ master\ mode\ and\ disable\ I2C\ slave\ mode}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00346}00346\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_abd9eebb35aad7616fe0414952e2d477d}{USER\_CTRL}},\ (uint8\_t)\doxymbox{\hyperlink{ICM20948__regs_8h_af68c5a8a485ff0d5bf62df214bd843b1}{USER\_CTRL\_I2C\_MST\_EN}}))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00347}00347\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00348}00348\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00349}00349\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(3))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00350}00350\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00351}00351\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00352}00352\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a24bc05247067ad9f0479f5a6d49c6412}{I2C\_MST\_CTRL}},\ (uint8\_t)0x07))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00353}00353\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00354}00354\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00355}00355\ \ \ delay(10);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00356}00356\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00357}00357\ \ \ \textcolor{comment}{//Soft\ Reset}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00358}00358\ \ \ writeSlave4(\doxymbox{\hyperlink{ICM20948__regs_8h_a3327fe2d014f5a7a14f435dc91a211e7}{AK\_CNTL3}},\ 0x01);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00359}00359\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00360}00360\ \ \ delay(100);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00361}00361\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00362}00362\ \ \ uint8\_t\ i,\ who;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00363}00363\ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ 10;\ i++)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00364}00364\ \ \ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00365}00365\ \ \ \ \ readSlave4(\doxymbox{\hyperlink{ICM20948__regs_8h_ad50958b1c02ef5f355ef4b8c3c1f950f}{AK\_WIA2}},\ who);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00366}00366\ \ \ \ \ \textcolor{keywordflow}{if}\ (who\ ==\ \doxymbox{\hyperlink{ICM20948__regs_8h_ae26396a9b83ccd4d5bddaff886608eb4}{AK\_WIA2\_VAL}})}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00367}00367\ \ \ \ \ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00368}00368\ \ \ \ \ \ \ \textcolor{comment}{//Mode\ 3\ (continuous\ measurement\ 100Hz)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00369}00369\ \ \ \ \ \ \ writeSlave4(\doxymbox{\hyperlink{ICM20948__regs_8h_aa87dd3ac650291f0cb7ef9df161b141a}{AK\_CNTL2}},\ 0x08);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00370}00370\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00371}00371\ \ \ \ \ \ \ delay(10);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00372}00372\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00373}00373\ \ \ \ \ \ \ \textcolor{comment}{//\ -\/-\/-\/-\/\ Setup\ auto-\/read\ (SLV0)\ -\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00374}00374\ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(3))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00375}00375\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00376}00376\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00377}00377\ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a614db921c27f375c632960a7f34999a4}{I2C\_SLV0\_ADDR}},\ (uint8\_t)(\doxymbox{\hyperlink{ICM20948__regs_8h_a5bb4b636373b265ea8f5a44eb9c3de71}{AK09916\_I2C\_ADDR}}\ |\ 0x80)))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00378}00378\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00379}00379\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00380}00380\ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a0553d56ecccd0fc8008505e712a9b075}{I2C\_SLV0\_REG}},\ (uint8\_t)\doxymbox{\hyperlink{ICM20948__regs_8h_a8fd61d6bf64fda1d2894843373c89b2c}{AK\_ST1}}))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00381}00381\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00382}00382\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00383}00383\ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_ad6fb6553534b0b9e9715db3e5a04ebca}{I2C\_SLV0\_CTRL}},\ (uint8\_t)(\doxymbox{\hyperlink{ICM20948__regs_8h_a00a6bbbaaeeeba58a5c7a70a00237b34}{I2C\_SLVx\_EN}}\ |\ 8)))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00384}00384\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00385}00385\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00386}00386\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00387}00387\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00388}00388\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00389}00389\ \ \ \ \ \ writeSlave4(\doxymbox{\hyperlink{ICM20948__regs_8h_aa87dd3ac650291f0cb7ef9df161b141a}{AK\_CNTL2}},\ 0x08);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00390}00390\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00391}00391\ \ \ \ \ \ \ delay(10);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00392}00392\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00393}00393\ \ \ \ \ \ \ \textcolor{comment}{//\ -\/-\/-\/-\/\ Setup\ auto-\/read\ (SLV0)\ -\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00394}00394\ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(3))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00395}00395\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00396}00396\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00397}00397\ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a614db921c27f375c632960a7f34999a4}{I2C\_SLV0\_ADDR}},\ (uint8\_t)(\doxymbox{\hyperlink{ICM20948__regs_8h_a5bb4b636373b265ea8f5a44eb9c3de71}{AK09916\_I2C\_ADDR}}\ |\ 0x80)))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00398}00398\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00399}00399\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00400}00400\ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a0553d56ecccd0fc8008505e712a9b075}{I2C\_SLV0\_REG}},\ (uint8\_t)\doxymbox{\hyperlink{ICM20948__regs_8h_a8fd61d6bf64fda1d2894843373c89b2c}{AK\_ST1}}))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00401}00401\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00402}00402\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00403}00403\ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_ad6fb6553534b0b9e9715db3e5a04ebca}{I2C\_SLV0\_CTRL}},\ (uint8\_t)(\doxymbox{\hyperlink{ICM20948__regs_8h_a00a6bbbaaeeeba58a5c7a70a00237b34}{I2C\_SLVx\_EN}}\ |\ 8)))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00404}00404\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00405}00405\ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00406}00406\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00407}00407\ \ \ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00408}00408\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00409}00409\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00410}\doxymbox{\hyperlink{classDevLab__ICM20948_a0882a30454b0716953f5f375613d24b3}{00410}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a0882a30454b0716953f5f375613d24b3}{DevLab\_ICM20948::setMagOpMode}}(\doxymbox{\hyperlink{DevLab__ICM20948_8h_ad14b8d7e0be37ca0ccaf45ccc31c18bb}{ICM20948\_Op\_Mode}}\ opMode)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00411}00411\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00412}00412\ \ \ \textcolor{comment}{//\ Write\ operation\ mode\ to\ magnetometer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00413}00413\ \ \ writeSlave4(\doxymbox{\hyperlink{ICM20948__regs_8h_aa87dd3ac650291f0cb7ef9df161b141a}{AK\_CNTL2}},\ (uint8\_t)opMode);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00414}00414\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00415}00415\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00416}00416\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00417}00417\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00418}00418\ \textcolor{keywordtype}{bool}\ DevLab\_ICM20948::writeSlave4(uint8\_t\ reg,\ uint8\_t\ value)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00419}00419\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00420}00420\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 3}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00421}00421\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(3))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00422}00422\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00423}00423\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00424}00424\ \ \ \textcolor{comment}{//\ 7\ -\/\ 1:r\ ,\ 0:W}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00425}00425\ \ \ \textcolor{comment}{//[6:0]:\ I2C\ slave\ address\ (AK09916\_I2C\_ADDR)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00426}00426\ \ \ \textcolor{comment}{//\ Set\ slave\ address\ (write)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00427}00427\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>\doxymbox{\hyperlink{classBusIO__7Semi_aa633479356af692cb9ea334771b7c0c5}{write}}(\doxymbox{\hyperlink{ICM20948__regs_8h_a25432a6492073ae1e1e082ea95ad3c65}{I2C\_SLV4\_ADDR}},\ (uint8\_t)\doxymbox{\hyperlink{ICM20948__regs_8h_a5bb4b636373b265ea8f5a44eb9c3de71}{AK09916\_I2C\_ADDR}}))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00428}00428\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00429}00429\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00430}00430\ \ \ \textcolor{comment}{//\ Set\ data\ to\ write\ to\ slave}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00431}00431\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>\doxymbox{\hyperlink{classBusIO__7Semi_aa633479356af692cb9ea334771b7c0c5}{write}}(\doxymbox{\hyperlink{ICM20948__regs_8h_a317a21f85deb696c508437cd32ac803c}{I2C\_SLV4\_DO}},\ value))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00432}00432\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00433}00433\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00434}00434\ \ \ \textcolor{comment}{//\ Set\ target\ register}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00435}00435\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>\doxymbox{\hyperlink{classBusIO__7Semi_aa633479356af692cb9ea334771b7c0c5}{write}}(\doxymbox{\hyperlink{ICM20948__regs_8h_a89919db5e2f4a361c1d19cc2215c8d0c}{I2C\_SLV4\_REG}},\ reg))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00436}00436\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00437}00437\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00438}00438\ \ \ \textcolor{comment}{//\ Start\ transaction\ (EN\ bit)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00439}00439\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>\doxymbox{\hyperlink{classBusIO__7Semi_aa633479356af692cb9ea334771b7c0c5}{write}}(\doxymbox{\hyperlink{ICM20948__regs_8h_a7e5cb081a1546553fe74fb3e07b7907b}{I2C\_SLV4\_CTRL}},\ (uint8\_t)128))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00440}00440\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00441}00441\ \ \ \textcolor{comment}{//\ Wait\ for\ completion\ (with\ timeout)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00442}00442\ \ \ uint32\_t\ start\ =\ millis();}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00443}00443\ \ \ uint8\_t\ status;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00444}00444\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00445}00445\ \ \ \textcolor{keywordflow}{while}\ (millis()\ -\/\ start\ <\ 10)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00446}00446\ \ \ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00447}00447\ \ \ \ \ \textcolor{keywordflow}{if}\ (bus-\/>\doxymbox{\hyperlink{classBusIO__7Semi_a933c66d9a1afe84102323e209a93dd31}{read}}(\doxymbox{\hyperlink{ICM20948__regs_8h_a7e5cb081a1546553fe74fb3e07b7907b}{I2C\_SLV4\_CTRL}},\ status))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00448}00448\ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!(status\ \&\ 0x80))\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00449}00449\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00450}00450\ \ \ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00451}00451\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00452}00452\ \ \ \textcolor{comment}{//\ Timeout}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00453}00453\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00454}00454\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00455}00455\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00456}00456\ \textcolor{keywordtype}{bool}\ DevLab\_ICM20948::readSlave4(uint8\_t\ reg,\ uint8\_t\ \&value)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00457}00457\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00458}00458\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 3}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00459}00459\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(3))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00460}00460\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00461}00461\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00462}00462\ \ \ \textcolor{comment}{//\ Set\ slave\ address\ (read)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00463}00463\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a25432a6492073ae1e1e082ea95ad3c65}{I2C\_SLV4\_ADDR}},\ (uint8\_t)(\doxymbox{\hyperlink{ICM20948__regs_8h_a5bb4b636373b265ea8f5a44eb9c3de71}{AK09916\_I2C\_ADDR}}\ |\ 0x80)))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00464}00464\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00465}00465\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00466}00466\ \ \ \textcolor{comment}{//\ Set\ target\ register}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00467}00467\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a89919db5e2f4a361c1d19cc2215c8d0c}{I2C\_SLV4\_REG}},\ reg))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00468}00468\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00469}00469\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00470}00470\ \ \ \textcolor{comment}{//\ Start\ transaction}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00471}00471\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a7e5cb081a1546553fe74fb3e07b7907b}{I2C\_SLV4\_CTRL}},\ (uint8\_t)128))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00472}00472\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00473}00473\ \ \ \textcolor{comment}{//\ Wait\ for\ completion}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00474}00474\ \ \ uint32\_t\ start\ =\ millis();}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00475}00475\ \ \ uint8\_t\ status;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00476}00476\ \ \ \textcolor{keywordflow}{while}\ (millis()\ -\/\ start\ <\ 10)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00477}00477\ \ \ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00478}00478\ \ \ \ \ \textcolor{keywordflow}{if}\ (bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_a7e5cb081a1546553fe74fb3e07b7907b}{I2C\_SLV4\_CTRL}},\ status))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00479}00479\ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!(status\ \&\ 0x80))\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00480}00480\ \ \ \ \ \ \ \ \{\ \textcolor{keywordflow}{if}\ (!bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_a838003994d9f3319308f9f650cc2a083}{I2C\_SLV4\_DI}},\ value))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00481}00481\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00482}00482\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00483}00483\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00484}00484\ \ \ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00485}00485\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00486}00486\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00487}00487\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00488}\doxymbox{\hyperlink{classDevLab__ICM20948_a6c9c09f8b2ab39f5de7f48c6c743ffc4}{00488}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a6c9c09f8b2ab39f5de7f48c6c743ffc4}{DevLab\_ICM20948::setLowPower}}(\textcolor{keywordtype}{bool}\ enable)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00489}00489\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00490}00490\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 0}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00491}00491\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00492}00492\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00493}00493\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00494}00494\ \ \ \textcolor{comment}{//\ Set\ or\ clear\ LP\_EN\ bit\ (bit\ 5)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00495}00495\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>writeBit(\doxymbox{\hyperlink{ICM20948__regs_8h_a96169eb207e721c1546cea9ffd8a35e4}{PWR\_MGMT\_1}},\ 5,\ (uint8\_t)enable))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00496}00496\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00497}00497\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00498}00498\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00499}00499\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00500}00500\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00501}00501\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00502}\doxymbox{\hyperlink{classDevLab__ICM20948_a9832c13228e84e8ef74a631bfe1fdcd7}{00502}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a9832c13228e84e8ef74a631bfe1fdcd7}{DevLab\_ICM20948::getLowPower}}(\textcolor{keywordtype}{bool}\ \&enable)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00503}00503\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00504}00504\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 0}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00505}00505\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00506}00506\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00507}00507\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00508}00508\ \ \ \textcolor{comment}{//\ Read\ LP\_EN\ bit\ (bit\ 5)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00509}00509\ \ \ uint8\_t\ v\ =\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00510}00510\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>readBit(\doxymbox{\hyperlink{ICM20948__regs_8h_a96169eb207e721c1546cea9ffd8a35e4}{PWR\_MGMT\_1}},\ 5,\ v))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00511}00511\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00512}00512\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00513}00513\ \ \ \textcolor{comment}{//\ Convert\ bit\ value\ to\ boolean}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00514}00514\ \ \ enable\ =\ (v\ ==\ 1);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00515}00515\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00516}00516\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00517}00517\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00518}00518\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00519}00519\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00520}\doxymbox{\hyperlink{classDevLab__ICM20948_a18de038f48173c77483f4be1c04204d6}{00520}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a18de038f48173c77483f4be1c04204d6}{DevLab\_ICM20948::setClock}}(\doxymbox{\hyperlink{DevLab__ICM20948_8h_a4f34ad1572aec922143a5ffa9420879a}{ICM20948\_Clock\_Source}}\ clock)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00521}00521\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00522}00522\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 0}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00523}00523\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00524}00524\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00525}00525\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00526}00526\ \ \ \textcolor{comment}{//\ Set\ CLKSEL\ bits\ [2:0]}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00527}00527\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a96169eb207e721c1546cea9ffd8a35e4}{PWR\_MGMT\_1}},\ (uint8\_t)clock))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00528}00528\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00529}00529\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00530}00530\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00531}00531\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00532}00532\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00533}00533\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00534}\doxymbox{\hyperlink{classDevLab__ICM20948_ac4585d35fd7444eee47ea7accd162b6d}{00534}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_ac4585d35fd7444eee47ea7accd162b6d}{DevLab\_ICM20948::getClock}}(uint8\_t\ \&clock)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00535}00535\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00536}00536\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 0}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00537}00537\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00538}00538\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00539}00539\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00540}00540\ \ \ \textcolor{comment}{//\ Read\ CLKSEL\ bits\ [2:0]}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00541}00541\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_a96169eb207e721c1546cea9ffd8a35e4}{PWR\_MGMT\_1}},\ clock))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00542}00542\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00543}00543\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00544}00544\ \ \ \ \ clock\ \&=\ 0x07;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00545}00545\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00546}00546\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00547}00547\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00548}00548\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00549}00549\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00550}\doxymbox{\hyperlink{classDevLab__ICM20948_a70bbcf97fd1c211e2bea203a5039b1bb}{00550}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a70bbcf97fd1c211e2bea203a5039b1bb}{DevLab\_ICM20948::setGyroSampleRate}}(\textcolor{keywordtype}{float}\ sampleRate)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00551}00551\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00552}00552\ \ \ \textcolor{comment}{//\ Validate\ sample\ rate\ range\ (approx\ 4.3\ Hz\ to\ 1100\ Hz)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00553}00553\ \ \ \textcolor{keywordflow}{if}\ ((sampleRate\ <\ 4.3f)\ ||\ (sampleRate\ >\ 1100.0f))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00554}00554\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00555}00555\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00556}00556\ \ \ \textcolor{comment}{//\ Compute\ divider\ value}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00557}00557\ \ \ uint8\_t\ v\ =\ (uint8\_t)((1100.0f\ /\ sampleRate)\ -\/\ 1.0f);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00558}00558\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00559}00559\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 2}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00560}00560\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00561}00561\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00562}00562\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00563}00563\ \ \ \textcolor{comment}{//\ Write\ sample\ rate\ divider}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00564}00564\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_ad4b8489fa75f9ee976be1fc77a1470e5}{GYRO\_SMPLRT\_DIV}},\ v))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00565}00565\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00566}00566\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00567}00567\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00568}00568\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00569}00569\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00570}00570\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00571}\doxymbox{\hyperlink{classDevLab__ICM20948_a721c6c8151230452abfc6c36814f63a7}{00571}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a721c6c8151230452abfc6c36814f63a7}{DevLab\_ICM20948::getGyroSampleRate}}(\textcolor{keywordtype}{float}\ \&sampleRate)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00572}00572\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00573}00573\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00574}00574\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00575}00575\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00576}00576\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00577}00577\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 2}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00578}00578\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00579}00579\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00580}00580\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00581}00581\ \ \ \textcolor{comment}{//\ Read\ sample\ rate\ divider}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00582}00582\ \ \ uint8\_t\ v\ =\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00583}00583\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_ad4b8489fa75f9ee976be1fc77a1470e5}{GYRO\_SMPLRT\_DIV}},\ v))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00584}00584\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00585}00585\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00586}00586\ \ \ \textcolor{comment}{//\ Compute\ sample\ rate}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00587}00587\ \ \ sampleRate\ =\ 1100.0f\ /\ (1.0f\ +\ v);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00588}00588\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00589}00589\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00590}00590\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00591}00591\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00592}00592\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00593}\doxymbox{\hyperlink{classDevLab__ICM20948_a0bea2c662c285120253851c80289e077}{00593}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a0bea2c662c285120253851c80289e077}{DevLab\_ICM20948::setDLPF}}(\doxymbox{\hyperlink{DevLab__ICM20948_8h_a9f4d08566440cf9c577724b075c59aa1}{ICM20948\_Gyro\_DLPF}}\ dlpf,\ \textcolor{keywordtype}{bool}\ bypass)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00594}00594\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00595}00595\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00596}00596\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00597}00597\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00598}00598\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00599}00599\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 2}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00600}00600\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00601}00601\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00602}00602\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00603}00603\ \ \ \textcolor{comment}{//\ Enable\ or\ disable\ DLPF\ bypass\ (bit\ 0)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00604}00604\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>writeBit(\doxymbox{\hyperlink{ICM20948__regs_8h_ac972e7c28645c461e84f63b7f3a6100a}{GYRO\_CONFIG\_1}},\ 0,\ (uint8\_t)bypass))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00605}00605\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00606}00606\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00607}00607\ \ \ \textcolor{comment}{//\ If\ bypass\ enabled,\ skip\ DLPF\ configuration}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00608}00608\ \ \ \textcolor{keywordflow}{if}\ (bypass)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00609}00609\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00610}00610\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00611}00611\ \ \ \textcolor{comment}{//\ Set\ DLPF\ configuration\ bits\ [5:3]}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00612}00612\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>writeBits(\doxymbox{\hyperlink{ICM20948__regs_8h_ac972e7c28645c461e84f63b7f3a6100a}{GYRO\_CONFIG\_1}},\ 3,\ 3,\ (uint8\_t)dlpf))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00613}00613\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00614}00614\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00615}00615\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00616}00616\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00617}00617\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00618}00618\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00619}\doxymbox{\hyperlink{classDevLab__ICM20948_ab5ef83d7268ee07da27e9cce74c94e46}{00619}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_ab5ef83d7268ee07da27e9cce74c94e46}{DevLab\_ICM20948::getDLPF}}(uint8\_t\ \&dlpf,\ \textcolor{keywordtype}{bool}\ \&bypass)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00620}00620\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00621}00621\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00622}00622\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00623}00623\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00624}00624\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00625}00625\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 2}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00626}00626\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00627}00627\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00628}00628\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00629}00629\ \ \ \textcolor{comment}{//\ Read\ GYRO\_CONFIG\_1\ register}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00630}00630\ \ \ uint8\_t\ v\ =\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00631}00631\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_ac972e7c28645c461e84f63b7f3a6100a}{GYRO\_CONFIG\_1}},\ v))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00632}00632\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00633}00633\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00634}00634\ \ \ \textcolor{comment}{//\ Extract\ bypass\ bit\ (bit\ 0)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00635}00635\ \ \ bypass\ =\ (v\ \&\ 0x01);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00636}00636\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00637}00637\ \ \ \textcolor{comment}{//\ Extract\ DLPF\ bits\ [5:3]}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00638}00638\ \ \ dlpf\ =\ (v\ >>\ 3)\ \&\ 0x07;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00639}00639\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00640}00640\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00641}00641\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00642}00642\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00643}00643\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00644}\doxymbox{\hyperlink{classDevLab__ICM20948_a6a06dbd14558e50d40595de82502d632}{00644}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a6a06dbd14558e50d40595de82502d632}{DevLab\_ICM20948::setGyroScale}}(\doxymbox{\hyperlink{DevLab__ICM20948_8h_a409a608f5c864bb503bf1a65b164de7d}{ICM20948\_Gyro\_FullScale}}\ fullScale)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00645}00645\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00646}00646\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00647}00647\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00648}00648\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00649}00649\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00650}00650\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 2}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00651}00651\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00652}00652\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00653}00653\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00654}00654\ \ \ \textcolor{comment}{//\ Set\ full-\/scale\ range\ bits\ [2:1]}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00655}00655\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>writeBits(\doxymbox{\hyperlink{ICM20948__regs_8h_ac972e7c28645c461e84f63b7f3a6100a}{GYRO\_CONFIG\_1}},\ 1,\ 2,\ (uint8\_t)fullScale))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00656}00656\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00657}00657\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00658}00658\ \ \ \textcolor{comment}{//\ Update\ internal\ scale\ (LSB\ per\ g)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00659}00659\ \ \ \ degree\_per\_second\ =\ 32768.0f\ /\ (250.0f\ *\ (1\ <<\ ((uint8\_t)fullScale)));}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00660}00660\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00661}00661\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00662}00662\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00663}00663\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00664}00664\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00665}\doxymbox{\hyperlink{classDevLab__ICM20948_a5e21409c747b1345884dd0d05720f37f}{00665}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a5e21409c747b1345884dd0d05720f37f}{DevLab\_ICM20948::getGyroScale}}(uint8\_t\ \&fullScale)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00666}00666\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00667}00667\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00668}00668\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00669}00669\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00670}00670\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00671}00671\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 2}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00672}00672\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00673}00673\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00674}00674\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00675}00675\ \ \ \textcolor{comment}{//\ Read\ full-\/scale\ range\ bits\ [2:1]}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00676}00676\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>readBits(\doxymbox{\hyperlink{ICM20948__regs_8h_ac972e7c28645c461e84f63b7f3a6100a}{GYRO\_CONFIG\_1}},\ 1,\ 2,\ fullScale))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00677}00677\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00678}00678\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00679}00679\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00680}00680\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00681}00681\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00682}00682\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00683}\doxymbox{\hyperlink{classDevLab__ICM20948_a9d7602ece2c3908e7bbb2acd45dff156}{00683}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a9d7602ece2c3908e7bbb2acd45dff156}{DevLab\_ICM20948::selfTestGyro}}(\textcolor{keywordtype}{bool}\ x,\ \textcolor{keywordtype}{bool}\ y,\ \textcolor{keywordtype}{bool}\ z)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00684}00684\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00685}00685\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00686}00686\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00687}00687\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00688}00688\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00689}00689\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 2}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00690}00690\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00691}00691\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00692}00692\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00693}00693\ \ \ \textcolor{comment}{//\ Set\ Z-\/axis\ self-\/test\ (bit\ 3)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00694}00694\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>writeBit(\doxymbox{\hyperlink{ICM20948__regs_8h_ad5fd1f43dabfe58ed84b6014b470c236}{GYRO\_CONFIG\_2}},\ 3,\ (uint8\_t)z))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00695}00695\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00696}00696\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00697}00697\ \ \ \textcolor{comment}{//\ Set\ Y-\/axis\ self-\/test\ (bit\ 4)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00698}00698\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>writeBit(\doxymbox{\hyperlink{ICM20948__regs_8h_ad5fd1f43dabfe58ed84b6014b470c236}{GYRO\_CONFIG\_2}},\ 4,\ (uint8\_t)y))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00699}00699\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00700}00700\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00701}00701\ \ \ \textcolor{comment}{//\ Set\ X-\/axis\ self-\/test\ (bit\ 5)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00702}00702\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>writeBit(\doxymbox{\hyperlink{ICM20948__regs_8h_ad5fd1f43dabfe58ed84b6014b470c236}{GYRO\_CONFIG\_2}},\ 5,\ (uint8\_t)x))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00703}00703\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00704}00704\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00705}00705\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00706}00706\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00707}00707\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00708}00708\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00709}\doxymbox{\hyperlink{classDevLab__ICM20948_afe657b6e9d21f02dad2599ea04feefe2}{00709}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_afe657b6e9d21f02dad2599ea04feefe2}{DevLab\_ICM20948::setAccelSampleRate}}(uint16\_t\ sampleRate)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00710}00710\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00711}00711\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00712}00712\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00713}00713\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00714}00714\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00715}00715\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 2}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00716}00716\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00717}00717\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00718}00718\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00719}00719\ \ \ \textcolor{comment}{//\ Validate\ input}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00720}00720\ \ \ \textcolor{keywordflow}{if}\ (sampleRate\ ==\ 0)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00721}00721\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00722}00722\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00723}00723\ \ \ \textcolor{comment}{//\ Clamp\ maximum\ rate}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00724}00724\ \ \ \textcolor{keywordflow}{if}\ (sampleRate\ >=\ 1125)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00725}00725\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00726}00726\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00727}00727\ \ \ \textcolor{comment}{//\ Compute\ divider\ (rounded)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00728}00728\ \ \ uint16\_t\ div\ =\ (1125.0f\ /\ sampleRate)\ -\/\ 1;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00729}00729\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00730}00730\ \ \ \textcolor{keywordflow}{if}\ (div\ >\ 4095u)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00731}00731\ \ \ \ \ div\ =\ 4095u;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00732}00732\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00733}00733\ \ \ \textcolor{comment}{//\ Split\ divider\ into\ high\ and\ low\ bytes}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00734}00734\ \ \ uint8\_t\ msb\ =\ (uint8\_t)((div\ >>\ 8)\ \&\ 0x0F);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00735}00735\ \ \ uint8\_t\ lsb\ =\ (uint8\_t)(div\ \&\ 0xFF);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00736}00736\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00737}00737\ \ \ \textcolor{comment}{//\ Write\ divider\ high\ byte}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00738}00738\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_ad063fc542e8600d8c86200f55762a5a9}{ACCEL\_SMPLRT\_DIV\_1}},\ msb))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00739}00739\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00740}00740\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00741}00741\ \ \ \textcolor{comment}{//\ Write\ divider\ low\ byte}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00742}00742\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a5fc41bb3a5697245421fe42fe14d8bac}{ACCEL\_SMPLRT\_DIV\_2}},\ lsb))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00743}00743\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00744}00744\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00745}00745\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00746}00746\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00747}00747\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00748}\doxymbox{\hyperlink{classDevLab__ICM20948_aca0cb8da36b8e9128299b9aeb5bb60ec}{00748}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_aca0cb8da36b8e9128299b9aeb5bb60ec}{DevLab\_ICM20948::setAccelDivRate}}(uint16\_t\ divisor)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00749}00749\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00750}00750\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00751}00751\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00752}00752\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00753}00753\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 2}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00754}00754\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00755}00755\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00756}00756\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00757}00757\ \ \ \textcolor{comment}{//\ Validate\ input}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00758}00758\ \ \ \textcolor{keywordflow}{if}\ (divisor\ ==\ 0)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00759}00759\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00760}00760\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00761}00761\ \ \ \textcolor{keywordflow}{if}\ (divisor\ >\ 4095u)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00762}00762\ \ \ \ \ divisor\ =\ 4095u;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00763}00763\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00764}00764\ \ \ \textcolor{comment}{//\ Split\ divider\ into\ high\ and\ low\ bytes}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00765}00765\ \ \ uint8\_t\ msb\ =\ (uint8\_t)((divisor\ >>\ 8)\ \&\ 0x0F);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00766}00766\ \ \ uint8\_t\ lsb\ =\ (uint8\_t)(divisor\ \&\ 0xFF);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00767}00767\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00768}00768\ \ \ \textcolor{comment}{//\ Write\ divider\ high\ byte}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00769}00769\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_ad063fc542e8600d8c86200f55762a5a9}{ACCEL\_SMPLRT\_DIV\_1}},\ msb))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00770}00770\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00771}00771\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00772}00772\ \ \ \textcolor{comment}{//\ Write\ divider\ low\ byte}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00773}00773\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a5fc41bb3a5697245421fe42fe14d8bac}{ACCEL\_SMPLRT\_DIV\_2}},\ lsb))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00774}00774\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00775}00775\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00776}00776\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00777}00777\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00778}00778\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00779}00779\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00780}\doxymbox{\hyperlink{classDevLab__ICM20948_a16cc9db132bb7a2b706275c9f5a03773}{00780}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a16cc9db132bb7a2b706275c9f5a03773}{DevLab\_ICM20948::setGyroDivRate}}(uint8\_t\ divisor)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00781}00781\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00782}00782\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00783}00783\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00784}00784\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 2}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00785}00785\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00786}00786\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00787}00787\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00788}00788\ \ \ \textcolor{comment}{//\ Write\ sample\ rate\ divider}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00789}00789\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_ad4b8489fa75f9ee976be1fc77a1470e5}{GYRO\_SMPLRT\_DIV}},\ divisor))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00790}00790\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00791}00791\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00792}00792\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00793}00793\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00794}00794\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00795}00795\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00796}\doxymbox{\hyperlink{classDevLab__ICM20948_a9f2da1c80e24d06ae0a0561eb850d8d9}{00796}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a9f2da1c80e24d06ae0a0561eb850d8d9}{DevLab\_ICM20948::getAccelSampleRate}}(\textcolor{keywordtype}{float}\ \&sampleRate)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00797}00797\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00798}00798\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00799}00799\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00800}00800\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00801}00801\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00802}00802\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 2}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00803}00803\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00804}00804\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00805}00805\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00806}00806\ \ \ \textcolor{comment}{//\ Read\ divider\ high\ byte}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00807}00807\ \ \ uint8\_t\ msb\ =\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00808}00808\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_ad063fc542e8600d8c86200f55762a5a9}{ACCEL\_SMPLRT\_DIV\_1}},\ msb))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00809}00809\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00810}00810\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00811}00811\ \ \ \textcolor{comment}{//\ Read\ divider\ low\ byte}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00812}00812\ \ \ uint8\_t\ lsb\ =\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00813}00813\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_a5fc41bb3a5697245421fe42fe14d8bac}{ACCEL\_SMPLRT\_DIV\_2}},\ lsb))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00814}00814\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00815}00815\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00816}00816\ \ \ \textcolor{comment}{//\ Combine\ 12-\/bit\ divider}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00817}00817\ \ \ uint16\_t\ div\ =\ ((msb\ \&\ 0x0F)\ <<\ 8)\ |\ lsb;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00818}00818\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00819}00819\ \ \ \textcolor{comment}{//\ Compute\ sample\ rate}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00820}00820\ \ \ sampleRate\ =\ 1125.0f\ /\ (1.0f\ +\ div);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00821}00821\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00822}00822\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00823}00823\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00824}00824\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00825}00825\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00826}\doxymbox{\hyperlink{classDevLab__ICM20948_adfbd409c7723007d208c82550098a649}{00826}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_adfbd409c7723007d208c82550098a649}{DevLab\_ICM20948::selfTestAccel}}(\textcolor{keywordtype}{bool}\ x,\ \textcolor{keywordtype}{bool}\ y,\ \textcolor{keywordtype}{bool}\ z)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00827}00827\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00828}00828\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00829}00829\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00830}00830\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00831}00831\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00832}00832\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 2}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00833}00833\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00834}00834\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00835}00835\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00836}00836\ \ \ \textcolor{keywordflow}{if}\ (x)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00837}00837\ \ \ \{\ \textcolor{comment}{//\ Set\ X-\/axis\ self-\/test\ (bit\ 7)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00838}00838\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>writeBit(\doxymbox{\hyperlink{ICM20948__regs_8h_a86a65c9ccec738d87e0aa97db3589a52}{ACCEL\_CONFIG\_2}},\ 7,\ (uint8\_t)x))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00839}00839\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00840}00840\ \ \ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00841}00841\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00842}00842\ \ \ \textcolor{keywordflow}{if}\ (y)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00843}00843\ \ \ \{\ \textcolor{comment}{//\ Set\ Y-\/axis\ self-\/test\ (bit\ 6)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00844}00844\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>writeBit(\doxymbox{\hyperlink{ICM20948__regs_8h_a86a65c9ccec738d87e0aa97db3589a52}{ACCEL\_CONFIG\_2}},\ 6,\ (uint8\_t)y))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00845}00845\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00846}00846\ \ \ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00847}00847\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00848}00848\ \ \ \textcolor{keywordflow}{if}\ (z)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00849}00849\ \ \ \{\ \textcolor{comment}{//\ Set\ Z-\/axis\ self-\/test\ (bit\ 5)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00850}00850\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>writeBit(\doxymbox{\hyperlink{ICM20948__regs_8h_a86a65c9ccec738d87e0aa97db3589a52}{ACCEL\_CONFIG\_2}},\ 5,\ (uint8\_t)z))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00851}00851\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00852}00852\ \ \ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00853}00853\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00854}00854\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00855}00855\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00856}00856\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00857}\doxymbox{\hyperlink{classDevLab__ICM20948_a1a2aa0019d5e1c6ba8ce4a3c1d9fcb43}{00857}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a1a2aa0019d5e1c6ba8ce4a3c1d9fcb43}{DevLab\_ICM20948::setAccelScale}}(\doxymbox{\hyperlink{DevLab__ICM20948_8h_a7d56bdd11158e2d05da5c9317fadee05}{ICM20948\_Accel\_FullScale}}\ fullScale)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00858}00858\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00859}00859\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00860}00860\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00861}00861\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00862}00862\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00863}00863\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 2}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00864}00864\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00865}00865\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00866}00866\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00867}00867\ \ \ \textcolor{comment}{//\ Set\ full-\/scale\ bits\ [2:1]}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00868}00868\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>writeBits(\doxymbox{\hyperlink{ICM20948__regs_8h_ab7336e26f8947086e41a375f1e1e74d4}{ACCEL\_CONFIG}},\ 1,\ 2,\ (uint8\_t)fullScale))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00869}00869\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00870}00870\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00871}00871\ \ \ \textcolor{comment}{//\ Update\ internal\ scale\ (LSB\ per\ g)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00872}00872\ \ \ mg\_per\_lsb\ =\ 16384.0f\ /\ (1\ <<\ (uint8\_t)fullScale);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00873}00873\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00874}00874\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00875}00875\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00876}00876\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00877}00877\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00878}\doxymbox{\hyperlink{classDevLab__ICM20948_ace42a35300e82402626ce89eb8958e5f}{00878}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_ace42a35300e82402626ce89eb8958e5f}{DevLab\_ICM20948::getAccelScale}}(uint8\_t\ \&fullScale)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00879}00879\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00880}00880\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00881}00881\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00882}00882\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00883}00883\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00884}00884\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 2}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00885}00885\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00886}00886\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00887}00887\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00888}00888\ \ \ \textcolor{comment}{//\ Read\ full-\/scale\ bits\ [2:1]}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00889}00889\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>readBits(\doxymbox{\hyperlink{ICM20948__regs_8h_ab7336e26f8947086e41a375f1e1e74d4}{ACCEL\_CONFIG}},\ 1,\ 2,\ fullScale))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00890}00890\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00891}00891\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00892}00892\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00893}00893\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00894}00894\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00895}00895\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00896}00896\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00897}\doxymbox{\hyperlink{classDevLab__ICM20948_ac52d80aad738b90aa0f05e9d6404bb85}{00897}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_ac52d80aad738b90aa0f05e9d6404bb85}{DevLab\_ICM20948::setAccelDLPF}}(uint8\_t\ dlpf,\ \textcolor{keywordtype}{bool}\ bypass)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00898}00898\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00899}00899\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00900}00900\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00901}00901\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00902}00902\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00903}00903\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 2}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00904}00904\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00905}00905\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00906}00906\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00907}00907\ \ \ \textcolor{comment}{//\ Set\ or\ clear\ DLPF\ bypass\ (bit\ 0)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00908}00908\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>writeBit(\doxymbox{\hyperlink{ICM20948__regs_8h_ab7336e26f8947086e41a375f1e1e74d4}{ACCEL\_CONFIG}},\ 0,\ (uint8\_t)bypass))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00909}00909\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00910}00910\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00911}00911\ \ \ \textcolor{comment}{//\ If\ bypass\ enabled,\ skip\ DLPF\ configuration}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00912}00912\ \ \ \textcolor{keywordflow}{if}\ (bypass)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00913}00913\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00914}00914\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00915}00915\ \ \ \textcolor{comment}{//\ Limit\ DLPF\ value\ to\ valid\ range}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00916}00916\ \ \ dlpf\ \&=\ 0x07;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00917}00917\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00918}00918\ \ \ \textcolor{comment}{//\ Set\ DLPF\ configuration\ bits\ [5:3]}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00919}00919\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>writeBits(\doxymbox{\hyperlink{ICM20948__regs_8h_ab7336e26f8947086e41a375f1e1e74d4}{ACCEL\_CONFIG}},\ 3,\ 3,\ dlpf))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00920}00920\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00921}00921\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00922}00922\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00923}00923\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00924}00924\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00925}00925\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00926}\doxymbox{\hyperlink{classDevLab__ICM20948_a95dae0d8f84175c0175e65b9981d86f9}{00926}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a95dae0d8f84175c0175e65b9981d86f9}{DevLab\_ICM20948::getAccelDLPF}}(uint8\_t\ \&dlpf,\ \textcolor{keywordtype}{bool}\ \&bypass)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00927}00927\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00928}00928\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00929}00929\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00930}00930\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00931}00931\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00932}00932\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 2}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00933}00933\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00934}00934\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00935}00935\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00936}00936\ \ \ \textcolor{comment}{//\ Read\ ACCEL\_CONFIG\ register}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00937}00937\ \ \ uint8\_t\ v\ =\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00938}00938\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_ab7336e26f8947086e41a375f1e1e74d4}{ACCEL\_CONFIG}},\ v))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00939}00939\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00940}00940\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00941}00941\ \ \ \textcolor{comment}{//\ Extract\ bypass\ bit\ (bit\ 0)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00942}00942\ \ \ bypass\ =\ (v\ \&\ 0x01);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00943}00943\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00944}00944\ \ \ \textcolor{comment}{//\ Extract\ DLPF\ bits\ [5:3]}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00945}00945\ \ \ dlpf\ =\ (v\ >>\ 3)\ \&\ 0x07;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00946}00946\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00947}00947\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00948}00948\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00949}00949\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00950}00950\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00951}00951\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00952}\doxymbox{\hyperlink{classDevLab__ICM20948_a619f82390347cc173d1604d4d711b537}{00952}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a619f82390347cc173d1604d4d711b537}{DevLab\_ICM20948::setAccelAveraging}}(\doxymbox{\hyperlink{DevLab__ICM20948_8h_a792c56c75cabcab23c273bd9a48aefa9}{ICM20948\_Accel\_Average}}\ avg)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00953}00953\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00954}00954\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00955}00955\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00956}00956\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00957}00957\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00958}00958\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 2}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00959}00959\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00960}00960\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00961}00961\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00962}00962\ \ \ \textcolor{comment}{//\ Set\ DEC3\ averaging\ bits\ [1:0]}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00963}00963\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>writeBits(\doxymbox{\hyperlink{ICM20948__regs_8h_a86a65c9ccec738d87e0aa97db3589a52}{ACCEL\_CONFIG\_2}},\ 0,\ 2,\ (uint8\_t)avg))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00964}00964\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00965}00965\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00966}00966\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00967}00967\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00968}00968\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00969}00969\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00970}\doxymbox{\hyperlink{classDevLab__ICM20948_a7ae5665d5e835f8024df82f43bae46e7}{00970}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a7ae5665d5e835f8024df82f43bae46e7}{DevLab\_ICM20948::setGyroAveraging}}(\doxymbox{\hyperlink{DevLab__ICM20948_8h_a6b88764d5f92bd1ed524fdc1f8b87088}{ICM20948\_Gyro\_Average}}\ avg)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00971}00971\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00972}00972\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00973}00973\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00974}00974\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00975}00975\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00976}00976\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 2}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00977}00977\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00978}00978\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00979}00979\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00980}00980\ \ \ \textcolor{comment}{//\ Set\ DEC3\ averaging\ bits\ [1:0]}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00981}00981\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>writeBits(\doxymbox{\hyperlink{ICM20948__regs_8h_ad5fd1f43dabfe58ed84b6014b470c236}{GYRO\_CONFIG\_2}},\ 0,\ 2,\ (uint8\_t)avg))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00982}00982\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00983}00983\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00984}00984\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00985}00985\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00986}00986\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00987}00987\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00988}\doxymbox{\hyperlink{classDevLab__ICM20948_ae356f6810b038f90e706bd288bb79d19}{00988}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_ae356f6810b038f90e706bd288bb79d19}{DevLab\_ICM20948::getAccelAveraging}}(uint8\_t\ \&avg)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00989}00989\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00990}00990\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00991}00991\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00992}00992\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00993}00993\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00994}00994\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 2}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00995}00995\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00996}00996\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00997}00997\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00998}00998\ \ \ \textcolor{comment}{//\ Read\ DEC3\ averaging\ bits\ [1:0]}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l00999}00999\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>readBits(\doxymbox{\hyperlink{ICM20948__regs_8h_a86a65c9ccec738d87e0aa97db3589a52}{ACCEL\_CONFIG\_2}},\ 0,\ 2,\ avg))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01000}01000\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01001}01001\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01002}01002\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01003}01003\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01004}01004\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01005}01005\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01006}\doxymbox{\hyperlink{classDevLab__ICM20948_ae9c088334d6ec706bb08b47ef29bd186}{01006}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_ae9c088334d6ec706bb08b47ef29bd186}{DevLab\_ICM20948::setSensors}}(\textcolor{keywordtype}{bool}\ accel\_on,\ \textcolor{keywordtype}{bool}\ gyro\_on,\ \textcolor{keywordtype}{bool}\ temp\_on)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01007}01007\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01008}01008\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01009}01009\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01010}01010\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01011}01011\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01012}01012\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 0}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01013}01013\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01014}01014\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01015}01015\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01016}01016\ \ \ \textcolor{comment}{//\ Build\ PWR\_MGMT\_2\ mask}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01017}01017\ \ \ uint8\_t\ v\ =\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01018}01018\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01019}01019\ \ \ \textcolor{comment}{//\ Disable\ accel\ axes\ if\ not\ enabled}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01020}01020\ \ \ \textcolor{keywordflow}{if}\ (!accel\_on)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01021}01021\ \ \ \ \ v\ |=\ 0x38;\ \textcolor{comment}{//\ bits\ [5:3]}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01022}01022\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01023}01023\ \ \ \textcolor{comment}{//\ Disable\ gyro\ axes\ if\ not\ enabled}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01024}01024\ \ \ \textcolor{keywordflow}{if}\ (!gyro\_on)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01025}01025\ \ \ \ \ v\ |=\ 0x07;\ \textcolor{comment}{//\ bits\ [2:0]}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01026}01026\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01027}01027\ \ \ \textcolor{comment}{//\ Write\ sensor\ enable/disable\ mask}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01028}01028\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a23cfbcfd19dc88eb631309970f138e65}{PWR\_MGMT\_2}},\ v))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01029}01029\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01030}01030\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01031}01031\ \ \ \textcolor{comment}{//\ Set\ or\ clear\ TEMP\_DIS\ bit\ (bit\ 3)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01032}01032\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>writeBit(\doxymbox{\hyperlink{ICM20948__regs_8h_a96169eb207e721c1546cea9ffd8a35e4}{PWR\_MGMT\_1}},\ 3,\ (uint8\_t)!temp\_on))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01033}01033\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01034}01034\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01035}01035\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01036}01036\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01037}01037\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01038}01038\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01039}\doxymbox{\hyperlink{classDevLab__ICM20948_a8b3768ede281b8aa65900b1db8a7a7c7}{01039}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a8b3768ede281b8aa65900b1db8a7a7c7}{DevLab\_ICM20948::getSensors}}(\textcolor{keywordtype}{bool}\ \&accel\_on,\ \textcolor{keywordtype}{bool}\ \&gyro\_on,\ \textcolor{keywordtype}{bool}\ \&temp\_on)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01040}01040\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01041}01041\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01042}01042\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01043}01043\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01044}01044\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01045}01045\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 0}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01046}01046\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01047}01047\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01048}01048\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01049}01049\ \ \ \textcolor{comment}{//\ Read\ PWR\_MGMT\_2\ register}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01050}01050\ \ \ uint8\_t\ v\ =\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01051}01051\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_a23cfbcfd19dc88eb631309970f138e65}{PWR\_MGMT\_2}},\ v))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01052}01052\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01053}01053\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01054}01054\ \ \ \textcolor{comment}{//\ Decode\ gyro\ state\ (bits\ [2:0])}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01055}01055\ \ \ gyro\_on\ =\ ((v\ \&\ 0x07)\ ==\ 0);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01056}01056\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01057}01057\ \ \ \textcolor{comment}{//\ Decode\ accel\ state\ (bits\ [5:3])}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01058}01058\ \ \ accel\_on\ =\ ((v\ \&\ 0x38)\ ==\ 0);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01059}01059\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01060}01060\ \ \ \textcolor{comment}{//\ Read\ TEMP\_DIS\ bit\ (bit\ 3)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01061}01061\ \ \ uint8\_t\ t\ =\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01062}01062\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>readBit(\doxymbox{\hyperlink{ICM20948__regs_8h_a96169eb207e721c1546cea9ffd8a35e4}{PWR\_MGMT\_1}},\ 3,\ t))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01063}01063\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01064}01064\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01065}01065\ \ \ \textcolor{comment}{//\ Decode\ temperature\ state}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01066}01066\ \ \ temp\_on\ =\ (t\ ==\ 0);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01067}01067\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01068}01068\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01069}01069\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01070}01070\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01071}01071\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01072}\doxymbox{\hyperlink{classDevLab__ICM20948_a631e6298058a3c54f1c02bae5cf8db54}{01072}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a631e6298058a3c54f1c02bae5cf8db54}{DevLab\_ICM20948::setGyroOffset}}(uint16\_t\ offsetX,\ uint16\_t\ offsetY,\ uint16\_t\ offsetZ)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01073}01073\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01074}01074\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01075}01075\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01076}01076\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01077}01077\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01078}01078\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 2}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01079}01079\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01080}01080\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01081}01081\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01082}01082\ \ \ \textcolor{comment}{//\ Pack\ offset\ values\ into\ byte\ array}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01083}01083\ \ \ uint8\_t\ data[6]\ =\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01084}01084\ \ \ \ \ \ \ (uint8\_t)(offsetX\ >>\ 8),}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01085}01085\ \ \ \ \ \ \ (uint8\_t)(offsetX\ \&\ 0xFF),}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01086}01086\ \ \ \ \ \ \ (uint8\_t)(offsetY\ >>\ 8),}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01087}01087\ \ \ \ \ \ \ (uint8\_t)(offsetY\ \&\ 0xFF),}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01088}01088\ \ \ \ \ \ \ (uint8\_t)(offsetZ\ >>\ 8),}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01089}01089\ \ \ \ \ \ \ (uint8\_t)(offsetZ\ \&\ 0xFF)\};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01090}01090\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01091}01091\ \ \ \textcolor{comment}{//\ Write\ offset\ registers}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01092}01092\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a75ed9711e6453cadb7bc62a8457aefc7}{XG\_OFFS\_USRH}},\ data,\ 6))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01093}01093\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01094}01094\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01095}01095\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01096}01096\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01097}01097\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01098}01098\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01099}\doxymbox{\hyperlink{classDevLab__ICM20948_a3d407a299b73a9d6da88f724bcca0a36}{01099}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a3d407a299b73a9d6da88f724bcca0a36}{DevLab\_ICM20948::getGyroOffset}}(int16\_t\ \&offsetX,\ int16\_t\ \&offsetY,\ int16\_t\ \&offsetZ)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01100}01100\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01101}01101\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01102}01102\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01103}01103\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01104}01104\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01105}01105\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 2}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01106}01106\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(2))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01107}01107\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01108}01108\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01109}01109\ \ \ \textcolor{comment}{//\ Read\ offset\ registers}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01110}01110\ \ \ uint8\_t\ data[6];}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01111}01111\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_a75ed9711e6453cadb7bc62a8457aefc7}{XG\_OFFS\_USRH}},\ data,\ 6))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01112}01112\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01113}01113\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01114}01114\ \ \ \textcolor{comment}{//\ Convert\ to\ signed\ values}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01115}01115\ \ \ offsetX\ =\ (int16\_t)((data[0]\ <<\ 8)\ |\ data[1]);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01116}01116\ \ \ offsetY\ =\ (int16\_t)((data[2]\ <<\ 8)\ |\ data[3]);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01117}01117\ \ \ offsetZ\ =\ (int16\_t)((data[4]\ <<\ 8)\ |\ data[5]);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01118}01118\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01119}01119\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01120}01120\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01121}01121\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01122}01122\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01123}01123\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01124}\doxymbox{\hyperlink{classDevLab__ICM20948_a7c150c665140086d7937fa4b2f39cd45}{01124}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a7c150c665140086d7937fa4b2f39cd45}{DevLab\_ICM20948::setAccelOffset}}(int16\_t\ offsetX,\ int16\_t\ offsetY,\ int16\_t\ offsetZ)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01125}01125\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01126}01126\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01127}01127\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01128}01128\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01129}01129\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01130}01130\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 1\ (accel\ offsets\ are\ here)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01131}01131\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(1))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01132}01132\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01133}01133\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01134}01134\ \ \ \textcolor{comment}{//\ Pack\ offset\ values\ into\ byte\ array}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01135}01135\ \ \ uint8\_t\ data[6]\ =\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01136}01136\ \ \ \ \ \ \ (uint8\_t)(offsetX\ >>\ 8),}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01137}01137\ \ \ \ \ \ \ (uint8\_t)(offsetX\ \&\ 0xFF),}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01138}01138\ \ \ \ \ \ \ (uint8\_t)(offsetY\ >>\ 8),}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01139}01139\ \ \ \ \ \ \ (uint8\_t)(offsetY\ \&\ 0xFF),}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01140}01140\ \ \ \ \ \ \ (uint8\_t)(offsetZ\ >>\ 8),}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01141}01141\ \ \ \ \ \ \ (uint8\_t)(offsetZ\ \&\ 0xFF)\};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01142}01142\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01143}01143\ \ \ \textcolor{comment}{//\ Write\ offset\ registers}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01144}01144\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a04ff2b3ed31a8d968fd35d4aa6f21f41}{XA\_OFFS\_H}},\ data,\ 6))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01145}01145\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01146}01146\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01147}01147\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01148}01148\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01149}01149\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01150}01150\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01151}\doxymbox{\hyperlink{classDevLab__ICM20948_ae4beff71dc469940c9ba561d57f04ec7}{01151}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_ae4beff71dc469940c9ba561d57f04ec7}{DevLab\_ICM20948::getAccelOffset}}(int16\_t\ \&offsetX,\ int16\_t\ \&offsetY,\ int16\_t\ \&offsetZ)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01152}01152\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01153}01153\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01154}01154\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01155}01155\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01156}01156\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01157}01157\ \ \ \textcolor{comment}{//\ Select\ USER\ BANK\ 1}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01158}01158\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(1))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01159}01159\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01160}01160\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01161}01161\ \ \ \textcolor{comment}{//\ Read\ offset\ registers}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01162}01162\ \ \ uint8\_t\ data[6];}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01163}01163\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_a04ff2b3ed31a8d968fd35d4aa6f21f41}{XA\_OFFS\_H}},\ data,\ 6))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01164}01164\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01165}01165\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01166}01166\ \ \ \textcolor{comment}{//\ Convert\ to\ signed\ values}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01167}01167\ \ \ offsetX\ =\ (int16\_t)((data[0]\ <<\ 8)\ |\ data[1]);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01168}01168\ \ \ offsetY\ =\ (int16\_t)((data[2]\ <<\ 8)\ |\ data[3]);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01169}01169\ \ \ offsetZ\ =\ (int16\_t)((data[4]\ <<\ 8)\ |\ data[5]);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01170}01170\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01171}01171\ \ \ \textcolor{comment}{//\ Success}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01172}01172\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01173}01173\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01174}01174\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01175}01175\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01176}\doxymbox{\hyperlink{classDevLab__ICM20948_ab011f71e9466a0e1e8245638f81b0f43}{01176}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_ab011f71e9466a0e1e8245638f81b0f43}{DevLab\_ICM20948::intInit}}(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{structICM20948__IntPinConfig}{ICM20948\_IntPinConfig}}\ \&cfg)\{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01177}01177\ \ \ \textcolor{comment}{//\ Validate\ bus\ pointer}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01178}01178\ \ \ \textcolor{keywordflow}{if}\ (!bus)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01179}01179\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01180}01180\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01181}01181\ \ \ \textcolor{keywordflow}{if}(!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01182}01182\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01183}01183\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01184}01184\ \ \ uint8\_t\ reg\ =\ (cfg.\doxymbox{\hyperlink{structICM20948__IntPinConfig_a5bab37898a5ad12279ae46748d5400cf}{activeLevel}}\ \ \ <<\ 7)\ |}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01185}01185\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (cfg.\doxymbox{\hyperlink{structICM20948__IntPinConfig_af8cd3194154cbe96ee8042e0feebbc39}{driveMode}}\ \ \ \ \ <<\ 6)\ |}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01186}01186\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (cfg.\doxymbox{\hyperlink{structICM20948__IntPinConfig_ae1451bd05cabcea7fcada08028553753}{latchMode}}\ \ \ \ \ <<\ 5)\ |}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01187}01187\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (cfg.\doxymbox{\hyperlink{structICM20948__IntPinConfig_a6dd7d0d00d7f06c42cf51752d57e13dd}{clearMode}}\ \ \ \ \ <<\ 4)\ |}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01188}01188\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (cfg.\doxymbox{\hyperlink{structICM20948__IntPinConfig_a31e303e6779d760cab50e5302930d1a2}{fsyncActLevel}}\ <<\ 3)\ |}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01189}01189\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (cfg.\doxymbox{\hyperlink{structICM20948__IntPinConfig_a6eb25bd804e5571506469674bf924323}{fsyncIntEn}}\ \ \ \ <<\ 2)\ |}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01190}01190\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (cfg.\doxymbox{\hyperlink{structICM20948__IntPinConfig_a395907b185a1d0bfe2526f4931c7138e}{bypassEn}}\ \ \ \ \ \ <<\ 1);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01191}01191\ \ \ \textcolor{comment}{//\ Initialize\ INT1\ }}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01192}01192\ \ \ \textcolor{comment}{//\ Configure\ interrupt\ pin\ (open-\/drain,\ active-\/low,\ latch)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01193}01193\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_ab00fdfba66092d2d869031629c092dad}{INT\_PIN\_CFG}},\ reg))}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01194}01194\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01195}01195\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01196}01196\ \ \ \textcolor{comment}{//\ Configuration\ successful}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01197}01197\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01198}01198\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01199}01199\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01200}\doxymbox{\hyperlink{classDevLab__ICM20948_a3c5db22058479806072167f2c15319c7}{01200}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a3c5db22058479806072167f2c15319c7}{DevLab\_ICM20948::intEnableConfig}}(\textcolor{keyword}{const}\ \doxymbox{\hyperlink{structICM20948__IntEnableConfig}{ICM20948\_IntEnableConfig}}\ \&cfg)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01201}01201\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01202}01202\ \ \ \textcolor{keywordflow}{if}\ (!bus)\ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01203}01203\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01204}01204\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01205}01205\ \ \ \textcolor{comment}{//\ INT\_ENABLE}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01206}01206\ \ \ uint8\_t\ reg0\ =\ (cfg.\doxymbox{\hyperlink{structICM20948__IntEnableConfig_ad8e41ee5fb54f5f168e2429d09ea900e}{wofEn}}\ \ \ \ \ \ \ <<\ 7)\ |}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01207}01207\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (cfg.\doxymbox{\hyperlink{structICM20948__IntEnableConfig_a2c13cfee0f9e9e73a152599540dc8e0f}{womIntEn}}\ \ \ \ <<\ 3)\ |}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01208}01208\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (cfg.\doxymbox{\hyperlink{structICM20948__IntEnableConfig_ad5823eddb88b1463692d7fe5363ca6f9}{pllRdyEn}}\ \ \ \ <<\ 2)\ |}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01209}01209\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (cfg.\doxymbox{\hyperlink{structICM20948__IntEnableConfig_a5640acb7eedb2bf36876d7b3651988da}{dmpInt1En}}\ \ \ <<\ 1)\ |}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01210}01210\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (cfg.\doxymbox{\hyperlink{structICM20948__IntEnableConfig_aff622326c928640c8f9576a7c9834be7}{i2cMstIntEn}}\ <<\ 0);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01211}01211\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_abf7a56466fd6203663685a04448c9185}{INT\_ENABLE}},\ reg0))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01212}01212\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01213}01213\ \ \ \textcolor{comment}{//\ INT\_ENABLE\_1}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01214}01214\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_ae8c6c6e4a060f62ce0e923d80a0ccffe}{INT\_ENABLE\_1}},\ (uint8\_t)(cfg.\doxymbox{\hyperlink{structICM20948__IntEnableConfig_a6764938aee3f8d6c6e070851872cc388}{rawDataRdyEn}}\ \&\ 0x01)))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01215}01215\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01216}01216\ \ \ \textcolor{comment}{//\ INT\_ENABLE\_2\ —\ construye\ máscara\ desde\ el\ array}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01217}01217\ \ \ uint8\_t\ ovfMask\ =\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01218}01218\ \ \ \textcolor{keywordflow}{for}\ (uint8\_t\ i\ =\ 0;\ i\ <\ 5;\ i++)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01219}01219\ \ \ \ \ ovfMask\ |=\ (cfg.\doxymbox{\hyperlink{structICM20948__IntEnableConfig_a1254a7bd92a17da57b81a91338c145bc}{fifoOvfEn}}[i]\ ?\ BIT(i)\ :\ 0);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01220}01220\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a37397c9ab1b56abddfadfa044fec7371}{INT\_ENABLE\_2}},\ ovfMask))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01221}01221\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01222}01222\ \ \ \textcolor{comment}{//\ INT\_ENABLE\_3\ —\ igual}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01223}01223\ \ \ uint8\_t\ wmMask\ =\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01224}01224\ \ \ \textcolor{keywordflow}{for}\ (uint8\_t\ i\ =\ 0;\ i\ <\ 5;\ i++)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01225}01225\ \ \ \ \ wmMask\ |=\ (cfg.\doxymbox{\hyperlink{structICM20948__IntEnableConfig_aaac07304191025a3f3da9b0a619b3f6f}{fifoWmEn}}[i]\ ?\ BIT(i)\ :\ 0);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01226}01226\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a3d88b66994665f81b4be05f71a6bf721}{INT\_ENABLE\_3}},\ wmMask))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01227}01227\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01228}01228\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01229}01229\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01230}01230\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01231}\doxymbox{\hyperlink{classDevLab__ICM20948_a61f65c00baf13e2cd69eee7cb6688720}{01231}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a61f65c00baf13e2cd69eee7cb6688720}{DevLab\_ICM20948::checkIntStatus}}(\doxymbox{\hyperlink{structICM20948__IntStatus}{ICM20948\_IntStatus}}\ \&status)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01232}01232\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01233}01233\ \ \ \textcolor{keywordflow}{if}\ (!bus)\ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01234}01234\ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01235}01235\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01236}01236\ \ \ \textcolor{comment}{//\ Leer\ los\ 4\ registros\ de\ status\ en\ una\ sola\ operación\ de\ burst}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01237}01237\ \ \ uint8\_t\ raw[4];}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01238}01238\ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_a62cba161837810295654c3cc2de959a6}{INT\_STATUS}},\ raw,\ 4))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01239}01239\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01240}01240\ \ \ \textcolor{comment}{//\ INT\_STATUS\ (0x19)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01241}01241\ \ \ status.\doxymbox{\hyperlink{structICM20948__IntStatus_a2438eb5d73069cbb931b12879679c756}{womInt}}\ \ \ \ =\ (raw[0]\ \&\ \doxymbox{\hyperlink{ICM20948__regs_8h_a1da7a39a86332022ad6cc968d9bb2fe6}{STS\_WOM\_INT}})\ \ \ \ \ ?\ 1\ :\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01242}01242\ \ \ status.\doxymbox{\hyperlink{structICM20948__IntStatus_a0e14602a7e105da494b79056fc1a6ac4}{pllRdyInt}}\ =\ (raw[0]\ \&\ \doxymbox{\hyperlink{ICM20948__regs_8h_a307d55fede8f7bed60f2820f10b4a37c}{STS\_PLL\_RDY\_INT}})\ ?\ 1\ :\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01243}01243\ \ \ status.\doxymbox{\hyperlink{structICM20948__IntStatus_a0b7a43a154fb62938d5b72f6c4e7589b}{dmpInt1}}\ \ \ =\ (raw[0]\ \&\ \doxymbox{\hyperlink{ICM20948__regs_8h_a7bdf0e8f1f8ce9ac0b6c3416e94de186}{STS\_DMP\_INT1}})\ \ \ \ ?\ 1\ :\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01244}01244\ \ \ status.\doxymbox{\hyperlink{structICM20948__IntStatus_a76967ffcc1f2f78af326ec5997c4e46e}{i2cMstInt}}\ =\ (raw[0]\ \&\ \doxymbox{\hyperlink{ICM20948__regs_8h_a02e7e0bda15647950f785937f772c0d3}{STS\_I2C\_MST\_INT}})\ ?\ 1\ :\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01245}01245\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01246}01246\ \ \ \textcolor{comment}{//\ INT\_STATUS\_1\ (0x1A)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01247}01247\ \ \ status.\doxymbox{\hyperlink{structICM20948__IntStatus_a8662cbb6f261e560d0571467f4957bf0}{rawDataRdy}}\ =\ (raw[1]\ \&\ \doxymbox{\hyperlink{ICM20948__regs_8h_ae4756d95c4a9a7ce7f4de7808c759697}{STS\_RAW\_DATA\_0\_RDY\_INT}})\ ?\ 1\ :\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01248}01248\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01249}01249\ \ \ \textcolor{comment}{//\ INT\_STATUS\_2\ (0x1B)\ —\ FIFO\ overflow\ canal\ por\ canal}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01250}01250\ \ \ \textcolor{keywordflow}{for}\ (uint8\_t\ i\ =\ 0;\ i\ <\ 5;\ i++)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01251}01251\ \ \ \ \ status.\doxymbox{\hyperlink{structICM20948__IntStatus_a91ea9622426177697ad95043338f2096}{fifoOvf}}[i]\ =\ (raw[2]\ \&\ BIT(i))\ ?\ 1\ :\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01252}01252\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01253}01253\ \ \ \textcolor{comment}{//\ INT\_STATUS\_3\ (0x1C)\ —\ FIFO\ watermark\ canal\ por\ canal}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01254}01254\ \ \ \textcolor{keywordflow}{for}\ (uint8\_t\ i\ =\ 0;\ i\ <\ 5;\ i++)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01255}01255\ \ \ \ \ status.\doxymbox{\hyperlink{structICM20948__IntStatus_ac11c6bb5cb949a957d5ae12de13039bf}{fifoWm}}[i]\ =\ (raw[3]\ \&\ BIT(i))\ ?\ 1\ :\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01256}01256\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01257}01257\ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01258}01258\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01259}01259\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01260}\doxymbox{\hyperlink{classDevLab__ICM20948_aab027c72832d1c7ec722187e6a64796a}{01260}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_aab027c72832d1c7ec722187e6a64796a}{DevLab\_ICM20948::auxMasterEnable}}(uint8\_t\ clkFreq)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01261}01261\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01262}01262\ \ \ \ \ \textcolor{comment}{//\ BANK\ 0:\ asegurarse\ que\ BYPASS\_EN=0\ e\ I2C\_MST\_EN=1}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01263}01263\ \ \ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01264}01264\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01265}01265\ \ \ \ \ \textcolor{comment}{//\ Limpiar\ BYPASS\_EN\ (bit\ 1\ de\ INT\_PIN\_CFG)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01266}01266\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>writeBit(\doxymbox{\hyperlink{ICM20948__regs_8h_ab00fdfba66092d2d869031629c092dad}{INT\_PIN\_CFG}},\ 1,\ (uint8\_t)0))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01267}01267\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01268}01268\ \ \ \ \ \textcolor{comment}{//\ Activar\ I2C\_MST\_EN\ (bit\ 5\ de\ USER\_CTRL)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01269}01269\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>writeBit(\doxymbox{\hyperlink{ICM20948__regs_8h_abd9eebb35aad7616fe0414952e2d477d}{USER\_CTRL}},\ 5,\ (uint8\_t)1))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01270}01270\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01271}01271\ \ \ \ \ \textcolor{comment}{//\ BANK\ 3:\ configurar\ clock\ del\ master\ auxiliar}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01272}01272\ \ \ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(3))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01273}01273\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01274}01274\ \ \ \ \ \textcolor{comment}{//\ clkFreq\ típico:\ 0x07\ =\ \string~345.6\ kHz\ \ |\ \ 0x0D\ =\ \string~400\ kHz}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01275}01275\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>writeBits(\doxymbox{\hyperlink{ICM20948__regs_8h_a24bc05247067ad9f0479f5a6d49c6412}{I2C\_MST\_CTRL}},\ 0,\ 4,\ clkFreq))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01276}01276\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01277}01277\ \ \ \ \ \textcolor{comment}{//\ Volver\ a\ BANK\ 0}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01278}01278\ \ \ \ \ \textcolor{keywordflow}{return}\ \doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01279}01279\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01280}01280\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01281}\doxymbox{\hyperlink{classDevLab__ICM20948_a1079d6d89e4bda1f496cce90a820e102}{01281}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a1079d6d89e4bda1f496cce90a820e102}{DevLab\_ICM20948::auxWriteByte}}(uint8\_t\ slaveAddr,\ uint8\_t\ reg,\ uint8\_t\ data)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01282}01282\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01283}01283\ \ \ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(3))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01284}01284\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01285}01285\ \ \ \ \ \textcolor{comment}{//\ Dirección\ del\ slave,\ bit\ 7=0\ para\ escritura}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01286}01286\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a25432a6492073ae1e1e082ea95ad3c65}{I2C\_SLV4\_ADDR}},\ (uint8\_t)(slaveAddr\ \&\ 0x7F)))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01287}01287\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01288}01288\ \ \ \ \ \textcolor{comment}{//\ Registro\ destino\ que\ queremos\ escribir\ en\ el\ slave}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01289}01289\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a89919db5e2f4a361c1d19cc2215c8d0c}{I2C\_SLV4\_REG}},\ reg))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01290}01290\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01291}01291\ \ \ \ \ \textcolor{comment}{//\ Dato\ a\ escribir}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01292}01292\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a317a21f85deb696c508437cd32ac803c}{I2C\_SLV4\_DO}},\ data))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01293}01293\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01294}01294\ \ \ \ \ \textcolor{comment}{//\ Disparar\ transacción\ (I2C\_SLV4\_EN,\ se\ auto-\/limpia\ al\ terminar)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01295}01295\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a7e5cb081a1546553fe74fb3e07b7907b}{I2C\_SLV4\_CTRL}},\ (uint8\_t)\doxymbox{\hyperlink{ICM20948__regs_8h_a00a6bbbaaeeeba58a5c7a70a00237b34}{I2C\_SLVx\_EN}}))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01296}01296\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01297}01297\ \ \ \ \ \textcolor{comment}{//\ Esperar\ a\ que\ complete\ —\ verificar\ SLV4\_DONE\ en\ BANK\ 0}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01298}01298\ \ \ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01299}01299\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01300}01300\ \ \ \ \ uint8\_t\ status\ =\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01301}01301\ \ \ \ \ uint8\_t\ timeout\ =\ 50;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01302}01302\ \ \ \ \ \textcolor{keywordflow}{do}\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01303}01303\ \ \ \ \ \ \ \ \ delay(1);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01304}01304\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_a8498e646190e00d95ddd95af4d6a093a}{I2C\_MST\_STATUS}},\ status))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01305}01305\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (-\/-\/timeout\ ==\ 0)\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};\ \ \textcolor{comment}{//\ timeout}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01306}01306\ \ \ \ \ \}\ \textcolor{keywordflow}{while}\ (!(status\ \&\ \doxymbox{\hyperlink{ICM20948__regs_8h_ad2aa22121a98f94134f273fe12e269be}{MST\_SLV4\_DONE}}));}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01307}01307\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01308}01308\ \ \ \ \ \textcolor{comment}{//\ Verificar\ que\ no\ hubo\ NACK}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01309}01309\ \ \ \ \ \textcolor{keywordflow}{return}\ !(status\ \&\ \doxymbox{\hyperlink{ICM20948__regs_8h_add44eaeeb32d78a1dbfb3a01a98471b3}{MST\_SLV4\_NACK}});}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01310}01310\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01311}01311\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01312}\doxymbox{\hyperlink{classDevLab__ICM20948_a1b8cce13fe757b1b3a61f8437766d7eb}{01312}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a1b8cce13fe757b1b3a61f8437766d7eb}{DevLab\_ICM20948::auxReadByte}}(uint8\_t\ slaveAddr,\ uint8\_t\ reg,\ uint8\_t\ \&data)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01313}01313\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01314}01314\ \ \ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(3))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01315}01315\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01316}01316\ \ \ \ \ \textcolor{comment}{//\ Dirección\ del\ slave,\ bit\ 7=1\ para\ lectura}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01317}01317\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a25432a6492073ae1e1e082ea95ad3c65}{I2C\_SLV4\_ADDR}},\ (uint8\_t)((slaveAddr\ \&\ 0x7F)\ |\ \doxymbox{\hyperlink{ICM20948__regs_8h_a8c357db66e310d0e6298ab41c86d3cad}{I2C\_SLVx\_RNW}})))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01318}01318\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01319}01319\ \ \ \ \ \textcolor{comment}{//\ Registro\ origen\ que\ queremos\ leer\ del\ slave}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01320}01320\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a89919db5e2f4a361c1d19cc2215c8d0c}{I2C\_SLV4\_REG}},\ reg))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01321}01321\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01322}01322\ \ \ \ \ \textcolor{comment}{//\ Disparar\ transacción\ (I2C\_SLV4\_EN,\ se\ auto-\/limpia\ al\ terminar)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01323}01323\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a7e5cb081a1546553fe74fb3e07b7907b}{I2C\_SLV4\_CTRL}},\ (uint8\_t)\doxymbox{\hyperlink{ICM20948__regs_8h_a00a6bbbaaeeeba58a5c7a70a00237b34}{I2C\_SLVx\_EN}}))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01324}01324\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01325}01325\ \ \ \ \ \textcolor{comment}{//\ Esperar\ a\ que\ complete\ —\ verificar\ SLV4\_DONE\ en\ BANK\ 0}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01326}01326\ \ \ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01327}01327\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01328}01328\ \ \ \ \ uint8\_t\ status\ =\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01329}01329\ \ \ \ \ uint8\_t\ timeout\ =\ 50;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01330}01330\ \ \ \ \ \textcolor{keywordflow}{do}\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01331}01331\ \ \ \ \ \ \ \ \ delay(1);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01332}01332\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_a8498e646190e00d95ddd95af4d6a093a}{I2C\_MST\_STATUS}},\ status))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01333}01333\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (-\/-\/timeout\ ==\ 0)\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};\ \ \textcolor{comment}{//\ timeout}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01334}01334\ \ \ \ \ \}\ \textcolor{keywordflow}{while}\ (!(status\ \&\ \doxymbox{\hyperlink{ICM20948__regs_8h_ad2aa22121a98f94134f273fe12e269be}{MST\_SLV4\_DONE}}));}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01335}01335\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01336}01336\ \ \ \ \ \textcolor{comment}{//\ Verificar\ que\ no\ hubo\ NACK}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01337}01337\ \ \ \ \ \textcolor{keywordflow}{if}\ (status\ \&\ \doxymbox{\hyperlink{ICM20948__regs_8h_add44eaeeb32d78a1dbfb3a01a98471b3}{MST\_SLV4\_NACK}})\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01338}01338\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01339}01339\ \ \ \ \ \textcolor{comment}{//\ Leer\ el\ dato\ recibido\ del\ slave\ (BANK\ 3)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01340}01340\ \ \ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(3))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01341}01341\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_a838003994d9f3319308f9f650cc2a083}{I2C\_SLV4\_DI}},\ data))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01342}01342\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01343}01343\ \ \ \ \ \textcolor{keywordflow}{return}\ \doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01344}01344\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01345}01345\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01346}\doxymbox{\hyperlink{classDevLab__ICM20948_ac2a1cdaf078cac71e14e0629925a7808}{01346}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_ac2a1cdaf078cac71e14e0629925a7808}{DevLab\_ICM20948::auxWriteCommand}}(uint8\_t\ slaveAddr,\ uint8\_t\ cmd)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01347}01347\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01348}01348\ \ \ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(3))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01349}01349\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01350}01350\ \ \ \ \ \textcolor{comment}{//\ Dirección\ del\ slave,\ bit\ 7=0\ para\ escritura}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01351}01351\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a25432a6492073ae1e1e082ea95ad3c65}{I2C\_SLV4\_ADDR}},\ (uint8\_t)(slaveAddr\ \&\ 0x7F)))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01352}01352\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01353}01353\ \ \ \ \ \textcolor{comment}{//\ Byte\ de\ comando\ a\ enviar\ (único\ byte\ de\ la\ transacción)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01354}01354\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a317a21f85deb696c508437cd32ac803c}{I2C\_SLV4\_DO}},\ cmd))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01355}01355\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01356}01356\ \ \ \ \ \textcolor{comment}{//\ EN\ +\ REG\_DIS:\ el\ SLV4\ envía\ solo\ I2C\_SLV4\_DO,\ sin\ byte\ de\ registro}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01357}01357\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a7e5cb081a1546553fe74fb3e07b7907b}{I2C\_SLV4\_CTRL}},\ (uint8\_t)(\doxymbox{\hyperlink{ICM20948__regs_8h_a00a6bbbaaeeeba58a5c7a70a00237b34}{I2C\_SLVx\_EN}}\ |\ \doxymbox{\hyperlink{ICM20948__regs_8h_aff507d9c313c3acd182b127a8a7df3fb}{I2C\_SLVx\_REG\_DIS}})))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01358}01358\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01359}01359\ \ \ \ \ \textcolor{comment}{//\ Esperar\ a\ que\ complete\ —\ verificar\ SLV4\_DONE\ en\ BANK\ 0}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01360}01360\ \ \ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01361}01361\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01362}01362\ \ \ \ \ uint8\_t\ status\ =\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01363}01363\ \ \ \ \ uint8\_t\ timeout\ =\ 50;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01364}01364\ \ \ \ \ \textcolor{keywordflow}{do}\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01365}01365\ \ \ \ \ \ \ \ \ delay(1);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01366}01366\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_a8498e646190e00d95ddd95af4d6a093a}{I2C\_MST\_STATUS}},\ status))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01367}01367\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (-\/-\/timeout\ ==\ 0)\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};\ \ \textcolor{comment}{//\ timeout}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01368}01368\ \ \ \ \ \}\ \textcolor{keywordflow}{while}\ (!(status\ \&\ \doxymbox{\hyperlink{ICM20948__regs_8h_ad2aa22121a98f94134f273fe12e269be}{MST\_SLV4\_DONE}}));}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01369}01369\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01370}01370\ \ \ \ \ \textcolor{comment}{//\ Verificar\ que\ no\ hubo\ NACK}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01371}01371\ \ \ \ \ \textcolor{keywordflow}{return}\ !(status\ \&\ \doxymbox{\hyperlink{ICM20948__regs_8h_add44eaeeb32d78a1dbfb3a01a98471b3}{MST\_SLV4\_NACK}});}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01372}01372\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01373}01373\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01374}\doxymbox{\hyperlink{classDevLab__ICM20948_ab8336307b4096237d701d989d1f5e619}{01374}}\ \ \ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_ab8336307b4096237d701d989d1f5e619}{DevLab\_ICM20948::auxConfigSlave}}(uint8\_t\ slaveAddr,\ uint8\_t\ reg,\ uint8\_t\ numBytes)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01375}01375\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01376}01376\ \ \ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(3))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01377}01377\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01378}01378\ \ \ \ \ \textcolor{comment}{//\ Slave\ 0:\ dirección\ +\ bit\ READ}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01379}01379\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a614db921c27f375c632960a7f34999a4}{I2C\_SLV0\_ADDR}},\ (uint8\_t)(slaveAddr\ |\ \doxymbox{\hyperlink{ICM20948__regs_8h_a8c357db66e310d0e6298ab41c86d3cad}{I2C\_SLVx\_RNW}})))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01380}01380\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01381}01381\ \ \ \ \ \textcolor{comment}{//\ Registro\ de\ inicio}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01382}01382\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a0553d56ecccd0fc8008505e712a9b075}{I2C\_SLV0\_REG}},\ reg))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01383}01383\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01384}01384\ \ \ \ \ \textcolor{comment}{//\ Habilitar\ +\ número\ de\ bytes}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01385}01385\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_ad6fb6553534b0b9e9715db3e5a04ebca}{I2C\_SLV0\_CTRL}},\ (uint8\_t)(\doxymbox{\hyperlink{ICM20948__regs_8h_a00a6bbbaaeeeba58a5c7a70a00237b34}{I2C\_SLVx\_EN}}\ |\ (numBytes\ \&\ 0x0F))))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01386}01386\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01387}01387\ \ \ \ \ \textcolor{keywordflow}{return}\ \doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01388}01388\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01389}01389\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01390}01390\ \textcolor{comment}{//\ Para\ leer\ los\ datos\ que\ el\ ICM\ leyó\ automáticamente:}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01391}\doxymbox{\hyperlink{classDevLab__ICM20948_a8f47c9f63642c35e5b5656e720667566}{01391}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a8f47c9f63642c35e5b5656e720667566}{DevLab\_ICM20948::auxReadSensorData}}(uint8\_t\ *buf,\ uint8\_t\ len)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01392}01392\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01393}01393\ \ \ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01394}01394\ \ \ \ \ \textcolor{keywordflow}{return}\ bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_a3cc8ba7b3d13ace76a3d4bfd9101de76}{EXT\_SLV\_SENS\_DATA\_00}},\ buf,\ len);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01395}01395\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01396}01396\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01397}\doxymbox{\hyperlink{classDevLab__ICM20948_a57d37173d6d5c54ab4c7027dfdd3a78f}{01397}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a57d37173d6d5c54ab4c7027dfdd3a78f}{DevLab\_ICM20948::auxReadResponse}}(uint8\_t\ slaveAddr,\ uint8\_t\ \&data)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01398}01398\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01399}01399\ \ \ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(3))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01400}01400\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01401}01401\ \ \ \ \ \textcolor{comment}{//\ Slave\ address\ con\ bit\ READ,\ sin\ byte\ de\ registro\ (REG\_DIS)}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01402}01402\ \ \ \ \ \textcolor{comment}{//\ Genera:\ [START,\ addr+R,\ lee\ 1\ byte,\ STOP]}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01403}01403\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a25432a6492073ae1e1e082ea95ad3c65}{I2C\_SLV4\_ADDR}},\ (uint8\_t)((slaveAddr\ \&\ 0x7F)\ |\ \doxymbox{\hyperlink{ICM20948__regs_8h_a8c357db66e310d0e6298ab41c86d3cad}{I2C\_SLVx\_RNW}})))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01404}01404\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>write(\doxymbox{\hyperlink{ICM20948__regs_8h_a7e5cb081a1546553fe74fb3e07b7907b}{I2C\_SLV4\_CTRL}},\ (uint8\_t)(\doxymbox{\hyperlink{ICM20948__regs_8h_a00a6bbbaaeeeba58a5c7a70a00237b34}{I2C\_SLVx\_EN}}\ |\ \doxymbox{\hyperlink{ICM20948__regs_8h_aff507d9c313c3acd182b127a8a7df3fb}{I2C\_SLVx\_REG\_DIS}})))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01405}01405\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01406}01406\ \ \ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01407}01407\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01408}01408\ \ \ \ \ uint8\_t\ status\ =\ 0;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01409}01409\ \ \ \ \ uint8\_t\ timeout\ =\ 50;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01410}01410\ \ \ \ \ \textcolor{keywordflow}{do}\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01411}01411\ \ \ \ \ \ \ \ \ delay(1);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01412}01412\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_a8498e646190e00d95ddd95af4d6a093a}{I2C\_MST\_STATUS}},\ status))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01413}01413\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (-\/-\/timeout\ ==\ 0)\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01414}01414\ \ \ \ \ \}\ \textcolor{keywordflow}{while}\ (!(status\ \&\ \doxymbox{\hyperlink{ICM20948__regs_8h_ad2aa22121a98f94134f273fe12e269be}{MST\_SLV4\_DONE}}));}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01415}01415\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01416}01416\ \ \ \ \ \textcolor{keywordflow}{if}\ (status\ \&\ \doxymbox{\hyperlink{ICM20948__regs_8h_add44eaeeb32d78a1dbfb3a01a98471b3}{MST\_SLV4\_NACK}})\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01417}01417\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01418}01418\ \ \ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(3))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01419}01419\ \ \ \ \ \textcolor{keywordflow}{if}\ (!bus-\/>read(\doxymbox{\hyperlink{ICM20948__regs_8h_a838003994d9f3319308f9f650cc2a083}{I2C\_SLV4\_DI}},\ data))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01420}01420\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01421}01421\ \ \ \ \ \textcolor{keywordflow}{return}\ \doxymbox{\hyperlink{classDevLab__ICM20948_aaa26fcbfea0e67d45cb1c3ae39654c55}{selectBank}}(0);}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01422}01422\ \}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01423}01423\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01424}\doxymbox{\hyperlink{classDevLab__ICM20948_a357d1315ecc5a649ac4ce6b31cb47e7a}{01424}}\ \textcolor{keywordtype}{bool}\ \doxymbox{\hyperlink{classDevLab__ICM20948_a357d1315ecc5a649ac4ce6b31cb47e7a}{DevLab\_ICM20948::auxRead12bit}}(uint16\_t\ \&raw)}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01425}01425\ \{}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01426}01426\ \ \ \ \ uint8\_t\ buf[2];}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01427}01427\ \ \ \ \ \textcolor{keywordflow}{if}\ (!\doxymbox{\hyperlink{classDevLab__ICM20948_a8f47c9f63642c35e5b5656e720667566}{auxReadSensorData}}(buf,\ 2))\ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01428}01428\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01429}01429\ \ \ \ \ \textcolor{comment}{//\ LSB\ primero\ (little-\/endian):\ buf[0]\ =\ byte\ bajo,\ buf[1]\ =\ byte\ alto}}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01430}01430\ \ \ \ \ raw\ =\ (uint16\_t)(buf[0]\ |\ (buf[1]\ <<\ 8))\ \&\ 0x0FFF;}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01431}01431\ }
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01432}01432\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{DevLab__ICM20948_8cpp_source_l01433}01433\ \}}

\end{DoxyCode}
