Code Example

Copy-paste the following setup code to your application:
static void init_events(void)
{
    struct events_conf    events_config;
    struct events_ch_conf ch_config;

    /* Initialize event module */
    events_get_config_defaults(&events_config);
    events_init(&events_config);
    events_enable();

    /*
     * Configure an event channel
     * - AST periodic event 0 --- Generator
     * - PDCA channel 0       --- User
     */
    events_ch_get_config_defaults(&ch_config);
    ch_config.channel_id = PEVC_ID_USER_PDCA_0;
    ch_config.generator_id = PEVC_ID_GEN_AST_2;
    ch_config.shaper_enable = true;
    ch_config.igf_edge = EVENT_IGF_EDGE_NONE;
    events_ch_configure(&ch_config);

    /* Enable the channel */
    events_ch_enable(PEVC_ID_USER_PDCA_0);
}
Add this to the main loop or a setup function:
/* Initialize AST as event generator. */
init_ast();

/* Initialise events for this example. */
init_events();

/* Initialize the PDCA as event user */
init_pdca();