GPIO实例应用
#include "stm32f10x.h"
#ifndef _ _LED_H
#define _ _LED_H
void LED_Init(void);
#endif
#include "led.h"
void LED_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB,&GPIO_InitStructure);
}
void Delay( _IO u32 nCount)
{
for(;nCount !=0;nCount--);
}
int main(void)
{
LED_Init();
while (1)
{
GPIO_SetBits(GPIO_Pin_5);
delay(720000);
GPIO_ReaetBits(GPIO_Pin_5);
Delay(720000);
}
}