Common process - adapter the uart api
更多...
#include "tuya_cloud_types.h"
浏览源代码.
|
| 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
- 版权所有
- Copyright 2021-2022 Tuya Inc. All Rights Reserved.
◆ tkl_uart_deinit()
| OPERATE_RET tkl_uart_deinit |
( |
TUYA_UART_NUM_E |
port_id | ) |
|
uart deinit
- 参数
-
| [in] | port_id | uart 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()
uart init
- 参数
-
| [in] | port_id | uart 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] | cfg | uart 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] | uart | refer to tuya_uart_t |
| [in] | cmd | control command |
| [in] | arg | command 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_id | uart 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] | data | read data |
| [in] | len | buff 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_id | uart 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_cb | receive 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_id | uart 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] | enable | TRUE-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_id | uart 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] | enable | TRUE-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_id | uart 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_cb | receive 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_id | uart 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_ms | the 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_id | uart 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] | data | write buff |
| [in] | len | buff len |
- 返回
- return > 0: number of data written; return <= 0: write errror