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;
events_get_config_defaults(&events_config);
events_init(&events_config);
events_enable();
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);
events_ch_enable(PEVC_ID_USER_PDCA_0);
}
Add this to the main loop or a setup function:
init_ast();
init_events();
init_pdca();