Skip to Content
Hands-On Embedded Programming with C++17
book

Hands-On Embedded Programming with C++17

by Maya Posch
January 2019
Intermediate to advanced
458 pages
10h 35m
English
Packt Publishing
Content preview from Hands-On Embedded Programming with C++17

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On RTOS with Microcontrollers

Hands-On RTOS with Microcontrollers

Brian Amos

Publisher Resources

ISBN: 9781788629300Supplemental Content