应用说明
这个应用程序的目的是展示通过调用 Driverlib 库中的 API 实现对 GPIO 控制, LED 灯
连接在 GPIO 管脚表示 GPIO 的输出,通过周期性的给 GPIO 引脚高低电平来实现 LED 灯的亮
灭。 在原理图中可以看出 LED 低电平点亮,即引脚输出低电平, LED 点亮,引脚输出高电
平, LED 熄灭。
void LEDBlinkyRoutine()
{
//
// Toggle the lines initially to turn off the LEDs.
// The values driven are as required by the LEDs on the LP.
//
GPIO_IF_LedOff(MCU_ALL_LED_IND);
while(1)
{
//
// Alternately toggle hi-low each of the GPIOs
// to switch the corresponding LED on/off.
//
MAP_UtilsDelay(8000000);
GPIO_IF_LedOn(MCU_RED_LED_GPIO);
MAP_UtilsDelay(8000000);
GPIO_IF_LedOff(MCU_RED_LED_GPIO);
MAP_UtilsDelay(8000000);
GPIO_IF_LedOn(MCU_BLUE_LED_GPIO);
MAP_UtilsDelay(8000000);
GPIO_IF_LedOff(MCU_BLUE_LED_GPIO);
MAP_UtilsDelay(8000000);
GPIO_IF_LedOn(MCU_GREEN_LED_GPIO);
MAP_UtilsDelay(8000000);
GPIO_IF_LedOff(MCU_GREEN_LED_GPIO);
}
static void
BoardInit(void)
{
/* In case of TI-RTOS vector table is initialize by OS itself */
#ifndef USE_TIRTOS
//
// Set vector table base
//
#if defined(ccs)
MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);
#endif
#if defined(ewarm)
MAP_IntVTableBaseSet((unsigned long)&__vector_table);
#endif
#endif
int
main()
{
//
// Initialize Board configurations
//
BoardInit();
//
// Power on the corresponding GPIO port B for 9,10,11.
// Set up the GPIO lines to mode 0 (GPIO)
//
PinMuxConfig();
GPIO_IF_LedConfigure(LED1|LED2|LED3);
GPIO_IF_LedOff(MCU_ALL_LED_IND);
//
// Start the LEDBlinkyRoutine
//
LEDBlinkyRoutine();
return 0;
}
感谢分享