\doxysection{\+\_\+\+\_\+general\+\_\+uart.\+c}
\hypertarget{____general__uart_8c_source}{}\label{____general__uart_8c_source}\index{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Src/\_\_general\_uart.c@{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Src/\_\_general\_uart.c}}

\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00001}00001\ \textcolor{comment}{/**\ }}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00002}00002\ \textcolor{comment}{\ \ **************************************************************************}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00003}00003\ \textcolor{comment}{\ \ *\ @file\ general\_uart.c}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00004}00004\ \textcolor{comment}{\ \ *\ @brief\ Модуль\ для\ инициализации\ UART.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00005}00005\ \textcolor{comment}{\ \ **************************************************************************}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00006}00006\ \textcolor{comment}{\ \ *\ //-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/Функции-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\///}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00007}00007\ \textcolor{comment}{\ \ *\ @verbatim}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00008}00008\ \textcolor{comment}{\ \ *\ Functions:\ users}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00009}00009\ \textcolor{comment}{\ \ *\ \ \ -\/\ UART\_Base\_Init\ \ \ \ \ \ \ \ \ \ \ \ \ \ Инициализация\ UART\ }}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00010}00010\ \textcolor{comment}{\ \ *\ }}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00011}00011\ \textcolor{comment}{\ \ *\ Functions:\ uart\ initialize}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00012}00012\ \textcolor{comment}{\ \ *\ \ \ -\/\ UART\_GPIO\_Init\ \ \ \ \ \ \ \ \ \ \ \ \ \ Инициализация\ GPIO\ для\ UART}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00013}00013\ \textcolor{comment}{\ \ *\ \ \ -\/\ UART\_DMA\_Init\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Инициализация\ DMA\ для\ UART}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00014}00014\ \textcolor{comment}{\ \ *\ \ \ -\/\ UART\_MspInit\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Аналог\ HAL\_MspInit\ для\ UART}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00015}00015\ \textcolor{comment}{\ \ *\ \ \ -\/\ UART\_MspDeInit\ \ \ \ \ \ \ \ \ \ \ \ \ \ Аналог\ HAL\_MspDeInit\ для\ UART}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00016}00016\ \textcolor{comment}{\ \ *\ @endverbatim}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00017}00017\ \textcolor{comment}{***************************************************************************/}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00018}00018\ \textcolor{preprocessor}{\#include\ "{}general\_uart.h"{}}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00019}00019\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{general__gpio_8h}{general\_gpio.h}}"{}}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00020}00020\ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00021}00021\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00022}00022\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/UART\ INIT\ FUNCTIONS-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}\textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00023}00023\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00024}00024\ \textcolor{comment}{\ \ *\ @brief\ \ Initialize\ UART\ with\ UART\_SettingsTypeDef\ structure.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00025}00025\ \textcolor{comment}{\ \ *\ @param\ \ suart\ -\/\ указатель\ на\ структуру\ с\ настройками\ UART.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00026}00026\ \textcolor{comment}{\ \ *\ @return\ HAL\ status.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00027}00027\ \textcolor{comment}{\ \ *\ @note\ \ \ Данная\ структура\ содержит\ хендл\ ЮАРТ\ и\ настройки\ перефирии\ (GPIO)}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00028}00028\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00029}00029\ HAL\_StatusTypeDef\ UART\_Base\_Init(\mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\_SettingsTypeDef}}\ *suart)}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00030}00030\ \{\ \textcolor{comment}{//\ function\ takes\ setting\ structure\ for\ init}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00031}00031\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00032}00032\ \ \ \textcolor{comment}{//\ check\ is\ settings\ are\ valid}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00033}00033\ \ \ \textcolor{keywordflow}{if}(Check\_UART\_Init\_Struct(suart)\ !=\ HAL\_OK)}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00034}00034\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00035}00035\ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00036}00036\ \ \ suart-\/>huart.Init.Mode\ =\ UART\_MODE\_TX\_RX;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00037}00037\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00038}00038\ \ \ UART\_MspInit(\&suart-\/>huart);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00039}00039\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00040}00040\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00041}00041\ \ \ \textcolor{keywordflow}{if}\ (HAL\_UART\_Init(\&suart-\/>huart)\ !=\ HAL\_OK)}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00042}00042\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00043}00043\ \ \ \ \ \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__uart_8c_source_l00044}00044\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00045}00045\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00046}00046\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00047}00047\ \ \ \textcolor{comment}{//\ init\ gpio\ from\ UARTSettings\ structure}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00048}00048\ \ \ UART\_GPIO\_Init(suart-\/>GPIOx,\ suart-\/>GPIO\_PIN\_RX,\ suart-\/>GPIO\_PIN\_TX);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00049}00049\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00050}00050\ \ \ \_\_HAL\_UART\_ENABLE\_IT(\&suart-\/>huart,\ UART\_IT\_IDLE);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00051}00051\ \ \ \textcolor{comment}{//\ init\ dma\ from\ UARTSettings\ structure\ if\ need}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00052}00052\ \ \ \textcolor{keywordflow}{if}\ (suart-\/>DMAChannel\ !=\ 0)}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00053}00053\ \ \ \ \ UART\_DMA\_Init(\&suart-\/>huart,\ suart-\/>huart.hdmarx,\ suart-\/>DMAChannel,\ suart-\/>DMA\_CHANNEL\_X);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00054}00054\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00055}00055\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00056}00056\ \ \ \textcolor{keywordflow}{return}\ HAL\_OK;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00057}00057\ \}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00058}00058\ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00059}00059\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00060}00060\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00061}00061\ \textcolor{comment}{\ \ *\ @brief\ \ Initialize\ GPIO\ for\ UART.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00062}00062\ \textcolor{comment}{\ \ *\ @param\ \ GPIOx\ \ \ \ \ \ \ -\/\ порт\ для\ настройки.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00063}00063\ \textcolor{comment}{\ \ *\ @param\ \ GPIO\_PIN\_RX\ -\/\ пин\ для\ настройки\ на\ прием.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00064}00064\ \textcolor{comment}{\ \ *\ @param\ \ GPIO\_PIN\_TX\ -\/\ пин\ для\ настройки\ на\ передачу.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00065}00065\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00066}00066\ \textcolor{keywordtype}{void}\ UART\_GPIO\_Init(GPIO\_TypeDef\ *GPIOx,\ uint16\_t\ GPIO\_PIN\_RX,\ uint16\_t\ GPIO\_PIN\_TX)}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00067}00067\ \{\ \textcolor{comment}{//\ function\ takes\ port\ and\ pins\ (for\ rx\ and\ tx)}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00068}00068\ \ \ GPIO\_InitTypeDef\ GPIO\_InitStruct\ =\ \{0\};}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00069}00069\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00070}00070\ \ \ \textcolor{comment}{//\ choose\ port\ for\ enable\ clock}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00071}00071\ \ \ \mbox{\hyperlink{group___m_y_l_i_b_s___g_p_i_o___g_e_n_e_r_a_l_ga962f010f783b81fcdd27eb6b53db28e6}{GPIO\_Clock\_Enable}}(GPIOx);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00072}00072\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00073}00073\ \ \ \textcolor{comment}{//USART3\ GPIO\ Configuration}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00074}00074\ \ \ \textcolor{comment}{//GPIO\_PIN\_TX\ -\/-\/-\/-\/-\/-\/>\ USART\_TX}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00075}00075\ \ \ \textcolor{comment}{//GPIO\_PIN\_RX\ -\/-\/-\/-\/-\/-\/>\ USART\_RX\ \ \ \ }}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00076}00076\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00077}00077\ \textcolor{preprocessor}{\#if\ defined(STM32F407xx)\ }\textcolor{comment}{//\ gpio\ init\ for\ 407}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00078}00078\ \ \ GPIO\_InitStruct.Pin\ =\ GPIO\_PIN\_TX|GPIO\_PIN\_RX;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00079}00079\ \ \ GPIO\_InitStruct.Mode\ =\ GPIO\_MODE\_AF\_PP;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00080}00080\ \ \ GPIO\_InitStruct.Pull\ =\ GPIO\_NOPULL;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00081}00081\ \ \ GPIO\_InitStruct.Speed\ =\ GPIO\_SPEED\_FREQ\_VERY\_HIGH;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00082}00082\ \ \ GPIO\_InitStruct.Alternate\ =\ GPIO\_AF7\_USART3;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00083}00083\ \ \ HAL\_GPIO\_Init(GPIOx,\ \&GPIO\_InitStruct);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00084}00084\ \textcolor{preprocessor}{\#elif\ defined(STM32F103xG)\ \ }\textcolor{comment}{//\ gpio\ init\ for\ atm403/stm103}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00085}00085\ \ \ \textcolor{comment}{//GPIO\_PIN\_TX\ -\/-\/-\/-\/-\/-\/>\ USART\_TX}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00086}00086\ \ \ GPIO\_InitStruct.Pin\ =\ GPIO\_PIN\_TX;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00087}00087\ \ \ GPIO\_InitStruct.Mode\ =\ GPIO\_MODE\_AF\_PP;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00088}00088\ \ \ GPIO\_InitStruct.Speed\ =\ GPIO\_SPEED\_FREQ\_HIGH;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00089}00089\ \ \ HAL\_GPIO\_Init(GPIOx,\ \&GPIO\_InitStruct);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00090}00090\ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00091}00091\ \textcolor{comment}{//\ \ GPIO\_PIN\_RX\ -\/-\/-\/-\/-\/-\/>\ USART\_RX\ \ }}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00092}00092\ \ \ GPIO\_InitStruct.Pin\ =\ GPIO\_PIN\_RX;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00093}00093\ \ \ GPIO\_InitStruct.Mode\ =\ GPIO\_MODE\_INPUT;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00094}00094\ \ \ GPIO\_InitStruct.Pull\ =\ GPIO\_NOPULL;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00095}00095\ \ \ HAL\_GPIO\_Init(GPIOx,\ \&GPIO\_InitStruct);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00096}00096\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00097}00097\ \}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00098}00098\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00099}00099\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00100}00100\ \textcolor{comment}{\ \ *\ @brief\ \ Initialize\ DMA\ for\ UART.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00101}00101\ \textcolor{comment}{\ \ *\ @param\ \ huart\ \ \ \ \ \ \ \ \ -\/\ указатель\ на\ хендл\ UART\ для\ настройки\ DMA.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00102}00102\ \textcolor{comment}{\ \ *\ @param\ \ hdma\_rx\ \ \ \ \ \ \ -\/\ указатель\ на\ хендл\ DMA\ для\ линии\ приема\ UART.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00103}00103\ \textcolor{comment}{\ \ *\ @param\ \ DMAChannel\ \ \ \ -\/\ указатель\ на\ канал\ DMA/поток\ DMA\ в\ STM32F407.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00104}00104\ \textcolor{comment}{\ \ *\ @param\ \ DMA\_CHANNEL\_X\ -\/\ канал\ DMA.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00105}00105\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00106}00106\ \textcolor{keywordtype}{void}\ UART\_DMA\_Init(UART\_HandleTypeDef\ *huart,\ DMA\_HandleTypeDef\ *hdma\_rx,\ DMA\_Stream\_TypeDef\ *DMAChannel,\ uint32\_t\ DMA\_CHANNEL\_X)}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00107}00107\ \{\ \textcolor{comment}{//\ function\ takes\ uart\ and\ dma\ handlers\ and\ dmachannel\ for\ uart}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00108}00108\ \ \ \textcolor{comment}{//\ for\ now\ only\ dma\ rx\ is\ supported,\ tx\ maybe\ later\ if\ needed}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00109}00109\ \ \ \ \ \textcolor{comment}{//\ calc\ defines\ on\ boot\_project\_setup.h}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00110}00110\ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00111}00111\ \ \ \textcolor{comment}{/*\ USART3\ DMA\ Init\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00112}00112\ \ \ \textcolor{comment}{/*\ USART3\_RX\ Init\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00113}00113\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00114}00114\ \ \ hdma\_rx-\/>Instance\ =\ DMAChannel;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00115}00115\ \textcolor{preprocessor}{\#if\ defined(STM32F407xx)\ }\textcolor{comment}{//\ dma\ channel\ choose\ for\ 407}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00116}00116\ \ \ hdma\_rx-\/>Init.Channel\ =\ DMA\_CHANNEL\_X;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00117}00117\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00118}00118\ \ \ hdma\_rx-\/>Init.Direction\ =\ DMA\_PERIPH\_TO\_MEMORY;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00119}00119\ \ \ hdma\_rx-\/>Init.PeriphInc\ =\ DMA\_PINC\_DISABLE;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00120}00120\ \ \ hdma\_rx-\/>Init.MemInc\ =\ DMA\_MINC\_ENABLE;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00121}00121\ \ \ hdma\_rx-\/>Init.PeriphDataAlignment\ =\ DMA\_PDATAALIGN\_BYTE;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00122}00122\ \ \ hdma\_rx-\/>Init.MemDataAlignment\ =\ DMA\_MDATAALIGN\_BYTE;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00123}00123\ \ \ hdma\_rx-\/>Init.Mode\ =\ DMA\_CIRCULAR;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00124}00124\ \ \ hdma\_rx-\/>Init.Priority\ =\ DMA\_PRIORITY\_LOW;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00125}00125\ \ \ \textcolor{keywordflow}{if}\ (HAL\_DMA\_Init(hdma\_rx)\ !=\ HAL\_OK)}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00126}00126\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00127}00127\ \ \ \ \ \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__uart_8c_source_l00128}00128\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00129}00129\ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00130}00130\ \ \ \_\_USER\_LINKDMA(huart,hdmarx,hdma\_rx);\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00131}00131\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00132}00132\ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00133}00133\ \ \ \textcolor{comment}{//\ \_\_USER\_LINKDMA\ is\ need\ because\ \_\_HAL\_LINKDMA\ is\ written\ for\ global\ defined\ hdma\_rx}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00134}00134\ \ \ \textcolor{comment}{//\ so\ you\ get\ error\ because\ hal\ uses\ .\ insted\ of\ -\/>}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00135}00135\ \}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00136}00136\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00137}00137\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00138}00138\ \textcolor{comment}{\ \ *\ @brief\ \ Initialize\ UART\ \&\ DMA\ clock\ and\ interrupt.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00139}00139\ \textcolor{comment}{\ \ *\ @param\ \ huart\ -\/\ указатель\ на\ хендл\ UART\ для\ инициализации.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00140}00140\ \textcolor{comment}{\ \ *\ @note\ \ \ Чтобы\ не\ генерировать\ функцию\ с\ иницилизацией\ неиспользуемых\ UART,}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00141}00141\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ дефайнами\ в\ rs\_message.h\ определяются\ используемые\ UART.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00142}00142\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00143}00143\ \textcolor{keywordtype}{void}\ UART\_MspInit(UART\_HandleTypeDef\ *huart)\ \textcolor{comment}{//\ analog\ for\ hal\ function}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00144}00144\ \{\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00145}00145\ \textcolor{comment}{//\ \ \_\_RCC\_DMA\_UART\_CLK\_ENABLE();}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00146}00146\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00147}00147\ \textcolor{comment}{//\ \ /*\ DMA1\_Stream1\_IRQn\ interrupt\ configuration\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00148}00148\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA\_UART\_IRQn,\ 0,\ 0);}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00149}00149\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA\_UART\_IRQn);}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00150}00150\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00151}00151\ \ \ \textcolor{comment}{//\ rcc,\ dma\ and\ interrupt\ init\ for\ USARTs}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00152}00152\ \ \ \textcolor{comment}{//\ GPIO\ init\ was\ moved\ to\ own\ functions\ UART\_GPIO\_Init\ \ }}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00153}00153\ \ \ \textcolor{keywordflow}{if}(0);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00154}00154\ \textcolor{preprocessor}{\#ifdef\ USE\_USART1}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00155}00155\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==USART1)}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00156}00156\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00157}00157\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00158}00158\ \ \ \textcolor{comment}{/*\ DMA2\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00159}00159\ \ \ \_\_HAL\_RCC\_DMA2\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00160}00160\ \ \ \textcolor{comment}{/*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00161}00161\ \ \ HAL\_NVIC\_SetPriority(DMA2\_Stream2\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00162}00162\ \ \ HAL\_NVIC\_EnableIRQ(DMA2\_Stream2\_IRQn);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00163}00163\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00164}00164\ \ \ \textcolor{comment}{/*\ USART1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00165}00165\ \ \ \_\_HAL\_RCC\_USART1\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00166}00166\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00167}00167\ \ \ \textcolor{comment}{/*\ USART1\ interrupt\ Init\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00168}00168\ \ \ HAL\_NVIC\_SetPriority(USART1\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00169}00169\ \ \ HAL\_NVIC\_EnableIRQ(USART1\_IRQn);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00170}00170\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00171}00171\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_USART1}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00172}00172\ \textcolor{preprocessor}{\#ifdef\ USE\_USART2}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00173}00173\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==USART2)}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00174}00174\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00175}00175\ \ \ \textcolor{comment}{/*\ DMA1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00176}00176\ \ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00177}00177\ \ \ \textcolor{comment}{/*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00178}00178\ \ \ HAL\_NVIC\_SetPriority(DMA1\_Stream5\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00179}00179\ \ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream5\_IRQn);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00180}00180\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00181}00181\ \ \ \textcolor{comment}{/*\ USART2\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00182}00182\ \ \ \_\_HAL\_RCC\_USART2\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00183}00183\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00184}00184\ \ \ \textcolor{comment}{/*\ USART2\ interrupt\ Init\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00185}00185\ \ \ HAL\_NVIC\_SetPriority(USART2\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00186}00186\ \ \ HAL\_NVIC\_EnableIRQ(USART2\_IRQn);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00187}00187\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00188}00188\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_USART2}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00189}00189\ \textcolor{preprocessor}{\#ifdef\ USE\_USART3}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00190}00190\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==USART3)}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00191}00191\ \ \ \{\ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00192}00192\ \ \ \textcolor{comment}{/*\ DMA1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00193}00193\ \ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00194}00194\ \ \ \textcolor{comment}{/*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00195}00195\ \ \ HAL\_NVIC\_SetPriority(DMA1\_Stream1\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00196}00196\ \ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream1\_IRQn);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00197}00197\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00198}00198\ \ \ \textcolor{comment}{/*\ USART3\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00199}00199\ \ \ \_\_HAL\_RCC\_USART3\_CLK\_ENABLE();\ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00200}00200\ \ \ \textcolor{comment}{/*\ USART3\ interrupt\ Init\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00201}00201\ \ \ HAL\_NVIC\_SetPriority(USART3\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00202}00202\ \ \ HAL\_NVIC\_EnableIRQ(USART3\_IRQn);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00203}00203\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00204}00204\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_USART3}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00205}00205\ \textcolor{preprocessor}{\#ifdef\ USE\_UART4}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00206}00206\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==UART4)}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00207}00207\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00208}00208\ \ \ \textcolor{comment}{/*\ DMA1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00209}00209\ \ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00210}00210\ \ \ \textcolor{comment}{/*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00211}00211\ \ \ HAL\_NVIC\_SetPriority(DMA1\_Stream2\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00212}00212\ \ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream2\_IRQn);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00213}00213\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00214}00214\ \ \ \textcolor{comment}{/*\ UART4\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00215}00215\ \ \ \_\_HAL\_RCC\_UART4\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00216}00216\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00217}00217\ \ \ \textcolor{comment}{/*\ UART4\ interrupt\ Init\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00218}00218\ \ \ HAL\_NVIC\_SetPriority(UART4\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00219}00219\ \ \ HAL\_NVIC\_EnableIRQ(UART4\_IRQn);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00220}00220\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00221}00221\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_UART4}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00222}00222\ \textcolor{preprocessor}{\#ifdef\ USE\_UART5}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00223}00223\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==UART5)}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00224}00224\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00225}00225\ \ \ \textcolor{comment}{/*\ DMA1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00226}00226\ \ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00227}00227\ \ \ \textcolor{comment}{/*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00228}00228\ \ \ HAL\_NVIC\_SetPriority(DMA1\_Stream0\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00229}00229\ \ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream0\_IRQn);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00230}00230\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00231}00231\ \ \ \textcolor{comment}{/*\ UART5\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00232}00232\ \ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00233}00233\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00234}00234\ \ \ \textcolor{comment}{/*\ UART5\ interrupt\ Init\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00235}00235\ \ \ HAL\_NVIC\_SetPriority(UART5\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00236}00236\ \ \ HAL\_NVIC\_EnableIRQ(UART5\_IRQn);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00237}00237\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00238}00238\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_UART5}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00239}00239\ \textcolor{preprocessor}{\#ifdef\ USE\_USART6}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00240}00240\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==USART6)}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00241}00241\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00242}00242\ \ \ \textcolor{comment}{/*\ DMA2\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00243}00243\ \ \ \_\_HAL\_RCC\_DMA2\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00244}00244\ \ \ \textcolor{comment}{/*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00245}00245\ \ \ HAL\_NVIC\_SetPriority(DMA2\_Stream1\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00246}00246\ \ \ HAL\_NVIC\_EnableIRQ(DMA2\_Stream1\_IRQn);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00247}00247\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00248}00248\ \ \ \textcolor{comment}{/*\ USART6\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00249}00249\ \ \ \_\_HAL\_RCC\_USART6\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00250}00250\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00251}00251\ \ \ \textcolor{comment}{/*\ USART6\ interrupt\ Init\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00252}00252\ \ \ HAL\_NVIC\_SetPriority(USART6\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00253}00253\ \ \ HAL\_NVIC\_EnableIRQ(USART6\_IRQn);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00254}00254\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00255}00255\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_USART6}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00256}00256\ \}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00257}00257\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00258}00258\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00259}00259\ \textcolor{comment}{\ \ *\ @brief\ \ Deinitialize\ UART\ \&\ DMA\ clock\ and\ interrupt.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00260}00260\ \textcolor{comment}{\ \ *\ @param\ \ huart\ -\/\ указатель\ на\ хендл\ UART\ для\ деинициализации.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00261}00261\ \textcolor{comment}{\ \ *\ @note\ \ \ Чтобы\ не\ генерировать\ функцию\ с\ деиницилизацией\ неиспользуемых\ UART,}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00262}00262\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ дефайнами\ определяются\ используемые\ UART.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00263}00263\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00264}00264\ \textcolor{keywordtype}{void}\ UART\_MspDeInit(UART\_HandleTypeDef\ *huart)\ \textcolor{comment}{//\ analog\ for\ hal\ function}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00265}00265\ \{\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00266}00266\ \ \ \textcolor{comment}{//\ rcc,\ dma\ and\ interrupt\ init\ for\ USARTs}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00267}00267\ \ \ \textcolor{comment}{//\ GPIO\ init\ was\ moved\ to\ own\ functions\ UART\_GPIO\_Init\ \ }}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00268}00268\ \ \ \textcolor{keywordflow}{if}(0);}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00269}00269\ \textcolor{preprocessor}{\#ifdef\ USE\_USART1}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00270}00270\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==USART1)}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00271}00271\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00272}00272\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00273}00273\ \textcolor{comment}{//\ \ /*\ DMA2\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00274}00274\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA2\_CLK\_ENABLE();}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00275}00275\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00276}00276\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA2\_Stream2\_IRQn,\ 0,\ 0);}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00277}00277\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA2\_Stream2\_IRQn);}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00278}00278\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00279}00279\ \ \ \textcolor{comment}{/*\ USART1\ clock\ reset\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00280}00280\ \ \ \_\_HAL\_RCC\_USART1\_FORCE\_RESET();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00281}00281\ \ \ \_\_HAL\_RCC\_USART1\_RELEASE\_RESET();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00282}00282\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00283}00283\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_USART1}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00284}00284\ \textcolor{preprocessor}{\#ifdef\ USE\_USART2}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00285}00285\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==USART2)}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00286}00286\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00287}00287\ \textcolor{comment}{//\ \ /*\ DMA1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00288}00288\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00289}00289\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00290}00290\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA1\_Stream5\_IRQn,\ 0,\ 0);}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00291}00291\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream5\_IRQn);}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00292}00292\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00293}00293\ \ \ \textcolor{comment}{/*\ USART2\ clock\ reset\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00294}00294\ \ \ \_\_HAL\_RCC\_USART2\_FORCE\_RESET();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00295}00295\ \ \ \_\_HAL\_RCC\_USART2\_RELEASE\_RESET();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00296}00296\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00297}00297\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_USART2}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00298}00298\ \textcolor{preprocessor}{\#ifdef\ USE\_USART3}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00299}00299\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==USART3)}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00300}00300\ \ \ \{\ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00301}00301\ \textcolor{comment}{//\ \ /*\ DMA1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00302}00302\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00303}00303\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00304}00304\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA1\_Stream1\_IRQn,\ 0,\ 0);}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00305}00305\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream1\_IRQn);}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00306}00306\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00307}00307\ \ \ \textcolor{comment}{/*\ USART3\ clock\ reset\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00308}00308\ \ \ \_\_HAL\_RCC\_USART3\_FORCE\_RESET();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00309}00309\ \ \ \_\_HAL\_RCC\_USART3\_RELEASE\_RESET();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00310}00310\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00311}00311\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_USART3}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00312}00312\ \textcolor{preprocessor}{\#ifdef\ USE\_UART4}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00313}00313\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==UART4)}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00314}00314\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00315}00315\ \textcolor{comment}{//\ \ /*\ DMA1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00316}00316\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00317}00317\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00318}00318\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA1\_Stream2\_IRQn,\ 0,\ 0);}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00319}00319\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream2\_IRQn);}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00320}00320\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00321}00321\ \ \ \textcolor{comment}{/*\ UART4\ clock\ reset\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00322}00322\ \ \ \_\_HAL\_RCC\_UART4\_FORCE\_RESET();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00323}00323\ \ \ \_\_HAL\_RCC\_UART4\_RELEASE\_RESET();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00324}00324\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00325}00325\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_UART4}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00326}00326\ \textcolor{preprocessor}{\#ifdef\ USE\_UART5}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00327}00327\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==UART5)}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00328}00328\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00329}00329\ \textcolor{comment}{//\ \ /*\ DMA1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00330}00330\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00331}00331\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00332}00332\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA1\_Stream0\_IRQn,\ 0,\ 0);}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00333}00333\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream0\_IRQn);}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00334}00334\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00335}00335\ \ \ \textcolor{comment}{/*\ UART5\ clock\ reset\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00336}00336\ \ \ \_\_HAL\_RCC\_UART5\_FORCE\_RESET();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00337}00337\ \ \ \_\_HAL\_RCC\_UART5\_RELEASE\_RESET();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00338}00338\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00339}00339\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_UART5}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00340}00340\ \textcolor{preprocessor}{\#ifdef\ USE\_USART6}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00341}00341\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==USART6)}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00342}00342\ \ \ \{}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00343}00343\ \textcolor{comment}{//\ \ /*\ DMA2\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00344}00344\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA2\_CLK\_ENABLE();}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00345}00345\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00346}00346\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA2\_Stream1\_IRQn,\ 0,\ 0);}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00347}00347\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA2\_Stream1\_IRQn);}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00348}00348\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00349}00349\ \ \ \textcolor{comment}{/*\ USART6\ clock\ reset\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00350}00350\ \ \ \_\_HAL\_RCC\_USART6\_FORCE\_RESET();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00351}00351\ \ \ \_\_HAL\_RCC\_USART6\_RELEASE\_RESET();}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00352}00352\ \ \ \}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00353}00353\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_USART6}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00354}00354\ \}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00355}00355\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00356}00356\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00357}00357\ \textcolor{comment}{\ \ *\ @brief\ \ Check\ that\ uart\ init\ structure\ have\ correct\ values.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00358}00358\ \textcolor{comment}{\ \ *\ @param\ \ suart\ -\/\ указатель\ на\ структуру\ с\ настройками\ UART.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00359}00359\ \textcolor{comment}{\ \ *\ @return\ HAL\ status.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00360}00360\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00361}00361\ HAL\_StatusTypeDef\ Check\_UART\_Init\_Struct(\mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\_SettingsTypeDef}}\ *suart)}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00362}00362\ \{}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00363}00363\ \ \ \textcolor{comment}{//\ check\ is\ settings\ are\ valid}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00364}00364\ \ \ \textcolor{keywordflow}{if}\ (!IS\_UART\_INSTANCE(suart-\/>huart.Instance))}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00365}00365\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00366}00366\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00367}00367\ \ \ \textcolor{keywordflow}{if}\ (!IS\_UART\_BAUDRATE(suart-\/>huart.Init.BaudRate)\ ||\ (suart-\/>huart.Init.BaudRate\ ==\ NULL))}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00368}00368\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00369}00369\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00370}00370\ \ \ \textcolor{keywordflow}{if}\ (!IS\_GPIO\_ALL\_INSTANCE(suart-\/>GPIOx))}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00371}00371\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00372}00372\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00373}00373\ \ \ \textcolor{keywordflow}{if}\ (!IS\_GPIO\_PIN(suart-\/>GPIO\_PIN\_RX)\ \&\&\ !IS\_GPIO\_PIN(suart-\/>GPIO\_PIN\_TX))\ \textcolor{comment}{//\ if\ both\ pins\ arent\ set\ up}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00374}00374\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00375}00375\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00376}00376\ \ \ \textcolor{keywordflow}{return}\ HAL\_OK;}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00377}00377\ \}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00378}00378\ }
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00379}00379\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/UART\ INIT\ FUNCTIONS-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{____general__uart_8c_source_l00380}00380\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}

\end{DoxyCode}
