Home >
Decoupling Drivers from the Hardware Platform
This talk is about how to design drivers that are decoupled from a specific hardware platform so they can be reused on different microcontrollers. Decoupled drivers also enable the creation of a functional simulator for your embedded application. Writing decoupled drivers does not require more effort or time to implement than a traditional platform-specific driver.
A decoupled driver requires a public interface that is defined without direct hardware dependencies and a mechanism (e.g., a Hardware Abstraction Layer) that decouples the driver implementation from a specific hardware platform.
There are numerous ways to create interfaces for a Hardware Abstraction Layer (HAL). The following list covers three ways to create abstract interfaces that decouple a driver from platform-specific dependencies. In this context, an “abstract interface” is an interface that defines a behavior with late binding.
- Façade. Using link-time bindings.
- Separation of concerns. Using compile-time bindings.
- Polymorphic. Using run-time bindings.