4.2.1 Event System Configurator
The event system enables direct peripheral-to-peripheral communication and signaling. The event system consists of generators, channels, and users. A change in the peripheral’s state is referred to as an event.
How to use the Event System Configurator
- Create a new project using the ATtiny817.
-
Click on Add software component to add the event system driver.
A tab named EVENTS appears on the left side of the screen.
-
Click on the EVENTS tab.
The GENERATORS and the USERS from the system drivers will appear by default, such as Port and PORTMUX.
Overflow Timer Event Starts an ADC Conversion
-
Click on Add software component to add the Timer driver.
The TCA0 is added as a generator and a user. The overflow event is listed as a generator.
-
Click on Add software component to add the ADC driver.
The ADC is added as a user.
-
Start by dragging the TCA event generator (overflow) onto an Asynchronous
Event Channel 0, then try dragging this event channel onto the ADC. This
does not work because we have not yet enabled STARTEI (START Event Input
Enable) for the ADC. Click on the ADC0 configuration wheel, then check
"STARTEI" and close. You will now see that “Trigger Conversion on Event” is
present in the ADC0 as a specific event user. Now you can drag the event
channel onto this event (note: ADC0 should be grayed out when no specific
event users have been enabled).
-
Next, connect the TCA event with the ADC: Click and drag the
Timer/Counter A0 overflow to the
Synchronous Event Channel 0 channel.
During drag and drop, only supported channels are highlighted.A connection is made between TCA and the event channel.
-
Click and drag the Synchronous Event Channel 0 to
the ADC0.
A connection is made between the event channel and the Trigger Conversion On Event.
This will result in the following code:
EVSYS.ASYNCUSER1 = EVSYS_ASYNCUSER1_SYNCCH0_gc /* Synchronous Event Channel 0 */ ; EVSYS.SYNCCH0 = EVSYS_SYNCCH0_TCA0_OVF_LUNF_gc /* Timer/Counter A0 overflow */;
The event input is enabled in adc.c.
ADC0.EVCTRL = 1 << ADC_STARTEI_bp /* Start Event Input Enable: enabled */;