sggt/Core/Inc/usart.h

89 lines
2.1 KiB
C

/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file usart.h
* @brief This file contains all the function prototypes for
* the usart.c file
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USART_H__
#define __USART_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* USER CODE BEGIN Includes */
#include "data_type_def.h"
#include "stm32f407xx.h"
/* USER CODE END Includes */
extern UART_HandleTypeDef huart1;
extern UART_HandleTypeDef huart2;
extern UART_HandleTypeDef huart3;
extern UART_HandleTypeDef huart6;
/* USER CODE BEGIN Private defines */
#define BUFFER_SIZE 255
typedef struct
{
uint8_t rx_flag;
uint8_t tx_flag;
uint8_t rx_buff[BUFFER_SIZE];
uint8_t tx_buff[BUFFER_SIZE];
uint16_t rx_len;
uint16_t tx_len;
} st_scom;
typedef struct
{
uint8_t index;
char *name;
st_scom *scom;
} st_scom_device;
extern st_scom scom1_hart;
extern st_scom scom2_rs485;
extern st_scom scom6_ble;
// extern st_scom_device scom_device[3];
/* USER CODE END Private defines */
void MX_USART1_UART_Init(void);
void MX_USART2_UART_Init(void);
void MX_USART3_UART_Init(void);
void MX_USART6_UART_Init(void);
/* USER CODE BEGIN Prototypes */
void usart_printf(UART_HandleTypeDef *huart, char *fmt, ...);
void proc_huart_it(UART_HandleTypeDef *huart);
/* USER CODE END Prototypes */
#ifdef __cplusplus
}
#endif
#endif /* __USART_H__ */