82 lines
2.2 KiB
C
82 lines
2.2 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 "stdio.h"
|
|
/* USER CODE END Includes */
|
|
|
|
/* USER CODE BEGIN Private defines */
|
|
typedef struct
|
|
{
|
|
uint8_t *rx_buf; //接收缓冲数组
|
|
uint16_t rx_buf_cnt; //接收缓冲计数值
|
|
uint16_t rx_size; //接收数据大小
|
|
uint8_t rx_flag; //接收完成标志位
|
|
|
|
uint8_t *tx_buf; //发送缓冲数组
|
|
uint16_t tx_buf_cnt; //发送缓冲计数值
|
|
uint16_t tx_size; //实际发送数据大小
|
|
}UART_BUF; //串口结构体
|
|
|
|
extern UART_BUF usart3; //串口结构体实体
|
|
|
|
extern uint8_t usart6_rx_buf[64]; //发送数据缓冲数组
|
|
extern uint8_t usart6_tx_buf[64]; //接收数据缓冲数据
|
|
|
|
//#ifdef __GNUC__
|
|
// #define PUTCHAR_PROTOTYPE int _io_putchar(int ch)
|
|
// #else
|
|
// #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
|
|
// #endif
|
|
//extern PUTCHAR_PROTOTYPE;
|
|
/* 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 modbus_init(void);
|
|
void modbus_callback(void);
|
|
void modbus_send(USART_TypeDef *Luart,uint8_t *Tx_Buf,uint16_t Size);
|
|
|
|
void usart2_laser_send(USART_TypeDef *Luart,uint8_t *Tx_Buf,uint16_t Size);
|
|
void usart6_send(uint8_t *Tx_Buf,uint16_t Size);
|
|
void usart6_rx_cb(void);
|
|
/* USER CODE END Prototypes */
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* __USART_H__ */
|
|
|