To summarise the changes needed in board.c ...
Add defines for the other two LEDS:
#define LED1_GPIO_PORT_NUM 3
#define LED1_GPIO_BIT_NUM 25
#define LED2_GPIO_PORT_NUM 3
#define LED2_GPIO_BIT_NUM 26
Update Board_LED_Init() to add:
Chip_GPIO_WriteDirBit(LPC_GPIO, LED1_GPIO_PORT_NUM, LED1_GPIO_BIT_NUM, true);
Chip_GPIO_WriteDirBit(LPC_GPIO, LED2_GPIO_PORT_NUM, LED2_GPIO_BIT_NUM, true);
Update Board_LED_Set() to add :
if (LEDNumber == 1) {
Chip_GPIO_WritePortBit(LPC_GPIO, LED1_GPIO_PORT_NUM, LED1_GPIO_BIT_NUM, On);
}
if (LEDNumber == 2) {
Chip_GPIO_WritePortBit(LPC_GPIO, LED2_GPIO_PORT_NUM, LED2_GPIO_BIT_NUM, On);
}
Update Board_LED_Test() to add:
if (LEDNumber == 1) {
state = Chip_GPIO_ReadPortBit(LPC_GPIO, LED1_GPIO_PORT_NUM, LED1_GPIO_BIT_NUM);
}
if (LEDNumber == 2) {
state = Chip_GPIO_ReadPortBit(LPC_GPIO, LED2_GPIO_PORT_NUM, LED2_GPIO_BIT_NUM);
}
Replace code in Board_LED_Toggle :
if (LEDNumber < 3) {
Board_LED_Set(LEDNumber, !Board_LED_Test(LEDNumber));
}
Optimising the above left as an exercise for the reader :smileywink:
Then in your main code, you can call Board_LED_Toggle() with 0,1 or 2 appropriately.
Regards,
LPCXpresso Support