This article presents another example of using trait templates to help us not shoot ourselves in the foot with invalid pin assignments. If this means nothing to you please take a look Traits templates 101. If it all looks spookily familiar, perhaps you already read Traits for wake-up pins. The comments below do present essentiallyContinue reading “Traits for STM32 pin functions”
Category Archives: Templates
Traits for wake-up pins
This is a real example from an embedded project I’ve been working on. The goal was to convert a potential run time error into a compile time error. If you haven’t done so already, please take a look at Traits templates 101, which introduces some of the ideas discussed below. The scenario The device isContinue reading “Traits for wake-up pins”
Traits templates 101
If you are not familiar with them, traits in C++ are a simple method of using templates to associate custom information with specific data types (and/or with specific data values) at compile time. If you think for a moment about the built-in integral types: int, short, long, and so on, you already know that theseContinue reading “Traits templates 101”