led.c 1.23 KB
#include "led.h" 
void LED_Init(void)
{    	 
  GPIO_InitTypeDef  GPIO_InitStructure;
  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);//使能GPIOF时钟
  //GPIOF9,F10初始化设置
  GPIO_InitStructure.GPIO_Pin = ARM_LED1_Pin;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;//普通输出模式
  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;//推挽输出
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;//100MHz
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;//上拉
  GPIO_Init(ARM_LED1_Port, &GPIO_InitStructure);//初始化

	GPIO_ResetBits(ARM_LED1_Port,ARM_LED1_Pin);//GPIOF9,F10设置高,灯灭

  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOG, ENABLE);//使能GPIOF时钟

  //GPIOF9,F10初始化设置
  GPIO_InitStructure.GPIO_Pin = ARM_LED2_Pin|ARM_LED3_Pin|ARM_LED4_Pin;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;//普通输出模式
  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;//推挽输出
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;//100MHz
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;//上拉
  GPIO_Init(ARM_LED2_Port, &GPIO_InitStructure);//初始化

	GPIO_ResetBits(ARM_LED2_Port,ARM_LED2_Pin);//GPIOF9,F10设置高,灯灭
	GPIO_ResetBits(ARM_LED3_Port,ARM_LED3_Pin);//GPIOF9,F10设置高,灯灭
	GPIO_ResetBits(ARM_LED4_Port,ARM_LED4_Pin);//GPIOF9,F10设置高,灯灭	

}