Hi, I'm using MRT on LPC832 (SDK: 2.16.000), and if I call the following, the interrupt for channel 1 does actually happen, and the flags for RUN and INT are set. To ignore channel 1, I have to test for MRT_GetEnabledInterrupts() in the interrupt handler. Which is Ok, because it works, but it seems counter-intuitive that if I say "disable interrupts for channel 1," the interrupt is still actually enabled. Or am I doing something wrong?
Thanks!
void MRT0_DriverIRQHandler(void)
{
if ( MRT_GetStatusFlags( MRT0, kMRT_Channel_0 ) == (MRT_CHANNEL_STAT_INTFLAG_MASK | MRT_CHANNEL_STAT_RUN_MASK) ) {
MRT_ClearStatusFlags( MRT0, kMRT_Channel_0, kMRT_TimerInterruptFlag );
g_doPWM = 0;
g_LED0 = !g_LED0;
GPIO_PinWrite( g_pins[0].gpio.base, g_pins[0].gpio.port, g_pins[0].gpio.pin, g_LED0 );
}
if ( MRT_GetEnabledInterrupts( MRT0, kMRT_Channel_1 ) ) {
if ( MRT_GetStatusFlags( MRT0, kMRT_Channel_1 ) == (MRT_CHANNEL_STAT_INTFLAG_MASK | MRT_CHANNEL_STAT_RUN_MASK) ) {
MRT_ClearStatusFlags( MRT0, kMRT_Channel_1, kMRT_TimerInterruptFlag );
g_doPWM = 0;
g_LED1 = !g_LED1;
GPIO_PinWrite( g_pins[3].gpio.base, g_pins[3].gpio.port, g_pins[3].gpio.pin, g_LED1 );
}
}
SDK_ISR_EXIT_BARRIER;
}
/*
* @brief Application entry point.
*/
int main(void) {
/* Init board hardware. */
BOARD_InitBootPins();
BOARD_InitBootClocks();
BOARD_InitBootPeripherals();
#ifndef BOARD_INIT_DEBUG_CONSOLE_PERIPHERAL
/* Init FSL debug console. */
BOARD_InitDebugConsole();
#endif
mrt_config_t defaultMRTConfig;
MRT_GetDefaultConfig( &defaultMRTConfig );
MRT_Init( MRT0, &defaultMRTConfig );
MRT_SetupChannelMode( MRT0, kMRT_Channel_0, kMRT_RepeatMode );
MRT_SetupChannelMode( MRT0, kMRT_Channel_1, kMRT_RepeatMode );
MRT_UpdateTimerPeriod( MRT0, kMRT_Channel_0, MRTINTERVAL, 1 );
MRT_UpdateTimerPeriod( MRT0, kMRT_Channel_1, SYSCLOCK, 1 );
MRT_EnableInterrupts( MRT0, kMRT_Channel_0, kMRT_TimerInterruptEnable );
MRT_DisableInterrupts( MRT0, kMRT_Channel_1, kMRT_TimerInterruptEnable );
EnableIRQ( MRT0_IRQn ); /* Normally, this would be called in peripherals.c */