![]() |
EVE 1.0
|
![]() |
Data Structures | |
struct | pwm_state_t |
struct | pwm_channel_config_t |
struct | pwm_t |
Macros | |
#define | PWM_NUM_CHANNELS 4 |
Functions called from application programs | |
void | PwmInit (const struct pwm_t *Pwm) |
Name: PwmInit Initialize PWM. More... | |
void | PwmSet (const struct pwm_t *Pwm, uint8_t Channel, uint16_t Value) |
Name: PwmSet Sets PWM duty cycle for the selected channel. More... | |
void | PwmFrequencySet (const struct pwm_t *Pwm, uint32_t Frequency) |
Name: PwmFrequencySet Sets the PWM frequency. This frequency will be used for all channels on the selected timer. More... | |
void | PwmInterruptHandler (const struct pwm_t *Pwm) |
Name: PwmInterruptHandler PWM interrupt handler Called from board.c at hardware interrupt context. More... | |
This PWM driver can be used for PWM0, PWM1 and PWM2. For each PWM instance, state variables must be initilalized in RAM, and configuration data must be initilalized in FLASH.
The state variable is of type struct pwm_state_t, and is used to hold a copy of used PWM values. The variable should not be initialized.
The configuration data is of type struct pwm_t, and is used to set:
The timer is counting from 0 to TOP value. TOP value = (16 MHz clock / (2^Prescaler) / Frequency). Care must be taken to obtain enough resolution. Set Prescaler as low as possible.
void PwmInit | ( | const struct pwm_t * | Pwm | ) |
Name: PwmInit
Initialize PWM.
Pwm | Configuration structure for PWM to be used. |
void PwmSet | ( | const struct pwm_t * | Pwm, |
uint8_t | Channel, | ||
uint16_t | Value | ||
) |
Name: PwmSet
Sets PWM duty cycle for the selected channel.
Pwm | Configuration structure for PWM to be used. |
Channel | 0-2 |
Value | PWM active time (0 to Range set in struct pwm_t) |
void PwmFrequencySet | ( | const struct pwm_t * | Pwm, |
uint32_t | Frequency | ||
) |
Name: PwmFrequencySet
Sets the PWM frequency. This frequency will be used for all channels on the selected timer.
Pwm | Configuration structure for PWM to be used. |
Frequency | The frequency in Hz for the generated PWM |
void PwmInterruptHandler | ( | const struct pwm_t * | Pwm | ) |
Name: PwmInterruptHandler
PWM interrupt handler Called from board.c at hardware interrupt context.
Pwm | PWM instance |