RT_Thread Studio创建工程编译时出错error: ‘struct serial_configure‘ has no member named ‘flowcontrol‘

我们在使用RT_Thread Studio创建新的工程,还没有写代码就编译报错

报错代码switch (cfg->flowcontrol)

 

错误提醒:error: 'struct serial_configure' has no member named 'flowcontrol'

意思是没有“struct serial_configure”没有名为“flowcontrol”的成员

解决方法

在drv_usart.c文件里面屏蔽以下代码

 switch (cfg->flowcontrol)
    {
    case RT_SERIAL_FLOWCONTROL_NONE:
        uart->handle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
        break;
    case RT_SERIAL_FLOWCONTROL_CTSRTS:
        uart->handle.Init.HwFlowCtl = UART_HWCONTROL_RTS_CTS;
        break;
    default:
        uart->handle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
        break;
    }

编译就能正常通过了

具体原因作者也不清楚,此代码屏蔽后工程暂时没有没有出现问题