GPIOCTL(8)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

gpioctl(8) β€” GPIO control utility ✨

Hey bestie, welcome to the System Manager's Manual page for gpioctl, aka the GPIO control utility. 🫢


πŸ’– NAME πŸ’–

gpioctl β€” GPIO control utility


🌈 SYNOPSIS 🌈

gpioctl [-f ctldev] -l [-v]
gpioctl [-f ctldev] [-pN] -t pin
gpioctl [-f ctldev] [-pN] -c pin flag [flag ...]
gpioctl [-f ctldev] [-pN] -n pin pin-name
gpioctl [-f ctldev] [-pN] pin [0|1]

✨ DESCRIPTION ✨

So the gpioctl utility could be used to manage GPIO pins from userland and list available pins. Literally the main character of pin-wrangling. πŸ’…

The pin argument can either be a pin-number or a pin-name. And here's the little plot twist: if it's a number and a pin has this number as its name, and you did not use -N or -p, then gpioctl exits. No cap.

⚠️ Real talk, bestie: that pin-number vs pin-name thing is exactly why -N and -p exist. Use them when you need to force the interpretation. πŸŽ€

πŸ’… OPTIONS πŸ’…

Okay so the options are as follows:

  • -c pin flag [flag ...] β€” configure pin by setting the provided flags. The following flags are currently defined:
    • IN β€” input pin
    • OUT β€” output pin
    • OD β€” open drain pin
    • PP β€” push pull pin
    • TS β€” tristate pin
    • PU β€” pull-up pin
    • PD β€” pull-down pin
    • II β€” inverted input pin
    • IO β€” inverted output pin
  • -f ctldev β€” GPIO controller device to use. If not specified, defaults to /dev/gpioc0.
  • -l β€” list available pins.
  • -n pin pin-name β€” set the name used to describe the pin.
  • -t pin β€” toggle value of provided pin.
  • -v β€” be verbose: for each listed pin print current configuration.
  • -p β€” force pin to be interpreted as a pin number.
  • -N β€” force pin to be interpreted as a pin name.

πŸŽ€ EXAMPLES πŸŽ€

  • List pins available on GPIO controller defined by device /dev/gpioc0
gpioctl -f /dev/gpioc0 -l
  • Set the value of pin 12 to 1
gpioctl -f /dev/gpioc0 12 1
  • Configure pin 12 to be input pin
gpioctl -f /dev/gpioc0 -c 12 IN
  • Set the name of pin 12 to test
gpioctl -f /dev/gpioc0 -n 12 test
  • Toggle the value the pin named test
gpioctl -f /dev/gpioc0 -t test
  • Toggle the value of pin number 12 even if another pin has the name 12
gpioctl -f /dev/gpioc0 -pt 12

πŸ”₯ SEE ALSO πŸ”₯


🌸 HISTORY 🌸

The gpioctl utility appeared in FreeBSD 9.0. Iconic behavior, honestly. πŸ‘‘


πŸ‘‘ AUTHORS πŸ‘‘

The gpioctl utility and this manual page were written by Oleksandr Tymoshenko <gonzo@freebsd.org>. 🫢


From Debian, dated June 6, 2018 β€” GPIOCTL(8), periodt. Stay slay, bestie! πŸ’–

πŸ“¦ where this page comes from