Download Stellaris Peripheral Driver Library User's Guide

Transcript
GPIO
Prototype:
void
GPIOPortIntUnregister(unsigned long ulPort)
Parameters:
ulPort is the base address of the GPIO port.
Description:
This function will unregister the interrupt handler for the specified GPIO port. This function will
also disable the corresponding GPIO port interrupt in the interrupt controller; individual GPIO
interrupts and interrupt sources must be disabled with GPIOPinIntDisable().
See also:
IntRegister() for important information about registering interrupt handlers.
Returns:
None.
12.3
Programming Example
The following example shows how to use the GPIO API to initialize the GPIO, enable interrupts,
read data from pins, and write data to pins.
int iVal;
//
// Register the port-level interrupt handler. This handler is the
// first level interrupt handler for all the pin interrupts.
//
GPIOPortIntRegister(GPIO_PORTA_BASE, PortAIntHandler);
//
// Initialize the GPIO pin configuration.
//
// Set pins 2, 4, and 5 as input, SW controlled.
//
GPIOPinTypeGPIOInput(GPIO_PORTA_BASE,
GPIO_PIN_2 | GPIO_PIN_4 | GPIO_PIN_5);
//
// Set pins 0 and 3 as output, SW controlled.
//
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_3);
//
// Make pins 2 and 4 rising edge triggered interrupts.
//
GPIOIntTypeSet(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_4, GPIO_RISING_EDGE);
//
// Make pin 5 high level triggered interrupts.
//
GPIOIntTypeSet(GPIO_PORTA_BASE, GPIO_PIN_5, GPIO_HIGH_LEVEL);
//
// Read some pins.
//
iVal = GPIOPinRead(GPIO_PORTA_BASE,
174
September 09, 2011