GPIOPWM(4)
πΈ 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
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2011 Marc Balmer <marc@msys.ch>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms