Skip to content

Embrace and Extend

LordEidi edited this page Apr 3, 2020 · 1 revision

The Ordinator firmware is extendable. You can add your own Apps easily. To do so, you will have to write a subclass of the BaseApp base class and then extend at least the following functions:

Base

void handleEvents();

This is where your App can react to events.

void paintFrameInternal();

This is where your App prepares the offscreen. The ordinator firmware makes then sure that your offscreen is drawn on the screen without any flickering.

And more

If you need more flexibility or more features, you might want to have a look at these functions:

void handleEvents(EventHandler* eh);

If you need a pointer to the EventHandler (to look things up as example), use this function instead of the once above.

void paintFrame();

If you don't like that offscreen, override the default behaviour here.

void cleanup();

Be a good citizen and clean the memory when your App gets deconstructed.

bool getEnforceFramerate();

Sometimes you might want to override the enforced framerate. Just tell the Ordinator that it should not enforce a framerate when running your App.

bool canWeGoToSleep();

By default the Ordinator goes into sleep mode when no event happens. Your App can tell the Ordinator firmware to not go into sleep while the App runs.

bool canSwitchAway();

Usually a single short click will switch to the next App. If your App is doing something complicated and does not want the Ordinator to move to the next App, tell it to not switch away.