void Chip_SYSCTL_SetPinInterrupt(uint32_t intno, uint8_t port, uint8_t pin) { if (port == 0) { /* Pins P0.1 to P0.23 only */ LPC_SYSCTL->PINTSEL[intno] = (uint32_t) pin; } else { /* P1.1 to P1.31 and P2.0 to P2.7 */ LPC_SYSCTL->PINTSEL[intno] = (uint32_t) ((port - 1) * 32 + pin); } } |
void Chip_SYSCTL_SetPinInterrupt(uint32_t intno, uint8_t port, uint8_t pin) { if (port == 0) { /* Pins P0.1 to P0.23 only */ LPC_SYSCTL->PINTSEL[intno] = (uint32_t) pin; } else { /* P1.1 to P1.31 and P2.0 to P2.7 */ LPC_SYSCTL->PINTSEL[intno] = (uint32_t) ((port - 1) * 32 + pin + 24); } } |
/* PIO0_0 [Offset: 0]; PIO1_0 [Offset: 24(0x18)]; PIO2_0 [Offset: 56(0x38)] */ #define PINTSEL_OFFSET "\0\x18\x38" STATIC INLINE void Chip_SYSCTL_SetPinInterrupt(uint32_t intno, uint8_t port, uint8_t pin) { LPC_SYSCTL->PINTSEL[intno] = (uint32_t) PINTSEL_OFFSET[port] + pin; } |