gateway/Hardware/inc/UART.h

45 lines
858 B
C
Raw Normal View History

2024-07-13 02:22:47 +00:00
/*
* UART.h
*
* Created on: 2024<EFBFBD><EFBFBD>5<EFBFBD><EFBFBD>18<EFBFBD><EFBFBD>
* Author: 34509
*/
#ifndef HARDWARE_RS485_UART_H_
#define HARDWARE_RS485_UART_H_
#include "ch32v30x.h"
#include <rtthread.h>
#include <rthw.h>
#include "drivers/pin.h"
#define write PIN_HIGH
#define read PIN_LOW
#define open PIN_HIGH
#define close PIN_LOW
/* PD8 */
#define USART3_DE 55
/* PE5 */
#define J1_DE 4
/* PE6 */
#define J2_DE 5
/* PA1 */
#define J3_DE 24
/* PB0 */
#define J4_DE 35
#define J1_USART UART6
#define J2_USART UART7
#define J3_USART USART2
#define J4_USART UART8
#define J5_0_USART USART3
void USARTx_SendByte(USART_TypeDef* pUSARTx, uint8_t data);
void USARTx_SendStr(USART_TypeDef* pUSARTx, char *str);
void USARTx_SendByte_str(USART_TypeDef* pUSARTx, uint8_t data);
2024-07-13 02:22:47 +00:00
void USARTx_SendStr_Len(USART_TypeDef* pUSARTx, char *str, int len);
#endif /* HARDWARE_RS485_UART_H_ */