Allows control of 2 independent PWM channels. A limited subset of GPIO pins can be connected to one of these 2 channels, allowing PWM control of GPIO pins. You have to set the desired pin into a particular Alt Fun to PWM output. See the PWM documentation on the Main Page.
◆ bcm2835_pwm_set_clock()
void bcm2835_pwm_set_clock |
( |
uint32_t |
divisor | ) |
|
Sets the PWM clock divisor, to control the basic PWM pulse widths.
- Parameters
-
[in] | divisor | Divides the basic 19.2MHz PWM clock. You can use one of the common values BCM2835_PWM_CLOCK_DIVIDER_* in bcm2835PWMClockDivider |
◆ bcm2835_pwm_set_data()
void bcm2835_pwm_set_data |
( |
uint8_t |
channel, |
|
|
uint32_t |
data |
|
) |
| |
Sets the PWM pulse ratio to emit to DATA/RANGE, where RANGE is set by bcm2835_pwm_set_range().
- Parameters
-
[in] | channel | The PWM channel. 0 or 1. |
[in] | data | Controls the PWM output ratio as a fraction of the range. Can vary from 0 to RANGE. |
◆ bcm2835_pwm_set_mode()
void bcm2835_pwm_set_mode |
( |
uint8_t |
channel, |
|
|
uint8_t |
markspace, |
|
|
uint8_t |
enabled |
|
) |
| |
Sets the mode of the given PWM channel, allowing you to control the PWM mode and enable/disable that channel
- Parameters
-
[in] | channel | The PWM channel. 0 or 1. |
[in] | markspace | Set true if you want Mark-Space mode. 0 for Balanced mode. |
[in] | enabled | Set true to enable this channel and produce PWM pulses. |
◆ bcm2835_pwm_set_range()
void bcm2835_pwm_set_range |
( |
uint8_t |
channel, |
|
|
uint32_t |
range |
|
) |
| |
Sets the maximum range of the PWM output. The data value can vary between 0 and this range to control PWM output
- Parameters
-
[in] | channel | The PWM channel. 0 or 1. |
[in] | range | The maximum value permitted for DATA. |