Content originally posted in LPCWare by cappo85 on Tue Jul 07 05:38:31 MST 2015
I would like to report a bug in the file syscon_11n6x.c, function :
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);
}
}
is not correct.
The proposed solution is:
void Chip_SYSCTL_SetPinInterrupt(uint32_t intno, uint8_t port, uint8_t pin)
{
switch(port)
{
case 0:
LPC_SYSCTL->PINTSEL[intno] = (uint32_t) pin;
break;
case 1:
LPC_SYSCTL->PINTSEL[intno] = (uint32_t) (24 + pin);
break;
case 2:
LPC_SYSCTL->PINTSEL[intno] = (uint32_t) (56 + pin);
break;
default:
break;
}
}
Best regards
Riccardo Capponi