요약하면..
GPIOPortIntRegister(GPIO_PORTA_BASE, PortAIntHandler);
GPIOPinTypeGPIOInput(GPIO_PORTA_BASE,GPIO_PIN_2);
GPIOIntTypeSet(GPIO_PORTA_BASE, GPIO_PIN_2, GPIO_RISING_EDGE);
GPIOPinIntEnable(GPIO_PORTA_BASE, GPIO_PIN_2);
이렇게 셋트로 해주면 P2는 rising_edge에서 PortAIntHandler 핸들러를 호출하게 되는건가?
그리고 핸들러에서는
GPIOPinIntStatus 를 사용해서 핀 별로 처리해주면 될 듯?
9.2.2.11 GPIOPinIntStatus Gets interrupt status for the specified GPIO port. Prototype: long GPIOPinIntStatus(unsigned long ulPort, tBoolean bMasked) Parameters: ulPort is the base address of the GPIO port. bMasked specifies whether masked or raw interrupt status is returned. Description: If bMasked is set as true, then the masked interrupt status is returned; otherwise, the raw interrupt status will be returned. Returns: Returns a bit-packed byte, where each bit that is set identifies an active masked or raw interrupt, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. Bits 31:8 should be ignored. |
9.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, (GPIO_PIN_0 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5)); // // Write some pins. Even though pins 2, 4, and 5 are specified, those // pins are unaffected by this write since they are configured as inputs. // At the end of this write, pin 0 will be a 0, and pin 3 will be a 1. // GPIOPinWrite(GPIO_PORTA_BASE, (GPIO_PIN_0 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5), 0xF4); // // Enable the pin interrupts. // GPIOPinIntEnable(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_4 | GPIO_PIN_5); |
9.2.2.4 GPIOIntTypeSet Sets the interrupt type for the specified pin(s). Prototype: void GPIOIntTypeSet(unsigned long ulPort, unsigned char ucPins, unsigned long ulIntType) Parameters: ulPort is the base address of the GPIO port. ucPins is the bit-packed representation of the pin(s). ulIntType specifies the type of interrupt trigger mechanism. Description: This function sets up the various interrupt trigger mechanisms for the specified pin(s) on the selected GPIO port. The parameter ulIntType is an enumerated data type that can be one of the following values: GPIO_FALLING_EDGE GPIO_RISING_EDGE GPIO_BOTH_EDGES GPIO_LOW_LEVEL GPIO_HIGH_LEVEL where the different values describe the interrupt detection mechanism (edge or level) and the particular triggering event (falling, rising, or both edges for edge detect, low or high for level detect). The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. Note: In order to avoid any spurious interrupts, the user must ensure that the GPIO inputs remain stable for the duration of this function. Returns: None. |
[링크 : https://e2e.ti.com/support/microcontrollers/stellaris_arm/f/471/t/48738]
[링크 : http://elk.informatik.fh-augsburg.de/cdrom-stellaris/LM3S811/rasware-read-only/RASLib/src/encoder.c]
[링크 : http://elk.informatik.fh-augsburg.de/cdrom-stellaris/LM3S811/rasware-read-only/RASLib/src/]
'embeded > Cortex-M3 Ti' 카테고리의 다른 글
lm3s stellarisware SPI (0) | 2015.10.05 |
---|---|
cortex-m3 ROM direct call (0) | 2015.09.25 |
bitband / cortex-m3 (0) | 2013.08.16 |
LM3S1968과 H-JTAG(wiggler) (0) | 2013.06.28 |
cortex-m3 JTAG / X-LinkEx 1.1 (0) | 2013.06.11 |