\doxysection{\+\_\+\+\_\+general\+\_\+uart.\+h}
\hypertarget{____general__uart_8h_source}{}\label{____general__uart_8h_source}\index{F:/Work/Projects/STM/.Elementary/STM32\_ExtendedLibs/MyLibsGeneral/Inc/\_\_general\_uart.h@{F:/Work/Projects/STM/.Elementary/STM32\_ExtendedLibs/MyLibsGeneral/Inc/\_\_general\_uart.h}}

\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00001}00001\ \textcolor{comment}{/**\ }}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00002}00002\ \textcolor{comment}{**************************************************************************}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00003}00003\ \textcolor{comment}{*\ @file\ general\_uart.h}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00004}00004\ \textcolor{comment}{*\ @brief\ Заголовочный\ файл\ для\ модуля\ инициализации\ UART.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00005}00005\ \textcolor{comment}{*************************************************************************/}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00006}00006\ \textcolor{preprocessor}{\#ifndef\ \_\_UART\_GENERAL\_H\_}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00007}00007\ \textcolor{preprocessor}{\#define\ \_\_UART\_GENERAL\_H\_}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00008}00008\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00009}00009\ \textcolor{comment}{//////////////////////////////////////////////////////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00010}00010\ \textcolor{comment}{/////////////////////////-\/-\/-\/USER\ SETTINGS-\/-\/-\//////////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00011}00011\ \textcolor{comment}{}\textcolor{preprocessor}{\#define\ HAL\_UART\_MODULE\_ENABLED\ \ \ }\textcolor{comment}{//\ need\ to\ uncomment\ these\ defines\ in\ stm32f4xx\_hal\_conf.h}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00012}00012\ \textcolor{comment}{//\#define\ HAL\_USART\_MODULE\_ENABLED\ \ //\ maybe\ also\ need\ to\ add\ hal\_uart.h/.c\ (source\ code)}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00013}00013\ }
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00014}00014\ \textcolor{comment}{//\#define\ USE\_USART1}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00015}00015\ \textcolor{comment}{//\#define\ USE\_USART2}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00016}00016\ \textcolor{comment}{//\#define\ USE\_USART3}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00017}00017\ \textcolor{comment}{//\#define\ USE\_UART4}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00018}00018\ \textcolor{comment}{//\#define\ USE\_UART5}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00019}00019\ \textcolor{comment}{//\#define\ USE\_USART6}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00020}00020\ \textcolor{comment}{/*\ note:\ used\ uart\ defines\ in\ modbus.h\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00021}00021\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00022}00022\ \textcolor{comment}{/////////////////////////-\/-\/-\/USER\ SETTINGS-\/-\/-\//////////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00023}00023\ \textcolor{comment}{}\textcolor{preprocessor}{\#include\ "{}interface\_config.h"{}}\ \textcolor{comment}{/*\ used\ uart\ defines\ in\ modbus.h\ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00024}00024\ }
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00025}00025\ }
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00026}00026\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00027}00027\ \textcolor{comment}{/////////////////////////////////////////////////////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00028}00028\ \textcolor{comment}{////////////////////////////-\/-\/-\/DEFINES-\/-\/-\/////////////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00029}00029\ \textcolor{comment}{}\textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{mylibs__defs_8h}{mylibs\_defs.h}}"{}}\textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00030}00030\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00031}00031\ \textcolor{comment}{\ \ *\ @brief\ \ Analog\ for\ HAL\ define.\ Remade\ with\ pointer\ to\ structure.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00032}00032\ \textcolor{comment}{\ \ *\ @note\ \ \ @ref\ \_\_HAL\_LINKDMA.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00033}00033\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00034}00034\ \textcolor{preprocessor}{\#define\ \_\_USER\_LINKDMA(\_\_HANDLE\_\_,\ \_\_PPP\_DMA\_FIELD\_\_,\ \_\_DMA\_HANDLE\_\_)\ \ \ \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00035}00035\ \textcolor{preprocessor}{do\{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00036}00036\ \textcolor{preprocessor}{(\_\_HANDLE\_\_)-\/>\_\_PPP\_DMA\_FIELD\_\_\ =\ (\_\_DMA\_HANDLE\_\_);\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00037}00037\ \textcolor{preprocessor}{(\_\_DMA\_HANDLE\_\_)-\/>Parent\ =\ (\_\_HANDLE\_\_);\}\ while(0U)}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00038}00038\ }
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00039}00039\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00040}00040\ \textcolor{comment}{////////////////////////////-\/-\/-\/DEFINES-\/-\/-\/////////////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00041}00041\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00042}00042\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00043}00043\ \textcolor{comment}{/////////////////////////////////////////////////////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00044}00044\ \textcolor{comment}{///////////////////////-\/-\/-\/STRUCTURES\ \&\ ENUMS-\/-\/-\///////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00045}\mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{00045}}\ \textcolor{comment}{}\textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\textcolor{comment}{//\ struct\ with\ settings\ for\ custom\ function}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00046}00046\ \{}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00047}00047\ \ \ UART\_HandleTypeDef\ huart;}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00048}00048\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00049}00049\ \ \ GPIO\_TypeDef\ *GPIOx;}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00050}00050\ \ \ uint16\_t\ GPIO\_PIN\_RX;}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00051}00051\ \ \ uint16\_t\ GPIO\_PIN\_TX;}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00052}00052\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00053}00053\ \ \ DMA\_Stream\_TypeDef\ *DMAChannel;\ \textcolor{comment}{//\ DMAChannel\ =\ 0\ if\ doesnt\ need}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00054}00054\ \ \ uint32\_t\ DMA\_CHANNEL\_X;\ \textcolor{comment}{//\ DMAChannel\ =\ 0\ if\ doesnt\ need}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00055}00055\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00056}00056\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00057}00057\ \}\mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\_SettingsTypeDef}};\textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00058}00058\ \textcolor{comment}{///////////////////////-\/-\/-\/STRUCTURES\ \&\ ENUMS-\/-\/-\///////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00059}00059\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00060}00060\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00061}00061\ \textcolor{comment}{/////////////////////////////////////////////////////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00062}00062\ \textcolor{comment}{///////////////////////////-\/-\/-\/FUNCTIONS-\/-\/-\////////////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00063}00063\ \textcolor{comment}{}\textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00064}00064\ \textcolor{comment}{\ \ *\ @brief\ \ Initialize\ UART\ with\ UART\_SettingsTypeDef\ structure.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00065}00065\ \textcolor{comment}{\ \ *\ @param\ \ suart\ -\/\ указатель\ на\ структуру\ с\ настройками\ UART.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00066}00066\ \textcolor{comment}{\ \ *\ @return\ HAL\ status.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00067}00067\ \textcolor{comment}{\ \ *\ @note\ \ \ Данная\ структура\ содержит\ хендл\ ЮАРТ\ и\ настройки\ перефирии\ (GPIO)}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00068}00068\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00069}00069\ HAL\_StatusTypeDef\ UART\_Base\_Init(\mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\_SettingsTypeDef}}\ *suart);\textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00070}00070\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00071}00071\ \textcolor{comment}{\ \ *\ @brief\ \ Initialize\ GPIO\ for\ UART.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00072}00072\ \textcolor{comment}{\ \ *\ @param\ \ GPIOx\ \ \ \ \ \ \ -\/\ порт\ для\ настройки.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00073}00073\ \textcolor{comment}{\ \ *\ @param\ \ GPIO\_PIN\_RX\ -\/\ пин\ для\ настройки\ на\ прием.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00074}00074\ \textcolor{comment}{\ \ *\ @param\ \ GPIO\_PIN\_TX\ -\/\ пин\ для\ настройки\ на\ передачу.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00075}00075\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00076}00076\ \textcolor{keywordtype}{void}\ UART\_GPIO\_Init(GPIO\_TypeDef\ *GPIOx,\ uint16\_t\ GPIO\_PIN\_RX,\ uint16\_t\ GPIO\_PIN\_TX);\textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00077}00077\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00078}00078\ \textcolor{comment}{\ \ *\ @brief\ \ Initialize\ DMA\ for\ UART.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00079}00079\ \textcolor{comment}{\ \ *\ @param\ \ huart\ \ \ \ \ \ \ \ \ -\/\ указатель\ на\ хендл\ UART\ для\ настройки\ DMA.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00080}00080\ \textcolor{comment}{\ \ *\ @param\ \ hdma\_rx\ \ \ \ \ \ \ -\/\ указатель\ на\ хендл\ DMA\ для\ линии\ приема\ UART.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00081}00081\ \textcolor{comment}{\ \ *\ @param\ \ DMAChannel\ \ \ \ -\/\ указатель\ на\ канал\ DMA/поток\ DMA\ в\ STM32F407.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00082}00082\ \textcolor{comment}{\ \ *\ @param\ \ DMA\_CHANNEL\_X\ -\/\ канал\ DMA.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00083}00083\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00084}00084\ \textcolor{keywordtype}{void}\ UART\_DMA\_Init(UART\_HandleTypeDef\ *huart,\ DMA\_HandleTypeDef\ *hdma\_rx,\ DMA\_Stream\_TypeDef\ *DMAChannel,\ uint32\_t\ DMA\_CHANNEL\_X);\textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00085}00085\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00086}00086\ \textcolor{comment}{\ \ *\ @brief\ \ Initialize\ UART\ \&\ DMA\ clock\ and\ interrupt.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00087}00087\ \textcolor{comment}{\ \ *\ @param\ \ huart\ -\/\ указатель\ на\ хендл\ UART\ для\ инициализации.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00088}00088\ \textcolor{comment}{\ \ *\ @note\ \ \ Чтобы\ не\ генерировать\ функцию\ с\ иницилизацией\ неиспользуемых\ UART,}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00089}00089\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ дефайнами\ определяются\ используемые\ UART.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00090}00090\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00091}00091\ \textcolor{keywordtype}{void}\ UART\_MspInit(UART\_HandleTypeDef\ *huart);\textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00092}00092\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00093}00093\ \textcolor{comment}{\ \ *\ @brief\ \ Deinitialize\ UART\ \&\ DMA\ clock\ and\ interrupt.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00094}00094\ \textcolor{comment}{\ \ *\ @param\ \ huart\ -\/\ указатель\ на\ хендл\ UART\ для\ деинициализации.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00095}00095\ \textcolor{comment}{\ \ *\ @note\ \ \ Чтобы\ не\ генерировать\ функцию\ с\ деиницилизацией\ неиспользуемых\ UART,}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00096}00096\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ дефайнами\ в\ rs\_message.h\ определяются\ используемые\ UART.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00097}00097\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00098}00098\ \textcolor{keywordtype}{void}\ UART\_MspDeInit(UART\_HandleTypeDef\ *huart);}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00099}00099\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00100}00100\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00101}00101\ \textcolor{comment}{\ \ *\ @brief\ \ Check\ that\ uart\ init\ structure\ have\ correct\ values.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00102}00102\ \textcolor{comment}{\ \ *\ @param\ \ suart\ -\/\ указатель\ на\ структуру\ с\ настройками\ UART.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00103}00103\ \textcolor{comment}{\ \ *\ @return\ HAL\ status.}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00104}00104\ \textcolor{comment}{\ \ */}\ }
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00105}00105\ HAL\_StatusTypeDef\ Check\_UART\_Init\_Struct(\mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\_SettingsTypeDef}}\ *suart);\textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00106}00106\ \textcolor{comment}{///////////////////////////-\/-\/-\/FUNCTIONS-\/-\/-\////////////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00107}00107\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__uart_8h_source_l00108}00108\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ \_\_UART\_GENERAL\_H\_}}

\end{DoxyCode}
