led.c
#include "led.h"
void LED_Config(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
GPIO_InitStruct.GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_InitStruct.GPIO_Pin=GPIO_Pin_0;
GPIO_InitStruct.GPIO_Speed=GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStruct);
}
led.h
#ifndef __LED_H
#define __LED_H
#include "stm32f10x.h"
void LED_Config(void);
#endif
main.c
#include "stm32f10x.h"
#include "led.h"
int main(void)
{
LED_Config();
while(1)
{
}
}
标签:LED,点亮,void,led,STM32,InitStruct,GPIO,include
From: https://www.cnblogs.com/Sound-Sleep/p/16977438.html