improve serial api docs

This commit is contained in:
lixianjing 2023-07-04 10:54:38 +08:00
parent 49683bcf1a
commit 352a52c468
2 changed files with 53 additions and 0 deletions

View File

@ -1,5 +1,8 @@
# 最新动态
2023/07/05
* 完善serial helper的文档(感谢俊杰提供补丁)。
2023/07/04
* 完善conf\_node\_get\_child\_value。

View File

@ -89,17 +89,67 @@ typedef enum { stopbits_one = 1, stopbits_two = 2, stopbits_one_point_five } sto
typedef enum { flowcontrol_none = 0, flowcontrol_software, flowcontrol_hardware } flowcontrol_t;
/**
* @method serial_open
*
* @annotation ["global"]
* @param {const char*} port
*
* @return {serial_handle_t} NULL
*/
serial_handle_t serial_open(const char* port);
ret_t serial_iflush(serial_handle_t handle);
ret_t serial_oflush(serial_handle_t handle);
ret_t serial_wait_for_data(serial_handle_t handle, uint32_t timeout_ms);
/**
* @method serial_read
*
* @annotation ["global"]
* @param {serial_handle_t} handle
* @param {uint8_t*} buff
* @param {uint32_t} max_size
*
* @return {int32_t}
*/
int32_t serial_read(serial_handle_t handle, uint8_t* buff, uint32_t max_size);
/**
* @method serial_write
*
* @annotation ["global"]
* @param {serial_handle_t} handle
* @param {const uint8_t*} buff
* @param {uint32_t} max_size
*
* @return {int32_t}
*/
int32_t serial_write(serial_handle_t handle, const uint8_t* buff, uint32_t max_size);
/**
* @method serial_close
*
* @annotation ["global"]
* @param {serial_handle_t} handle
*
* @return {int}
*/
int serial_close(serial_handle_t handle);
/**
* @method serial_config
*
* @annotation ["global"]
* @param {serial_handle_t} handle
* @param {uint32_t} baudrate
* @param {bytesize_t} bytesize
* @param {stopbits_t} stopbits
* @param {flowcontrol_t} flowcontrol
* @param {parity_t} parity
*
* @return {ret_t} RET_OK表示成功
*/
ret_t serial_config(serial_handle_t handle, uint32_t baudrate, bytesize_t bytesize,
stopbits_t stopbits, flowcontrol_t flowcontrol, parity_t parity);