为什么我用HAL库就能点亮,用库函数的时候就不可以呢?
这是LED.c的代码
#include "stm32f10x.h" // Device header
#include "LED.h"
/*初始化LED*/
void LEDConfig(void){
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);//开启CPIO外设时钟
GPIO_InitTypeDef GPIO_Initstruct;//定义句柄结构体
GPIO_Initstruct.GPIO_Pin=GPIO_Pin_13;//选择引脚
GPIO_Initstruct.GPIO_Speed=GPIO_Speed_50MHz;//配置速度为50MHz
GPIO_Initstruct.GPIO_Mode=GPIO_Mode_Out_PP;//配置引脚为推挽输出
GPIO_Init(GPIOC,&GPIO_Initstruct);//初始化GPIO
GPIO_SetBits(GPIOC,GPIO_Pin_13);//关闭LED灯
}
/*打开LED*/
void LED_ON(void){
GPIO_ResetBits(GPIOC,GPIO_Pin_13);//开启LED
}
/*关闭LED*/
void LED_OFF(void){
GPIO_SetBits(GPIOC,GPIO_Pin_13);
}
这是main.h的
#include "stm32f10x.h" // Device header
#include "LED.h"
#include "ADC.h"
#include "USART.h"
void Delay(uint32_t Count);//简单延时函数
uint16_t ADCValue = 0;
uint32_t ADCValue2[4];
int main(void){
//SystemInit();
LEDConfig();
ADCConfig();
USARTConfig();
LED_ON();
while(1){
}
}
void Delay(uint32_t Count){
for(;Count!=0;Count--);
}