You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.9 KiB
62 lines
1.9 KiB
/**
|
|
******************************************************************************
|
|
* @file usart.h
|
|
* @brief This file contains all the function prototypes for
|
|
* the usart.c file
|
|
******************************************************************************
|
|
* @attention
|
|
*
|
|
* <h2><center>© Copyright (c) 2022 STMicroelectronics.
|
|
* All rights reserved.</center></h2>
|
|
*
|
|
* This software component is licensed by ST under Ultimate Liberty license
|
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
|
* the License. You may obtain a copy of the License at:
|
|
* www.st.com/SLA0044
|
|
*
|
|
******************************************************************************
|
|
*/
|
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
#ifndef __USART_H__
|
|
#define __USART_H__
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
#include "main.h"
|
|
|
|
/* USER CODE BEGIN Includes */
|
|
#define USART_REC_LEN 200 //定义最大接收字节数 200
|
|
#define EN_USART1_RX 1 //使能(1)/禁止(0)串口1接收
|
|
#define RXBUFFERSIZE 10 //缓存大小
|
|
#define HAL_USART_ISR_EN 0//HAL库自带的串口接收中断服务函数开关
|
|
/* USER CODE END Includes */
|
|
|
|
extern UART_HandleTypeDef huart1;
|
|
|
|
/* USER CODE BEGIN Private defines */
|
|
|
|
/* USER CODE END Private defines */
|
|
|
|
void MX_USART1_UART_Init(void);
|
|
|
|
/* USER CODE BEGIN Prototypes */
|
|
void USART_SendByte( char Data);
|
|
void USART_SendString(char *nbuff);
|
|
extern uint8_t USART_RX_BUF[USART_REC_LEN]; //接收缓冲,最大USART_REC_LEN个字节.末字节为换行符
|
|
extern uint16_t USART_RX_STA; //接收状态标记
|
|
extern UART_HandleTypeDef huart1; //UART句柄
|
|
|
|
|
|
extern uint8_t aRxBuffer[RXBUFFERSIZE];//HAL库USART接收Buffer
|
|
/* USER CODE END Prototypes */
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* __USART_H__ */
|
|
|
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|
|