Configure the Event System

Configure the EVSYS module to wire channel 0 event to channel 1.
  1. Create an event resource instance.
    struct events_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.
  2. Create an event resource configuration struct.
    struct events_config config;
    
  3. 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.
  4. 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;
    
  5. Allocate and configure the resource using the configuration structure.
    events_allocate(&capture_event_resource, &config);
    
  6. Attach a user to the resource.
    events_attach_user(&capture_event_resource, CONF_TCC_EVENT_USER);