- USART_InitTypeDef USART_InitStructure;
-
/* Usart init,38400,8bit data bit,1 stop bit, No Parity and flow control, rx tx enable */
- USART_InitStructure.USART_BaudRate = 38400;
- USART_InitStructure.USART_WordLength = USART_WordLength_8b;
- USART_InitStructure.USART_StopBits = USART_StopBits_1;
- USART_InitStructure.USART_Parity = USART_Parity_No;
- USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
- USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
- USART_Init(USAR1T, &USART_InitStructure);
-
- /* Enable USART DMA RX request */
- USART_DMACmd(USART1, USART_DMAReq_Rx, ENABLE);
/* Enable USART1 RX DMA channel */
- DMA_Cmd(DMA1_Channel5, ENABLE);
- /* Enable USART */
- USART_Cmd(USART, ENABLE);