Rpi is a lightweight and simple C library for Raspberry Pi using direct register control.
It maps the peripheral registers in memory using /dev/mem for PWM, I2C, SPI and /dev/gpiomem for GPIO control.
It is mainly used for iiot and m2m applications.
- GPIO
- PWM
- I2C (master)
- SPI
- Model: Pi Zero & Zero W, Pi Zero 2 W, Pi 3 Model B+, Pi 4 Model B, Compute Module 3 & 4 (Generally most of the 40-pin models)
Tried and tested on the following OS
- Raspbian
- Raspberry Pi OS (32 and 64-bit)
- 64-bit Ubuntu 20+ (Only GPIO peripheral is supported)
In your Raspberry Pi, clone the rpi repository.
$ git clone https://github.com/EdAlegrid/rpiGo inside the directory to compile the library and the sample applications.
$ cd rpiCompile the rpi source code and create an object file within the obj folder.
$ gcc -Wall -pedantic -c src/rpi.c -o obj/rpi.oCompile the sample applications (gpio.c, pwm.c, i2c.c and others).
e.g. compiling the pwm.c ...
$ gcc -Wall -pedantic pwm.c obj/rpi.o -o pwmRun the application.
$ sudo ./pwmGNU General Public License v3.0