From 7265d43e5f02087d109f7e29d056f99b8165fa13 Mon Sep 17 00:00:00 2001 From: ThinkPad-T460P Date: Tue, 14 Apr 2020 18:48:32 +0800 Subject: [PATCH] update --- Core/Inc/gpio.h | 2 +- Core/Src/freertos.c | 8 +++----- Core/Src/gpio.c | 4 ++-- Core/Src/iwdg.c | 2 +- Core/Src/main.c | 3 +-- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Core/Inc/gpio.h b/Core/Inc/gpio.h index 8bab632..4b739a2 100644 --- a/Core/Inc/gpio.h +++ b/Core/Inc/gpio.h @@ -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 */ diff --git a/Core/Src/freertos.c b/Core/Src/freertos.c index fbc5c3e..c99c2c1 100644 --- a/Core/Src/freertos.c +++ b/Core/Src/freertos.c @@ -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); } diff --git a/Core/Src/gpio.c b/Core/Src/gpio.c index 54833f5..f91e9f5 100644 --- a/Core/Src/gpio.c +++ b/Core/Src/gpio.c @@ -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() { diff --git a/Core/Src/iwdg.c b/Core/Src/iwdg.c index 2415a08..afc9a28 100644 --- a/Core/Src/iwdg.c +++ b/Core/Src/iwdg.c @@ -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) { diff --git a/Core/Src/main.c b/Core/Src/main.c index 9ed8408..6ac9387 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -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();