This is library for accessing the GPIO's of APU2/3 devices. Currently it supports accessing the GPIO's controlling the LED1,2,3, MODESW signal and SIMSWAP signal (apu3 only).
This library could be used as an example.
- gcc
- cmake
By default compiles statically linked library and some examples.
mkdir build
cd build
cmake ..
make
After compilation. Examples are in dir build/example
.
blinky
- it blinks the LED2 and LED3 on APU.simswap
- changes the simswap pin value. Usage:./simswap
- shows current pin state./simswap 1
- sets the simswap pin value to 1./simswap 0
- sets the simswap pin value to 0
apu2_gpiod
- a daemon that is only built on OpenBSD to be run from rc.securelevel to control the LEDs
Short API summary:
const char *apu_gpio_version(void)
- returns library version stringint apu_gpio_init(void)
- initializes the library and maps the gpio spaceint apu_gpio_get_dir(unsigned offset)
- gets gpio direction (1 - out, 0 - in)int apu_gpio_set_dir(unsigned offset, unsigned direction)
- sets gpio direction (1 - out, 0 - in)int apu_gpio_get_val(unsigned offset)
- gets gpio stateint apu_gpio_set_val(unsigned offset, unsigned value)
- sets gpio value
If you have any trouble or find any bug, please report an issue in this location. To create the issue, from the list of available templates select the one, that fits best the nature of the issue (bug, feature, question or task) and fill it.