27 lines
749 B
C
27 lines
749 B
C
#include "../../init/inc/gpio.h"
|
||
|
||
/*
|
||
* LED初始化
|
||
*/
|
||
static void LED_Init(void)
|
||
{
|
||
GPIO_InitTypeDef GPIO_InitStructure; //定义一个GPIO_InitTypeDef类型的结构体
|
||
|
||
RCC_PB2PeriphClockCmd(RCC_PB2Periph_GPIOC, ENABLE); //使能与LED相关的GPIO端口时钟
|
||
|
||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13; //配置GPIO引脚
|
||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //设置GPIO模式为推挽输出
|
||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //设置GPIO口输出速度
|
||
GPIO_Init(GPIOC, &GPIO_InitStructure); //调用库函数,初始化GPIOC
|
||
|
||
GPIO_SetBits(GPIOC,GPIO_Pin_13); //设置引脚输出高电平
|
||
}
|
||
|
||
/*
|
||
* 初始化所有GPIO
|
||
*/
|
||
void all_gpio_Init(void)
|
||
{
|
||
LED_Init();
|
||
}
|