Re:Force an interrupt by software
I'm working on a port Simulator, and use the following code to generate interrupts on individual pins on a specific port. This gives complete control to the pin level. Note there are LMI warnings in the docs, about reprogramming the JTAG port pins - so avoid those pins.
Note that the 2 pins params are actually bit packed bytes, 8 bits -> 8 pins.
| Code: |
void GPIOSetPins(UINT port, UINT pinsToTrigger, UINT pinsInUse) {
HWREG(port + GPIO_O_DIR) |= pinsInUse; // outputs ( = 1)
HWREG(port + GPIO_O_AFSEL) &= ~pinsToTrigger; // software control ( = 0)
GPIOWrite(port, pinsInUse, 0); // clear for multi pins per port and part updates
GPIOWrite(port, pinsToTrigger, pinsToTrigger);
HWREG(port + GPIO_O_DIR) &= ~pinsToTrigger; // inputs ( = 0)
}
|
You should call this function just before generating the port interrupt as you do now. So that on entry to the GPIO port ISR, the appropriate pins will be asserted, and you can check those as normal (and clear) : -
| Code: |
if (GPIORead(GPIO_PORTA_BASE, GPIO_PIN_7)) {
...
|
login or register to reply
|