master
ThinkPad-T460P 2020-04-14 18:48:32 +08:00
parent 1afcd15ace
commit 7265d43e5f
5 changed files with 8 additions and 11 deletions

View File

@ -39,7 +39,7 @@ void MX_GPIO_Init(void);
/* USER CODE BEGIN Prototypes */
void demoEnumCtlInit(GPIO_PinState PinState);
void demoEnumCtlInit();
void demoLedInit();
void demoLedBlink();
/* USER CODE END Prototypes */

View File

@ -155,14 +155,12 @@ void StartDefaultTask(void *argument)
/* init code for USB_DEVICE */
MX_USB_DEVICE_Init();
/* USER CODE BEGIN StartDefaultTask */
demoEnumCtlInit(GPIO_PIN_SET);
demoEnumCtlInit();
/* Infinite loop */
for(;;)
{
osDelay(1000);
printf("[%f],NumofTasks:%d\n",(float)(osKernelGetTickCount()/1000.0),(int)(osThreadGetCount()));
// printf("Name:%s\n",osThreadGetName(defaultTaskHandle));
// printf("state:%s\n",osKernelGetState());
printf("[%f]\n",(float)(osKernelGetTickCount()/1000.0));
}
/* USER CODE END StartDefaultTask */
}
@ -182,7 +180,7 @@ void StartLedBlinkTask(void *argument)
for(;;)
{
// HAL_GPIO_TogglePin(LED_RUN_GPIO_Port,LED_RUN_Pin);
// printf("led toggled\n");
demoLedBlink();
osDelay(500);
}

View File

@ -110,7 +110,7 @@ void MX_GPIO_Init(void)
}
/* USER CODE BEGIN 2 */
void demoEnumCtlInit(GPIO_PinState PinState)
void demoEnumCtlInit()
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
GPIO_InitStruct.Pin = GPIO_PIN_8;
@ -119,7 +119,7 @@ void demoEnumCtlInit(GPIO_PinState PinState)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_8, PinState);
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_8, GPIO_PIN_SET);
}
void demoLedInit()
{

View File

@ -31,7 +31,7 @@ void MX_IWDG_Init(void)
{
hiwdg.Instance = IWDG;
hiwdg.Init.Prescaler = IWDG_PRESCALER_256;
hiwdg.Init.Prescaler = IWDG_PRESCALER_16;
hiwdg.Init.Reload = 0xfff;
if (HAL_IWDG_Init(&hiwdg) != HAL_OK)
{

View File

@ -98,12 +98,11 @@ int main(void)
/* USER CODE BEGIN 2 */
HAL_IWDG_Refresh(&hiwdg);
printf("Core initial successfully\n");
demoEnumCtlInit(GPIO_PIN_RESET);
/* USER CODE END 2 */
/* Init scheduler */
osKernelInitialize(); /* Call init function for freertos objects (in freertos.c) */
MX_FREERTOS_Init();
MX_FREERTOS_Init();
/* Start scheduler */
osKernelStart();