ZD-BMS-CH/ZDBMS/BMS_CC/init/src/gpio.c

27 lines
749 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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();
}