User Tools

Site Tools


getting_started:tutorials:hal3

This is an old revision of the document!


Using the HAL with the GPIO Subsystem

In the EEROS library you will find a directory with examples. For this example see HalTest4.cpp.

The system either uses real hardware inputs and output or makes use of a simulated gpio device. The hardware could be (TODO). You also need to install the necessary wrapper library, see Installing Hardware Libraries.

When using a simulated gpio device, make sure to load the kernel driver first and then create the device with

$ sudo modprobe gpio-sim
$ sudo mkdir /sys/kernel/config/gpio-sim/ofagpio 
$ sudo mkdir /sys/kernel/config/gpio-sim/ofagpio/bank0
$ echo 32 | sudo tee /sys/kernel/config/gpio-sim/ofagpio/bank0/num_lines
$ echo 1 | sudo tee /sys/kernel/config/gpio-sim/ofagpio/live

Make sure that your local user has access to the device file.

$ sudo chown $USER:$USER /dev/gpiochip0

Open a shell in the build directory of your EEROS library and run

$ ./examples/hal/halTest4 -c HalTest4ConfigGpio.json  

This examples creates a small control system with a couple of peripheral input and output blocks. The main sequence alters the values on digital and analog outputs periodically. It also logs the digital and analog inputs.

getting_started/tutorials/hal3.1778658079.txt.gz · Last modified: by ursgraf