\doxysection{SPI\+\_\+\+Usage\+\_\+\+Example}
\hypertarget{_s_p_i__usage__example-example}{}\label{_s_p_i__usage__example-example}Пример использования SPI\+\_\+\+Base\+\_\+\+Init.

Пример использования SPI\+\_\+\+Base\+\_\+\+Init. Инициализация SPI1 с базовыми настройками\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{general__spi_8h}{general\_spi.h}}"{}}}
\DoxyCodeLine{}
\DoxyCodeLine{\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\_SettingsTypeDef}}\ mySPI;}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{void}\ SPI1\_Init(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\{}
\DoxyCodeLine{\ \ \ \ \textcolor{comment}{//\ Настройка\ SPI1}}
\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Instance\ =\ SPI1;}
\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.Mode\ =\ SPI\_MODE\_MASTER;}
\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.Direction\ =\ SPI\_DIRECTION\_2LINES;}
\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.DataSize\ =\ SPI\_DATASIZE\_8BIT;}
\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.CLKPolarity\ =\ SPI\_POLARITY\_LOW;}
\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.CLKPhase\ =\ SPI\_PHASE\_1EDGE;}
\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.NSS\ =\ SPI\_NSS\_SOFT;}
\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.BaudRatePrescaler\ =\ SPI\_BAUDRATEPRESCALER\_16;}
\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.FirstBit\ =\ SPI\_FIRSTBIT\_MSB;}
\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.TIMode\ =\ SPI\_TIMODE\_DISABLE;}
\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.CRCCalculation\ =\ SPI\_CRCCALCULATION\_DISABLE;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \textcolor{comment}{//\ Настройка\ GPIO\ для\ SPI}}
\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_a6a15d48eccf92959de3a086031fdc979}{CLK\_GPIOx}}\ =\ GPIOA;}
\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3bcb1ed12da3544e02e6d36493669bdc}{CLK\_PIN}}\ =\ GPIO\_PIN\_5;}
\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3f3748103a0b7861f6700042fd691ba1}{CLK\_GPIO\_AlternageFunc}}\ =\ GPIO\_AF5\_SPI1;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_a0d55a2941854f61934487f3d209cfa95}{MISO\_GPIOx}}\ =\ GPIOA;}
\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3366c654d7ec6dd41c6a0b504dc8509a}{MISO\_PIN}}\ =\ GPIO\_PIN\_6;}
\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_aecd7a5c6e205335b8ed229d74cd35d14}{MISO\_GPIO\_AlternageFunc}}\ =\ GPIO\_AF5\_SPI1;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_a0af3bdb273818ff97eb4ff3cff918820}{MOSI\_GPIOx}}\ =\ GPIOA;}
\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_a961208869faf4a7369aaf4edde75f176}{MOSI\_PIN}}\ =\ GPIO\_PIN\_7;}
\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_afbe75a1c36650a4a9b41fa706a4c7eab}{MOSI\_GPIO\_AlternageFunc}}\ =\ GPIO\_AF5\_SPI1;}
\DoxyCodeLine{}
\DoxyCodeLine{\ \ \ \ \textcolor{comment}{//\ Инициализация\ SPI}}
\DoxyCodeLine{\ \ \ \ \textcolor{keywordflow}{if}(\mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_ga0e177e3c57a8fcdc73b5602e72ec66ba}{SPI\_Base\_Init}}(\&mySPI)\ !=\ HAL\_OK)}
\DoxyCodeLine{\ \ \ \ \{}
\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{comment}{//\ Обработка\ ошибки}}
\DoxyCodeLine{\ \ \ \ \}}
\DoxyCodeLine{\}}

\end{DoxyCode}



\begin{DoxyCodeInclude}{0}

\end{DoxyCodeInclude}
 