|
gossamer 0.0.1
a very lightweight app framework for SAMD and SAML chips
|
Functions for configuring the Event System. More...
Functions | |
| void | evsys_init (void) |
| Initializes the Event System. | |
| void | evsys_configure_channel (uint8_t channel, uint8_t generator, evsys_path_t path, evsys_edge_t edge, generic_clock_generator_t clocksource) |
| Configures an event channel with a generator and path settings. | |
| void | evsys_connect_user (uint8_t user, uint8_t channel) |
| Connects an event user to an event channel. | |
| void | evsys_disconnect_user (uint8_t user) |
| Disconnects an event user from its channel. | |
| void | evsys_software_event (uint8_t channel) |
| Triggers a software event on the specified channel. | |
| void | evsys_enable_interrupt (uint8_t channel) |
| Enables the event-detected interrupt for a channel. | |
| void | evsys_disable_interrupt (uint8_t channel) |
| Disables the event-detected interrupt for a channel. | |
| bool | evsys_get_and_clear_interrupt (uint8_t channel) |
| Checks and clears a channel's event-detected interrupt flag. | |
Functions for configuring the Event System.
The Event System routes events between peripherals without CPU intervention. Event generators (sources) are connected to event users (destinations) through configurable event channels.
Generator and user IDs are chip-specific. Use the EVSYS_ID_GEN_* and EVSYS_ID_USER_* defines from your chip's headers. For example, EVSYS_ID_GEN_RTC_OVF for the RTC overflow generator, or EVSYS_ID_USER_DMAC_CH_0 for DMA channel 0's event input.
| void evsys_configure_channel | ( | uint8_t | channel, |
| uint8_t | generator, | ||
| evsys_path_t | path, | ||
| evsys_edge_t | edge, | ||
| generic_clock_generator_t | clocksource ) |
Configures an event channel with a generator and path settings.
| channel | The event channel number (0 to EVSYS_CHANNELS-1). |
| generator | The event generator ID. Use the EVSYS_ID_GEN_* defines from your chip's instance header (e.g. EVSYS_ID_GEN_RTC_OVF). |
| path | The event propagation path. Use EVSYS_PATH_ASYNCHRONOUS for lowest latency without edge detection, EVSYS_PATH_SYNCHRONOUS when generator and channel share a clock, or EVSYS_PATH_RESYNCHRONIZED when they do not. |
| edge | Edge detection mode. Must be EVSYS_EDGE_NONE for asynchronous paths. Must be EVSYS_EDGE_RISING, EVSYS_EDGE_FALLING, or EVSYS_EDGE_BOTH for synchronous or resynchronized paths. |
| clocksource | The generic clock source for edge detection and event propagation. Ignored when path is EVSYS_PATH_ASYNCHRONOUS. |
| void evsys_connect_user | ( | uint8_t | user, |
| uint8_t | channel ) |
Connects an event user to an event channel.
The channel must be configured first with evsys_configure_channel(). Multiple users can be connected to the same channel.
| user | The event user ID. Use the EVSYS_ID_USER_* defines from your chip's instance header (e.g. EVSYS_ID_USER_DMAC_CH_0). |
| channel | The event channel number to connect to. |
| void evsys_disable_interrupt | ( | uint8_t | channel | ) |
Disables the event-detected interrupt for a channel.
| channel | The channel to disable the interrupt for. |
| void evsys_disconnect_user | ( | uint8_t | user | ) |
Disconnects an event user from its channel.
| user | The event user ID to disconnect. |
| void evsys_enable_interrupt | ( | uint8_t | channel | ) |
Enables the event-detected interrupt for a channel.
Define irq_handler_evsys in your application; from it, call evsys_get_and_clear_interrupt() to identify which channel fired. On the SAM D51 only channels 0-11 can generate interrupts.
| channel | The channel to enable the interrupt for. |
| bool evsys_get_and_clear_interrupt | ( | uint8_t | channel | ) |
Checks and clears a channel's event-detected interrupt flag.
| channel | The channel to check. |
| void evsys_init | ( | void | ) |
Initializes the Event System.
Enables the EVSYS bus clock. Call once at boot before configuring any event channels.
| void evsys_software_event | ( | uint8_t | channel | ) |
Triggers a software event on the specified channel.
The software event behaves like an event from a generator. For synchronous or resynchronized paths, the channel must be configured with edge detection enabled.
| channel | The event channel number. |