-
Notifications
You must be signed in to change notification settings - Fork 405
Porting to non Arduino Platforms
Even though RadioLib was originally written for Arduino, it can run on any platform that can compile C++ code. This page shows how to install and use RadioLib on any generic platform. Go here to see an example for Raspberry Pi.
To port RadioLib, follow these steps:
-
Install the library
There are two options how to do this. The more common way is to use RadioLib source directly in your project. Alternatively, you can also install RadioLib as a shared library, to make it available system-wide. This is useful if you are compiling the library directly on the target platform, and not cross-compiling:
$ mkdir build/
$ cd build
$ cmake ..
$ sudo make install
-
Include RadioLib in your project
In the appropriate file in your project, include the library header:
#include <RadioLib.h>
NOTE: If you installed RadioLib as a shared library in the previous step, you will have to include it like this:
#include <RadioLib/RadioLib.h>
-
Provide your hardware abstraction layer to RadioLib
To run on different platforms (e.g., esp-idf for ESP32, stm32hal for STM32, pigpio for Raspberry Pi etc.), RadioLib includes a light-weight Hardware Abstraction Layer (HAL) class. HALs for the most commont platforms are provided here: https://github.com/jgromes/RadioLib/tree/master/src/hal. If adding a new platform, it's up to the user to add implementation of this abstraction layer - usually this boils down to providing functions that perform GPIO operations, SPI transactions etc. -
Done!
Congratulations, you have now succesfully ported RadioLib to your platform!