diff --git a/.gitignore b/.gitignore index fdc4b61..4e5f666 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -/MyLibsGeneral/.vscode/ -/Doc/ \ No newline at end of file +/MyLibsGeneral/.vscode/ \ No newline at end of file diff --git a/Doc/html/_s_p_i__usage__example-example.html b/Doc/html/_s_p_i__usage__example-example.html new file mode 100644 index 0000000..e9f6df9 --- /dev/null +++ b/Doc/html/_s_p_i__usage__example-example.html @@ -0,0 +1,165 @@ + + + + + + + +MyLibs: SPI_Usage_Example + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
MyLibs 1.0 +
+
Расширенные библиотеки для STM32
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
SPI_Usage_Example
+
+
+

Пример использования SPI_Base_Init.

+

Пример использования SPI_Base_Init. Инициализация SPI1 с базовыми настройками:

#include "general_spi.h"
+
+ +
+
void SPI1_Init(void)
+
{
+
// Настройка SPI1
+
mySPI.hspi.Instance = SPI1;
+
mySPI.hspi.Init.Mode = SPI_MODE_MASTER;
+
mySPI.hspi.Init.Direction = SPI_DIRECTION_2LINES;
+
mySPI.hspi.Init.DataSize = SPI_DATASIZE_8BIT;
+
mySPI.hspi.Init.CLKPolarity = SPI_POLARITY_LOW;
+
mySPI.hspi.Init.CLKPhase = SPI_PHASE_1EDGE;
+
mySPI.hspi.Init.NSS = SPI_NSS_SOFT;
+
mySPI.hspi.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_16;
+
mySPI.hspi.Init.FirstBit = SPI_FIRSTBIT_MSB;
+
mySPI.hspi.Init.TIMode = SPI_TIMODE_DISABLE;
+
mySPI.hspi.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
+
+
// Настройка GPIO для SPI
+
mySPI.CLK_GPIOx = GPIOA;
+
mySPI.CLK_PIN = GPIO_PIN_5;
+
mySPI.CLK_GPIO_AlternageFunc = GPIO_AF5_SPI1;
+
+
mySPI.MISO_GPIOx = GPIOA;
+
mySPI.MISO_PIN = GPIO_PIN_6;
+
mySPI.MISO_GPIO_AlternageFunc = GPIO_AF5_SPI1;
+
+
mySPI.MOSI_GPIOx = GPIOA;
+
mySPI.MOSI_PIN = GPIO_PIN_7;
+
mySPI.MOSI_GPIO_AlternageFunc = GPIO_AF5_SPI1;
+
+
// Инициализация SPI
+
if(SPI_Base_Init(&mySPI) != HAL_OK)
+
{
+
// Обработка ошибки
+
}
+
}
+
Заголовочный файл для модуля инициализации SPI.
+
HAL_StatusTypeDef SPI_Base_Init(SPI_SettingsTypeDef *sspi)
Инициализация SPI с помощью структуры SPI_SettingsTypeDef.
Definition general_spi.c:23
+
Структура настроек SPI.
+
GPIO_TypeDef * MOSI_GPIOx
Порт MOSI.
+
GPIO_TypeDef * MISO_GPIOx
Порт MISO.
+
uint32_t MISO_PIN
Пин MISO.
+
uint32_t CLK_PIN
Пин CLK.
+
uint32_t CLK_GPIO_AlternageFunc
Альтернативная функция для CLK.
+
GPIO_TypeDef * CLK_GPIOx
Порт CLK.
+
uint32_t MOSI_PIN
Пин MOSI.
+
SPI_HandleTypeDef hspi
HAL handle SPI.
+
uint32_t MISO_GPIO_AlternageFunc
Альтернативная функция для MISO.
+
uint32_t MOSI_GPIO_AlternageFunc
Альтернативная функция для MOSI.
+
+
+
+ + + + diff --git a/Doc/html/examples.html b/Doc/html/examples.html new file mode 100644 index 0000000..425d399 --- /dev/null +++ b/Doc/html/examples.html @@ -0,0 +1,116 @@ + + + + + + + +MyLibs: Examples + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
MyLibs 1.0 +
+
Расширенные библиотеки для STM32
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Examples
+
+
+
Here is a list of all examples:
+
+
+
+ + + + diff --git a/Doc/html/examples.js b/Doc/html/examples.js new file mode 100644 index 0000000..2b5561e --- /dev/null +++ b/Doc/html/examples.js @@ -0,0 +1,4 @@ +var examples = +[ + [ "SPI_Usage_Example", "_s_p_i__usage__example-example.html", null ] +]; \ No newline at end of file diff --git a/Doc/html/general__spi_8c.html b/Doc/html/general__spi_8c.html new file mode 100644 index 0000000..f4f02f1 --- /dev/null +++ b/Doc/html/general__spi_8c.html @@ -0,0 +1,233 @@ + + + + + + + +MyLibs: E:/.WORK/STM32/STM32_ExtendedLibs/MyLibsGeneral/Src/general_spi.c File Reference + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
MyLibs 1.0 +
+
Расширенные библиотеки для STM32
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
general_spi.c File Reference
+
+
+ +

Модуль для инициализации SPI. +More...

+
#include "general_spi.h"
+#include "general_gpio.h"
+
Include dependency graph for general_spi.c:
+
+
+ +
+

Go to the source code of this file.

+ + + + + + + + + + + + + +

+Functions

HAL_StatusTypeDef SPI_Base_Init (SPI_SettingsTypeDef *sspi)
 Инициализация SPI с помощью структуры SPI_SettingsTypeDef.
void SPI_GPIO_Init (SPI_SettingsTypeDef *sspi)
 Инициализация GPIO для SPI.
void SPI_DMA_Init (SPI_HandleTypeDef *hspi, DMA_HandleTypeDef *hdma_rx, DMA_Stream_TypeDef *DMAChannel, uint32_t DMA_CHANNEL_X)
void SPI_MspInit (SPI_HandleTypeDef *hspi)
 Настройка тактирования и прерываний SPI.
void SPI_MspDeInit (SPI_HandleTypeDef *hspi)
 Деинициализация тактирования и прерываний SPI.
HAL_StatusTypeDef SPI_Check_Init_Struct (SPI_SettingsTypeDef *sspi)
 Проверка корректности структуры инициализации SPI.
+

Detailed Description

+

Модуль для инициализации SPI.

+

Реализация функций для работы с SPI:

    +
  • Инициализация SPI и его линий CLK/MISO/MOSI
  • +
  • Настройка GPIO для SPI
  • +
  • Настройка NVIC и тактирования SPI
  • +
+ +

Definition in file general_spi.c.

+

Function Documentation

+ +

◆ SPI_GPIO_Init()

+ +
+
+ + + + + + + +
void SPI_GPIO_Init (SPI_SettingsTypeDef * sspi)
+
+ +

Инициализация GPIO для SPI.

+
Parameters
+ + +
sspiУказатель на структуру с настройками SPI.
+
+
+ +

Definition at line 58 of file general_spi.c.

+ +
+
+ +

◆ SPI_DMA_Init()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
void SPI_DMA_Init (SPI_HandleTypeDef * hspi,
DMA_HandleTypeDef * hdma_rx,
DMA_Stream_TypeDef * DMAChannel,
uint32_t DMA_CHANNEL_X )
+
+ +

Definition at line 89 of file general_spi.c.

+ +
+
+
+
+ +
+ + + + diff --git a/Doc/html/general__spi_8c.js b/Doc/html/general__spi_8c.js new file mode 100644 index 0000000..08a35c5 --- /dev/null +++ b/Doc/html/general__spi_8c.js @@ -0,0 +1,8 @@ +var general__spi_8c = +[ + [ "SPI_Base_Init", "group___m_y___l_i_b_s___s_p_i.html#ga0e177e3c57a8fcdc73b5602e72ec66ba", null ], + [ "SPI_GPIO_Init", "general__spi_8c.html#ae80d21e5cab86571709a2619442733b5", null ], + [ "SPI_MspInit", "group___m_y___l_i_b_s___s_p_i.html#gab9f13318daf02bc5b5f302ae392dccac", null ], + [ "SPI_MspDeInit", "group___m_y___l_i_b_s___s_p_i.html#gac279cc3eaa35541edfe330a1844a85e4", null ], + [ "SPI_Check_Init_Struct", "group___m_y___l_i_b_s___s_p_i.html#ga333dd251bc878931086d48aa932b1a5f", null ] +]; \ No newline at end of file diff --git a/Doc/html/general__spi_8c__incl.map b/Doc/html/general__spi_8c__incl.map new file mode 100644 index 0000000..8c160f6 --- /dev/null +++ b/Doc/html/general__spi_8c__incl.map @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/Doc/html/general__spi_8c__incl.md5 b/Doc/html/general__spi_8c__incl.md5 new file mode 100644 index 0000000..8342b9b --- /dev/null +++ b/Doc/html/general__spi_8c__incl.md5 @@ -0,0 +1 @@ +cda11d9ce070219b48b91b6cd8be6ad8 \ No newline at end of file diff --git a/Doc/html/general__spi_8c__incl.png b/Doc/html/general__spi_8c__incl.png new file mode 100644 index 0000000..a6d0f47 Binary files /dev/null and b/Doc/html/general__spi_8c__incl.png differ diff --git a/Doc/html/general__spi_8c_source.html b/Doc/html/general__spi_8c_source.html new file mode 100644 index 0000000..b9acf50 --- /dev/null +++ b/Doc/html/general__spi_8c_source.html @@ -0,0 +1,428 @@ + + + + + + + +MyLibs: E:/.WORK/STM32/STM32_ExtendedLibs/MyLibsGeneral/Src/general_spi.c Source File + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
MyLibs 1.0 +
+
Расширенные библиотеки для STM32
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
general_spi.c
+
+
+Go to the documentation of this file.
1/**
+
2**************************************************************************
+
3* @file general_spi.c
+
4* @brief Модуль для инициализации SPI.
+
5**************************************************************************
+
6Реализация функций для работы с SPI:
+
7 - Инициализация SPI и его линий CLK/MISO/MOSI
+
8 - Настройка GPIO для SPI
+
9 - Настройка NVIC и тактирования SPI
+
10**************************************************************************/
+
11#include "general_spi.h"
+
12#include "general_gpio.h"
+
13
+
14//-------------------------------------------------------------------
+
15//------------------------SPI INIT FUNCTIONS------------------------
+
16/**
+
17 * @brief Инициализация SPI с помощью структуры SPI_SettingsTypeDef.
+
18 * @param sspi Указатель на структуру с настройками SPI.
+
19 * @return HAL status.
+
20 * @details
+
21 * Инициализирует SPI и его GPIO.
+
22 * Настройка аналогична HAL_SPI_Init
+
23 * @code
+
24 * suart.hspi.Init...
+
25 * @endcode
+
26 * но дополнительно надо прописать пины CLK/MISO/MOSI @ref SPI_SettingsTypeDef
+
27 */
+
+
28HAL_StatusTypeDef SPI_Base_Init(SPI_SettingsTypeDef *sspi)
+
29{ // function takes setting structure for init
+
30
+
31 // check is settings are valid
+
32 if(SPI_Check_Init_Struct(sspi) != HAL_OK)
+
33 return HAL_ERROR;
+
34
+
35 SPI_MspInit(&sspi->hspi);
+
36
+
37 if (HAL_SPI_Init(&sspi->hspi) != HAL_OK)
+
38 {
+ +
40 return HAL_ERROR;
+
41 }
+
42
+
43 // init gpio from SPISettings structure
+
44 SPI_GPIO_Init(sspi);
+
45
+
46// // init dma from SPISettings structure if need
+
47// if (sspi->DMAChannel != 0)
+
48// SPI_DMA_Init(&sspi->hspi, sspi->hspi.hdmarx, sspi->DMAChannel, sspi->DMA_CHANNEL_X);
+
49
+
50 return HAL_OK;
+
51}
+
+
52
+
53
+
54/**
+
55 * @brief Инициализация GPIO для SPI.
+
56 * @param sspi Указатель на структуру с настройками SPI.
+
57 */
+
+ +
59{
+
60 GPIO_InitTypeDef GPIO_InitStruct = {0};
+
61 // GPIO INIT
+ + + +
65 // CLK PIN INIT
+
66 GPIO_InitStruct.Pin = sspi->CLK_PIN;
+
67 GPIO_InitStruct.Alternate = sspi->CLK_GPIO_AlternageFunc;
+
68 GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+
69 GPIO_InitStruct.Pull = GPIO_NOPULL;
+
70 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
+
71 HAL_GPIO_Init(sspi->CLK_GPIOx, &GPIO_InitStruct);
+
72 // MISO PIN INIT
+
73 GPIO_InitStruct.Pin = sspi->MISO_PIN;
+
74 GPIO_InitStruct.Alternate = sspi->MISO_GPIO_AlternageFunc;
+
75 GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+
76 GPIO_InitStruct.Pull = GPIO_NOPULL;
+
77 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
+
78 HAL_GPIO_Init(sspi->MISO_GPIOx, &GPIO_InitStruct);
+
79 // MOSI PIN INIT
+
80 GPIO_InitStruct.Pin = sspi->MOSI_PIN;
+
81 GPIO_InitStruct.Alternate = sspi->MOSI_GPIO_AlternageFunc;
+
82 GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+
83 GPIO_InitStruct.Pull = GPIO_NOPULL;
+
84 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
+
85 HAL_GPIO_Init(sspi->MOSI_GPIOx, &GPIO_InitStruct);
+
86}
+
+
87
+
88
+
89void SPI_DMA_Init(SPI_HandleTypeDef *hspi, DMA_HandleTypeDef *hdma_rx, DMA_Stream_TypeDef *DMAChannel, uint32_t DMA_CHANNEL_X)
+
90{ // function takes spi and dma handlers and dmachannel for spi
+
91// // for now only dma rx is supported, tx maybe later if needed
+
92// // calc defines on boot_project_setup.h
+
93
+
94// /* SPI3 DMA Init */
+
95// /* SPI3_RX Init */
+
96//
+
97// hdma_rx->Instance = DMAChannel;
+
98//#if defined(STM32F4xx) // dma channel choose for 407
+
99// hdma_rx->Init.Channel = DMA_CHANNEL_X;
+
100//#endif
+
101// hdma_rx->Init.Direction = DMA_PERIPH_TO_MEMORY;
+
102// hdma_rx->Init.PeriphInc = DMA_PINC_DISABLE;
+
103// hdma_rx->Init.MemInc = DMA_MINC_ENABLE;
+
104// hdma_rx->Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
+
105// hdma_rx->Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
+
106// hdma_rx->Init.Mode = DMA_CIRCULAR;
+
107// hdma_rx->Init.Priority = DMA_PRIORITY_LOW;
+
108// if (HAL_DMA_Init(hdma_rx) != HAL_OK)
+
109// {
+
110// MyLibs_Error_Handler();
+
111// }
+
112
+
113// __USER_LINKDMA(hspi,hdmarx,hdma_rx);
+
114//
+
115
+
116// // __USER_LINKDMA is need because __HAL_LINKDMA is written for global defined hdma_rx
+
117// // so you get error because hal uses . insted of ->
+
118}
+
119
+
120
+
121/**
+
122 * @brief Настройка тактирования и прерываний SPI.
+
123 * @param hspi Указатель на хендл SPI.
+
124 * @note Чтобы не генерировать функцию с иницилизацией неиспользуемых SPI,
+
125 дефайнами @ref SPI_INIT в @ref general_spi.h определяются используемые SPI.
+
126 */
+
+
127void SPI_MspInit(SPI_HandleTypeDef *hspi) // analog for hal function
+
128{
+
129 // rcc, dma and interrupt init for SPIs
+
130 // GPIO init was moved to own functions SPI_GPIO_Init
+
131 if(0);
+
132#ifdef USE_SPI1
+
133 else if(hspi->Instance==SPI1)
+
134 {
+
135
+
136// /* DMA2 clock enable */
+
137// __HAL_RCC_DMA2_CLK_ENABLE();
+
138// /* DMA interrupt init */
+
139// HAL_NVIC_SetPriority(DMA2_Stream2_IRQn, 0, 0);
+
140// HAL_NVIC_EnableIRQ(DMA2_Stream2_IRQn);
+
141
+
142 /* SPI1 clock enable */
+
143 __HAL_RCC_SPI1_CLK_ENABLE();
+
144
+
145 /* SPI1 interrupt Init */
+
146 HAL_NVIC_SetPriority(SPI1_IRQn, 0, 0);
+
147 HAL_NVIC_EnableIRQ(SPI1_IRQn);
+
148 }
+
149#endif // USE_SPI1
+
150#ifdef USE_SPI2
+
151 else if(hspi->Instance==SPI2)
+
152 {
+
153// /* DMA1 clock enable */
+
154// __HAL_RCC_DMA1_CLK_ENABLE();
+
155// /* DMA interrupt init */
+
156// HAL_NVIC_SetPriority(DMA1_Stream5_IRQn, 0, 0);
+
157// HAL_NVIC_EnableIRQ(DMA1_Stream5_IRQn);
+
158
+
159 /* SPI2 clock enable */
+
160 __HAL_RCC_SPI2_CLK_ENABLE();
+
161
+
162 /* SPI2 interrupt Init */
+
163 HAL_NVIC_SetPriority(SPI2_IRQn, 0, 0);
+
164 HAL_NVIC_EnableIRQ(SPI2_IRQn);
+
165 }
+
166#endif // USE_SPI2
+
167#ifdef USE_SPI3
+
168 else if(hspi->Instance==SPI3)
+
169 {
+
170// /* DMA1 clock enable */
+
171// __HAL_RCC_DMA1_CLK_ENABLE();
+
172// /* DMA interrupt init */
+
173// HAL_NVIC_SetPriority(DMA1_Stream1_IRQn, 0, 0);
+
174// HAL_NVIC_EnableIRQ(DMA1_Stream1_IRQn);
+
175
+
176 /* SPI3 clock enable */
+
177 __HAL_RCC_SPI3_CLK_ENABLE();
+
178 /* SPI3 interrupt Init */
+
179 HAL_NVIC_SetPriority(SPI3_IRQn, 0, 0);
+
180 HAL_NVIC_EnableIRQ(SPI3_IRQn);
+
181 }
+
182#endif // USE_SPI3
+
183}
+
+
184
+
185/**
+
186 * @brief Деинициализация тактирования и прерываний SPI.
+
187 * @param hspi Указатель на хендл SPI.
+
188 * @note Чтобы не генерировать функцию с иницилизацией неиспользуемых SPI,
+
189 дефайнами @ref SPI_INIT в @ref general_spi.h определяются используемые SPI.
+
190 */
+
+
191void SPI_MspDeInit(SPI_HandleTypeDef *hspi) // analog for hal function
+
192{
+
193 // rcc, dma and interrupt init for SPIs
+
194 // GPIO init was moved to own functions SPI_GPIO_Init
+
195 if(0);
+
196#ifdef USE_SPI1
+
197 else if(hspi->Instance==SPI1)
+
198 {
+
199
+
200// /* DMA2 clock enable */
+
201// __HAL_RCC_DMA2_CLK_ENABLE();
+
202// /* DMA interrupt init */
+
203// HAL_NVIC_SetPriority(DMA2_Stream2_IRQn, 0, 0);
+
204// HAL_NVIC_EnableIRQ(DMA2_Stream2_IRQn);
+
205
+
206 /* SPI1 clock reset */
+
207 __HAL_RCC_SPI1_FORCE_RESET();
+
208 __HAL_RCC_SPI1_RELEASE_RESET();
+
209 }
+
210#endif // USE_SPI1
+
211#ifdef USE_SPI2
+
212 else if(hspi->Instance==SPI2)
+
213 {
+
214// /* DMA1 clock enable */
+
215// __HAL_RCC_DMA1_CLK_ENABLE();
+
216// /* DMA interrupt init */
+
217// HAL_NVIC_SetPriority(DMA1_Stream5_IRQn, 0, 0);
+
218// HAL_NVIC_EnableIRQ(DMA1_Stream5_IRQn);
+
219
+
220 /* SPI2 clock reset */
+
221 __HAL_RCC_SPI2_FORCE_RESET();
+
222 __HAL_RCC_SPI2_RELEASE_RESET();
+
223 }
+
224#endif // USE_SPI2
+
225#ifdef USE_SPI3
+
226 else if(hspi->Instance==SPI3)
+
227 {
+
228// /* DMA1 clock enable */
+
229// __HAL_RCC_DMA1_CLK_ENABLE();
+
230// /* DMA interrupt init */
+
231// HAL_NVIC_SetPriority(DMA1_Stream1_IRQn, 0, 0);
+
232// HAL_NVIC_EnableIRQ(DMA1_Stream1_IRQn);
+
233
+
234 /* SPI3 clock reset */
+
235 __HAL_RCC_SPI3_FORCE_RESET();
+
236 __HAL_RCC_SPI3_RELEASE_RESET();
+
237 }
+
238#endif // USE_SPI3
+
239}
+
+
240
+
241/**
+
242 * @brief Проверка корректности структуры инициализации SPI.
+
243 * @param sspi Указатель на структуру с настройками SPI.
+
244 * @return HAL status.
+
245 */
+
+ +
247{
+
248 // check is settings are valid
+
249 if (!IS_SPI_ALL_INSTANCE(sspi->hspi.Instance))
+
250 return HAL_ERROR;
+
251
+
252 // check init settings
+
253 if (!IS_SPI_MODE(sspi->hspi.Init.Mode))
+
254 return HAL_ERROR;
+
255 if (!IS_SPI_DIRECTION(sspi->hspi.Init.Direction))
+
256 return HAL_ERROR;
+
257 if (!IS_SPI_DATASIZE(sspi->hspi.Init.DataSize))
+
258 return HAL_ERROR;
+
259 if (!IS_SPI_BAUDRATE_PRESCALER(sspi->hspi.Init.BaudRatePrescaler))
+
260 return HAL_ERROR;
+
261 if (!IS_SPI_CPOL(sspi->hspi.Init.CLKPolarity))
+
262 return HAL_ERROR;
+
263 if (!IS_SPI_CPHA(sspi->hspi.Init.CLKPhase))
+
264 return HAL_ERROR;
+
265 if (!IS_SPI_NSS(sspi->hspi.Init.NSS))
+
266 return HAL_ERROR;
+
267 if (!IS_SPI_FIRST_BIT(sspi->hspi.Init.FirstBit))
+
268 return HAL_ERROR;
+
269 if (!IS_SPI_CRC_CALCULATION(sspi->hspi.Init.CRCCalculation))
+
270 return HAL_ERROR;
+
271 if (!IS_SPI_CRC_POLYNOMIAL(sspi->hspi.Init.NSS) &&
+
272 (sspi->hspi.Init.CRCCalculation != SPI_CRCCALCULATION_DISABLE))
+
273 return HAL_ERROR;
+
274 if (!IS_SPI_TIMODE(sspi->hspi.Init.TIMode))
+
275 return HAL_ERROR;
+
276
+
277 // check gpio
+
278 if (!IS_GPIO_ALL_INSTANCE(sspi->CLK_GPIOx) || !IS_GPIO_ALL_INSTANCE(sspi->MISO_GPIOx) || !IS_GPIO_ALL_INSTANCE(sspi->MOSI_GPIOx))
+
279 return HAL_ERROR;
+
280 if (!IS_GPIO_PIN(sspi->CLK_PIN) && !IS_GPIO_PIN(sspi->MISO_PIN) && !IS_GPIO_PIN(sspi->MOSI_PIN)) // if both pins arent set up
+
281 return HAL_ERROR;
+
282
+
283 return HAL_OK;
+
284}
+
+
Заголовочный файл для модуля инициализации портов и работы с ними.
+
void SPI_GPIO_Init(SPI_SettingsTypeDef *sspi)
Инициализация GPIO для SPI.
Definition general_spi.c:58
+
Заголовочный файл для модуля инициализации SPI.
+
#define MyLibs_Error_Handler(params)
Error_Handler который будет вызыватся в библиотеке
Definition mylibs_defs.h:31
+
HAL_StatusTypeDef SPI_Base_Init(SPI_SettingsTypeDef *sspi)
Инициализация SPI с помощью структуры SPI_SettingsTypeDef.
Definition general_spi.c:28
+
HAL_StatusTypeDef SPI_Check_Init_Struct(SPI_SettingsTypeDef *sspi)
Проверка корректности структуры инициализации SPI.
+
void SPI_MspInit(SPI_HandleTypeDef *hspi)
Настройка тактирования и прерываний SPI.
+
void SPI_MspDeInit(SPI_HandleTypeDef *hspi)
Деинициализация тактирования и прерываний SPI.
+
HAL_StatusTypeDef GPIO_Clock_Enable(GPIO_TypeDef *GPIOx)
Включить тактирование порта GPIO.
+
Структура настроек SPI.
+
GPIO_TypeDef * MOSI_GPIOx
Порт MOSI.
+
GPIO_TypeDef * MISO_GPIOx
Порт MISO.
+
uint32_t MISO_PIN
Пин MISO.
+
uint32_t CLK_PIN
Пин CLK.
+
uint32_t CLK_GPIO_AlternageFunc
Альтернативная функция для CLK.
+
GPIO_TypeDef * CLK_GPIOx
Порт CLK.
+
uint32_t MOSI_PIN
Пин MOSI.
+
SPI_HandleTypeDef hspi
HAL handle SPI.
+
uint32_t MISO_GPIO_AlternageFunc
Альтернативная функция для MISO.
+
uint32_t MOSI_GPIO_AlternageFunc
Альтернативная функция для MOSI.
+
+
+
+ + + + diff --git a/Doc/html/general__spi_8h.html b/Doc/html/general__spi_8h.html new file mode 100644 index 0000000..ce77bd2 --- /dev/null +++ b/Doc/html/general__spi_8h.html @@ -0,0 +1,185 @@ + + + + + + + +MyLibs: E:/.WORK/STM32/STM32_ExtendedLibs/MyLibsGeneral/Inc/general_spi.h File Reference + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
MyLibs 1.0 +
+
Расширенные библиотеки для STM32
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
general_spi.h File Reference
+
+
+ +

Заголовочный файл для модуля инициализации SPI. +More...

+
#include "mylibs_defs.h"
+
Include dependency graph for general_spi.h:
+
+
+ +
This graph shows which files directly or indirectly include this file:
+
+
+ +
+

Go to the source code of this file.

+ + + + +

+Classes

struct  SPI_SettingsTypeDef
 Структура настроек SPI. More...
+ + + + + + + + + +

+Macros

#define HAL_SPI_MODULE_ENABLED
 Включение HAL SPI.
#define USE_SPI1
 Включить SPI1 в SPI_MspInit.
#define USE_SPI2
 Включить SPI2 в SPI_MspInit.
#define USE_SPI3
 Включить SPI3 в SPI_MspInit.
+ + + + + + + + + +

+Functions

HAL_StatusTypeDef SPI_Base_Init (SPI_SettingsTypeDef *sspi)
 Инициализация SPI с помощью структуры SPI_SettingsTypeDef.
HAL_StatusTypeDef SPI_Check_Init_Struct (SPI_SettingsTypeDef *sspi)
 Проверка корректности структуры инициализации SPI.
void SPI_MspInit (SPI_HandleTypeDef *hspi)
 Настройка тактирования и прерываний SPI.
void SPI_MspDeInit (SPI_HandleTypeDef *hspi)
 Деинициализация тактирования и прерываний SPI.
+

Detailed Description

+

Заголовочный файл для модуля инициализации SPI.

+ +

Definition in file general_spi.h.

+
+
+ +
+ + + + diff --git a/Doc/html/general__spi_8h.js b/Doc/html/general__spi_8h.js new file mode 100644 index 0000000..089149a --- /dev/null +++ b/Doc/html/general__spi_8h.js @@ -0,0 +1,11 @@ +var general__spi_8h = +[ + [ "HAL_SPI_MODULE_ENABLED", "group___s_p_i___i_n_i_t.html#ga8ad4712bf4add56892d057778e826e0c", null ], + [ "USE_SPI1", "group___s_p_i___i_n_i_t.html#ga2fe0c8aeb2c61679f32836fef479eedf", null ], + [ "USE_SPI2", "group___s_p_i___i_n_i_t.html#ga53687cddb8e39e76a79b8ffaa152fb2b", null ], + [ "USE_SPI3", "group___s_p_i___i_n_i_t.html#ga5fdd6e5934a8005ef05b80f6d95883dc", null ], + [ "SPI_Base_Init", "group___m_y___l_i_b_s___s_p_i.html#ga0e177e3c57a8fcdc73b5602e72ec66ba", null ], + [ "SPI_Check_Init_Struct", "group___m_y___l_i_b_s___s_p_i.html#ga333dd251bc878931086d48aa932b1a5f", null ], + [ "SPI_MspInit", "group___m_y___l_i_b_s___s_p_i.html#gab9f13318daf02bc5b5f302ae392dccac", null ], + [ "SPI_MspDeInit", "group___m_y___l_i_b_s___s_p_i.html#gac279cc3eaa35541edfe330a1844a85e4", null ] +]; \ No newline at end of file diff --git a/Doc/html/general__spi_8h__dep__incl.map b/Doc/html/general__spi_8h__dep__incl.map new file mode 100644 index 0000000..2b0811b --- /dev/null +++ b/Doc/html/general__spi_8h__dep__incl.map @@ -0,0 +1,5 @@ + + + + + diff --git a/Doc/html/general__spi_8h__dep__incl.md5 b/Doc/html/general__spi_8h__dep__incl.md5 new file mode 100644 index 0000000..81e4d30 --- /dev/null +++ b/Doc/html/general__spi_8h__dep__incl.md5 @@ -0,0 +1 @@ +4329b58f85cc157f873e0efea5ebf705 \ No newline at end of file diff --git a/Doc/html/general__spi_8h__dep__incl.png b/Doc/html/general__spi_8h__dep__incl.png new file mode 100644 index 0000000..8bbc97a Binary files /dev/null and b/Doc/html/general__spi_8h__dep__incl.png differ diff --git a/Doc/html/general__spi_8h__incl.map b/Doc/html/general__spi_8h__incl.map new file mode 100644 index 0000000..3212273 --- /dev/null +++ b/Doc/html/general__spi_8h__incl.map @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Doc/html/general__spi_8h__incl.md5 b/Doc/html/general__spi_8h__incl.md5 new file mode 100644 index 0000000..1d36217 --- /dev/null +++ b/Doc/html/general__spi_8h__incl.md5 @@ -0,0 +1 @@ +e0af89a349938fa4f2a316fa222eee4c \ No newline at end of file diff --git a/Doc/html/general__spi_8h__incl.png b/Doc/html/general__spi_8h__incl.png new file mode 100644 index 0000000..7deb629 Binary files /dev/null and b/Doc/html/general__spi_8h__incl.png differ diff --git a/Doc/html/general__spi_8h_source.html b/Doc/html/general__spi_8h_source.html new file mode 100644 index 0000000..862f814 --- /dev/null +++ b/Doc/html/general__spi_8h_source.html @@ -0,0 +1,305 @@ + + + + + + + +MyLibs: E:/.WORK/STM32/STM32_ExtendedLibs/MyLibsGeneral/Inc/general_spi.h Source File + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
MyLibs 1.0 +
+
Расширенные библиотеки для STM32
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
general_spi.h
+
+
+Go to the documentation of this file.
1/**
+
2**************************************************************************
+
3* @file general_spi.h
+
4* @brief Заголовочный файл для модуля инициализации SPI.
+
5**************************************************************************
+
6* @defgroup MY_LIBS_SPI SPI Tools
+
7* @ingroup MYLIBS_PERIPHERAL
+
8* @brief Функции и макросы для удобной работы с SPI.
+
9* @details
+
10Модуль предоставляет функции для базовой инициализации SPI
+
11
+
12
+
13@par Пример использования:
+
14@code
+
15// Структура настроек SPI
+
16SPI_SettingsTypeDef spi1Settings;
+
17
+
18void SPI1_Init(void)
+
19{
+
20 // Настройка SPI1 как Master, 8 бит, полный дуплекс
+
21 spi1Settings.hspi.Instance = SPI1;
+
22 spi1Settings.hspi.Init.Mode = SPI_MODE_MASTER;
+
23 spi1Settings.hspi.Init.Direction = SPI_DIRECTION_2LINES;
+
24 spi1Settings.hspi.Init.DataSize = SPI_DATASIZE_8BIT;
+
25 spi1Settings.hspi.Init.CLKPolarity = SPI_POLARITY_LOW;
+
26 spi1Settings.hspi.Init.CLKPhase = SPI_PHASE_1EDGE;
+
27 spi1Settings.hspi.Init.NSS = SPI_NSS_SOFT;
+
28 spi1Settings.hspi.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_16;
+
29 spi1Settings.hspi.Init.FirstBit = SPI_FIRSTBIT_MSB;
+
30 spi1Settings.hspi.Init.TIMode = SPI_TIMODE_DISABLE;
+
31 spi1Settings.hspi.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
+
32
+
33 // Настройка GPIO
+
34 spi1Settings.CLK_GPIOx = GPIOA;
+
35 spi1Settings.CLK_PIN = GPIO_PIN_5;
+
36 spi1Settings.CLK_GPIO_AlternageFunc = GPIO_AF5_SPI1;
+
37
+
38 spi1Settings.MISO_GPIOx = GPIOA;
+
39 spi1Settings.MISO_PIN = GPIO_PIN_6;
+
40 spi1Settings.MISO_GPIO_AlternageFunc = GPIO_AF5_SPI1;
+
41
+
42 spi1Settings.MOSI_GPIOx = GPIOA;
+
43 spi1Settings.MOSI_PIN = GPIO_PIN_7;
+
44 spi1Settings.MOSI_GPIO_AlternageFunc = GPIO_AF5_SPI1;
+
45
+
46 // Инициализация SPI
+
47 if(SPI_Base_Init(&spi1Settings) != HAL_OK)
+
48 {
+
49 // Обработка ошибки
+
50 Error_Handler();
+
51 }
+
52}
+
53@endcode
+
54
+
55
+
56
+
57* @note Требуется подключение модуля SPI в библиотеке HAL
+
58@code
+
59#define HAL_SPI_MODULE_ENABLED
+
60@endcode
+
61* @{
+
62*************************************************************************/
+
63#ifndef __SPI_GENERAL_H_
+
64#define __SPI_GENERAL_H_
+
65
+
66
+
67/////////////////////////////////////////////////////////////////////
+
68/////////////////////////---USER SETTINGS---/////////////////////////
+
69/**
+
70 * @addtogroup SPI_INIT Init defines
+
71 * @ingroup MY_LIBS_SPI
+
72 * @brief Настройка SPI
+
73 * @{
+
74 */
+
75#define HAL_SPI_MODULE_ENABLED ///< Включение HAL SPI
+
76
+
77#define USE_SPI1 ///< Включить SPI1 в @ref SPI_MspInit
+
78#define USE_SPI2 ///< Включить SPI2 в @ref SPI_MspInit
+
79#define USE_SPI3 ///< Включить SPI3 в @ref SPI_MspInit
+
80/** SPI_INIT
+
81 * @}
+
82 */
+
83/////////////////////////---USER SETTINGS---/////////////////////////
+
84#include "mylibs_defs.h"
+
85
+
86
+
87
+
88/////////////////////////////////////////////////////////////////////
+
89////////////////////////////---DEFINES---////////////////////////////
+
90
+
91
+
92
+
93////////////////////////////---DEFINES---////////////////////////////
+
94
+
95
+
96/////////////////////////////////////////////////////////////////////
+
97///////////////////////---STRUCTURES & ENUMS---//////////////////////
+
98/**
+
99 * @brief Структура настроек SPI
+
100 * @details Содержит все необходимые параметры для инициализации SPI,
+
101 * включая GPIO и DMA.
+
102 */
+
+
103typedef struct
+
104{
+
105 SPI_HandleTypeDef hspi; ///< HAL handle SPI
+
106
+
107 GPIO_TypeDef *CLK_GPIOx; ///< Порт CLK
+
108 uint32_t CLK_PIN; ///< Пин CLK
+
109 uint32_t CLK_GPIO_AlternageFunc; ///< Альтернативная функция для CLK
+
110
+
111 GPIO_TypeDef *MISO_GPIOx; ///< Порт MISO
+
112 uint32_t MISO_PIN; ///< Пин MISO
+
113 uint32_t MISO_GPIO_AlternageFunc; ///< Альтернативная функция для MISO
+
114
+
115 GPIO_TypeDef *MOSI_GPIOx; ///< Порт MOSI
+
116 uint32_t MOSI_PIN; ///< Пин MOSI
+
117 uint32_t MOSI_GPIO_AlternageFunc; ///< Альтернативная функция для MOSI
+
118
+
119 DMA_Stream_TypeDef *DMAChannel; ///< Канал DMA (NULL если не нужен)
+
120 uint32_t DMA_CHANNEL_X; ///< Номер канала DMA (0 если не нужен)
+
121
+ +
+
123///////////////////////---STRUCTURES & ENUMS---//////////////////////
+
124
+
125
+
126/////////////////////////////////////////////////////////////////////
+
127///////////////////////////---FUNCTIONS---///////////////////////////
+
128
+
129/* Инициализация SPI с использованием структуры настроек */
+
130HAL_StatusTypeDef SPI_Base_Init(SPI_SettingsTypeDef *sspi);
+
131
+
132/* Проверка корректности структуры настроек SPI */
+
133HAL_StatusTypeDef SPI_Check_Init_Struct(SPI_SettingsTypeDef *sspi);
+
134
+
135/* Инициализация тактирования и прерываний для выбранного SPI */
+
136void SPI_MspInit(SPI_HandleTypeDef *hspi);
+
137
+
138/* Деинициализация тактирования и прерываний для выбранного SPI */
+
139void SPI_MspDeInit(SPI_HandleTypeDef *hspi);
+
140
+
141
+
142/**
+
143 * @cond SPI_INTERNAL
+
144 */
+
145
+
146/* Настройка GPIO для SPI */
+ +
148
+
149/* Настройка DMA для SPI */
+
150void SPI_DMA_Init(SPI_HandleTypeDef *hspi, DMA_HandleTypeDef *hdma_rx, DMA_Stream_TypeDef *DMAChannel, uint32_t DMA_CHANNEL_X);
+
151
+
152#ifndef __USER_LINKDMA
+
153/**
+
154 * @brief Аналог HAL макроса для привязки DMA к UART.
+
155 * @note @ref __HAL_LINKDMA.
+
156 */
+
157#define __USER_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \
+
158do{ \
+
159(__HANDLE__)->__PPP_DMA_FIELD__ = (__DMA_HANDLE__); \
+
160(__DMA_HANDLE__)->Parent = (__HANDLE__);} while(0U)
+
161#endif
+
162
+
163/** @endcond */
+
164///////////////////////////---FUNCTIONS---///////////////////////////
+
165
+
166#endif // __SPI_GENERAL_H_
+
167
+
168/** MY_LIBS_SPI
+
169 * @}
+
170 */
+
void SPI_GPIO_Init(SPI_SettingsTypeDef *sspi)
Инициализация GPIO для SPI.
Definition general_spi.c:58
+
HAL_StatusTypeDef SPI_Base_Init(SPI_SettingsTypeDef *sspi)
Инициализация SPI с помощью структуры SPI_SettingsTypeDef.
Definition general_spi.c:28
+
HAL_StatusTypeDef SPI_Check_Init_Struct(SPI_SettingsTypeDef *sspi)
Проверка корректности структуры инициализации SPI.
+
void SPI_MspInit(SPI_HandleTypeDef *hspi)
Настройка тактирования и прерываний SPI.
+
void SPI_MspDeInit(SPI_HandleTypeDef *hspi)
Деинициализация тактирования и прерываний SPI.
+
Заголочный файл для дефайнов библиотеки MyLibsGeneral.
+
Структура настроек SPI.
+
GPIO_TypeDef * MOSI_GPIOx
Порт MOSI.
+
GPIO_TypeDef * MISO_GPIOx
Порт MISO.
+
uint32_t MISO_PIN
Пин MISO.
+
uint32_t CLK_PIN
Пин CLK.
+
DMA_Stream_TypeDef * DMAChannel
Канал DMA (NULL если не нужен)
+
uint32_t CLK_GPIO_AlternageFunc
Альтернативная функция для CLK.
+
GPIO_TypeDef * CLK_GPIOx
Порт CLK.
+
uint32_t MOSI_PIN
Пин MOSI.
+
uint32_t DMA_CHANNEL_X
Номер канала DMA (0 если не нужен)
+
SPI_HandleTypeDef hspi
HAL handle SPI.
+
uint32_t MISO_GPIO_AlternageFunc
Альтернативная функция для MISO.
+
uint32_t MOSI_GPIO_AlternageFunc
Альтернативная функция для MOSI.
+
+
+
+ + + + diff --git a/Doc/html/general__uart_8c.html b/Doc/html/general__uart_8c.html new file mode 100644 index 0000000..fed8a13 --- /dev/null +++ b/Doc/html/general__uart_8c.html @@ -0,0 +1,257 @@ + + + + + + + +MyLibs: E:/.WORK/STM32/STM32_ExtendedLibs/MyLibsGeneral/Src/general_uart.c File Reference + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
MyLibs 1.0 +
+
Расширенные библиотеки для STM32
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
general_uart.c File Reference
+
+
+ +

Модуль для инициализации UART. +More...

+
#include "general_uart.h"
+#include "general_gpio.h"
+
Include dependency graph for general_uart.c:
+
+
+ +
+

Go to the source code of this file.

+ + + + + + + + + + + + + + +

+Functions

HAL_StatusTypeDef UART_Base_Init (UART_SettingsTypeDef *suart)
 Инициализация UART с помощью структуры UART_SettingsTypeDef.
void UART_GPIO_Init (GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN_RX, uint16_t GPIO_PIN_TX)
 Инициализация GPIO для UART.
void UART_DMA_Init (UART_HandleTypeDef *huart, DMA_HandleTypeDef *hdma_rx, DMA_Stream_TypeDef *DMAChannel, uint32_t DMA_CHANNEL_X)
 Инициализация DMA для UART.
void UART_MspInit (UART_HandleTypeDef *huart)
 Настройка тактирования и прерываний UART.
void UART_MspDeInit (UART_HandleTypeDef *huart)
 Деинициализация тактирования и прерываний UART.
HAL_StatusTypeDef UART_Check_Init_Struct (UART_SettingsTypeDef *suart)
 Проверка корректности структуры инициализации UART.
+

Detailed Description

+

Модуль для инициализации UART.

+

Реализация функций для работы с UART:

    +
  • Инициализация UART и его линий RX/TX
  • +
  • Настройка DMA для UART
  • +
  • Настройка GPIO для UART
  • +
  • Настройка NVIC и тактирования UART
  • +
+ +

Definition in file general_uart.c.

+

Function Documentation

+ +

◆ UART_GPIO_Init()

+ +
+
+ + + + + + + + + + + + + + + + +
void UART_GPIO_Init (GPIO_TypeDef * GPIOx,
uint16_t GPIO_PIN_RX,
uint16_t GPIO_PIN_TX )
+
+ +

Инициализация GPIO для UART.

+
Parameters
+ + + + +
GPIOxПорт для настройки.
GPIO_PIN_RXПин для приема.
GPIO_PIN_TXПин для передачи.
+
+
+ +

Definition at line 69 of file general_uart.c.

+ +
+
+ +

◆ UART_DMA_Init()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
void UART_DMA_Init (UART_HandleTypeDef * huart,
DMA_HandleTypeDef * hdma_rx,
DMA_Stream_TypeDef * DMAChannel,
uint32_t DMA_CHANNEL_X )
+
+ +

Инициализация DMA для UART.

+
Parameters
+ + + + + +
huartУказатель на хендл UART.
hdma_rxУказатель на хендл DMA для линии приема UART.
DMAChannelУказатель на канал DMA/поток DMA в STM32F407.
DMA_CHANNEL_XКанал DMA.
+
+
+ +

Definition at line 109 of file general_uart.c.

+ +
+
+
+
+ +
+ + + + diff --git a/Doc/html/general__uart_8c.js b/Doc/html/general__uart_8c.js new file mode 100644 index 0000000..9425ccf --- /dev/null +++ b/Doc/html/general__uart_8c.js @@ -0,0 +1,9 @@ +var general__uart_8c = +[ + [ "UART_Base_Init", "group___m_y___l_i_b_s___u_a_r_t.html#gab9f07396b778505c934143e89953e154", null ], + [ "UART_GPIO_Init", "general__uart_8c.html#a3abae05bbde5f3b402bf18ca13dc6a0b", null ], + [ "UART_DMA_Init", "general__uart_8c.html#ad82d0cbd19151675135fd75dad315d05", null ], + [ "UART_MspInit", "group___m_y___l_i_b_s___u_a_r_t.html#gab9313fd2f9fc6873ca6bfbc5b96edbbb", null ], + [ "UART_MspDeInit", "group___m_y___l_i_b_s___u_a_r_t.html#ga93ed6ceef4e3b5e7885786125cce93bc", null ], + [ "UART_Check_Init_Struct", "group___m_y___l_i_b_s___u_a_r_t.html#ga2a22e46ecb9e04b2ce197a0e9c09044a", null ] +]; \ No newline at end of file diff --git a/Doc/html/general__uart_8c__incl.map b/Doc/html/general__uart_8c__incl.map new file mode 100644 index 0000000..b1e5c6b --- /dev/null +++ b/Doc/html/general__uart_8c__incl.map @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/Doc/html/general__uart_8c__incl.md5 b/Doc/html/general__uart_8c__incl.md5 new file mode 100644 index 0000000..c4d1007 --- /dev/null +++ b/Doc/html/general__uart_8c__incl.md5 @@ -0,0 +1 @@ +3ff3cdf25ec66354d1baab1e80991e75 \ No newline at end of file diff --git a/Doc/html/general__uart_8c__incl.png b/Doc/html/general__uart_8c__incl.png new file mode 100644 index 0000000..cc1dcf1 Binary files /dev/null and b/Doc/html/general__uart_8c__incl.png differ diff --git a/Doc/html/general__uart_8c_source.html b/Doc/html/general__uart_8c_source.html new file mode 100644 index 0000000..3d792ea --- /dev/null +++ b/Doc/html/general__uart_8c_source.html @@ -0,0 +1,526 @@ + + + + + + + +MyLibs: E:/.WORK/STM32/STM32_ExtendedLibs/MyLibsGeneral/Src/general_uart.c Source File + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
MyLibs 1.0 +
+
Расширенные библиотеки для STM32
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
general_uart.c
+
+
+Go to the documentation of this file.
1/**
+
2**************************************************************************
+
3* @file general_uart.c
+
4* @brief Модуль для инициализации UART.
+
5**************************************************************************
+
6Реализация функций для работы с UART:
+
7 - Инициализация UART и его линий RX/TX
+
8 - Настройка DMA для UART
+
9 - Настройка GPIO для UART
+
10 - Настройка NVIC и тактирования UART
+
11**************************************************************************/
+
12#include "general_uart.h"
+
13#include "general_gpio.h"
+
14
+
15//-------------------------------------------------------------------
+
16//------------------------UART INIT FUNCTIONS------------------------
+
17/**
+
18 * @brief Инициализация UART с помощью структуры UART_SettingsTypeDef.
+
19 * @param suart Указатель на структуру с настройками UART.
+
20 * @return HAL status.
+
21 * @details
+
22 * Инициализирует UART и его GPIO и при необходимости DMA.
+
23 * Настройка аналогична HAL_UART_Init
+
24 * @code
+
25 * suart.huart.Init...
+
26 * @endcode
+
27 * но дополнительно надо прописать пины RX/TX @ref UART_SettingsTypeDef
+
28 * @code
+
29 * suart->GPIOx, suart->GPIO_PIN_RX, suart->GPIO_PIN_TX
+
30 * @endcode
+
31 */
+
+
32HAL_StatusTypeDef UART_Base_Init(UART_SettingsTypeDef *suart)
+
33{ // function takes setting structure for init
+
34
+
35 // check is settings are valid
+
36 if(UART_Check_Init_Struct(suart) != HAL_OK)
+
37 return HAL_ERROR;
+
38
+
39 suart->huart.Init.Mode = UART_MODE_TX_RX;
+
40
+
41 UART_MspInit(&suart->huart);
+
42
+
43
+
44 if (HAL_UART_Init(&suart->huart) != HAL_OK)
+
45 {
+ +
47 return HAL_ERROR;
+
48 }
+
49
+
50 // init gpio from UARTSettings structure
+
51 UART_GPIO_Init(suart->GPIOx, suart->GPIO_PIN_RX, suart->GPIO_PIN_TX);
+
52
+
53 __HAL_UART_ENABLE_IT(&suart->huart, UART_IT_IDLE);
+
54 // init dma from UARTSettings structure if need
+
55 if (suart->DMAChannel != 0)
+
56 UART_DMA_Init(&suart->huart, suart->huart.hdmarx, suart->DMAChannel, suart->DMA_CHANNEL_X);
+
57
+
58
+
59 return HAL_OK;
+
60}
+
+
61
+
62
+
63/**
+
64 * @brief Инициализация GPIO для UART.
+
65 * @param GPIOx Порт для настройки.
+
66 * @param GPIO_PIN_RX Пин для приема.
+
67 * @param GPIO_PIN_TX Пин для передачи.
+
68 */
+
+
69void UART_GPIO_Init(GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN_RX, uint16_t GPIO_PIN_TX)
+
70{ // function takes port and pins (for rx and tx)
+
71 GPIO_InitTypeDef GPIO_InitStruct = {0};
+
72
+
73 // choose port for enable clock
+
74 GPIO_Clock_Enable(GPIOx);
+
75
+
76 //USART3 GPIO Configuration
+
77 //GPIO_PIN_TX ------> USART_TX
+
78 //GPIO_PIN_RX ------> USART_RX
+
79
+
80#if defined(STM32F4xx) // gpio init for 407
+
81 GPIO_InitStruct.Pin = GPIO_PIN_TX|GPIO_PIN_RX;
+
82 GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+
83 GPIO_InitStruct.Pull = GPIO_NOPULL;
+
84 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
+
85 GPIO_InitStruct.Alternate = GPIO_AF7_USART3;
+
86 HAL_GPIO_Init(GPIOx, &GPIO_InitStruct);
+
87#elif defined(STM32F1xx) // gpio init for atm403/stm103
+
88 //GPIO_PIN_TX ------> USART_TX
+
89 GPIO_InitStruct.Pin = GPIO_PIN_TX;
+
90 GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+
91 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
+
92 HAL_GPIO_Init(GPIOx, &GPIO_InitStruct);
+
93
+
94// GPIO_PIN_RX ------> USART_RX
+
95 GPIO_InitStruct.Pin = GPIO_PIN_RX;
+
96 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
+
97 GPIO_InitStruct.Pull = GPIO_NOPULL;
+
98 HAL_GPIO_Init(GPIOx, &GPIO_InitStruct);
+
99#endif
+
100}
+
+
101
+
102/**
+
103 * @brief Инициализация DMA для UART.
+
104 * @param huart Указатель на хендл UART.
+
105 * @param hdma_rx Указатель на хендл DMA для линии приема UART.
+
106 * @param DMAChannel Указатель на канал DMA/поток DMA в STM32F407.
+
107 * @param DMA_CHANNEL_X Канал DMA.
+
108 */
+
+
109void UART_DMA_Init(UART_HandleTypeDef *huart, DMA_HandleTypeDef *hdma_rx, DMA_Stream_TypeDef *DMAChannel, uint32_t DMA_CHANNEL_X)
+
110{ // function takes uart and dma handlers and dmachannel for uart
+
111 // for now only dma rx is supported, tx maybe later if needed
+
112 // calc defines on boot_project_setup.h
+
113
+
114 /* USART3 DMA Init */
+
115 /* USART3_RX Init */
+
116
+
117 hdma_rx->Instance = DMAChannel;
+
118#if defined(STM32F4xx) // dma channel choose for 407
+
119 hdma_rx->Init.Channel = DMA_CHANNEL_X;
+
120#endif
+
121 hdma_rx->Init.Direction = DMA_PERIPH_TO_MEMORY;
+
122 hdma_rx->Init.PeriphInc = DMA_PINC_DISABLE;
+
123 hdma_rx->Init.MemInc = DMA_MINC_ENABLE;
+
124 hdma_rx->Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
+
125 hdma_rx->Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
+
126 hdma_rx->Init.Mode = DMA_CIRCULAR;
+
127 hdma_rx->Init.Priority = DMA_PRIORITY_LOW;
+
128 if (HAL_DMA_Init(hdma_rx) != HAL_OK)
+
129 {
+ +
131 }
+
132
+
133 __USER_LINKDMA(huart,hdmarx,hdma_rx);
+
134
+
135
+
136 // __USER_LINKDMA is need because __HAL_LINKDMA is written for global defined hdma_rx
+
137 // so you get error because hal uses . insted of ->
+
138}
+
+
139
+
140/**
+
141 * @brief Настройка тактирования и прерываний UART.
+
142 * @param huart Указатель на хендл UART.
+
143 * @note Чтобы не генерировать функцию с иницилизацией неиспользуемых UART,
+
144 дефайнами @ref UART_INIT в @ref general_uart.h определяются используемые UART.
+
145 */
+
+
146void UART_MspInit(UART_HandleTypeDef *huart) // analog for hal function
+
147{
+
148// __RCC_DMA_UART_CLK_ENABLE();
+
149// /* DMA interrupt init */
+
150// /* DMA1_Stream1_IRQn interrupt configuration */
+
151// HAL_NVIC_SetPriority(DMA_UART_IRQn, 0, 0);
+
152// HAL_NVIC_EnableIRQ(DMA_UART_IRQn);
+
153
+
154 // rcc, dma and interrupt init for USARTs
+
155 // GPIO init was moved to own functions UART_GPIO_Init
+
156 if(0);
+
157#ifdef USE_USART1
+
158 else if(huart->Instance==USART1)
+
159 {
+
160
+
161 /* DMA2 clock enable */
+
162 __HAL_RCC_DMA2_CLK_ENABLE();
+
163 /* DMA interrupt init */
+
164 HAL_NVIC_SetPriority(DMA2_Stream2_IRQn, 0, 0);
+
165 HAL_NVIC_EnableIRQ(DMA2_Stream2_IRQn);
+
166
+
167 /* USART1 clock enable */
+
168 __HAL_RCC_USART1_CLK_ENABLE();
+
169
+
170 /* USART1 interrupt Init */
+
171 HAL_NVIC_SetPriority(USART1_IRQn, 0, 0);
+
172 HAL_NVIC_EnableIRQ(USART1_IRQn);
+
173 }
+
174#endif // USE_USART1
+
175#ifdef USE_USART2
+
176 else if(huart->Instance==USART2)
+
177 {
+
178 /* DMA1 clock enable */
+
179 __HAL_RCC_DMA1_CLK_ENABLE();
+
180 /* DMA interrupt init */
+
181 HAL_NVIC_SetPriority(DMA1_Stream5_IRQn, 0, 0);
+
182 HAL_NVIC_EnableIRQ(DMA1_Stream5_IRQn);
+
183
+
184 /* USART2 clock enable */
+
185 __HAL_RCC_USART2_CLK_ENABLE();
+
186
+
187 /* USART2 interrupt Init */
+
188 HAL_NVIC_SetPriority(USART2_IRQn, 0, 0);
+
189 HAL_NVIC_EnableIRQ(USART2_IRQn);
+
190 }
+
191#endif // USE_USART2
+
192#ifdef USE_USART3
+
193 else if(huart->Instance==USART3)
+
194 {
+
195 /* DMA1 clock enable */
+
196 __HAL_RCC_DMA1_CLK_ENABLE();
+
197 /* DMA interrupt init */
+
198 HAL_NVIC_SetPriority(DMA1_Stream1_IRQn, 0, 0);
+
199 HAL_NVIC_EnableIRQ(DMA1_Stream1_IRQn);
+
200
+
201 /* USART3 clock enable */
+
202 __HAL_RCC_USART3_CLK_ENABLE();
+
203 /* USART3 interrupt Init */
+
204 HAL_NVIC_SetPriority(USART3_IRQn, 0, 0);
+
205 HAL_NVIC_EnableIRQ(USART3_IRQn);
+
206 }
+
207#endif // USE_USART3
+
208#ifdef USE_UART4
+
209 else if(huart->Instance==UART4)
+
210 {
+
211 /* DMA1 clock enable */
+
212 __HAL_RCC_DMA1_CLK_ENABLE();
+
213 /* DMA interrupt init */
+
214 HAL_NVIC_SetPriority(DMA1_Stream2_IRQn, 0, 0);
+
215 HAL_NVIC_EnableIRQ(DMA1_Stream2_IRQn);
+
216
+
217 /* UART4 clock enable */
+
218 __HAL_RCC_UART4_CLK_ENABLE();
+
219
+
220 /* UART4 interrupt Init */
+
221 HAL_NVIC_SetPriority(UART4_IRQn, 0, 0);
+
222 HAL_NVIC_EnableIRQ(UART4_IRQn);
+
223 }
+
224#endif // USE_UART4
+
225#ifdef USE_UART5
+
226 else if(huart->Instance==UART5)
+
227 {
+
228 /* DMA1 clock enable */
+
229 __HAL_RCC_DMA1_CLK_ENABLE();
+
230 /* DMA interrupt init */
+
231 HAL_NVIC_SetPriority(DMA1_Stream0_IRQn, 0, 0);
+
232 HAL_NVIC_EnableIRQ(DMA1_Stream0_IRQn);
+
233
+
234 /* UART5 clock enable */
+
235 __HAL_RCC_DMA1_CLK_ENABLE();
+
236
+
237 /* UART5 interrupt Init */
+
238 HAL_NVIC_SetPriority(UART5_IRQn, 0, 0);
+
239 HAL_NVIC_EnableIRQ(UART5_IRQn);
+
240 }
+
241#endif // USE_UART5
+
242#ifdef USE_USART6
+
243 else if(huart->Instance==USART6)
+
244 {
+
245 /* DMA2 clock enable */
+
246 __HAL_RCC_DMA2_CLK_ENABLE();
+
247 /* DMA interrupt init */
+
248 HAL_NVIC_SetPriority(DMA2_Stream1_IRQn, 0, 0);
+
249 HAL_NVIC_EnableIRQ(DMA2_Stream1_IRQn);
+
250
+
251 /* USART6 clock enable */
+
252 __HAL_RCC_USART6_CLK_ENABLE();
+
253
+
254 /* USART6 interrupt Init */
+
255 HAL_NVIC_SetPriority(USART6_IRQn, 0, 0);
+
256 HAL_NVIC_EnableIRQ(USART6_IRQn);
+
257 }
+
258#endif // USE_USART6
+
259}
+
+
260
+
261/**
+
262 * @brief Деинициализация тактирования и прерываний UART.
+
263 * @param huart Указатель на хендл UART.
+
264 * @note Чтобы не генерировать функцию с деиницилизацией неиспользуемых UART,
+
265 дефайнами @ref UART_INIT в @ref general_uart.h определяются используемые UART.
+
266 */
+
+
267void UART_MspDeInit(UART_HandleTypeDef *huart) // analog for hal function
+
268{
+
269 // rcc, dma and interrupt init for USARTs
+
270 // GPIO init was moved to own functions UART_GPIO_Init
+
271 if(0);
+
272#ifdef USE_USART1
+
273 else if(huart->Instance==USART1)
+
274 {
+
275
+
276// /* DMA2 clock enable */
+
277// __HAL_RCC_DMA2_CLK_ENABLE();
+
278// /* DMA interrupt init */
+
279// HAL_NVIC_SetPriority(DMA2_Stream2_IRQn, 0, 0);
+
280// HAL_NVIC_EnableIRQ(DMA2_Stream2_IRQn);
+
281
+
282 /* USART1 clock reset */
+
283 __HAL_RCC_USART1_FORCE_RESET();
+
284 __HAL_RCC_USART1_RELEASE_RESET();
+
285 }
+
286#endif // USE_USART1
+
287#ifdef USE_USART2
+
288 else if(huart->Instance==USART2)
+
289 {
+
290// /* DMA1 clock enable */
+
291// __HAL_RCC_DMA1_CLK_ENABLE();
+
292// /* DMA interrupt init */
+
293// HAL_NVIC_SetPriority(DMA1_Stream5_IRQn, 0, 0);
+
294// HAL_NVIC_EnableIRQ(DMA1_Stream5_IRQn);
+
295
+
296 /* USART2 clock reset */
+
297 __HAL_RCC_USART2_FORCE_RESET();
+
298 __HAL_RCC_USART2_RELEASE_RESET();
+
299 }
+
300#endif // USE_USART2
+
301#ifdef USE_USART3
+
302 else if(huart->Instance==USART3)
+
303 {
+
304// /* DMA1 clock enable */
+
305// __HAL_RCC_DMA1_CLK_ENABLE();
+
306// /* DMA interrupt init */
+
307// HAL_NVIC_SetPriority(DMA1_Stream1_IRQn, 0, 0);
+
308// HAL_NVIC_EnableIRQ(DMA1_Stream1_IRQn);
+
309
+
310 /* USART3 clock reset */
+
311 __HAL_RCC_USART3_FORCE_RESET();
+
312 __HAL_RCC_USART3_RELEASE_RESET();
+
313 }
+
314#endif // USE_USART3
+
315#ifdef USE_UART4
+
316 else if(huart->Instance==UART4)
+
317 {
+
318// /* DMA1 clock enable */
+
319// __HAL_RCC_DMA1_CLK_ENABLE();
+
320// /* DMA interrupt init */
+
321// HAL_NVIC_SetPriority(DMA1_Stream2_IRQn, 0, 0);
+
322// HAL_NVIC_EnableIRQ(DMA1_Stream2_IRQn);
+
323
+
324 /* UART4 clock reset */
+
325 __HAL_RCC_UART4_FORCE_RESET();
+
326 __HAL_RCC_UART4_RELEASE_RESET();
+
327 }
+
328#endif // USE_UART4
+
329#ifdef USE_UART5
+
330 else if(huart->Instance==UART5)
+
331 {
+
332// /* DMA1 clock enable */
+
333// __HAL_RCC_DMA1_CLK_ENABLE();
+
334// /* DMA interrupt init */
+
335// HAL_NVIC_SetPriority(DMA1_Stream0_IRQn, 0, 0);
+
336// HAL_NVIC_EnableIRQ(DMA1_Stream0_IRQn);
+
337
+
338 /* UART5 clock reset */
+
339 __HAL_RCC_UART5_FORCE_RESET();
+
340 __HAL_RCC_UART5_RELEASE_RESET();
+
341 }
+
342#endif // USE_UART5
+
343#ifdef USE_USART6
+
344 else if(huart->Instance==USART6)
+
345 {
+
346// /* DMA2 clock enable */
+
347// __HAL_RCC_DMA2_CLK_ENABLE();
+
348// /* DMA interrupt init */
+
349// HAL_NVIC_SetPriority(DMA2_Stream1_IRQn, 0, 0);
+
350// HAL_NVIC_EnableIRQ(DMA2_Stream1_IRQn);
+
351
+
352 /* USART6 clock reset */
+
353 __HAL_RCC_USART6_FORCE_RESET();
+
354 __HAL_RCC_USART6_RELEASE_RESET();
+
355 }
+
356#endif // USE_USART6
+
357}
+
+
358
+
359/**
+
360 * @brief Проверка корректности структуры инициализации UART.
+
361 * @param suart Указатель на структуру с настройками UART.
+
362 * @return HAL status.
+
363 */
+
+ +
365{
+
366 // check is settings are valid
+
367 if (!IS_UART_INSTANCE(suart->huart.Instance))
+
368 return HAL_ERROR;
+
369
+
370 if (!IS_UART_BAUDRATE(suart->huart.Init.BaudRate) || (suart->huart.Init.BaudRate == NULL))
+
371 return HAL_ERROR;
+
372
+
373 if (!IS_GPIO_ALL_INSTANCE(suart->GPIOx))
+
374 return HAL_ERROR;
+
375
+
376 if (!IS_GPIO_PIN(suart->GPIO_PIN_RX) && !IS_GPIO_PIN(suart->GPIO_PIN_TX)) // if both pins arent set up
+
377 return HAL_ERROR;
+
378
+
379 return HAL_OK;
+
380}
+
+
381
+
382//------------------------UART INIT FUNCTIONS------------------------
+
383//-------------------------------------------------------------------
+
Заголовочный файл для модуля инициализации портов и работы с ними.
+
void UART_GPIO_Init(GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN_RX, uint16_t GPIO_PIN_TX)
Инициализация GPIO для UART.
+
void UART_DMA_Init(UART_HandleTypeDef *huart, DMA_HandleTypeDef *hdma_rx, DMA_Stream_TypeDef *DMAChannel, uint32_t DMA_CHANNEL_X)
Инициализация DMA для UART.
+
Заголовочный файл для модуля инициализации UART.
+
#define MyLibs_Error_Handler(params)
Error_Handler который будет вызыватся в библиотеке
Definition mylibs_defs.h:31
+
HAL_StatusTypeDef UART_Check_Init_Struct(UART_SettingsTypeDef *suart)
Проверка корректности структуры инициализации UART.
+
void UART_MspDeInit(UART_HandleTypeDef *huart)
Деинициализация тактирования и прерываний UART.
+
void UART_MspInit(UART_HandleTypeDef *huart)
Настройка тактирования и прерываний UART.
+
HAL_StatusTypeDef UART_Base_Init(UART_SettingsTypeDef *suart)
Инициализация UART с помощью структуры UART_SettingsTypeDef.
+
HAL_StatusTypeDef GPIO_Clock_Enable(GPIO_TypeDef *GPIOx)
Включить тактирование порта GPIO.
+
Структура настроек UART.
+
uint32_t DMA_CHANNEL_X
Номер канала DMA (0 если не нужен)
+
DMA_Stream_TypeDef * DMAChannel
Канал DMA (NULL если не нужен)
+
uint16_t GPIO_PIN_RX
Пин приема
+
uint16_t GPIO_PIN_TX
Пин передачи
+
UART_HandleTypeDef huart
HAL handle UART.
+
GPIO_TypeDef * GPIOx
Порт для UART.
+
+
+
+ + + + diff --git a/Doc/html/general__uart_8h.html b/Doc/html/general__uart_8h.html new file mode 100644 index 0000000..90515b1 --- /dev/null +++ b/Doc/html/general__uart_8h.html @@ -0,0 +1,191 @@ + + + + + + + +MyLibs: E:/.WORK/STM32/STM32_ExtendedLibs/MyLibsGeneral/Inc/general_uart.h File Reference + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
MyLibs 1.0 +
+
Расширенные библиотеки для STM32
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
general_uart.h File Reference
+
+
+ +

Заголовочный файл для модуля инициализации UART. +More...

+
#include "mylibs_defs.h"
+
Include dependency graph for general_uart.h:
+
+
+ +
This graph shows which files directly or indirectly include this file:
+
+
+ +
+

Go to the source code of this file.

+ + + + +

+Classes

struct  UART_SettingsTypeDef
 Структура настроек UART. More...
+ + + + + + + + + + + + + + + +

+Macros

#define HAL_UART_MODULE_ENABLED
 Включение HAL UART.
#define USE_USART1
 Включить USART1 в UART_MspInit.
#define USE_USART2
 Включить USART2 в UART_MspInit.
#define USE_USART3
 Включить USART3 в UART_MspInit.
#define USE_UART4
 Включить UART4 в UART_MspInit.
#define USE_UART5
 Включить UART5 в UART_MspInit.
#define USE_USART6
 Включить USART6 в UART_MspInit.
+ + + + + + + + + +

+Functions

HAL_StatusTypeDef UART_Base_Init (UART_SettingsTypeDef *suart)
 Инициализация UART с помощью структуры UART_SettingsTypeDef.
HAL_StatusTypeDef UART_Check_Init_Struct (UART_SettingsTypeDef *suart)
 Проверка корректности структуры инициализации UART.
void UART_MspInit (UART_HandleTypeDef *huart)
 Настройка тактирования и прерываний UART.
void UART_MspDeInit (UART_HandleTypeDef *huart)
 Деинициализация тактирования и прерываний UART.
+

Detailed Description

+

Заголовочный файл для модуля инициализации UART.

+ +

Definition in file general_uart.h.

+
+
+ +
+ + + + diff --git a/Doc/html/general__uart_8h.js b/Doc/html/general__uart_8h.js new file mode 100644 index 0000000..8784c8c --- /dev/null +++ b/Doc/html/general__uart_8h.js @@ -0,0 +1,14 @@ +var general__uart_8h = +[ + [ "HAL_UART_MODULE_ENABLED", "group___u_a_r_t___i_n_i_t.html#ga167269406e73327b95c3bb7b9cfe6d89", null ], + [ "USE_USART1", "group___u_a_r_t___i_n_i_t.html#gace54f148bb1d72f13bf397d096d38d1b", null ], + [ "USE_USART2", "group___u_a_r_t___i_n_i_t.html#gaacb3968508217a0d8b3f64aa0c8aa07d", null ], + [ "USE_USART3", "group___u_a_r_t___i_n_i_t.html#ga6dadd967b428aade24008ec060009976", null ], + [ "USE_UART4", "group___u_a_r_t___i_n_i_t.html#ga779530e93e7aa1f25eb13045ec42b8e7", null ], + [ "USE_UART5", "group___u_a_r_t___i_n_i_t.html#ga592c6bf4a6496d6806ba0838cdfa2340", null ], + [ "USE_USART6", "group___u_a_r_t___i_n_i_t.html#gafaeb8bdd4aa7fb1987505530daa90868", null ], + [ "UART_Base_Init", "group___m_y___l_i_b_s___u_a_r_t.html#gab9f07396b778505c934143e89953e154", null ], + [ "UART_Check_Init_Struct", "group___m_y___l_i_b_s___u_a_r_t.html#ga2a22e46ecb9e04b2ce197a0e9c09044a", null ], + [ "UART_MspInit", "group___m_y___l_i_b_s___u_a_r_t.html#gab9313fd2f9fc6873ca6bfbc5b96edbbb", null ], + [ "UART_MspDeInit", "group___m_y___l_i_b_s___u_a_r_t.html#ga93ed6ceef4e3b5e7885786125cce93bc", null ] +]; \ No newline at end of file diff --git a/Doc/html/general__uart_8h__dep__incl.map b/Doc/html/general__uart_8h__dep__incl.map new file mode 100644 index 0000000..3fc50f2 --- /dev/null +++ b/Doc/html/general__uart_8h__dep__incl.map @@ -0,0 +1,5 @@ + + + + + diff --git a/Doc/html/general__uart_8h__dep__incl.md5 b/Doc/html/general__uart_8h__dep__incl.md5 new file mode 100644 index 0000000..72c181c --- /dev/null +++ b/Doc/html/general__uart_8h__dep__incl.md5 @@ -0,0 +1 @@ +ee757a0889d23a9f20e9362475bd6f5a \ No newline at end of file diff --git a/Doc/html/general__uart_8h__dep__incl.png b/Doc/html/general__uart_8h__dep__incl.png new file mode 100644 index 0000000..7259788 Binary files /dev/null and b/Doc/html/general__uart_8h__dep__incl.png differ diff --git a/Doc/html/general__uart_8h__incl.map b/Doc/html/general__uart_8h__incl.map new file mode 100644 index 0000000..39e2c3f --- /dev/null +++ b/Doc/html/general__uart_8h__incl.map @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Doc/html/general__uart_8h__incl.md5 b/Doc/html/general__uart_8h__incl.md5 new file mode 100644 index 0000000..00ba33d --- /dev/null +++ b/Doc/html/general__uart_8h__incl.md5 @@ -0,0 +1 @@ +26572d8168d54cd9681b4ae6726cb93e \ No newline at end of file diff --git a/Doc/html/general__uart_8h__incl.png b/Doc/html/general__uart_8h__incl.png new file mode 100644 index 0000000..121f85e Binary files /dev/null and b/Doc/html/general__uart_8h__incl.png differ diff --git a/Doc/html/general__uart_8h_source.html b/Doc/html/general__uart_8h_source.html new file mode 100644 index 0000000..144eb8a --- /dev/null +++ b/Doc/html/general__uart_8h_source.html @@ -0,0 +1,286 @@ + + + + + + + +MyLibs: E:/.WORK/STM32/STM32_ExtendedLibs/MyLibsGeneral/Inc/general_uart.h Source File + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
MyLibs 1.0 +
+
Расширенные библиотеки для STM32
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
general_uart.h
+
+
+Go to the documentation of this file.
1/**
+
2**************************************************************************
+
3* @file general_uart.h
+
4* @brief Заголовочный файл для модуля инициализации UART.
+
5**************************************************************************
+
6* @defgroup MY_LIBS_UART UART Tools
+
7* @ingroup MYLIBS_PERIPHERAL
+
8* @brief Функции и макросы для удобной работы с UART.
+
9* @details
+
10Модуль предоставляет функции для базовой инициализации UART
+
11
+
12
+
13@par Пример использования:
+
14@code
+
15// Структура настроек UART
+
16UART_SettingsTypeDef uart2Settings;
+
17
+
18void UART2_Init(void)
+
19{
+
20 // Настройка UART2 с 115200 бод, 8 бит, 1 стоп-бит, без паритета
+
21 uart2Settings.huart.Instance = USART2;
+
22 uart2Settings.huart.Init.BaudRate = 115200;
+
23 uart2Settings.huart.Init.WordLength = UART_WORDLENGTH_8B;
+
24 uart2Settings.huart.Init.StopBits = UART_STOPBITS_1;
+
25 uart2Settings.huart.Init.Parity = UART_PARITY_NONE;
+
26 uart2Settings.huart.Init.Mode = UART_MODE_TX_RX;
+
27 uart2Settings.huart.Init.HwFlowCtl = UART_HWCONTROL_NONE;
+
28 uart2Settings.huart.Init.OverSampling = UART_OVERSAMPLING_16;
+
29
+
30 // Настройка GPIO
+
31 uart2Settings.GPIOx = GPIOA;
+
32 uart2Settings.GPIO_PIN_TX = GPIO_PIN_2;
+
33 uart2Settings.GPIO_PIN_RX = GPIO_PIN_3;
+
34
+
35 // DMA не используется в этом примере
+
36 uart2Settings.DMAChannel = NULL;
+
37 uart2Settings.DMA_CHANNEL_X = 0;
+
38
+
39 // Инициализация UART
+
40 if(UART_Base_Init(&uart2Settings) != HAL_OK)
+
41 {
+
42 // Обработка ошибки
+
43 Error_Handler();
+
44 }
+
45}
+
46@endcode
+
47
+
48* @note Требуется подключение модуля UART в библиотеке HAL
+
49@code
+
50#define HAL_UART_MODULE_ENABLED
+
51@endcode
+
52* @{
+
53*************************************************************************/
+
54#ifndef __UART_GENERAL_H_
+
55#define __UART_GENERAL_H_
+
56
+
57/////////////////////////////////////////////////////////////////////
+
58/////////////////////////---USER SETTINGS---/////////////////////////
+
59/**
+
60 * @addtogroup UART_INIT Init defines
+
61 * @ingroup MY_LIBS_UART
+
62 * @brief Настройка UART
+
63 * @{
+
64 */
+
65#define HAL_UART_MODULE_ENABLED ///< Включение HAL UART
+
66
+
67#define USE_USART1 ///< Включить USART1 в @ref UART_MspInit
+
68#define USE_USART2 ///< Включить USART2 в @ref UART_MspInit
+
69#define USE_USART3 ///< Включить USART3 в @ref UART_MspInit
+
70#define USE_UART4 ///< Включить UART4 в @ref UART_MspInit
+
71#define USE_UART5 ///< Включить UART5 в @ref UART_MspInit
+
72#define USE_USART6 ///< Включить USART6 в @ref UART_MspInit
+
73/** UART_INIT
+
74 * @}
+
75 */
+
76/////////////////////////---USER SETTINGS---/////////////////////////
+
77#include "mylibs_defs.h"
+
78
+
79
+
80
+
81/////////////////////////////////////////////////////////////////////
+
82////////////////////////////---DEFINES---////////////////////////////
+
83
+
84
+
85
+
86////////////////////////////---DEFINES---////////////////////////////
+
87
+
88
+
89/////////////////////////////////////////////////////////////////////
+
90///////////////////////---STRUCTURES & ENUMS---//////////////////////
+
91/**
+
92 * @brief Структура настроек UART
+
93 * @details Содержит все необходимые параметры для инициализации UART,
+
94 * включая GPIO и DMA.
+
95 */
+
+
96typedef struct
+
97{
+
98 UART_HandleTypeDef huart; ///< HAL handle UART
+
99
+
100 GPIO_TypeDef *GPIOx; ///< Порт для UART
+
101 uint16_t GPIO_PIN_RX; ///< Пин приема
+
102 uint16_t GPIO_PIN_TX; ///< Пин передачи
+
103
+
104 DMA_Stream_TypeDef *DMAChannel; ///< Канал DMA (NULL если не нужен)
+
105 uint32_t DMA_CHANNEL_X; ///< Номер канала DMA (0 если не нужен)
+
106
+ +
+
108
+
109///////////////////////---STRUCTURES & ENUMS---//////////////////////
+
110
+
111
+
112/////////////////////////////////////////////////////////////////////
+
113///////////////////////////---FUNCTIONS---///////////////////////////
+
114
+
115/* Инициализация UART с использованием структуры настроек */
+
116HAL_StatusTypeDef UART_Base_Init(UART_SettingsTypeDef *suart);
+
117
+
118/* Проверка корректности структуры настроек UART */
+
119HAL_StatusTypeDef UART_Check_Init_Struct(UART_SettingsTypeDef *suart);
+
120
+
121/* Инициализация тактирования и прерываний для выбранного UART */
+
122void UART_MspInit(UART_HandleTypeDef *huart);
+
123
+
124/* Деинициализация тактирования и прерываний для выбранного UART */
+
125void UART_MspDeInit(UART_HandleTypeDef *huart);
+
126
+
127
+
128/**
+
129 * @cond UART_INTERNAL
+
130 */
+
131
+
132/* Настройка GPIO для UART */
+
133void UART_GPIO_Init(GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN_RX, uint16_t GPIO_PIN_TX);
+
134
+
135/* Настройка DMA для UART */
+
136void UART_DMA_Init(UART_HandleTypeDef *huart, DMA_HandleTypeDef *hdma_rx, DMA_Stream_TypeDef *DMAChannel, uint32_t DMA_CHANNEL_X);
+
137
+
138#ifndef __USER_LINKDMA
+
139/**
+
140 * @brief Аналог HAL макроса для привязки DMA к UART.
+
141 * @note @ref __HAL_LINKDMA.
+
142 */
+
143#define __USER_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \
+
144do{ \
+
145(__HANDLE__)->__PPP_DMA_FIELD__ = (__DMA_HANDLE__); \
+
146(__DMA_HANDLE__)->Parent = (__HANDLE__);} while(0U)
+
147#endif
+
148
+
149/** @endcond */
+
150///////////////////////////---FUNCTIONS---///////////////////////////
+
151
+
152#endif // __UART_GENERAL_H_
+
153
+
154/** MY_LIBS_UART
+
155 * @}
+
156 */
+
void UART_GPIO_Init(GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN_RX, uint16_t GPIO_PIN_TX)
Инициализация GPIO для UART.
+
void UART_DMA_Init(UART_HandleTypeDef *huart, DMA_HandleTypeDef *hdma_rx, DMA_Stream_TypeDef *DMAChannel, uint32_t DMA_CHANNEL_X)
Инициализация DMA для UART.
+
HAL_StatusTypeDef UART_Check_Init_Struct(UART_SettingsTypeDef *suart)
Проверка корректности структуры инициализации UART.
+
void UART_MspDeInit(UART_HandleTypeDef *huart)
Деинициализация тактирования и прерываний UART.
+
void UART_MspInit(UART_HandleTypeDef *huart)
Настройка тактирования и прерываний UART.
+
HAL_StatusTypeDef UART_Base_Init(UART_SettingsTypeDef *suart)
Инициализация UART с помощью структуры UART_SettingsTypeDef.
+
Заголочный файл для дефайнов библиотеки MyLibsGeneral.
+
Структура настроек UART.
+
uint32_t DMA_CHANNEL_X
Номер канала DMA (0 если не нужен)
+
DMA_Stream_TypeDef * DMAChannel
Канал DMA (NULL если не нужен)
+
uint16_t GPIO_PIN_RX
Пин приема
+
uint16_t GPIO_PIN_TX
Пин передачи
+
UART_HandleTypeDef huart
HAL handle UART.
+
GPIO_TypeDef * GPIOx
Порт для UART.
+
+
+
+ + + + diff --git a/Doc/html/group___m_y___l_i_b_s___s_p_i.html b/Doc/html/group___m_y___l_i_b_s___s_p_i.html new file mode 100644 index 0000000..2d9633d --- /dev/null +++ b/Doc/html/group___m_y___l_i_b_s___s_p_i.html @@ -0,0 +1,328 @@ + + + + + + + +MyLibs: SPI Tools + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
MyLibs 1.0 +
+
Расширенные библиотеки для STM32
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
SPI Tools
+
+
+ +

Функции и макросы для удобной работы с SPI. +More...

+
Collaboration diagram for SPI Tools:
+
+
+ + + + + +

+Topics

 Init defines
 Настройка SPI.
+ + + +

+Classes

struct  SPI_SettingsTypeDef
 Структура настроек SPI. More...
+ + + + + + + + + +

+Functions

HAL_StatusTypeDef SPI_Base_Init (SPI_SettingsTypeDef *sspi)
 Инициализация SPI с помощью структуры SPI_SettingsTypeDef.
HAL_StatusTypeDef SPI_Check_Init_Struct (SPI_SettingsTypeDef *sspi)
 Проверка корректности структуры инициализации SPI.
void SPI_MspInit (SPI_HandleTypeDef *hspi)
 Настройка тактирования и прерываний SPI.
void SPI_MspDeInit (SPI_HandleTypeDef *hspi)
 Деинициализация тактирования и прерываний SPI.
+

Detailed Description

+

Функции и макросы для удобной работы с SPI.

+

Модуль предоставляет функции для базовой инициализации SPI

+
Пример использования:
// Структура настроек SPI
+
SPI_SettingsTypeDef spi1Settings;
+
+
void SPI1_Init(void)
+
{
+
// Настройка SPI1 как Master, 8 бит, полный дуплекс
+
spi1Settings.hspi.Instance = SPI1;
+
spi1Settings.hspi.Init.Mode = SPI_MODE_MASTER;
+
spi1Settings.hspi.Init.Direction = SPI_DIRECTION_2LINES;
+
spi1Settings.hspi.Init.DataSize = SPI_DATASIZE_8BIT;
+
spi1Settings.hspi.Init.CLKPolarity = SPI_POLARITY_LOW;
+
spi1Settings.hspi.Init.CLKPhase = SPI_PHASE_1EDGE;
+
spi1Settings.hspi.Init.NSS = SPI_NSS_SOFT;
+
spi1Settings.hspi.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_16;
+
spi1Settings.hspi.Init.FirstBit = SPI_FIRSTBIT_MSB;
+
spi1Settings.hspi.Init.TIMode = SPI_TIMODE_DISABLE;
+
spi1Settings.hspi.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
+
+
// Настройка GPIO
+
spi1Settings.CLK_GPIOx = GPIOA;
+
spi1Settings.CLK_PIN = GPIO_PIN_5;
+
spi1Settings.CLK_GPIO_AlternageFunc = GPIO_AF5_SPI1;
+
+
spi1Settings.MISO_GPIOx = GPIOA;
+
spi1Settings.MISO_PIN = GPIO_PIN_6;
+
spi1Settings.MISO_GPIO_AlternageFunc = GPIO_AF5_SPI1;
+
+
spi1Settings.MOSI_GPIOx = GPIOA;
+
spi1Settings.MOSI_PIN = GPIO_PIN_7;
+
spi1Settings.MOSI_GPIO_AlternageFunc = GPIO_AF5_SPI1;
+
+
// Инициализация SPI
+
if(SPI_Base_Init(&spi1Settings) != HAL_OK)
+
{
+
// Обработка ошибки
+
Error_Handler();
+
}
+
}
+
HAL_StatusTypeDef SPI_Base_Init(SPI_SettingsTypeDef *sspi)
Инициализация SPI с помощью структуры SPI_SettingsTypeDef.
Definition general_spi.c:28
+
Структура настроек SPI.
+
GPIO_TypeDef * MOSI_GPIOx
Порт MOSI.
+
GPIO_TypeDef * MISO_GPIOx
Порт MISO.
+
uint32_t MISO_PIN
Пин MISO.
+
uint32_t CLK_PIN
Пин CLK.
+
uint32_t CLK_GPIO_AlternageFunc
Альтернативная функция для CLK.
+
GPIO_TypeDef * CLK_GPIOx
Порт CLK.
+
uint32_t MOSI_PIN
Пин MOSI.
+
SPI_HandleTypeDef hspi
HAL handle SPI.
+
uint32_t MISO_GPIO_AlternageFunc
Альтернативная функция для MISO.
+
uint32_t MOSI_GPIO_AlternageFunc
Альтернативная функция для MOSI.
+
+
Note
Требуется подключение модуля SPI в библиотеке HAL
#define HAL_SPI_MODULE_ENABLED
+
+

Function Documentation

+ +

◆ SPI_Base_Init()

+ +
+
+ + + + + + + +
HAL_StatusTypeDef SPI_Base_Init (SPI_SettingsTypeDef * sspi)
+
+ +

Инициализация SPI с помощью структуры SPI_SettingsTypeDef.

+
Parameters
+ + +
sspiУказатель на структуру с настройками SPI.
+
+
+
Returns
HAL status.
+


+ Инициализирует SPI и его GPIO. Настройка аналогична HAL_SPI_Init

suart.hspi.Init...
+

но дополнительно надо прописать пины CLK/MISO/MOSI SPI_SettingsTypeDef

+ +

Definition at line 28 of file general_spi.c.

+ +
+
+ +

◆ SPI_Check_Init_Struct()

+ +
+
+ + + + + + + +
HAL_StatusTypeDef SPI_Check_Init_Struct (SPI_SettingsTypeDef * sspi)
+
+ +

Проверка корректности структуры инициализации SPI.

+
Parameters
+ + +
sspiУказатель на структуру с настройками SPI.
+
+
+
Returns
HAL status.
+ +

Definition at line 246 of file general_spi.c.

+ +
+
+ +

◆ SPI_MspInit()

+ +
+
+ + + + + + + +
void SPI_MspInit (SPI_HandleTypeDef * hspi)
+
+ +

Настройка тактирования и прерываний SPI.

+
Parameters
+ + +
hspiУказатель на хендл SPI.
+
+
+
Note
Чтобы не генерировать функцию с иницилизацией неиспользуемых SPI, дефайнами Init defines в general_spi.h определяются используемые SPI.
+ +

Definition at line 127 of file general_spi.c.

+ +
+
+ +

◆ SPI_MspDeInit()

+ +
+
+ + + + + + + +
void SPI_MspDeInit (SPI_HandleTypeDef * hspi)
+
+ +

Деинициализация тактирования и прерываний SPI.

+
Parameters
+ + +
hspiУказатель на хендл SPI.
+
+
+
Note
Чтобы не генерировать функцию с иницилизацией неиспользуемых SPI, дефайнами Init defines в general_spi.h определяются используемые SPI.
+ +

Definition at line 191 of file general_spi.c.

+ +
+
+
+
+ +
+ + + + diff --git a/Doc/html/group___m_y___l_i_b_s___s_p_i.js b/Doc/html/group___m_y___l_i_b_s___s_p_i.js new file mode 100644 index 0000000..4a4c6ec --- /dev/null +++ b/Doc/html/group___m_y___l_i_b_s___s_p_i.js @@ -0,0 +1,22 @@ +var group___m_y___l_i_b_s___s_p_i = +[ + [ "Init defines", "group___s_p_i___i_n_i_t.html", "group___s_p_i___i_n_i_t" ], + [ "SPI_SettingsTypeDef", "struct_s_p_i___settings_type_def.html", [ + [ "hspi", "struct_s_p_i___settings_type_def.html#ad203d8b8d67e4f477d002d15b03ba422", null ], + [ "CLK_GPIOx", "struct_s_p_i___settings_type_def.html#a6a15d48eccf92959de3a086031fdc979", null ], + [ "CLK_PIN", "struct_s_p_i___settings_type_def.html#a3bcb1ed12da3544e02e6d36493669bdc", null ], + [ "CLK_GPIO_AlternageFunc", "struct_s_p_i___settings_type_def.html#a3f3748103a0b7861f6700042fd691ba1", null ], + [ "MISO_GPIOx", "struct_s_p_i___settings_type_def.html#a0d55a2941854f61934487f3d209cfa95", null ], + [ "MISO_PIN", "struct_s_p_i___settings_type_def.html#a3366c654d7ec6dd41c6a0b504dc8509a", null ], + [ "MISO_GPIO_AlternageFunc", "struct_s_p_i___settings_type_def.html#aecd7a5c6e205335b8ed229d74cd35d14", null ], + [ "MOSI_GPIOx", "struct_s_p_i___settings_type_def.html#a0af3bdb273818ff97eb4ff3cff918820", null ], + [ "MOSI_PIN", "struct_s_p_i___settings_type_def.html#a961208869faf4a7369aaf4edde75f176", null ], + [ "MOSI_GPIO_AlternageFunc", "struct_s_p_i___settings_type_def.html#afbe75a1c36650a4a9b41fa706a4c7eab", null ], + [ "DMAChannel", "struct_s_p_i___settings_type_def.html#a3cfd9469b0617a68bbd2a161ba06bb95", null ], + [ "DMA_CHANNEL_X", "struct_s_p_i___settings_type_def.html#aa0edaa145076d2383b3e0095d156d474", null ] + ] ], + [ "SPI_Base_Init", "group___m_y___l_i_b_s___s_p_i.html#ga0e177e3c57a8fcdc73b5602e72ec66ba", null ], + [ "SPI_Check_Init_Struct", "group___m_y___l_i_b_s___s_p_i.html#ga333dd251bc878931086d48aa932b1a5f", null ], + [ "SPI_MspInit", "group___m_y___l_i_b_s___s_p_i.html#gab9f13318daf02bc5b5f302ae392dccac", null ], + [ "SPI_MspDeInit", "group___m_y___l_i_b_s___s_p_i.html#gac279cc3eaa35541edfe330a1844a85e4", null ] +]; \ No newline at end of file diff --git a/Doc/html/group___m_y___l_i_b_s___s_p_i.map b/Doc/html/group___m_y___l_i_b_s___s_p_i.map new file mode 100644 index 0000000..faa73b4 --- /dev/null +++ b/Doc/html/group___m_y___l_i_b_s___s_p_i.map @@ -0,0 +1,5 @@ + + + + + diff --git a/Doc/html/group___m_y___l_i_b_s___s_p_i.md5 b/Doc/html/group___m_y___l_i_b_s___s_p_i.md5 new file mode 100644 index 0000000..85e5c62 --- /dev/null +++ b/Doc/html/group___m_y___l_i_b_s___s_p_i.md5 @@ -0,0 +1 @@ +b9d2d820e20d54c87d46b9628c5b5f42 \ No newline at end of file diff --git a/Doc/html/group___m_y___l_i_b_s___s_p_i.png b/Doc/html/group___m_y___l_i_b_s___s_p_i.png new file mode 100644 index 0000000..0f1a90d Binary files /dev/null and b/Doc/html/group___m_y___l_i_b_s___s_p_i.png differ diff --git a/Doc/html/group___m_y___l_i_b_s___u_a_r_t.html b/Doc/html/group___m_y___l_i_b_s___u_a_r_t.html new file mode 100644 index 0000000..4d3bf39 --- /dev/null +++ b/Doc/html/group___m_y___l_i_b_s___u_a_r_t.html @@ -0,0 +1,317 @@ + + + + + + + +MyLibs: UART Tools + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
MyLibs 1.0 +
+
Расширенные библиотеки для STM32
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
UART Tools
+
+
+ +

Функции и макросы для удобной работы с UART. +More...

+
Collaboration diagram for UART Tools:
+
+
+ + + + + +

+Topics

 Init defines
 Настройка UART.
+ + + +

+Classes

struct  UART_SettingsTypeDef
 Структура настроек UART. More...
+ + + + + + + + + +

+Functions

HAL_StatusTypeDef UART_Base_Init (UART_SettingsTypeDef *suart)
 Инициализация UART с помощью структуры UART_SettingsTypeDef.
HAL_StatusTypeDef UART_Check_Init_Struct (UART_SettingsTypeDef *suart)
 Проверка корректности структуры инициализации UART.
void UART_MspInit (UART_HandleTypeDef *huart)
 Настройка тактирования и прерываний UART.
void UART_MspDeInit (UART_HandleTypeDef *huart)
 Деинициализация тактирования и прерываний UART.
+

Detailed Description

+

Функции и макросы для удобной работы с UART.

+

Модуль предоставляет функции для базовой инициализации UART

+
Пример использования:
// Структура настроек UART
+
UART_SettingsTypeDef uart2Settings;
+
+
void UART2_Init(void)
+
{
+
// Настройка UART2 с 115200 бод, 8 бит, 1 стоп-бит, без паритета
+
uart2Settings.huart.Instance = USART2;
+
uart2Settings.huart.Init.BaudRate = 115200;
+
uart2Settings.huart.Init.WordLength = UART_WORDLENGTH_8B;
+
uart2Settings.huart.Init.StopBits = UART_STOPBITS_1;
+
uart2Settings.huart.Init.Parity = UART_PARITY_NONE;
+
uart2Settings.huart.Init.Mode = UART_MODE_TX_RX;
+
uart2Settings.huart.Init.HwFlowCtl = UART_HWCONTROL_NONE;
+
uart2Settings.huart.Init.OverSampling = UART_OVERSAMPLING_16;
+
+
// Настройка GPIO
+
uart2Settings.GPIOx = GPIOA;
+
uart2Settings.GPIO_PIN_TX = GPIO_PIN_2;
+
uart2Settings.GPIO_PIN_RX = GPIO_PIN_3;
+
+
// DMA не используется в этом примере
+
uart2Settings.DMAChannel = NULL;
+
uart2Settings.DMA_CHANNEL_X = 0;
+
+
// Инициализация UART
+
if(UART_Base_Init(&uart2Settings) != HAL_OK)
+
{
+
// Обработка ошибки
+
Error_Handler();
+
}
+
}
+
HAL_StatusTypeDef UART_Base_Init(UART_SettingsTypeDef *suart)
Инициализация UART с помощью структуры UART_SettingsTypeDef.
+
Структура настроек UART.
+
uint32_t DMA_CHANNEL_X
Номер канала DMA (0 если не нужен)
+
DMA_Stream_TypeDef * DMAChannel
Канал DMA (NULL если не нужен)
+
uint16_t GPIO_PIN_RX
Пин приема
+
uint16_t GPIO_PIN_TX
Пин передачи
+
UART_HandleTypeDef huart
HAL handle UART.
+
GPIO_TypeDef * GPIOx
Порт для UART.
+
+
Note
Требуется подключение модуля UART в библиотеке HAL
#define HAL_UART_MODULE_ENABLED
+
+

Function Documentation

+ +

◆ UART_Base_Init()

+ +
+
+ + + + + + + +
HAL_StatusTypeDef UART_Base_Init (UART_SettingsTypeDef * suart)
+
+ +

Инициализация UART с помощью структуры UART_SettingsTypeDef.

+
Parameters
+ + +
suartУказатель на структуру с настройками UART.
+
+
+
Returns
HAL status.
+


+ Инициализирует UART и его GPIO и при необходимости DMA. Настройка аналогична HAL_UART_Init

suart.huart.Init...
+

но дополнительно надо прописать пины RX/TX UART_SettingsTypeDef

suart->GPIOx, suart->GPIO_PIN_RX, suart->GPIO_PIN_TX
+
+

Definition at line 32 of file general_uart.c.

+ +
+
+ +

◆ UART_Check_Init_Struct()

+ +
+
+ + + + + + + +
HAL_StatusTypeDef UART_Check_Init_Struct (UART_SettingsTypeDef * suart)
+
+ +

Проверка корректности структуры инициализации UART.

+
Parameters
+ + +
suartУказатель на структуру с настройками UART.
+
+
+
Returns
HAL status.
+ +

Definition at line 364 of file general_uart.c.

+ +
+
+ +

◆ UART_MspInit()

+ +
+
+ + + + + + + +
void UART_MspInit (UART_HandleTypeDef * huart)
+
+ +

Настройка тактирования и прерываний UART.

+
Parameters
+ + +
huartУказатель на хендл UART.
+
+
+
Note
Чтобы не генерировать функцию с иницилизацией неиспользуемых UART, дефайнами Init defines в general_uart.h определяются используемые UART.
+ +

Definition at line 146 of file general_uart.c.

+ +
+
+ +

◆ UART_MspDeInit()

+ +
+
+ + + + + + + +
void UART_MspDeInit (UART_HandleTypeDef * huart)
+
+ +

Деинициализация тактирования и прерываний UART.

+
Parameters
+ + +
huartУказатель на хендл UART.
+
+
+
Note
Чтобы не генерировать функцию с деиницилизацией неиспользуемых UART, дефайнами Init defines в general_uart.h определяются используемые UART.
+ +

Definition at line 267 of file general_uart.c.

+ +
+
+
+
+ +
+ + + + diff --git a/Doc/html/group___m_y___l_i_b_s___u_a_r_t.js b/Doc/html/group___m_y___l_i_b_s___u_a_r_t.js new file mode 100644 index 0000000..c634bfd --- /dev/null +++ b/Doc/html/group___m_y___l_i_b_s___u_a_r_t.js @@ -0,0 +1,16 @@ +var group___m_y___l_i_b_s___u_a_r_t = +[ + [ "Init defines", "group___u_a_r_t___i_n_i_t.html", "group___u_a_r_t___i_n_i_t" ], + [ "UART_SettingsTypeDef", "struct_u_a_r_t___settings_type_def.html", [ + [ "huart", "struct_u_a_r_t___settings_type_def.html#accf2c9448a3ea8eb3b8c25a569276fea", null ], + [ "GPIOx", "struct_u_a_r_t___settings_type_def.html#af6f9910d065bae715cdb4a1024143a8f", null ], + [ "GPIO_PIN_RX", "struct_u_a_r_t___settings_type_def.html#a3fba2b52788fe453348b5d92ed52ba49", null ], + [ "GPIO_PIN_TX", "struct_u_a_r_t___settings_type_def.html#a5f1babfcfb436cd77f5614253c0a5bef", null ], + [ "DMAChannel", "struct_u_a_r_t___settings_type_def.html#a1ecc9ac6a1d2747ade56770cbab6a613", null ], + [ "DMA_CHANNEL_X", "struct_u_a_r_t___settings_type_def.html#a15ce92b03f7f189bfbe1ab88a5f94d19", null ] + ] ], + [ "UART_Base_Init", "group___m_y___l_i_b_s___u_a_r_t.html#gab9f07396b778505c934143e89953e154", null ], + [ "UART_Check_Init_Struct", "group___m_y___l_i_b_s___u_a_r_t.html#ga2a22e46ecb9e04b2ce197a0e9c09044a", null ], + [ "UART_MspInit", "group___m_y___l_i_b_s___u_a_r_t.html#gab9313fd2f9fc6873ca6bfbc5b96edbbb", null ], + [ "UART_MspDeInit", "group___m_y___l_i_b_s___u_a_r_t.html#ga93ed6ceef4e3b5e7885786125cce93bc", null ] +]; \ No newline at end of file diff --git a/Doc/html/group___m_y___l_i_b_s___u_a_r_t.map b/Doc/html/group___m_y___l_i_b_s___u_a_r_t.map new file mode 100644 index 0000000..52ecc7e --- /dev/null +++ b/Doc/html/group___m_y___l_i_b_s___u_a_r_t.map @@ -0,0 +1,5 @@ + + + + + diff --git a/Doc/html/group___m_y___l_i_b_s___u_a_r_t.md5 b/Doc/html/group___m_y___l_i_b_s___u_a_r_t.md5 new file mode 100644 index 0000000..9c19d2c --- /dev/null +++ b/Doc/html/group___m_y___l_i_b_s___u_a_r_t.md5 @@ -0,0 +1 @@ +5475854d3a1c20af70a164c6fe76463e \ No newline at end of file diff --git a/Doc/html/group___m_y___l_i_b_s___u_a_r_t.png b/Doc/html/group___m_y___l_i_b_s___u_a_r_t.png new file mode 100644 index 0000000..e70bae8 Binary files /dev/null and b/Doc/html/group___m_y___l_i_b_s___u_a_r_t.png differ diff --git a/Doc/html/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.html b/Doc/html/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.html new file mode 100644 index 0000000..b3953b2 --- /dev/null +++ b/Doc/html/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.html @@ -0,0 +1,273 @@ + + + + + + + +MyLibs: General tools + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
MyLibs 1.0 +
+
Расширенные библиотеки для STM32
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
General tools
+
+
+ +

Функции для базовой инициализации UART. +More...

+
Collaboration diagram for General tools:
+
+
+ + + + + +

+Topics

 Init defines
 Настройка UART.
+ + + +

+Classes

struct  UART_SettingsTypeDef
 Структура настроек UART. More...
+ + + + + + + + + +

+Functions

HAL_StatusTypeDef UART_Base_Init (UART_SettingsTypeDef *suart)
 Инициализация UART с помощью структуры UART_SettingsTypeDef.
HAL_StatusTypeDef Check_UART_Init_Struct (UART_SettingsTypeDef *suart)
 Проверка корректности структуры инициализации UART.
void UART_MspInit (UART_HandleTypeDef *huart)
 Настройка тактирования и прерываний UART.
void UART_MspDeInit (UART_HandleTypeDef *huart)
 Deinitialize UART & DMA clock and interrupt.
+

Detailed Description

+

Функции для базовой инициализации UART.

+

Function Documentation

+ +

◆ UART_Base_Init()

+ +
+
+ + + + + + + +
HAL_StatusTypeDef UART_Base_Init (UART_SettingsTypeDef * suart)
+
+ +

Инициализация UART с помощью структуры UART_SettingsTypeDef.

+
Parameters
+ + +
suartУказатель на структуру с настройками UART.
+
+
+
Returns
HAL status.
+


+ Инициализирует UART и при необходимости его GPIO и DMA.

+ +

Definition at line 24 of file general_uart.c.

+ +
+
+ +

◆ Check_UART_Init_Struct()

+ +
+
+ + + + + + + +
HAL_StatusTypeDef Check_UART_Init_Struct (UART_SettingsTypeDef * suart)
+
+ +

Проверка корректности структуры инициализации UART.

+
Parameters
+ + +
suartУказатель на структуру с настройками UART.
+
+
+
Returns
HAL status.
+ +

Definition at line 356 of file general_uart.c.

+ +
+
+ +

◆ UART_MspInit()

+ +
+
+ + + + + + + +
void UART_MspInit (UART_HandleTypeDef * huart)
+
+ +

Настройка тактирования и прерываний UART.

+
Parameters
+ + +
huartУказатель на хендл UART.
+
+
+
Note
Чтобы не генерировать функцию с иницилизацией неиспользуемых UART, дефайнами Init defines в general_uart.h определяются используемые UART.
+ +

Definition at line 138 of file general_uart.c.

+ +
+
+ +

◆ UART_MspDeInit()

+ +
+
+ + + + + + + +
void UART_MspDeInit (UART_HandleTypeDef * huart)
+
+ +

Deinitialize UART & DMA clock and interrupt.

+
Parameters
+ + +
huart- указатель на хендл UART для деинициализации.
+
+
+
Note
Чтобы не генерировать функцию с деиницилизацией неиспользуемых UART, дефайнами Init defines в general_uart.h определяются используемые UART.
+ +

Definition at line 259 of file general_uart.c.

+ +
+
+
+
+ +
+ + + + diff --git a/Doc/html/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.js b/Doc/html/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.js new file mode 100644 index 0000000..05466b3 --- /dev/null +++ b/Doc/html/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.js @@ -0,0 +1,16 @@ +var group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l = +[ + [ "Init defines", "group___u_a_r_t___i_n_i_t.html", "group___u_a_r_t___i_n_i_t" ], + [ "UART_SettingsTypeDef", "struct_u_a_r_t___settings_type_def.html", [ + [ "huart", "struct_u_a_r_t___settings_type_def.html#accf2c9448a3ea8eb3b8c25a569276fea", null ], + [ "GPIOx", "struct_u_a_r_t___settings_type_def.html#af6f9910d065bae715cdb4a1024143a8f", null ], + [ "GPIO_PIN_RX", "struct_u_a_r_t___settings_type_def.html#a3fba2b52788fe453348b5d92ed52ba49", null ], + [ "GPIO_PIN_TX", "struct_u_a_r_t___settings_type_def.html#a5f1babfcfb436cd77f5614253c0a5bef", null ], + [ "DMAChannel", "struct_u_a_r_t___settings_type_def.html#a1ecc9ac6a1d2747ade56770cbab6a613", null ], + [ "DMA_CHANNEL_X", "struct_u_a_r_t___settings_type_def.html#a15ce92b03f7f189bfbe1ab88a5f94d19", null ] + ] ], + [ "UART_Base_Init", "group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.html#gab9f07396b778505c934143e89953e154", null ], + [ "Check_UART_Init_Struct", "group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.html#gac9c27133622dfaf1f43683f4edf0ff65", null ], + [ "UART_MspInit", "group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.html#gab9313fd2f9fc6873ca6bfbc5b96edbbb", null ], + [ "UART_MspDeInit", "group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.html#ga93ed6ceef4e3b5e7885786125cce93bc", null ] +]; \ No newline at end of file diff --git a/Doc/html/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.map b/Doc/html/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.map new file mode 100644 index 0000000..7cd0297 --- /dev/null +++ b/Doc/html/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.map @@ -0,0 +1,5 @@ + + + + + diff --git a/Doc/html/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.md5 b/Doc/html/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.md5 new file mode 100644 index 0000000..7716970 --- /dev/null +++ b/Doc/html/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.md5 @@ -0,0 +1 @@ +e6d1f13a7d892bfe12b1137f7c4b33fa \ No newline at end of file diff --git a/Doc/html/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.png b/Doc/html/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.png new file mode 100644 index 0000000..35db670 Binary files /dev/null and b/Doc/html/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.png differ diff --git a/Doc/html/group___s_p_i___i_n_i_t.html b/Doc/html/group___s_p_i___i_n_i_t.html new file mode 100644 index 0000000..c62b59e --- /dev/null +++ b/Doc/html/group___s_p_i___i_n_i_t.html @@ -0,0 +1,220 @@ + + + + + + + +MyLibs: Init defines + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
MyLibs 1.0 +
+
Расширенные библиотеки для STM32
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Init defines
+
+
+ +

Настройка SPI. +More...

+
Collaboration diagram for Init defines:
+
+
+ + + + + + + + + + + +

+Macros

#define HAL_SPI_MODULE_ENABLED
 Включение HAL SPI.
#define USE_SPI1
 Включить SPI1 в SPI_MspInit.
#define USE_SPI2
 Включить SPI2 в SPI_MspInit.
#define USE_SPI3
 Включить SPI3 в SPI_MspInit.
+

Detailed Description

+

Настройка SPI.

+

Macro Definition Documentation

+ +

◆ HAL_SPI_MODULE_ENABLED

+ +
+
+ + + + +
#define HAL_SPI_MODULE_ENABLED
+
+ +

Включение HAL SPI.

+ +

Definition at line 75 of file general_spi.h.

+ +
+
+ +

◆ USE_SPI1

+ +
+
+ + + + +
#define USE_SPI1
+
+ +

Включить SPI1 в SPI_MspInit.

+ +

Definition at line 77 of file general_spi.h.

+ +
+
+ +

◆ USE_SPI2

+ +
+
+ + + + +
#define USE_SPI2
+
+ +

Включить SPI2 в SPI_MspInit.

+ +

Definition at line 78 of file general_spi.h.

+ +
+
+ +

◆ USE_SPI3

+ +
+
+ + + + +
#define USE_SPI3
+
+ +

Включить SPI3 в SPI_MspInit.

+ +

Definition at line 79 of file general_spi.h.

+ +
+
+
+
+ +
+ + + + diff --git a/Doc/html/group___s_p_i___i_n_i_t.js b/Doc/html/group___s_p_i___i_n_i_t.js new file mode 100644 index 0000000..84da224 --- /dev/null +++ b/Doc/html/group___s_p_i___i_n_i_t.js @@ -0,0 +1,7 @@ +var group___s_p_i___i_n_i_t = +[ + [ "HAL_SPI_MODULE_ENABLED", "group___s_p_i___i_n_i_t.html#ga8ad4712bf4add56892d057778e826e0c", null ], + [ "USE_SPI1", "group___s_p_i___i_n_i_t.html#ga2fe0c8aeb2c61679f32836fef479eedf", null ], + [ "USE_SPI2", "group___s_p_i___i_n_i_t.html#ga53687cddb8e39e76a79b8ffaa152fb2b", null ], + [ "USE_SPI3", "group___s_p_i___i_n_i_t.html#ga5fdd6e5934a8005ef05b80f6d95883dc", null ] +]; \ No newline at end of file diff --git a/Doc/html/group___s_p_i___i_n_i_t.map b/Doc/html/group___s_p_i___i_n_i_t.map new file mode 100644 index 0000000..8b71b63 --- /dev/null +++ b/Doc/html/group___s_p_i___i_n_i_t.map @@ -0,0 +1,4 @@ + + + + diff --git a/Doc/html/group___s_p_i___i_n_i_t.md5 b/Doc/html/group___s_p_i___i_n_i_t.md5 new file mode 100644 index 0000000..fe2e1ed --- /dev/null +++ b/Doc/html/group___s_p_i___i_n_i_t.md5 @@ -0,0 +1 @@ +a5fee9e01f339403bf93347eac092de0 \ No newline at end of file diff --git a/Doc/html/group___s_p_i___i_n_i_t.png b/Doc/html/group___s_p_i___i_n_i_t.png new file mode 100644 index 0000000..ff54ab3 Binary files /dev/null and b/Doc/html/group___s_p_i___i_n_i_t.png differ diff --git a/Doc/html/group___u_a_r_t___i_n_i_t.html b/Doc/html/group___u_a_r_t___i_n_i_t.html new file mode 100644 index 0000000..d8e1f06 --- /dev/null +++ b/Doc/html/group___u_a_r_t___i_n_i_t.html @@ -0,0 +1,280 @@ + + + + + + + +MyLibs: Init defines + + + + + + + + + + + + + + + + + +
+
+ + + + + + +
+
MyLibs 1.0 +
+
Расширенные библиотеки для STM32
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Init defines
+
+
+ +

Настройка UART. +More...

+
Collaboration diagram for Init defines:
+
+
+ + + + + + + + + + + + + + + + + +

+Macros

#define HAL_UART_MODULE_ENABLED
 Включение HAL UART.
#define USE_USART1
 Включить USART1 в UART_MspInit.
#define USE_USART2
 Включить USART2 в UART_MspInit.
#define USE_USART3
 Включить USART3 в UART_MspInit.
#define USE_UART4
 Включить UART4 в UART_MspInit.
#define USE_UART5
 Включить UART5 в UART_MspInit.
#define USE_USART6
 Включить USART6 в UART_MspInit.
+

Detailed Description

+

Настройка UART.

+

Macro Definition Documentation

+ +

◆ HAL_UART_MODULE_ENABLED

+ +
+
+ + + + +
#define HAL_UART_MODULE_ENABLED
+
+ +

Включение HAL UART.

+ +

Definition at line 65 of file general_uart.h.

+ +
+
+ +

◆ USE_USART1

+ +
+
+ + + + +
#define USE_USART1
+
+ +

Включить USART1 в UART_MspInit.

+ +

Definition at line 67 of file general_uart.h.

+ +
+
+ +

◆ USE_USART2

+ +
+
+ + + + +
#define USE_USART2
+
+ +

Включить USART2 в UART_MspInit.

+ +

Definition at line 68 of file general_uart.h.

+ +
+
+ +

◆ USE_USART3

+ +
+
+ + + + +
#define USE_USART3
+
+ +

Включить USART3 в UART_MspInit.

+ +

Definition at line 69 of file general_uart.h.

+ +
+
+ +

◆ USE_UART4

+ +
+
+ + + + +
#define USE_UART4
+
+ +

Включить UART4 в UART_MspInit.

+ +

Definition at line 70 of file general_uart.h.

+ +
+
+ +

◆ USE_UART5

+ +
+
+ + + + +
#define USE_UART5
+
+ +

Включить UART5 в UART_MspInit.

+ +

Definition at line 71 of file general_uart.h.

+ +
+
+ +

◆ USE_USART6

+ +
+
+ + + + +
#define USE_USART6
+
+ +

Включить USART6 в UART_MspInit.

+ +

Definition at line 72 of file general_uart.h.

+ +
+
+
+
+ +
+ + + + diff --git a/Doc/html/group___u_a_r_t___i_n_i_t.js b/Doc/html/group___u_a_r_t___i_n_i_t.js new file mode 100644 index 0000000..2aa885c --- /dev/null +++ b/Doc/html/group___u_a_r_t___i_n_i_t.js @@ -0,0 +1,10 @@ +var group___u_a_r_t___i_n_i_t = +[ + [ "HAL_UART_MODULE_ENABLED", "group___u_a_r_t___i_n_i_t.html#ga167269406e73327b95c3bb7b9cfe6d89", null ], + [ "USE_USART1", "group___u_a_r_t___i_n_i_t.html#gace54f148bb1d72f13bf397d096d38d1b", null ], + [ "USE_USART2", "group___u_a_r_t___i_n_i_t.html#gaacb3968508217a0d8b3f64aa0c8aa07d", null ], + [ "USE_USART3", "group___u_a_r_t___i_n_i_t.html#ga6dadd967b428aade24008ec060009976", null ], + [ "USE_UART4", "group___u_a_r_t___i_n_i_t.html#ga779530e93e7aa1f25eb13045ec42b8e7", null ], + [ "USE_UART5", "group___u_a_r_t___i_n_i_t.html#ga592c6bf4a6496d6806ba0838cdfa2340", null ], + [ "USE_USART6", "group___u_a_r_t___i_n_i_t.html#gafaeb8bdd4aa7fb1987505530daa90868", null ] +]; \ No newline at end of file diff --git a/Doc/html/group___u_a_r_t___i_n_i_t.map b/Doc/html/group___u_a_r_t___i_n_i_t.map new file mode 100644 index 0000000..5159791 --- /dev/null +++ b/Doc/html/group___u_a_r_t___i_n_i_t.map @@ -0,0 +1,4 @@ + + + + diff --git a/Doc/html/group___u_a_r_t___i_n_i_t.md5 b/Doc/html/group___u_a_r_t___i_n_i_t.md5 new file mode 100644 index 0000000..51b7988 --- /dev/null +++ b/Doc/html/group___u_a_r_t___i_n_i_t.md5 @@ -0,0 +1 @@ +a6be7d8c2d212183934faf5551879d8d \ No newline at end of file diff --git a/Doc/html/group___u_a_r_t___i_n_i_t.png b/Doc/html/group___u_a_r_t___i_n_i_t.png new file mode 100644 index 0000000..f441551 Binary files /dev/null and b/Doc/html/group___u_a_r_t___i_n_i_t.png differ diff --git a/Doc/html/search/all_1c.js b/Doc/html/search/all_1c.js new file mode 100644 index 0000000..f69cabe --- /dev/null +++ b/Doc/html/search/all_1c.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['утилиты_20mylibs_5fdefines_0',['Общие утилиты (<a class="el" href="group___m_y_l_i_b_s___d_e_f_i_n_e_s.html">General Tools</a>)',['../index.html#utils_module',1,'']]] +]; diff --git a/Doc/html/search/defines_0.js b/Doc/html/search/defines_0.js new file mode 100644 index 0000000..e5549a9 --- /dev/null +++ b/Doc/html/search/defines_0.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['_5f_5fuser_5flinkdma_0',['__USER_LINKDMA',['../general__uart_8h.html#a52d3bb980b28a6804655b6b25f14da46',1,'general_uart.h']]] +]; diff --git a/Doc/html/search/functions_5.js b/Doc/html/search/functions_5.js new file mode 100644 index 0000000..d14df27 --- /dev/null +++ b/Doc/html/search/functions_5.js @@ -0,0 +1,14 @@ +var searchData= +[ + ['tim_5fbase_5finit_0',['TIM_Base_Init',['../group___m_y_l_i_b_s___t_i_m___g_e_n_e_r_a_l.html#ga7044214f24a9868ba7e1650b55e639ec',1,'TIM_Base_Init(TIM_SettingsTypeDef *stim): general_tim.c'],['../group___m_y_l_i_b_s___t_i_m___g_e_n_e_r_a_l.html#ga7044214f24a9868ba7e1650b55e639ec',1,'TIM_Base_Init(TIM_SettingsTypeDef *stim): general_tim.c']]], + ['tim_5fbase_5fmspdeinit_1',['TIM_Base_MspDeInit',['../group___m_y_l_i_b_s___t_i_m___g_e_n_e_r_a_l.html#ga879e3f1c919c02990736730275367115',1,'TIM_Base_MspDeInit(TIM_HandleTypeDef *htim): general_tim.c'],['../group___m_y_l_i_b_s___t_i_m___g_e_n_e_r_a_l.html#ga879e3f1c919c02990736730275367115',1,'TIM_Base_MspDeInit(TIM_HandleTypeDef *htim): general_tim.c']]], + ['tim_5fbase_5fmspinit_2',['TIM_Base_MspInit',['../group___m_y_l_i_b_s___t_i_m___g_e_n_e_r_a_l.html#gaad47337be7ba2f6c0777c40d7278c931',1,'TIM_Base_MspInit(TIM_HandleTypeDef *htim, TIM_ITModeTypeDef it_mode): general_tim.c'],['../group___m_y_l_i_b_s___t_i_m___g_e_n_e_r_a_l.html#gaad47337be7ba2f6c0777c40d7278c931',1,'TIM_Base_MspInit(TIM_HandleTypeDef *htim, TIM_ITModeTypeDef it_mode): general_tim.c']]], + ['tim_5fdelay_3',['TIM_Delay',['../group___m_y_l_i_b_s___t_i_m___d_e_l_a_y.html#ga88c552a133cb6e3015453cccab74c07e',1,'TIM_Delay(TIM_HandleTypeDef *htim, uint16_t delay): general_tim.c'],['../group___m_y_l_i_b_s___t_i_m___d_e_l_a_y.html#ga88c552a133cb6e3015453cccab74c07e',1,'TIM_Delay(TIM_HandleTypeDef *htim, uint16_t delay): general_tim.c']]], + ['tim_5fdelay_5fnonblocking_4',['TIM_Delay_NonBlocking',['../group___m_y_l_i_b_s___t_i_m___d_e_l_a_y.html#ga108637af414bff3373059273b815ce9b',1,'TIM_Delay_NonBlocking(TIM_HandleTypeDef *htim, uint16_t delay): general_tim.c'],['../group___m_y_l_i_b_s___t_i_m___d_e_l_a_y.html#ga108637af414bff3373059273b815ce9b',1,'TIM_Delay_NonBlocking(TIM_HandleTypeDef *htim, uint16_t delay): general_tim.c']]], + ['tim_5fdelay_5fstart_5',['TIM_Delay_Start',['../group___m_y_l_i_b_s___t_i_m___d_e_l_a_y.html#ga4c0dfde4e15f677600605348b4e97834',1,'TIM_Delay_Start(TIM_HandleTypeDef *htim): general_tim.c'],['../group___m_y_l_i_b_s___t_i_m___d_e_l_a_y.html#ga4c0dfde4e15f677600605348b4e97834',1,'TIM_Delay_Start(TIM_HandleTypeDef *htim): general_tim.c']]], + ['tim_5fencoder_5finit_6',['TIM_Encoder_Init',['../group___m_y_l_i_b_s___t_i_m___e_n_c_o_d_e_r.html#ga8d16c3b7e7c6decc54c5c3d1a8bf0fbc',1,'TIM_Encoder_Init(TIM_EncoderTypeDef *henc1, TIM_HandleTypeDef *htim): general_tim.c'],['../group___m_y_l_i_b_s___t_i_m___e_n_c_o_d_e_r.html#ga8d16c3b7e7c6decc54c5c3d1a8bf0fbc',1,'TIM_Encoder_Init(TIM_EncoderTypeDef *henc, TIM_HandleTypeDef *htim): general_tim.c']]], + ['tim_5fencoder_5fread_7',['TIM_Encoder_Read',['../group___m_y_l_i_b_s___t_i_m___e_n_c_o_d_e_r.html#gac3bc6525f88c275e47eb864e6d567501',1,'TIM_Encoder_Read(TIM_EncoderTypeDef *henc): general_tim.c'],['../group___m_y_l_i_b_s___t_i_m___e_n_c_o_d_e_r.html#gac3bc6525f88c275e47eb864e6d567501',1,'TIM_Encoder_Read(TIM_EncoderTypeDef *henc): general_tim.c']]], + ['tim_5fencoder_5freadswitch_8',['TIM_Encoder_ReadSwitch',['../group___m_y_l_i_b_s___t_i_m___e_n_c_o_d_e_r.html#ga117b795017e9e3a357ddefe323412761',1,'TIM_Encoder_ReadSwitch(TIM_EncoderTypeDef *henc): general_tim.c'],['../group___m_y_l_i_b_s___t_i_m___e_n_c_o_d_e_r.html#ga117b795017e9e3a357ddefe323412761',1,'TIM_Encoder_ReadSwitch(TIM_EncoderTypeDef *henc): general_tim.c']]], + ['tim_5foc_5fcomparator_5finit_9',['TIM_OC_Comparator_Init',['../group___m_y_l_i_b_s___t_i_m___o_c.html#gae2608ca8023e9a0713af0b4fbfbc1889',1,'TIM_OC_Comparator_Init(TIM_HandleTypeDef *htim, uint32_t TIM_CHANNEL): general_tim.c'],['../group___m_y_l_i_b_s___t_i_m___o_c.html#gae2608ca8023e9a0713af0b4fbfbc1889',1,'TIM_OC_Comparator_Init(TIM_HandleTypeDef *htim, uint32_t TIM_CHANNEL): general_tim.c']]], + ['tim_5foutput_5fpwm_5finit_10',['TIM_Output_PWM_Init',['../group___m_y_l_i_b_s___t_i_m___o_c.html#gadb2f465d89f609e035867e980c3a29c6',1,'TIM_Output_PWM_Init(TIM_HandleTypeDef *htim, TIM_OC_InitTypeDef *sConfigOC, uint32_t TIM_CHANNEL, GPIO_TypeDef *GPIOx, uint32_t PWM_PIN): general_tim.c'],['../group___m_y_l_i_b_s___t_i_m___o_c.html#gadb2f465d89f609e035867e980c3a29c6',1,'TIM_Output_PWM_Init(TIM_HandleTypeDef *htim, TIM_OC_InitTypeDef *sConfigOC, uint32_t TIM_CHANNEL, GPIO_TypeDef *GPIOx, uint32_t GPIO_PIN): general_tim.c']]] +]; diff --git a/Doc/html/search/functions_6.js b/Doc/html/search/functions_6.js new file mode 100644 index 0000000..21e3ae0 --- /dev/null +++ b/Doc/html/search/functions_6.js @@ -0,0 +1,9 @@ +var searchData= +[ + ['uart_5fbase_5finit_0',['UART_Base_Init',['../group___m_y___l_i_b_s___u_a_r_t.html#gab9f07396b778505c934143e89953e154',1,'UART_Base_Init(UART_SettingsTypeDef *suart): general_uart.c'],['../group___m_y___l_i_b_s___u_a_r_t.html#gab9f07396b778505c934143e89953e154',1,'UART_Base_Init(UART_SettingsTypeDef *suart): general_uart.c']]], + ['uart_5fcheck_5finit_5fstruct_1',['UART_Check_Init_Struct',['../group___m_y___l_i_b_s___u_a_r_t.html#ga2a22e46ecb9e04b2ce197a0e9c09044a',1,'UART_Check_Init_Struct(UART_SettingsTypeDef *suart): general_uart.c'],['../group___m_y___l_i_b_s___u_a_r_t.html#ga2a22e46ecb9e04b2ce197a0e9c09044a',1,'UART_Check_Init_Struct(UART_SettingsTypeDef *suart): general_uart.c']]], + ['uart_5fdma_5finit_2',['UART_DMA_Init',['../general__uart_8c.html#ad82d0cbd19151675135fd75dad315d05',1,'general_uart.c']]], + ['uart_5fgpio_5finit_3',['UART_GPIO_Init',['../general__uart_8c.html#a3abae05bbde5f3b402bf18ca13dc6a0b',1,'general_uart.c']]], + ['uart_5fmspdeinit_4',['UART_MspDeInit',['../group___m_y___l_i_b_s___u_a_r_t.html#ga93ed6ceef4e3b5e7885786125cce93bc',1,'UART_MspDeInit(UART_HandleTypeDef *huart): general_uart.c'],['../group___m_y___l_i_b_s___u_a_r_t.html#ga93ed6ceef4e3b5e7885786125cce93bc',1,'UART_MspDeInit(UART_HandleTypeDef *huart): general_uart.c']]], + ['uart_5fmspinit_5',['UART_MspInit',['../group___m_y___l_i_b_s___u_a_r_t.html#gab9313fd2f9fc6873ca6bfbc5b96edbbb',1,'UART_MspInit(UART_HandleTypeDef *huart): general_uart.c'],['../group___m_y___l_i_b_s___u_a_r_t.html#gab9313fd2f9fc6873ca6bfbc5b96edbbb',1,'UART_MspInit(UART_HandleTypeDef *huart): general_uart.c']]] +]; diff --git a/Doc/html/search/functions_7.js b/Doc/html/search/functions_7.js new file mode 100644 index 0000000..9d621e7 --- /dev/null +++ b/Doc/html/search/functions_7.js @@ -0,0 +1,8 @@ +var searchData= +[ + ['uart_5fbase_5finit_0',['UART_Base_Init',['../group___m_y___l_i_b_s___u_a_r_t.html#gab9f07396b778505c934143e89953e154',1,'UART_Base_Init(UART_SettingsTypeDef *suart): general_uart.c'],['../group___m_y___l_i_b_s___u_a_r_t.html#gab9f07396b778505c934143e89953e154',1,'UART_Base_Init(UART_SettingsTypeDef *suart): general_uart.c']]], + ['uart_5fdma_5finit_1',['UART_DMA_Init',['../general__uart_8c.html#ad82d0cbd19151675135fd75dad315d05',1,'general_uart.c']]], + ['uart_5fgpio_5finit_2',['UART_GPIO_Init',['../general__uart_8c.html#a3abae05bbde5f3b402bf18ca13dc6a0b',1,'general_uart.c']]], + ['uart_5fmspdeinit_3',['UART_MspDeInit',['../group___m_y___l_i_b_s___u_a_r_t.html#ga93ed6ceef4e3b5e7885786125cce93bc',1,'UART_MspDeInit(UART_HandleTypeDef *huart): general_uart.c'],['../group___m_y___l_i_b_s___u_a_r_t.html#ga93ed6ceef4e3b5e7885786125cce93bc',1,'UART_MspDeInit(UART_HandleTypeDef *huart): general_uart.c']]], + ['uart_5fmspinit_4',['UART_MspInit',['../group___m_y___l_i_b_s___u_a_r_t.html#gab9313fd2f9fc6873ca6bfbc5b96edbbb',1,'UART_MspInit(UART_HandleTypeDef *huart): general_uart.c'],['../group___m_y___l_i_b_s___u_a_r_t.html#gab9313fd2f9fc6873ca6bfbc5b96edbbb',1,'UART_MspInit(UART_HandleTypeDef *huart): general_uart.c']]] +]; diff --git a/Doc/html/struct_s_p_i___settings_type_def.js b/Doc/html/struct_s_p_i___settings_type_def.js new file mode 100644 index 0000000..1658113 --- /dev/null +++ b/Doc/html/struct_s_p_i___settings_type_def.js @@ -0,0 +1,15 @@ +var struct_s_p_i___settings_type_def = +[ + [ "hspi", "struct_s_p_i___settings_type_def.html#ad203d8b8d67e4f477d002d15b03ba422", null ], + [ "CLK_GPIOx", "struct_s_p_i___settings_type_def.html#a6a15d48eccf92959de3a086031fdc979", null ], + [ "CLK_PIN", "struct_s_p_i___settings_type_def.html#a3bcb1ed12da3544e02e6d36493669bdc", null ], + [ "CLK_GPIO_AlternageFunc", "struct_s_p_i___settings_type_def.html#a3f3748103a0b7861f6700042fd691ba1", null ], + [ "MISO_GPIOx", "struct_s_p_i___settings_type_def.html#a0d55a2941854f61934487f3d209cfa95", null ], + [ "MISO_PIN", "struct_s_p_i___settings_type_def.html#a3366c654d7ec6dd41c6a0b504dc8509a", null ], + [ "MISO_GPIO_AlternageFunc", "struct_s_p_i___settings_type_def.html#aecd7a5c6e205335b8ed229d74cd35d14", null ], + [ "MOSI_GPIOx", "struct_s_p_i___settings_type_def.html#a0af3bdb273818ff97eb4ff3cff918820", null ], + [ "MOSI_PIN", "struct_s_p_i___settings_type_def.html#a961208869faf4a7369aaf4edde75f176", null ], + [ "MOSI_GPIO_AlternageFunc", "struct_s_p_i___settings_type_def.html#afbe75a1c36650a4a9b41fa706a4c7eab", null ], + [ "DMAChannel", "struct_s_p_i___settings_type_def.html#a3cfd9469b0617a68bbd2a161ba06bb95", null ], + [ "DMA_CHANNEL_X", "struct_s_p_i___settings_type_def.html#aa0edaa145076d2383b3e0095d156d474", null ] +]; \ No newline at end of file diff --git a/Doc/html/struct_u_a_r_t___settings_type_def.js b/Doc/html/struct_u_a_r_t___settings_type_def.js new file mode 100644 index 0000000..57d179f --- /dev/null +++ b/Doc/html/struct_u_a_r_t___settings_type_def.js @@ -0,0 +1,9 @@ +var struct_u_a_r_t___settings_type_def = +[ + [ "huart", "struct_u_a_r_t___settings_type_def.html#accf2c9448a3ea8eb3b8c25a569276fea", null ], + [ "GPIOx", "struct_u_a_r_t___settings_type_def.html#af6f9910d065bae715cdb4a1024143a8f", null ], + [ "GPIO_PIN_RX", "struct_u_a_r_t___settings_type_def.html#a3fba2b52788fe453348b5d92ed52ba49", null ], + [ "GPIO_PIN_TX", "struct_u_a_r_t___settings_type_def.html#a5f1babfcfb436cd77f5614253c0a5bef", null ], + [ "DMAChannel", "struct_u_a_r_t___settings_type_def.html#a1ecc9ac6a1d2747ade56770cbab6a613", null ], + [ "DMA_CHANNEL_X", "struct_u_a_r_t___settings_type_def.html#a15ce92b03f7f189bfbe1ab88a5f94d19", null ] +]; \ No newline at end of file diff --git a/Doc/latex/_s_p_i__usage__example-example.tex b/Doc/latex/_s_p_i__usage__example-example.tex new file mode 100644 index 0000000..82f9edf --- /dev/null +++ b/Doc/latex/_s_p_i__usage__example-example.tex @@ -0,0 +1,52 @@ +\doxysection{SPI\+\_\+\+Usage\+\_\+\+Example} +\hypertarget{_s_p_i__usage__example-example}{}\label{_s_p_i__usage__example-example}Пример использования SPI\+\_\+\+Base\+\_\+\+Init. + +Пример использования SPI\+\_\+\+Base\+\_\+\+Init. Инициализация SPI1 с базовыми настройками\+: +\begin{DoxyCode}{0} +\DoxyCodeLine{\textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{general__spi_8h}{general\_spi.h}}"{}}} +\DoxyCodeLine{} +\DoxyCodeLine{\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\_SettingsTypeDef}}\ mySPI;} +\DoxyCodeLine{} +\DoxyCodeLine{\textcolor{keywordtype}{void}\ SPI1\_Init(\textcolor{keywordtype}{void})} +\DoxyCodeLine{\{} +\DoxyCodeLine{\ \ \ \ \textcolor{comment}{//\ Настройка\ SPI1}} +\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Instance\ =\ SPI1;} +\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.Mode\ =\ SPI\_MODE\_MASTER;} +\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.Direction\ =\ SPI\_DIRECTION\_2LINES;} +\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.DataSize\ =\ SPI\_DATASIZE\_8BIT;} +\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.CLKPolarity\ =\ SPI\_POLARITY\_LOW;} +\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.CLKPhase\ =\ SPI\_PHASE\_1EDGE;} +\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.NSS\ =\ SPI\_NSS\_SOFT;} +\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.BaudRatePrescaler\ =\ SPI\_BAUDRATEPRESCALER\_16;} +\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.FirstBit\ =\ SPI\_FIRSTBIT\_MSB;} +\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.TIMode\ =\ SPI\_TIMODE\_DISABLE;} +\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.CRCCalculation\ =\ SPI\_CRCCALCULATION\_DISABLE;} +\DoxyCodeLine{} +\DoxyCodeLine{\ \ \ \ \textcolor{comment}{//\ Настройка\ GPIO\ для\ SPI}} +\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_a6a15d48eccf92959de3a086031fdc979}{CLK\_GPIOx}}\ =\ GPIOA;} +\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3bcb1ed12da3544e02e6d36493669bdc}{CLK\_PIN}}\ =\ GPIO\_PIN\_5;} +\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3f3748103a0b7861f6700042fd691ba1}{CLK\_GPIO\_AlternageFunc}}\ =\ GPIO\_AF5\_SPI1;} +\DoxyCodeLine{} +\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_a0d55a2941854f61934487f3d209cfa95}{MISO\_GPIOx}}\ =\ GPIOA;} +\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3366c654d7ec6dd41c6a0b504dc8509a}{MISO\_PIN}}\ =\ GPIO\_PIN\_6;} +\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_aecd7a5c6e205335b8ed229d74cd35d14}{MISO\_GPIO\_AlternageFunc}}\ =\ GPIO\_AF5\_SPI1;} +\DoxyCodeLine{} +\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_a0af3bdb273818ff97eb4ff3cff918820}{MOSI\_GPIOx}}\ =\ GPIOA;} +\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_a961208869faf4a7369aaf4edde75f176}{MOSI\_PIN}}\ =\ GPIO\_PIN\_7;} +\DoxyCodeLine{\ \ \ \ mySPI.\mbox{\hyperlink{struct_s_p_i___settings_type_def_afbe75a1c36650a4a9b41fa706a4c7eab}{MOSI\_GPIO\_AlternageFunc}}\ =\ GPIO\_AF5\_SPI1;} +\DoxyCodeLine{} +\DoxyCodeLine{\ \ \ \ \textcolor{comment}{//\ Инициализация\ SPI}} +\DoxyCodeLine{\ \ \ \ \textcolor{keywordflow}{if}(\mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_ga0e177e3c57a8fcdc73b5602e72ec66ba}{SPI\_Base\_Init}}(\&mySPI)\ !=\ HAL\_OK)} +\DoxyCodeLine{\ \ \ \ \{} +\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{comment}{//\ Обработка\ ошибки}} +\DoxyCodeLine{\ \ \ \ \}} +\DoxyCodeLine{\}} + +\end{DoxyCode} + + + +\begin{DoxyCodeInclude}{0} + +\end{DoxyCodeInclude} + \ No newline at end of file diff --git a/Doc/latex/examples.tex b/Doc/latex/examples.tex new file mode 100644 index 0000000..5e9c832 --- /dev/null +++ b/Doc/latex/examples.tex @@ -0,0 +1,4 @@ +\doxysection{Examples} +Here is a list of all examples\+:\begin{DoxyCompactItemize} +\item +\mbox{\hyperlink{_s_p_i__usage__example-example}{SPI\+\_\+\+Usage\+\_\+\+Example}}\end{DoxyCompactItemize} diff --git a/Doc/latex/general__spi_8c.tex b/Doc/latex/general__spi_8c.tex new file mode 100644 index 0000000..8a267c6 --- /dev/null +++ b/Doc/latex/general__spi_8c.tex @@ -0,0 +1,79 @@ +\doxysection{E\+:/.WORK/\+STM32/\+STM32\+\_\+\+Extended\+Libs/\+My\+Libs\+General/\+Src/general\+\_\+spi.c File Reference} +\hypertarget{general__spi_8c}{}\label{general__spi_8c}\index{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Src/general\_spi.c@{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Src/general\_spi.c}} + + +Модуль для инициализации SPI. + + +{\ttfamily \#include "{}general\+\_\+spi.\+h"{}}\newline +{\ttfamily \#include "{}general\+\_\+gpio.\+h"{}}\newline +Include dependency graph for general\+\_\+spi.\+c\+:\nopagebreak +\begin{figure}[H] +\begin{center} +\leavevmode +\includegraphics[width=250pt]{general__spi_8c__incl} +\end{center} +\end{figure} +\doxysubsubsection*{Functions} +\begin{DoxyCompactItemize} +\item +HAL\+\_\+\+Status\+Type\+Def \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_ga0e177e3c57a8fcdc73b5602e72ec66ba}{SPI\+\_\+\+Base\+\_\+\+Init}} (\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\+\_\+\+Settings\+Type\+Def}} \texorpdfstring{$\ast$}{*}sspi) +\begin{DoxyCompactList}\small\item\em Инициализация SPI с помощью структуры \doxylink{struct_s_p_i___settings_type_def}{SPI\+\_\+\+Settings\+Type\+Def}. \end{DoxyCompactList}\item +void \mbox{\hyperlink{general__spi_8c_ae80d21e5cab86571709a2619442733b5}{SPI\+\_\+\+GPIO\+\_\+\+Init}} (\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\+\_\+\+Settings\+Type\+Def}} \texorpdfstring{$\ast$}{*}sspi) +\begin{DoxyCompactList}\small\item\em Инициализация GPIO для SPI. \end{DoxyCompactList}\item +void \mbox{\hyperlink{general__spi_8c_abb78b8bd5303e88f969694e6fe03c411}{SPI\+\_\+\+DMA\+\_\+\+Init}} (SPI\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}hspi, DMA\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}hdma\+\_\+rx, DMA\+\_\+\+Stream\+\_\+\+Type\+Def \texorpdfstring{$\ast$}{*}DMAChannel, uint32\+\_\+t DMA\+\_\+\+CHANNEL\+\_\+X) +\item +void \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_gab9f13318daf02bc5b5f302ae392dccac}{SPI\+\_\+\+Msp\+Init}} (SPI\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}hspi) +\begin{DoxyCompactList}\small\item\em Настройка тактирования и прерываний SPI. \end{DoxyCompactList}\item +void \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_gac279cc3eaa35541edfe330a1844a85e4}{SPI\+\_\+\+Msp\+De\+Init}} (SPI\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}hspi) +\begin{DoxyCompactList}\small\item\em Деинициализация тактирования и прерываний SPI. \end{DoxyCompactList}\item +HAL\+\_\+\+Status\+Type\+Def \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_ga333dd251bc878931086d48aa932b1a5f}{SPI\+\_\+\+Check\+\_\+\+Init\+\_\+\+Struct}} (\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\+\_\+\+Settings\+Type\+Def}} \texorpdfstring{$\ast$}{*}sspi) +\begin{DoxyCompactList}\small\item\em Проверка корректности структуры инициализации SPI. \end{DoxyCompactList}\end{DoxyCompactItemize} + + +\doxysubsection{Detailed Description} +Модуль для инициализации SPI. + +Реализация функций для работы с SPI\+: +\begin{DoxyItemize} +\item Инициализация SPI и его линий CLK/\+MISO/\+MOSI +\item Настройка GPIO для SPI +\item Настройка NVIC и тактирования SPI +\end{DoxyItemize} + +Definition in file \mbox{\hyperlink{general__spi_8c_source}{general\+\_\+spi.\+c}}. + + + +\label{doc-func-members} +\Hypertarget{general__spi_8c_doc-func-members} +\doxysubsection{Function Documentation} +\Hypertarget{general__spi_8c_ae80d21e5cab86571709a2619442733b5}\index{general\_spi.c@{general\_spi.c}!SPI\_GPIO\_Init@{SPI\_GPIO\_Init}} +\index{SPI\_GPIO\_Init@{SPI\_GPIO\_Init}!general\_spi.c@{general\_spi.c}} +\doxysubsubsection{\texorpdfstring{SPI\_GPIO\_Init()}{SPI\_GPIO\_Init()}} +{\footnotesize\ttfamily \label{general__spi_8c_ae80d21e5cab86571709a2619442733b5} +void SPI\+\_\+\+GPIO\+\_\+\+Init (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\+\_\+\+Settings\+Type\+Def}} \texorpdfstring{$\ast$}{*}}]{sspi}{}\end{DoxyParamCaption})} + + + +Инициализация GPIO для SPI. + + +\begin{DoxyParams}{Parameters} +{\em sspi} & Указатель на структуру с настройками SPI. \\ +\hline +\end{DoxyParams} + + +Definition at line \mbox{\hyperlink{general__spi_8c_source_l00058}{58}} of file \mbox{\hyperlink{general__spi_8c_source}{general\+\_\+spi.\+c}}. + +\Hypertarget{general__spi_8c_abb78b8bd5303e88f969694e6fe03c411}\index{general\_spi.c@{general\_spi.c}!SPI\_DMA\_Init@{SPI\_DMA\_Init}} +\index{SPI\_DMA\_Init@{SPI\_DMA\_Init}!general\_spi.c@{general\_spi.c}} +\doxysubsubsection{\texorpdfstring{SPI\_DMA\_Init()}{SPI\_DMA\_Init()}} +{\footnotesize\ttfamily \label{general__spi_8c_abb78b8bd5303e88f969694e6fe03c411} +void SPI\+\_\+\+DMA\+\_\+\+Init (\begin{DoxyParamCaption}\item[{SPI\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}}]{hspi}{, }\item[{DMA\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}}]{hdma\+\_\+rx}{, }\item[{DMA\+\_\+\+Stream\+\_\+\+Type\+Def \texorpdfstring{$\ast$}{*}}]{DMAChannel}{, }\item[{uint32\+\_\+t}]{DMA\+\_\+\+CHANNEL\+\_\+X}{}\end{DoxyParamCaption})} + + + +Definition at line \mbox{\hyperlink{general__spi_8c_source_l00089}{89}} of file \mbox{\hyperlink{general__spi_8c_source}{general\+\_\+spi.\+c}}. + diff --git a/Doc/latex/general__spi_8c__incl.md5 b/Doc/latex/general__spi_8c__incl.md5 new file mode 100644 index 0000000..1f76dff --- /dev/null +++ b/Doc/latex/general__spi_8c__incl.md5 @@ -0,0 +1 @@ +2ef78bca7433c0859e5f0181551ac011 \ No newline at end of file diff --git a/Doc/latex/general__spi_8c__incl.pdf b/Doc/latex/general__spi_8c__incl.pdf new file mode 100644 index 0000000..80324e8 Binary files /dev/null and b/Doc/latex/general__spi_8c__incl.pdf differ diff --git a/Doc/latex/general__spi_8c_source.tex b/Doc/latex/general__spi_8c_source.tex new file mode 100644 index 0000000..6f892b1 --- /dev/null +++ b/Doc/latex/general__spi_8c_source.tex @@ -0,0 +1,290 @@ +\doxysection{general\+\_\+spi.\+c} +\hypertarget{general__spi_8c_source}{}\label{general__spi_8c_source}\index{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Src/general\_spi.c@{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Src/general\_spi.c}} +\mbox{\hyperlink{general__spi_8c}{Go to the documentation of this file.}} +\begin{DoxyCode}{0} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00001}00001\ \textcolor{comment}{/**\ }} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00002}00002\ \textcolor{comment}{**************************************************************************}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00003}00003\ \textcolor{comment}{*\ @file\ general\_spi.c}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00004}00004\ \textcolor{comment}{*\ @brief\ Модуль\ для\ инициализации\ SPI.}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00005}00005\ \textcolor{comment}{**************************************************************************}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00006}00006\ \textcolor{comment}{Реализация\ функций\ для\ работы\ с\ SPI:}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00007}00007\ \textcolor{comment}{\ \ -\/\ Инициализация\ SPI\ и\ его\ линий\ CLK/MISO/MOSI}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00008}00008\ \textcolor{comment}{\ \ -\/\ Настройка\ GPIO\ для\ SPI}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00009}00009\ \textcolor{comment}{\ \ -\/\ Настройка\ NVIC\ и\ тактирования\ SPI}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00010}00010\ \textcolor{comment}{**************************************************************************/}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00011}00011\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{general__spi_8h}{general\_spi.h}}"{}}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00012}00012\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{general__gpio_8h}{general\_gpio.h}}"{}}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00013}00013\ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00014}00014\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00015}00015\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/SPI\ INIT\ FUNCTIONS-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}\textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00016}00016\ \textcolor{comment}{/**\ \ }} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00017}00017\ \textcolor{comment}{\ \ *\ @brief\ \ Инициализация\ SPI\ с\ помощью\ структуры\ SPI\_SettingsTypeDef.}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00018}00018\ \textcolor{comment}{\ \ *\ @param\ \ sspi\ Указатель\ на\ структуру\ с\ настройками\ SPI.}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00019}00019\ \textcolor{comment}{\ \ *\ @return\ HAL\ status.}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00020}00020\ \textcolor{comment}{\ \ *\ @details\ \ }} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00021}00021\ \textcolor{comment}{\ \ *\ Инициализирует\ SPI\ и\ его\ GPIO.}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00022}00022\ \textcolor{comment}{\ \ *\ Настройка\ аналогична\ HAL\_SPI\_Init\ }} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00023}00023\ \textcolor{comment}{\ \ *\ @code}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00024}00024\ \textcolor{comment}{\ \ *\ suart.hspi.Init...}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00025}00025\ \textcolor{comment}{\ \ *\ @endcode\ }} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00026}00026\ \textcolor{comment}{\ \ *\ но\ дополнительно\ надо\ прописать\ пины\ CLK/MISO/MOSI\ @ref\ SPI\_SettingsTypeDef}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00027}00027\ \textcolor{comment}{\ \ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00028}\mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_ga0e177e3c57a8fcdc73b5602e72ec66ba}{00028}}\ HAL\_StatusTypeDef\ \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_ga0e177e3c57a8fcdc73b5602e72ec66ba}{SPI\_Base\_Init}}(\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\_SettingsTypeDef}}\ *sspi)} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00029}00029\ \{\ \textcolor{comment}{//\ function\ takes\ setting\ structure\ for\ init}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00030}00030\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00031}00031\ \ \ \textcolor{comment}{//\ check\ is\ settings\ are\ valid}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00032}00032\ \ \ \textcolor{keywordflow}{if}(\mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_ga333dd251bc878931086d48aa932b1a5f}{SPI\_Check\_Init\_Struct}}(sspi)\ !=\ HAL\_OK)} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00033}00033\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00034}00034\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00035}00035\ \ \ \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_gab9f13318daf02bc5b5f302ae392dccac}{SPI\_MspInit}}(\&sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}});\ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00036}00036\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00037}00037\ \ \ \textcolor{keywordflow}{if}\ (HAL\_SPI\_Init(\&sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}})\ !=\ HAL\_OK)} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00038}00038\ \ \ \{} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00039}00039\ \ \ \ \ \mbox{\hyperlink{group___e_r_r_o_r___h_a_n_d_l_e_r___d_e_f_i_n_e_s_gae110df81afd885a390bbeb152d7b709f}{MyLibs\_Error\_Handler}}();} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00040}00040\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00041}00041\ \ \ \}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00042}00042\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00043}00043\ \ \ \textcolor{comment}{//\ init\ gpio\ from\ SPISettings\ structure}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00044}00044\ \ \ \mbox{\hyperlink{general__spi_8c_ae80d21e5cab86571709a2619442733b5}{SPI\_GPIO\_Init}}(sspi);} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00045}00045\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00046}00046\ \textcolor{comment}{//\ \ //\ init\ dma\ from\ SPISettings\ structure\ if\ need}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00047}00047\ \textcolor{comment}{//\ \ if\ (sspi-\/>DMAChannel\ !=\ 0)}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00048}00048\ \textcolor{comment}{//\ \ \ \ SPI\_DMA\_Init(\&sspi-\/>hspi,\ sspi-\/>hspi.hdmarx,\ sspi-\/>DMAChannel,\ sspi-\/>DMA\_CHANNEL\_X);}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00049}00049\ \ \ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00050}00050\ \ \ \textcolor{keywordflow}{return}\ HAL\_OK;} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00051}00051\ \}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00052}00052\ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00053}00053\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00054}00054\ \textcolor{comment}{/**\ \ }} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00055}00055\ \textcolor{comment}{\ \ *\ @brief\ \ Инициализация\ GPIO\ для\ SPI.}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00056}00056\ \textcolor{comment}{\ \ *\ @param\ \ sspi\ Указатель\ на\ структуру\ с\ настройками\ SPI.}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00057}00057\ \textcolor{comment}{\ \ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00058}\mbox{\hyperlink{general__spi_8c_ae80d21e5cab86571709a2619442733b5}{00058}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{general__spi_8c_ae80d21e5cab86571709a2619442733b5}{SPI\_GPIO\_Init}}(\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\_SettingsTypeDef}}\ *sspi)} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00059}00059\ \{\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00060}00060\ \ \ GPIO\_InitTypeDef\ GPIO\_InitStruct\ =\ \{0\};\ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00061}00061\ \ \ \textcolor{comment}{//\ GPIO\ INIT\ \ }} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00062}00062\ \ \ \mbox{\hyperlink{group___m_y_l_i_b_s___g_p_i_o___g_e_n_e_r_a_l_ga962f010f783b81fcdd27eb6b53db28e6}{GPIO\_Clock\_Enable}}(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a6a15d48eccf92959de3a086031fdc979}{CLK\_GPIOx}});} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00063}00063\ \ \ \mbox{\hyperlink{group___m_y_l_i_b_s___g_p_i_o___g_e_n_e_r_a_l_ga962f010f783b81fcdd27eb6b53db28e6}{GPIO\_Clock\_Enable}}(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a0d55a2941854f61934487f3d209cfa95}{MISO\_GPIOx}});} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00064}00064\ \ \ \mbox{\hyperlink{group___m_y_l_i_b_s___g_p_i_o___g_e_n_e_r_a_l_ga962f010f783b81fcdd27eb6b53db28e6}{GPIO\_Clock\_Enable}}(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a0af3bdb273818ff97eb4ff3cff918820}{MOSI\_GPIOx}});\ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00065}00065\ \ \ \ \ \textcolor{comment}{//\ CLK\ PIN\ INIT}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00066}00066\ \ \ GPIO\_InitStruct.Pin\ =\ sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3bcb1ed12da3544e02e6d36493669bdc}{CLK\_PIN}};} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00067}00067\ \ \ GPIO\_InitStruct.Alternate\ =\ sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3f3748103a0b7861f6700042fd691ba1}{CLK\_GPIO\_AlternageFunc}};} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00068}00068\ \ \ GPIO\_InitStruct.Mode\ =\ GPIO\_MODE\_AF\_PP;} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00069}00069\ \ \ GPIO\_InitStruct.Pull\ =\ GPIO\_NOPULL;} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00070}00070\ \ \ GPIO\_InitStruct.Speed\ =\ GPIO\_SPEED\_FREQ\_VERY\_HIGH;} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00071}00071\ \ \ HAL\_GPIO\_Init(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a6a15d48eccf92959de3a086031fdc979}{CLK\_GPIOx}},\ \&GPIO\_InitStruct);} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00072}00072\ \ \ \textcolor{comment}{//\ MISO\ PIN\ INIT}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00073}00073\ \ \ GPIO\_InitStruct.Pin\ =\ sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3366c654d7ec6dd41c6a0b504dc8509a}{MISO\_PIN}};} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00074}00074\ \ \ GPIO\_InitStruct.Alternate\ =\ sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_aecd7a5c6e205335b8ed229d74cd35d14}{MISO\_GPIO\_AlternageFunc}};} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00075}00075\ \ \ GPIO\_InitStruct.Mode\ =\ GPIO\_MODE\_AF\_PP;} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00076}00076\ \ \ GPIO\_InitStruct.Pull\ =\ GPIO\_NOPULL;} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00077}00077\ \ \ GPIO\_InitStruct.Speed\ =\ GPIO\_SPEED\_FREQ\_VERY\_HIGH;} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00078}00078\ \ \ HAL\_GPIO\_Init(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a0d55a2941854f61934487f3d209cfa95}{MISO\_GPIOx}},\ \&GPIO\_InitStruct);} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00079}00079\ \ \ \textcolor{comment}{//\ MOSI\ PIN\ INIT}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00080}00080\ \ \ GPIO\_InitStruct.Pin\ =\ sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a961208869faf4a7369aaf4edde75f176}{MOSI\_PIN}};} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00081}00081\ \ \ GPIO\_InitStruct.Alternate\ =\ sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_afbe75a1c36650a4a9b41fa706a4c7eab}{MOSI\_GPIO\_AlternageFunc}};} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00082}00082\ \ \ GPIO\_InitStruct.Mode\ =\ GPIO\_MODE\_AF\_PP;} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00083}00083\ \ \ GPIO\_InitStruct.Pull\ =\ GPIO\_NOPULL;} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00084}00084\ \ \ GPIO\_InitStruct.Speed\ =\ GPIO\_SPEED\_FREQ\_VERY\_HIGH;} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00085}00085\ \ \ HAL\_GPIO\_Init(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a0af3bdb273818ff97eb4ff3cff918820}{MOSI\_GPIOx}},\ \&GPIO\_InitStruct);} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00086}00086\ \}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00087}00087\ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00088}00088\ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00089}00089\ \textcolor{keywordtype}{void}\ SPI\_DMA\_Init(SPI\_HandleTypeDef\ *hspi,\ DMA\_HandleTypeDef\ *hdma\_rx,\ DMA\_Stream\_TypeDef\ *DMAChannel,\ uint32\_t\ DMA\_CHANNEL\_X)} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00090}00090\ \{\ \textcolor{comment}{//\ function\ takes\ spi\ and\ dma\ handlers\ and\ dmachannel\ for\ spi}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00091}00091\ \textcolor{comment}{//\ \ //\ for\ now\ only\ dma\ rx\ is\ supported,\ tx\ maybe\ later\ if\ needed}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00092}00092\ \textcolor{comment}{//\ \ \ \ //\ calc\ defines\ on\ boot\_project\_setup.h}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00093}00093\ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00094}00094\ \textcolor{comment}{//\ \ /*\ SPI3\ DMA\ Init\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00095}00095\ \textcolor{comment}{//\ \ /*\ SPI3\_RX\ Init\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00096}00096\ \textcolor{comment}{//\ \ }} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00097}00097\ \textcolor{comment}{//\ \ hdma\_rx-\/>Instance\ =\ DMAChannel;}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00098}00098\ \textcolor{comment}{//\#if\ defined(STM32F4xx)\ //\ dma\ channel\ choose\ for\ 407}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00099}00099\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.Channel\ =\ DMA\_CHANNEL\_X;}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00100}00100\ \textcolor{comment}{//\#endif}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00101}00101\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.Direction\ =\ DMA\_PERIPH\_TO\_MEMORY;}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00102}00102\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.PeriphInc\ =\ DMA\_PINC\_DISABLE;}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00103}00103\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.MemInc\ =\ DMA\_MINC\_ENABLE;}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00104}00104\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.PeriphDataAlignment\ =\ DMA\_PDATAALIGN\_BYTE;}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00105}00105\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.MemDataAlignment\ =\ DMA\_MDATAALIGN\_BYTE;}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00106}00106\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.Mode\ =\ DMA\_CIRCULAR;}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00107}00107\ \textcolor{comment}{//\ \ hdma\_rx-\/>Init.Priority\ =\ DMA\_PRIORITY\_LOW;}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00108}00108\ \textcolor{comment}{//\ \ if\ (HAL\_DMA\_Init(hdma\_rx)\ !=\ HAL\_OK)}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00109}00109\ \textcolor{comment}{//\ \ \{}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00110}00110\ \textcolor{comment}{//\ \ \ \ MyLibs\_Error\_Handler();}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00111}00111\ \textcolor{comment}{//\ \ \}}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00112}00112\ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00113}00113\ \textcolor{comment}{//\ \ \_\_USER\_LINKDMA(hspi,hdmarx,hdma\_rx);\ \ }} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00114}00114\ \textcolor{comment}{//\ \ }} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00115}00115\ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00116}00116\ \textcolor{comment}{//\ \ //\ \_\_USER\_LINKDMA\ is\ need\ because\ \_\_HAL\_LINKDMA\ is\ written\ for\ global\ defined\ hdma\_rx}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00117}00117\ \textcolor{comment}{//\ \ //\ so\ you\ get\ error\ because\ hal\ uses\ .\ insted\ of\ -\/>}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00118}00118\ \}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00119}00119\ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00120}00120\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00121}00121\ \textcolor{comment}{/**\ \ }} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00122}00122\ \textcolor{comment}{\ \ *\ @brief\ \ Настройка\ тактирования\ и\ прерываний\ SPI.}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00123}00123\ \textcolor{comment}{\ \ *\ @param\ \ hspi\ Указатель\ на\ хендл\ SPI.}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00124}00124\ \textcolor{comment}{\ \ *\ @note\ \ \ Чтобы\ не\ генерировать\ функцию\ с\ иницилизацией\ неиспользуемых\ SPI,}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00125}00125\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ дефайнами\ @ref\ SPI\_INIT\ в\ @ref\ general\_spi.h\ определяются\ используемые\ SPI.}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00126}00126\ \textcolor{comment}{\ \ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00127}\mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_gab9f13318daf02bc5b5f302ae392dccac}{00127}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_gab9f13318daf02bc5b5f302ae392dccac}{SPI\_MspInit}}(SPI\_HandleTypeDef\ *hspi)\ \textcolor{comment}{//\ analog\ for\ hal\ function}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00128}00128\ \{\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00129}00129\ \ \ \textcolor{comment}{//\ rcc,\ dma\ and\ interrupt\ init\ for\ SPIs}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00130}00130\ \ \ \textcolor{comment}{//\ GPIO\ init\ was\ moved\ to\ own\ functions\ SPI\_GPIO\_Init\ \ }} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00131}00131\ \ \ \textcolor{keywordflow}{if}(0);} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00132}00132\ \textcolor{preprocessor}{\#ifdef\ USE\_SPI1}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00133}00133\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(hspi-\/>Instance==SPI1)} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00134}00134\ \ \ \{} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00135}00135\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00136}00136\ \textcolor{comment}{//\ \ /*\ DMA2\ clock\ enable\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00137}00137\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA2\_CLK\_ENABLE();}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00138}00138\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00139}00139\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA2\_Stream2\_IRQn,\ 0,\ 0);}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00140}00140\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA2\_Stream2\_IRQn);}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00141}00141\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00142}00142\ \ \ \textcolor{comment}{/*\ SPI1\ clock\ enable\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00143}00143\ \ \ \_\_HAL\_RCC\_SPI1\_CLK\_ENABLE();} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00144}00144\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00145}00145\ \ \ \textcolor{comment}{/*\ SPI1\ interrupt\ Init\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00146}00146\ \ \ HAL\_NVIC\_SetPriority(SPI1\_IRQn,\ 0,\ 0);} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00147}00147\ \ \ HAL\_NVIC\_EnableIRQ(SPI1\_IRQn);} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00148}00148\ \ \ \}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00149}00149\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_SPI1}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00150}00150\ \textcolor{preprocessor}{\#ifdef\ USE\_SPI2}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00151}00151\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(hspi-\/>Instance==SPI2)} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00152}00152\ \ \ \{} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00153}00153\ \textcolor{comment}{//\ \ /*\ DMA1\ clock\ enable\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00154}00154\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00155}00155\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00156}00156\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA1\_Stream5\_IRQn,\ 0,\ 0);}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00157}00157\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream5\_IRQn);}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00158}00158\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00159}00159\ \ \ \textcolor{comment}{/*\ SPI2\ clock\ enable\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00160}00160\ \ \ \_\_HAL\_RCC\_SPI2\_CLK\_ENABLE();} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00161}00161\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00162}00162\ \ \ \textcolor{comment}{/*\ SPI2\ interrupt\ Init\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00163}00163\ \ \ HAL\_NVIC\_SetPriority(SPI2\_IRQn,\ 0,\ 0);} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00164}00164\ \ \ HAL\_NVIC\_EnableIRQ(SPI2\_IRQn);} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00165}00165\ \ \ \}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00166}00166\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_SPI2}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00167}00167\ \textcolor{preprocessor}{\#ifdef\ USE\_SPI3}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00168}00168\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(hspi-\/>Instance==SPI3)} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00169}00169\ \ \ \{\ \ \ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00170}00170\ \textcolor{comment}{//\ \ /*\ DMA1\ clock\ enable\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00171}00171\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00172}00172\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00173}00173\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA1\_Stream1\_IRQn,\ 0,\ 0);}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00174}00174\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream1\_IRQn);}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00175}00175\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00176}00176\ \ \ \textcolor{comment}{/*\ SPI3\ clock\ enable\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00177}00177\ \ \ \_\_HAL\_RCC\_SPI3\_CLK\_ENABLE();\ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00178}00178\ \ \ \textcolor{comment}{/*\ SPI3\ interrupt\ Init\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00179}00179\ \ \ HAL\_NVIC\_SetPriority(SPI3\_IRQn,\ 0,\ 0);} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00180}00180\ \ \ HAL\_NVIC\_EnableIRQ(SPI3\_IRQn);} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00181}00181\ \ \ \}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00182}00182\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_SPI3}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00183}00183\ \}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00184}00184\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00185}00185\ \textcolor{comment}{/**\ \ }} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00186}00186\ \textcolor{comment}{\ \ *\ @brief\ \ Деинициализация\ тактирования\ и\ прерываний\ SPI.}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00187}00187\ \textcolor{comment}{\ \ *\ @param\ \ hspi\ Указатель\ на\ хендл\ SPI.}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00188}00188\ \textcolor{comment}{\ \ *\ @note\ \ \ Чтобы\ не\ генерировать\ функцию\ с\ иницилизацией\ неиспользуемых\ SPI,}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00189}00189\ \textcolor{comment}{\ \ \ \ \ \ \ \ \ \ \ \ дефайнами\ @ref\ SPI\_INIT\ в\ @ref\ general\_spi.h\ определяются\ используемые\ SPI.}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00190}00190\ \textcolor{comment}{\ \ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00191}\mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_gac279cc3eaa35541edfe330a1844a85e4}{00191}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_gac279cc3eaa35541edfe330a1844a85e4}{SPI\_MspDeInit}}(SPI\_HandleTypeDef\ *hspi)\ \textcolor{comment}{//\ analog\ for\ hal\ function}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00192}00192\ \{\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00193}00193\ \ \ \textcolor{comment}{//\ rcc,\ dma\ and\ interrupt\ init\ for\ SPIs}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00194}00194\ \ \ \textcolor{comment}{//\ GPIO\ init\ was\ moved\ to\ own\ functions\ SPI\_GPIO\_Init\ \ }} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00195}00195\ \ \ \textcolor{keywordflow}{if}(0);} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00196}00196\ \textcolor{preprocessor}{\#ifdef\ USE\_SPI1}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00197}00197\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(hspi-\/>Instance==SPI1)} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00198}00198\ \ \ \{} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00199}00199\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00200}00200\ \textcolor{comment}{//\ \ /*\ DMA2\ clock\ enable\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00201}00201\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA2\_CLK\_ENABLE();}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00202}00202\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00203}00203\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA2\_Stream2\_IRQn,\ 0,\ 0);}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00204}00204\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA2\_Stream2\_IRQn);}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00205}00205\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00206}00206\ \ \ \textcolor{comment}{/*\ SPI1\ clock\ reset\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00207}00207\ \ \ \_\_HAL\_RCC\_SPI1\_FORCE\_RESET();} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00208}00208\ \ \ \_\_HAL\_RCC\_SPI1\_RELEASE\_RESET();} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00209}00209\ \ \ \}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00210}00210\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_SPI1}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00211}00211\ \textcolor{preprocessor}{\#ifdef\ USE\_SPI2}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00212}00212\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(hspi-\/>Instance==SPI2)} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00213}00213\ \ \ \{} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00214}00214\ \textcolor{comment}{//\ \ /*\ DMA1\ clock\ enable\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00215}00215\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00216}00216\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00217}00217\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA1\_Stream5\_IRQn,\ 0,\ 0);}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00218}00218\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream5\_IRQn);}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00219}00219\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00220}00220\ \ \ \textcolor{comment}{/*\ SPI2\ clock\ reset\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00221}00221\ \ \ \_\_HAL\_RCC\_SPI2\_FORCE\_RESET();} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00222}00222\ \ \ \_\_HAL\_RCC\_SPI2\_RELEASE\_RESET();} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00223}00223\ \ \ \}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00224}00224\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_SPI2}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00225}00225\ \textcolor{preprocessor}{\#ifdef\ USE\_SPI3}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00226}00226\ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}(hspi-\/>Instance==SPI3)} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00227}00227\ \ \ \{\ \ \ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00228}00228\ \textcolor{comment}{//\ \ /*\ DMA1\ clock\ enable\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00229}00229\ \textcolor{comment}{//\ \ \_\_HAL\_RCC\_DMA1\_CLK\_ENABLE();}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00230}00230\ \textcolor{comment}{//\ \ /*\ DMA\ interrupt\ init\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00231}00231\ \textcolor{comment}{//\ \ HAL\_NVIC\_SetPriority(DMA1\_Stream1\_IRQn,\ 0,\ 0);}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00232}00232\ \textcolor{comment}{//\ \ HAL\_NVIC\_EnableIRQ(DMA1\_Stream1\_IRQn);}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00233}00233\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00234}00234\ \ \ \textcolor{comment}{/*\ SPI3\ clock\ reset\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00235}00235\ \ \ \_\_HAL\_RCC\_SPI3\_FORCE\_RESET();} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00236}00236\ \ \ \_\_HAL\_RCC\_SPI3\_RELEASE\_RESET();} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00237}00237\ \ \ \}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00238}00238\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ USE\_SPI3}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00239}00239\ \}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00240}00240\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00241}00241\ \textcolor{comment}{/**\ \ }} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00242}00242\ \textcolor{comment}{\ \ *\ @brief\ \ Проверка\ корректности\ структуры\ инициализации\ SPI.}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00243}00243\ \textcolor{comment}{\ \ *\ @param\ \ sspi\ Указатель\ на\ структуру\ с\ настройками\ SPI.}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00244}00244\ \textcolor{comment}{\ \ *\ @return\ HAL\ status.}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00245}00245\ \textcolor{comment}{\ \ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00246}\mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_ga333dd251bc878931086d48aa932b1a5f}{00246}}\ HAL\_StatusTypeDef\ \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_ga333dd251bc878931086d48aa932b1a5f}{SPI\_Check\_Init\_Struct}}(\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\_SettingsTypeDef}}\ *sspi)} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00247}00247\ \{} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00248}00248\ \ \ \textcolor{comment}{//\ check\ is\ settings\ are\ valid}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00249}00249\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_ALL\_INSTANCE(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Instance))} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00250}00250\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00251}00251\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00252}00252\ \ \ \textcolor{comment}{//\ check\ init\ settings}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00253}00253\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_MODE(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.Mode))} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00254}00254\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00255}00255\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_DIRECTION(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.Direction))} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00256}00256\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00257}00257\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_DATASIZE(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.DataSize))} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00258}00258\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00259}00259\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_BAUDRATE\_PRESCALER(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.BaudRatePrescaler))} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00260}00260\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00261}00261\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_CPOL(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.CLKPolarity))} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00262}00262\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00263}00263\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_CPHA(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.CLKPhase))} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00264}00264\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00265}00265\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_NSS(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.NSS))} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00266}00266\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00267}00267\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_FIRST\_BIT(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.FirstBit))} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00268}00268\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00269}00269\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_CRC\_CALCULATION(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.CRCCalculation))} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00270}00270\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00271}00271\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_CRC\_POLYNOMIAL(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.NSS)\ \&\&\ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00272}00272\ \ \ \ \ (sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.CRCCalculation\ !=\ SPI\_CRCCALCULATION\_DISABLE))} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00273}00273\ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00274}00274\ \ \ \textcolor{keywordflow}{if}\ (!IS\_SPI\_TIMODE(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.TIMode))} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00275}00275\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00276}00276\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00277}00277\ \ \ \textcolor{comment}{//\ check\ gpio}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00278}00278\ \ \ \textcolor{keywordflow}{if}\ (!IS\_GPIO\_ALL\_INSTANCE(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a6a15d48eccf92959de3a086031fdc979}{CLK\_GPIOx}})\ ||\ !IS\_GPIO\_ALL\_INSTANCE(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a0d55a2941854f61934487f3d209cfa95}{MISO\_GPIOx}})\ ||\ !IS\_GPIO\_ALL\_INSTANCE(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a0af3bdb273818ff97eb4ff3cff918820}{MOSI\_GPIOx}}))} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00279}00279\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;\ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00280}00280\ \ \ \textcolor{keywordflow}{if}\ (!IS\_GPIO\_PIN(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3bcb1ed12da3544e02e6d36493669bdc}{CLK\_PIN}})\ \&\&\ !IS\_GPIO\_PIN(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3366c654d7ec6dd41c6a0b504dc8509a}{MISO\_PIN}})\ \&\&\ !IS\_GPIO\_PIN(sspi-\/>\mbox{\hyperlink{struct_s_p_i___settings_type_def_a961208869faf4a7369aaf4edde75f176}{MOSI\_PIN}}))\ \textcolor{comment}{//\ if\ both\ pins\ arent\ set\ up}} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00281}00281\ \ \ \ \ \textcolor{keywordflow}{return}\ HAL\_ERROR;} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00282}00282\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00283}00283\ \ \ \textcolor{keywordflow}{return}\ HAL\_OK;} +\DoxyCodeLine{\Hypertarget{general__spi_8c_source_l00284}00284\ \}} + +\end{DoxyCode} diff --git a/Doc/latex/general__spi_8h.tex b/Doc/latex/general__spi_8h.tex new file mode 100644 index 0000000..27be6dc --- /dev/null +++ b/Doc/latex/general__spi_8h.tex @@ -0,0 +1,58 @@ +\doxysection{E\+:/.WORK/\+STM32/\+STM32\+\_\+\+Extended\+Libs/\+My\+Libs\+General/\+Inc/general\+\_\+spi.h File Reference} +\hypertarget{general__spi_8h}{}\label{general__spi_8h}\index{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Inc/general\_spi.h@{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Inc/general\_spi.h}} + + +Заголовочный файл для модуля инициализации SPI. + + +{\ttfamily \#include "{}mylibs\+\_\+defs.\+h"{}}\newline +Include dependency graph for general\+\_\+spi.\+h\+:\nopagebreak +\begin{figure}[H] +\begin{center} +\leavevmode +\includegraphics[width=229pt]{general__spi_8h__incl} +\end{center} +\end{figure} +This graph shows which files directly or indirectly include this file\+:\nopagebreak +\begin{figure}[H] +\begin{center} +\leavevmode +\includegraphics[width=229pt]{general__spi_8h__dep__incl} +\end{center} +\end{figure} +\doxysubsubsection*{Classes} +\begin{DoxyCompactItemize} +\item +struct \mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\+\_\+\+Settings\+Type\+Def}} +\begin{DoxyCompactList}\small\item\em Структура настроек SPI. \end{DoxyCompactList}\end{DoxyCompactItemize} +\doxysubsubsection*{Macros} +\begin{DoxyCompactItemize} +\item +\#define \mbox{\hyperlink{group___s_p_i___i_n_i_t_ga8ad4712bf4add56892d057778e826e0c}{HAL\+\_\+\+SPI\+\_\+\+MODULE\+\_\+\+ENABLED}} +\begin{DoxyCompactList}\small\item\em Включение HAL SPI. \end{DoxyCompactList}\item +\#define \mbox{\hyperlink{group___s_p_i___i_n_i_t_ga2fe0c8aeb2c61679f32836fef479eedf}{USE\+\_\+\+SPI1}} +\begin{DoxyCompactList}\small\item\em Включить SPI1 в \doxylink{group___m_y___l_i_b_s___s_p_i_gab9f13318daf02bc5b5f302ae392dccac}{SPI\+\_\+\+Msp\+Init}. \end{DoxyCompactList}\item +\#define \mbox{\hyperlink{group___s_p_i___i_n_i_t_ga53687cddb8e39e76a79b8ffaa152fb2b}{USE\+\_\+\+SPI2}} +\begin{DoxyCompactList}\small\item\em Включить SPI2 в \doxylink{group___m_y___l_i_b_s___s_p_i_gab9f13318daf02bc5b5f302ae392dccac}{SPI\+\_\+\+Msp\+Init}. \end{DoxyCompactList}\item +\#define \mbox{\hyperlink{group___s_p_i___i_n_i_t_ga5fdd6e5934a8005ef05b80f6d95883dc}{USE\+\_\+\+SPI3}} +\begin{DoxyCompactList}\small\item\em Включить SPI3 в \doxylink{group___m_y___l_i_b_s___s_p_i_gab9f13318daf02bc5b5f302ae392dccac}{SPI\+\_\+\+Msp\+Init}. \end{DoxyCompactList}\end{DoxyCompactItemize} +\doxysubsubsection*{Functions} +\begin{DoxyCompactItemize} +\item +HAL\+\_\+\+Status\+Type\+Def \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_ga0e177e3c57a8fcdc73b5602e72ec66ba}{SPI\+\_\+\+Base\+\_\+\+Init}} (\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\+\_\+\+Settings\+Type\+Def}} \texorpdfstring{$\ast$}{*}sspi) +\begin{DoxyCompactList}\small\item\em Инициализация SPI с помощью структуры \doxylink{struct_s_p_i___settings_type_def}{SPI\+\_\+\+Settings\+Type\+Def}. \end{DoxyCompactList}\item +HAL\+\_\+\+Status\+Type\+Def \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_ga333dd251bc878931086d48aa932b1a5f}{SPI\+\_\+\+Check\+\_\+\+Init\+\_\+\+Struct}} (\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\+\_\+\+Settings\+Type\+Def}} \texorpdfstring{$\ast$}{*}sspi) +\begin{DoxyCompactList}\small\item\em Проверка корректности структуры инициализации SPI. \end{DoxyCompactList}\item +void \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_gab9f13318daf02bc5b5f302ae392dccac}{SPI\+\_\+\+Msp\+Init}} (SPI\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}hspi) +\begin{DoxyCompactList}\small\item\em Настройка тактирования и прерываний SPI. \end{DoxyCompactList}\item +void \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_gac279cc3eaa35541edfe330a1844a85e4}{SPI\+\_\+\+Msp\+De\+Init}} (SPI\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}hspi) +\begin{DoxyCompactList}\small\item\em Деинициализация тактирования и прерываний SPI. \end{DoxyCompactList}\end{DoxyCompactItemize} + + +\doxysubsection{Detailed Description} +Заголовочный файл для модуля инициализации SPI. + + + +Definition in file \mbox{\hyperlink{general__spi_8h_source}{general\+\_\+spi.\+h}}. + diff --git a/Doc/latex/general__spi_8h__dep__incl.md5 b/Doc/latex/general__spi_8h__dep__incl.md5 new file mode 100644 index 0000000..f5ac2fc --- /dev/null +++ b/Doc/latex/general__spi_8h__dep__incl.md5 @@ -0,0 +1 @@ +fea888aee51476403223144bb4236fba \ No newline at end of file diff --git a/Doc/latex/general__spi_8h__dep__incl.pdf b/Doc/latex/general__spi_8h__dep__incl.pdf new file mode 100644 index 0000000..30f2e0d Binary files /dev/null and b/Doc/latex/general__spi_8h__dep__incl.pdf differ diff --git a/Doc/latex/general__spi_8h__incl.md5 b/Doc/latex/general__spi_8h__incl.md5 new file mode 100644 index 0000000..16cfe45 --- /dev/null +++ b/Doc/latex/general__spi_8h__incl.md5 @@ -0,0 +1 @@ +8a3d826e5468561d84d56e799c52cb0a \ No newline at end of file diff --git a/Doc/latex/general__spi_8h__incl.pdf b/Doc/latex/general__spi_8h__incl.pdf new file mode 100644 index 0000000..37c6296 Binary files /dev/null and b/Doc/latex/general__spi_8h__incl.pdf differ diff --git a/Doc/latex/general__spi_8h_source.tex b/Doc/latex/general__spi_8h_source.tex new file mode 100644 index 0000000..df6732d --- /dev/null +++ b/Doc/latex/general__spi_8h_source.tex @@ -0,0 +1,176 @@ +\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}} +\mbox{\hyperlink{general__spi_8h}{Go to the documentation of this file.}} +\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{comment}{*\ @defgroup\ MY\_LIBS\_SPI\ \ \ \ \ \ SPI\ Tools}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00007}00007\ \textcolor{comment}{*\ @ingroup\ \ MYLIBS\_PERIPHERAL}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00008}00008\ \textcolor{comment}{*\ @brief\ \ \ \ Функции\ и\ макросы\ для\ удобной\ работы\ с\ SPI.}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00009}00009\ \textcolor{comment}{*\ @details}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00010}00010\ \textcolor{comment}{Модуль\ предоставляет\ функции\ для\ базовой\ инициализации\ SPI}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00011}00011\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00012}00012\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00013}00013\ \textcolor{comment}{@par\ Пример\ использования:}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00014}00014\ \textcolor{comment}{@code}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00015}00015\ \textcolor{comment}{//\ Структура\ настроек\ SPI}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00016}00016\ \textcolor{comment}{SPI\_SettingsTypeDef\ spi1Settings;}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00017}00017\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00018}00018\ \textcolor{comment}{void\ SPI1\_Init(void)}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00019}00019\ \textcolor{comment}{\{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00020}00020\ \textcolor{comment}{\ \ \ \ //\ Настройка\ SPI1\ как\ Master,\ 8\ бит,\ полный\ дуплекс}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00021}00021\ \textcolor{comment}{\ \ \ \ spi1Settings.hspi.Instance\ =\ SPI1;}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00022}00022\ \textcolor{comment}{\ \ \ \ spi1Settings.hspi.Init.Mode\ =\ SPI\_MODE\_MASTER;}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00023}00023\ \textcolor{comment}{\ \ \ \ spi1Settings.hspi.Init.Direction\ =\ SPI\_DIRECTION\_2LINES;}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00024}00024\ \textcolor{comment}{\ \ \ \ spi1Settings.hspi.Init.DataSize\ =\ SPI\_DATASIZE\_8BIT;}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00025}00025\ \textcolor{comment}{\ \ \ \ spi1Settings.hspi.Init.CLKPolarity\ =\ SPI\_POLARITY\_LOW;}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00026}00026\ \textcolor{comment}{\ \ \ \ spi1Settings.hspi.Init.CLKPhase\ =\ SPI\_PHASE\_1EDGE;}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00027}00027\ \textcolor{comment}{\ \ \ \ spi1Settings.hspi.Init.NSS\ =\ SPI\_NSS\_SOFT;}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00028}00028\ \textcolor{comment}{\ \ \ \ spi1Settings.hspi.Init.BaudRatePrescaler\ =\ SPI\_BAUDRATEPRESCALER\_16;}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00029}00029\ \textcolor{comment}{\ \ \ \ spi1Settings.hspi.Init.FirstBit\ =\ SPI\_FIRSTBIT\_MSB;}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00030}00030\ \textcolor{comment}{\ \ \ \ spi1Settings.hspi.Init.TIMode\ =\ SPI\_TIMODE\_DISABLE;}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00031}00031\ \textcolor{comment}{\ \ \ \ spi1Settings.hspi.Init.CRCCalculation\ =\ SPI\_CRCCALCULATION\_DISABLE;}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00032}00032\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00033}00033\ \textcolor{comment}{\ \ \ \ //\ Настройка\ GPIO}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00034}00034\ \textcolor{comment}{\ \ \ \ spi1Settings.CLK\_GPIOx\ =\ GPIOA;}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00035}00035\ \textcolor{comment}{\ \ \ \ spi1Settings.CLK\_PIN\ =\ GPIO\_PIN\_5;}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00036}00036\ \textcolor{comment}{\ \ \ \ spi1Settings.CLK\_GPIO\_AlternageFunc\ =\ GPIO\_AF5\_SPI1;}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00037}00037\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00038}00038\ \textcolor{comment}{\ \ \ \ spi1Settings.MISO\_GPIOx\ =\ GPIOA;}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00039}00039\ \textcolor{comment}{\ \ \ \ spi1Settings.MISO\_PIN\ =\ GPIO\_PIN\_6;}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00040}00040\ \textcolor{comment}{\ \ \ \ spi1Settings.MISO\_GPIO\_AlternageFunc\ =\ GPIO\_AF5\_SPI1;}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00041}00041\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00042}00042\ \textcolor{comment}{\ \ \ \ spi1Settings.MOSI\_GPIOx\ =\ GPIOA;}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00043}00043\ \textcolor{comment}{\ \ \ \ spi1Settings.MOSI\_PIN\ =\ GPIO\_PIN\_7;}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00044}00044\ \textcolor{comment}{\ \ \ \ spi1Settings.MOSI\_GPIO\_AlternageFunc\ =\ GPIO\_AF5\_SPI1;}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00045}00045\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00046}00046\ \textcolor{comment}{\ \ \ \ //\ Инициализация\ SPI}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00047}00047\ \textcolor{comment}{\ \ \ \ if(SPI\_Base\_Init(\&spi1Settings)\ !=\ HAL\_OK)}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00048}00048\ \textcolor{comment}{\ \ \ \ \{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00049}00049\ \textcolor{comment}{\ \ \ \ \ \ \ \ //\ Обработка\ ошибки}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00050}00050\ \textcolor{comment}{\ \ \ \ \ \ \ \ Error\_Handler();}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00051}00051\ \textcolor{comment}{\ \ \ \ \}}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00052}00052\ \textcolor{comment}{\}}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00053}00053\ \textcolor{comment}{@endcode}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00054}00054\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00055}00055\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00056}00056\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00057}00057\ \textcolor{comment}{*\ \ @note\ Требуется\ подключение\ модуля\ SPI\ в\ библиотеке\ HAL\ }} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00058}00058\ \textcolor{comment}{@code\ }} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00059}00059\ \textcolor{comment}{\#define\ HAL\_SPI\_MODULE\_ENABLED}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00060}00060\ \textcolor{comment}{@endcode}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00061}00061\ \textcolor{comment}{*\ @\{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00062}00062\ \textcolor{comment}{*************************************************************************/}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00063}00063\ \textcolor{preprocessor}{\#ifndef\ \_\_SPI\_GENERAL\_H\_}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00064}00064\ \textcolor{preprocessor}{\#define\ \_\_SPI\_GENERAL\_H\_}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00065}00065\ } +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00066}00066\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00067}00067\ \textcolor{comment}{/////////////////////////////////////////////////////////////////////}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00068}00068\ \textcolor{comment}{/////////////////////////-\/-\/-\/USER\ SETTINGS-\/-\/-\//////////////////////////}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00069}00069\ \textcolor{comment}{/**\ }} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00070}00070\ \textcolor{comment}{\ \ *\ @addtogroup\ SPI\_INIT\ Init\ defines}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00071}00071\ \textcolor{comment}{\ \ *\ @ingroup\ \ \ \ MY\_LIBS\_SPI}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00072}00072\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ \ \ Настройка\ SPI}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00073}00073\ \textcolor{comment}{\ \ *\ @\{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00074}00074\ \textcolor{comment}{\ \ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00075}\mbox{\hyperlink{group___s_p_i___i_n_i_t_ga8ad4712bf4add56892d057778e826e0c}{00075}}\ \textcolor{preprocessor}{\#define\ HAL\_SPI\_MODULE\_ENABLED\ \ \ }\textcolor{comment}{///<\ Включение\ HAL\ SPI}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00076}00076\ } +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00077}\mbox{\hyperlink{group___s_p_i___i_n_i_t_ga2fe0c8aeb2c61679f32836fef479eedf}{00077}}\ \textcolor{preprocessor}{\#define\ USE\_SPI1\ \ \ \ }\textcolor{comment}{///<\ Включить\ SPI1\ в\ @ref\ SPI\_MspInit}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00078}\mbox{\hyperlink{group___s_p_i___i_n_i_t_ga53687cddb8e39e76a79b8ffaa152fb2b}{00078}}\ \textcolor{preprocessor}{\#define\ USE\_SPI2\ \ \ \ }\textcolor{comment}{///<\ Включить\ SPI2\ в\ @ref\ SPI\_MspInit}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00079}\mbox{\hyperlink{group___s_p_i___i_n_i_t_ga5fdd6e5934a8005ef05b80f6d95883dc}{00079}}\ \textcolor{preprocessor}{\#define\ USE\_SPI3\ \ \ \ }\textcolor{comment}{///<\ Включить\ SPI3\ в\ @ref\ SPI\_MspInit}\textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00080}00080\ \textcolor{comment}{/**\ SPI\_INIT}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00081}00081\ \textcolor{comment}{\ \ *\ @\}}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00082}00082\ \textcolor{comment}{\ \ */}\textcolor{preprocessor}{}\textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00083}00083\ \textcolor{comment}{/////////////////////////-\/-\/-\/USER\ SETTINGS-\/-\/-\//////////////////////////}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00084}00084\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{mylibs__defs_8h}{mylibs\_defs.h}}"{}}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00085}00085\ } +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00086}00086\ } +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00087}00087\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00088}00088\ \textcolor{comment}{/////////////////////////////////////////////////////////////////////}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00089}00089\ \textcolor{comment}{////////////////////////////-\/-\/-\/DEFINES-\/-\/-\/////////////////////////////}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00090}00090\ } +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00091}00091\ } +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00092}00092\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00093}00093\ \textcolor{comment}{////////////////////////////-\/-\/-\/DEFINES-\/-\/-\/////////////////////////////}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00094}00094\ } +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00095}00095\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00096}00096\ \textcolor{comment}{/////////////////////////////////////////////////////////////////////}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00097}00097\ \textcolor{comment}{///////////////////////-\/-\/-\/STRUCTURES\ \&\ ENUMS-\/-\/-\///////////////////////}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00098}00098\ \textcolor{comment}{/**}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00099}00099\ \textcolor{comment}{\ \ *\ @brief\ Структура\ настроек\ SPI}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00100}00100\ \textcolor{comment}{\ \ *\ @details\ Содержит\ все\ необходимые\ параметры\ для\ инициализации\ SPI,}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00101}00101\ \textcolor{comment}{\ \ *\ включая\ GPIO\ и\ DMA.}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00102}00102\ \textcolor{comment}{\ \ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00103}\mbox{\hyperlink{struct_s_p_i___settings_type_def}{00103}}\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00104}00104\ \{} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00105}\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{00105}}\ \ \ SPI\_HandleTypeDef\ \mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{///<\ HAL\ handle\ SPI}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00106}00106\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00107}\mbox{\hyperlink{struct_s_p_i___settings_type_def_a6a15d48eccf92959de3a086031fdc979}{00107}}\ \ \ GPIO\_TypeDef\ \ *\mbox{\hyperlink{struct_s_p_i___settings_type_def_a6a15d48eccf92959de3a086031fdc979}{CLK\_GPIOx}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{///<\ Порт\ CLK}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00108}\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3bcb1ed12da3544e02e6d36493669bdc}{00108}}\ \ \ uint32\_t\ \ \ \ \ \ \mbox{\hyperlink{struct_s_p_i___settings_type_def_a3bcb1ed12da3544e02e6d36493669bdc}{CLK\_PIN}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{///<\ Пин\ CLK}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00109}\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3f3748103a0b7861f6700042fd691ba1}{00109}}\ \ \ uint32\_t\ \ \ \ \ \ \mbox{\hyperlink{struct_s_p_i___settings_type_def_a3f3748103a0b7861f6700042fd691ba1}{CLK\_GPIO\_AlternageFunc}};\ \ \ \textcolor{comment}{///<\ Альтернативная\ функция\ для\ CLK}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00110}00110\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00111}\mbox{\hyperlink{struct_s_p_i___settings_type_def_a0d55a2941854f61934487f3d209cfa95}{00111}}\ \ \ GPIO\_TypeDef\ \ *\mbox{\hyperlink{struct_s_p_i___settings_type_def_a0d55a2941854f61934487f3d209cfa95}{MISO\_GPIOx}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{///<\ Порт\ MISO}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00112}\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3366c654d7ec6dd41c6a0b504dc8509a}{00112}}\ \ \ uint32\_t\ \ \ \ \ \ \mbox{\hyperlink{struct_s_p_i___settings_type_def_a3366c654d7ec6dd41c6a0b504dc8509a}{MISO\_PIN}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{///<\ Пин\ MISO}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00113}\mbox{\hyperlink{struct_s_p_i___settings_type_def_aecd7a5c6e205335b8ed229d74cd35d14}{00113}}\ \ \ uint32\_t\ \ \ \ \ \ \mbox{\hyperlink{struct_s_p_i___settings_type_def_aecd7a5c6e205335b8ed229d74cd35d14}{MISO\_GPIO\_AlternageFunc}};\ \ \textcolor{comment}{///<\ Альтернативная\ функция\ для\ MISO}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00114}00114\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00115}\mbox{\hyperlink{struct_s_p_i___settings_type_def_a0af3bdb273818ff97eb4ff3cff918820}{00115}}\ \ \ GPIO\_TypeDef\ \ *\mbox{\hyperlink{struct_s_p_i___settings_type_def_a0af3bdb273818ff97eb4ff3cff918820}{MOSI\_GPIOx}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{///<\ Порт\ MOSI}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00116}\mbox{\hyperlink{struct_s_p_i___settings_type_def_a961208869faf4a7369aaf4edde75f176}{00116}}\ \ \ uint32\_t\ \ \ \ \ \ \mbox{\hyperlink{struct_s_p_i___settings_type_def_a961208869faf4a7369aaf4edde75f176}{MOSI\_PIN}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{///<\ Пин\ MOSI}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00117}\mbox{\hyperlink{struct_s_p_i___settings_type_def_afbe75a1c36650a4a9b41fa706a4c7eab}{00117}}\ \ \ uint32\_t\ \ \ \ \ \ \mbox{\hyperlink{struct_s_p_i___settings_type_def_afbe75a1c36650a4a9b41fa706a4c7eab}{MOSI\_GPIO\_AlternageFunc}};\ \ \textcolor{comment}{///<\ Альтернативная\ функция\ для\ MOSI}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00118}00118\ } +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00119}\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3cfd9469b0617a68bbd2a161ba06bb95}{00119}}\ \ \ DMA\_Stream\_TypeDef\ *\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3cfd9469b0617a68bbd2a161ba06bb95}{DMAChannel}};\ \ \ \ \ \ \ \ \ \textcolor{comment}{///<\ Канал\ DMA\ (NULL\ если\ не\ нужен)}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00120}\mbox{\hyperlink{struct_s_p_i___settings_type_def_aa0edaa145076d2383b3e0095d156d474}{00120}}\ \ \ uint32\_t\ \mbox{\hyperlink{struct_s_p_i___settings_type_def_aa0edaa145076d2383b3e0095d156d474}{DMA\_CHANNEL\_X}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{///<\ Номер\ канала\ DMA\ (0\ если\ не\ нужен)}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00121}00121\ \ \ } +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00122}00122\ \}\ \mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\_SettingsTypeDef}};\textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00123}00123\ \textcolor{comment}{///////////////////////-\/-\/-\/STRUCTURES\ \&\ ENUMS-\/-\/-\///////////////////////}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00124}00124\ } +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00125}00125\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00126}00126\ \textcolor{comment}{/////////////////////////////////////////////////////////////////////}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00127}00127\ \textcolor{comment}{///////////////////////////-\/-\/-\/FUNCTIONS-\/-\/-\////////////////////////////}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00128}00128\ } +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00129}00129\ \textcolor{comment}{/*\ Инициализация\ SPI\ с\ использованием\ структуры\ настроек\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00130}00130\ HAL\_StatusTypeDef\ \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_ga0e177e3c57a8fcdc73b5602e72ec66ba}{SPI\_Base\_Init}}(\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\_SettingsTypeDef}}\ *sspi);} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00131}00131\ } +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00132}00132\ \textcolor{comment}{/*\ Проверка\ корректности\ структуры\ настроек\ SPI\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00133}00133\ HAL\_StatusTypeDef\ \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_ga333dd251bc878931086d48aa932b1a5f}{SPI\_Check\_Init\_Struct}}(\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\_SettingsTypeDef}}\ *sspi);} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00134}00134\ } +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00135}00135\ \textcolor{comment}{/*\ Инициализация\ тактирования\ и\ прерываний\ для\ выбранного\ SPI\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00136}00136\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_gab9f13318daf02bc5b5f302ae392dccac}{SPI\_MspInit}}(SPI\_HandleTypeDef\ *hspi);} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00137}00137\ } +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00138}00138\ \textcolor{comment}{/*\ Деинициализация\ тактирования\ и\ прерываний\ для\ выбранного\ SPI\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00139}00139\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_gac279cc3eaa35541edfe330a1844a85e4}{SPI\_MspDeInit}}(SPI\_HandleTypeDef\ *hspi);} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00140}00140\ } +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00141}00141\ \ \ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00142}00142\ \textcolor{comment}{/**\ }} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00143}00143\ \textcolor{comment}{\ *\ @cond\ SPI\_INTERNAL}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00144}00144\ \textcolor{comment}{\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00145}00145\ } +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00146}00146\ \textcolor{comment}{/*\ Настройка\ GPIO\ для\ SPI\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00147}00147\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{general__spi_8c_ae80d21e5cab86571709a2619442733b5}{SPI\_GPIO\_Init}}(\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\_SettingsTypeDef}}\ *sspi);} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00148}00148\ } +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00149}00149\ \textcolor{comment}{/*\ Настройка\ DMA\ для\ SPI\ */}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00150}00150\ \textcolor{keywordtype}{void}\ SPI\_DMA\_Init(SPI\_HandleTypeDef\ *hspi,\ DMA\_HandleTypeDef\ *hdma\_rx,\ DMA\_Stream\_TypeDef\ *DMAChannel,\ uint32\_t\ DMA\_CHANNEL\_X);} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00151}00151\ } +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00152}00152\ \textcolor{preprocessor}{\#ifndef\ \_\_USER\_LINKDMA}\textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00153}00153\ \textcolor{comment}{/**\ \ }} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00154}00154\ \textcolor{comment}{\ \ *\ @brief\ \ Аналог\ HAL\ макроса\ для\ привязки\ DMA\ к\ UART.}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00155}00155\ \textcolor{comment}{\ \ *\ @note\ \ \ @ref\ \_\_HAL\_LINKDMA.}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00156}00156\ \textcolor{comment}{\ \ */}\textcolor{preprocessor}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00157}00157\ \textcolor{preprocessor}{\#define\ \_\_USER\_LINKDMA(\_\_HANDLE\_\_,\ \_\_PPP\_DMA\_FIELD\_\_,\ \_\_DMA\_HANDLE\_\_)\ \ \ \(\backslash\)}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00158}00158\ \textcolor{preprocessor}{do\{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \(\backslash\)}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00159}00159\ \textcolor{preprocessor}{(\_\_HANDLE\_\_)-\/>\_\_PPP\_DMA\_FIELD\_\_\ =\ (\_\_DMA\_HANDLE\_\_);\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \(\backslash\)}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00160}00160\ \textcolor{preprocessor}{(\_\_DMA\_HANDLE\_\_)-\/>Parent\ =\ (\_\_HANDLE\_\_);\}\ while(0U)}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00161}00161\ \textcolor{preprocessor}{\#endif}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00162}00162\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00163}00163\ \textcolor{comment}{/**\ @endcond\ */}\textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00164}00164\ \textcolor{comment}{///////////////////////////-\/-\/-\/FUNCTIONS-\/-\/-\////////////////////////////}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00165}00165\ } +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00166}00166\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ \_\_SPI\_GENERAL\_H\_}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00167}00167\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00168}00168\ \textcolor{comment}{/**\ MY\_LIBS\_SPI}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00169}00169\ \textcolor{comment}{\ \ *\ @\}}} +\DoxyCodeLine{\Hypertarget{general__spi_8h_source_l00170}00170\ \textcolor{comment}{\ \ */}} + +\end{DoxyCode} diff --git a/Doc/latex/general__uart_8c.tex b/Doc/latex/general__uart_8c.tex new file mode 100644 index 0000000..204133f --- /dev/null +++ b/Doc/latex/general__uart_8c.tex @@ -0,0 +1,99 @@ +\doxysection{E\+:/.WORK/\+STM32/\+STM32\+\_\+\+Extended\+Libs/\+My\+Libs\+General/\+Src/general\+\_\+uart.c File Reference} +\hypertarget{general__uart_8c}{}\label{general__uart_8c}\index{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Src/general\_uart.c@{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Src/general\_uart.c}} + + +Модуль для инициализации UART. + + +{\ttfamily \#include "{}general\+\_\+uart.\+h"{}}\newline +{\ttfamily \#include "{}general\+\_\+gpio.\+h"{}}\newline +Include dependency graph for general\+\_\+uart.\+c\+:\nopagebreak +\begin{figure}[H] +\begin{center} +\leavevmode +\includegraphics[width=254pt]{general__uart_8c__incl} +\end{center} +\end{figure} +\doxysubsubsection*{Functions} +\begin{DoxyCompactItemize} +\item +HAL\+\_\+\+Status\+Type\+Def \mbox{\hyperlink{group___m_y___l_i_b_s___u_a_r_t_gab9f07396b778505c934143e89953e154}{UART\+\_\+\+Base\+\_\+\+Init}} (\mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\+\_\+\+Settings\+Type\+Def}} \texorpdfstring{$\ast$}{*}suart) +\begin{DoxyCompactList}\small\item\em Инициализация UART с помощью структуры \doxylink{struct_u_a_r_t___settings_type_def}{UART\+\_\+\+Settings\+Type\+Def}. \end{DoxyCompactList}\item +void \mbox{\hyperlink{general__uart_8c_a3abae05bbde5f3b402bf18ca13dc6a0b}{UART\+\_\+\+GPIO\+\_\+\+Init}} (GPIO\+\_\+\+Type\+Def \texorpdfstring{$\ast$}{*}GPIOx, uint16\+\_\+t GPIO\+\_\+\+PIN\+\_\+\+RX, uint16\+\_\+t GPIO\+\_\+\+PIN\+\_\+\+TX) +\begin{DoxyCompactList}\small\item\em Инициализация GPIO для UART. \end{DoxyCompactList}\item +void \mbox{\hyperlink{general__uart_8c_ad82d0cbd19151675135fd75dad315d05}{UART\+\_\+\+DMA\+\_\+\+Init}} (UART\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}huart, DMA\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}hdma\+\_\+rx, DMA\+\_\+\+Stream\+\_\+\+Type\+Def \texorpdfstring{$\ast$}{*}DMAChannel, uint32\+\_\+t DMA\+\_\+\+CHANNEL\+\_\+X) +\begin{DoxyCompactList}\small\item\em Инициализация DMA для UART. \end{DoxyCompactList}\item +void \mbox{\hyperlink{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\+\_\+\+Msp\+Init}} (UART\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}huart) +\begin{DoxyCompactList}\small\item\em Настройка тактирования и прерываний UART. \end{DoxyCompactList}\item +void \mbox{\hyperlink{group___m_y___l_i_b_s___u_a_r_t_ga93ed6ceef4e3b5e7885786125cce93bc}{UART\+\_\+\+Msp\+De\+Init}} (UART\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}huart) +\begin{DoxyCompactList}\small\item\em Деинициализация тактирования и прерываний UART. \end{DoxyCompactList}\item +HAL\+\_\+\+Status\+Type\+Def \mbox{\hyperlink{group___m_y___l_i_b_s___u_a_r_t_ga2a22e46ecb9e04b2ce197a0e9c09044a}{UART\+\_\+\+Check\+\_\+\+Init\+\_\+\+Struct}} (\mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\+\_\+\+Settings\+Type\+Def}} \texorpdfstring{$\ast$}{*}suart) +\begin{DoxyCompactList}\small\item\em Проверка корректности структуры инициализации UART. \end{DoxyCompactList}\end{DoxyCompactItemize} + + +\doxysubsection{Detailed Description} +Модуль для инициализации UART. + +Реализация функций для работы с UART\+: +\begin{DoxyItemize} +\item Инициализация UART и его линий RX/\+TX +\item Настройка DMA для UART +\item Настройка GPIO для UART +\item Настройка NVIC и тактирования UART +\end{DoxyItemize} + +Definition in file \mbox{\hyperlink{general__uart_8c_source}{general\+\_\+uart.\+c}}. + + + +\label{doc-func-members} +\Hypertarget{general__uart_8c_doc-func-members} +\doxysubsection{Function Documentation} +\Hypertarget{general__uart_8c_a3abae05bbde5f3b402bf18ca13dc6a0b}\index{general\_uart.c@{general\_uart.c}!UART\_GPIO\_Init@{UART\_GPIO\_Init}} +\index{UART\_GPIO\_Init@{UART\_GPIO\_Init}!general\_uart.c@{general\_uart.c}} +\doxysubsubsection{\texorpdfstring{UART\_GPIO\_Init()}{UART\_GPIO\_Init()}} +{\footnotesize\ttfamily \label{general__uart_8c_a3abae05bbde5f3b402bf18ca13dc6a0b} +void UART\+\_\+\+GPIO\+\_\+\+Init (\begin{DoxyParamCaption}\item[{GPIO\+\_\+\+Type\+Def \texorpdfstring{$\ast$}{*}}]{GPIOx}{, }\item[{uint16\+\_\+t}]{GPIO\+\_\+\+PIN\+\_\+\+RX}{, }\item[{uint16\+\_\+t}]{GPIO\+\_\+\+PIN\+\_\+\+TX}{}\end{DoxyParamCaption})} + + + +Инициализация GPIO для UART. + + +\begin{DoxyParams}{Parameters} +{\em GPIOx} & Порт для настройки. \\ +\hline +{\em GPIO\+\_\+\+PIN\+\_\+\+RX} & Пин для приема. \\ +\hline +{\em GPIO\+\_\+\+PIN\+\_\+\+TX} & Пин для передачи. \\ +\hline +\end{DoxyParams} + + +Definition at line \mbox{\hyperlink{general__uart_8c_source_l00069}{69}} of file \mbox{\hyperlink{general__uart_8c_source}{general\+\_\+uart.\+c}}. + +\Hypertarget{general__uart_8c_ad82d0cbd19151675135fd75dad315d05}\index{general\_uart.c@{general\_uart.c}!UART\_DMA\_Init@{UART\_DMA\_Init}} +\index{UART\_DMA\_Init@{UART\_DMA\_Init}!general\_uart.c@{general\_uart.c}} +\doxysubsubsection{\texorpdfstring{UART\_DMA\_Init()}{UART\_DMA\_Init()}} +{\footnotesize\ttfamily \label{general__uart_8c_ad82d0cbd19151675135fd75dad315d05} +void UART\+\_\+\+DMA\+\_\+\+Init (\begin{DoxyParamCaption}\item[{UART\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}}]{huart}{, }\item[{DMA\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}}]{hdma\+\_\+rx}{, }\item[{DMA\+\_\+\+Stream\+\_\+\+Type\+Def \texorpdfstring{$\ast$}{*}}]{DMAChannel}{, }\item[{uint32\+\_\+t}]{DMA\+\_\+\+CHANNEL\+\_\+X}{}\end{DoxyParamCaption})} + + + +Инициализация DMA для UART. + + +\begin{DoxyParams}{Parameters} +{\em huart} & Указатель на хендл UART. \\ +\hline +{\em hdma\+\_\+rx} & Указатель на хендл DMA для линии приема UART. \\ +\hline +{\em DMAChannel} & Указатель на канал DMA/поток DMA в STM32\+F407. \\ +\hline +{\em DMA\+\_\+\+CHANNEL\+\_\+X} & Канал DMA. \\ +\hline +\end{DoxyParams} + + +Definition at line \mbox{\hyperlink{general__uart_8c_source_l00109}{109}} of file \mbox{\hyperlink{general__uart_8c_source}{general\+\_\+uart.\+c}}. + diff --git a/Doc/latex/general__uart_8c__incl.md5 b/Doc/latex/general__uart_8c__incl.md5 new file mode 100644 index 0000000..3238d36 --- /dev/null +++ b/Doc/latex/general__uart_8c__incl.md5 @@ -0,0 +1 @@ +aca5aa942ee268e1ecf62cd6f36f940b \ No newline at end of file diff --git a/Doc/latex/general__uart_8c__incl.pdf b/Doc/latex/general__uart_8c__incl.pdf new file mode 100644 index 0000000..6988894 Binary files /dev/null and b/Doc/latex/general__uart_8c__incl.pdf differ diff --git a/Doc/latex/general__uart_8c_source.tex b/Doc/latex/general__uart_8c_source.tex new file mode 100644 index 0000000..2d231c4 --- /dev/null +++ b/Doc/latex/general__uart_8c_source.tex @@ -0,0 +1,389 @@ +\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}} +\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___m_y___l_i_b_s___u_a_r_t_gab9f07396b778505c934143e89953e154}{00032}}\ HAL\_StatusTypeDef\ \mbox{\hyperlink{group___m_y___l_i_b_s___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___m_y___l_i_b_s___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___m_y___l_i_b_s___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\ \ \ \ \ \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_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\ \ \ \ \ \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_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___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{00146}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___m_y___l_i_b_s___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___m_y___l_i_b_s___u_a_r_t_ga93ed6ceef4e3b5e7885786125cce93bc}{00267}}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___m_y___l_i_b_s___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___m_y___l_i_b_s___u_a_r_t_ga2a22e46ecb9e04b2ce197a0e9c09044a}{00364}}\ HAL\_StatusTypeDef\ \mbox{\hyperlink{group___m_y___l_i_b_s___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} diff --git a/Doc/latex/general__uart_8h.tex b/Doc/latex/general__uart_8h.tex new file mode 100644 index 0000000..717023b --- /dev/null +++ b/Doc/latex/general__uart_8h.tex @@ -0,0 +1,64 @@ +\doxysection{E\+:/.WORK/\+STM32/\+STM32\+\_\+\+Extended\+Libs/\+My\+Libs\+General/\+Inc/general\+\_\+uart.h File Reference} +\hypertarget{general__uart_8h}{}\label{general__uart_8h}\index{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Inc/general\_uart.h@{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Inc/general\_uart.h}} + + +Заголовочный файл для модуля инициализации UART. + + +{\ttfamily \#include "{}mylibs\+\_\+defs.\+h"{}}\newline +Include dependency graph for general\+\_\+uart.\+h\+:\nopagebreak +\begin{figure}[H] +\begin{center} +\leavevmode +\includegraphics[width=229pt]{general__uart_8h__incl} +\end{center} +\end{figure} +This graph shows which files directly or indirectly include this file\+:\nopagebreak +\begin{figure}[H] +\begin{center} +\leavevmode +\includegraphics[width=229pt]{general__uart_8h__dep__incl} +\end{center} +\end{figure} +\doxysubsubsection*{Classes} +\begin{DoxyCompactItemize} +\item +struct \mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\+\_\+\+Settings\+Type\+Def}} +\begin{DoxyCompactList}\small\item\em Структура настроек UART. \end{DoxyCompactList}\end{DoxyCompactItemize} +\doxysubsubsection*{Macros} +\begin{DoxyCompactItemize} +\item +\#define \mbox{\hyperlink{group___u_a_r_t___i_n_i_t_ga167269406e73327b95c3bb7b9cfe6d89}{HAL\+\_\+\+UART\+\_\+\+MODULE\+\_\+\+ENABLED}} +\begin{DoxyCompactList}\small\item\em Включение HAL UART. \end{DoxyCompactList}\item +\#define \mbox{\hyperlink{group___u_a_r_t___i_n_i_t_gace54f148bb1d72f13bf397d096d38d1b}{USE\+\_\+\+USART1}} +\begin{DoxyCompactList}\small\item\em Включить USART1 в \doxylink{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\+\_\+\+Msp\+Init}. \end{DoxyCompactList}\item +\#define \mbox{\hyperlink{group___u_a_r_t___i_n_i_t_gaacb3968508217a0d8b3f64aa0c8aa07d}{USE\+\_\+\+USART2}} +\begin{DoxyCompactList}\small\item\em Включить USART2 в \doxylink{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\+\_\+\+Msp\+Init}. \end{DoxyCompactList}\item +\#define \mbox{\hyperlink{group___u_a_r_t___i_n_i_t_ga6dadd967b428aade24008ec060009976}{USE\+\_\+\+USART3}} +\begin{DoxyCompactList}\small\item\em Включить USART3 в \doxylink{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\+\_\+\+Msp\+Init}. \end{DoxyCompactList}\item +\#define \mbox{\hyperlink{group___u_a_r_t___i_n_i_t_ga779530e93e7aa1f25eb13045ec42b8e7}{USE\+\_\+\+UART4}} +\begin{DoxyCompactList}\small\item\em Включить UART4 в \doxylink{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\+\_\+\+Msp\+Init}. \end{DoxyCompactList}\item +\#define \mbox{\hyperlink{group___u_a_r_t___i_n_i_t_ga592c6bf4a6496d6806ba0838cdfa2340}{USE\+\_\+\+UART5}} +\begin{DoxyCompactList}\small\item\em Включить UART5 в \doxylink{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\+\_\+\+Msp\+Init}. \end{DoxyCompactList}\item +\#define \mbox{\hyperlink{group___u_a_r_t___i_n_i_t_gafaeb8bdd4aa7fb1987505530daa90868}{USE\+\_\+\+USART6}} +\begin{DoxyCompactList}\small\item\em Включить USART6 в \doxylink{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\+\_\+\+Msp\+Init}. \end{DoxyCompactList}\end{DoxyCompactItemize} +\doxysubsubsection*{Functions} +\begin{DoxyCompactItemize} +\item +HAL\+\_\+\+Status\+Type\+Def \mbox{\hyperlink{group___m_y___l_i_b_s___u_a_r_t_gab9f07396b778505c934143e89953e154}{UART\+\_\+\+Base\+\_\+\+Init}} (\mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\+\_\+\+Settings\+Type\+Def}} \texorpdfstring{$\ast$}{*}suart) +\begin{DoxyCompactList}\small\item\em Инициализация UART с помощью структуры \doxylink{struct_u_a_r_t___settings_type_def}{UART\+\_\+\+Settings\+Type\+Def}. \end{DoxyCompactList}\item +HAL\+\_\+\+Status\+Type\+Def \mbox{\hyperlink{group___m_y___l_i_b_s___u_a_r_t_ga2a22e46ecb9e04b2ce197a0e9c09044a}{UART\+\_\+\+Check\+\_\+\+Init\+\_\+\+Struct}} (\mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\+\_\+\+Settings\+Type\+Def}} \texorpdfstring{$\ast$}{*}suart) +\begin{DoxyCompactList}\small\item\em Проверка корректности структуры инициализации UART. \end{DoxyCompactList}\item +void \mbox{\hyperlink{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\+\_\+\+Msp\+Init}} (UART\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}huart) +\begin{DoxyCompactList}\small\item\em Настройка тактирования и прерываний UART. \end{DoxyCompactList}\item +void \mbox{\hyperlink{group___m_y___l_i_b_s___u_a_r_t_ga93ed6ceef4e3b5e7885786125cce93bc}{UART\+\_\+\+Msp\+De\+Init}} (UART\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}huart) +\begin{DoxyCompactList}\small\item\em Деинициализация тактирования и прерываний UART. \end{DoxyCompactList}\end{DoxyCompactItemize} + + +\doxysubsection{Detailed Description} +Заголовочный файл для модуля инициализации UART. + + + +Definition in file \mbox{\hyperlink{general__uart_8h_source}{general\+\_\+uart.\+h}}. + diff --git a/Doc/latex/general__uart_8h__dep__incl.md5 b/Doc/latex/general__uart_8h__dep__incl.md5 new file mode 100644 index 0000000..389d754 --- /dev/null +++ b/Doc/latex/general__uart_8h__dep__incl.md5 @@ -0,0 +1 @@ +7baa47c3e07d62541ed2b703b2008261 \ No newline at end of file diff --git a/Doc/latex/general__uart_8h__dep__incl.pdf b/Doc/latex/general__uart_8h__dep__incl.pdf new file mode 100644 index 0000000..9be1d44 Binary files /dev/null and b/Doc/latex/general__uart_8h__dep__incl.pdf differ diff --git a/Doc/latex/general__uart_8h__incl.md5 b/Doc/latex/general__uart_8h__incl.md5 new file mode 100644 index 0000000..a5e6dee --- /dev/null +++ b/Doc/latex/general__uart_8h__incl.md5 @@ -0,0 +1 @@ +7d0dbc4788a1c22d3b92320c194dfaad \ No newline at end of file diff --git a/Doc/latex/general__uart_8h__incl.pdf b/Doc/latex/general__uart_8h__incl.pdf new file mode 100644 index 0000000..053acc6 Binary files /dev/null and b/Doc/latex/general__uart_8h__incl.pdf differ diff --git a/Doc/latex/general__uart_8h_source.tex b/Doc/latex/general__uart_8h_source.tex new file mode 100644 index 0000000..afc8879 --- /dev/null +++ b/Doc/latex/general__uart_8h_source.tex @@ -0,0 +1,162 @@ +\doxysection{general\+\_\+uart.\+h} +\hypertarget{general__uart_8h_source}{}\label{general__uart_8h_source}\index{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Inc/general\_uart.h@{E:/.WORK/STM32/STM32\_ExtendedLibs/MyLibsGeneral/Inc/general\_uart.h}} +\mbox{\hyperlink{general__uart_8h}{Go to the documentation of this file.}} +\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{comment}{*\ @defgroup\ MY\_LIBS\_UART\ \ \ \ \ \ UART\ Tools}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00007}00007\ \textcolor{comment}{*\ @ingroup\ \ MYLIBS\_PERIPHERAL}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00008}00008\ \textcolor{comment}{*\ @brief\ \ \ \ Функции\ и\ макросы\ для\ удобной\ работы\ с\ UART.}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00009}00009\ \textcolor{comment}{*\ @details}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00010}00010\ \textcolor{comment}{Модуль\ предоставляет\ функции\ для\ базовой\ инициализации\ UART}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00011}00011\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00012}00012\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00013}00013\ \textcolor{comment}{@par\ Пример\ использования:}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00014}00014\ \textcolor{comment}{@code}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00015}00015\ \textcolor{comment}{//\ Структура\ настроек\ UART}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00016}00016\ \textcolor{comment}{UART\_SettingsTypeDef\ uart2Settings;}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00017}00017\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00018}00018\ \textcolor{comment}{void\ UART2\_Init(void)}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00019}00019\ \textcolor{comment}{\{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00020}00020\ \textcolor{comment}{\ \ \ \ //\ Настройка\ UART2\ с\ 115200\ бод,\ 8\ бит,\ 1\ стоп-\/бит,\ без\ паритета}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00021}00021\ \textcolor{comment}{\ \ \ \ uart2Settings.huart.Instance\ =\ USART2;}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00022}00022\ \textcolor{comment}{\ \ \ \ uart2Settings.huart.Init.BaudRate\ =\ 115200;}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00023}00023\ \textcolor{comment}{\ \ \ \ uart2Settings.huart.Init.WordLength\ =\ UART\_WORDLENGTH\_8B;}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00024}00024\ \textcolor{comment}{\ \ \ \ uart2Settings.huart.Init.StopBits\ =\ UART\_STOPBITS\_1;}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00025}00025\ \textcolor{comment}{\ \ \ \ uart2Settings.huart.Init.Parity\ =\ UART\_PARITY\_NONE;}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00026}00026\ \textcolor{comment}{\ \ \ \ uart2Settings.huart.Init.Mode\ =\ UART\_MODE\_TX\_RX;}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00027}00027\ \textcolor{comment}{\ \ \ \ uart2Settings.huart.Init.HwFlowCtl\ =\ UART\_HWCONTROL\_NONE;}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00028}00028\ \textcolor{comment}{\ \ \ \ uart2Settings.huart.Init.OverSampling\ =\ UART\_OVERSAMPLING\_16;}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00029}00029\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00030}00030\ \textcolor{comment}{\ \ \ \ //\ Настройка\ GPIO}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00031}00031\ \textcolor{comment}{\ \ \ \ uart2Settings.GPIOx\ =\ GPIOA;}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00032}00032\ \textcolor{comment}{\ \ \ \ uart2Settings.GPIO\_PIN\_TX\ =\ GPIO\_PIN\_2;}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00033}00033\ \textcolor{comment}{\ \ \ \ uart2Settings.GPIO\_PIN\_RX\ =\ GPIO\_PIN\_3;}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00034}00034\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00035}00035\ \textcolor{comment}{\ \ \ \ //\ DMA\ не\ используется\ в\ этом\ примере}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00036}00036\ \textcolor{comment}{\ \ \ \ uart2Settings.DMAChannel\ =\ NULL;}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00037}00037\ \textcolor{comment}{\ \ \ \ uart2Settings.DMA\_CHANNEL\_X\ =\ 0;}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00038}00038\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00039}00039\ \textcolor{comment}{\ \ \ \ //\ Инициализация\ UART}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00040}00040\ \textcolor{comment}{\ \ \ \ if(UART\_Base\_Init(\&uart2Settings)\ !=\ HAL\_OK)}} +\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}{\ \ \ \ \ \ \ \ Error\_Handler();}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00044}00044\ \textcolor{comment}{\ \ \ \ \}}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00045}00045\ \textcolor{comment}{\}}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00046}00046\ \textcolor{comment}{@endcode}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00047}00047\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00048}00048\ \textcolor{comment}{*\ \ @note\ Требуется\ подключение\ модуля\ UART\ в\ библиотеке\ HAL\ }} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00049}00049\ \textcolor{comment}{@code\ }} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00050}00050\ \textcolor{comment}{\#define\ HAL\_UART\_MODULE\_ENABLED}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00051}00051\ \textcolor{comment}{@endcode}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00052}00052\ \textcolor{comment}{*\ @\{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00053}00053\ \textcolor{comment}{*************************************************************************/}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00054}00054\ \textcolor{preprocessor}{\#ifndef\ \_\_UART\_GENERAL\_H\_}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00055}00055\ \textcolor{preprocessor}{\#define\ \_\_UART\_GENERAL\_H\_}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00056}00056\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00057}00057\ \textcolor{comment}{/////////////////////////////////////////////////////////////////////}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00058}00058\ \textcolor{comment}{/////////////////////////-\/-\/-\/USER\ SETTINGS-\/-\/-\//////////////////////////}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00059}00059\ \textcolor{comment}{/**\ }} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00060}00060\ \textcolor{comment}{\ \ *\ @addtogroup\ UART\_INIT\ Init\ defines}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00061}00061\ \textcolor{comment}{\ \ *\ @ingroup\ \ \ \ MY\_LIBS\_UART}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00062}00062\ \textcolor{comment}{\ \ *\ @brief\ \ \ \ \ \ Настройка\ UART}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00063}00063\ \textcolor{comment}{\ \ *\ @\{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00064}00064\ \textcolor{comment}{\ \ */}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00065}\mbox{\hyperlink{group___u_a_r_t___i_n_i_t_ga167269406e73327b95c3bb7b9cfe6d89}{00065}}\ \textcolor{preprocessor}{\#define\ HAL\_UART\_MODULE\_ENABLED\ \ \ }\textcolor{comment}{///<\ Включение\ HAL\ UART}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00066}00066\ } +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00067}\mbox{\hyperlink{group___u_a_r_t___i_n_i_t_gace54f148bb1d72f13bf397d096d38d1b}{00067}}\ \textcolor{preprocessor}{\#define\ USE\_USART1\ \ \ \ }\textcolor{comment}{///<\ Включить\ USART1\ в\ @ref\ UART\_MspInit}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00068}\mbox{\hyperlink{group___u_a_r_t___i_n_i_t_gaacb3968508217a0d8b3f64aa0c8aa07d}{00068}}\ \textcolor{preprocessor}{\#define\ USE\_USART2\ \ \ \ }\textcolor{comment}{///<\ Включить\ USART2\ в\ @ref\ UART\_MspInit}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00069}\mbox{\hyperlink{group___u_a_r_t___i_n_i_t_ga6dadd967b428aade24008ec060009976}{00069}}\ \textcolor{preprocessor}{\#define\ USE\_USART3\ \ \ \ }\textcolor{comment}{///<\ Включить\ USART3\ в\ @ref\ UART\_MspInit}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00070}\mbox{\hyperlink{group___u_a_r_t___i_n_i_t_ga779530e93e7aa1f25eb13045ec42b8e7}{00070}}\ \textcolor{preprocessor}{\#define\ USE\_UART4\ \ \ \ \ }\textcolor{comment}{///<\ Включить\ UART4\ в\ @ref\ UART\_MspInit}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00071}\mbox{\hyperlink{group___u_a_r_t___i_n_i_t_ga592c6bf4a6496d6806ba0838cdfa2340}{00071}}\ \textcolor{preprocessor}{\#define\ USE\_UART5\ \ \ \ \ }\textcolor{comment}{///<\ Включить\ UART5\ в\ @ref\ UART\_MspInit}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00072}\mbox{\hyperlink{group___u_a_r_t___i_n_i_t_gafaeb8bdd4aa7fb1987505530daa90868}{00072}}\ \textcolor{preprocessor}{\#define\ USE\_USART6\ \ \ \ }\textcolor{comment}{///<\ Включить\ USART6\ в\ @ref\ UART\_MspInit}\textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00073}00073\ \textcolor{comment}{/**\ UART\_INIT}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00074}00074\ \textcolor{comment}{\ \ *\ @\}}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00075}00075\ \textcolor{comment}{\ \ */}\textcolor{preprocessor}{}\textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00076}00076\ \textcolor{comment}{/////////////////////////-\/-\/-\/USER\ SETTINGS-\/-\/-\//////////////////////////}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00077}00077\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{mylibs__defs_8h}{mylibs\_defs.h}}"{}}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00078}00078\ } +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00079}00079\ } +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00080}00080\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00081}00081\ \textcolor{comment}{/////////////////////////////////////////////////////////////////////}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00082}00082\ \textcolor{comment}{////////////////////////////-\/-\/-\/DEFINES-\/-\/-\/////////////////////////////}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00083}00083\ } +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00084}00084\ } +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00085}00085\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00086}00086\ \textcolor{comment}{////////////////////////////-\/-\/-\/DEFINES-\/-\/-\/////////////////////////////}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00087}00087\ } +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00088}00088\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00089}00089\ \textcolor{comment}{/////////////////////////////////////////////////////////////////////}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00090}00090\ \textcolor{comment}{///////////////////////-\/-\/-\/STRUCTURES\ \&\ ENUMS-\/-\/-\///////////////////////}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00091}00091\ \textcolor{comment}{/**}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00092}00092\ \textcolor{comment}{\ \ *\ @brief\ Структура\ настроек\ UART}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00093}00093\ \textcolor{comment}{\ \ *\ @details\ Содержит\ все\ необходимые\ параметры\ для\ инициализации\ UART,}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00094}00094\ \textcolor{comment}{\ \ *\ включая\ GPIO\ и\ DMA.}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00095}00095\ \textcolor{comment}{\ \ */}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00096}\mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{00096}}\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00097}00097\ \{} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00098}\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_accf2c9448a3ea8eb3b8c25a569276fea}{00098}}\ \ \ UART\_HandleTypeDef\ \mbox{\hyperlink{struct_u_a_r_t___settings_type_def_accf2c9448a3ea8eb3b8c25a569276fea}{huart}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{///<\ HAL\ handle\ UART}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00099}00099\ \ \ } +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00100}\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_af6f9910d065bae715cdb4a1024143a8f}{00100}}\ \ \ GPIO\_TypeDef\ *\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_af6f9910d065bae715cdb4a1024143a8f}{GPIOx}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{///<\ Порт\ для\ UART}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00101}\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_a3fba2b52788fe453348b5d92ed52ba49}{00101}}\ \ \ uint16\_t\ \mbox{\hyperlink{struct_u_a_r_t___settings_type_def_a3fba2b52788fe453348b5d92ed52ba49}{GPIO\_PIN\_RX}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{///<\ Пин\ приема}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00102}\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_a5f1babfcfb436cd77f5614253c0a5bef}{00102}}\ \ \ uint16\_t\ \mbox{\hyperlink{struct_u_a_r_t___settings_type_def_a5f1babfcfb436cd77f5614253c0a5bef}{GPIO\_PIN\_TX}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{///<\ Пин\ передачи}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00103}00103\ \ \ } +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00104}\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_a1ecc9ac6a1d2747ade56770cbab6a613}{00104}}\ \ \ DMA\_Stream\_TypeDef\ *\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_a1ecc9ac6a1d2747ade56770cbab6a613}{DMAChannel}};\ \ \ \ \ \ \ \ \ \textcolor{comment}{///<\ Канал\ DMA\ (NULL\ если\ не\ нужен)}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00105}\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_a15ce92b03f7f189bfbe1ab88a5f94d19}{00105}}\ \ \ uint32\_t\ \mbox{\hyperlink{struct_u_a_r_t___settings_type_def_a15ce92b03f7f189bfbe1ab88a5f94d19}{DMA\_CHANNEL\_X}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{///<\ Номер\ канала\ DMA\ (0\ если\ не\ нужен)}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00106}00106\ \ \ } +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00107}00107\ \}\ \mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\_SettingsTypeDef}};} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00108}00108\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00109}00109\ \textcolor{comment}{///////////////////////-\/-\/-\/STRUCTURES\ \&\ ENUMS-\/-\/-\///////////////////////}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00110}00110\ } +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00111}00111\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00112}00112\ \textcolor{comment}{/////////////////////////////////////////////////////////////////////}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00113}00113\ \textcolor{comment}{///////////////////////////-\/-\/-\/FUNCTIONS-\/-\/-\////////////////////////////}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00114}00114\ } +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00115}00115\ \textcolor{comment}{/*\ Инициализация\ UART\ с\ использованием\ структуры\ настроек\ */}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00116}00116\ HAL\_StatusTypeDef\ \mbox{\hyperlink{group___m_y___l_i_b_s___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_8h_source_l00117}00117\ } +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00118}00118\ \textcolor{comment}{/*\ Проверка\ корректности\ структуры\ настроек\ UART\ */}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00119}00119\ HAL\_StatusTypeDef\ \mbox{\hyperlink{group___m_y___l_i_b_s___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_8h_source_l00120}00120\ } +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00121}00121\ \textcolor{comment}{/*\ Инициализация\ тактирования\ и\ прерываний\ для\ выбранного\ UART\ */}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00122}00122\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\_MspInit}}(UART\_HandleTypeDef\ *huart);} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00123}00123\ } +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00124}00124\ \textcolor{comment}{/*\ Деинициализация\ тактирования\ и\ прерываний\ для\ выбранного\ UART\ */}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00125}00125\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{group___m_y___l_i_b_s___u_a_r_t_ga93ed6ceef4e3b5e7885786125cce93bc}{UART\_MspDeInit}}(UART\_HandleTypeDef\ *huart);} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00126}00126\ } +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00127}00127\ \ \ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00128}00128\ \textcolor{comment}{/**\ }} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00129}00129\ \textcolor{comment}{\ *\ @cond\ UART\_INTERNAL}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00130}00130\ \textcolor{comment}{\ */}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00131}00131\ } +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00132}00132\ \textcolor{comment}{/*\ Настройка\ GPIO\ для\ UART\ */}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00133}00133\ \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_8h_source_l00134}00134\ } +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00135}00135\ \textcolor{comment}{/*\ Настройка\ DMA\ для\ UART\ */}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00136}00136\ \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_8h_source_l00137}00137\ } +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00138}00138\ \textcolor{preprocessor}{\#ifndef\ \_\_USER\_LINKDMA}\textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00139}00139\ \textcolor{comment}{/**\ \ }} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00140}00140\ \textcolor{comment}{\ \ *\ @brief\ \ Аналог\ HAL\ макроса\ для\ привязки\ DMA\ к\ UART.}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00141}00141\ \textcolor{comment}{\ \ *\ @note\ \ \ @ref\ \_\_HAL\_LINKDMA.}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00142}00142\ \textcolor{comment}{\ \ */}\textcolor{preprocessor}{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00143}00143\ \textcolor{preprocessor}{\#define\ \_\_USER\_LINKDMA(\_\_HANDLE\_\_,\ \_\_PPP\_DMA\_FIELD\_\_,\ \_\_DMA\_HANDLE\_\_)\ \ \ \(\backslash\)}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00144}00144\ \textcolor{preprocessor}{do\{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \(\backslash\)}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00145}00145\ \textcolor{preprocessor}{(\_\_HANDLE\_\_)-\/>\_\_PPP\_DMA\_FIELD\_\_\ =\ (\_\_DMA\_HANDLE\_\_);\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \(\backslash\)}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00146}00146\ \textcolor{preprocessor}{(\_\_DMA\_HANDLE\_\_)-\/>Parent\ =\ (\_\_HANDLE\_\_);\}\ while(0U)}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00147}00147\ \textcolor{preprocessor}{\#endif}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00148}00148\ \ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00149}00149\ \textcolor{comment}{/**\ @endcond\ */}\textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00150}00150\ \textcolor{comment}{///////////////////////////-\/-\/-\/FUNCTIONS-\/-\/-\////////////////////////////}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00151}00151\ } +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00152}00152\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ \_\_UART\_GENERAL\_H\_}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00153}00153\ \textcolor{comment}{}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00154}00154\ \textcolor{comment}{/**\ MY\_LIBS\_UART}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00155}00155\ \textcolor{comment}{\ \ *\ @\}}} +\DoxyCodeLine{\Hypertarget{general__uart_8h_source_l00156}00156\ \textcolor{comment}{\ \ */}} + +\end{DoxyCode} diff --git a/Doc/latex/group___m_y___l_i_b_s___s_p_i.md5 b/Doc/latex/group___m_y___l_i_b_s___s_p_i.md5 new file mode 100644 index 0000000..85e5c62 --- /dev/null +++ b/Doc/latex/group___m_y___l_i_b_s___s_p_i.md5 @@ -0,0 +1 @@ +b9d2d820e20d54c87d46b9628c5b5f42 \ No newline at end of file diff --git a/Doc/latex/group___m_y___l_i_b_s___s_p_i.pdf b/Doc/latex/group___m_y___l_i_b_s___s_p_i.pdf new file mode 100644 index 0000000..5f01da5 Binary files /dev/null and b/Doc/latex/group___m_y___l_i_b_s___s_p_i.pdf differ diff --git a/Doc/latex/group___m_y___l_i_b_s___s_p_i.tex b/Doc/latex/group___m_y___l_i_b_s___s_p_i.tex new file mode 100644 index 0000000..e722937 --- /dev/null +++ b/Doc/latex/group___m_y___l_i_b_s___s_p_i.tex @@ -0,0 +1,195 @@ +\doxysubsubsection{SPI Tools } +\hypertarget{group___m_y___l_i_b_s___s_p_i}{}\label{group___m_y___l_i_b_s___s_p_i}\index{SPI Tools@{SPI Tools}} + + +Функции и макросы для удобной работы с SPI. + + +Collaboration diagram for SPI Tools\+:\nopagebreak +\begin{figure}[H] +\begin{center} +\leavevmode +\includegraphics[width=334pt]{group___m_y___l_i_b_s___s_p_i} +\end{center} +\end{figure} +\doxysubsubsubsubsection*{Topics} +\begin{DoxyCompactItemize} +\item +\mbox{\hyperlink{group___s_p_i___i_n_i_t}{Init defines}} +\begin{DoxyCompactList}\small\item\em Настройка SPI. \end{DoxyCompactList}\end{DoxyCompactItemize} +\doxysubsubsubsubsection*{Classes} +\begin{DoxyCompactItemize} +\item +struct \mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\+\_\+\+Settings\+Type\+Def}} +\begin{DoxyCompactList}\small\item\em Структура настроек SPI. \end{DoxyCompactList}\end{DoxyCompactItemize} +\doxysubsubsubsubsection*{Functions} +\begin{DoxyCompactItemize} +\item +HAL\+\_\+\+Status\+Type\+Def \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_ga0e177e3c57a8fcdc73b5602e72ec66ba}{SPI\+\_\+\+Base\+\_\+\+Init}} (\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\+\_\+\+Settings\+Type\+Def}} \texorpdfstring{$\ast$}{*}sspi) +\begin{DoxyCompactList}\small\item\em Инициализация SPI с помощью структуры \doxylink{struct_s_p_i___settings_type_def}{SPI\+\_\+\+Settings\+Type\+Def}. \end{DoxyCompactList}\item +HAL\+\_\+\+Status\+Type\+Def \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_ga333dd251bc878931086d48aa932b1a5f}{SPI\+\_\+\+Check\+\_\+\+Init\+\_\+\+Struct}} (\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\+\_\+\+Settings\+Type\+Def}} \texorpdfstring{$\ast$}{*}sspi) +\begin{DoxyCompactList}\small\item\em Проверка корректности структуры инициализации SPI. \end{DoxyCompactList}\item +void \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_gab9f13318daf02bc5b5f302ae392dccac}{SPI\+\_\+\+Msp\+Init}} (SPI\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}hspi) +\begin{DoxyCompactList}\small\item\em Настройка тактирования и прерываний SPI. \end{DoxyCompactList}\item +void \mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_gac279cc3eaa35541edfe330a1844a85e4}{SPI\+\_\+\+Msp\+De\+Init}} (SPI\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}hspi) +\begin{DoxyCompactList}\small\item\em Деинициализация тактирования и прерываний SPI. \end{DoxyCompactList}\end{DoxyCompactItemize} + + +\doxysubsubsubsection{Detailed Description} +Функции и макросы для удобной работы с SPI. + +Модуль предоставляет функции для базовой инициализации SPI + +\begin{DoxyParagraph}{Пример использования\+:} + +\begin{DoxyCode}{0} +\DoxyCodeLine{\textcolor{comment}{//\ Структура\ настроек\ SPI}} +\DoxyCodeLine{\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\_SettingsTypeDef}}\ spi1Settings;} +\DoxyCodeLine{} +\DoxyCodeLine{\textcolor{keywordtype}{void}\ SPI1\_Init(\textcolor{keywordtype}{void})} +\DoxyCodeLine{\{} +\DoxyCodeLine{\ \ \ \ \textcolor{comment}{//\ Настройка\ SPI1\ как\ Master,\ 8\ бит,\ полный\ дуплекс}} +\DoxyCodeLine{\ \ \ \ spi1Settings.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Instance\ =\ SPI1;} +\DoxyCodeLine{\ \ \ \ spi1Settings.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.Mode\ =\ SPI\_MODE\_MASTER;} +\DoxyCodeLine{\ \ \ \ spi1Settings.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.Direction\ =\ SPI\_DIRECTION\_2LINES;} +\DoxyCodeLine{\ \ \ \ spi1Settings.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.DataSize\ =\ SPI\_DATASIZE\_8BIT;} +\DoxyCodeLine{\ \ \ \ spi1Settings.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.CLKPolarity\ =\ SPI\_POLARITY\_LOW;} +\DoxyCodeLine{\ \ \ \ spi1Settings.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.CLKPhase\ =\ SPI\_PHASE\_1EDGE;} +\DoxyCodeLine{\ \ \ \ spi1Settings.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.NSS\ =\ SPI\_NSS\_SOFT;} +\DoxyCodeLine{\ \ \ \ spi1Settings.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.BaudRatePrescaler\ =\ SPI\_BAUDRATEPRESCALER\_16;} +\DoxyCodeLine{\ \ \ \ spi1Settings.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.FirstBit\ =\ SPI\_FIRSTBIT\_MSB;} +\DoxyCodeLine{\ \ \ \ spi1Settings.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.TIMode\ =\ SPI\_TIMODE\_DISABLE;} +\DoxyCodeLine{\ \ \ \ spi1Settings.\mbox{\hyperlink{struct_s_p_i___settings_type_def_ad203d8b8d67e4f477d002d15b03ba422}{hspi}}.Init.CRCCalculation\ =\ SPI\_CRCCALCULATION\_DISABLE;} +\DoxyCodeLine{} +\DoxyCodeLine{\ \ \ \ \textcolor{comment}{//\ Настройка\ GPIO}} +\DoxyCodeLine{\ \ \ \ spi1Settings.\mbox{\hyperlink{struct_s_p_i___settings_type_def_a6a15d48eccf92959de3a086031fdc979}{CLK\_GPIOx}}\ =\ GPIOA;} +\DoxyCodeLine{\ \ \ \ spi1Settings.\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3bcb1ed12da3544e02e6d36493669bdc}{CLK\_PIN}}\ =\ GPIO\_PIN\_5;} +\DoxyCodeLine{\ \ \ \ spi1Settings.\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3f3748103a0b7861f6700042fd691ba1}{CLK\_GPIO\_AlternageFunc}}\ =\ GPIO\_AF5\_SPI1;} +\DoxyCodeLine{} +\DoxyCodeLine{\ \ \ \ spi1Settings.\mbox{\hyperlink{struct_s_p_i___settings_type_def_a0d55a2941854f61934487f3d209cfa95}{MISO\_GPIOx}}\ =\ GPIOA;} +\DoxyCodeLine{\ \ \ \ spi1Settings.\mbox{\hyperlink{struct_s_p_i___settings_type_def_a3366c654d7ec6dd41c6a0b504dc8509a}{MISO\_PIN}}\ =\ GPIO\_PIN\_6;} +\DoxyCodeLine{\ \ \ \ spi1Settings.\mbox{\hyperlink{struct_s_p_i___settings_type_def_aecd7a5c6e205335b8ed229d74cd35d14}{MISO\_GPIO\_AlternageFunc}}\ =\ GPIO\_AF5\_SPI1;} +\DoxyCodeLine{} +\DoxyCodeLine{\ \ \ \ spi1Settings.\mbox{\hyperlink{struct_s_p_i___settings_type_def_a0af3bdb273818ff97eb4ff3cff918820}{MOSI\_GPIOx}}\ =\ GPIOA;} +\DoxyCodeLine{\ \ \ \ spi1Settings.\mbox{\hyperlink{struct_s_p_i___settings_type_def_a961208869faf4a7369aaf4edde75f176}{MOSI\_PIN}}\ =\ GPIO\_PIN\_7;} +\DoxyCodeLine{\ \ \ \ spi1Settings.\mbox{\hyperlink{struct_s_p_i___settings_type_def_afbe75a1c36650a4a9b41fa706a4c7eab}{MOSI\_GPIO\_AlternageFunc}}\ =\ GPIO\_AF5\_SPI1;} +\DoxyCodeLine{} +\DoxyCodeLine{\ \ \ \ \textcolor{comment}{//\ Инициализация\ SPI}} +\DoxyCodeLine{\ \ \ \ \textcolor{keywordflow}{if}(\mbox{\hyperlink{group___m_y___l_i_b_s___s_p_i_ga0e177e3c57a8fcdc73b5602e72ec66ba}{SPI\_Base\_Init}}(\&spi1Settings)\ !=\ HAL\_OK)} +\DoxyCodeLine{\ \ \ \ \{} +\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{comment}{//\ Обработка\ ошибки}} +\DoxyCodeLine{\ \ \ \ \ \ \ \ Error\_Handler();} +\DoxyCodeLine{\ \ \ \ \}} +\DoxyCodeLine{\}} + +\end{DoxyCode} + +\end{DoxyParagraph} +\begin{DoxyNote}{Note} +Требуется подключение модуля SPI в библиотеке HAL +\begin{DoxyCode}{0} +\DoxyCodeLine{\textcolor{preprocessor}{\#define\ HAL\_SPI\_MODULE\_ENABLED}} + +\end{DoxyCode} + +\end{DoxyNote} + + +\label{doc-func-members} +\Hypertarget{group___m_y___l_i_b_s___s_p_i_doc-func-members} +\doxysubsubsubsection{Function Documentation} +\Hypertarget{group___m_y___l_i_b_s___s_p_i_ga0e177e3c57a8fcdc73b5602e72ec66ba}\index{SPI Tools@{SPI Tools}!SPI\_Base\_Init@{SPI\_Base\_Init}} +\index{SPI\_Base\_Init@{SPI\_Base\_Init}!SPI Tools@{SPI Tools}} +\doxysubsubsubsubsection{\texorpdfstring{SPI\_Base\_Init()}{SPI\_Base\_Init()}} +{\footnotesize\ttfamily \label{group___m_y___l_i_b_s___s_p_i_ga0e177e3c57a8fcdc73b5602e72ec66ba} +HAL\+\_\+\+Status\+Type\+Def SPI\+\_\+\+Base\+\_\+\+Init (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\+\_\+\+Settings\+Type\+Def}} \texorpdfstring{$\ast$}{*}}]{sspi}{}\end{DoxyParamCaption})} + + + +Инициализация SPI с помощью структуры \doxylink{struct_s_p_i___settings_type_def}{SPI\+\_\+\+Settings\+Type\+Def}. + + +\begin{DoxyParams}{Parameters} +{\em sspi} & Указатель на структуру с настройками SPI. \\ +\hline +\end{DoxyParams} +\begin{DoxyReturn}{Returns} +HAL status. +\end{DoxyReturn} +~\newline + Инициализирует SPI и его GPIO. Настройка аналогична HAL\+\_\+\+SPI\+\_\+\+Init +\begin{DoxyCode}{0} +\DoxyCodeLine{suart.hspi.Init...} + +\end{DoxyCode} + но дополнительно надо прописать пины CLK/\+MISO/\+MOSI \doxylink{struct_s_p_i___settings_type_def}{SPI\+\_\+\+Settings\+Type\+Def} + +Definition at line \mbox{\hyperlink{general__spi_8c_source_l00028}{28}} of file \mbox{\hyperlink{general__spi_8c_source}{general\+\_\+spi.\+c}}. + +\Hypertarget{group___m_y___l_i_b_s___s_p_i_ga333dd251bc878931086d48aa932b1a5f}\index{SPI Tools@{SPI Tools}!SPI\_Check\_Init\_Struct@{SPI\_Check\_Init\_Struct}} +\index{SPI\_Check\_Init\_Struct@{SPI\_Check\_Init\_Struct}!SPI Tools@{SPI Tools}} +\doxysubsubsubsubsection{\texorpdfstring{SPI\_Check\_Init\_Struct()}{SPI\_Check\_Init\_Struct()}} +{\footnotesize\ttfamily \label{group___m_y___l_i_b_s___s_p_i_ga333dd251bc878931086d48aa932b1a5f} +HAL\+\_\+\+Status\+Type\+Def SPI\+\_\+\+Check\+\_\+\+Init\+\_\+\+Struct (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{struct_s_p_i___settings_type_def}{SPI\+\_\+\+Settings\+Type\+Def}} \texorpdfstring{$\ast$}{*}}]{sspi}{}\end{DoxyParamCaption})} + + + +Проверка корректности структуры инициализации SPI. + + +\begin{DoxyParams}{Parameters} +{\em sspi} & Указатель на структуру с настройками SPI. \\ +\hline +\end{DoxyParams} +\begin{DoxyReturn}{Returns} +HAL status. +\end{DoxyReturn} + + +Definition at line \mbox{\hyperlink{general__spi_8c_source_l00246}{246}} of file \mbox{\hyperlink{general__spi_8c_source}{general\+\_\+spi.\+c}}. + +\Hypertarget{group___m_y___l_i_b_s___s_p_i_gab9f13318daf02bc5b5f302ae392dccac}\index{SPI Tools@{SPI Tools}!SPI\_MspInit@{SPI\_MspInit}} +\index{SPI\_MspInit@{SPI\_MspInit}!SPI Tools@{SPI Tools}} +\doxysubsubsubsubsection{\texorpdfstring{SPI\_MspInit()}{SPI\_MspInit()}} +{\footnotesize\ttfamily \label{group___m_y___l_i_b_s___s_p_i_gab9f13318daf02bc5b5f302ae392dccac} +void SPI\+\_\+\+Msp\+Init (\begin{DoxyParamCaption}\item[{SPI\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}}]{hspi}{}\end{DoxyParamCaption})} + + + +Настройка тактирования и прерываний SPI. + + +\begin{DoxyParams}{Parameters} +{\em hspi} & Указатель на хендл SPI. \\ +\hline +\end{DoxyParams} +\begin{DoxyNote}{Note} +Чтобы не генерировать функцию с иницилизацией неиспользуемых SPI, дефайнами \doxylink{group___s_p_i___i_n_i_t}{Init defines} в \doxylink{general__spi_8h}{general\+\_\+spi.\+h} определяются используемые SPI. +\end{DoxyNote} + + +Definition at line \mbox{\hyperlink{general__spi_8c_source_l00127}{127}} of file \mbox{\hyperlink{general__spi_8c_source}{general\+\_\+spi.\+c}}. + +\Hypertarget{group___m_y___l_i_b_s___s_p_i_gac279cc3eaa35541edfe330a1844a85e4}\index{SPI Tools@{SPI Tools}!SPI\_MspDeInit@{SPI\_MspDeInit}} +\index{SPI\_MspDeInit@{SPI\_MspDeInit}!SPI Tools@{SPI Tools}} +\doxysubsubsubsubsection{\texorpdfstring{SPI\_MspDeInit()}{SPI\_MspDeInit()}} +{\footnotesize\ttfamily \label{group___m_y___l_i_b_s___s_p_i_gac279cc3eaa35541edfe330a1844a85e4} +void SPI\+\_\+\+Msp\+De\+Init (\begin{DoxyParamCaption}\item[{SPI\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}}]{hspi}{}\end{DoxyParamCaption})} + + + +Деинициализация тактирования и прерываний SPI. + + +\begin{DoxyParams}{Parameters} +{\em hspi} & Указатель на хендл SPI. \\ +\hline +\end{DoxyParams} +\begin{DoxyNote}{Note} +Чтобы не генерировать функцию с иницилизацией неиспользуемых SPI, дефайнами \doxylink{group___s_p_i___i_n_i_t}{Init defines} в \doxylink{general__spi_8h}{general\+\_\+spi.\+h} определяются используемые SPI. +\end{DoxyNote} + + +Definition at line \mbox{\hyperlink{general__spi_8c_source_l00191}{191}} of file \mbox{\hyperlink{general__spi_8c_source}{general\+\_\+spi.\+c}}. + +\input{group___s_p_i___i_n_i_t} diff --git a/Doc/latex/group___m_y___l_i_b_s___u_a_r_t.md5 b/Doc/latex/group___m_y___l_i_b_s___u_a_r_t.md5 new file mode 100644 index 0000000..9c19d2c --- /dev/null +++ b/Doc/latex/group___m_y___l_i_b_s___u_a_r_t.md5 @@ -0,0 +1 @@ +5475854d3a1c20af70a164c6fe76463e \ No newline at end of file diff --git a/Doc/latex/group___m_y___l_i_b_s___u_a_r_t.pdf b/Doc/latex/group___m_y___l_i_b_s___u_a_r_t.pdf new file mode 100644 index 0000000..cb8cbf4 Binary files /dev/null and b/Doc/latex/group___m_y___l_i_b_s___u_a_r_t.pdf differ diff --git a/Doc/latex/group___m_y___l_i_b_s___u_a_r_t.tex b/Doc/latex/group___m_y___l_i_b_s___u_a_r_t.tex new file mode 100644 index 0000000..9a4d246 --- /dev/null +++ b/Doc/latex/group___m_y___l_i_b_s___u_a_r_t.tex @@ -0,0 +1,193 @@ +\doxysubsubsection{UART Tools } +\hypertarget{group___m_y___l_i_b_s___u_a_r_t}{}\label{group___m_y___l_i_b_s___u_a_r_t}\index{UART Tools@{UART Tools}} + + +Функции и макросы для удобной работы с UART. + + +Collaboration diagram for UART Tools\+:\nopagebreak +\begin{figure}[H] +\begin{center} +\leavevmode +\includegraphics[width=344pt]{group___m_y___l_i_b_s___u_a_r_t} +\end{center} +\end{figure} +\doxysubsubsubsubsection*{Topics} +\begin{DoxyCompactItemize} +\item +\mbox{\hyperlink{group___u_a_r_t___i_n_i_t}{Init defines}} +\begin{DoxyCompactList}\small\item\em Настройка UART. \end{DoxyCompactList}\end{DoxyCompactItemize} +\doxysubsubsubsubsection*{Classes} +\begin{DoxyCompactItemize} +\item +struct \mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\+\_\+\+Settings\+Type\+Def}} +\begin{DoxyCompactList}\small\item\em Структура настроек UART. \end{DoxyCompactList}\end{DoxyCompactItemize} +\doxysubsubsubsubsection*{Functions} +\begin{DoxyCompactItemize} +\item +HAL\+\_\+\+Status\+Type\+Def \mbox{\hyperlink{group___m_y___l_i_b_s___u_a_r_t_gab9f07396b778505c934143e89953e154}{UART\+\_\+\+Base\+\_\+\+Init}} (\mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\+\_\+\+Settings\+Type\+Def}} \texorpdfstring{$\ast$}{*}suart) +\begin{DoxyCompactList}\small\item\em Инициализация UART с помощью структуры \doxylink{struct_u_a_r_t___settings_type_def}{UART\+\_\+\+Settings\+Type\+Def}. \end{DoxyCompactList}\item +HAL\+\_\+\+Status\+Type\+Def \mbox{\hyperlink{group___m_y___l_i_b_s___u_a_r_t_ga2a22e46ecb9e04b2ce197a0e9c09044a}{UART\+\_\+\+Check\+\_\+\+Init\+\_\+\+Struct}} (\mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\+\_\+\+Settings\+Type\+Def}} \texorpdfstring{$\ast$}{*}suart) +\begin{DoxyCompactList}\small\item\em Проверка корректности структуры инициализации UART. \end{DoxyCompactList}\item +void \mbox{\hyperlink{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\+\_\+\+Msp\+Init}} (UART\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}huart) +\begin{DoxyCompactList}\small\item\em Настройка тактирования и прерываний UART. \end{DoxyCompactList}\item +void \mbox{\hyperlink{group___m_y___l_i_b_s___u_a_r_t_ga93ed6ceef4e3b5e7885786125cce93bc}{UART\+\_\+\+Msp\+De\+Init}} (UART\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}huart) +\begin{DoxyCompactList}\small\item\em Деинициализация тактирования и прерываний UART. \end{DoxyCompactList}\end{DoxyCompactItemize} + + +\doxysubsubsubsection{Detailed Description} +Функции и макросы для удобной работы с UART. + +Модуль предоставляет функции для базовой инициализации UART + +\begin{DoxyParagraph}{Пример использования\+:} + +\begin{DoxyCode}{0} +\DoxyCodeLine{\textcolor{comment}{//\ Структура\ настроек\ UART}} +\DoxyCodeLine{\mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\_SettingsTypeDef}}\ uart2Settings;} +\DoxyCodeLine{} +\DoxyCodeLine{\textcolor{keywordtype}{void}\ UART2\_Init(\textcolor{keywordtype}{void})} +\DoxyCodeLine{\{} +\DoxyCodeLine{\ \ \ \ \textcolor{comment}{//\ Настройка\ UART2\ с\ 115200\ бод,\ 8\ бит,\ 1\ стоп-\/бит,\ без\ паритета}} +\DoxyCodeLine{\ \ \ \ uart2Settings.\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_accf2c9448a3ea8eb3b8c25a569276fea}{huart}}.Instance\ =\ USART2;} +\DoxyCodeLine{\ \ \ \ uart2Settings.\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_accf2c9448a3ea8eb3b8c25a569276fea}{huart}}.Init.BaudRate\ =\ 115200;} +\DoxyCodeLine{\ \ \ \ uart2Settings.\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_accf2c9448a3ea8eb3b8c25a569276fea}{huart}}.Init.WordLength\ =\ UART\_WORDLENGTH\_8B;} +\DoxyCodeLine{\ \ \ \ uart2Settings.\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_accf2c9448a3ea8eb3b8c25a569276fea}{huart}}.Init.StopBits\ =\ UART\_STOPBITS\_1;} +\DoxyCodeLine{\ \ \ \ uart2Settings.\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_accf2c9448a3ea8eb3b8c25a569276fea}{huart}}.Init.Parity\ =\ UART\_PARITY\_NONE;} +\DoxyCodeLine{\ \ \ \ uart2Settings.\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_accf2c9448a3ea8eb3b8c25a569276fea}{huart}}.Init.Mode\ =\ UART\_MODE\_TX\_RX;} +\DoxyCodeLine{\ \ \ \ uart2Settings.\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_accf2c9448a3ea8eb3b8c25a569276fea}{huart}}.Init.HwFlowCtl\ =\ UART\_HWCONTROL\_NONE;} +\DoxyCodeLine{\ \ \ \ uart2Settings.\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_accf2c9448a3ea8eb3b8c25a569276fea}{huart}}.Init.OverSampling\ =\ UART\_OVERSAMPLING\_16;} +\DoxyCodeLine{} +\DoxyCodeLine{\ \ \ \ \textcolor{comment}{//\ Настройка\ GPIO}} +\DoxyCodeLine{\ \ \ \ uart2Settings.\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_af6f9910d065bae715cdb4a1024143a8f}{GPIOx}}\ =\ GPIOA;} +\DoxyCodeLine{\ \ \ \ uart2Settings.\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_a5f1babfcfb436cd77f5614253c0a5bef}{GPIO\_PIN\_TX}}\ =\ GPIO\_PIN\_2;} +\DoxyCodeLine{\ \ \ \ uart2Settings.\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_a3fba2b52788fe453348b5d92ed52ba49}{GPIO\_PIN\_RX}}\ =\ GPIO\_PIN\_3;} +\DoxyCodeLine{} +\DoxyCodeLine{\ \ \ \ \textcolor{comment}{//\ DMA\ не\ используется\ в\ этом\ примере}} +\DoxyCodeLine{\ \ \ \ uart2Settings.\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_a1ecc9ac6a1d2747ade56770cbab6a613}{DMAChannel}}\ =\ NULL;} +\DoxyCodeLine{\ \ \ \ uart2Settings.\mbox{\hyperlink{struct_u_a_r_t___settings_type_def_a15ce92b03f7f189bfbe1ab88a5f94d19}{DMA\_CHANNEL\_X}}\ =\ 0;} +\DoxyCodeLine{} +\DoxyCodeLine{\ \ \ \ \textcolor{comment}{//\ Инициализация\ UART}} +\DoxyCodeLine{\ \ \ \ \textcolor{keywordflow}{if}(\mbox{\hyperlink{group___m_y___l_i_b_s___u_a_r_t_gab9f07396b778505c934143e89953e154}{UART\_Base\_Init}}(\&uart2Settings)\ !=\ HAL\_OK)} +\DoxyCodeLine{\ \ \ \ \{} +\DoxyCodeLine{\ \ \ \ \ \ \ \ \textcolor{comment}{//\ Обработка\ ошибки}} +\DoxyCodeLine{\ \ \ \ \ \ \ \ Error\_Handler();} +\DoxyCodeLine{\ \ \ \ \}} +\DoxyCodeLine{\}} + +\end{DoxyCode} + +\end{DoxyParagraph} +\begin{DoxyNote}{Note} +Требуется подключение модуля UART в библиотеке HAL +\begin{DoxyCode}{0} +\DoxyCodeLine{\textcolor{preprocessor}{\#define\ HAL\_UART\_MODULE\_ENABLED}} + +\end{DoxyCode} + +\end{DoxyNote} + + +\label{doc-func-members} +\Hypertarget{group___m_y___l_i_b_s___u_a_r_t_doc-func-members} +\doxysubsubsubsection{Function Documentation} +\Hypertarget{group___m_y___l_i_b_s___u_a_r_t_gab9f07396b778505c934143e89953e154}\index{UART Tools@{UART Tools}!UART\_Base\_Init@{UART\_Base\_Init}} +\index{UART\_Base\_Init@{UART\_Base\_Init}!UART Tools@{UART Tools}} +\doxysubsubsubsubsection{\texorpdfstring{UART\_Base\_Init()}{UART\_Base\_Init()}} +{\footnotesize\ttfamily \label{group___m_y___l_i_b_s___u_a_r_t_gab9f07396b778505c934143e89953e154} +HAL\+\_\+\+Status\+Type\+Def UART\+\_\+\+Base\+\_\+\+Init (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\+\_\+\+Settings\+Type\+Def}} \texorpdfstring{$\ast$}{*}}]{suart}{}\end{DoxyParamCaption})} + + + +Инициализация UART с помощью структуры \doxylink{struct_u_a_r_t___settings_type_def}{UART\+\_\+\+Settings\+Type\+Def}. + + +\begin{DoxyParams}{Parameters} +{\em suart} & Указатель на структуру с настройками UART. \\ +\hline +\end{DoxyParams} +\begin{DoxyReturn}{Returns} +HAL status. +\end{DoxyReturn} +~\newline + Инициализирует UART и его GPIO и при необходимости DMA. Настройка аналогична HAL\+\_\+\+UART\+\_\+\+Init +\begin{DoxyCode}{0} +\DoxyCodeLine{suart.huart.Init...} + +\end{DoxyCode} + но дополнительно надо прописать пины RX/\+TX \doxylink{struct_u_a_r_t___settings_type_def}{UART\+\_\+\+Settings\+Type\+Def} +\begin{DoxyCode}{0} +\DoxyCodeLine{suart-\/>GPIOx,\ suart-\/>GPIO\_PIN\_RX,\ suart-\/>GPIO\_PIN\_TX} + +\end{DoxyCode} + + +Definition at line \mbox{\hyperlink{general__uart_8c_source_l00032}{32}} of file \mbox{\hyperlink{general__uart_8c_source}{general\+\_\+uart.\+c}}. + +\Hypertarget{group___m_y___l_i_b_s___u_a_r_t_ga2a22e46ecb9e04b2ce197a0e9c09044a}\index{UART Tools@{UART Tools}!UART\_Check\_Init\_Struct@{UART\_Check\_Init\_Struct}} +\index{UART\_Check\_Init\_Struct@{UART\_Check\_Init\_Struct}!UART Tools@{UART Tools}} +\doxysubsubsubsubsection{\texorpdfstring{UART\_Check\_Init\_Struct()}{UART\_Check\_Init\_Struct()}} +{\footnotesize\ttfamily \label{group___m_y___l_i_b_s___u_a_r_t_ga2a22e46ecb9e04b2ce197a0e9c09044a} +HAL\+\_\+\+Status\+Type\+Def UART\+\_\+\+Check\+\_\+\+Init\+\_\+\+Struct (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\+\_\+\+Settings\+Type\+Def}} \texorpdfstring{$\ast$}{*}}]{suart}{}\end{DoxyParamCaption})} + + + +Проверка корректности структуры инициализации UART. + + +\begin{DoxyParams}{Parameters} +{\em suart} & Указатель на структуру с настройками UART. \\ +\hline +\end{DoxyParams} +\begin{DoxyReturn}{Returns} +HAL status. +\end{DoxyReturn} + + +Definition at line \mbox{\hyperlink{general__uart_8c_source_l00364}{364}} of file \mbox{\hyperlink{general__uart_8c_source}{general\+\_\+uart.\+c}}. + +\Hypertarget{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}\index{UART Tools@{UART Tools}!UART\_MspInit@{UART\_MspInit}} +\index{UART\_MspInit@{UART\_MspInit}!UART Tools@{UART Tools}} +\doxysubsubsubsubsection{\texorpdfstring{UART\_MspInit()}{UART\_MspInit()}} +{\footnotesize\ttfamily \label{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb} +void UART\+\_\+\+Msp\+Init (\begin{DoxyParamCaption}\item[{UART\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}}]{huart}{}\end{DoxyParamCaption})} + + + +Настройка тактирования и прерываний UART. + + +\begin{DoxyParams}{Parameters} +{\em huart} & Указатель на хендл UART. \\ +\hline +\end{DoxyParams} +\begin{DoxyNote}{Note} +Чтобы не генерировать функцию с иницилизацией неиспользуемых UART, дефайнами \doxylink{group___u_a_r_t___i_n_i_t}{Init defines} в \doxylink{general__uart_8h}{general\+\_\+uart.\+h} определяются используемые UART. +\end{DoxyNote} + + +Definition at line \mbox{\hyperlink{general__uart_8c_source_l00146}{146}} of file \mbox{\hyperlink{general__uart_8c_source}{general\+\_\+uart.\+c}}. + +\Hypertarget{group___m_y___l_i_b_s___u_a_r_t_ga93ed6ceef4e3b5e7885786125cce93bc}\index{UART Tools@{UART Tools}!UART\_MspDeInit@{UART\_MspDeInit}} +\index{UART\_MspDeInit@{UART\_MspDeInit}!UART Tools@{UART Tools}} +\doxysubsubsubsubsection{\texorpdfstring{UART\_MspDeInit()}{UART\_MspDeInit()}} +{\footnotesize\ttfamily \label{group___m_y___l_i_b_s___u_a_r_t_ga93ed6ceef4e3b5e7885786125cce93bc} +void UART\+\_\+\+Msp\+De\+Init (\begin{DoxyParamCaption}\item[{UART\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}}]{huart}{}\end{DoxyParamCaption})} + + + +Деинициализация тактирования и прерываний UART. + + +\begin{DoxyParams}{Parameters} +{\em huart} & Указатель на хендл UART. \\ +\hline +\end{DoxyParams} +\begin{DoxyNote}{Note} +Чтобы не генерировать функцию с деиницилизацией неиспользуемых UART, дефайнами \doxylink{group___u_a_r_t___i_n_i_t}{Init defines} в \doxylink{general__uart_8h}{general\+\_\+uart.\+h} определяются используемые UART. +\end{DoxyNote} + + +Definition at line \mbox{\hyperlink{general__uart_8c_source_l00267}{267}} of file \mbox{\hyperlink{general__uart_8c_source}{general\+\_\+uart.\+c}}. + +\input{group___u_a_r_t___i_n_i_t} diff --git a/Doc/latex/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.md5 b/Doc/latex/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.md5 new file mode 100644 index 0000000..7716970 --- /dev/null +++ b/Doc/latex/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.md5 @@ -0,0 +1 @@ +e6d1f13a7d892bfe12b1137f7c4b33fa \ No newline at end of file diff --git a/Doc/latex/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.pdf b/Doc/latex/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.pdf new file mode 100644 index 0000000..d381472 Binary files /dev/null and b/Doc/latex/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.pdf differ diff --git a/Doc/latex/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.tex b/Doc/latex/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.tex new file mode 100644 index 0000000..3390e43 --- /dev/null +++ b/Doc/latex/group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l.tex @@ -0,0 +1,136 @@ +\doxysubsubsubsection{General tools } +\hypertarget{group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l}{}\label{group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l}\index{General tools@{General tools}} + + +Функции для базовой инициализации UART. + + +Collaboration diagram for General tools\+: +\nopagebreak +\begin{figure}[H] +\begin{center} +\leavevmode +\includegraphics[width=350pt]{group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l} +\end{center} +\end{figure} +\doxysubsubsubsubsubsection*{Topics} +\begin{DoxyCompactItemize} +\item +\mbox{\hyperlink{group___u_a_r_t___i_n_i_t}{Init defines}} +\begin{DoxyCompactList}\small\item\em Настройка UART. \end{DoxyCompactList}\end{DoxyCompactItemize} +\doxysubsubsubsubsubsection*{Classes} +\begin{DoxyCompactItemize} +\item +struct \mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\+\_\+\+Settings\+Type\+Def}} +\begin{DoxyCompactList}\small\item\em Структура настроек UART. \end{DoxyCompactList}\end{DoxyCompactItemize} +\doxysubsubsubsubsubsection*{Functions} +\begin{DoxyCompactItemize} +\item +HAL\+\_\+\+Status\+Type\+Def \mbox{\hyperlink{group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l_gab9f07396b778505c934143e89953e154}{UART\+\_\+\+Base\+\_\+\+Init}} (\mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\+\_\+\+Settings\+Type\+Def}} \texorpdfstring{$\ast$}{*}suart) +\begin{DoxyCompactList}\small\item\em Инициализация UART с помощью структуры \doxylink{struct_u_a_r_t___settings_type_def}{UART\+\_\+\+Settings\+Type\+Def}. \end{DoxyCompactList}\item +HAL\+\_\+\+Status\+Type\+Def \mbox{\hyperlink{group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l_gac9c27133622dfaf1f43683f4edf0ff65}{Check\+\_\+\+UART\+\_\+\+Init\+\_\+\+Struct}} (\mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\+\_\+\+Settings\+Type\+Def}} \texorpdfstring{$\ast$}{*}suart) +\begin{DoxyCompactList}\small\item\em Проверка корректности структуры инициализации UART. \end{DoxyCompactList}\item +void \mbox{\hyperlink{group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\+\_\+\+Msp\+Init}} (UART\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}huart) +\begin{DoxyCompactList}\small\item\em Настройка тактирования и прерываний UART. \end{DoxyCompactList}\item +void \mbox{\hyperlink{group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l_ga93ed6ceef4e3b5e7885786125cce93bc}{UART\+\_\+\+Msp\+De\+Init}} (UART\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}huart) +\begin{DoxyCompactList}\small\item\em Deinitialize UART \& DMA clock and interrupt. \end{DoxyCompactList}\end{DoxyCompactItemize} + + +\doxysubsubsubsubsection{Detailed Description} +Функции для базовой инициализации UART. + + + +\label{doc-func-members} +\Hypertarget{group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l_doc-func-members} +\doxysubsubsubsubsection{Function Documentation} +\Hypertarget{group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l_gab9f07396b778505c934143e89953e154}\index{General tools@{General tools}!UART\_Base\_Init@{UART\_Base\_Init}} +\index{UART\_Base\_Init@{UART\_Base\_Init}!General tools@{General tools}} +\doxysubsubsubsubsubsection{\texorpdfstring{UART\_Base\_Init()}{UART\_Base\_Init()}} +{\footnotesize\ttfamily \label{group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l_gab9f07396b778505c934143e89953e154} +HAL\+\_\+\+Status\+Type\+Def UART\+\_\+\+Base\+\_\+\+Init (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\+\_\+\+Settings\+Type\+Def}} \texorpdfstring{$\ast$}{*}}]{suart}{}\end{DoxyParamCaption})} + + + +Инициализация UART с помощью структуры \doxylink{struct_u_a_r_t___settings_type_def}{UART\+\_\+\+Settings\+Type\+Def}. + + +\begin{DoxyParams}{Parameters} +{\em suart} & Указатель на структуру с настройками UART. \\ +\hline +\end{DoxyParams} +\begin{DoxyReturn}{Returns} +HAL status. +\end{DoxyReturn} +~\newline + Инициализирует UART и при необходимости его GPIO и DMA. + +Definition at line \mbox{\hyperlink{general__uart_8c_source_l00024}{24}} of file \mbox{\hyperlink{general__uart_8c_source}{general\+\_\+uart.\+c}}. + +\Hypertarget{group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l_gac9c27133622dfaf1f43683f4edf0ff65}\index{General tools@{General tools}!Check\_UART\_Init\_Struct@{Check\_UART\_Init\_Struct}} +\index{Check\_UART\_Init\_Struct@{Check\_UART\_Init\_Struct}!General tools@{General tools}} +\doxysubsubsubsubsubsection{\texorpdfstring{Check\_UART\_Init\_Struct()}{Check\_UART\_Init\_Struct()}} +{\footnotesize\ttfamily \label{group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l_gac9c27133622dfaf1f43683f4edf0ff65} +HAL\+\_\+\+Status\+Type\+Def Check\+\_\+\+UART\+\_\+\+Init\+\_\+\+Struct (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{struct_u_a_r_t___settings_type_def}{UART\+\_\+\+Settings\+Type\+Def}} \texorpdfstring{$\ast$}{*}}]{suart}{}\end{DoxyParamCaption})} + + + +Проверка корректности структуры инициализации UART. + + +\begin{DoxyParams}{Parameters} +{\em suart} & Указатель на структуру с настройками UART. \\ +\hline +\end{DoxyParams} +\begin{DoxyReturn}{Returns} +HAL status. +\end{DoxyReturn} + + +Definition at line \mbox{\hyperlink{general__uart_8c_source_l00356}{356}} of file \mbox{\hyperlink{general__uart_8c_source}{general\+\_\+uart.\+c}}. + +\Hypertarget{group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l_gab9313fd2f9fc6873ca6bfbc5b96edbbb}\index{General tools@{General tools}!UART\_MspInit@{UART\_MspInit}} +\index{UART\_MspInit@{UART\_MspInit}!General tools@{General tools}} +\doxysubsubsubsubsubsection{\texorpdfstring{UART\_MspInit()}{UART\_MspInit()}} +{\footnotesize\ttfamily \label{group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l_gab9313fd2f9fc6873ca6bfbc5b96edbbb} +void UART\+\_\+\+Msp\+Init (\begin{DoxyParamCaption}\item[{UART\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}}]{huart}{}\end{DoxyParamCaption})} + + + +Настройка тактирования и прерываний UART. + + +\begin{DoxyParams}{Parameters} +{\em huart} & Указатель на хендл UART. \\ +\hline +\end{DoxyParams} +\begin{DoxyNote}{Note} +Чтобы не генерировать функцию с иницилизацией неиспользуемых UART, дефайнами \doxylink{group___u_a_r_t___i_n_i_t}{Init defines} в \doxylink{general__uart_8h}{general\+\_\+uart.\+h} определяются используемые UART. +\end{DoxyNote} + + +Definition at line \mbox{\hyperlink{general__uart_8c_source_l00138}{138}} of file \mbox{\hyperlink{general__uart_8c_source}{general\+\_\+uart.\+c}}. + +\Hypertarget{group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l_ga93ed6ceef4e3b5e7885786125cce93bc}\index{General tools@{General tools}!UART\_MspDeInit@{UART\_MspDeInit}} +\index{UART\_MspDeInit@{UART\_MspDeInit}!General tools@{General tools}} +\doxysubsubsubsubsubsection{\texorpdfstring{UART\_MspDeInit()}{UART\_MspDeInit()}} +{\footnotesize\ttfamily \label{group___m_y_l_i_b_s___u_a_r_t___g_e_n_e_r_a_l_ga93ed6ceef4e3b5e7885786125cce93bc} +void UART\+\_\+\+Msp\+De\+Init (\begin{DoxyParamCaption}\item[{UART\+\_\+\+Handle\+Type\+Def \texorpdfstring{$\ast$}{*}}]{huart}{}\end{DoxyParamCaption})} + + + +Deinitialize UART \& DMA clock and interrupt. + + +\begin{DoxyParams}{Parameters} +{\em huart} & -\/ указатель на хендл UART для деинициализации. \\ +\hline +\end{DoxyParams} +\begin{DoxyNote}{Note} +Чтобы не генерировать функцию с деиницилизацией неиспользуемых UART, дефайнами \doxylink{group___u_a_r_t___i_n_i_t}{Init defines} в \doxylink{general__uart_8h}{general\+\_\+uart.\+h} определяются используемые UART. +\end{DoxyNote} + + +Definition at line \mbox{\hyperlink{general__uart_8c_source_l00259}{259}} of file \mbox{\hyperlink{general__uart_8c_source}{general\+\_\+uart.\+c}}. + +\input{group___u_a_r_t___i_n_i_t} diff --git a/Doc/latex/group___s_p_i___i_n_i_t.md5 b/Doc/latex/group___s_p_i___i_n_i_t.md5 new file mode 100644 index 0000000..fe2e1ed --- /dev/null +++ b/Doc/latex/group___s_p_i___i_n_i_t.md5 @@ -0,0 +1 @@ +a5fee9e01f339403bf93347eac092de0 \ No newline at end of file diff --git a/Doc/latex/group___s_p_i___i_n_i_t.pdf b/Doc/latex/group___s_p_i___i_n_i_t.pdf new file mode 100644 index 0000000..5605950 Binary files /dev/null and b/Doc/latex/group___s_p_i___i_n_i_t.pdf differ diff --git a/Doc/latex/group___s_p_i___i_n_i_t.tex b/Doc/latex/group___s_p_i___i_n_i_t.tex new file mode 100644 index 0000000..77960f4 --- /dev/null +++ b/Doc/latex/group___s_p_i___i_n_i_t.tex @@ -0,0 +1,91 @@ +\doxysubsubsubsection{Init defines } +\hypertarget{group___s_p_i___i_n_i_t}{}\label{group___s_p_i___i_n_i_t}\index{Init defines@{Init defines}} + + +Настройка SPI. + + +Collaboration diagram for Init defines\+:\nopagebreak +\begin{figure}[H] +\begin{center} +\leavevmode +\includegraphics[width=238pt]{group___s_p_i___i_n_i_t} +\end{center} +\end{figure} +\doxysubsubsubsubsubsection*{Macros} +\begin{DoxyCompactItemize} +\item +\#define \mbox{\hyperlink{group___s_p_i___i_n_i_t_ga8ad4712bf4add56892d057778e826e0c}{HAL\+\_\+\+SPI\+\_\+\+MODULE\+\_\+\+ENABLED}} +\begin{DoxyCompactList}\small\item\em Включение HAL SPI. \end{DoxyCompactList}\item +\#define \mbox{\hyperlink{group___s_p_i___i_n_i_t_ga2fe0c8aeb2c61679f32836fef479eedf}{USE\+\_\+\+SPI1}} +\begin{DoxyCompactList}\small\item\em Включить SPI1 в \doxylink{group___m_y___l_i_b_s___s_p_i_gab9f13318daf02bc5b5f302ae392dccac}{SPI\+\_\+\+Msp\+Init}. \end{DoxyCompactList}\item +\#define \mbox{\hyperlink{group___s_p_i___i_n_i_t_ga53687cddb8e39e76a79b8ffaa152fb2b}{USE\+\_\+\+SPI2}} +\begin{DoxyCompactList}\small\item\em Включить SPI2 в \doxylink{group___m_y___l_i_b_s___s_p_i_gab9f13318daf02bc5b5f302ae392dccac}{SPI\+\_\+\+Msp\+Init}. \end{DoxyCompactList}\item +\#define \mbox{\hyperlink{group___s_p_i___i_n_i_t_ga5fdd6e5934a8005ef05b80f6d95883dc}{USE\+\_\+\+SPI3}} +\begin{DoxyCompactList}\small\item\em Включить SPI3 в \doxylink{group___m_y___l_i_b_s___s_p_i_gab9f13318daf02bc5b5f302ae392dccac}{SPI\+\_\+\+Msp\+Init}. \end{DoxyCompactList}\end{DoxyCompactItemize} + + +\doxysubsubsubsubsection{Detailed Description} +Настройка SPI. + + + +\label{doc-define-members} +\Hypertarget{group___s_p_i___i_n_i_t_doc-define-members} +\doxysubsubsubsubsection{Macro Definition Documentation} +\Hypertarget{group___s_p_i___i_n_i_t_ga8ad4712bf4add56892d057778e826e0c}\index{Init defines@{Init defines}!HAL\_SPI\_MODULE\_ENABLED@{HAL\_SPI\_MODULE\_ENABLED}} +\index{HAL\_SPI\_MODULE\_ENABLED@{HAL\_SPI\_MODULE\_ENABLED}!Init defines@{Init defines}} +\doxysubsubsubsubsubsection{\texorpdfstring{HAL\_SPI\_MODULE\_ENABLED}{HAL\_SPI\_MODULE\_ENABLED}} +{\footnotesize\ttfamily \label{group___s_p_i___i_n_i_t_ga8ad4712bf4add56892d057778e826e0c} +\#define HAL\+\_\+\+SPI\+\_\+\+MODULE\+\_\+\+ENABLED} + + + +Включение HAL SPI. + + + +Definition at line \mbox{\hyperlink{general__spi_8h_source_l00075}{75}} of file \mbox{\hyperlink{general__spi_8h_source}{general\+\_\+spi.\+h}}. + +\Hypertarget{group___s_p_i___i_n_i_t_ga2fe0c8aeb2c61679f32836fef479eedf}\index{Init defines@{Init defines}!USE\_SPI1@{USE\_SPI1}} +\index{USE\_SPI1@{USE\_SPI1}!Init defines@{Init defines}} +\doxysubsubsubsubsubsection{\texorpdfstring{USE\_SPI1}{USE\_SPI1}} +{\footnotesize\ttfamily \label{group___s_p_i___i_n_i_t_ga2fe0c8aeb2c61679f32836fef479eedf} +\#define USE\+\_\+\+SPI1} + + + +Включить SPI1 в \doxylink{group___m_y___l_i_b_s___s_p_i_gab9f13318daf02bc5b5f302ae392dccac}{SPI\+\_\+\+Msp\+Init}. + + + +Definition at line \mbox{\hyperlink{general__spi_8h_source_l00077}{77}} of file \mbox{\hyperlink{general__spi_8h_source}{general\+\_\+spi.\+h}}. + +\Hypertarget{group___s_p_i___i_n_i_t_ga53687cddb8e39e76a79b8ffaa152fb2b}\index{Init defines@{Init defines}!USE\_SPI2@{USE\_SPI2}} +\index{USE\_SPI2@{USE\_SPI2}!Init defines@{Init defines}} +\doxysubsubsubsubsubsection{\texorpdfstring{USE\_SPI2}{USE\_SPI2}} +{\footnotesize\ttfamily \label{group___s_p_i___i_n_i_t_ga53687cddb8e39e76a79b8ffaa152fb2b} +\#define USE\+\_\+\+SPI2} + + + +Включить SPI2 в \doxylink{group___m_y___l_i_b_s___s_p_i_gab9f13318daf02bc5b5f302ae392dccac}{SPI\+\_\+\+Msp\+Init}. + + + +Definition at line \mbox{\hyperlink{general__spi_8h_source_l00078}{78}} of file \mbox{\hyperlink{general__spi_8h_source}{general\+\_\+spi.\+h}}. + +\Hypertarget{group___s_p_i___i_n_i_t_ga5fdd6e5934a8005ef05b80f6d95883dc}\index{Init defines@{Init defines}!USE\_SPI3@{USE\_SPI3}} +\index{USE\_SPI3@{USE\_SPI3}!Init defines@{Init defines}} +\doxysubsubsubsubsubsection{\texorpdfstring{USE\_SPI3}{USE\_SPI3}} +{\footnotesize\ttfamily \label{group___s_p_i___i_n_i_t_ga5fdd6e5934a8005ef05b80f6d95883dc} +\#define USE\+\_\+\+SPI3} + + + +Включить SPI3 в \doxylink{group___m_y___l_i_b_s___s_p_i_gab9f13318daf02bc5b5f302ae392dccac}{SPI\+\_\+\+Msp\+Init}. + + + +Definition at line \mbox{\hyperlink{general__spi_8h_source_l00079}{79}} of file \mbox{\hyperlink{general__spi_8h_source}{general\+\_\+spi.\+h}}. + diff --git a/Doc/latex/group___u_a_r_t___i_n_i_t.md5 b/Doc/latex/group___u_a_r_t___i_n_i_t.md5 new file mode 100644 index 0000000..51b7988 --- /dev/null +++ b/Doc/latex/group___u_a_r_t___i_n_i_t.md5 @@ -0,0 +1 @@ +a6be7d8c2d212183934faf5551879d8d \ No newline at end of file diff --git a/Doc/latex/group___u_a_r_t___i_n_i_t.pdf b/Doc/latex/group___u_a_r_t___i_n_i_t.pdf new file mode 100644 index 0000000..6d38e68 Binary files /dev/null and b/Doc/latex/group___u_a_r_t___i_n_i_t.pdf differ diff --git a/Doc/latex/group___u_a_r_t___i_n_i_t.tex b/Doc/latex/group___u_a_r_t___i_n_i_t.tex new file mode 100644 index 0000000..2ed0a89 --- /dev/null +++ b/Doc/latex/group___u_a_r_t___i_n_i_t.tex @@ -0,0 +1,139 @@ +\doxysubsubsubsection{Init defines } +\hypertarget{group___u_a_r_t___i_n_i_t}{}\label{group___u_a_r_t___i_n_i_t}\index{Init defines@{Init defines}} + + +Настройка UART. + + +Collaboration diagram for Init defines\+:\nopagebreak +\begin{figure}[H] +\begin{center} +\leavevmode +\includegraphics[width=249pt]{group___u_a_r_t___i_n_i_t} +\end{center} +\end{figure} +\doxysubsubsubsubsubsection*{Macros} +\begin{DoxyCompactItemize} +\item +\#define \mbox{\hyperlink{group___u_a_r_t___i_n_i_t_ga167269406e73327b95c3bb7b9cfe6d89}{HAL\+\_\+\+UART\+\_\+\+MODULE\+\_\+\+ENABLED}} +\begin{DoxyCompactList}\small\item\em Включение HAL UART. \end{DoxyCompactList}\item +\#define \mbox{\hyperlink{group___u_a_r_t___i_n_i_t_gace54f148bb1d72f13bf397d096d38d1b}{USE\+\_\+\+USART1}} +\begin{DoxyCompactList}\small\item\em Включить USART1 в \doxylink{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\+\_\+\+Msp\+Init}. \end{DoxyCompactList}\item +\#define \mbox{\hyperlink{group___u_a_r_t___i_n_i_t_gaacb3968508217a0d8b3f64aa0c8aa07d}{USE\+\_\+\+USART2}} +\begin{DoxyCompactList}\small\item\em Включить USART2 в \doxylink{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\+\_\+\+Msp\+Init}. \end{DoxyCompactList}\item +\#define \mbox{\hyperlink{group___u_a_r_t___i_n_i_t_ga6dadd967b428aade24008ec060009976}{USE\+\_\+\+USART3}} +\begin{DoxyCompactList}\small\item\em Включить USART3 в \doxylink{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\+\_\+\+Msp\+Init}. \end{DoxyCompactList}\item +\#define \mbox{\hyperlink{group___u_a_r_t___i_n_i_t_ga779530e93e7aa1f25eb13045ec42b8e7}{USE\+\_\+\+UART4}} +\begin{DoxyCompactList}\small\item\em Включить UART4 в \doxylink{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\+\_\+\+Msp\+Init}. \end{DoxyCompactList}\item +\#define \mbox{\hyperlink{group___u_a_r_t___i_n_i_t_ga592c6bf4a6496d6806ba0838cdfa2340}{USE\+\_\+\+UART5}} +\begin{DoxyCompactList}\small\item\em Включить UART5 в \doxylink{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\+\_\+\+Msp\+Init}. \end{DoxyCompactList}\item +\#define \mbox{\hyperlink{group___u_a_r_t___i_n_i_t_gafaeb8bdd4aa7fb1987505530daa90868}{USE\+\_\+\+USART6}} +\begin{DoxyCompactList}\small\item\em Включить USART6 в \doxylink{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\+\_\+\+Msp\+Init}. \end{DoxyCompactList}\end{DoxyCompactItemize} + + +\doxysubsubsubsubsection{Detailed Description} +Настройка UART. + + + +\label{doc-define-members} +\Hypertarget{group___u_a_r_t___i_n_i_t_doc-define-members} +\doxysubsubsubsubsection{Macro Definition Documentation} +\Hypertarget{group___u_a_r_t___i_n_i_t_ga167269406e73327b95c3bb7b9cfe6d89}\index{Init defines@{Init defines}!HAL\_UART\_MODULE\_ENABLED@{HAL\_UART\_MODULE\_ENABLED}} +\index{HAL\_UART\_MODULE\_ENABLED@{HAL\_UART\_MODULE\_ENABLED}!Init defines@{Init defines}} +\doxysubsubsubsubsubsection{\texorpdfstring{HAL\_UART\_MODULE\_ENABLED}{HAL\_UART\_MODULE\_ENABLED}} +{\footnotesize\ttfamily \label{group___u_a_r_t___i_n_i_t_ga167269406e73327b95c3bb7b9cfe6d89} +\#define HAL\+\_\+\+UART\+\_\+\+MODULE\+\_\+\+ENABLED} + + + +Включение HAL UART. + + + +Definition at line \mbox{\hyperlink{general__uart_8h_source_l00065}{65}} of file \mbox{\hyperlink{general__uart_8h_source}{general\+\_\+uart.\+h}}. + +\Hypertarget{group___u_a_r_t___i_n_i_t_gace54f148bb1d72f13bf397d096d38d1b}\index{Init defines@{Init defines}!USE\_USART1@{USE\_USART1}} +\index{USE\_USART1@{USE\_USART1}!Init defines@{Init defines}} +\doxysubsubsubsubsubsection{\texorpdfstring{USE\_USART1}{USE\_USART1}} +{\footnotesize\ttfamily \label{group___u_a_r_t___i_n_i_t_gace54f148bb1d72f13bf397d096d38d1b} +\#define USE\+\_\+\+USART1} + + + +Включить USART1 в \doxylink{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\+\_\+\+Msp\+Init}. + + + +Definition at line \mbox{\hyperlink{general__uart_8h_source_l00067}{67}} of file \mbox{\hyperlink{general__uart_8h_source}{general\+\_\+uart.\+h}}. + +\Hypertarget{group___u_a_r_t___i_n_i_t_gaacb3968508217a0d8b3f64aa0c8aa07d}\index{Init defines@{Init defines}!USE\_USART2@{USE\_USART2}} +\index{USE\_USART2@{USE\_USART2}!Init defines@{Init defines}} +\doxysubsubsubsubsubsection{\texorpdfstring{USE\_USART2}{USE\_USART2}} +{\footnotesize\ttfamily \label{group___u_a_r_t___i_n_i_t_gaacb3968508217a0d8b3f64aa0c8aa07d} +\#define USE\+\_\+\+USART2} + + + +Включить USART2 в \doxylink{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\+\_\+\+Msp\+Init}. + + + +Definition at line \mbox{\hyperlink{general__uart_8h_source_l00068}{68}} of file \mbox{\hyperlink{general__uart_8h_source}{general\+\_\+uart.\+h}}. + +\Hypertarget{group___u_a_r_t___i_n_i_t_ga6dadd967b428aade24008ec060009976}\index{Init defines@{Init defines}!USE\_USART3@{USE\_USART3}} +\index{USE\_USART3@{USE\_USART3}!Init defines@{Init defines}} +\doxysubsubsubsubsubsection{\texorpdfstring{USE\_USART3}{USE\_USART3}} +{\footnotesize\ttfamily \label{group___u_a_r_t___i_n_i_t_ga6dadd967b428aade24008ec060009976} +\#define USE\+\_\+\+USART3} + + + +Включить USART3 в \doxylink{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\+\_\+\+Msp\+Init}. + + + +Definition at line \mbox{\hyperlink{general__uart_8h_source_l00069}{69}} of file \mbox{\hyperlink{general__uart_8h_source}{general\+\_\+uart.\+h}}. + +\Hypertarget{group___u_a_r_t___i_n_i_t_ga779530e93e7aa1f25eb13045ec42b8e7}\index{Init defines@{Init defines}!USE\_UART4@{USE\_UART4}} +\index{USE\_UART4@{USE\_UART4}!Init defines@{Init defines}} +\doxysubsubsubsubsubsection{\texorpdfstring{USE\_UART4}{USE\_UART4}} +{\footnotesize\ttfamily \label{group___u_a_r_t___i_n_i_t_ga779530e93e7aa1f25eb13045ec42b8e7} +\#define USE\+\_\+\+UART4} + + + +Включить UART4 в \doxylink{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\+\_\+\+Msp\+Init}. + + + +Definition at line \mbox{\hyperlink{general__uart_8h_source_l00070}{70}} of file \mbox{\hyperlink{general__uart_8h_source}{general\+\_\+uart.\+h}}. + +\Hypertarget{group___u_a_r_t___i_n_i_t_ga592c6bf4a6496d6806ba0838cdfa2340}\index{Init defines@{Init defines}!USE\_UART5@{USE\_UART5}} +\index{USE\_UART5@{USE\_UART5}!Init defines@{Init defines}} +\doxysubsubsubsubsubsection{\texorpdfstring{USE\_UART5}{USE\_UART5}} +{\footnotesize\ttfamily \label{group___u_a_r_t___i_n_i_t_ga592c6bf4a6496d6806ba0838cdfa2340} +\#define USE\+\_\+\+UART5} + + + +Включить UART5 в \doxylink{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\+\_\+\+Msp\+Init}. + + + +Definition at line \mbox{\hyperlink{general__uart_8h_source_l00071}{71}} of file \mbox{\hyperlink{general__uart_8h_source}{general\+\_\+uart.\+h}}. + +\Hypertarget{group___u_a_r_t___i_n_i_t_gafaeb8bdd4aa7fb1987505530daa90868}\index{Init defines@{Init defines}!USE\_USART6@{USE\_USART6}} +\index{USE\_USART6@{USE\_USART6}!Init defines@{Init defines}} +\doxysubsubsubsubsubsection{\texorpdfstring{USE\_USART6}{USE\_USART6}} +{\footnotesize\ttfamily \label{group___u_a_r_t___i_n_i_t_gafaeb8bdd4aa7fb1987505530daa90868} +\#define USE\+\_\+\+USART6} + + + +Включить USART6 в \doxylink{group___m_y___l_i_b_s___u_a_r_t_gab9313fd2f9fc6873ca6bfbc5b96edbbb}{UART\+\_\+\+Msp\+Init}. + + + +Definition at line \mbox{\hyperlink{general__uart_8h_source_l00072}{72}} of file \mbox{\hyperlink{general__uart_8h_source}{general\+\_\+uart.\+h}}. +