从官网复制串口操作例程到自建的RT-Thread Studio工程中,报语法错误。
#include <rtthread.h>
#include <variable.h>
#include <rtdbg.h>
/*
#include <rtdevice.h>
#include <rthw.h>
#include <board.h>
#include <stm32f4xx.h>
#include <rtdef.h>
*/
#define SAMPLE_UART_NAME "uart2" /* 串口设备名称 */
static rt_device_t serial; /* 串口设备句柄 */
/* 查找串口设备 */
serial = rt_device_find(SAMPLE_UART_NAME);
/* 以中断接收及轮询发送模式打开串口设备 */
rt_device_open(serial, RT_DEVICE_FLAG_INT_RX);
这些语句应该都在函数内部才行吧???
直接这样放置,不报错才怪啊。。
@sync 果然,果然。
@sync 养鹰的被鹰啄眼睛了,我竟然没注意到