Loading...
Searching...
No Matches
source.h File Reference

Provides functionality to trigger multiple events at once. More...

Detailed Description

Provides functionality to trigger multiple events at once.

Event Source API

Author
Benjamin Valentin benja.nosp@m.min..nosp@m.valen.nosp@m.tin@.nosp@m.ml-pa.nosp@m..com

Definition in file source.h.

#include "event.h"
#include "list.h"
#include "irq.h"
+ Include dependency graph for source.h:

Go to the source code of this file.

Data Structures

struct  event_source_t
 Event source struct. More...
 
struct  event_source_subscriber_t
 Subscriber of an event source. More...
 
#define EVENT_SOURCE_INIT   { 0 }
 Initialize an event source.
 
#define EVENT_SOURCE_SUBSCRIBER_INIT(e, q)   { .event = (event_t *)e, .queue = q }
 Initialize an event source subscriber.
 
static void event_source_attach (event_source_t *source, event_source_subscriber_t *event)
 Attach an event to an event source.
 
static void event_source_detach (event_source_t *source, event_source_subscriber_t *event)
 Remove a subscription from the event source.
 
static void event_source_trigger (event_source_t *source)
 Trigger all events registered on the event source.
 

Macro Definition Documentation

◆ EVENT_SOURCE_INIT

#define EVENT_SOURCE_INIT   { 0 }

Initialize an event source.

Definition at line 52 of file source.h.

◆ EVENT_SOURCE_SUBSCRIBER_INIT

#define EVENT_SOURCE_SUBSCRIBER_INIT (   e,
 
)    { .event = (event_t *)e, .queue = q }

Initialize an event source subscriber.

Parameters
[in]eThe event to trigger
[in]qThe event queue to use for the event

Definition at line 60 of file source.h.

Function Documentation

◆ event_source_attach()

static void event_source_attach ( event_source_t source,
event_source_subscriber_t event 
)
inlinestatic

Attach an event to an event source.

Parameters
[in]sourceThe event list to attach the event to
[in]eventThe new event subscription

Definition at line 68 of file source.h.

◆ event_source_detach()

static void event_source_detach ( event_source_t source,
event_source_subscriber_t event 
)
inlinestatic

Remove a subscription from the event source.

Parameters
[in]sourceThe event list to remove the event from
[in]eventThe event to remove

Definition at line 84 of file source.h.

◆ event_source_trigger()

static void event_source_trigger ( event_source_t source)
inlinestatic

Trigger all events registered on the event source.

Parameters
[in]sourceThe event list to trigger

Definition at line 99 of file source.h.