EVE 1.0
Collaboration diagram for nRF52 PWM driver:

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...
 

Detailed Description

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.

Macro Definition Documentation

#define PWM_NUM_CHANNELS   4

Number of PWM channels available

Definition at line 81 of file pwm.h.

Function Documentation

void PwmInit ( const struct pwm_t Pwm)

Name: PwmInit
Initialize PWM.

Parameters
PwmConfiguration 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.

Parameters
PwmConfiguration structure for PWM to be used.
Channel0-2
ValuePWM 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.

Parameters
PwmConfiguration structure for PWM to be used.
FrequencyThe 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.

Parameters
PwmPWM instance