This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Using S1 (PA18), I added the code below so that the LED output is inverted every time S1 is input.
---------------------------------------------------------------------------------------------------------------------------------------------
void GROUP1_IRQHandler(void)
{
switch (DL_Interrupt_getPendingGroup(DL_INTERRUPT_GROUP_1)) {
case GPIO_MULTIPLE_GPIOA_INT_IIDX:
switch (DL_GPIO_getPendingInterrupt(GPIO_SWITCHES_PORT)) {
case GPIO_SWITCHES_USER_SWITCH_1_IIDX:
/* If SW is high, turn the LED off */
if (DL_GPIO_readPins(
GPIO_SWITCHES_PORT, GPIO_SWITCHES_USER_SWITCH_1_PIN )) {
DL_GPIO_setPins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN);
}
/* Otherwise, turn the LED on */
else {
DL_GPIO_clearPins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN);
}
case GPIO_GRP_0_PIN_0_IIDX:
if (DL_GPIO_readPins(
GPIO_SWITCHES_PORT, GPIO_GRP_0_PIN_0_PIN )) {
DL_GPIO_togglePins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN);
}
break;
}
}
}
---------------------------------------------------------------------------------------------------------------------------------------------
It worked, but the following warning occurred.
「warning: 30 enumeration values not handled in switch: 'DL_GPIO_IIDX_DIO0', 'DL_GPIO_IIDX_DIO1', 'DL_GPIO_IIDX_DIO2'... [-Wswitch]」
What does this mean and how can I deal with it?
As near as I can tell DL_GPIO_getPendingInterrupt(GPIO_SWITCHES_PORT) returns a value from the DL_GPIO_IIDX enum
where the enum contains:
Which does not match the "GPIO_SWITCHES_USER_SWITCH_1_IIDX" you have in the case statement. Since enums are mapped to integers, it might work, but you are getting the warning that your enum is not part of the set.
I haven't dug deep, but I think the error is just saying that you don't have a default case in your switch statement, and therefore, there are possible cases that are not covered. Just try adding:
case default: break;
to the end of your switch statement and see if the warning goes away.
Thanks,
JD
To make it easier to see the nested switch/cases I am reposting the cod
void GROUP1_IRQHandler(void) { switch (DL_Interrupt_getPendingGroup(DL_INTERRUPT_GROUP_1)) { case GPIO_MULTIPLE_GPIOA_INT_IIDX: switch (DL_GPIO_getPendingInterrupt(GPIO_SWITCHES_PORT)) { case GPIO_SWITCHES_USER_SWITCH_1_IIDX: /* If SW is high, turn the LED off */ if (DL_GPIO_readPins( GPIO_SWITCHES_PORT, GPIO_SWITCHES_USER_SWITCH_1_PIN )) { DL_GPIO_setPins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN); } /* Otherwise, turn the LED on */ else { DL_GPIO_clearPins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN); } case GPIO_GRP_0_PIN_0_IIDX: if (DL_GPIO_readPins( GPIO_SWITCHES_PORT, GPIO_GRP_0_PIN_0_PIN )) { DL_GPIO_togglePins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN); } break; } } }