初始版本

This commit is contained in:
2026-04-23 13:49:53 +08:00
parent c1d6ebd38c
commit ac718a463a
257 changed files with 265681 additions and 0 deletions
+60
View File
@@ -0,0 +1,60 @@
#ifndef _HDL_USART_H_
#define _HDL_USART_H_
#include "hc32_ll.h"
#define DEBUG_UART (CM_USART1)
#define DEBUG_UART_CLK (FCG1_PERIPH_USART1)
#define DEBUG_UART_RX_PORT (GPIO_PORT_A) /* PA11: USART2_RX */
#define DEBUG_UART_RX_PIN (GPIO_PIN_11)
#define DEBUG_UART_RX_GPIO_FUNC (GPIO_FUNC_33)
#define DEBUG_UART_TX_PORT (GPIO_PORT_A) /* PA12: USART2_TX */
#define DEBUG_UART_TX_PIN (GPIO_PIN_12)
#define DEBUG_UART_TX_GPIO_FUNC (GPIO_FUNC_32)
#define DEBUG_UART_INT_EI (INT_SRC_USART1_EI)
#define DEBUG_UART_INT_EI_IRQ (INT000_IRQn)
#define DEBUG_UART_INT_RI (INT_SRC_USART1_RI)
#define DEBUG_UART_INT_RI_IRQ (INT001_IRQn)
typedef void (*hdl_debug_uart_rx_cb_t)(uint8_t data);
void hdl_debug_uart_init(void);
int hdl_debug_uart_getc(int *ch);
void hdl_debug_uart_putc(uint8_t ch);
void hdl_debug_uart_rx_reg(hdl_debug_uart_rx_cb_t pCBS);
#define COM_UART (CM_USART2)
#define COM_UART_CLK (FCG1_PERIPH_USART2)
#define COM_RX_PORT (GPIO_PORT_A)
#define COM_RX_PIN (GPIO_PIN_10)
#define COM_RX_GPIO_FUNC (GPIO_FUNC_37)
#define COM_TX_PORT (GPIO_PORT_A)
#define COM_TX_PIN (GPIO_PIN_08)
#define COM_TX_GPIO_FUNC (GPIO_FUNC_36)
#define COM_INT_EI (INT_SRC_USART2_EI)
#define COM_INT_EI_IRQ (INT011_IRQn)
#define COM_INT_RI (INT_SRC_USART2_RI)
#define COM_INT_RI_IRQ (INT012_IRQn)
typedef void (*com_rx_callback)(uint8_t data);
void hdl_com_uart_init(void);
void hdl_com_uart_rx_register(com_rx_callback pCBS);
void hdl_com_uart_send(uint8_t *w_buf,uint16_t len);
#endif