generated from hulk/gd32e23x_template
for debug
This commit is contained in:
parent
3f75e99553
commit
e5f3bf900a
@ -12,6 +12,21 @@
|
||||
// #define POWER_SUPPLY_12V
|
||||
#define POWER_SUPPLY_24V
|
||||
|
||||
// #define GD32E230F4
|
||||
// #define GD32E230F8
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
#ifdef GD32E230F8
|
||||
#define USART_RCU RCU_USART1
|
||||
#define USART_PHY USART1
|
||||
#define USART_PHY_IRQ USART1_IRQn
|
||||
#else
|
||||
#define USART_RCU RCU_USART0
|
||||
#define USART_PHY USART0
|
||||
#define USART_PHY_IRQ USART0_IRQn
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
#ifdef POWER_SUPPLY_12V
|
||||
@ -26,7 +41,6 @@
|
||||
#error "Please define either POWER_SUPPLY_12V or POWER_SUPPLY_24V"
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
#define I2C_GPIO_RCU RCU_GPIOF
|
||||
@ -41,13 +55,14 @@
|
||||
/******************************************************************************/
|
||||
|
||||
#define USART_GPIO_RCU RCU_GPIOA
|
||||
#define USART_RCU RCU_USART0
|
||||
// #define USART_RCU RCU_USART0
|
||||
#define USART_GPIO_PORT GPIOA
|
||||
#define USART_GPIO_AF GPIO_AF_1
|
||||
#define USART_TX_PIN GPIO_PIN_2
|
||||
#define USART_RX_PIN GPIO_PIN_3
|
||||
#define USART_PHY USART0
|
||||
// #define USART_PHY USART0
|
||||
#define USART_PHY_BAUDRATE 115200U
|
||||
// #define USART_PHY_IRQ USART0_IRQn
|
||||
#define RS485_EN_PORT GPIOA
|
||||
#define RS485_EN_PIN GPIO_PIN_4
|
||||
|
||||
|
@ -26,12 +26,10 @@ void usart_config(void)
|
||||
usart_baudrate_set(USART_PHY, USART_PHY_BAUDRATE);
|
||||
usart_receive_config(USART_PHY, USART_RECEIVE_ENABLE);
|
||||
usart_transmit_config(USART_PHY, USART_TRANSMIT_ENABLE);
|
||||
|
||||
usart_enable(USART_PHY);
|
||||
|
||||
nvic_irq_enable(USART0_IRQn, 0);
|
||||
nvic_irq_enable(USART_PHY_IRQ, 0);
|
||||
usart_interrupt_enable(USART_PHY, USART_INT_RBNE);
|
||||
usart_interrupt_enable(USART_PHY, USART_INT_IDLE);
|
||||
usart_enable(USART_PHY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user