-
Notifications
You must be signed in to change notification settings - Fork 413
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 file shows how to install and use RadioLib on any generic platform. Go here to see an example for Raspberry Pi.
-
Install the library
There are two options how to do this. The more common way is to use RadioLib as a source library directly in your project. Alternatively, you can also install RadioLib as a shared library:
$ 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 pigpio 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!