Solution

Solution to the assignment.

ctimer1_match_interrupt.h

// -----------------------------------------------------------------------------
// Shared variables
// -----------------------------------------------------------------------------
extern volatile bool ctimer1_0_timeout_flag;
extern volatile bool ctimer1_1_timeout_flag;

ctimer1_match_interrupt.c

In ctimer1_match_interrupt_init():

CTIMER1->MR[1] = 500-1;
CTIMER1->MCR |= CTIMER_MCR_MR1I(1);    

In CTIMER1_IRQHandler():

// Interrupt generated by MR1?
if((CTIMER1->IR & CTIMER_IR_MR1INT(1)) != 0)
{
    // Clear status flag by writing 1
    CTIMER1->IR |= CTIMER_IR_MR1INT(1);

    // Handle the event
    ctimer1_1_timeout_flag = true;
}   

main.c

In main():

// CTIMER1 flag true?
if(ctimer1_1_timeout_flag == true)
{
    // Set it false
    ctimer1_1_timeout_flag = false;

    // Toggle red LED
    GPIO3->PTOR = (1<<12);
}