9.1.3.2 Code Example
Copy-paste the following setup code to your application:
Add this to the main loop or a setup function:staticvoidinit_events(void){structevents_conf events_config;structevents_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);}
/* Initialize AST as event generator. */init_ast();/* Initialise events for this example. */init_events();/* Initialize the PDCA as event user */init_pdca();
