Sofware Design Patterns

Wide box Tiny box List
Ascent Descent

ChibiOS/HAL design: an object-oriented approach

The C programming language is clearly an imperative programming language not designed to be object-oriented. Anyway, the object-oriented approach remains something much more related to the design and mindset more than to syntax. The ChibiOS/HAL is an Hardware Abstraction Layer which design could be considered very object-oriented. We encountered it in almost every article related to ChibiOS but we often ignored its design as it comes with a series of demos which allow to use it easily without a deep knowledge of its internal mechanisms.

This article is dedicated to people continue reading...

Port a ChibiOS based application to another platform

Port a ChibiOS based application to another platform

We already talked about ChibiOS/HAL design and its multiple architectures support. This is very important for regular developers: imagine a scenario in which you design an application using a certain MCU and after a first stage you decide to upgrade your application. Imagine also that hardware resources on the MCU you decided to use are not enough to make that upgrade. At that point you have to port application on another MCU and this could cost a big effort in terms of time/money. If your application is ChibiOS based and you followed some guidelines already introduced in continue reading...

C Library design for embedded applications: tips and hints

C Library design: tips and hints

Write reusable code is one of the most powerful and time-saving thing that an embedded programmer should learn. Compose well-arranged libraries makes things easiest, especially when we want to add old code in a new project. Citing one of the most talented programmers I have ever met, “Well done code should be like a LEGO: must fit perfectly and without any effort”. So a good library should be quite abstract, with a simple hierarchy and should provide some well documented APIs.

Even if this is a generic embedded article, we will provide some concrete example.

When we want continue reading...

Registers and bit masks

Registers and bit masks

When I started with embedded my knowledge about programming was (and probably still is) very elementary. I often used logical operator like logical NOT (!), logical OR (| |) and logical AND (&&) but was almost ignoring the bitwise operators.SL Plugins

Handling registers is actually so simple that at first approach I wasted a couple of days and this was because bitwise operators are required to. Talking with friends of mine coming from Arduino, this problem seems to be much diffused. The trap seems to be a lack of basic knowledge of informatics and electronics. So in this continue reading...