Alex Konshin akonshin@gmail.com
This project contains source code of Linux driver that currently tested on Raspberry Pi 3, Banana Pi M3, ODROID C2, MinnowBoard Turbot.
The main goal of this driver is to simplify developing of applications that need to receive some high frequency signals from GPIO, for example, from RF or IR receivers.
I use this driver for receiving and decoding messages from RF sensors like thermometers.
See my another project https://github.com/alex-konshin/f007th-rpi that can use this driver.
/dev/gpiots*
. Each GPIO file may have different filtering settings.File | Description |
---|---|
gpio-ts.c |
Source code of the driver. |
gpio-ts.h |
The driver's header file. |
Makefile |
Makefile for building this driver. |
README.md |
This file. |
Install Linux headers - see instruction https://www.raspberrypi.org/documentation/linux/kernel/headers.md
Download this driver sources and build it:
cd ~
git clone https://github.com/alex-konshin/gpio-ts.git
cd gpio-ts
make all
The driver file gpio-ts.ko
is created in folder ~/gpio-ts
.
Download and setup Linux headers:
git clone --depth 1 https://github.com/hardkernel/linux.git -b odroidc2-3.14.y
cd /lib/modules/$(uname -r)
sudo ln -s /usr/src/linux-headers-$(uname -r) build
Download this driver sources and build it:
cd ~
git clone https://github.com/alex-konshin/gpio-ts.git
cd gpio-ts
make all
The driver file gpio-ts.ko
is created in folder ~/gpio-ts
.
Install Linux headers:
sudo apt-get install linux-headers-$(uname -r)
Install make, gcc and g++ if they are not installed yet:
sudo apt install make
sudo apt install gcc
sudo apt install g++
Download this driver sources and build it:
cd ~
git clone https://github.com/alex-konshin/gpio-ts.git
cd gpio-ts
make all
The driver file gpio-ts.ko
is created in folder ~/gpio-ts
.
Building Linux kernel module on BPI-M3 is currently a nightmare. I finally figured out how to cross-compile it on another machine and after some hacks I was able to load and use it. But I don't remember all steps I did to achieve it. To make your life easier I provided compiled driver for the current BPI-M3 kernel. Take it from folder bpi-m3-kernel-3.4.39
.
Not all GPIOs allow to set interruptions handler. This is a hardware limitation. The following GPIO numbers are supported on BPI-M3:
32, 33, 34, 35, 202, 203, 204, 205, 226, 227, 228, 229, 234, 360, 361, 362.
See output of command gpio readall
to find these GPIOs on the connector.
The comma-separated list of GPIOs that will be served by this driver. Device /dev/gpiots*
will be created for each GPIO from this list.
Minimum duration of the same level to be accepted. This is an optional parameter. It sets the default value that can be changed for a particular GPIO by user application.
Maximum duration of the same level to be accepted. This is an optional parameter. It sets the default value that can be changed for a particular GPIO by user application.
Minimum sequence length to be accepted. This is an optional parameter. It sets the default value that can be changed for a particular GPIO by user application.
sudo insmod gpio-ts.ko gpios=27
sudo insmod gpio-ts.ko gpios=21,27 min_duration=400 max_duration=1100 min_seq_len=100
sudo rmmod gpio-ts