\doxysection{general\+\_\+uart.\+c}
\hypertarget{general__uart_8c_source}{}\label{general__uart_8c_source}\index{E:/.WORK/STM32/STM\_Libs/STM32\_General/Src/general\_uart.c@{E:/.WORK/STM32/STM\_Libs/STM32\_General/Src/general\_uart.c}}
\mbox{\hyperlink{general__uart_8c}{Go to the documentation of this file.}}
\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}{Реализация\ функций\ для\ работы\ с\ UART:}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00007}00007\ \textcolor{comment}{\ \ -\/\ Инициализация\ UART\ и\ его\ линий\ RX/TX}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00008}00008\ \textcolor{comment}{\ \ -\/\ Настройка\ DMA\ для\ UART}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00009}00009\ \textcolor{comment}{\ \ -\/\ Настройка\ GPIO\ для\ UART}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00010}00010\ \textcolor{comment}{\ \ -\/\ Настройка\ NVIC\ и\ тактирования\ UART}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00011}00011\ \textcolor{comment}{*************************************************************************/}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00012}00012\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{general__uart_8h}{general\_uart.h}}"{}}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00013}00013\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{general__gpio_8h}{general\_gpio.h}}"{}}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00014}00014\ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00015}00015\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00016}00016\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/UART\ INIT\ FUNCTIONS-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}\textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00017}00017\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00018}00018\ \textcolor{comment}{\ \ *\ @brief\ \ Инициализация\ UART\ с\ помощью\ структуры\ UART\_SettingsTypeDef.}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00019}00019\ \textcolor{comment}{\ \ *\ @param\ \ suart\ Указатель\ на\ структуру\ с\ настройками\ UART.}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00020}00020\ \textcolor{comment}{\ \ *\ @return\ HAL\ status.}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00021}00021\ \textcolor{comment}{\ \ *\ @details\ \ }}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00022}00022\ \textcolor{comment}{\ \ *\ Инициализирует\ UART\ и\ его\ GPIO\ и\ при\ необходимости\ DMA.}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00023}00023\ \textcolor{comment}{\ \ *\ Настройка\ аналогична\ HAL\_UART\_Init\ }}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00024}00024\ \textcolor{comment}{\ \ *\ @code}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00025}00025\ \textcolor{comment}{\ \ *\ suart.huart.Init...}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00026}00026\ \textcolor{comment}{\ \ *\ @endcode\ }}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00027}00027\ \textcolor{comment}{\ \ *\ но\ дополнительно\ надо\ прописать\ пины\ RX/TX\ @ref\ UART\_SettingsTypeDef}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00028}00028\ \textcolor{comment}{\ \ *\ @code}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00029}00029\ \textcolor{comment}{\ \ *\ suart-\/>GPIOx,\ suart-\/>GPIO\_PIN\_RX,\ suart-\/>GPIO\_PIN\_TX}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00030}00030\ \textcolor{comment}{\ \ *\ @endcode}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00031}00031\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00032}\mbox{\hyperlink{group___g_e_n_e_r_a_l___u_a_r_t_gab9f07396b778505c934143e89953e154}{00032}}\ HAL\_StatusTypeDef\ \mbox{\hyperlink{group___g_e_n_e_r_a_l___u_a_r_t_gab9f07396b778505c934143e89953e154}{UART\_Base\_Init}}(\mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\_SettingsTypeDef}}\ *suart)}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00033}00033\ \{\ \textcolor{comment}{//\ function\ takes\ setting\ structure\ for\ init}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00034}00034\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00035}00035\ \ \ \textcolor{comment}{//\ check\ is\ settings\ are\ valid}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00036}00036\ \ \ \textcolor{keywordflow}{if}(\mbox{\hyperlink{group___g_e_n_e_r_a_l___u_a_r_t_ga2a22e46ecb9e04b2ce197a0e9c09044a}{UART\_Check\_Init\_Struct}}(suart)\ !=\ HAL\_OK)}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00037}00037\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00038}00038\ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00039}00039\ \ \ suart-\/>\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_accf2c9448a3ea8eb3b8c25a569276fea}{huart}}.Init.Mode\ =\ UART\_MODE\_TX\_RX;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00040}00040\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00041}00041\ \ \ \mbox{\hyperlink{group___g_e_n_e_r_a_l___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\_MspInit}}(\&suart-\/>\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_accf2c9448a3ea8eb3b8c25a569276fea}{huart}});}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00042}00042\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00043}00043\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00044}00044\ \ \ \textcolor{keywordflow}{if}\ (HAL\_UART\_Init(\&suart-\/>\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_accf2c9448a3ea8eb3b8c25a569276fea}{huart}})\ !=\ HAL\_OK)}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00045}00045\ \ \ \{}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00046}00046\ \ \ \ \ MyLibs\_Error\_Handler();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00047}00047\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00048}00048\ \ \ \}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00049}00049\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00050}00050\ \ \ \textcolor{comment}{//\ init\ gpio\ from\ UARTSettings\ structure}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00051}00051\ \ \ \mbox{\hyperlink{general__uart_8c_a3abae05bbde5f3b402bf18ca13dc6a0b}{UART\_GPIO\_Init}}(suart-\/>\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_af6f9910d065bae715cdb4a1024143a8f}{GPIOx}},\ suart-\/>\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_a3fba2b52788fe453348b5d92ed52ba49}{GPIO\_PIN\_RX}},\ suart-\/>\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_a5f1babfcfb436cd77f5614253c0a5bef}{GPIO\_PIN\_TX}});}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00052}00052\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00053}00053\ \ \ \_\_HAL\_UART\_ENABLE\_IT(\&suart-\/>\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_accf2c9448a3ea8eb3b8c25a569276fea}{huart}},\ UART\_IT\_IDLE);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00054}00054\ \ \ \textcolor{comment}{//\ init\ dma\ from\ UARTSettings\ structure\ if\ need}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00055}00055\ \ \ \textcolor{keywordflow}{if}\ (suart-\/>\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_a1ecc9ac6a1d2747ade56770cbab6a613}{DMAChannel}}\ !=\ 0)}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00056}00056\ \ \ \ \ \mbox{\hyperlink{general__uart_8c_ad82d0cbd19151675135fd75dad315d05}{UART\_DMA\_Init}}(\&suart-\/>\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_accf2c9448a3ea8eb3b8c25a569276fea}{huart}},\ suart-\/>\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_accf2c9448a3ea8eb3b8c25a569276fea}{huart}}.hdmarx,\ suart-\/>\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_a1ecc9ac6a1d2747ade56770cbab6a613}{DMAChannel}},\ suart-\/>\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_a15ce92b03f7f189bfbe1ab88a5f94d19}{DMA\_CHANNEL\_X}});}
\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{keywordflow}{return}\ HAL\_OK;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00060}00060\ \}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00061}00061\ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00062}00062\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00063}00063\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00064}00064\ \textcolor{comment}{\ \ *\ @brief\ \ Инициализация\ GPIO\ для\ UART.}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00065}00065\ \textcolor{comment}{\ \ *\ @param\ \ GPIOx\ \ \ \ \ \ \ Порт\ для\ настройки.}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00066}00066\ \textcolor{comment}{\ \ *\ @param\ \ GPIO\_PIN\_RX\ Пин\ для\ приема.}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00067}00067\ \textcolor{comment}{\ \ *\ @param\ \ GPIO\_PIN\_TX\ Пин\ для\ передачи.}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00068}00068\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00069}\mbox{\hyperlink{general__uart_8c_a3abae05bbde5f3b402bf18ca13dc6a0b}{00069}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{general__uart_8c_a3abae05bbde5f3b402bf18ca13dc6a0b}{UART\_GPIO\_Init}}(GPIO\_TypeDef\ *GPIOx,\ uint16\_t\ GPIO\_PIN\_RX,\ uint16\_t\ GPIO\_PIN\_TX)}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00070}00070\ \{\ \textcolor{comment}{//\ function\ takes\ port\ and\ pins\ (for\ rx\ and\ tx)}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00071}00071\ \ \ GPIO\_InitTypeDef\ GPIO\_InitStruct\ =\ \{0\};}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00072}00072\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00073}00073\ \ \ \textcolor{comment}{//\ choose\ port\ for\ enable\ clock}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00074}00074\ \ \ \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_l00075}00075\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00076}00076\ \ \ \textcolor{comment}{//USART3\ GPIO\ Configuration}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00077}00077\ \ \ \textcolor{comment}{//GPIO\_PIN\_TX\ -\/-\/-\/-\/-\/-\/>\ USART\_TX}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00078}00078\ \ \ \textcolor{comment}{//GPIO\_PIN\_RX\ -\/-\/-\/-\/-\/-\/>\ USART\_RX\ \ \ \ }}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00079}00079\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00080}00080\ \textcolor{preprocessor}{\#if\ defined(STM32F4xx)\ }\textcolor{comment}{//\ gpio\ init\ for\ 407}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00081}00081\ \ \ GPIO\_InitStruct.Pin\ =\ GPIO\_PIN\_TX|GPIO\_PIN\_RX;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00082}00082\ \ \ GPIO\_InitStruct.Mode\ =\ GPIO\_MODE\_AF\_PP;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00083}00083\ \ \ GPIO\_InitStruct.Pull\ =\ GPIO\_NOPULL;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00084}00084\ \ \ GPIO\_InitStruct.Speed\ =\ GPIO\_SPEED\_FREQ\_VERY\_HIGH;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00085}00085\ \ \ GPIO\_InitStruct.Alternate\ =\ GPIO\_AF7\_USART3;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00086}00086\ \ \ HAL\_GPIO\_Init(GPIOx,\ \&GPIO\_InitStruct);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00087}00087\ \textcolor{preprocessor}{\#elif\ defined(STM32F1xx)\ \ }\textcolor{comment}{//\ gpio\ init\ for\ atm403/stm103}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00088}00088\ \ \ \textcolor{comment}{//GPIO\_PIN\_TX\ -\/-\/-\/-\/-\/-\/>\ USART\_TX}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00089}00089\ \ \ GPIO\_InitStruct.Pin\ =\ GPIO\_PIN\_TX;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00090}00090\ \ \ GPIO\_InitStruct.Mode\ =\ GPIO\_MODE\_AF\_PP;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00091}00091\ \ \ GPIO\_InitStruct.Speed\ =\ GPIO\_SPEED\_FREQ\_HIGH;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00092}00092\ \ \ HAL\_GPIO\_Init(GPIOx,\ \&GPIO\_InitStruct);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00093}00093\ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00094}00094\ \textcolor{comment}{//\ \ GPIO\_PIN\_RX\ -\/-\/-\/-\/-\/-\/>\ USART\_RX\ \ }}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00095}00095\ \ \ GPIO\_InitStruct.Pin\ =\ GPIO\_PIN\_RX;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00096}00096\ \ \ GPIO\_InitStruct.Mode\ =\ GPIO\_MODE\_INPUT;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00097}00097\ \ \ GPIO\_InitStruct.Pull\ =\ GPIO\_NOPULL;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00098}00098\ \ \ HAL\_GPIO\_Init(GPIOx,\ \&GPIO\_InitStruct);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00099}00099\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00100}00100\ \}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00101}00101\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00102}00102\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00103}00103\ \textcolor{comment}{\ \ *\ @brief\ \ Инициализация\ DMA\ для\ UART.}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00104}00104\ \textcolor{comment}{\ \ *\ @param\ \ huart\ \ \ \ \ \ \ \ \ Указатель\ на\ хендл\ UART.}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00105}00105\ \textcolor{comment}{\ \ *\ @param\ \ hdma\_rx\ \ \ \ \ \ \ Указатель\ на\ хендл\ DMA\ для\ линии\ приема\ UART.}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00106}00106\ \textcolor{comment}{\ \ *\ @param\ \ DMAChannel\ \ \ \ Указатель\ на\ канал\ DMA/поток\ DMA\ в\ STM32F407.}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00107}00107\ \textcolor{comment}{\ \ *\ @param\ \ DMA\_CHANNEL\_X\ Канал\ DMA.}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00108}00108\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00109}\mbox{\hyperlink{general__uart_8c_ad82d0cbd19151675135fd75dad315d05}{00109}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{general__uart_8c_ad82d0cbd19151675135fd75dad315d05}{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_l00110}00110\ \{\ \textcolor{comment}{//\ function\ takes\ uart\ and\ dma\ handlers\ and\ dmachannel\ for\ uart}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00111}00111\ \ \ \textcolor{comment}{//\ for\ now\ only\ dma\ rx\ is\ supported,\ tx\ maybe\ later\ if\ needed}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00112}00112\ \ \ \ \ \textcolor{comment}{//\ calc\ defines\ on\ boot\_project\_setup.h}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00113}00113\ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00114}00114\ \ \ \textcolor{comment}{/*\ USART3\ DMA\ Init\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00115}00115\ \ \ \textcolor{comment}{/*\ USART3\_RX\ Init\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00116}00116\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00117}00117\ \ \ hdma\_rx-\/>Instance\ =\ DMAChannel;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00118}00118\ \textcolor{preprocessor}{\#if\ defined(STM32F4xx)\ }\textcolor{comment}{//\ dma\ channel\ choose\ for\ 407}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00119}00119\ \ \ hdma\_rx-\/>Init.Channel\ =\ DMA\_CHANNEL\_X;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00120}00120\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00121}00121\ \ \ hdma\_rx-\/>Init.Direction\ =\ DMA\_PERIPH\_TO\_MEMORY;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00122}00122\ \ \ hdma\_rx-\/>Init.PeriphInc\ =\ DMA\_PINC\_DISABLE;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00123}00123\ \ \ hdma\_rx-\/>Init.MemInc\ =\ DMA\_MINC\_ENABLE;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00124}00124\ \ \ hdma\_rx-\/>Init.PeriphDataAlignment\ =\ DMA\_PDATAALIGN\_BYTE;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00125}00125\ \ \ hdma\_rx-\/>Init.MemDataAlignment\ =\ DMA\_MDATAALIGN\_BYTE;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00126}00126\ \ \ hdma\_rx-\/>Init.Mode\ =\ DMA\_CIRCULAR;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00127}00127\ \ \ hdma\_rx-\/>Init.Priority\ =\ DMA\_PRIORITY\_LOW;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00128}00128\ \ \ \textcolor{keywordflow}{if}\ (HAL\_DMA\_Init(hdma\_rx)\ !=\ HAL\_OK)}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00129}00129\ \ \ \{}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00130}00130\ \ \ \ \ MyLibs\_Error\_Handler();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00131}00131\ \ \ \}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00132}00132\ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00133}00133\ \ \ \_\_USER\_LINKDMA(huart,hdmarx,hdma\_rx);\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00134}00134\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00135}00135\ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00136}00136\ \ \ \textcolor{comment}{//\ \_\_USER\_LINKDMA\ is\ need\ because\ \_\_HAL\_LINKDMA\ is\ written\ for\ global\ defined\ hdma\_rx}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00137}00137\ \ \ \textcolor{comment}{//\ so\ you\ get\ error\ because\ hal\ uses\ .\ insted\ of\ -\/>}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00138}00138\ \}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00139}00139\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00140}00140\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00141}00141\ \textcolor{comment}{\ \ *\ @brief\ \ Настройка\ тактирования\ и\ прерываний\ UART.}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00142}00142\ \textcolor{comment}{\ \ *\ @param\ \ huart\ Указатель\ на\ хендл\ UART.}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00143}00143\ \textcolor{comment}{\ \ *\ @note\ \ \ Чтобы\ не\ генерировать\ функцию\ с\ иницилизацией\ неиспользуемых\ UART,}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00144}00144\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ дефайнами\ @ref\ UART\_INIT\ в\ @ref\ general\_uart.h\ определяются\ используемые\ UART.}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00145}00145\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00146}\mbox{\hyperlink{group___g_e_n_e_r_a_l___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{00146}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___g_e_n_e_r_a_l___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\_MspInit}}(UART\_HandleTypeDef\ *huart)\ \textcolor{comment}{//\ analog\ for\ hal\ function}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00147}00147\ \{\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00148}00148\ \textcolor{comment}{//\ \ \_\_RCC\_DMA\_UART\_CLK\_ENABLE();}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00149}00149\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00150}00150\ \textcolor{comment}{//\ \ /*\ DMA1\_Stream1\_IRQn\ interrupt\ configuration\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00151}00151\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA\_UART\_IRQn,\ 0,\ 0);}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00152}00152\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA\_UART\_IRQn);}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00153}00153\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00154}00154\ \ \ \textcolor{comment}{//\ rcc,\ dma\ and\ interrupt\ init\ for\ USARTs}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00155}00155\ \ \ \textcolor{comment}{//\ GPIO\ init\ was\ moved\ to\ own\ functions\ UART\_GPIO\_Init\ \ }}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00156}00156\ \ \ \textcolor{keywordflow}{if}(0);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00157}00157\ \textcolor{preprocessor}{\#ifdef\ USE\_USART1}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00158}00158\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==USART1)}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00159}00159\ \ \ \{}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00160}00160\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00161}00161\ \ \ \textcolor{comment}{/*\ DMA2\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00162}00162\ \ \ \_\_HAL\_RCC\_DMA2\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00163}00163\ \ \ \textcolor{comment}{/*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00164}00164\ \ \ HAL\_NVIC\_SetPriority(DMA2\_Stream2\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00165}00165\ \ \ HAL\_NVIC\_EnableIRQ(DMA2\_Stream2\_IRQn);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00166}00166\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00167}00167\ \ \ \textcolor{comment}{/*\ USART1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00168}00168\ \ \ \_\_HAL\_RCC\_USART1\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00169}00169\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00170}00170\ \ \ \textcolor{comment}{/*\ USART1\ interrupt\ Init\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00171}00171\ \ \ HAL\_NVIC\_SetPriority(USART1\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00172}00172\ \ \ HAL\_NVIC\_EnableIRQ(USART1\_IRQn);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00173}00173\ \ \ \}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00174}00174\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_USART1}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00175}00175\ \textcolor{preprocessor}{\#ifdef\ USE\_USART2}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00176}00176\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==USART2)}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00177}00177\ \ \ \{}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00178}00178\ \ \ \textcolor{comment}{/*\ DMA1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00179}00179\ \ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00180}00180\ \ \ \textcolor{comment}{/*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00181}00181\ \ \ HAL\_NVIC\_SetPriority(DMA1\_Stream5\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00182}00182\ \ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream5\_IRQn);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00183}00183\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00184}00184\ \ \ \textcolor{comment}{/*\ USART2\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00185}00185\ \ \ \_\_HAL\_RCC\_USART2\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00186}00186\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00187}00187\ \ \ \textcolor{comment}{/*\ USART2\ interrupt\ Init\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00188}00188\ \ \ HAL\_NVIC\_SetPriority(USART2\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00189}00189\ \ \ HAL\_NVIC\_EnableIRQ(USART2\_IRQn);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00190}00190\ \ \ \}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00191}00191\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_USART2}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00192}00192\ \textcolor{preprocessor}{\#ifdef\ USE\_USART3}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00193}00193\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==USART3)}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00194}00194\ \ \ \{\ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00195}00195\ \ \ \textcolor{comment}{/*\ DMA1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00196}00196\ \ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00197}00197\ \ \ \textcolor{comment}{/*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00198}00198\ \ \ HAL\_NVIC\_SetPriority(DMA1\_Stream1\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00199}00199\ \ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream1\_IRQn);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00200}00200\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00201}00201\ \ \ \textcolor{comment}{/*\ USART3\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00202}00202\ \ \ \_\_HAL\_RCC\_USART3\_CLK\_ENABLE();\ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00203}00203\ \ \ \textcolor{comment}{/*\ USART3\ interrupt\ Init\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00204}00204\ \ \ HAL\_NVIC\_SetPriority(USART3\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00205}00205\ \ \ HAL\_NVIC\_EnableIRQ(USART3\_IRQn);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00206}00206\ \ \ \}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00207}00207\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_USART3}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00208}00208\ \textcolor{preprocessor}{\#ifdef\ USE\_UART4}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00209}00209\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==UART4)}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00210}00210\ \ \ \{}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00211}00211\ \ \ \textcolor{comment}{/*\ DMA1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00212}00212\ \ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00213}00213\ \ \ \textcolor{comment}{/*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00214}00214\ \ \ HAL\_NVIC\_SetPriority(DMA1\_Stream2\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00215}00215\ \ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream2\_IRQn);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00216}00216\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00217}00217\ \ \ \textcolor{comment}{/*\ UART4\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00218}00218\ \ \ \_\_HAL\_RCC\_UART4\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00219}00219\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00220}00220\ \ \ \textcolor{comment}{/*\ UART4\ interrupt\ Init\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00221}00221\ \ \ HAL\_NVIC\_SetPriority(UART4\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00222}00222\ \ \ HAL\_NVIC\_EnableIRQ(UART4\_IRQn);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00223}00223\ \ \ \}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00224}00224\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_UART4}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00225}00225\ \textcolor{preprocessor}{\#ifdef\ USE\_UART5}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00226}00226\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==UART5)}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00227}00227\ \ \ \{}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00228}00228\ \ \ \textcolor{comment}{/*\ DMA1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00229}00229\ \ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00230}00230\ \ \ \textcolor{comment}{/*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00231}00231\ \ \ HAL\_NVIC\_SetPriority(DMA1\_Stream0\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00232}00232\ \ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream0\_IRQn);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00233}00233\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00234}00234\ \ \ \textcolor{comment}{/*\ UART5\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00235}00235\ \ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00236}00236\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00237}00237\ \ \ \textcolor{comment}{/*\ UART5\ interrupt\ Init\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00238}00238\ \ \ HAL\_NVIC\_SetPriority(UART5\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00239}00239\ \ \ HAL\_NVIC\_EnableIRQ(UART5\_IRQn);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00240}00240\ \ \ \}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00241}00241\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_UART5}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00242}00242\ \textcolor{preprocessor}{\#ifdef\ USE\_USART6}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00243}00243\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==USART6)}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00244}00244\ \ \ \{}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00245}00245\ \ \ \textcolor{comment}{/*\ DMA2\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00246}00246\ \ \ \_\_HAL\_RCC\_DMA2\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00247}00247\ \ \ \textcolor{comment}{/*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00248}00248\ \ \ HAL\_NVIC\_SetPriority(DMA2\_Stream1\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00249}00249\ \ \ HAL\_NVIC\_EnableIRQ(DMA2\_Stream1\_IRQn);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00250}00250\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00251}00251\ \ \ \textcolor{comment}{/*\ USART6\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00252}00252\ \ \ \_\_HAL\_RCC\_USART6\_CLK\_ENABLE();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00253}00253\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00254}00254\ \ \ \textcolor{comment}{/*\ USART6\ interrupt\ Init\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00255}00255\ \ \ HAL\_NVIC\_SetPriority(USART6\_IRQn,\ 0,\ 0);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00256}00256\ \ \ HAL\_NVIC\_EnableIRQ(USART6\_IRQn);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00257}00257\ \ \ \}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00258}00258\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_USART6}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00259}00259\ \}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00260}00260\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00261}00261\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00262}00262\ \textcolor{comment}{\ \ *\ @brief\ \ Деинициализация\ тактирования\ и\ прерываний\ UART.}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00263}00263\ \textcolor{comment}{\ \ *\ @param\ \ huart\ Указатель\ на\ хендл\ UART.}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00264}00264\ \textcolor{comment}{\ \ *\ @note\ \ \ Чтобы\ не\ генерировать\ функцию\ с\ деиницилизацией\ неиспользуемых\ UART,}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00265}00265\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ дефайнами\ @ref\ UART\_INIT\ в\ @ref\ general\_uart.h\ определяются\ используемые\ UART.}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00266}00266\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00267}\mbox{\hyperlink{group___g_e_n_e_r_a_l___u_a_r_t_ga93ed6ceef4e3b5e7885786125cce93bc}{00267}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___g_e_n_e_r_a_l___u_a_r_t_ga93ed6ceef4e3b5e7885786125cce93bc}{UART\_MspDeInit}}(UART\_HandleTypeDef\ *huart)\ \textcolor{comment}{//\ analog\ for\ hal\ function}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00268}00268\ \{\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00269}00269\ \ \ \textcolor{comment}{//\ rcc,\ dma\ and\ interrupt\ init\ for\ USARTs}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00270}00270\ \ \ \textcolor{comment}{//\ GPIO\ init\ was\ moved\ to\ own\ functions\ UART\_GPIO\_Init\ \ }}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00271}00271\ \ \ \textcolor{keywordflow}{if}(0);}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00272}00272\ \textcolor{preprocessor}{\#ifdef\ USE\_USART1}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00273}00273\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==USART1)}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00274}00274\ \ \ \{}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00275}00275\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00276}00276\ \textcolor{comment}{//\ \ /*\ DMA2\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00277}00277\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA2\_CLK\_ENABLE();}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00278}00278\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00279}00279\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA2\_Stream2\_IRQn,\ 0,\ 0);}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00280}00280\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA2\_Stream2\_IRQn);}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00281}00281\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00282}00282\ \ \ \textcolor{comment}{/*\ USART1\ clock\ reset\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00283}00283\ \ \ \_\_HAL\_RCC\_USART1\_FORCE\_RESET();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00284}00284\ \ \ \_\_HAL\_RCC\_USART1\_RELEASE\_RESET();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00285}00285\ \ \ \}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00286}00286\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_USART1}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00287}00287\ \textcolor{preprocessor}{\#ifdef\ USE\_USART2}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00288}00288\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==USART2)}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00289}00289\ \ \ \{}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00290}00290\ \textcolor{comment}{//\ \ /*\ DMA1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00291}00291\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00292}00292\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00293}00293\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA1\_Stream5\_IRQn,\ 0,\ 0);}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00294}00294\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream5\_IRQn);}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00295}00295\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00296}00296\ \ \ \textcolor{comment}{/*\ USART2\ clock\ reset\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00297}00297\ \ \ \_\_HAL\_RCC\_USART2\_FORCE\_RESET();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00298}00298\ \ \ \_\_HAL\_RCC\_USART2\_RELEASE\_RESET();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00299}00299\ \ \ \}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00300}00300\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_USART2}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00301}00301\ \textcolor{preprocessor}{\#ifdef\ USE\_USART3}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00302}00302\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==USART3)}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00303}00303\ \ \ \{\ \ \ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00304}00304\ \textcolor{comment}{//\ \ /*\ DMA1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00305}00305\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00306}00306\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00307}00307\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA1\_Stream1\_IRQn,\ 0,\ 0);}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00308}00308\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream1\_IRQn);}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00309}00309\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00310}00310\ \ \ \textcolor{comment}{/*\ USART3\ clock\ reset\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00311}00311\ \ \ \_\_HAL\_RCC\_USART3\_FORCE\_RESET();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00312}00312\ \ \ \_\_HAL\_RCC\_USART3\_RELEASE\_RESET();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00313}00313\ \ \ \}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00314}00314\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_USART3}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00315}00315\ \textcolor{preprocessor}{\#ifdef\ USE\_UART4}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00316}00316\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==UART4)}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00317}00317\ \ \ \{}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00318}00318\ \textcolor{comment}{//\ \ /*\ DMA1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00319}00319\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00320}00320\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00321}00321\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA1\_Stream2\_IRQn,\ 0,\ 0);}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00322}00322\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream2\_IRQn);}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00323}00323\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00324}00324\ \ \ \textcolor{comment}{/*\ UART4\ clock\ reset\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00325}00325\ \ \ \_\_HAL\_RCC\_UART4\_FORCE\_RESET();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00326}00326\ \ \ \_\_HAL\_RCC\_UART4\_RELEASE\_RESET();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00327}00327\ \ \ \}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00328}00328\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_UART4}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00329}00329\ \textcolor{preprocessor}{\#ifdef\ USE\_UART5}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00330}00330\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==UART5)}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00331}00331\ \ \ \{}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00332}00332\ \textcolor{comment}{//\ \ /*\ DMA1\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00333}00333\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00334}00334\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00335}00335\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA1\_Stream0\_IRQn,\ 0,\ 0);}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00336}00336\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream0\_IRQn);}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00337}00337\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00338}00338\ \ \ \textcolor{comment}{/*\ UART5\ clock\ reset\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00339}00339\ \ \ \_\_HAL\_RCC\_UART5\_FORCE\_RESET();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00340}00340\ \ \ \_\_HAL\_RCC\_UART5\_RELEASE\_RESET();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00341}00341\ \ \ \}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00342}00342\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_UART5}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00343}00343\ \textcolor{preprocessor}{\#ifdef\ USE\_USART6}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00344}00344\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(huart-\/>Instance==USART6)}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00345}00345\ \ \ \{}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00346}00346\ \textcolor{comment}{//\ \ /*\ DMA2\ clock\ enable\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00347}00347\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA2\_CLK\_ENABLE();}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00348}00348\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00349}00349\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA2\_Stream1\_IRQn,\ 0,\ 0);}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00350}00350\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA2\_Stream1\_IRQn);}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00351}00351\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00352}00352\ \ \ \textcolor{comment}{/*\ USART6\ clock\ reset\ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00353}00353\ \ \ \_\_HAL\_RCC\_USART6\_FORCE\_RESET();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00354}00354\ \ \ \_\_HAL\_RCC\_USART6\_RELEASE\_RESET();}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00355}00355\ \ \ \}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00356}00356\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_USART6}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00357}00357\ \}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00358}00358\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00359}00359\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00360}00360\ \textcolor{comment}{\ \ *\ @brief\ \ Проверка\ корректности\ структуры\ инициализации\ UART.}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00361}00361\ \textcolor{comment}{\ \ *\ @param\ \ suart\ Указатель\ на\ структуру\ с\ настройками\ UART.}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00362}00362\ \textcolor{comment}{\ \ *\ @return\ HAL\ status.}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00363}00363\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00364}\mbox{\hyperlink{group___g_e_n_e_r_a_l___u_a_r_t_ga2a22e46ecb9e04b2ce197a0e9c09044a}{00364}}\ HAL\_StatusTypeDef\ \mbox{\hyperlink{group___g_e_n_e_r_a_l___u_a_r_t_ga2a22e46ecb9e04b2ce197a0e9c09044a}{UART\_Check\_Init\_Struct}}(\mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\_SettingsTypeDef}}\ *suart)}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00365}00365\ \{}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00366}00366\ \ \ \textcolor{comment}{//\ check\ is\ settings\ are\ valid}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00367}00367\ \ \ \textcolor{keywordflow}{if}\ (!IS\_UART\_INSTANCE(suart-\/>\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_accf2c9448a3ea8eb3b8c25a569276fea}{huart}}.Instance))}
\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\_UART\_BAUDRATE(suart-\/>\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_accf2c9448a3ea8eb3b8c25a569276fea}{huart}}.Init.BaudRate)\ ||\ (suart-\/>\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_accf2c9448a3ea8eb3b8c25a569276fea}{huart}}.Init.BaudRate\ ==\ NULL))}
\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\_ALL\_INSTANCE(suart-\/>\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_af6f9910d065bae715cdb4a1024143a8f}{GPIOx}}))}
\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}{if}\ (!IS\_GPIO\_PIN(suart-\/>\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_a3fba2b52788fe453348b5d92ed52ba49}{GPIO\_PIN\_RX}})\ \&\&\ !IS\_GPIO\_PIN(suart-\/>\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_a5f1babfcfb436cd77f5614253c0a5bef}{GPIO\_PIN\_TX}}))\ \textcolor{comment}{//\ if\ both\ pins\ arent\ set\ up}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00377}00377\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00378}00378\ \ \ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00379}00379\ \ \ \textcolor{keywordflow}{return}\ HAL\_OK;}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00380}00380\ \}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00381}00381\ }
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00382}00382\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/UART\ INIT\ FUNCTIONS-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{general__uart_8c_source_l00383}00383\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}

\end{DoxyCode}
