BaseModule

This class contains the logic for registering and keeping track of which feature modules are currently active or inactive. Its header file looks as follows:

#include "ota_core.h"enum ModuleIndex {   MOD_IDX_TEMPERATURE_HUMIDITY = 0,   MOD_IDX_CO2,   MOD_IDX_JURA,   MOD_IDX_JURATERM,   MOD_IDX_MOTION,   MOD_IDX_PWM,   MOD_IDX_IO,   MOD_IDX_SWITCH,   MOD_IDX_PLANT};typedef bool (*modStart)();typedef bool (*modShutdown)();

The inclusion of the OtaCore header is to allow us to use the logging feature. Beyond this, we create another enumeration, which maps a specific feature module to a particular bit in the feature module bitmask (active_mods).

Finally, function pointers are defined, which are used for respectively starting and shutting down a feature ...

Get Hands-On Embedded Programming with C++17 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.