更新配置代码

This commit is contained in:
LokLiang
2025-04-10 10:57:28 +08:00
parent 59ca87af0d
commit 133181c542
10 changed files with 364 additions and 37 deletions

View File

@@ -6,6 +6,7 @@
#include "uart_port.h"
#include "drivers/chip/gpio.h"
#include "driver/uart.h"
#include "hal/uart_ll.h"
@@ -368,7 +369,7 @@ static int _uart_port_read(sb_data_port_t *port, void *data, uint32_t size)
return ret;
}
static bool _uart_port_is_tart(sb_data_port_t *port)
static bool _uart_port_is_start(sb_data_port_t *port)
{
if (port == NULL)
{
@@ -424,7 +425,7 @@ static sb_data_port_vtable_t const s_uart_vtable = {
.stop = _uart_port_stop,
.write = _uart_port_write,
.read = _uart_port_read,
.is_started = _uart_port_is_tart,
.is_started = _uart_port_is_start,
.get_rx_length = _uart_port_get_rx_length,
};
@@ -482,9 +483,14 @@ sb_data_port_t *sb_uart_port_bind(int uart_num,
void sb_uart_port_unbind(sb_data_port_t *port)
{
if (_uart_port_is_tart(port))
if (_uart_port_is_start(port))
{
_uart_port_stop(port);
__uart_data_t *uart_data = port->data;
drv_gpio_pin_configure(uart_data->tx_pin, _GPIO_DIR_IN, _GPIO_PUD_PULL_UP);
drv_gpio_pin_configure(uart_data->rx_pin, _GPIO_DIR_IN, _GPIO_PUD_PULL_UP);
port->data = NULL;
}
port->data = NULL;
}