STM32_ExtendedLibs/Doc/latex/____general__spi_8c_source.tex
Razvalyaev 9d720767b0 Доработал модуль TIM (с точки зрения документции. Код не проверен)
Доработна документация в целом
	- добавелн main page
	- исправлены ошибки в шапках и коментах
	- добавлен граф инклюдов
2025-10-19 11:55:12 +03:00

299 lines
37 KiB
TeX
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

\doxysection{\+\_\+\+\_\+general\+\_\+spi.\+c}
\hypertarget{____general__spi_8c_source}{}\label{____general__spi_8c_source}\index{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Src/\_\_general\_spi.c@{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Src/\_\_general\_spi.c}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00001}00001\ \textcolor{comment}{/**\ }}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00002}00002\ \textcolor{comment}{**************************************************************************}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00003}00003\ \textcolor{comment}{*\ @file\ general\_spi.c}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00004}00004\ \textcolor{comment}{*\ @brief\ Модуль\ для\ инициализации\ SPI.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00005}00005\ \textcolor{comment}{**************************************************************************}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00006}00006\ \textcolor{comment}{*\ @details}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00007}00007\ \textcolor{comment}{*}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00008}00008\ \textcolor{comment}{*\ Функции:}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00009}00009\ \textcolor{comment}{*\ \ \ -\/\ SPI\_Base\_Init\ \ \ \ \ \ \ \ \ \ \ \ \ Инициализация\ SPI\ }}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00010}00010\ \textcolor{comment}{*\ }}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00011}00011\ \textcolor{comment}{*\ Functions:\ spi\ initialize}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00012}00012\ \textcolor{comment}{*\ \ \ -\/\ SPI\_GPIO\_Init\ \ \ \ \ \ \ \ \ \ \ \ \ Инициализация\ GPIO\ для\ SPI}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00013}00013\ \textcolor{comment}{*\ \ \ -\/\ SPI\_DMA\_Init\ \ \ \ \ \ \ \ \ \ \ \ \ \ Инициализация\ DMA\ для\ SPI}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00014}00014\ \textcolor{comment}{*\ \ \ -\/\ SPI\_MspInit\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Аналог\ HAL\_MspInit\ для\ SPI}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00015}00015\ \textcolor{comment}{*\ \ \ -\/\ SPI\_MspDeInit\ \ \ \ \ \ \ \ \ \ \ \ \ Аналог\ HAL\_MspDeInit\ для\ SPI}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00016}00016\ \textcolor{comment}{*}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00017}00017\ \textcolor{comment}{*************************************************************************/}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00018}00018\ \textcolor{preprocessor}{\#include\ "{}general\_spi.h"{}}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00019}00019\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{general__gpio_8h}{general\_gpio.h}}"{}}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00020}00020\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00021}00021\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00022}00022\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/SPI\ INIT\ FUNCTIONS-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}\textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00023}00023\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00024}00024\ \textcolor{comment}{\ \ *\ @brief\ \ Initialize\ SPI\ with\ SPI\_SettingsTypeDef\ structure.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00025}00025\ \textcolor{comment}{\ \ *\ @param\ \ sspi\ -\/\ указатель\ на\ структуру\ с\ настройками\ SPI.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00026}00026\ \textcolor{comment}{\ \ *\ @return\ HAL\ status.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00027}00027\ \textcolor{comment}{\ \ *\ @note\ \ \ SPI\_SettingsTypeDef\ структура\ содержит\ хендл\ SPI\ и\ настройки\ перефирии\ (GPIO)}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00028}00028\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00029}00029\ HAL\_StatusTypeDef\ SPI\_Base\_Init(\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\_SettingsTypeDef}}\ *sspi)}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00030}00030\ \{\ \textcolor{comment}{//\ function\ takes\ setting\ structure\ for\ init}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00031}00031\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00032}00032\ \ \ \textcolor{comment}{//\ check\ is\ settings\ are\ valid}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00033}00033\ \ \ \textcolor{keywordflow}{if}(Check\_SPI\_Init\_Struct(sspi)\ !=\ HAL\_OK)}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00034}00034\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00035}00035\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00036}00036\ \ \ SPI\_MspInit(\&sspi-\/>hspi);\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00037}00037\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00038}00038\ \ \ \textcolor{keywordflow}{if}\ (HAL\_SPI\_Init(\&sspi-\/>hspi)\ !=\ HAL\_OK)}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00039}00039\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00040}00040\ \ \ \ \ \mbox{\hyperlink{group___e_r_r_o_r___h_a_n_d_l_e_r___d_e_f_i_n_e_s_gae110df81afd885a390bbeb152d7b709f}{MyLibs\_Error\_Handler}}();}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00041}00041\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00042}00042\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00043}00043\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00044}00044\ \ \ \textcolor{comment}{//\ init\ gpio\ from\ SPISettings\ structure}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00045}00045\ \ \ SPI\_GPIO\_Init(sspi);}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00046}00046\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00047}00047\ \textcolor{comment}{//\ \ //\ init\ dma\ from\ SPISettings\ structure\ if\ need}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00048}00048\ \textcolor{comment}{//\ \ if\ (sspi-\/>DMAChannel\ !=\ 0)}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00049}00049\ \textcolor{comment}{//\ \ \ \ SPI\_DMA\_Init(\&sspi-\/>hspi,\ sspi-\/>hspi.hdmarx,\ sspi-\/>DMAChannel,\ sspi-\/>DMA\_CHANNEL\_X);}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00050}00050\ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00051}00051\ \ \ \textcolor{keywordflow}{return}\ HAL\_OK;}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00052}00052\ \}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00053}00053\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00054}00054\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00055}00055\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00056}00056\ \textcolor{comment}{\ \ *\ @brief\ \ Initialize\ GPIO\ for\ SPI.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00057}00057\ \textcolor{comment}{\ \ *\ @param\ \ GPIOx\ \ \ \ \ \ \ -\/\ порт\ для\ настройки.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00058}00058\ \textcolor{comment}{\ \ *\ @param\ \ GPIO\_PIN\_RX\ -\/\ пин\ для\ настройки\ на\ прием.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00059}00059\ \textcolor{comment}{\ \ *\ @param\ \ GPIO\_PIN\_TX\ -\/\ пин\ для\ настройки\ на\ передачу.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00060}00060\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00061}00061\ \textcolor{keywordtype}{void}\ SPI\_GPIO\_Init(\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\_SettingsTypeDef}}\ *sspi)}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00062}00062\ \{\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00063}00063\ \ \ GPIO\_InitTypeDef\ GPIO\_InitStruct\ =\ \{0\};\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00064}00064\ \ \ \textcolor{comment}{//\ GPIO\ INIT\ \ }}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00065}00065\ \ \ \mbox{\hyperlink{group___m_y_l_i_b_s___g_p_i_o___g_e_n_e_r_a_l_ga962f010f783b81fcdd27eb6b53db28e6}{GPIO\_Clock\_Enable}}(sspi-\/>CLK\_GPIOx);}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00066}00066\ \ \ \mbox{\hyperlink{group___m_y_l_i_b_s___g_p_i_o___g_e_n_e_r_a_l_ga962f010f783b81fcdd27eb6b53db28e6}{GPIO\_Clock\_Enable}}(sspi-\/>MISO\_GPIOx);}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00067}00067\ \ \ \mbox{\hyperlink{group___m_y_l_i_b_s___g_p_i_o___g_e_n_e_r_a_l_ga962f010f783b81fcdd27eb6b53db28e6}{GPIO\_Clock\_Enable}}(sspi-\/>MOSI\_GPIOx);\ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00068}00068\ \ \ \ \ \textcolor{comment}{//\ CLK\ PIN\ INIT}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00069}00069\ \ \ GPIO\_InitStruct.Pin\ =\ sspi-\/>CLK\_PIN;}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00070}00070\ \ \ GPIO\_InitStruct.Alternate\ =\ sspi-\/>CLK\_GPIO\_AlternageFunc;}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00071}00071\ \ \ GPIO\_InitStruct.Mode\ =\ GPIO\_MODE\_AF\_PP;}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00072}00072\ \ \ GPIO\_InitStruct.Pull\ =\ GPIO\_NOPULL;}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00073}00073\ \ \ GPIO\_InitStruct.Speed\ =\ GPIO\_SPEED\_FREQ\_VERY\_HIGH;}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00074}00074\ \ \ HAL\_GPIO\_Init(sspi-\/>CLK\_GPIOx,\ \&GPIO\_InitStruct);}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00075}00075\ \ \ \textcolor{comment}{//\ MISO\ PIN\ INIT}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00076}00076\ \ \ GPIO\_InitStruct.Pin\ =\ sspi-\/>MISO\_PIN;}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00077}00077\ \ \ GPIO\_InitStruct.Alternate\ =\ sspi-\/>MISO\_GPIO\_AlternageFunc;}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00078}00078\ \ \ GPIO\_InitStruct.Mode\ =\ GPIO\_MODE\_AF\_PP;}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00079}00079\ \ \ GPIO\_InitStruct.Pull\ =\ GPIO\_NOPULL;}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00080}00080\ \ \ GPIO\_InitStruct.Speed\ =\ GPIO\_SPEED\_FREQ\_VERY\_HIGH;}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00081}00081\ \ \ HAL\_GPIO\_Init(sspi-\/>MISO\_GPIOx,\ \&GPIO\_InitStruct);}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00082}00082\ \ \ \textcolor{comment}{//\ MOSI\ PIN\ INIT}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00083}00083\ \ \ GPIO\_InitStruct.Pin\ =\ sspi-\/>MOSI\_PIN;}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00084}00084\ \ \ GPIO\_InitStruct.Alternate\ =\ sspi-\/>MOSI\_GPIO\_AlternageFunc;}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00085}00085\ \ \ GPIO\_InitStruct.Mode\ =\ GPIO\_MODE\_AF\_PP;}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00086}00086\ \ \ GPIO\_InitStruct.Pull\ =\ GPIO\_NOPULL;}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00087}00087\ \ \ GPIO\_InitStruct.Speed\ =\ GPIO\_SPEED\_FREQ\_VERY\_HIGH;}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00088}00088\ \ \ HAL\_GPIO\_Init(sspi-\/>MOSI\_GPIOx,\ \&GPIO\_InitStruct);}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00089}00089\ \}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00090}00090\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00091}00091\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00092}00092\ \textcolor{comment}{\ \ *\ @brief\ \ Initialize\ DMA\ for\ SPI.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00093}00093\ \textcolor{comment}{\ \ *\ @param\ \ hspi\ \ \ \ \ \ \ \ -\/\ указатель\ на\ хендл\ SPI\ для\ настройки\ DMA.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00094}00094\ \textcolor{comment}{\ \ *\ @param\ \ hdma\_rx\ \ \ \ \ \ \ -\/\ указатель\ на\ хендл\ DMA\ для\ линии\ приема\ SPI.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00095}00095\ \textcolor{comment}{\ \ *\ @param\ \ DMAChannel\ \ \ \ -\/\ указатель\ на\ канал\ DMA/поток\ DMA\ в\ STM32F407.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00096}00096\ \textcolor{comment}{\ \ *\ @param\ \ DMA\_CHANNEL\_X\ -\/\ канал\ DMA.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00097}00097\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00098}00098\ \textcolor{keywordtype}{void}\ SPI\_DMA\_Init(SPI\_HandleTypeDef\ *hspi,\ DMA\_HandleTypeDef\ *hdma\_rx,\ DMA\_Stream\_TypeDef\ *DMAChannel,\ uint32\_t\ DMA\_CHANNEL\_X)}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00099}00099\ \{\ \textcolor{comment}{//\ function\ takes\ spi\ and\ dma\ handlers\ and\ dmachannel\ for\ spi}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00100}00100\ \textcolor{comment}{//\ \ //\ for\ now\ only\ dma\ rx\ is\ supported,\ tx\ maybe\ later\ if\ needed}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00101}00101\ \textcolor{comment}{//\ \ \ \ //\ calc\ defines\ on\ boot\_project\_setup.h}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00102}00102\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00103}00103\ \textcolor{comment}{//\ \ /*\ SPI3\ DMA\ Init\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00104}00104\ \textcolor{comment}{//\ \ /*\ SPI3\_RX\ Init\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00105}00105\ \textcolor{comment}{//\ \ }}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00106}00106\ \textcolor{comment}{//\ \ hdma\_rx-\/>Instance\ =\ DMAChannel;}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00107}00107\ \textcolor{comment}{//\#if\ defined(STM32F407xx)\ //\ dma\ channel\ choose\ for\ 407}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00108}00108\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.Channel\ =\ DMA\_CHANNEL\_X;}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00109}00109\ \textcolor{comment}{//\#endif}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00110}00110\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.Direction\ =\ DMA\_PERIPH\_TO\_MEMORY;}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00111}00111\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.PeriphInc\ =\ DMA\_PINC\_DISABLE;}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00112}00112\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.MemInc\ =\ DMA\_MINC\_ENABLE;}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00113}00113\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.PeriphDataAlignment\ =\ DMA\_PDATAALIGN\_BYTE;}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00114}00114\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.MemDataAlignment\ =\ DMA\_MDATAALIGN\_BYTE;}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00115}00115\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.Mode\ =\ DMA\_CIRCULAR;}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00116}00116\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.Priority\ =\ DMA\_PRIORITY\_LOW;}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00117}00117\ \textcolor{comment}{//\ \ if\ (HAL\_DMA\_Init(hdma\_rx)\ !=\ HAL\_OK)}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00118}00118\ \textcolor{comment}{//\ \ \{}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00119}00119\ \textcolor{comment}{//\ \ \ \ MyLibs\_Error\_Handler();}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00120}00120\ \textcolor{comment}{//\ \ \}}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00121}00121\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00122}00122\ \textcolor{comment}{//\ \ \_\_USER\_LINKDMA(hspi,hdmarx,hdma\_rx);\ \ }}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00123}00123\ \textcolor{comment}{//\ \ }}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00124}00124\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00125}00125\ \textcolor{comment}{//\ \ //\ \_\_USER\_LINKDMA\ is\ need\ because\ \_\_HAL\_LINKDMA\ is\ written\ for\ global\ defined\ hdma\_rx}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00126}00126\ \textcolor{comment}{//\ \ //\ so\ you\ get\ error\ because\ hal\ uses\ .\ insted\ of\ -\/>}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00127}00127\ \}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00128}00128\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00129}00129\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00130}00130\ \textcolor{comment}{\ \ *\ @brief\ \ Initialize\ SPI\ \&\ DMA\ clock\ and\ interrupt.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00131}00131\ \textcolor{comment}{\ \ *\ @param\ \ hspi\ -\/\ указатель\ на\ хендл\ SPI\ для\ инициализации.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00132}00132\ \textcolor{comment}{\ \ *\ @note\ \ \ Чтобы\ не\ генерировать\ функцию\ с\ иницилизацией\ неиспользуемых\ SPI,}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00133}00133\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ дефайнами\ в\ general\_spi.h\ определяются\ используемые\ SPI.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00134}00134\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00135}00135\ \textcolor{keywordtype}{void}\ SPI\_MspInit(SPI\_HandleTypeDef\ *hspi)\ \textcolor{comment}{//\ analog\ for\ hal\ function}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00136}00136\ \{\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00137}00137\ \ \ \textcolor{comment}{//\ rcc,\ dma\ and\ interrupt\ init\ for\ SPIs}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00138}00138\ \ \ \textcolor{comment}{//\ GPIO\ init\ was\ moved\ to\ own\ functions\ SPI\_GPIO\_Init\ \ }}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00139}00139\ \ \ \textcolor{keywordflow}{if}(0);}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00140}00140\ \textcolor{preprocessor}{\#ifdef\ USE\_SPI1}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00141}00141\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(hspi-\/>Instance==SPI1)}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00142}00142\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00143}00143\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00144}00144\ \textcolor{comment}{//\ \ /*\ DMA2\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00145}00145\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA2\_CLK\_ENABLE();}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00146}00146\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00147}00147\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA2\_Stream2\_IRQn,\ 0,\ 0);}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00148}00148\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA2\_Stream2\_IRQn);}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00149}00149\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00150}00150\ \ \ \textcolor{comment}{/*\ SPI1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00151}00151\ \ \ \_\_HAL\_RCC\_SPI1\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00152}00152\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00153}00153\ \ \ \textcolor{comment}{/*\ SPI1\ interrupt\ Init\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00154}00154\ \ \ HAL\_NVIC\_SetPriority(SPI1\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00155}00155\ \ \ HAL\_NVIC\_EnableIRQ(SPI1\_IRQn);}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00156}00156\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00157}00157\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_SPI1}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00158}00158\ \textcolor{preprocessor}{\#ifdef\ USE\_SPI2}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00159}00159\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(hspi-\/>Instance==SPI2)}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00160}00160\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00161}00161\ \textcolor{comment}{//\ \ /*\ DMA1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00162}00162\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00163}00163\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00164}00164\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA1\_Stream5\_IRQn,\ 0,\ 0);}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00165}00165\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream5\_IRQn);}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00166}00166\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00167}00167\ \ \ \textcolor{comment}{/*\ SPI2\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00168}00168\ \ \ \_\_HAL\_RCC\_SPI2\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00169}00169\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00170}00170\ \ \ \textcolor{comment}{/*\ SPI2\ interrupt\ Init\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00171}00171\ \ \ HAL\_NVIC\_SetPriority(SPI2\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00172}00172\ \ \ HAL\_NVIC\_EnableIRQ(SPI2\_IRQn);}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00173}00173\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00174}00174\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_SPI2}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00175}00175\ \textcolor{preprocessor}{\#ifdef\ USE\_SPI3}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00176}00176\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(hspi-\/>Instance==SPI3)}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00177}00177\ \ \ \{\ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00178}00178\ \textcolor{comment}{//\ \ /*\ DMA1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00179}00179\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00180}00180\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00181}00181\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA1\_Stream1\_IRQn,\ 0,\ 0);}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00182}00182\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream1\_IRQn);}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00183}00183\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00184}00184\ \ \ \textcolor{comment}{/*\ SPI3\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00185}00185\ \ \ \_\_HAL\_RCC\_SPI3\_CLK\_ENABLE();\ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00186}00186\ \ \ \textcolor{comment}{/*\ SPI3\ interrupt\ Init\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00187}00187\ \ \ HAL\_NVIC\_SetPriority(SPI3\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00188}00188\ \ \ HAL\_NVIC\_EnableIRQ(SPI3\_IRQn);}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00189}00189\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00190}00190\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_SPI3}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00191}00191\ \}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00192}00192\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00193}00193\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00194}00194\ \textcolor{comment}{\ \ *\ @brief\ \ Deinitialize\ SPI\ \&\ DMA\ clock\ and\ interrupt.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00195}00195\ \textcolor{comment}{\ \ *\ @param\ \ hspi\ -\/\ указатель\ на\ хендл\ SPI\ для\ деинициализации.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00196}00196\ \textcolor{comment}{\ \ *\ @note\ \ \ Чтобы\ не\ генерировать\ функцию\ с\ деиницилизацией\ неиспользуемых\ SPI,}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00197}00197\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ дефайнами\ определяются\ используемые\ SPI.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00198}00198\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00199}00199\ \textcolor{keywordtype}{void}\ SPI\_MspDeInit(SPI\_HandleTypeDef\ *hspi)\ \textcolor{comment}{//\ analog\ for\ hal\ function}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00200}00200\ \{\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00201}00201\ \ \ \textcolor{comment}{//\ rcc,\ dma\ and\ interrupt\ init\ for\ SPIs}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00202}00202\ \ \ \textcolor{comment}{//\ GPIO\ init\ was\ moved\ to\ own\ functions\ SPI\_GPIO\_Init\ \ }}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00203}00203\ \ \ \textcolor{keywordflow}{if}(0);}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00204}00204\ \textcolor{preprocessor}{\#ifdef\ USE\_SPI1}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00205}00205\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(hspi-\/>Instance==SPI1)}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00206}00206\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00207}00207\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00208}00208\ \textcolor{comment}{//\ \ /*\ DMA2\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00209}00209\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA2\_CLK\_ENABLE();}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00210}00210\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00211}00211\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA2\_Stream2\_IRQn,\ 0,\ 0);}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00212}00212\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA2\_Stream2\_IRQn);}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00213}00213\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00214}00214\ \ \ \textcolor{comment}{/*\ SPI1\ clock\ reset\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00215}00215\ \ \ \_\_HAL\_RCC\_SPI1\_FORCE\_RESET();}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00216}00216\ \ \ \_\_HAL\_RCC\_SPI1\_RELEASE\_RESET();}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00217}00217\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00218}00218\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_SPI1}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00219}00219\ \textcolor{preprocessor}{\#ifdef\ USE\_SPI2}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00220}00220\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(hspi-\/>Instance==SPI2)}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00221}00221\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00222}00222\ \textcolor{comment}{//\ \ /*\ DMA1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00223}00223\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00224}00224\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00225}00225\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA1\_Stream5\_IRQn,\ 0,\ 0);}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00226}00226\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream5\_IRQn);}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00227}00227\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00228}00228\ \ \ \textcolor{comment}{/*\ SPI2\ clock\ reset\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00229}00229\ \ \ \_\_HAL\_RCC\_SPI2\_FORCE\_RESET();}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00230}00230\ \ \ \_\_HAL\_RCC\_SPI2\_RELEASE\_RESET();}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00231}00231\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00232}00232\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_SPI2}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00233}00233\ \textcolor{preprocessor}{\#ifdef\ USE\_SPI3}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00234}00234\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(hspi-\/>Instance==SPI3)}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00235}00235\ \ \ \{\ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00236}00236\ \textcolor{comment}{//\ \ /*\ DMA1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00237}00237\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00238}00238\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00239}00239\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA1\_Stream1\_IRQn,\ 0,\ 0);}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00240}00240\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream1\_IRQn);}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00241}00241\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00242}00242\ \ \ \textcolor{comment}{/*\ SPI3\ clock\ reset\ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00243}00243\ \ \ \_\_HAL\_RCC\_SPI3\_FORCE\_RESET();}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00244}00244\ \ \ \_\_HAL\_RCC\_SPI3\_RELEASE\_RESET();}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00245}00245\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00246}00246\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_SPI3}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00247}00247\ \}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00248}00248\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00249}00249\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00250}00250\ \textcolor{comment}{\ \ *\ @brief\ \ Check\ that\ spi\ init\ structure\ have\ correct\ values.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00251}00251\ \textcolor{comment}{\ \ *\ @param\ \ sspi\ -\/\ указатель\ на\ структуру\ с\ настройками\ SPI.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00252}00252\ \textcolor{comment}{\ \ *\ @return\ HAL\ status.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00253}00253\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00254}00254\ HAL\_StatusTypeDef\ Check\_SPI\_Init\_Struct(\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\_SettingsTypeDef}}\ *sspi)}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00255}00255\ \{}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00256}00256\ \ \ \textcolor{comment}{//\ check\ is\ settings\ are\ valid}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00257}00257\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_ALL\_INSTANCE(sspi-\/>hspi.Instance))}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00258}00258\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00259}00259\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00260}00260\ \ \ \textcolor{comment}{//\ check\ init\ settings}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00261}00261\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_MODE(sspi-\/>hspi.Init.Mode))}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00262}00262\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00263}00263\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_DIRECTION(sspi-\/>hspi.Init.Direction))}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00264}00264\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00265}00265\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_DATASIZE(sspi-\/>hspi.Init.DataSize))}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00266}00266\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00267}00267\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_BAUDRATE\_PRESCALER(sspi-\/>hspi.Init.BaudRatePrescaler))}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00268}00268\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00269}00269\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_CPOL(sspi-\/>hspi.Init.CLKPolarity))}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00270}00270\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00271}00271\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_CPHA(sspi-\/>hspi.Init.CLKPhase))}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00272}00272\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00273}00273\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_NSS(sspi-\/>hspi.Init.NSS))}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00274}00274\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00275}00275\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_FIRST\_BIT(sspi-\/>hspi.Init.FirstBit))}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00276}00276\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00277}00277\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_CRC\_CALCULATION(sspi-\/>hspi.Init.CRCCalculation))}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00278}00278\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00279}00279\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_CRC\_POLYNOMIAL(sspi-\/>hspi.Init.NSS)\ \&\&\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00280}00280\ \ \ \ \ (sspi-\/>hspi.Init.CRCCalculation\ !=\ SPI\_CRCCALCULATION\_DISABLE))}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00281}00281\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00282}00282\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_TIMODE(sspi-\/>hspi.Init.TIMode))}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00283}00283\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00284}00284\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00285}00285\ \ \ \textcolor{comment}{//\ check\ gpio}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00286}00286\ \ \ \textcolor{keywordflow}{if}\ (!IS\_GPIO\_ALL\_INSTANCE(sspi-\/>CLK\_GPIOx)\ ||\ !IS\_GPIO\_ALL\_INSTANCE(sspi-\/>MISO\_GPIOx)\ ||\ !IS\_GPIO\_ALL\_INSTANCE(sspi-\/>MOSI\_GPIOx))}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00287}00287\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00288}00288\ \ \ \textcolor{keywordflow}{if}\ (!IS\_GPIO\_PIN(sspi-\/>CLK\_PIN)\ \&\&\ !IS\_GPIO\_PIN(sspi-\/>MISO\_PIN)\ \&\&\ !IS\_GPIO\_PIN(sspi-\/>MOSI\_PIN))\ \textcolor{comment}{//\ if\ both\ pins\ arent\ set\ up}}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00289}00289\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00290}00290\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00291}00291\ \ \ \textcolor{keywordflow}{return}\ HAL\_OK;}
\DoxyCodeLine{\Hypertarget{____general__spi_8c_source_l00292}00292\ \}}
\end{DoxyCode}