EXPEED_OS  1.1.2
结构体 | 枚举 | 函数
Hal_uart

uart硬件抽象层接口 更多...

Hal_uart 的协作图:

结构体

struct  hal_uart_config_t
 
struct  hal_uart_dev_t
 

枚举

enum  hal_hal_uart_mode_t { UART_WORK_MODE_TX = 0x0, UART_WORK_MODE_RX, UART_WORK_MODE_TX_RX }
 
enum  hal_hal_uart_data_width_t { UART_DATA_WIDTH_5_BITS = 0x0, UART_DATA_WIDTH_6_BITS, UART_DATA_WIDTH_7_BITS, UART_DATA_WIDTH_8_BITS }
 
enum  hal_hal_uart_parity_check_t { UART_NO_PARITY = 0x0, UART_PARITY_CHECK_EVEN, UART_PARITY_CHECK_ODD }
 
enum  hal_hal_uart_stop_bits_t { UART_STOP_BIT_1 = 0x0, UART_STOP_BIT_1_5, UART_STOP_BIT_2 }
 
enum  hal_hal_uart_flow_control_t { UART_FLOW_CONTROL_DISABLED = 0x0, UART_FLOW_CONTROL_RTS, UART_FLOW_CONTROL_CTS, UART_FLOW_CONTROL_CTS_RTS }
 

函数

int32_t hal_uart_init (hal_uart_dev_t *uart)
 初始化UART 更多...
 
int32_t hal_uart_deinit (hal_uart_dev_t *uart)
 
int32_t hal_uart_transmit (hal_uart_dev_t *uart, const void *buffer, uint32_t size, uint32_t timeout)
 串口直接发送数据 更多...
 
int32_t hal_uart_receive (hal_uart_dev_t *uart, void *buffer, uint32_t size, uint32_t timeout)
 串口接收数据 更多...
 

详细描述

uart硬件抽象层接口

枚举类型说明

◆ hal_hal_uart_data_width_t

UART 数据位宽

枚举值
UART_DATA_WIDTH_5_BITS 
UART_DATA_WIDTH_6_BITS 
UART_DATA_WIDTH_7_BITS 
UART_DATA_WIDTH_8_BITS 

◆ hal_hal_uart_flow_control_t

UART 流控制

枚举值
UART_FLOW_CONTROL_DISABLED 
UART_FLOW_CONTROL_RTS 
UART_FLOW_CONTROL_CTS 
UART_FLOW_CONTROL_CTS_RTS 

◆ hal_hal_uart_mode_t

UART 模式

枚举值
UART_WORK_MODE_TX 
UART_WORK_MODE_RX 
UART_WORK_MODE_TX_RX 

◆ hal_hal_uart_parity_check_t

UART 奇偶校验

枚举值
UART_NO_PARITY 
UART_PARITY_CHECK_EVEN 
UART_PARITY_CHECK_ODD 

◆ hal_hal_uart_stop_bits_t

UART 停止位数

枚举值
UART_STOP_BIT_1 
UART_STOP_BIT_1_5 
UART_STOP_BIT_2 

函数说明

◆ hal_uart_deinit()

int32_t hal_uart_deinit ( hal_uart_dev_t uart)
参数
[in]uartthe interface which should be deinitialised
返回
0 : success

◆ hal_uart_init()

int32_t hal_uart_init ( hal_uart_dev_t uart)

初始化UART

参数
[in]uartUART接口
返回
0 : success

◆ hal_uart_receive()

int32_t hal_uart_receive ( hal_uart_dev_t uart,
void *  buffer,
uint32_t  size,
uint32_t  timeout 
)

串口接收数据

参数
[in]uartuart接口
[in]buffer发送数据
[in]size传输字节数
[in]timeout超时时间(ms)
返回
>0: 接收数据量,单位字节 else: 接收失败

◆ hal_uart_transmit()

int32_t hal_uart_transmit ( hal_uart_dev_t uart,
const void *  buffer,
uint32_t  size,
uint32_t  timeout 
)

串口直接发送数据

参数
[in]uartuart接口
[in]buffer发送数据
[in]size传输字节数
[in]timeout超时时间(ms)
返回
-1 : 发送失败
else: 发送成功