|
|
@@ -37,7 +37,7 @@ |
|
|
|
SYSINIT(hal_init, SI_SUB_HAL, SI_ORDER_FIRST, (void (*)(const void *))HAL_Init, NULL); |
|
|
|
|
|
|
|
static void |
|
|
|
clkenable(const void *none) |
|
|
|
c13led(const void *none) |
|
|
|
{ |
|
|
|
GPIO_InitTypeDef GPIO_InitStruct; |
|
|
|
|
|
|
@@ -54,8 +54,12 @@ clkenable(const void *none) |
|
|
|
|
|
|
|
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET); |
|
|
|
} |
|
|
|
SYSINIT(clkenable, SI_SUB_HAL, SI_ORDER_SECOND, clkenable, NULL); |
|
|
|
SYSINIT(c13led, SI_SUB_HAL, SI_ORDER_SECOND, c13led, NULL); |
|
|
|
|
|
|
|
/* |
|
|
|
* Referenced from: |
|
|
|
* Projects/STM32F103RB-Nucleo/Applications/USB_Device/HID_Standalone/Src/main.c |
|
|
|
*/ |
|
|
|
static void |
|
|
|
oscconfig(const void *none) |
|
|
|
{ |
|
|
@@ -63,7 +67,6 @@ oscconfig(const void *none) |
|
|
|
RCC_OscInitTypeDef oscinitstruct; |
|
|
|
RCC_PeriphCLKInitTypeDef rccperiphclkinit; |
|
|
|
|
|
|
|
|
|
|
|
__HAL_RCC_PWR_CLK_ENABLE(); |
|
|
|
|
|
|
|
oscinitstruct = (RCC_OscInitTypeDef){ |
|
|
@@ -78,18 +81,6 @@ oscconfig(const void *none) |
|
|
|
|
|
|
|
HAL_RCC_OscConfig(&oscinitstruct); |
|
|
|
|
|
|
|
/* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 |
|
|
|
* clocks dividers */ |
|
|
|
clkinitstruct.ClockType = RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | |
|
|
|
RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; |
|
|
|
|
|
|
|
clkinitstruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; |
|
|
|
clkinitstruct.AHBCLKDivider = RCC_SYSCLK_DIV1; |
|
|
|
clkinitstruct.APB1CLKDivider = RCC_HCLK_DIV2; |
|
|
|
clkinitstruct.APB2CLKDivider = RCC_HCLK_DIV1; |
|
|
|
HAL_RCC_ClockConfig(&clkinitstruct, FLASH_LATENCY_2); |
|
|
|
|
|
|
|
|
|
|
|
/* USB clock selection */ |
|
|
|
rccperiphclkinit = (RCC_PeriphCLKInitTypeDef){ |
|
|
|
.PeriphClockSelection = RCC_PERIPHCLK_USB, |
|
|
@@ -255,12 +246,19 @@ int |
|
|
|
main(void) |
|
|
|
{ |
|
|
|
|
|
|
|
//debug_printf("starting...\n"); |
|
|
|
|
|
|
|
//clkenable(NULL); |
|
|
|
sysinit_run(); |
|
|
|
|
|
|
|
//Radio.Init(&revents); |
|
|
|
//debug_printf("starting...\n"); |
|
|
|
|
|
|
|
#if 1 |
|
|
|
int i; |
|
|
|
for (i = 0; i < 5; i++) { |
|
|
|
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_SET); |
|
|
|
HAL_Delay(250); |
|
|
|
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET); |
|
|
|
HAL_Delay(250); |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
setlinebuf(vcp_usb); |
|
|
|
|
|
|
@@ -277,8 +275,6 @@ main(void) |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
uint32_t v; |
|
|
|
|
|
|
|
char inpbuf[1024]; |
|
|
|
char *lastcheck; |
|
|
|
char *endchr; |
|
|
|