29 lines
735 B
C
29 lines
735 B
C
//头文件
|
|
#include "stm32f10x.h"
|
|
#include "sys.h"
|
|
|
|
#define LED_GPIO_PORT GPIOA
|
|
#define LED_GPIO_PIN GPIO_Pin_1
|
|
void LED_Init(void) {
|
|
GPIO_InitTypeDef GPIO_InitStructure;
|
|
|
|
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
|
|
|
|
GPIO_InitStructure.GPIO_Pin = LED_GPIO_PIN;
|
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; // 推挽输出
|
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; // 50MHz速度
|
|
GPIO_Init(LED_GPIO_PORT, &GPIO_InitStructure);
|
|
}
|
|
int main(void)
|
|
{
|
|
SystemClock_Config();
|
|
LED_Init();
|
|
while (1)
|
|
{
|
|
GPIO_WriteBit(LED_GPIO_PORT, LED_GPIO_PIN,Bit_RESET);
|
|
Delay_ms(500);
|
|
GPIO_WriteBit(LED_GPIO_PORT, LED_GPIO_PIN,Bit_SET);
|
|
Delay_ms(500);
|
|
}
|
|
}
|