A Raspberry Pi Hardware Abstraction Layer for C/C++ projects. It includes an emulator.
The system tests can also be considered as examples 😉
The library automatically detects the Raspberry Pi Model.
CAUTION! Unexpected behaviour may be observed on alternate functions (see ANOM1).
2B and newer, except 5 and it's derivates. Compute Modules could not yet be tested.
Search for ADDHW comments in code to find sections which are crucial for implementation of more hardware support.
The main focus lies on Raspberry Pi OS, but it's attempted to make the code compatible to other distros.
In fact Raspberry Pi OS 32bit and Raspberry Pi OS 64bit are different distros: Raspbian and a Debian arm64 port. See this article on Tom's Hardware for further information.
See build/readme.md for the different build methods.
RPIHAL_CMAKE_CONFIG_EMUonly used in librpihal.a/CMakeLists.txt (has to be set to 1 before theadd_subdirectory()call in the parent CMakeLists if needed)
-
RPIHAL_EMUhas to be defined on compiler level for the linking code (most likely your application) and rpihal. If using librpihal.a/CMakeLists.txt, it has to be added before theadd_subdirectory()call in the parent CMakeLists. -
RPIHAL_CONFIG_LOGLEVEL- 0 OFF, no logging from rpihal
- 1 ERROR
- 2 WARNING
- 3 INFO
- 4 DEBUG