@@ -77,34 +77,34 @@ void uart_sync(void)
77
77
78
78
void usart_printf_init (uint32_t baudrate )
79
79
{
80
- GPIO_InitTypeDef GPIO_InitStructure ;
81
- USART_InitTypeDef USART_InitStructure ;
82
-
83
- tx_produce = 0 ;
84
- tx_consume = 0 ;
85
-
86
- RCC_APB2PeriphClockCmd (RCC_APB2Periph_USART1 | RCC_APB2Periph_GPIOA , ENABLE );
87
-
88
- GPIO_InitStructure .GPIO_Pin = GPIO_Pin_9 ;
89
- GPIO_InitStructure .GPIO_Speed = GPIO_Speed_50MHz ;
90
- GPIO_InitStructure .GPIO_Mode = GPIO_Mode_AF_PP ;
91
- GPIO_Init (GPIOA , & GPIO_InitStructure );
92
-
93
- USART_InitStructure .USART_BaudRate = baudrate ;
94
- USART_InitStructure .USART_WordLength = USART_WordLength_8b ;
95
- USART_InitStructure .USART_StopBits = USART_StopBits_1 ;
96
- USART_InitStructure .USART_Parity = USART_Parity_No ;
97
- USART_InitStructure .USART_HardwareFlowControl = USART_HardwareFlowControl_None ;
98
- USART_InitStructure .USART_Mode = USART_Mode_Tx ;
99
-
100
- USART_Init (USART1 , & USART_InitStructure );
101
- USART_ITConfig (USART1 , USART_IT_TC , ENABLE );
102
- USART_Cmd (USART1 , ENABLE );
103
-
104
- NVIC_InitTypeDef NVIC_InitStructure = {0 };
105
- NVIC_InitStructure .NVIC_IRQChannel = USART1_IRQn ;
106
- NVIC_InitStructure .NVIC_IRQChannelPreemptionPriority = 1 ;
107
- NVIC_InitStructure .NVIC_IRQChannelSubPriority = 3 ;
108
- NVIC_InitStructure .NVIC_IRQChannelCmd = ENABLE ;
109
- NVIC_Init (& NVIC_InitStructure );
80
+ GPIO_InitTypeDef GPIO_InitStructure ;
81
+ USART_InitTypeDef USART_InitStructure ;
82
+
83
+ tx_produce = 0 ;
84
+ tx_consume = 0 ;
85
+
86
+ RCC_APB2PeriphClockCmd (RCC_APB2Periph_USART1 | RCC_APB2Periph_GPIOA , ENABLE );
87
+
88
+ GPIO_InitStructure .GPIO_Pin = GPIO_Pin_9 ;
89
+ GPIO_InitStructure .GPIO_Speed = GPIO_Speed_50MHz ;
90
+ GPIO_InitStructure .GPIO_Mode = GPIO_Mode_AF_PP ;
91
+ GPIO_Init (GPIOA , & GPIO_InitStructure );
92
+
93
+ USART_InitStructure .USART_BaudRate = baudrate ;
94
+ USART_InitStructure .USART_WordLength = USART_WordLength_8b ;
95
+ USART_InitStructure .USART_StopBits = USART_StopBits_1 ;
96
+ USART_InitStructure .USART_Parity = USART_Parity_No ;
97
+ USART_InitStructure .USART_HardwareFlowControl = USART_HardwareFlowControl_None ;
98
+ USART_InitStructure .USART_Mode = USART_Mode_Tx ;
99
+
100
+ USART_Init (USART1 , & USART_InitStructure );
101
+ USART_ITConfig (USART1 , USART_IT_TC , ENABLE );
102
+ USART_Cmd (USART1 , ENABLE );
103
+
104
+ NVIC_InitTypeDef NVIC_InitStructure = { 0 };
105
+ NVIC_InitStructure .NVIC_IRQChannel = USART1_IRQn ;
106
+ NVIC_InitStructure .NVIC_IRQChannelPreemptionPriority = 1 ;
107
+ NVIC_InitStructure .NVIC_IRQChannelSubPriority = 3 ;
108
+ NVIC_InitStructure .NVIC_IRQChannelCmd = ENABLE ;
109
+ NVIC_Init (& NVIC_InitStructure );
110
110
}
0 commit comments