AnsweredAssumed Answered

Interrupt for Standard Timer Capture on LPC55S69

Question asked by Safiullah Hussaini on Jun 18, 2019
Latest reply on Jun 24, 2019 by Safiullah Hussaini

Hi,

 

I am trying to set up the timer for two interrupts, one for match and one for capture in an input pin.

 

However I am struggling to understand the multiple interrupt system in the SDK for the LPC55S69. The current code is as follows:

 

/******************************************************************************
 * Prototypes
 *****************************************************************************/
void ctimer_capture_callback(uint32_t arg_flags);
void ctimer_match_callback(uint32_t arg_flags);

/******************************************************************************
 * Global Variables
 *****************************************************************************/
ctimer_config_t g_ctimer_config;
ctimer_callback_t g_ctimer_callback[] = {NULL, ctimer_match_callback, NULL, NULL, NULL, ctimer_capture_callback, NULL, NULL};

/******************************************************************************
 * Function Definition
 *****************************************************************************/
void ctimer_capture_callback(uint32_t arg_flags)
{
}
void ctimer_capture_callback(uint32_t arg_flags)
{
}
//Within main function for initialization (before the eternal while loop)
    CTIMER_GetDefaultConfig(&g_ctimer_config);
    CTIMER_Init(CTIMER0, &g_ctimer_config);
    CTIMER_RegisterCallBack(CTIMER0, g_ctimer_callback, kCTIMER_MultipleCallback);
    CTIMER_SetupCapture(CTIMER0, kCTIMER_Capture_1, kCTIMER_Capture_RiseEdge, true);
//Code for match setup here
    CTIMER_StartTimer(CTIMER0);
----------------------------------------------------
The confusion is with this line
ctimer_callback_t g_ctimer_callback[] = {NULL, ctimer_match_callback, NULL, NULL, NULL, ctimer_capture_callback, NULL, NULL};
Where does each callback function go for each match and capture? At what index locations? If I intend to capture or match with multiple callbacks where would I place each?
Regards,
Safiullah Hussaini

Outcomes