Configure the Event System
Configure the EVSYS module to wire channel 0 event to channel 1.
- Create an event resource instance.
structevents_resource capture_event_resource;Note: This should never go out of scope as long as the resource is in use. In most cases, this should be global. - Create an event resource configuration struct.
structevents_config config; - Initialize the event resource configuration struct with default values.
events_get_config_defaults(&config);Note: This should always be performed before using the configuration struct to ensure that all values are initialized to known default settings. - Adjust the event resource configuration to desired values.
config.generator = CONF_TCC_EVENT_GENERATOR;config.edge_detect = EVENTS_EDGE_DETECT_RISING;config.path = EVENTS_PATH_SYNCHRONOUS;config.clock_source = GCLK_GENERATOR_0; - Allocate and configure the resource using the configuration structure.
events_allocate(&capture_event_resource, &config); - Attach a user to the resource.
events_attach_user(&capture_event_resource, CONF_TCC_EVENT_USER);
