Skip to content

Commit

Permalink
processing USB requests after init done
Browse files Browse the repository at this point in the history
  • Loading branch information
z4yx committed Apr 18, 2024
1 parent d2f8161 commit f4999a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 8 additions & 2 deletions Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ UART_HandleTypeDef huart2;

/* USER CODE BEGIN PV */
extern uint32_t _stack_boundary;
uint32_t device_loop_enable;
uint8_t device_loop_enable, usb_init_done;
/* USER CODE END PV */

/* Private function prototypes -----------------------------------------------*/
Expand Down Expand Up @@ -274,6 +274,11 @@ static void config_usb_mode(void) {
// enable the device_periodic_task, which controls LED and Touch sensing
device_loop_enable = 1;
}
// Called by core library
void USBD_LL_Init_Done(void)
{
usb_init_done = 1;
}
/* USER CODE END 0 */

/**
Expand Down Expand Up @@ -343,7 +348,8 @@ int main(void) {
DBG_MSG("Touch calibrating...\n");
GPIO_Touch_Calibrate();
}
device_loop(1);
if (usb_init_done)
device_loop(1);
++i;
}
}
Expand Down
3 changes: 0 additions & 3 deletions Src/usbd_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -793,9 +793,6 @@ static void SystemClockConfig_Resume(void)
SystemClock_CustomConfig(false, true);
}

// Unused callback
void USBD_LL_Init_Done(void) {}

/* USER CODE END 5 */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

0 comments on commit f4999a2

Please sign in to comment.