Skip to content

Commit

Permalink
more update
Browse files Browse the repository at this point in the history
  • Loading branch information
hathach committed Jun 14, 2024
1 parent f32851c commit e101299
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions hw/bsp/ch32v10x/family.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,17 @@ void board_init(void) {
SysTick_Config(SystemCoreClock / 1000);
#endif

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);

EXTEN->EXTEN_CTR |= EXTEN_USBFS_IO_EN;
uint8_t usb_div;
switch (SystemCoreClock) {
case 48000000: usb_div = RCC_USBCLKSource_PLLCLK_Div1; break;
case 72000000: usb_div = RCC_USBCLKSource_PLLCLK_1Div5; break;
default: TU_ASSERT(0,); break;
}
RCC_USBCLKConfig(usb_div);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USB, ENABLE);

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_USBFS, ENABLE);

#ifdef LED_PIN
GPIO_InitTypeDef led_init = {
Expand Down

0 comments on commit e101299

Please sign in to comment.