1. 1.
    Create an event channel configuration struct, which can be filled out to adjust the configuration of a single event channel.
    struct events_config config;
  2. 2.
    Initialize the event channel configuration struct with the module's default values.
    Note: This should always be performed before using the configuration struct to ensure that all values are initialized to known default settings.
  3. 3.
    Adjust the configuration struct to request that the channel is to be attached to the specified event generator, that rising edges of the event signal is to be detected on the channel, and that the synchronous event path is to be used.
    config.generator      = CONF_EVENT_GENERATOR;
    config.edge_detect    = EVENTS_EDGE_DETECT_RISING;
    config.path           = EVENTS_PATH_SYNCHRONOUS;
    config.clock_source   = GCLK_GENERATOR_0;
  4. 4.
    Allocate and configure the channel using the configuration structure.
    events_allocate(resource, &config);
    Note: The existing configuration struct may be re-used, as long as any values that have been altered from the default settings are taken into account by the user application.
  5. 5.
    Attach a user to the channel.
    events_attach_user(resource, CONF_EVENT_USER);