Recently I published a simplified version of the Always-On project hardware. Read this post for details. Today I publish a firmware example for the Always-On project. This firmware is written for the PlatformIO environment using Visual Studio Code. It is using a special adaption of my HAL layer for PlatformIO using the Arduino layer for…
Tag: example
Event-Based Firmware Example
If you read the previous articles about event-based firmware, modularisation and templates, you may wonder how to combine all these concepts in your firmware. I created a working firmware example, based on an event loop. In contrast to the minimal example code in my articles, this one contains everything you need to start a project….
Use Enum with More Class!
You may be familiar with enum values, but do you know about enum classes? This great feature was introduced with C++11 to solve several problems with the regular enum declaration. Now I will explain the enum class declaration and demonstrate its practical uses. Although the examples I provide are intended for the Arduino Uno, the…
C++ Templates for Embedded Code
Templates are a powerful feature of the C++ language but their syntax can be complex. This causes some developers to not use them, while others are concerned that templates might cause bloat to the compiled code. I will explain how templates work and how you may use them in your code. Although the examples I…
Auto and Structured Binding
This article is just a short follow-up article for “Write Less Code using the ‘auto’ Keyword”. Structured binding is something handy, introduced in C++17. Therefore, only the latest compiler will support it. If you are mainly write embedded code, you may skip this article, because it will take some years until C++17 support is available…
Guide to Modular Firmware
This article is for embedded software developers with a solid working knowledge of C or C++, but who struggle with large and complex projects. If you learn to develop embedded code, e.g. using the Arduino IDE, you find plenty of small example programs. It is helpful to get things started quickly, but as soon as…
Class or Module for Singletons?
Should you use a class or a module with a namespace for a singleton interface in your firmware? I found there are many misunderstandings which lead beginners to make a wrong decision in this matter. With this article, I try to visualize these misunderstandings with simple example code for the Arduino platform. Before we start,…