初级会员
- 积分
- 191
- 金钱
- 191
- 注册时间
- 2018-7-23
- 在线时间
- 23 小时
|
1金钱
1、首先找到drv_uart.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 = (struct stm32_uart *)serial->parent.user_data;
- RT_ASSERT(uart != RT_NULL);
- uart->handle.Instance = uart->config->Instance;
- uart->handle.Init.BaudRate = cfg->baud_rate;
- uart->handle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
- uart->handle.Init.Mode = UART_MODE_TX_RX;
- uart->handle.Init.OverSampling = UART_OVERSAMPLING_16;
- switch (cfg->data_bits)
- {
- case DATA_BITS_8:
- uart->handle.Init.WordLength = UART_WORDLENGTH_8B;
复制代码 2、按照需求将
- uart->handle.Init.HwFlowCtl
复制代码 赋值为一下内容即可
- /** @defgroup UART_Hardware_Flow_Control UART Hardware Flow Control
- * @{
- */
- #define UART_HWCONTROL_NONE 0x00000000U /*!< No hardware control */
- #define UART_HWCONTROL_RTS USART_CR3_RTSE /*!< Request To Send */
- #define UART_HWCONTROL_CTS USART_CR3_CTSE /*!< Clear To Send */
- #define UART_HWCONTROL_RTS_CTS (USART_CR3_RTSE | USART_CR3_CTSE) /*!< Request and Clear To Send */
复制代码 3、最重要的一条
增加流控需要增加引脚定义,所以相关引脚定义也需要更新,在 msp.c 中
|
|