Re:Practical Guide to Bare Metal C++
by bsoles on Tuesday March 10, 2026 @10:18PM
(#47331123)
I find that encapsulation of devices (UART, I2C, etc.) as classes in C++ rather than global functions that take structs, etc. as input arguments in C to be much more manageable. Same for device drivers for individual sensor ICs.
[ Parent
| on HN ]
Maybe, but I'd argue that this is a matter of taste, and what does it actually do for you?
In practice: Is it worth wrapping all your vendor-provided hardware abstraction in classes that you write yourself? Designing something like that to be "complete" (i.e. allow full access to all hardware functionality like IRQ/DMA setup) and to still stay hardware-independent is often borderline impossible anyway, and any attempt is invariably going to make your codebase more difficult to understand.