RTK_base/user_uart/user_uart.h

39 lines
863 B
C

/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-06-14 傅小二 the first version
*/
#ifndef APPLICATIONS_USER_UART_USER_UART_H_
#define APPLICATIONS_USER_UART_USER_UART_H_
#include <rtthread.h>
#include <rtdevice.h>
#include <ulog.h>
#include <rtdef.h>
#define USER_UART_NAME "uart3"
#define READ_SERIAL3(...) rt_device_read(serial3,0,__VA_ARGS__,uart3_simpack.rx_num)
rt_device_t serial3;
struct uart_simpack
{
rt_size_t rx_num;
rt_size_t tx_num;
struct rt_semaphore rx_sem; /* 用于接收消息的信号量 */
struct rt_semaphore tx_sem; /* 用于发送消息的信号量 */
};
typedef struct uart_simpack uart_simpack;
uart_simpack uart3_simpack;
rt_device_t uart3_init(void);
#endif /* APPLICATIONS_USER_UART_USER_UART_H_ */