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 */ /* USER CODE BEGIN Prototypes */
void demoEnumCtlInit(GPIO_PinState PinState); void demoEnumCtlInit();
void demoLedInit(); void demoLedInit();
void demoLedBlink(); void demoLedBlink();
/* USER CODE END Prototypes */ /* USER CODE END Prototypes */

View File

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

View File

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

View File

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

View File

@ -98,7 +98,6 @@ int main(void)
/* USER CODE BEGIN 2 */ /* USER CODE BEGIN 2 */
HAL_IWDG_Refresh(&hiwdg); HAL_IWDG_Refresh(&hiwdg);
printf("Core initial successfully\n"); printf("Core initial successfully\n");
demoEnumCtlInit(GPIO_PIN_RESET);
/* USER CODE END 2 */ /* USER CODE END 2 */
/* Init scheduler */ /* Init scheduler */