291 lines
		
	
	
		
			39 KiB
		
	
	
	
		
			TeX
		
	
	
	
	
	
			
		
		
	
	
			291 lines
		
	
	
		
			39 KiB
		
	
	
	
		
			TeX
		
	
	
	
	
	
\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}}
 | 
						||
\mbox{\hyperlink{general__spi_8c}{Go to the documentation of this file.}}
 | 
						||
\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}{Реализация\ функций\ для\ работы\ с\ SPI:}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00007}00007\ \textcolor{comment}{\ \ -\/\ Инициализация\ SPI\ и\ его\ линий\ CLK/MISO/MOSI}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00008}00008\ \textcolor{comment}{\ \ -\/\ Настройка\ GPIO\ для\ SPI}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00009}00009\ \textcolor{comment}{\ \ -\/\ Настройка\ NVIC\ и\ тактирования\ SPI}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00010}00010\ \textcolor{comment}{**************************************************************************/}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00011}00011\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{general__spi_8h}{general\_spi.h}}"{}}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00012}00012\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{general__gpio_8h}{general\_gpio.h}}"{}}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00013}00013\ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00014}00014\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00015}00015\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/SPI\ INIT\ FUNCTIONS-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}\textcolor{comment}{}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00016}00016\ \textcolor{comment}{/**\ \ }}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00017}00017\ \textcolor{comment}{\ \ *\ @brief\ \ Инициализация\ SPI\ с\ помощью\ структуры\ SPI\_SettingsTypeDef.}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00018}00018\ \textcolor{comment}{\ \ *\ @param\ \ sspi\ Указатель\ на\ структуру\ с\ настройками\ SPI.}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00019}00019\ \textcolor{comment}{\ \ *\ @return\ HAL\ status.}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00020}00020\ \textcolor{comment}{\ \ *\ @details\ \ }}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00021}00021\ \textcolor{comment}{\ \ *\ Инициализирует\ SPI\ и\ его\ GPIO.}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00022}00022\ \textcolor{comment}{\ \ *\ Настройка\ аналогична\ HAL\_SPI\_Init\ }}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00023}00023\ \textcolor{comment}{\ \ *\ @code}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00024}00024\ \textcolor{comment}{\ \ *\ suart.hspi.Init...}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00025}00025\ \textcolor{comment}{\ \ *\ @endcode\ }}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00026}00026\ \textcolor{comment}{\ \ *\ но\ дополнительно\ надо\ прописать\ пины\ CLK/MISO/MOSI\ @ref\ SPI\_SettingsTypeDef}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00027}00027\ \textcolor{comment}{\ \ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00028}\mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_ga0e177e3c57a8fcdc73b5602e72ec66ba}{00028}}\ HAL\_StatusTypeDef\ \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_ga0e177e3c57a8fcdc73b5602e72ec66ba}{SPI\_Base\_Init}}(\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\_SettingsTypeDef}}\ *sspi)}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00029}00029\ \{\ \textcolor{comment}{//\ function\ takes\ setting\ structure\ for\ init}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00030}00030\ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00031}00031\ \ \ \textcolor{comment}{//\ check\ is\ settings\ are\ valid}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00032}00032\ \ \ \textcolor{keywordflow}{if}(\mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_ga333dd251bc878931086d48aa932b1a5f}{SPI\_Check\_Init\_Struct}}(sspi)\ !=\ HAL\_OK)}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00033}00033\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00034}00034\ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00035}00035\ \ \ \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_gab9f13318daf02bc5b5f302ae392dccac}{SPI\_MspInit}}(\&sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}});\ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00036}00036\ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00037}00037\ \ \ \textcolor{keywordflow}{if}\ (HAL\_SPI\_Init(\&sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}})\ !=\ HAL\_OK)}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00038}00038\ \ \ \{}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00039}00039\ \ \ \ \ \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_l00040}00040\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00041}00041\ \ \ \}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00042}00042\ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00043}00043\ \ \ \textcolor{comment}{//\ init\ gpio\ from\ SPISettings\ structure}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00044}00044\ \ \ \mbox{\hyperlink{general__spi_8c_ae80d21e5cab86571709a2619442733b5}{SPI\_GPIO\_Init}}(sspi);}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00045}00045\ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00046}00046\ \textcolor{comment}{//\ \ //\ init\ dma\ from\ SPISettings\ structure\ if\ need}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00047}00047\ \textcolor{comment}{//\ \ if\ (sspi-\/>DMAChannel\ !=\ 0)}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00048}00048\ \textcolor{comment}{//\ \ \ \ SPI\_DMA\_Init(\&sspi-\/>hspi,\ sspi-\/>hspi.hdmarx,\ sspi-\/>DMAChannel,\ sspi-\/>DMA\_CHANNEL\_X);}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00049}00049\ \ \ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00050}00050\ \ \ \textcolor{keywordflow}{return}\ HAL\_OK;}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00051}00051\ \}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00052}00052\ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00053}00053\ \textcolor{comment}{}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00054}00054\ \textcolor{comment}{/**\ \ }}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00055}00055\ \textcolor{comment}{\ \ *\ @brief\ \ Инициализация\ GPIO\ для\ SPI.}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00056}00056\ \textcolor{comment}{\ \ *\ @param\ \ sspi\ Указатель\ на\ структуру\ с\ настройками\ SPI.}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00057}00057\ \textcolor{comment}{\ \ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00058}\mbox{\hyperlink{general__spi_8c_ae80d21e5cab86571709a2619442733b5}{00058}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{general__spi_8c_ae80d21e5cab86571709a2619442733b5}{SPI\_GPIO\_Init}}(\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\_SettingsTypeDef}}\ *sspi)}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00059}00059\ \{\ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00060}00060\ \ \ GPIO\_InitTypeDef\ GPIO\_InitStruct\ =\ \{0\};\ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00061}00061\ \ \ \textcolor{comment}{//\ GPIO\ INIT\ \ }}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00062}00062\ \ \ \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-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a6a15d48eccf92959de3a086031fdc979}{CLK\_GPIOx}});}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00063}00063\ \ \ \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-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a0d55a2941854f61934487f3d209cfa95}{MISO\_GPIOx}});}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00064}00064\ \ \ \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-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a0af3bdb273818ff97eb4ff3cff918820}{MOSI\_GPIOx}});\ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00065}00065\ \ \ \ \ \textcolor{comment}{//\ CLK\ PIN\ INIT}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00066}00066\ \ \ GPIO\_InitStruct.Pin\ =\ sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3bcb1ed12da3544e02e6d36493669bdc}{CLK\_PIN}};}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00067}00067\ \ \ GPIO\_InitStruct.Alternate\ =\ sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3f3748103a0b7861f6700042fd691ba1}{CLK\_GPIO\_AlternageFunc}};}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00068}00068\ \ \ GPIO\_InitStruct.Mode\ =\ GPIO\_MODE\_AF\_PP;}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00069}00069\ \ \ GPIO\_InitStruct.Pull\ =\ GPIO\_NOPULL;}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00070}00070\ \ \ GPIO\_InitStruct.Speed\ =\ GPIO\_SPEED\_FREQ\_VERY\_HIGH;}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00071}00071\ \ \ HAL\_GPIO\_Init(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a6a15d48eccf92959de3a086031fdc979}{CLK\_GPIOx}},\ \&GPIO\_InitStruct);}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00072}00072\ \ \ \textcolor{comment}{//\ MISO\ PIN\ INIT}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00073}00073\ \ \ GPIO\_InitStruct.Pin\ =\ sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3366c654d7ec6dd41c6a0b504dc8509a}{MISO\_PIN}};}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00074}00074\ \ \ GPIO\_InitStruct.Alternate\ =\ sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_aecd7a5c6e205335b8ed229d74cd35d14}{MISO\_GPIO\_AlternageFunc}};}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00075}00075\ \ \ GPIO\_InitStruct.Mode\ =\ GPIO\_MODE\_AF\_PP;}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00076}00076\ \ \ GPIO\_InitStruct.Pull\ =\ GPIO\_NOPULL;}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00077}00077\ \ \ GPIO\_InitStruct.Speed\ =\ GPIO\_SPEED\_FREQ\_VERY\_HIGH;}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00078}00078\ \ \ HAL\_GPIO\_Init(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a0d55a2941854f61934487f3d209cfa95}{MISO\_GPIOx}},\ \&GPIO\_InitStruct);}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00079}00079\ \ \ \textcolor{comment}{//\ MOSI\ PIN\ INIT}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00080}00080\ \ \ GPIO\_InitStruct.Pin\ =\ sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a961208869faf4a7369aaf4edde75f176}{MOSI\_PIN}};}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00081}00081\ \ \ GPIO\_InitStruct.Alternate\ =\ sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_afbe75a1c36650a4a9b41fa706a4c7eab}{MOSI\_GPIO\_AlternageFunc}};}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00082}00082\ \ \ GPIO\_InitStruct.Mode\ =\ GPIO\_MODE\_AF\_PP;}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00083}00083\ \ \ GPIO\_InitStruct.Pull\ =\ GPIO\_NOPULL;}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00084}00084\ \ \ GPIO\_InitStruct.Speed\ =\ GPIO\_SPEED\_FREQ\_VERY\_HIGH;}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00085}00085\ \ \ HAL\_GPIO\_Init(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a0af3bdb273818ff97eb4ff3cff918820}{MOSI\_GPIOx}},\ \&GPIO\_InitStruct);}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00086}00086\ \}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00087}00087\ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00088}00088\ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00089}00089\ \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_l00090}00090\ \{\ \textcolor{comment}{//\ function\ takes\ spi\ and\ dma\ handlers\ and\ dmachannel\ for\ spi}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00091}00091\ \textcolor{comment}{//\ \ //\ for\ now\ only\ dma\ rx\ is\ supported,\ tx\ maybe\ later\ if\ needed}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00092}00092\ \textcolor{comment}{//\ \ \ \ //\ calc\ defines\ on\ boot\_project\_setup.h}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00093}00093\ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00094}00094\ \textcolor{comment}{//\ \ /*\ SPI3\ DMA\ Init\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00095}00095\ \textcolor{comment}{//\ \ /*\ SPI3\_RX\ Init\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00096}00096\ \textcolor{comment}{//\ \ }}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00097}00097\ \textcolor{comment}{//\ \ hdma\_rx-\/>Instance\ =\ DMAChannel;}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00098}00098\ \textcolor{comment}{//\#if\ defined(STM32F4xx)\ //\ dma\ channel\ choose\ for\ 407}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00099}00099\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.Channel\ =\ DMA\_CHANNEL\_X;}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00100}00100\ \textcolor{comment}{//\#endif}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00101}00101\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.Direction\ =\ DMA\_PERIPH\_TO\_MEMORY;}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00102}00102\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.PeriphInc\ =\ DMA\_PINC\_DISABLE;}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00103}00103\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.MemInc\ =\ DMA\_MINC\_ENABLE;}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00104}00104\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.PeriphDataAlignment\ =\ DMA\_PDATAALIGN\_BYTE;}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00105}00105\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.MemDataAlignment\ =\ DMA\_MDATAALIGN\_BYTE;}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00106}00106\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.Mode\ =\ DMA\_CIRCULAR;}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00107}00107\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.Priority\ =\ DMA\_PRIORITY\_LOW;}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00108}00108\ \textcolor{comment}{//\ \ if\ (HAL\_DMA\_Init(hdma\_rx)\ !=\ HAL\_OK)}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00109}00109\ \textcolor{comment}{//\ \ \{}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00110}00110\ \textcolor{comment}{//\ \ \ \ MyLibs\_Error\_Handler();}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00111}00111\ \textcolor{comment}{//\ \ \}}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00112}00112\ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00113}00113\ \textcolor{comment}{//\ \ \_\_USER\_LINKDMA(hspi,hdmarx,hdma\_rx);\ \ }}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00114}00114\ \textcolor{comment}{//\ \ }}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00115}00115\ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00116}00116\ \textcolor{comment}{//\ \ //\ \_\_USER\_LINKDMA\ is\ need\ because\ \_\_HAL\_LINKDMA\ is\ written\ for\ global\ defined\ hdma\_rx}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00117}00117\ \textcolor{comment}{//\ \ //\ so\ you\ get\ error\ because\ hal\ uses\ .\ insted\ of\ -\/>}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00118}00118\ \}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00119}00119\ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00120}00120\ \textcolor{comment}{}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00121}00121\ \textcolor{comment}{/**\ \ }}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00122}00122\ \textcolor{comment}{\ \ *\ @brief\ \ Настройка\ тактирования\ и\ прерываний\ SPI.}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00123}00123\ \textcolor{comment}{\ \ *\ @param\ \ hspi\ Указатель\ на\ хендл\ SPI.}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00124}00124\ \textcolor{comment}{\ \ *\ @note\ \ \ Чтобы\ не\ генерировать\ функцию\ с\ иницилизацией\ неиспользуемых\ SPI,}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00125}00125\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ дефайнами\ @ref\ SPI\_INIT\ в\ @ref\ general\_spi.h\ определяются\ используемые\ SPI.}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00126}00126\ \textcolor{comment}{\ \ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00127}\mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_gab9f13318daf02bc5b5f302ae392dccac}{00127}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_gab9f13318daf02bc5b5f302ae392dccac}{SPI\_MspInit}}(SPI\_HandleTypeDef\ *hspi)\ \textcolor{comment}{//\ analog\ for\ hal\ function}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00128}00128\ \{\ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00129}00129\ \ \ \textcolor{comment}{//\ rcc,\ dma\ and\ interrupt\ init\ for\ SPIs}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00130}00130\ \ \ \textcolor{comment}{//\ GPIO\ init\ was\ moved\ to\ own\ functions\ SPI\_GPIO\_Init\ \ }}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00131}00131\ \ \ \textcolor{keywordflow}{if}(0);}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00132}00132\ \textcolor{preprocessor}{\#ifdef\ USE\_SPI1}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00133}00133\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(hspi-\/>Instance==SPI1)}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00134}00134\ \ \ \{}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00135}00135\ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00136}00136\ \textcolor{comment}{//\ \ /*\ DMA2\ clock\ enable\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00137}00137\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA2\_CLK\_ENABLE();}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00138}00138\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00139}00139\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA2\_Stream2\_IRQn,\ 0,\ 0);}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00140}00140\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA2\_Stream2\_IRQn);}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00141}00141\ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00142}00142\ \ \ \textcolor{comment}{/*\ SPI1\ clock\ enable\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00143}00143\ \ \ \_\_HAL\_RCC\_SPI1\_CLK\_ENABLE();}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00144}00144\ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00145}00145\ \ \ \textcolor{comment}{/*\ SPI1\ interrupt\ Init\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00146}00146\ \ \ HAL\_NVIC\_SetPriority(SPI1\_IRQn,\ 0,\ 0);}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00147}00147\ \ \ HAL\_NVIC\_EnableIRQ(SPI1\_IRQn);}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00148}00148\ \ \ \}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00149}00149\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_SPI1}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00150}00150\ \textcolor{preprocessor}{\#ifdef\ USE\_SPI2}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00151}00151\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(hspi-\/>Instance==SPI2)}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00152}00152\ \ \ \{}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00153}00153\ \textcolor{comment}{//\ \ /*\ DMA1\ clock\ enable\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00154}00154\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00155}00155\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00156}00156\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA1\_Stream5\_IRQn,\ 0,\ 0);}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00157}00157\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream5\_IRQn);}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00158}00158\ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00159}00159\ \ \ \textcolor{comment}{/*\ SPI2\ clock\ enable\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00160}00160\ \ \ \_\_HAL\_RCC\_SPI2\_CLK\_ENABLE();}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00161}00161\ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00162}00162\ \ \ \textcolor{comment}{/*\ SPI2\ interrupt\ Init\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00163}00163\ \ \ HAL\_NVIC\_SetPriority(SPI2\_IRQn,\ 0,\ 0);}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00164}00164\ \ \ HAL\_NVIC\_EnableIRQ(SPI2\_IRQn);}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00165}00165\ \ \ \}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00166}00166\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_SPI2}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00167}00167\ \textcolor{preprocessor}{\#ifdef\ USE\_SPI3}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00168}00168\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(hspi-\/>Instance==SPI3)}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00169}00169\ \ \ \{\ \ \ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00170}00170\ \textcolor{comment}{//\ \ /*\ DMA1\ clock\ enable\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00171}00171\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00172}00172\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00173}00173\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA1\_Stream1\_IRQn,\ 0,\ 0);}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00174}00174\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream1\_IRQn);}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00175}00175\ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00176}00176\ \ \ \textcolor{comment}{/*\ SPI3\ clock\ enable\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00177}00177\ \ \ \_\_HAL\_RCC\_SPI3\_CLK\_ENABLE();\ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00178}00178\ \ \ \textcolor{comment}{/*\ SPI3\ interrupt\ Init\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00179}00179\ \ \ HAL\_NVIC\_SetPriority(SPI3\_IRQn,\ 0,\ 0);}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00180}00180\ \ \ HAL\_NVIC\_EnableIRQ(SPI3\_IRQn);}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00181}00181\ \ \ \}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00182}00182\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_SPI3}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00183}00183\ \}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00184}00184\ \textcolor{comment}{}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00185}00185\ \textcolor{comment}{/**\ \ }}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00186}00186\ \textcolor{comment}{\ \ *\ @brief\ \ Деинициализация\ тактирования\ и\ прерываний\ SPI.}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00187}00187\ \textcolor{comment}{\ \ *\ @param\ \ hspi\ Указатель\ на\ хендл\ SPI.}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00188}00188\ \textcolor{comment}{\ \ *\ @note\ \ \ Чтобы\ не\ генерировать\ функцию\ с\ иницилизацией\ неиспользуемых\ SPI,}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00189}00189\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ дефайнами\ @ref\ SPI\_INIT\ в\ @ref\ general\_spi.h\ определяются\ используемые\ SPI.}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00190}00190\ \textcolor{comment}{\ \ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00191}\mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_gac279cc3eaa35541edfe330a1844a85e4}{00191}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_gac279cc3eaa35541edfe330a1844a85e4}{SPI\_MspDeInit}}(SPI\_HandleTypeDef\ *hspi)\ \textcolor{comment}{//\ analog\ for\ hal\ function}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00192}00192\ \{\ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00193}00193\ \ \ \textcolor{comment}{//\ rcc,\ dma\ and\ interrupt\ init\ for\ SPIs}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00194}00194\ \ \ \textcolor{comment}{//\ GPIO\ init\ was\ moved\ to\ own\ functions\ SPI\_GPIO\_Init\ \ }}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00195}00195\ \ \ \textcolor{keywordflow}{if}(0);}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00196}00196\ \textcolor{preprocessor}{\#ifdef\ USE\_SPI1}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00197}00197\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(hspi-\/>Instance==SPI1)}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00198}00198\ \ \ \{}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00199}00199\ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00200}00200\ \textcolor{comment}{//\ \ /*\ DMA2\ clock\ enable\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00201}00201\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA2\_CLK\_ENABLE();}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00202}00202\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00203}00203\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA2\_Stream2\_IRQn,\ 0,\ 0);}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00204}00204\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA2\_Stream2\_IRQn);}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00205}00205\ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00206}00206\ \ \ \textcolor{comment}{/*\ SPI1\ clock\ reset\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00207}00207\ \ \ \_\_HAL\_RCC\_SPI1\_FORCE\_RESET();}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00208}00208\ \ \ \_\_HAL\_RCC\_SPI1\_RELEASE\_RESET();}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00209}00209\ \ \ \}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00210}00210\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_SPI1}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00211}00211\ \textcolor{preprocessor}{\#ifdef\ USE\_SPI2}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00212}00212\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(hspi-\/>Instance==SPI2)}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00213}00213\ \ \ \{}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00214}00214\ \textcolor{comment}{//\ \ /*\ DMA1\ clock\ enable\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00215}00215\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00216}00216\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00217}00217\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA1\_Stream5\_IRQn,\ 0,\ 0);}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00218}00218\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream5\_IRQn);}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00219}00219\ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00220}00220\ \ \ \textcolor{comment}{/*\ SPI2\ clock\ reset\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00221}00221\ \ \ \_\_HAL\_RCC\_SPI2\_FORCE\_RESET();}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00222}00222\ \ \ \_\_HAL\_RCC\_SPI2\_RELEASE\_RESET();}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00223}00223\ \ \ \}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00224}00224\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_SPI2}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00225}00225\ \textcolor{preprocessor}{\#ifdef\ USE\_SPI3}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00226}00226\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(hspi-\/>Instance==SPI3)}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00227}00227\ \ \ \{\ \ \ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00228}00228\ \textcolor{comment}{//\ \ /*\ DMA1\ clock\ enable\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00229}00229\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00230}00230\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00231}00231\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA1\_Stream1\_IRQn,\ 0,\ 0);}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00232}00232\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream1\_IRQn);}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00233}00233\ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00234}00234\ \ \ \textcolor{comment}{/*\ SPI3\ clock\ reset\ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00235}00235\ \ \ \_\_HAL\_RCC\_SPI3\_FORCE\_RESET();}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00236}00236\ \ \ \_\_HAL\_RCC\_SPI3\_RELEASE\_RESET();}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00237}00237\ \ \ \}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00238}00238\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_SPI3}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00239}00239\ \}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00240}00240\ \textcolor{comment}{}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00241}00241\ \textcolor{comment}{/**\ \ }}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00242}00242\ \textcolor{comment}{\ \ *\ @brief\ \ Проверка\ корректности\ структуры\ инициализации\ SPI.}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00243}00243\ \textcolor{comment}{\ \ *\ @param\ \ sspi\ Указатель\ на\ структуру\ с\ настройками\ SPI.}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00244}00244\ \textcolor{comment}{\ \ *\ @return\ HAL\ status.}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00245}00245\ \textcolor{comment}{\ \ */}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00246}\mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_ga333dd251bc878931086d48aa932b1a5f}{00246}}\ HAL\_StatusTypeDef\ \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_ga333dd251bc878931086d48aa932b1a5f}{SPI\_Check\_Init\_Struct}}(\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\_SettingsTypeDef}}\ *sspi)}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00247}00247\ \{}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00248}00248\ \ \ \textcolor{comment}{//\ check\ is\ settings\ are\ valid}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00249}00249\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_ALL\_INSTANCE(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Instance))}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00250}00250\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00251}00251\ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00252}00252\ \ \ \textcolor{comment}{//\ check\ init\ settings}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00253}00253\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_MODE(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.Mode))}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00254}00254\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00255}00255\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_DIRECTION(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.Direction))}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00256}00256\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00257}00257\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_DATASIZE(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.DataSize))}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00258}00258\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00259}00259\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_BAUDRATE\_PRESCALER(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.BaudRatePrescaler))}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00260}00260\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00261}00261\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_CPOL(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.CLKPolarity))}
 | 
						||
\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\_CPHA(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.CLKPhase))}
 | 
						||
\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\_NSS(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.NSS))}
 | 
						||
\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\_FIRST\_BIT(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.FirstBit))}
 | 
						||
\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\_CRC\_CALCULATION(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.CRCCalculation))}
 | 
						||
\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\_CRC\_POLYNOMIAL(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.NSS)\ \&\&\ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00272}00272\ \ \ \ \ (sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.CRCCalculation\ !=\ SPI\_CRCCALCULATION\_DISABLE))}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00273}00273\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00274}00274\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_TIMODE(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.TIMode))}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00275}00275\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00276}00276\ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00277}00277\ \ \ \textcolor{comment}{//\ check\ gpio}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00278}00278\ \ \ \textcolor{keywordflow}{if}\ (!IS\_GPIO\_ALL\_INSTANCE(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a6a15d48eccf92959de3a086031fdc979}{CLK\_GPIOx}})\ ||\ !IS\_GPIO\_ALL\_INSTANCE(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a0d55a2941854f61934487f3d209cfa95}{MISO\_GPIOx}})\ ||\ !IS\_GPIO\_ALL\_INSTANCE(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a0af3bdb273818ff97eb4ff3cff918820}{MOSI\_GPIOx}}))}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00279}00279\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00280}00280\ \ \ \textcolor{keywordflow}{if}\ (!IS\_GPIO\_PIN(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3bcb1ed12da3544e02e6d36493669bdc}{CLK\_PIN}})\ \&\&\ !IS\_GPIO\_PIN(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3366c654d7ec6dd41c6a0b504dc8509a}{MISO\_PIN}})\ \&\&\ !IS\_GPIO\_PIN(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a961208869faf4a7369aaf4edde75f176}{MOSI\_PIN}}))\ \textcolor{comment}{//\ if\ both\ pins\ arent\ set\ up}}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00281}00281\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00282}00282\ \ \ }
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00283}00283\ \ \ \textcolor{keywordflow}{return}\ HAL\_OK;}
 | 
						||
\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00284}00284\ \}}
 | 
						||
 | 
						||
\end{DoxyCode}
 |