-
-
Notifications
You must be signed in to change notification settings - Fork 91
Using GPIO pins for LEDs
Starting with Amiberry v4.2, you can use GPIO pins to control activity LEDs.
This guide serves as documentation on how you can use this feature. It's meant for advanced users who know what they are doing! :)
These limitations exist in the current implementation, but might be improved/expanded in future updates:
- Currently, only GPIO 18, 23 and 24 are supported.
- The 3 pins are internally labeled as Red (GPIO 18), Yellow (GPIO 23) and Green (GPIO 24).
- The LEDs are used for DFx (Red), HDD (Yellow) or Power (Green) activity only for now.
Please refer to this diagram as an example on where the GPIO pins are located on the board: https://pinout.xyz/
- LEDs to connect to the GPIO pins, with any resistors as necessary. Make sure you know what you're doing, or you may end up burning up your device!
- Currently, only GPIO pins 18, 23 and 24 are supported.
- Appropriate wiring, including grounding. Again, make sure you know what you're doing here.
- Amiberry uses
libgpiod
to communicate with the GPIO pins, so you'll need to install that first:
-
for Debian/RPI-OS systems:
sudo apt update && sudo apt install libgpiod-dev
-
for Arch/Manjaro systems:
sudo pacman -S libgpiod
- You will need to compile Amiberry from source, adding an extra define (USE_GPIOD):
make -j4 PLATFORM=<your platform here> USE_GPIOD=1
- Finally, elevated permissions are required to access the GPIO pins. This means that you will have to either run Amiberry as
root
(e.g. withsudo
) or modify the system's permissions to allow a normal user access.
An (unsupported, may not work for you) example of how you can do that is shown below, but proceed at own risk - there is a reason GPIO access requires root permissions! :)
Create a gpiod group, add user to it and add a file to the /etc/udev/rules.d/ to assign the gpiochips to the gpiod group and give rw privileges.
sudo groupadd gpiod
sudo usermod -G gpiod <user>
For gpiochip 0: Create
/etc/udev/rules.d/60-gpiod.rules
with:
# udev rules for gpio port access through libgpiod
SUBSYSTEM=="gpio", KERNEL=="gpiochip0", GROUP="gpiod", MODE="0660"
Verify you have permission by
ll /dev/gpio*
.
This breaks the CLI permissions for the
libgiod
utilities,gpiodetect
,gpioset
etc. You will need to usesudo
for them, but you can run you programs without needingsudo
.
Then reboot.
- First Installation
- RetroPie Installation
- Kickstart ROMs (BIOS)
- Compiling from source
- Frequently Asked Questions
- Default Options
- How to enable Integer Scaling