|
#define | MAX_EVENTS 2 |
| max number of events that can be registered
|
|
The Event Module is intended to be used with interrupts when a task needs to run in response to the interrupt and the desire is to not call any tasks from the interrupts. This module makes this easy by allowing the user to register a task to run (see Event_Register()) in response to a flag being set to a non zero value.
- Todo:
- Josh Hass Add a code example (when done change this line to "@todo MM check <your names> documentation"
- Warning
- JaH 9/10
Initializes list of events (sets size to 0)
void Event_Register |
( |
uint8_t * |
flag, |
|
|
void(*)(void) |
fn_ptr |
|
) |
| |
Event Register will add an event (a function pointer) to the events array
If the array is not full (size < MAX_EVENTS), then a new event will be added at the end of the array, where the flag and the function pointer are passed in as parameters.
Event_Init() must be used to initialize the events array prior to calling Event_Register or Event_Unregister
- Parameters
-
flag | boolean flag to indicate if the event function pointer for the corresponding function pointer should be called upon a sequential Event_Tick() call |
fn_ptr | function pointer to be called when Event_Tick() is called and the corresponding event in the global events array has a set flag value of 1. |
- Note
- the .c file for this has "fn" as the parameter name, not "fn_ptr"
- Warning
- LH 10/10
- Todo:
- Austin H. Document this function (when done change this line to "@todo MM check <your names> documentation"
void Event_Unregister |
( |
void(*)(void) |
fn | ) |
|
Event_Unregister unregisters an event from the list of events that are to occur. This is done by passing a function pointer that points to the function that needs to be unregistered. Event_Unregister then loops through the event array to find the matching function pointer. When the function pointer is found the remaining items in the event array are shifted left to overwrite the function pointer.
- Parameters
-
fn | is a function pointer pointing to the function to unregister. |
- Warning
- EJ 10/10