\doxysection{7Semi\+\_\+\+SPI\+\_\+\+Interface.\+h}
\hypertarget{7Semi__SPI__Interface_8h_source}{}\label{7Semi__SPI__Interface_8h_source}\index{src/7Semi\_SPI\_Interface.h@{src/7Semi\_SPI\_Interface.h}}
\mbox{\hyperlink{7Semi__SPI__Interface_8h}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00001}00001\ \textcolor{preprocessor}{\#pragma\ once}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00002}00002\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{7Semi__Interface_8h}{7Semi\_Interface.h}}"{}}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00003}00003\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00004}00004\ \textcolor{comment}{/**}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00005}00005\ \textcolor{comment}{\ *\ 7Semi\ SPI\ Interface\ Implementation}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00006}00006\ \textcolor{comment}{\ */}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00007}\mbox{\hyperlink{classSPI__Interface}{00007}}\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classSPI__Interface}{SPI\_Interface}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{classInterface__7Semi}{Interface\_7Semi}}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00008}00008\ \{}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00009}00009\ }
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00010}00010\ \textcolor{keyword}{public}:}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00011}\mbox{\hyperlink{classSPI__Interface_a5e9372b9bbb05788a6147ee3fa38d799}{00011}}\ \ \ \ \ SPIClass\ *\mbox{\hyperlink{classSPI__Interface_a5e9372b9bbb05788a6147ee3fa38d799}{spi}}\ =\ \textcolor{keyword}{nullptr};}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00012}\mbox{\hyperlink{classSPI__Interface_a90f186288944e5595780219c7c3e8a17}{00012}}\ \ \ \ \ uint8\_t\ \mbox{\hyperlink{classSPI__Interface_a90f186288944e5595780219c7c3e8a17}{cs}}\ =\ 255;}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00013}\mbox{\hyperlink{classSPI__Interface_ad6aba961df73c0efc13421cb93e041c9}{00013}}\ \ \ \ \ uint32\_t\ \mbox{\hyperlink{classSPI__Interface_ad6aba961df73c0efc13421cb93e041c9}{speed}}\ =\ 1000000;}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00014}00014\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00015}00015\ \textcolor{comment}{\ \ \ \ /**}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00016}00016\ \textcolor{comment}{\ \ \ \ \ *\ beginSPI()}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00017}00017\ \textcolor{comment}{\ \ \ \ \ *}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00018}00018\ \textcolor{comment}{\ \ \ \ \ *\ -\/\ Initialize\ SPI\ interface}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00019}00019\ \textcolor{comment}{\ \ \ \ \ *\ -\/\ Configure\ CS\ and\ SPI\ bus}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00020}00020\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00021}\mbox{\hyperlink{classSPI__Interface_a24b5d68ff8da5578f56ee571d86ab289}{00021}}\ \ \ \ \ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{classSPI__Interface_a24b5d68ff8da5578f56ee571d86ab289}{beginSPI}}(uint8\_t\ csPin,}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00022}00022\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ SPIClass\ \&spiPort,}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00023}00023\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ uint32\_t\ spiSpeed,}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00024}00024\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ uint8\_t\ sck\ =\ 255,}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00025}00025\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ uint8\_t\ miso\ =\ 255,}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00026}00026\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ uint8\_t\ mosi\ =\ 255)\textcolor{keyword}{\ override}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00027}00027\ \textcolor{keyword}{\ \ \ \ }\{}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00028}00028\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (csPin\ ==\ 255)}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00029}00029\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00030}00030\ }
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00031}00031\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classSPI__Interface_a5e9372b9bbb05788a6147ee3fa38d799}{spi}}\ =\ \&spiPort;}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00032}00032\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classSPI__Interface_a90f186288944e5595780219c7c3e8a17}{cs}}\ =\ csPin;}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00033}00033\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classSPI__Interface_ad6aba961df73c0efc13421cb93e041c9}{speed}}\ =\ spiSpeed;}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00034}00034\ }
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00035}00035\ \ \ \ \ \ \ \ \ pinMode(\mbox{\hyperlink{classSPI__Interface_a90f186288944e5595780219c7c3e8a17}{cs}},\ OUTPUT);}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00036}00036\ \ \ \ \ \ \ \ \ digitalWrite(\mbox{\hyperlink{classSPI__Interface_a90f186288944e5595780219c7c3e8a17}{cs}},\ HIGH);}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00037}00037\ }
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00038}00038\ \textcolor{preprocessor}{\#if\ defined(ESP32)}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00039}00039\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (sck\ !=\ 255\ \&\&\ miso\ !=\ 255\ \&\&\ mosi\ !=\ 255)}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00040}00040\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classSPI__Interface_a5e9372b9bbb05788a6147ee3fa38d799}{spi}}-\/>begin(sck,\ miso,\ mosi,\ \mbox{\hyperlink{classSPI__Interface_a90f186288944e5595780219c7c3e8a17}{cs}});}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00041}00041\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00042}00042\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classSPI__Interface_a5e9372b9bbb05788a6147ee3fa38d799}{spi}}-\/>begin();}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00043}00043\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00044}00044\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classSPI__Interface_a5e9372b9bbb05788a6147ee3fa38d799}{spi}}-\/>begin();}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00045}00045\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00046}00046\ }
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00047}00047\ \ \ \ \ \ \ \ \ delay(1);}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00048}00048\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00049}00049\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00050}00050\ }
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00051}\mbox{\hyperlink{classSPI__Interface_a7235325c5823e1a8880a20686f23c021}{00051}}\ \ \ \ \ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{classSPI__Interface_a7235325c5823e1a8880a20686f23c021}{beginI2C}}(uint8\_t,\ TwoWire\ \&,\ uint32\_t,}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00052}00052\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ uint8\_t,\ uint8\_t)\textcolor{keyword}{\ override}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00053}00053\ \textcolor{keyword}{\ \ \ \ }\{}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00054}00054\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00055}00055\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00056}00056\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00057}00057\ \textcolor{comment}{\ \ \ \ /**}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00058}00058\ \textcolor{comment}{\ \ \ \ \ *\ read()}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00059}00059\ \textcolor{comment}{\ \ \ \ \ *}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00060}00060\ \textcolor{comment}{\ \ \ \ \ *\ -\/\ Read\ multiple\ bytes\ from\ register}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00061}00061\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00062}\mbox{\hyperlink{classSPI__Interface_a1f6007b741f717b88dab3bf727897040}{00062}}\ \ \ \ \ int8\_t\ \mbox{\hyperlink{classSPI__Interface_a1f6007b741f717b88dab3bf727897040}{read}}(uint8\_t\ reg,\ uint8\_t\ *data,\ uint32\_t\ len)\textcolor{keyword}{\ override}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00063}00063\ \textcolor{keyword}{\ \ \ \ }\{}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00064}00064\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!\mbox{\hyperlink{classSPI__Interface_a5e9372b9bbb05788a6147ee3fa38d799}{spi}}\ ||\ !data\ ||\ len\ ==\ 0)}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00065}00065\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00066}00066\ }
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00067}00067\ \ \ \ \ \ \ \ \ SPISettings\ settings(\mbox{\hyperlink{classSPI__Interface_ad6aba961df73c0efc13421cb93e041c9}{speed}},\ MSBFIRST,\ SPI\_MODE0);}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00068}00068\ }
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00069}00069\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classSPI__Interface_a5e9372b9bbb05788a6147ee3fa38d799}{spi}}-\/>beginTransaction(settings);}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00070}00070\ \ \ \ \ \ \ \ \ digitalWrite(\mbox{\hyperlink{classSPI__Interface_a90f186288944e5595780219c7c3e8a17}{cs}},\ LOW);}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00071}00071\ \ \ \ \ \ \ \ \ delayMicroseconds(10);}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00072}00072\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00073}00073\ \textcolor{comment}{\ \ \ \ \ \ \ \ /**}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00074}00074\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ *\ Send\ register\ address\ (read)}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00075}00075\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ */}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00076}00076\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classSPI__Interface_a5e9372b9bbb05788a6147ee3fa38d799}{spi}}-\/>transfer(reg\ |\ 0x80);}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00077}00077\ }
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00078}00078\ \ \ \ \ \ \ \ \ delayMicroseconds(10);}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00079}00079\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00080}00080\ \textcolor{comment}{\ \ \ \ \ \ \ \ /**}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00081}00081\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ *\ Read\ data}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00082}00082\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ */}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00083}00083\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (uint32\_t\ i\ =\ 0;\ i\ <\ len;\ i++)}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00084}00084\ \ \ \ \ \ \ \ \ \ \ \ \ data[i]\ =\ \mbox{\hyperlink{classSPI__Interface_a5e9372b9bbb05788a6147ee3fa38d799}{spi}}-\/>transfer(0x00);}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00085}00085\ }
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00086}00086\ \ \ \ \ \ \ \ \ digitalWrite(\mbox{\hyperlink{classSPI__Interface_a90f186288944e5595780219c7c3e8a17}{cs}},\ HIGH);}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00087}00087\ \ \ \ \ \ \ \ \ delayMicroseconds(10);}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00088}00088\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classSPI__Interface_a5e9372b9bbb05788a6147ee3fa38d799}{spi}}-\/>endTransaction();}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00089}00089\ }
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00090}00090\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Serial.print("{}R-\/Reg:\ "{});}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00091}00091\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Serial.print(reg,\ HEX);}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00092}00092\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Serial.print("{}\ |Data:\ "{});}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00093}00093\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ for\ (int\ i\ =\ 0;\ i\ <\ len;\ i++)}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00094}00094\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \{}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00095}00095\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ \ \ \ Serial.print("{}\ "{});}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00096}00096\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ \ \ \ Serial.print(data[i],\ HEX);}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00097}00097\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \}}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00098}00098\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Serial.println();}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00099}00099\ }
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00100}00100\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00101}00101\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00102}00102\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00103}00103\ \textcolor{comment}{\ \ \ \ /**}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00104}00104\ \textcolor{comment}{\ \ \ \ \ *\ write()}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00105}00105\ \textcolor{comment}{\ \ \ \ \ *}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00106}00106\ \textcolor{comment}{\ \ \ \ \ *\ -\/\ Write\ multiple\ bytes\ to\ register}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00107}00107\ \textcolor{comment}{\ \ \ \ \ */}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00108}\mbox{\hyperlink{classSPI__Interface_ae48d3d857131fc77c0f32c7ed24c28e1}{00108}}\ \ \ \ \ int8\_t\ \mbox{\hyperlink{classSPI__Interface_ae48d3d857131fc77c0f32c7ed24c28e1}{write}}(uint8\_t\ reg,\ \textcolor{keyword}{const}\ uint8\_t\ *data,\ uint32\_t\ len)\textcolor{keyword}{\ override}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00109}00109\ \textcolor{keyword}{\ \ \ \ }\{}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00110}00110\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (!\mbox{\hyperlink{classSPI__Interface_a5e9372b9bbb05788a6147ee3fa38d799}{spi}}\ ||\ !data\ ||\ len\ ==\ 0)}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00111}00111\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ -\/1;}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00112}00112\ }
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00113}00113\ \ \ \ \ \ \ \ \ SPISettings\ settings(\mbox{\hyperlink{classSPI__Interface_ad6aba961df73c0efc13421cb93e041c9}{speed}},\ MSBFIRST,\ SPI\_MODE0);}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00114}00114\ }
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00115}00115\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classSPI__Interface_a5e9372b9bbb05788a6147ee3fa38d799}{spi}}-\/>beginTransaction(settings);}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00116}00116\ \ \ \ \ \ \ \ \ digitalWrite(\mbox{\hyperlink{classSPI__Interface_a90f186288944e5595780219c7c3e8a17}{cs}},\ LOW);}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00117}00117\ \ \ \ \ \ \ \ \ delayMicroseconds(10);}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00118}00118\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00119}00119\ \textcolor{comment}{\ \ \ \ \ \ \ \ /**}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00120}00120\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ *\ Send\ register\ address\ (write)}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00121}00121\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ */}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00122}00122\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classSPI__Interface_a5e9372b9bbb05788a6147ee3fa38d799}{spi}}-\/>transfer(reg\ \&\ 0x7F);}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00123}00123\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00124}00124\ \textcolor{comment}{\ \ \ \ \ \ \ \ /**}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00125}00125\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ *\ Write\ data}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00126}00126\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ */}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00127}00127\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (uint32\_t\ i\ =\ 0;\ i\ <\ len;\ i++)}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00128}00128\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classSPI__Interface_a5e9372b9bbb05788a6147ee3fa38d799}{spi}}-\/>transfer(data[i]);}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00129}00129\ }
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00130}00130\ \ \ \ \ \ \ \ \ digitalWrite(\mbox{\hyperlink{classSPI__Interface_a90f186288944e5595780219c7c3e8a17}{cs}},\ HIGH);}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00131}00131\ \ \ \ \ \ \ \ \ delayMicroseconds(10);}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00132}00132\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classSPI__Interface_a5e9372b9bbb05788a6147ee3fa38d799}{spi}}-\/>endTransaction();}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00133}00133\ }
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00134}00134\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Serial.print("{}W-\/Reg:\ "{});}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00135}00135\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Serial.print(reg,\ HEX);}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00136}00136\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Serial.print("{}\ |Data:\ "{});}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00137}00137\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ for\ (int\ i\ =\ 0;\ i\ <\ len;\ i++)}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00138}00138\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \{}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00139}00139\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ \ \ \ Serial.print("{}\ "{});}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00140}00140\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ \ \ \ Serial.print(data[i],\ HEX);}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00141}00141\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \}}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00142}00142\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Serial.println();}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00143}00143\ }
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00144}00144\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00145}00145\ \ \ \ \ \}}
\DoxyCodeLine{\Hypertarget{7Semi__SPI__Interface_8h_source_l00146}00146\ \};}

\end{DoxyCode}
