summaryrefslogtreecommitdiff
path: root/bsp/gd32450z-eval/drivers/drv_usart.c
diff options
context:
space:
mode:
Diffstat (limited to 'bsp/gd32450z-eval/drivers/drv_usart.c')
-rw-r--r--bsp/gd32450z-eval/drivers/drv_usart.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/bsp/gd32450z-eval/drivers/drv_usart.c b/bsp/gd32450z-eval/drivers/drv_usart.c
index 216b022159..fa691a42b9 100644
--- a/bsp/gd32450z-eval/drivers/drv_usart.c
+++ b/bsp/gd32450z-eval/drivers/drv_usart.c
@@ -33,7 +33,7 @@
struct gd32_uart
{
uint32_t uart_periph; //Todo: 3bits
- IRQn_Type irqn; //Todo: 7bits
+ IRQn_Type irqn; //Todo: 7bits
rcu_periph_enum per_clk; //Todo: 5bits
rcu_periph_enum tx_gpio_clk; //Todo: 5bits
rcu_periph_enum rx_gpio_clk; //Todo: 5bits
@@ -44,7 +44,7 @@ struct gd32_uart
uint16_t rx_af; //Todo: 4bits
uint16_t rx_pin; //Todo: 4bits
- struct rt_serial_device * serial;
+ struct rt_serial_device * serial;
char *device_name;
};
@@ -189,7 +189,7 @@ static const struct gd32_uart uarts[] = {
"uart0",
},
#endif
-
+
#ifdef BSP_USING_UART1
{
USART1, // uart peripheral index
@@ -201,7 +201,7 @@ static const struct gd32_uart uarts[] = {
"uart1",
},
#endif
-
+
#ifdef BSP_USING_UART2
{
USART2, // uart peripheral index
@@ -213,7 +213,7 @@ static const struct gd32_uart uarts[] = {
"uart2",
},
#endif
-
+
#ifdef BSP_USING_UART3
{
UART3, // uart peripheral index
@@ -225,7 +225,7 @@ static const struct gd32_uart uarts[] = {
"uart3",
},
#endif
-
+
#ifdef BSP_USING_UART4
{
UART4, // uart peripheral index
@@ -249,7 +249,7 @@ static const struct gd32_uart uarts[] = {
"uart5",
},
#endif
-
+
#ifdef BSP_USING_UART6
{
UART6, // uart peripheral index
@@ -305,7 +305,7 @@ void gd32_uart_gpio_init(struct gd32_uart *uart)
/* configure USART Rx as alternate function push-pull */
gpio_mode_set(uart->rx_port, GPIO_MODE_AF, GPIO_PUPD_PULLUP, uart->rx_pin);
gpio_output_options_set(uart->rx_port, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, uart->rx_pin);
-
+
NVIC_SetPriority(uart->irqn, 0);
NVIC_EnableIRQ(uart->irqn);
}
@@ -318,9 +318,9 @@ static rt_err_t gd32_configure(struct rt_serial_device *serial, struct serial_co
RT_ASSERT(cfg != RT_NULL);
uart = (struct gd32_uart *)serial->parent.user_data;
-
+
gd32_uart_gpio_init(uart);
-
+
usart_baudrate_set(uart->uart_periph, cfg->baud_rate);
switch (cfg->data_bits)
@@ -400,7 +400,7 @@ static int gd32_putc(struct rt_serial_device *serial, char ch)
usart_data_transmit(uart->uart_periph, ch);
while((usart_flag_get(uart->uart_periph, USART_FLAG_TC) == RESET));
-
+
return 1;
}
@@ -452,7 +452,7 @@ int gd32_hw_usart_init(void)
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
int i;
-
+
for (i = 0; i < sizeof(uarts) / sizeof(uarts[0]); i++)
{
uarts[i].serial->ops = &gd32_uart_ops;