Modules

Of the firmware modules, we already looked at the plant module in Chapter 5, Example - Soil Humidity Monitor with Wi-Fi. Here we will look at the remaining modules, starting with the THP module:

#include "base_module.h"class THPModule {    public:    static bool initialize();    static bool start();    static bool shutdown();};#include "thp_module.h"#include "dht_module.h"#include "bme280_module.h"bool THPModule::initialize() {    BaseModule::registerModule(MOD_IDX_TEMPERATURE_HUMIDITY,     THPModule::start, THPModule::shutdown);    return true;}bool THPModule::start() {    BME280Module::init();    return true;}bool THPModule::shutdown() {    BME280Module::shutdown();    return true;}

This module has the provisions to act as a generic interface to a wide variety ...

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.