L14-Click 1.0
STM32WLE5CC LoRaWAN Sensor Platform
Loading...
Searching...
No Matches
usart_if.h
Go to the documentation of this file.
1/* USER CODE BEGIN Header */
2/**
3 ******************************************************************************
4 * @file usart_if.h
5 * @author MCD Application Team
6 * @brief Header for USART interface configuration
7 ******************************************************************************
8 * @attention
9 *
10 * Copyright (c) 2026 STMicroelectronics.
11 * All rights reserved.
12 *
13 * This software is licensed under terms that can be found in the LICENSE file
14 * in the root directory of this software component.
15 * If no LICENSE file comes with this software, it is provided AS-IS.
16 *
17 ******************************************************************************
18 */
19/* USER CODE END Header */
20
21#include "stm32_adv_trace.h"
22#include "usart.h"
23#include "dma.h"
24
25/* Define to prevent recursive inclusion -------------------------------------*/
26#ifndef __USART_IF_H__
27#define __USART_IF_H__
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33/* Includes ------------------------------------------------------------------*/
34/* USER CODE BEGIN Includes */
35
36/* USER CODE END Includes */
37
38/* Exported types ------------------------------------------------------------*/
39/* USER CODE BEGIN ET */
40
41/* USER CODE END ET */
42
43/* Exported constants --------------------------------------------------------*/
44/* USER CODE BEGIN EC */
45
46/* USER CODE END EC */
47
48/* External variables --------------------------------------------------------*/
49/* USER CODE BEGIN EV */
50extern volatile uint8_t uart_data_ready;
51extern char uart_req_buf[];
52/* USER CODE END EV */
53
54/* Exported macro ------------------------------------------------------------*/
55/* USER CODE BEGIN EM */
56
57/* USER CODE END EM */
58
59/* Exported functions prototypes ---------------------------------------------*/
60/**
61 * @brief Init the UART and associated DMA.
62 * @param cb TxCpltCallback
63 * @return @ref UTIL_ADV_TRACE_Status_t
64 */
65UTIL_ADV_TRACE_Status_t vcom_Init(void (*cb)(void *));
66
67/**
68 * @brief init receiver of vcom
69 * @param RxCb callback when Rx char is received
70 * @return @ref UTIL_ADV_TRACE_Status_t
71 */
72UTIL_ADV_TRACE_Status_t vcom_ReceiveInit(void (*RxCb)(uint8_t *rxChar, uint16_t size, uint8_t error));
73
74/**
75 * @brief DeInit the UART and associated DMA.
76 * @return @ref UTIL_ADV_TRACE_Status_t
77 */
78UTIL_ADV_TRACE_Status_t vcom_DeInit(void);
79
80/**
81 * @brief send buffer \p p_data of size \p size to vcom in polling mode
82 * @param p_data data to be sent
83 * @param size of buffer p_data to be sent
84 */
85void vcom_Trace(uint8_t *p_data, uint16_t size);
86
87/**
88 * @brief send buffer \p p_data of size \p size to vcom using DMA
89 * @param p_data data to be sent
90 * @param size of buffer p_data to be sent
91 * @return @ref UTIL_ADV_TRACE_Status_t
92 */
93UTIL_ADV_TRACE_Status_t vcom_Trace_DMA(uint8_t *p_data, uint16_t size);
94
95/**
96 * @brief last byte has been sent on the uart line
97 */
98void vcom_IRQHandler(void);
99
100/**
101 * @brief last byte has been sent from memory to uart data register
102 */
104
105/**
106 * @brief Resume the UART and associated DMA (used by LPM)
107 */
108void vcom_Resume(void);
109
110/* USER CODE BEGIN EFP */
111/**
112 * @brief Write to UART1
113 */
114UTIL_ADV_TRACE_Status_t Uart_Info(const char *strInfo);
115
116/**
117 * @brief start reading
118 * @param uart - handle for the uart being used
119 */
120UTIL_ADV_TRACE_Status_t Uart_StartReceving(UART_HandleTypeDef *uart);
121
122/**
123 * @brief continue with next reading if data arrived
124 */
125UTIL_ADV_TRACE_Status_t Uart_NextReceving();
126
127/**
128 * @brief called if char is ready from UART
129 * @retval -1 - other UART, 0 - char is accepted, next receiving must start, 1 - data ready
130 */
131int HAL_UART_RxCharMT(UART_HandleTypeDef *huart, uint8_t charRx);
132
133/* USER CODE END EFP */
134
135#ifdef __cplusplus
136}
137#endif
138
139#endif /* __USART_IF_H__ */
This file contains all the function prototypes for the dma.c file.
This file contains all the function prototypes for the usart.c file.
uint8_t charRx
buffer to receive 1 character
Definition usart_if.c:42
volatile uint8_t uart_data_ready
UTIL_ADV_TRACE_Status_t vcom_Trace_DMA(uint8_t *p_data, uint16_t size)
send buffer p_data of size size to vcom using DMA
Definition usart_if.c:158
void vcom_Resume(void)
Resume the UART and associated DMA (used by LPM).
Definition usart_if.c:217
UTIL_ADV_TRACE_Status_t Uart_Info(const char *strInfo)
Write to UART1.
Definition usart_if.c:299
void vcom_DMA_TX_IRQHandler(void)
last byte has been sent from memory to uart data register
int HAL_UART_RxCharMT(UART_HandleTypeDef *huart, uint8_t charRx)
called if char is ready from UART
Definition usart_if.c:279
void vcom_Trace(uint8_t *p_data, uint16_t size)
send buffer p_data of size size to vcom in polling mode
Definition usart_if.c:145
void vcom_IRQHandler(void)
last byte has been sent on the uart line
UTIL_ADV_TRACE_Status_t Uart_NextReceving()
continue with next reading if data arrived
Definition usart_if.c:306
UTIL_ADV_TRACE_Status_t vcom_ReceiveInit(void(*RxCb)(uint8_t *rxChar, uint16_t size, uint8_t error))
init receiver of vcom
Definition usart_if.c:177
UTIL_ADV_TRACE_Status_t Uart_StartReceving(UART_HandleTypeDef *uart)
start reading
Definition usart_if.c:313
UTIL_ADV_TRACE_Status_t vcom_DeInit(void)
DeInit the UART and associated DMA.
Definition usart_if.c:120
UTIL_ADV_TRACE_Status_t vcom_Init(void(*cb)(void *))
Init the UART and associated DMA.
Definition usart_if.c:105
char uart_req_buf[]
Definition usart_if.c:46