Launch an event - officinerobotiche/or_kernel_c.X GitHub Wiki

Define a module, create a new file c with name foo.c and add the following lines

// include module
#include <system/events.h>

#define FOO "FOO"
static string_data_t _MODULE_FOO = {FOO, sizeof(FOO)};

void foo_event(int argc, int* argv) {
   ...
}

void Foo_Init(void) {
   /// Register module
   hModule_t foo_module = register_module(&_MODULE_FOO);

    /// Register event
    fooEvent = register_event_p(foo_module, &foo_event, EVENT_PRIORITY_LOW);
}

Now in your main.c file:

#include "foo.h"

void main(void) {
   ...
   ...
   Foo_Init();
   ...
   ...
   while(true) {
      ...
      ...
      ...
      trigger_event(fooEvent);
      ...
   }
}