EmbeddedRelated.com
The 2024 Embedded Online Conference

Creating a Hardware Abstraction Layer (HAL) in C

Jacob Beningo

In my last post, C to C++: Using Abstract Interfaces to Create Hardware Abstraction Layers (HAL), I discussed how vital hardware abstraction layers are and how to use a C++ abstract interface to create them. You may be thinking, that’s great for C++, but I work in C! How do I create a HAL that can easily swap in and out different drivers? In today’s post, I will walk through exactly how to do that while using the I2C bus as an example.




The 2024 Embedded Online Conference