LPC1768 External Interrupt both edges (LPCOpen)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC1768 External Interrupt both edges (LPCOpen)

936 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rosfudum on Fri Nov 06 07:23:45 MST 2015
Dear all,
I'd like to set external interrupt on one pin of LPC1768 in both direction, rising and falling. but I've got just two functions:
Chip_GPIOINT_SetIntFalling
or
Chip_GPIOINT_SetIntRising

In case of LPC1115, there is a function called Chip_GPIO_SetupPinInt
where you can pass GPIO_INT_BOTH_EDGES as parameter so, both edges are covered by interrupt.

In case I use first Falling and then Rising, Interrupt request will be called in both edges (so functions are in OR) or last setting "win" and just rising edges occurs an interrupt?

In case of second condition, is there any (softwre) workaround to catch both edges?

Thanks a lot!
Labels (1)
0 Kudos
2 Replies

580 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by miccio on Fri Nov 06 10:29:20 MST 2015
LPCOpen code claims:

STATIC INLINE void Chip_GPIOINT_SetIntFalling(LPC_GPIOINT_T *pGPIOINT, LPC_GPIOINT_PORT_T port, uint32_t pins)
{
if (port == GPIOINT_PORT0) {
pGPIOINT->IO0.ENF = pins;
} else {
pGPIOINT->IO2.ENF = pins;
}
}

STATIC INLINE void Chip_GPIOINT_SetIntRising(LPC_GPIOINT_T *pGPIOINT, LPC_GPIOINT_PORT_T port, uint32_t pins)
{
if (port == GPIOINT_PORT0) {
pGPIOINT->IO0.ENR = pins;
} else {
pGPIOINT->IO2.ENR = pins;
}
}



I'd also take a wild guess and assume it's possible to set both registers. Maybe you could add this to your inc/gpioint_17xx_40.h file:

STATIC INLINE void Chip_GPIOINT_SetIntAnyEdge(LPC_GPIOINT_T *pGPIOINT, LPC_GPIOINT_PORT_T port, uint32_t pins)
{
if (port == GPIOINT_PORT0) {
pGPIOINT->IO0.ENR = pins;
pGPIOINT->IO0.ENF = pins;
} else {
pGPIOINT->IO2.ENR = pins;
pGPIOINT->IO2.ENF = pins;
}
}

0 Kudos

580 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Fri Nov 06 08:52:21 MST 2015

Quote: Rosfudum
Chip_GPIOINT_SetIntFalling
or
Chip_GPIOINT_SetIntRising



Come on, what do you think is happening if you set rising and falling   :quest:
0 Kudos