Old PWM API
[PWM driver]

This API has strong limititations, so it has been deprecated. More...

Functions

void pwm_setPolarity (PwmDev dev, bool pol)
 Set PWM polarity of pwm dev.
void pwm_setDuty (PwmDev dev, pwm_duty_t duty)
 Set duty of PWM channel dev.
void pwm_setFrequency (PwmDev dev, pwm_freq_t freq)
 Set frequency of PWM channel dev at freq.
void pwm_enable (PwmDev dev, bool state)
 Enable/Disable PWM channel dev.
void pwm_init (void)
 Initialize the PWM driver.

Detailed Description

This API has strong limititations, so it has been deprecated.

It is active by default for backward compatibility reasons, but for new projects please use the new PWM API. In order to disable this API, check CFG_PWM_ENABLE_OLD_API.

See also:
PWM API
CFG_PWM_ENABLE_OLD_API

Function Documentation

void pwm_enable ( PwmDev  dev,
bool  state 
)

Enable/Disable PWM channel dev.

Parameters:
dev PWM channel.
state if true the PWM on dev is activated, if false is disabled.

Definition at line 103 of file pwm.c.

void pwm_init ( void   ) 

Initialize the PWM driver.

Warning:
all available PWM channels are initialized.

Definition at line 117 of file pwm.c.

void pwm_setDuty ( PwmDev  dev,
pwm_duty_t  duty 
)

Set duty of PWM channel dev.

The current output frequency will be maintained.

Parameters:
dev PWM channel.
duty the new duty cycle.

Definition at line 69 of file pwm.c.

void pwm_setFrequency ( PwmDev  dev,
pwm_freq_t  freq 
)

Set frequency of PWM channel dev at freq.

Parameters:
dev PWM channel.
freq new frequency, in Hz.
Warning:
This function has to be called with PWM disabled, otherwise the output value will be undefined. The current duty cycle value will be lost, after calling this function the duty cycle have to be set again.

Definition at line 93 of file pwm.c.

void pwm_setPolarity ( PwmDev  dev,
bool  pol 
) [inline]

Set PWM polarity of pwm dev.

Parameters:
dev PWM channel.
pol if false positive polarity pulses are generated, if true negative polarity pulses are generated.
Warning:
This function has to be called with PWM disabled, otherwise the output value will be undefined.

Definition at line 152 of file pwm.h.