代码拉取完成,页面将自动刷新
/*
* Change Logs:
* Date Author Notes
* 2024-05-24 Slyant the first version
*/
#ifndef _UART_FRAMEWORK_H_
#define _UART_FRAMEWORK_H_
struct uart_framework_cfg
{
char *uart_name;
rt_size_t max_frame_size;
rt_uint32_t frame_interval_ms;
rt_uint32_t send_interval_ms;
rt_err_t (*rx_ind)(rt_device_t dev, rt_size_t size);
void (*rs485_txd)(void);
void (*rs485_rxd)(void);
};
struct uart_framework
{
rt_device_t uart_device;
rt_uint8_t *rx_buf;
rt_uint8_t rx_ch;
rt_size_t rx_size;
rt_sem_t rx_sem;
rt_mutex_t dev_lock;
rt_tick_t last_tick;
rt_tick_t cur_tick;
rt_tick_t send_tick;
struct uart_framework_cfg cfg;
};
typedef struct uart_framework *uart_framework_t;
uart_framework_t uart_framework_create(struct uart_framework_cfg *cfg);
rt_size_t uart_framework_send(uart_framework_t uf, rt_uint8_t *data, rt_size_t size);
rt_size_t uart_framework_send_take(uart_framework_t uf, rt_uint8_t *data, rt_size_t size);
rt_size_t uart_framework_send_take_release(uart_framework_t uf, rt_uint8_t *data, rt_size_t size);
rt_err_t uart_framework_receive(uart_framework_t uf, rt_uint32_t timeout_ms,
rt_err_t (*frame_handler)(rt_uint8_t *data, rt_size_t size), rt_uint8_t *out, rt_size_t out_max_size);
rt_err_t uart_framework_receive_release(uart_framework_t uf, rt_uint32_t timeout_ms,
rt_err_t (*frame_handler)(rt_uint8_t *data, rt_size_t size), rt_uint8_t *out, rt_size_t out_max_size);
rt_err_t uart_framework_receive_take_release(uart_framework_t uf, rt_uint32_t timeout_ms,
rt_err_t (*frame_handler)(rt_uint8_t *data, rt_size_t size), rt_uint8_t *out, rt_size_t out_max_size);
#endif /* _UART_FRAMEWORK_H_ */
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。