led.c的相关代码
- #include "led.h"
- #include "stm32f10x.h"
- #include "stdint.h"
-
-
-
- //LED的初始化
-
- void LED_Init()
- {
-
- GPIO_InitTypeDef led_initstruct; //定义gpio的结构体
-
- //初始化时钟
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
-
- led_initstruct.GPIO_Pin=GPIO_Pin_1 ; //初始化引脚口(需要对应自己板子上的)
- led_initstruct.GPIO_Speed=GPIO_Speed_2MHz;//选择频率
- led_initstruct.GPIO_Mode=GPIO_Mode_Out_PP;//选择推挽输出模式
-
- GPIO_Init(GPIOA,&led_initstruct ); //对结构体进行初始化
-
- }
|