Appiko
|
Hardware abstraction layer of the PWM peripheral in the nRF52 SoCs. More...
Data Structures | |
struct | hal_pwm_sequence_config_t |
Configuration for a sequence of PWM values. Note that the buffer pointed to in this structure needs to have a lifetime longer than the duration of the PWM. More... | |
struct | hal_pwm_init_t |
Struct for initializing the hal pwm module. More... | |
struct | hal_pwm_start_t |
Struct containing the configuration for starting the hal pwm module. More... | |
Macros | |
#define | PWM_USED HAL_PWM_PERIPH_USED |
#define | HAL_PWM_MAX_PIN_NUM 4 |
Enumerations | |
enum | hal_pwm_freq_t { , HAL_PWM_FREQ_8MHz = PWM_PRESCALER_PRESCALER_DIV_2, HAL_PWM_FREQ_4MHz = PWM_PRESCALER_PRESCALER_DIV_4, HAL_PWM_FREQ_2MHz = PWM_PRESCALER_PRESCALER_DIV_8, HAL_PWM_FREQ_1MHz = PWM_PRESCALER_PRESCALER_DIV_16, HAL_PWM_FREQ_500kHz = PWM_PRESCALER_PRESCALER_DIV_32, HAL_PWM_FREQ_250kHz = PWM_PRESCALER_PRESCALER_DIV_64, HAL_PWM_FREQ_125kHz = PWM_PRESCALER_PRESCALER_DIV_128 } |
Select the PWM frequency to operate at. More... | |
enum | hal_pwm_mode_t { HAL_PWM_MODE_UP = PWM_MODE_UPDOWN_Up, HAL_PWM_MODE_UP_DOWN = PWM_MODE_UPDOWN_UpAndDown } |
Select the operating mode of the PWM wave counter. More... | |
enum | hal_pwm_short_mask_t { HAL_PWM_SHORT_SEQEND0_STOP_MASK = PWM_SHORTS_SEQEND0_STOP_Msk, HAL_PWM_SHORT_SEQEND1_STOP_MASK = PWM_SHORTS_SEQEND1_STOP_Msk, HAL_PWM_SHORT_LOOPSDONE_SEQSTART0_MASK = PWM_SHORTS_LOOPSDONE_SEQSTART0_Msk, HAL_PWM_SHORT_LOOPSDONE_SEQSTART1_MASK = PWM_SHORTS_LOOPSDONE_SEQSTART1_Msk, HAL_PWM_SHORT_LOOPSDONE_STOP_MASK = PWM_SHORTS_LOOPSDONE_STOP_Msk } |
Bit masks for the PWM shortcuts. Or the appropriate ones for the required shortcuts. More... | |
enum | hal_pwm_decoder_load_t { HAL_PWM_LOAD_COMMON = PWM_DECODER_LOAD_Common, HAL_PWM_LOAD_GROUPED = PWM_DECODER_LOAD_Grouped, HAL_PWM_LOAD_INDIVIDUAL = PWM_DECODER_LOAD_Individual, HAL_PWM_LOAD_WAVE_FORM = PWM_DECODER_LOAD_WaveForm } |
PWM decoder's data load modes. This mode selects how the different channels' next value is loaded from the data read from the RAM. More... | |
enum | hal_pwm_dec_trigger_t { HAL_PWM_STEP_INTERNAL = PWM_DECODER_MODE_RefreshCount, HAL_PWM_STEP_EXTERNAL = PWM_DECODER_MODE_NextStep } |
PWM decoder's next load trigger modes. This selects when the next value is loaded from RAM. More... | |
enum | hal_pwm_irq_mask_t { HAL_PWM_IRQ_STOPPED_MASK = PWM_INTENSET_STOPPED_Msk, HAL_PWM_IRQ_SEQSTARTED0_MASK = PWM_INTENSET_SEQSTARTED0_Msk, HAL_PWM_IRQ_SEQSTARTED1_MASK = PWM_INTENSET_SEQSTARTED1_Msk, HAL_PWM_IRQ_SEQEND0_MASK = PWM_INTENSET_SEQEND0_Msk, HAL_PWM_IRQ_SEQEND1_MASK = PWM_INTENSET_SEQEND1_Msk, HAL_PWM_IRQ_PWMPERIODEND_MASK = PWM_INTENSET_PWMPERIODEND_Msk, HAL_PWM_IRQ_LOOPSDONE_MASK = PWM_INTENSET_LOOPSDONE_Msk } |
PWM interrupts. More... | |
Functions | |
void | hal_pwm_init (hal_pwm_init_t *init_config) |
Initialize the HAL PWM module. Can be called again to change the initialization configuration. More... | |
void | hal_pwm_start (hal_pwm_start_t *start_config) |
Start the PWM generation based on the configuration provided. More... | |
void | hal_pwm_stop (void) |
Stop the PWM generation. | |
#define HAL_PWM_MAX_PIN_NUM 4 |
#define PWM_USED HAL_PWM_PERIPH_USED |
enum hal_pwm_freq_t |
enum hal_pwm_irq_mask_t |
enum hal_pwm_mode_t |
enum hal_pwm_short_mask_t |
void hal_pwm_init | ( | hal_pwm_init_t * | init_config | ) |
init_config | Pointer to the configuration for the initialization |
Definition at line 126 of file hal_pwm.c.
References ASSERT, HAL_PWM_MAX_PIN_NUM, and hal_pwm_init_t::pin_num.
void hal_pwm_start | ( | hal_pwm_start_t * | start_config | ) |
start_config | Pointer to the configuration for the PWM to start |
Definition at line 192 of file hal_pwm.c.
References ASSERT, hal_pwm_start_t::countertop, hal_pwm_start_t::decoder_load, hal_pwm_start_t::decoder_trigger, hal_pwm_sequence_config_t::end_delay, HAL_PWM_LOAD_WAVE_FORM, HAL_PWM_MAX_PIN_NUM, hal_pwm_start_t::interrupt_masks, hal_pwm_start_t::irq_handler, hal_pwm_sequence_config_t::len, hal_pwm_start_t::loop, hal_pwm_sequence_config_t::repeats, hal_pwm_start_t::seq_config, hal_pwm_sequence_config_t::seq_values, and hal_pwm_start_t::shorts_mask.