User`s manual
RX62N Group, RX621 Group 5. Usage Examples
/* Poll the IRQ1 flag */
R_INTC_GetExtInterruptStatus(
PDL_INTC_IRQ1,
&irq_status
);
if ((irq_status & 0x01) == 0)
{
/* Disable IRQ1 */
R_INTC_ControlExtInterrupt(
PDL_INTC_IRQ1,
PDL_INTC_DISABLE
);
}
/* Has IRQ2 triggered? */
if (irq2_low == true)
{
/* Re-enable the interrupt if the signal has returned to the high level */
R_IO_PORT_Compare(
PDL_IO_PORT_3_2,
1,
ReEnableIRQ2
);
}
}
}
void IRQ0Handler(void)
{
/* Process the IRQ0 event here (the flag is cleared automatically */
switch_sw1_pressed = true;
}
void IRQ2Handler(void)
{
/* Disable the level-triggered interrupt */
R_INTC_ControlExtInterrupt(
PDL_INTC_IRQ2,
PDL_INTC_DISABLE
);
irq2_low = true;
}
static void ReEnableIRQ2(void)
{
/* Re-enable the interrupt (and try to clear it) */
R_INTC_ControlExtInterrupt(
PDL_INTC_IRQ2,
PDL_INTC_ENABLE | PDL_INTC_CLEAR_IR_FLAG
);
}
Figure 5-1: Example of External Interrupt
R20UT0084EE0112 Rev.1.12 Page 5-2
July. 16, 2014