-
Notifications
You must be signed in to change notification settings - Fork 369
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 abstraction layer class. 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. An example for Raspberry Pi using the lgpio library can be found here: https://github.com/jgromes/RadioLib/blob/master/examples/NonArduino/Raspberry/PiHal.h -
Done!
Congratulations, you have now succesfully ported RadioLib to your platform!