GPIOPWM(4)

πŸ“¦ version 11.0, in nixpkgs unstable

🌸 NAME 🌸

Okay bestie, welcome to GPIOPWM(4), straight outta the Kernel Interfaces Manual. This page is all about gpiopwm β€” support for pulsing GPIO pins in software. πŸ’–

✨ SYNOPSIS ✨

gpiopwm* at gpio? offset ? mask 1
gpiopwm* at gpio?

πŸ’– DESCRIPTION πŸ’–

The gpiopwm driver lets you pulse GPIO pins in software using the callout(9) facility. No cap. The pulse frequency and duty cycle are specified indirectly by setting an β€œon” and β€œoff” period, in ticks. Both values are accessible as sysctl(3) variables. Ngl, it’s giving lowkey elegant. ✨

πŸŽ€ SYSCTL VARIABLES πŸŽ€

These sysctl(3) variables are the main characters for defining the pulsing:

  • hw.gpiopwmN.off β€” define the β€œoff” period in ticks.
  • hw.gpiopwmN.on β€” define the β€œon” period in ticks.

Pulsing only starts when both the β€œon” and the β€œoff” period are set to values higher than zero. To stop the pulsing, set either value to zero. That’s it, periodt. πŸ’…

πŸ¦‹ EXAMPLES πŸ¦‹

To pulse a pin on a machine with 100 ticks/second with a frequency of 1Hz and a duty cycle of 20%, the β€œon” period must be set to 20 and the β€œoff” period must be set to 80. The following example will pulse the error LED of a Soekris net4801 with a frequency of 1 Hz and a duty cycle of 20%:

# gpioctl gpio0 20 set pp
# gpioctl gpio0 attach gpiopwm 20 1
# sysctl -w hw.gpiopwm0.off=80
# sysctl -w hw.gpiopwm0.on=20

πŸ”₯ SEE ALSO πŸ”₯

Go give these a vibe check, bestie:

⭐ HISTORY ⭐

The gpiopwm driver first appeared in NetBSD 6.0. Iconic behavior, honestly. 🫢

πŸ‘‘ AUTHORS πŸ‘‘

The gpiopwm driver was written by Marc Balmer <marc@msys.ch>. Slay. πŸ’œ


mwah πŸ’‹ this page is from Debian, dated November 13, 2011, and it’s GPIOPWM(4) β€” periodt.

πŸ“¦ where this page comes from