Event System

Returning to the temperature monitoring application introduced in Sleep Modes, the CPU will be woken up each time the ADC performs a measurement. As the CPU is put directly back to sleep if the ADC measurement is below the predefined threshold, the solution above will wake up the CPU without reason. As a result the CPU spends an unnecessary amount of time in Active mode and consumes more power than necessary. By using the event system the CPU's time in Active mode can be reduced even further.

Many of the peripherals on devices in the SAM D and SAM L series can be configured to generate events and the Event System can be used to route these events to a different peripheral. How to act upon an incoming event must be configured in the receiving peripheral. For the temperature monitoring application the RTC must be set to generate an overflow event, which is routed to the ADC by configuring the Event System. The ADC must be configured to start a conversion when it receives an event. By using the Event System, an RTC overflow can trigger an ADC conversion without waking up the CPU. Further the ADC can be configured to generate an interrupt if the threshold is exceeded, and the interrupt will wake up the CPU.