更新配置代码
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user