Files
supowang edb2879617 first commit for opensource
first commit for opensource
2019-09-16 13:19:50 +08:00

45 lines
1.3 KiB
C
Raw Permalink 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 files
******************************************************************************/
#include "led.h"
void led_init(void)
{
stc_gpio_config_t pstcGpioCfg;
///< 打开GPIO外设时钟门控
Sysctrl_SetPeripheralGate(SysctrlPeripheralGpio, TRUE);
///< 端口方向配置->输出
pstcGpioCfg.enDir = GpioDirOut;
///< 端口驱动能力配置->高驱动能力
pstcGpioCfg.enDrv = GpioDrvH;
///< 端口上下拉配置->无上下拉
pstcGpioCfg.enPuPd = GpioNoPuPd;
///< 端口开漏输出配置->开漏输出关闭
pstcGpioCfg.enOD = GpioOdDisable;
///< 端口输入/输出值寄存器总线控制模式配置->AHB
pstcGpioCfg.enCtrlMode = GpioAHB;
///< GPIO IO PD05初始化PD05在STK上外接LED
Gpio_Init(GpioPortD, GpioPin5, &pstcGpioCfg);
}
void led_on(void)
{
///< 端口PD05设置为高电平LED点亮
Gpio_SetIO(GpioPortD, GpioPin5);
}
void led_off(void)
{
///< 端口PD05设置为低电平LED关闭
Gpio_ClrIO(GpioPortD, GpioPin5);
}
/******************************************************************************
* EOF (not truncated)
******************************************************************************/