完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
STM32f407的drv_usart.c文件编译错误
static rt_err_t stm32_configure(struct rt_serial_device *serial, struct serial_configure *cfg) { struct stm32_uart *uart; RT_ASSERT(serial != RT_NULL); RT_ASSERT(cfg != RT_NULL); uart = rt_container_of(serial, struct stm32_uart, serial); /* uart clock enable */ stm32_uart_clk_enable(uart->config); /* uart gpio clock enable and gpio pin init */ stm32_gpio_configure(uart->config); uart->handle.Instance = uart->config->Instance; uart->handle.Init.BaudRate = cfg->baud_rate; uart->handle.Init.Mode = UART_MODE_TX_RX; uart->handle.Init.OverSampling = UART_OVERSAMPLING_16; 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; } switch (cfg->data_bits) { case DATA_BITS_8: if (cfg->parity == PARITY_ODD || cfg->parity == PARITY_EVEN) uart->handle.Init.WordLength = UART_WORDLENGTH_9B; else uart->handle.Init.WordLength = UART_WORDLENGTH_8B; break; case DATA_BITS_9: uart->handle.Init.WordLength = UART_WORDLENGTH_9B; break; default: uart->handle.Init.WordLength = UART_WORDLENGTH_8B; break; } switch (cfg->stop_bits) { case STOP_BITS_1: uart->handle.Init.StopBits = UART_STOPBITS_1; break; case STOP_BITS_2: uart->handle.Init.StopBits = UART_STOPBITS_2; break; default: uart->handle.Init.StopBits = UART_STOPBITS_1; break; } switch (cfg->parity) { case PARITY_NONE: uart->handle.Init.Parity = UART_PARITY_NONE; break; case PARITY_ODD: uart->handle.Init.Parity = UART_PARITY_ODD; break; case PARITY_EVEN: uart->handle.Init.Parity = UART_PARITY_EVEN; break; default: uart->handle.Init.Parity = UART_PARITY_NONE; break; } #ifdef RT_SERIAL_USING_DMA uart->dma_rx.last_index = 0; #endif if (HAL_UART_Init(&uart->handle) != HAL_OK) { return -RT_ERROR; } return RT_EOK; } 中的有一段关于流控的存在问题,会造成编译不通过,struct serial_configure结构体中不存在成员变量flowcontrol,代码如下: 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; } 初步推测是配置工具的问题,但是在stm32h753却没有出现这种问题,。 |
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
152个成员聚集在这个小组
加入小组【Vision Board创客营连载体验】基于RA8D1-Vision Board的自动路径规划小车
872 浏览 0 评论
【Vision Board创客营连载体验】基于Vision Board的垃圾分类
1215 浏览 0 评论
【Vision Board创客营连载体验】使用 Vision Board 做一个 UVC Camera
854 浏览 0 评论
【Vision Board创客营连载体验】TinyMaix进行手写数字识别
1161 浏览 0 评论
【Vision Board创客营连载体验】RA8D1-Vision Board使用7寸屏设置为RGB666大端模式模式成功显示摄像头图案
1153 浏览 0 评论
在RT-Thread Studio中新建的stm32f407-atk-explorer工程运行qemu失败,是什么原因引起的?
216浏览 3评论
STM32F407ZGT6 spi flash片选引脚无法被拉低的原因?怎么解决?
1188浏览 2评论
移植RT-THREAD在stm32开发板上,使用rt_kprintf不能正常打印的原因是什么?怎么解决?
514浏览 2评论
stm32f103zet用rtthread studio生成带finsh的项目程序,串口输入help没有反应是为什么?
518浏览 2评论
rtthread studio已经成功编写了外部flash下载算法,程序也能下载进去但是不能进行调试怎么办?
435浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-28 03:20 , Processed in 0.515805 second(s), Total 81, Slave 63 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号