微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > stm32 Usart 初始化

stm32 Usart 初始化

时间:11-17 来源:互联网 点击:
库文件中给出了初始化stm32 USART 的范例

/**

* @brief Fills each USART_InitStruct member with its default value.

* @param USART_InitStruct: pointer to a USART_InitTypeDef structure

* which will be initialized.

* @retval None

*/

void USART_StructInit(USART_InitTypeDef* USART_InitStruct)

{

/* USART_InitStruct members default value */

USART_InitStruct->USART_BaudRate = 9600;

USART_InitStruct->USART_WordLength = USART_WordLength_8b;

USART_InitStruct->USART_StopBits = USART_StopBits_1;

USART_InitStruct->USART_Parity = USART_Parity_No ;

USART_InitStruct->USART_Mode = USART_Mode_Rx | USART_Mode_Tx;

USART_InitStruct->USART_HardwareFlowControl = USART_HardwareFlowControl_None;

}

所以初始设置也是依样画葫芦。

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top