Appiko
|
A simple driver to get three PWM channels. This PWM module uses three GPIOTE channels and six PPI channels. More...
Macros | |
#define | SIMPLE_PWM_TIMER_USED TIMER_USED_SIMPLE_PWM |
#define | SIMPLE_PWM_CC_COUNT CONCAT_3(TIMER, SIMPLE_PWM_TIMER_USED, _CC_NUM) |
The number of CC registers in the RTC peripheral used for MS timer. | |
#define | SIMPLE_PWM_GPIOTE_START_CH 0 |
Three GPIOTE channels are used from this number for this module. | |
Enumerations | |
enum | simple_pwm_timer_freq_t { SIMPLE_PWM_TIMER_FREQ_16MHz = 0, SIMPLE_PWM_TIMER_FREQ_8MHz, SIMPLE_PWM_TIMER_FREQ_4MHz, SIMPLE_PWM_TIMER_FREQ_2MHz, SIMPLE_PWM_TIMER_FREQ_1MHz, SIMPLE_PWM_TIMER_FREQ_500kHz, SIMPLE_PWM_TIMER_FREQ_250kHz, SIMPLE_PWM_TIMER_FREQ_125kHz, SIMPLE_PWM_TIMER_FREQ_62500Hz, SIMPLE_PWM_TIMER_FREQ_31250Hz } |
Defines for the frequency at which the timer should run for the PWM generation. More... | |
enum | simple_pwm_channel_t { SIMPLE_PWM_CHANNEL0, SIMPLE_PWM_CHANNEL1, SIMPLE_PWM_CHANNEL2 } |
Defines for specifying the three PWM channels. More... | |
Functions | |
void | simple_pwm_init (simple_pwm_timer_freq_t freq, uint32_t max_count) |
Function to initiate PWM module with clock frequency and total time of pulse. More... | |
void | simple_pwm_channel_setup (simple_pwm_channel_t channel, uint32_t pwm_out_pin, uint32_t value) |
Function to setup a channel. More... | |
void | simple_pwm_start () |
Function to start PWM signals. | |
void | simple_pwm_stop () |
Function to stop PWM signals. | |
#define SIMPLE_PWM_TIMER_USED TIMER_USED_SIMPLE_PWM |
Specify which Timer peripheral would be used for the simple PWM module
Definition at line 43 of file simple_pwm.h.
enum simple_pwm_channel_t |
Enumerator | |
---|---|
SIMPLE_PWM_CHANNEL0 | SIMPLE_PWM_CHANNEL0. |
SIMPLE_PWM_CHANNEL1 | SIMPLE_PWM_CHANNEL1. |
SIMPLE_PWM_CHANNEL2 | SIMPLE_PWM_CHANNEL2. |
Definition at line 74 of file simple_pwm.h.
Definition at line 57 of file simple_pwm.h.
void simple_pwm_channel_setup | ( | simple_pwm_channel_t | channel, |
uint32_t | pwm_out_pin, | ||
uint32_t | value | ||
) |
channel | Channel which is to be set. |
pwm_out_pin | Output GPIO pin where PWM signal is desired |
value | Number of pulses. i.e. on time in ticks |
Definition at line 58 of file simple_pwm.c.
void simple_pwm_init | ( | simple_pwm_timer_freq_t | freq, |
uint32_t | max_count | ||
) |
freq | Frequency at which driving clock works. |
max_count | Max number of pulses possible. i.e. total time in ticks |
Definition at line 38 of file simple_pwm.c.