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);
|
2024-07-15 03:33:54 +00:00
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
2024-08-08 04:11:12 +00:00
|
|
|
|
/* J1_UART6 */
|
|
|
|
|
/* PE7 */
|
|
|
|
|
#define J1_PWR_Ctrl 38
|
|
|
|
|
void J1_485_Init(uint32_t baud);
|
|
|
|
|
void J1_PWR_Open(void);
|
|
|
|
|
void J1_PWR_Close(void);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* J2_UART7 */
|
|
|
|
|
/* PE8 */
|
|
|
|
|
#define J2_PWR_Ctrl 39
|
|
|
|
|
void J2_485_Init(uint32_t baud);
|
|
|
|
|
void J2_PWR_Open(void);
|
|
|
|
|
void J2_PWR_Close(void);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* J3_USART2 */
|
|
|
|
|
/* PE9 */
|
|
|
|
|
#define J3_PWR_Ctrl 40
|
|
|
|
|
void J3_485_Init(uint32_t baud);
|
|
|
|
|
void J3_PWR_Open(void);
|
|
|
|
|
void J3_PWR_Close(void);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* J4_UART8 */
|
|
|
|
|
/* PE10 */
|
|
|
|
|
#define J4_PWR_Ctrl 41
|
|
|
|
|
void J4_485_Init(uint32_t baud);
|
|
|
|
|
void J4_PWR_Open(void);
|
|
|
|
|
void J4_PWR_Close(void);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* J0-5_USART3 */
|
|
|
|
|
/* PE11 */
|
|
|
|
|
#define J5_PWR_Ctrl 42
|
|
|
|
|
/* PE12 */
|
|
|
|
|
#define J6_PWR_Ctrl 43
|
|
|
|
|
/* PE13 */
|
|
|
|
|
#define J7_PWR_Ctrl 44
|
|
|
|
|
/* PE14 */
|
|
|
|
|
#define J8_PWR_Ctrl 45
|
|
|
|
|
/* PE15 */
|
|
|
|
|
#define J9_PWR_Ctrl 46
|
|
|
|
|
/* PD9 */
|
|
|
|
|
#define TD_USART_A 56
|
|
|
|
|
/* PD10 */
|
|
|
|
|
#define TD_USART_B 57
|
|
|
|
|
/* PD11 */
|
|
|
|
|
#define TD_USART_C 58
|
|
|
|
|
void J5_0_485_Init(uint32_t baud);
|
|
|
|
|
void USART_CONNET_J0(void);
|
|
|
|
|
void USART_CONNET_J5(void);
|
|
|
|
|
void USART_CONNET_J6(void);
|
|
|
|
|
void USART_CONNET_J7(void);
|
|
|
|
|
void USART_CONNET_J8(void);
|
|
|
|
|
void USART_CONNET_J9(void);
|
|
|
|
|
void J5_PWR_Open(void);
|
|
|
|
|
void J5_PWR_Close(void);
|
|
|
|
|
void J6_PWR_Open(void);
|
|
|
|
|
void J6_PWR_Close(void);
|
|
|
|
|
void J7_PWR_Open(void);
|
|
|
|
|
void J7_PWR_Close(void);
|
|
|
|
|
void J8_PWR_Open(void);
|
|
|
|
|
void J8_PWR_Close(void);
|
|
|
|
|
void J9_PWR_Open(void);
|
|
|
|
|
void J9_PWR_Close(void);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* LORA_UART4 */
|
|
|
|
|
void LORA_UART4_Init(uint32_t baud);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Upward_UART5 */
|
|
|
|
|
void Upward_UART5_Init(uint32_t baud);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-07-13 02:22:47 +00:00
|
|
|
|
#endif /* HARDWARE_RS485_UART_H_ */
|