error: 'RCC_ABH1Periph_GPIOD' undeclared (first use in this function) Build Error
error: 'RCC_ABH1Periph_GPIOD' undeclared (first use in this function) Build Error
构建时出现错误:error: 'RCC_ABH1Periph_GPIOD' undeclared (first use in this function),有人知道为什么吗?
这适用于 STM32F4 探索板。
报错的行是:
RCC_AHB1PeriphClockLPModeCmd(RCC_ABH1Periph_GPIOD, 启用);
我已经包含了所有需要的文件。
#include "defines.h"
#include "stm32f4xx.h"
#include "stm32f4xx_rcc.h"
#include "stm32f4xx_gpio.h"
#include "stm32f4xx_adc.h"
//Configure sysTick
static __IO uint32_t timingDelay;
void Delay(uint32_t nTime)
{
timingDelay = nTime;
while (timingDelay != 0);
}
void sysTick_Handler(void)
{
if (timingDelay != 0x00)
{
timingDelay--;
}
}
//Configure GPIO
GPIO_InitTypeDef GPIO_initStruct;
void init_led(void)
{
RCC_AHB1PeriphClockLPModeCmd(RCC_ABH1Periph_GPIOD, ENABLE);
GPIO_initStruct.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
GPIO_initStruct.GPIO_Mode = GPIO_MODE_OUT;
GPIO_initStruct.GPIO_OType = GPIO_OType_PP;
GPIO_initStruct.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_initStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_initStruct(GPIOD, &~GPIO_initStruct);
}
int main(void)
{
if (SysTick_Config((SystemCoreClock/1000)));
while (1);
init_led();
while(1)
{
GPIO_ToggleBits(GPIOD, GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15);
Delay(1000);
}
}
这个RCC_ABH1Periph_GPIOD应该是RCC_AHB1Periph_GPIOD。
写问题前更仔细地检查你的代码!
构建时出现错误:error: 'RCC_ABH1Periph_GPIOD' undeclared (first use in this function),有人知道为什么吗?
这适用于 STM32F4 探索板。
报错的行是:
RCC_AHB1PeriphClockLPModeCmd(RCC_ABH1Periph_GPIOD, 启用);
我已经包含了所有需要的文件。
#include "defines.h"
#include "stm32f4xx.h"
#include "stm32f4xx_rcc.h"
#include "stm32f4xx_gpio.h"
#include "stm32f4xx_adc.h"
//Configure sysTick
static __IO uint32_t timingDelay;
void Delay(uint32_t nTime)
{
timingDelay = nTime;
while (timingDelay != 0);
}
void sysTick_Handler(void)
{
if (timingDelay != 0x00)
{
timingDelay--;
}
}
//Configure GPIO
GPIO_InitTypeDef GPIO_initStruct;
void init_led(void)
{
RCC_AHB1PeriphClockLPModeCmd(RCC_ABH1Periph_GPIOD, ENABLE);
GPIO_initStruct.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
GPIO_initStruct.GPIO_Mode = GPIO_MODE_OUT;
GPIO_initStruct.GPIO_OType = GPIO_OType_PP;
GPIO_initStruct.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_initStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_initStruct(GPIOD, &~GPIO_initStruct);
}
int main(void)
{
if (SysTick_Config((SystemCoreClock/1000)));
while (1);
init_led();
while(1)
{
GPIO_ToggleBits(GPIOD, GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15);
Delay(1000);
}
}
这个RCC_ABH1Periph_GPIOD应该是RCC_AHB1Periph_GPIOD。 写问题前更仔细地检查你的代码!