Led C
Led C
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
"ES_Configure.h"
"ES_Framework.h"
"ES_DeferRecall.h"
"inc/hw_memmap.h"
"inc/hw_types.h"
"inc/hw_gpio.h"
"inc/hw_sysctl.h"
"driverlib/sysctl.h"
"driverlib/pin_map.h"
"driverlib/gpio.h"
"inc/hw_nvic.h"
"inc/hw_timer.h"
#include "LED.h"
void InitLED(void)
{
volatile uint32_t Dummy;
// enable the clock to Port F
HWREG(SYSCTL_RCGCGPIO) |= SYSCTL_RCGCGPIO_R3;
// kill a few cycles to let the peripheral clock get going
Dummy = HWREG(SYSCTL_RCGCGPIO);
// Enable pins for digital I/O
HWREG(GPIO_PORTD_BASE+GPIO_O_DEN) |= (GPIO_PIN_2);
// make pins 2 on Port D into outputs
HWREG(GPIO_PORTD_BASE+GPIO_O_DIR) |= (GPIO_PIN_2);
printf("InitLED Complete\r\n");
}
void TurnOnLED(void)
{
//put PD2 high
HWREG(GPIO_PORTD_BASE+(GPIO_O_DATA + (0xff<<2))) |= GPIO_PIN_2;
}
void TurnOffLED(void)
{
//make PD2 low
HWREG(GPIO_PORTD_BASE+(GPIO_O_DATA + (0xff<<2))) &= ~GPIO_PIN_2;
}