TuyaOS
函数
tkl_uart.h 文件参考

Common process - adapter the uart api 更多...

#include "tuya_cloud_types.h"
tkl_uart.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

函数

OPERATE_RET tkl_uart_deinit (TUYA_UART_NUM_E port_id)
 uart deinit 更多...
 
OPERATE_RET tkl_uart_init (TUYA_UART_NUM_E port_id, TUYA_UART_BASE_CFG_T *cfg)
 uart init 更多...
 
OPERATE_RET tkl_uart_ioctl (TUYA_UART_NUM_E port_id, UINT32_T cmd, VOID *arg)
 uart control 更多...
 
INT_T tkl_uart_read (TUYA_UART_NUM_E port_id, VOID_T *buff, UINT16_T len)
 uart read data 更多...
 
VOID_T tkl_uart_rx_irq_cb_reg (TUYA_UART_NUM_E port_id, TUYA_UART_IRQ_CB rx_cb)
 enable uart rx interrupt and regist interrupt callback 更多...
 
OPERATE_RET tkl_uart_set_rx_flowctrl (TUYA_UART_NUM_E port_id, BOOL_T enable)
 set uart receive flowcontrol 更多...
 
OPERATE_RET tkl_uart_set_tx_int (TUYA_UART_NUM_E port_id, BOOL_T enable)
 set uart transmit interrupt status 更多...
 
VOID_T tkl_uart_tx_irq_cb_reg (TUYA_UART_NUM_E port_id, TUYA_UART_IRQ_CB tx_cb)
 regist uart tx interrupt callback If this function is called, it indicates that the data is sent asynchronously through interrupt, and then write is invoked to initiate asynchronous transmission. 更多...
 
OPERATE_RET tkl_uart_wait_for_data (TUYA_UART_NUM_E port_id, INT_T timeout_ms)
 wait for uart data 更多...
 
INT_T tkl_uart_write (TUYA_UART_NUM_E port_id, VOID_T *buff, UINT16_T len)
 uart write data 更多...
 

详细描述

Common process - adapter the uart api

版本
0.1
日期
2021-08-06

函数说明

◆ tkl_uart_deinit()

OPERATE_RET tkl_uart_deinit ( TUYA_UART_NUM_E  port_id)

uart deinit

参数
[in]port_iduart port id, id index starts at 0 in linux platform, high 16 bits aslo means uart type, it's value must be one of the TUYA_UART_TYPE_E type the low 16bit - means uart port id you can input like this TUYA_UART_PORT_ID(TUYA_UART_SYS, 2)
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tkl_uart_init()

OPERATE_RET tkl_uart_init ( TUYA_UART_NUM_E  port_id,
TUYA_UART_BASE_CFG_T cfg 
)

uart init

参数
[in]port_iduart port id, id index starts at 0 in linux platform, high 16 bits aslo means uart type, it's value must be one of the TUYA_UART_TYPE_E type the low 16bit - means uart port id you can input like this TUYA_UART_PORT_ID(TUYA_UART_SYS, 2)
[in]cfguart config
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tkl_uart_ioctl()

OPERATE_RET tkl_uart_ioctl ( TUYA_UART_NUM_E  port_id,
UINT32_T  cmd,
VOID *  arg 
)

uart control

参数
[in]uartrefer to tuya_uart_t
[in]cmdcontrol command
[in]argcommand argument
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tkl_uart_read()

INT_T tkl_uart_read ( TUYA_UART_NUM_E  port_id,
VOID_T *  buff,
UINT16_T  len 
)

uart read data

参数
[in]port_iduart port id, id index starts at 0 in linux platform, high 16 bits aslo means uart type, it's value must be one of the TUYA_UART_TYPE_E type the low 16bit - means uart port id you can input like this TUYA_UART_PORT_ID(TUYA_UART_SYS, 2)
[out]dataread data
[in]lenbuff len
返回
return >= 0: number of data read; return < 0: read errror

◆ tkl_uart_rx_irq_cb_reg()

VOID_T tkl_uart_rx_irq_cb_reg ( TUYA_UART_NUM_E  port_id,
TUYA_UART_IRQ_CB  rx_cb 
)

enable uart rx interrupt and regist interrupt callback

参数
[in]port_iduart port id, id index starts at 0 in linux platform, high 16 bits aslo means uart type, it's value must be one of the TUYA_UART_TYPE_E type the low 16bit - means uart port id you can input like this TUYA_UART_PORT_ID(TUYA_UART_SYS, 2)
[in]rx_cbreceive callback
返回
none

◆ tkl_uart_set_rx_flowctrl()

OPERATE_RET tkl_uart_set_rx_flowctrl ( TUYA_UART_NUM_E  port_id,
BOOL_T  enable 
)

set uart receive flowcontrol

参数
[in]port_iduart port id, id index starts at 0 in linux platform, high 16 bits aslo means uart type, it's value must be one of the TUYA_UART_TYPE_E type the low 16bit - means uart port id you can input like this TUYA_UART_PORT_ID(TUYA_UART_SYS, 2)
[in]enableTRUE-enalbe rx flowcontrol, FALSE-disable rx flowcontrol
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tkl_uart_set_tx_int()

OPERATE_RET tkl_uart_set_tx_int ( TUYA_UART_NUM_E  port_id,
BOOL_T  enable 
)

set uart transmit interrupt status

参数
[in]port_iduart port id, id index starts at 0 in linux platform, high 16 bits aslo means uart type, it's value must be one of the TUYA_UART_TYPE_E type the low 16bit - means uart port id you can input like this TUYA_UART_PORT_ID(TUYA_UART_SYS, 2)
[in]enableTRUE-enalbe tx int, FALSE-disable tx int
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tkl_uart_tx_irq_cb_reg()

VOID_T tkl_uart_tx_irq_cb_reg ( TUYA_UART_NUM_E  port_id,
TUYA_UART_IRQ_CB  tx_cb 
)

regist uart tx interrupt callback If this function is called, it indicates that the data is sent asynchronously through interrupt, and then write is invoked to initiate asynchronous transmission.

参数
[in]port_iduart port id, id index starts at 0 in linux platform, high 16 bits aslo means uart type, it's value must be one of the TUYA_UART_TYPE_E type the low 16bit - means uart port id you can input like this TUYA_UART_PORT_ID(TUYA_UART_SYS, 2)
[in]rx_cbreceive callback
返回
none

◆ tkl_uart_wait_for_data()

OPERATE_RET tkl_uart_wait_for_data ( TUYA_UART_NUM_E  port_id,
INT_T  timeout_ms 
)

wait for uart data

参数
[in]port_iduart port id, id index starts at 0 in linux platform, high 16 bits aslo means uart type, it's value must be one of the TUYA_UART_TYPE_E type the low 16bit - means uart port id you can input like this TUYA_UART_PORT_ID(TUYA_UART_SYS, 2)
[in]timeout_msthe max wait time, unit is millisecond -1 : block indefinitely 0 : non-block >0 : timeout in milliseconds
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tkl_uart_write()

INT_T tkl_uart_write ( TUYA_UART_NUM_E  port_id,
VOID_T *  buff,
UINT16_T  len 
)

uart write data

参数
[in]port_iduart port id, id index starts at 0 in linux platform, high 16 bits aslo means uart type, it's value must be one of the TUYA_UART_TYPE_E type the low 16bit - means uart port id you can input like this TUYA_UART_PORT_ID(TUYA_UART_SYS, 2)
[in]datawrite buff
[in]lenbuff len
返回
return > 0: number of data written; return <= 0: write errror