pwm(3)
π pwm(3) β Pulse Width Modulation π
okay bestie, welcome to the pwm glow-up π
this is a page from the bcm2835 library, and it's all about making your GPIO pins pulse like they're at a concert πΆ no cap.
β¨ NAME β¨
pwm β Pulse Width Modulation π
π¦ SYNOPSIS π¦
Functions π
void bcm2835_pwm_set_clock (uint32_t divisor)
void bcm2835_pwm_set_mode (uint8_t channel, uint8_t markspace, uint8_t enabled)
void bcm2835_pwm_set_range (uint8_t channel, uint32_t range)
void bcm2835_pwm_set_data (uint8_t channel, uint32_t data)
π Detailed Description π
So here's the tea π: this lets you control 2 independent PWM channels. A limited subset of GPIO pins can be connected to one of these 2 channels, and that's how you get PWM control of GPIO pins. It's giving remote control for your pins, periodt.
You have to set the desired pin into a particular Alt Fun to PWM output. See the PWM documentation on the Main Page. iykyk π
π Function Documentation π
void bcm2835_pwm_set_clock (uint32_t divisor) [extern]
Sets the PWM clock divisor, to control the basic PWM pulse widths. literally the speed dial for your pulses β¨
Parameters π«Ά
divisorβ Divides the basic 19.2MHz PWM clock. You can use one of the common valuesBCM2835_PWM_CLOCK_DIVIDER_*inbcm2835PWMClockDivider. iconic little menu of presets π
void bcm2835_pwm_set_data (uint8_t channel, uint32_t data) [extern]
Sets the PWM pulse ratio to emit to DATA/RANGE, where RANGE is set by bcm2835_pwm_set_range(). it's giving fraction energy π
Parameters π«Ά
channelβ The PWM channel.0or1.dataβ Controls the PWM output ratio as a fraction of the range. Can vary from0toRANGE.
void bcm2835_pwm_set_mode (uint8_t channel, uint8_t markspace, uint8_t enabled) [extern]
Sets the mode of the given PWM channel, allowing you to control the PWM mode and enable/disable that channel. main character energy fr fr π
Parameters π«Ά
channelβ The PWM channel.0or1.markspaceβ Set true if you want Mark-Space mode.0for Balanced mode.enabledβ Set true to enable this channel and produce PWM pulses. no pulses if you leave this off bestie, don't do that π
void bcm2835_pwm_set_range (uint8_t channel, uint32_t range) [extern]
Sets the maximum range of the PWM output. The data value can vary between 0 and this range to control PWM output. it's the ceiling, the limit, the vibe check πΈ
Parameters π«Ά
channelβ The PWM channel.0or1.rangeβ The maximum value permitted forDATA.
π Author π
Generated automatically by Doxygen for bcm2835 from the source code. not a human author, just a very efficient little robot π§β¨
π that's the whole page bestie! go forth and modulate those pulses π
okay and for the cute sign-off: this whole thing is bcm2835, Version 1.75, and it's the pwm(3) page from the Library Functions Manual. slay π
πβ
π¦ where this page comes from
- debian trixie: libbcm2835-dev 1.75+ds-1 Β· GPL-3.0-only
- ubuntu noble: libbcm2835-dev 1.75+ds-1 Β· GPL-3.0-only
- ubuntu questing: libbcm2835-dev 1.75+ds-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms