#include "McuBspSys.h" #include "McuBspEeprom.h" #include "driverlib/sysctl.h" #include "driverlib/gpio.h" #include "driverlib/interrupt.h" #include "inc/hw_memmap.h" #include "inc/hw_ints.h" static void McuBspIdleGpioInit(void); static void McuBspLedInit(void); void McuBspSysInit(void) { /* 不用的GPIO初始化 */ McuBspIdleGpioInit(); /* LED灯初始化 */ McuBspLedInit(); /* 使能全局中断 */ IntMasterEnable(); /* 初始化EEPROM */ McuBspEepromInit(); } /* 心跳灯1开关 */ void McuBspLed1OnOff(uint8_t flag) { if (flag == 0) { /* 关闭LED灯1 */ GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0, GPIO_PIN_0); } else { /* 打开LED灯1 */ GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0, ~GPIO_PIN_0); } } /* 心跳等2开关 */ void McuBspLed2OnOff(uint8_t flag) { if (flag == 0) { /* 关闭LED灯2 */ GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_1, GPIO_PIN_1); } else { /* 打开LED灯2 */ GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_1, ~GPIO_PIN_1); } } static void McuBspIdleGpioInit(void) { } static void McuBspLedInit(void) { SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); GPIODirModeSet(GPIO_PORTD_BASE, GPIO_PIN_0, GPIO_DIR_MODE_OUT); GPIOPadConfigSet(GPIO_PORTD_BASE, GPIO_PIN_0, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); GPIODirModeSet(GPIO_PORTD_BASE, GPIO_PIN_1, GPIO_DIR_MODE_OUT); GPIOPadConfigSet(GPIO_PORTD_BASE, GPIO_PIN_1, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD); }