MySensors Library & Examples  2.3.2-62-ge298769
Functions
Pulse Width Modulation

Detailed Description

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.

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)
 

Function Documentation

◆ 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]divisorDivides 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]channelThe PWM channel. 0 or 1.
[in]dataControls 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]channelThe PWM channel. 0 or 1.
[in]markspaceSet true if you want Mark-Space mode. 0 for Balanced mode.
[in]enabledSet 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]channelThe PWM channel. 0 or 1.
[in]rangeThe maximum value permitted for DATA.