【发布时间】:2018-02-14 04:07:10
【问题描述】:
我正在尝试让我的 stm32f4 发现上的 LED 闪烁。不知何故,它停留在延迟功能上。我已将 SysTick 中断优先级更改为 0,并添加了 IncTick()、GetTick() 函数。我错过了什么?
#include "stm32f4xx.h" // Device header
#include "stm32f4xx_hal.h" // Keil::Device:STM32Cube HAL:Common
int main(){
HAL_Init();
__HAL_RCC_GPIOD_CLK_ENABLE();
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Pin = GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15, GPIO_PIN_SET);
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
HAL_IncTick();
HAL_GetTick();
HAL_Delay(100);
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15, GPIO_PIN_RESET);
}
【问题讨论】:
标签: arm keil stm32f4discovery hal