\doxysection{\+\_\+\+\_\+general\+\_\+spi.\+h}
\hypertarget{____general__spi_8h_source}{}\label{____general__spi_8h_source}\index{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Inc/\_\_general\_spi.h@{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Inc/\_\_general\_spi.h}}

\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00001}00001\ \textcolor{comment}{/**\ }}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00002}00002\ \textcolor{comment}{**************************************************************************}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00003}00003\ \textcolor{comment}{*\ @file\ general\_spi.h}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00004}00004\ \textcolor{comment}{*\ @brief\ Заголовочны\ файл\ модуля\ инициализации\ SPI.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00005}00005\ \textcolor{comment}{*************************************************************************/}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00006}00006\ \textcolor{preprocessor}{\#ifndef\ \_\_SPI\_GENERAL\_H\_}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00007}00007\ \textcolor{preprocessor}{\#define\ \_\_SPI\_GENERAL\_H\_}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00008}00008\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00009}00009\ \textcolor{comment}{//////////////////////////////////////////////////////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00010}00010\ \textcolor{comment}{/////////////////////////-\/-\/-\/USER\ SETTINGS-\/-\/-\//////////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00011}00011\ \textcolor{preprocessor}{\#define\ HAL\_SPI\_MODULE\_ENABLED\ \ }\textcolor{comment}{//\ need\ to\ uncomment\ these\ defines\ in\ stm32f4xx\_hal\_conf.h}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00012}00012\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ also\ need\ to\ add\ hal\_spi.c\ (source\ code)}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00013}00013\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00014}00014\ \textcolor{preprocessor}{\#define\ USE\_SPI1}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00015}00015\ \textcolor{preprocessor}{\#define\ USE\_SPI2}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00016}00016\ \textcolor{preprocessor}{\#define\ USE\_SPI3}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00017}00017\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00018}00018\ \textcolor{comment}{/////////////////////////-\/-\/-\/USER\ SETTINGS-\/-\/-\//////////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00019}00019\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{mylibs__defs_8h}{mylibs\_defs.h}}"{}}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00020}00020\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00021}00021\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00022}00022\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00023}00023\ \textcolor{comment}{/////////////////////////////////////////////////////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00024}00024\ \textcolor{comment}{////////////////////////////-\/-\/-\/DEFINES-\/-\/-\/////////////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00025}00025\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00026}00026\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00027}00027\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00028}00028\ \textcolor{comment}{////////////////////////////-\/-\/-\/DEFINES-\/-\/-\/////////////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00029}00029\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00030}00030\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00031}00031\ \textcolor{comment}{/////////////////////////////////////////////////////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00032}00032\ \textcolor{comment}{///////////////////////-\/-\/-\/STRUCTURES\ \&\ ENUMS-\/-\/-\///////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00033}\mbox{\hyperlink{struct_s_p_i___settings_type_def}{00033}}\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct\ }\textcolor{comment}{//\ struct\ with\ settings\ for\ custom\ function}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00034}00034\ \{}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00035}00035\ \ \ SPI\_HandleTypeDef\ hspi;}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00036}00036\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00037}00037\ \ \ GPIO\_TypeDef\ \ *CLK\_GPIOx;}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00038}00038\ \ \ uint32\_t\ \ \ \ \ \ CLK\_PIN;}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00039}00039\ \ \ uint32\_t\ \ \ \ \ \ CLK\_GPIO\_AlternageFunc;}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00040}00040\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00041}00041\ \ \ GPIO\_TypeDef\ \ *MISO\_GPIOx;}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00042}00042\ \ \ uint32\_t\ \ \ \ \ \ MISO\_PIN;}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00043}00043\ \ \ uint32\_t\ \ \ \ \ \ MISO\_GPIO\_AlternageFunc;}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00044}00044\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00045}00045\ \ \ GPIO\_TypeDef\ \ *MOSI\_GPIOx;}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00046}00046\ \ \ uint32\_t\ \ \ \ \ \ MOSI\_PIN;\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00047}00047\ \ \ uint32\_t\ \ \ \ \ \ MOSI\_GPIO\_AlternageFunc;}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00048}00048\ \ \ }
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00049}00049\ \}\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\_SettingsTypeDef}};\textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00050}00050\ \textcolor{comment}{///////////////////////-\/-\/-\/STRUCTURES\ \&\ ENUMS-\/-\/-\///////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00051}00051\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00052}00052\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00053}00053\ \textcolor{comment}{/////////////////////////////////////////////////////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00054}00054\ \textcolor{comment}{///////////////////////////-\/-\/-\/FUNCTIONS-\/-\/-\////////////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00055}00055\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00056}00056\ \textcolor{comment}{\ \ *\ @brief\ \ Initialize\ SPI\ with\ SPI\_SettingsTypeDef\ structure.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00057}00057\ \textcolor{comment}{\ \ *\ @param\ \ sspi\ -\/\ указатель\ на\ структуру\ с\ настройками\ SPI.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00058}00058\ \textcolor{comment}{\ \ *\ @return\ HAL\ status.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00059}00059\ \textcolor{comment}{\ \ *\ @note\ \ \ Данная\ структура\ содержит\ хендл\ ЮАРТ\ и\ настройки\ перефирии\ (GPIO)}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00060}00060\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00061}00061\ HAL\_StatusTypeDef\ SPI\_Base\_Init(\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\_SettingsTypeDef}}\ *sspi);\textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00062}00062\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00063}00063\ \textcolor{comment}{\ \ *\ @brief\ \ Initialize\ GPIO\ for\ SPI.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00064}00064\ \textcolor{comment}{\ \ *\ @param\ \ GPIOx\ \ \ \ \ \ \ -\/\ порт\ для\ настройки.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00065}00065\ \textcolor{comment}{\ \ *\ @param\ \ GPIO\_PIN\_RX\ -\/\ пин\ для\ настройки\ на\ прием.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00066}00066\ \textcolor{comment}{\ \ *\ @param\ \ GPIO\_PIN\_TX\ -\/\ пин\ для\ настройки\ на\ передачу.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00067}00067\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00068}00068\ \textcolor{keywordtype}{void}\ SPI\_GPIO\_Init(\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\_SettingsTypeDef}}\ *sspi);\textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00069}00069\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00070}00070\ \textcolor{comment}{\ \ *\ @brief\ \ Initialize\ DMA\ for\ SPI.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00071}00071\ \textcolor{comment}{\ \ *\ @param\ \ hspi\ \ \ \ \ \ \ \ -\/\ указатель\ на\ хендл\ SPI\ для\ настройки\ DMA.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00072}00072\ \textcolor{comment}{\ \ *\ @param\ \ hdma\_rx\ \ \ \ \ \ \ -\/\ указатель\ на\ хендл\ DMA\ для\ линии\ приема\ SPI.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00073}00073\ \textcolor{comment}{\ \ *\ @param\ \ DMAChannel\ \ \ \ -\/\ указатель\ на\ канал\ DMA/поток\ DMA\ в\ STM32F407.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00074}00074\ \textcolor{comment}{\ \ *\ @param\ \ DMA\_CHANNEL\_X\ -\/\ канал\ DMA.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00075}00075\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00076}00076\ \textcolor{keywordtype}{void}\ SPI\_DMA\_Init(SPI\_HandleTypeDef\ *hspi,\ DMA\_HandleTypeDef\ *hdma\_rx,\ DMA\_Stream\_TypeDef\ *DMAChannel,\ uint32\_t\ DMA\_CHANNEL\_X);\textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00077}00077\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00078}00078\ \textcolor{comment}{\ \ *\ @brief\ \ Initialize\ SPI\ \&\ DMA\ clock\ and\ interrupt.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00079}00079\ \textcolor{comment}{\ \ *\ @param\ \ hspi\ -\/\ указатель\ на\ хендл\ SPI\ для\ инициализации.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00080}00080\ \textcolor{comment}{\ \ *\ @note\ \ \ Чтобы\ не\ генерировать\ функцию\ с\ иницилизацией\ неиспользуемых\ SPI,}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00081}00081\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ дефайнами\ определяются\ используемые\ SPI.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00082}00082\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00083}00083\ \textcolor{keywordtype}{void}\ SPI\_MspInit(SPI\_HandleTypeDef\ *hspi);\textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00084}00084\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00085}00085\ \textcolor{comment}{\ \ *\ @brief\ \ Deinitialize\ SPI\ \&\ DMA\ clock\ and\ interrupt.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00086}00086\ \textcolor{comment}{\ \ *\ @param\ \ hspi\ -\/\ указатель\ на\ хендл\ SPI\ для\ деинициализации.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00087}00087\ \textcolor{comment}{\ \ *\ @note\ \ \ Чтобы\ не\ генерировать\ функцию\ с\ деиницилизацией\ неиспользуемых\ SPI,}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00088}00088\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ дефайнами\ в\ rs\_message.h\ определяются\ используемые\ SPI.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00089}00089\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00090}00090\ \textcolor{keywordtype}{void}\ SPI\_MspDeInit(SPI\_HandleTypeDef\ *hspi);}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00091}00091\ \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00092}00092\ \textcolor{comment}{/**\ \ }}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00093}00093\ \textcolor{comment}{\ \ *\ @brief\ \ Check\ that\ spi\ init\ structure\ have\ correct\ values.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00094}00094\ \textcolor{comment}{\ \ *\ @param\ \ sspi\ -\/\ указатель\ на\ структуру\ с\ настройками\ SPI.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00095}00095\ \textcolor{comment}{\ \ *\ @return\ HAL\ status.}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00096}00096\ \textcolor{comment}{\ \ */}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00097}00097\ HAL\_StatusTypeDef\ Check\_SPI\_Init\_Struct(\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\_SettingsTypeDef}}\ *sspi);\textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00098}00098\ \textcolor{comment}{///////////////////////////-\/-\/-\/FUNCTIONS-\/-\/-\////////////////////////////}}
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00099}00099\ }
\DoxyCodeLine{\Hypertarget{____general__spi_8h_source_l00100}00100\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ \_\_SPI\_GENERAL\_H\_}}

\end{DoxyCode}
