Here you can find examples for simple Linux Kernel Modules and Linux Drivers.
I used a Raspberry Pi 3 to develop and test my modules and drivers. To compile them, you need to install the Kernel headers on your Pi. On Raspbian you can do this with the following command:
sudo apt install raspberrypi-kernel-headers
You also need the build utils (make, gcc, ...) but they come preinstalled on Raspbian.
In this repo you can find examples for:
- Simple Kernel Module
- Device Numbers and Device Files
- Create device file in driver and callbacks
- GPIO Driver
- Text LCD Driver
- PWM Module
- Temperature Sensor (I2C)
- Timer in Linux Kernel Modules
- High Resolution Timer in Linux Kernel Modules
- Accessing SPI with a Linux Kernel Module (BMP280 sensor again)
- Using a GPIO Interrupt in a Linux Kernel Module
- Using Parameters in a Linux Kernel Module
- IOCTL in a Linux Kernel Module
- Threads in a Linux Kernel Module
For more information about my Linux Driver examples check out my videos and my playlist