C++ For Embedded Developers (2023-03-20 - 2023-03-23)¶
Give an idea how an experienced C programmer can benefit from the C++ toolcase. The following aspects are covered, accompanied with many exercises.
C++ is an object oriented language. That term alone has many facets, and a solid understanding of each is given. Constructors, destructors, automatic pointer/base-class conversion, late binding (“abstract”?), and all that.
C++ also brings a rich toolset in form of its standard library. After a short conceptual introduction, containers and algorithms are something that is immediately useful for non-OO programmers.
C++ does not stop there; starting from its 2011 definition, the language has undergone a major revolution. An overview is given.
When installed, open a Ubuntu terminal, and install the software that is required for this training.
$ sudo apt update $ sudo apt install git build-essential cmake libgtest-dev libgmock-dev
It is also possible to setup a Linux-like environment on native Windows, using the following emulation layers:
You may use these, but be warned that there might not exist enough trainer-side knowledge to help you out f anything goes wrong.
Follow the instructions in the course project README to setup the initial version of the course project.
From Data Encapsulation
Exploring object copy when resources have to be explicitly managed: Object Copy (And Resource Management): There Be Dragons
Only if there is time (and fun): have a look at Multithreading
Based upon an object oriented encapsulation for OS primitives (timers and GPIOs, mainly),
A sensor abstract base class - an interface
A number of concrete sensor implementations
A configured set of those, measuring live data
Live data is posted via another interface
Another interface in the system
Display measurement values
Concrete implementation: a software PWM using a timer and a GPIO (as opposed to hardware PWM
Pointer Arithmetic Recap: Pointers and Arrays
Sorted Array Algorithms