File tree Expand file tree Collapse file tree 4 files changed +17
-12
lines changed Expand file tree Collapse file tree 4 files changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,9 @@ void USB_UCPD1_2_IRQHandler(void) {
4343//--------------------------------------------------------------------+
4444// MACRO TYPEDEF CONSTANT ENUM
4545//--------------------------------------------------------------------+
46+ #ifdef UART_DEV
4647UART_HandleTypeDef UartHandle ;
48+ #endif
4749
4850void board_init (void ) {
4951 HAL_Init (); // required for HAL_RCC_Osc TODO check with freeRTOS
@@ -59,8 +61,6 @@ void board_init(void) {
5961 __HAL_RCC_SYSCFG_CLK_ENABLE ();
6062 __HAL_RCC_PWR_CLK_ENABLE ();
6163
62- UART_CLK_EN ();
63-
6464#if CFG_TUSB_OS == OPT_OS_NONE
6565 // 1ms tick timer
6666 SysTick_Config (SystemCoreClock / 1000 );
@@ -91,6 +91,8 @@ void board_init(void) {
9191 HAL_GPIO_Init (BUTTON_PORT , & GPIO_InitStruct );
9292
9393#ifdef UART_DEV
94+ UART_CLK_EN ();
95+
9496 // UART
9597 GPIO_InitStruct .Pin = UART_TX_PIN | UART_RX_PIN ;
9698 GPIO_InitStruct .Mode = GPIO_MODE_AF_PP ;
@@ -167,7 +169,6 @@ int board_uart_write(void const *buf, int len) {
167169#else
168170 (void ) buf ;
169171 (void ) len ;
170- (void ) UartHandle ;
171172 return 0 ;
172173#endif
173174}
Original file line number Diff line number Diff line change @@ -57,7 +57,9 @@ void UCPD1_IRQHandler(void) {
5757//--------------------------------------------------------------------+
5858// MACRO TYPEDEF CONSTANT ENUM
5959//--------------------------------------------------------------------+
60+ #ifdef UART_DEV
6061UART_HandleTypeDef UartHandle ;
62+ #endif
6163
6264void board_init (void ) {
6365 HAL_Init ();
@@ -71,8 +73,6 @@ void board_init(void) {
7173 __HAL_RCC_GPIOE_CLK_ENABLE ();
7274 __HAL_RCC_GPIOG_CLK_ENABLE ();
7375
74- UART_CLK_EN ();
75-
7676#if CFG_TUSB_OS == OPT_OS_NONE
7777 // 1ms tick timer
7878 SysTick_Config (SystemCoreClock / 1000 );
@@ -107,6 +107,8 @@ void board_init(void) {
107107 HAL_GPIO_Init (BUTTON_PORT , & GPIO_InitStruct );
108108
109109#ifdef UART_DEV
110+ UART_CLK_EN ();
111+
110112 // UART
111113 memset (& GPIO_InitStruct , 0 , sizeof (GPIO_InitStruct ));
112114 GPIO_InitStruct .Pin = UART_TX_PIN | UART_RX_PIN ;
@@ -197,7 +199,6 @@ int board_uart_write(void const *buf, int len) {
197199#else
198200 (void ) buf ;
199201 (void ) len ;
200- (void ) UartHandle ;
201202 return 0 ;
202203#endif
203204}
Original file line number Diff line number Diff line change @@ -58,7 +58,9 @@ void USB_DRD_FS_IRQHandler(void) {
5858//--------------------------------------------------------------------+
5959// MACRO TYPEDEF CONSTANT ENUM
6060//--------------------------------------------------------------------+
61+ #ifdef UART_DEV
6162UART_HandleTypeDef UartHandle ;
63+ #endif
6264
6365void board_init (void ) {
6466 HAL_Init (); // required for HAL_RCC_Osc TODO check with freeRTOS
@@ -82,8 +84,6 @@ void board_init(void) {
8284 __HAL_RCC_GPIOI_CLK_ENABLE ();
8385 #endif
8486
85- UART_CLK_EN ();
86-
8787 #if CFG_TUSB_OS == OPT_OS_NONE
8888 // 1ms tick timer
8989 SysTick_Config (SystemCoreClock / 1000 );
@@ -114,6 +114,8 @@ void board_init(void) {
114114 HAL_GPIO_Init (BUTTON_PORT , & GPIO_InitStruct );
115115
116116 #ifdef UART_DEV
117+ UART_CLK_EN ();
118+
117119 // UART
118120 GPIO_InitStruct .Pin = UART_TX_PIN | UART_RX_PIN ;
119121 GPIO_InitStruct .Mode = GPIO_MODE_AF_PP ;
@@ -192,7 +194,6 @@ int board_uart_write(void const* buf, int len) {
192194 #else
193195 (void ) buf ;
194196 (void ) len ;
195- (void ) UartHandle ;
196197 return 0 ;
197198 #endif
198199}
Original file line number Diff line number Diff line change @@ -46,7 +46,9 @@ void USB_LP_IRQHandler(void) {
4646//--------------------------------------------------------------------+
4747// MACRO TYPEDEF CONSTANT ENUM
4848//--------------------------------------------------------------------+
49+ #ifdef UART_DEV
4950UART_HandleTypeDef UartHandle ;
51+ #endif
5052
5153void board_init (void ) {
5254 board_clock_init ();
@@ -58,8 +60,6 @@ void board_init(void) {
5860 __HAL_RCC_GPIOD_CLK_ENABLE ();
5961 __HAL_RCC_GPIOE_CLK_ENABLE ();
6062
61- UART_CLK_EN ();
62-
6363#if CFG_TUSB_OS == OPT_OS_NONE
6464 // 1ms tick timer
6565 SysTick_Config (SystemCoreClock / 1000 );
@@ -102,6 +102,8 @@ void board_init(void) {
102102 HAL_GPIO_Init (BUTTON_PORT , & GPIO_InitStruct );
103103
104104#ifdef UART_DEV
105+ UART_CLK_EN ();
106+
105107 // UART
106108 GPIO_InitStruct .Pin = UART_TX_PIN | UART_RX_PIN ;
107109 GPIO_InitStruct .Mode = GPIO_MODE_AF_PP ;
@@ -159,7 +161,7 @@ int board_uart_write(void const* buf, int len) {
159161 HAL_UART_Transmit (& UartHandle , (uint8_t * ) (uintptr_t ) buf , len , 0xffff );
160162 return len ;
161163#else
162- (void ) buf ; (void ) len ; ( void ) UartHandle ;
164+ (void ) buf ; (void ) len ;
163165 return 0 ;
164166#endif
165167}
You can’t perform that action at this time.
0 commit comments