1
完善资料让更多小伙伴认识你,还能领取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却没有出现这种问题,。 |
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
156个成员聚集在这个小组
加入小组【Vision Board创客营连载体验】基于RA8D1-Vision Board的自动路径规划小车
901 浏览 0 评论
【Vision Board创客营连载体验】基于Vision Board的垃圾分类
1304 浏览 0 评论
【Vision Board创客营连载体验】使用 Vision Board 做一个 UVC Camera
932 浏览 0 评论
【Vision Board创客营连载体验】TinyMaix进行手写数字识别
1197 浏览 0 评论
【Vision Board创客营连载体验】RA8D1-Vision Board使用7寸屏设置为RGB666大端模式模式成功显示摄像头图案
1206 浏览 0 评论
小黑屋| 手机版| Archiver| 德赢Vwin官网 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-22 20:14 , Processed in 0.604113 second(s), Total 98, Slave 81 queries .
Powered by 德赢Vwin官网 网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
德赢Vwin官网 观察
版权所有 © 湖南华秋数字科技有限公司
德赢Vwin官网 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号