Skip to content

Berkin99/EventController

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Event Controller

Dynamically allocated function pointer arrays.

Basic event controller example for interrupt request handler function like applications.

IRQ vector functions predefined in embedded systems. If you want to dynamically change called other functions in interrupt request function, you need to add event controller library.

Usage

There is a example usage of event controller in main function.

/* @brief Creates new eventHandle. Initial

  • allocated memory for event functions is
  • described as @EVENT_INIT_CAPACITY
  • @return eventHandle_t constructor
  • @retval handle.state == EVENT_ERROR:
  • memory allocation error!
  • @retval handle.state == EVENT_READY:
  • successful memory allocation. */ eventHandle_t eventNew(void);

/* @brief Calls every event_t event function

  • in the handle array (@handle->arr).
  • @param handle: object pointer. / void eventCall(eventHandle_t handle);

/* @brief Adds event_t function in the handle

  • array. If arr_size is exceeds the capacity
  • of the event_t array, reallocates the memory
  • as capacity multiplied by 2. If handle is not
  • initalized (not used the construct function)
  • @eventNew(), it constructs the object.
  • @param handle: object pointer. / void eventAdd(eventHandle_t handle, event_t event);

/* @brief Removes last event_t function in the

  • handle array.
  • @param handle: object pointer. / void eventRemove(eventHandle_t handle);

/* @brief Frees the allocated event_t array

  • memory. Deconstruction of the object. Do not
  • use after deconstruction.
  • @param handle: object pointer. / void eventFree(eventHandle_t handle);

About

Event Controller

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published