See Quickstart guide for SAM PWM module.
Driver for the PWM (Pulse Width Modulation). This driver provides access to the main features of the PWM controller.
Macros | |
#define | PWM_CLOCK_DIV_MAX 256 |
#define | PWM_CLOCK_PRE_MAX 11 |
#define | PWM_WPCR_WPCMD_DISABLE_SW_PROT (PWM_WPCR_WPCMD(0)) |
#define | PWM_WPCR_WPCMD_ENABLE_HW_PROT (PWM_WPCR_WPCMD(2)) |
#define | PWM_WPCR_WPCMD_ENABLE_SW_PROT (PWM_WPCR_WPCMD(1)) |
#define | PWM_WPCR_WPKEY_PASSWD 0x50574D00 |
Functions | |
void | pwm_channel_disable (Pwm *p_pwm, uint32_t ul_channel) |
Disable the PWM channel. More... | |
void | pwm_channel_disable_interrupt (Pwm *p_pwm, uint32_t ul_event, uint32_t ul_fault) |
Disable the interrupt of a channel counter event and fault protection. More... | |
void | pwm_channel_enable (Pwm *p_pwm, uint32_t ul_channel) |
Enable the PWM channel. More... | |
void | pwm_channel_enable_interrupt (Pwm *p_pwm, uint32_t ul_event, uint32_t ul_fault) |
Enable the interrupt of a channel counter event and fault protection. More... | |
uint32_t | pwm_channel_get_counter (Pwm *p_pwm, pwm_channel_t *p_channel) |
Return channel counter value. More... | |
uint32_t | pwm_channel_get_interrupt_mask (Pwm *p_pwm) |
Get channel counter event and fault protection trigger interrupt mask. More... | |
uint32_t | pwm_channel_get_interrupt_status (Pwm *p_pwm) |
Get channel counter event and fault protection trigger interrupt status. More... | |
uint32_t | pwm_channel_get_status (Pwm *p_pwm) |
Check which PWM channel is enabled. More... | |
uint32_t | pwm_channel_init (Pwm *p_pwm, pwm_channel_t *p_channel) |
Initialize one PWM channel. More... | |
void | pwm_channel_update_dead_time (Pwm *p_pwm, pwm_channel_t *p_channel, uint16_t us_deadtime_pwmh, uint16_t us_deadtime_pwml) |
Change dead-time value for PWM outputs. More... | |
uint32_t | pwm_channel_update_duty (Pwm *p_pwm, pwm_channel_t *p_channel, uint32_t ul_duty) |
Change the duty cycle of the PWM channel. More... | |
void | pwm_channel_update_output (Pwm *p_pwm, pwm_channel_t *p_channel, pwm_output_t *p_output, bool b_sync) |
Change output selection of the PWM channel. More... | |
uint32_t | pwm_channel_update_period (Pwm *p_pwm, pwm_channel_t *p_channel, uint32_t ul_period) |
Change the period of the PWM channel. More... | |
void | pwm_channel_update_polarity_mode (Pwm *p_pwm, pwm_channel_t *p_channel, bool polarity_inversion_flag, pwm_level_t polarity_value) |
Change polarity mode. More... | |
void | pwm_channel_update_spread (Pwm *p_pwm, pwm_channel_t *p_channel, uint32_t ul_spread) |
Change spread spectrum value. More... | |
static uint32_t | pwm_clocks_generate (uint32_t ul_frequency, uint32_t ul_mck) |
Find a prescaler/divisor couple to generate the desired ul_frequency from ul_mck. More... | |
uint32_t | pwm_cmp_change_setting (Pwm *p_pwm, pwm_cmp_t *p_cmp) |
Change the setting of PWM comparison. More... | |
void | pwm_cmp_disable_interrupt (Pwm *p_pwm, uint32_t ul_sources, pwm_cmp_interrupt_t type) |
Disable the interrupt of comparison. More... | |
void | pwm_cmp_enable_interrupt (Pwm *p_pwm, uint32_t ul_sources, pwm_cmp_interrupt_t type) |
Enable the interrupt of comparison. More... | |
uint32_t | pwm_cmp_get_period_counter (Pwm *p_pwm, uint32_t ul_cmp_unit) |
Report the value of the comparison period counter. More... | |
uint32_t | pwm_cmp_get_update_counter (Pwm *p_pwm, uint32_t ul_cmp_unit) |
Report the value of the comparison update period counter. More... | |
uint32_t | pwm_cmp_init (Pwm *p_pwm, pwm_cmp_t *p_cmp) |
Initialize PWM comparison unit. More... | |
void | pwm_disable_protect (Pwm *p_pwm, uint32_t ul_group) |
Disable PWM write protect. More... | |
void | pwm_enable_protect (Pwm *p_pwm, uint32_t ul_group, bool b_sw) |
Enable PWM write protect. More... | |
void | pwm_fault_clear_status (Pwm *p_pwm, pwm_fault_id_t id) |
Clear a fault input. More... | |
pwm_level_t | pwm_fault_get_input_level (Pwm *p_pwm, pwm_fault_id_t id) |
Get the level of a fault input. More... | |
uint32_t | pwm_fault_get_status (Pwm *p_pwm) |
Get fault status. More... | |
uint32_t | pwm_fault_init (Pwm *p_pwm, pwm_fault_t *p_fault) |
Initialize the behavior of a fault input. More... | |
uint32_t | pwm_get_interrupt_mask (Pwm *p_pwm) |
Get interrupt mask of PDC transfer, synchronous channels and comparison. More... | |
uint32_t | pwm_get_interrupt_status (Pwm *p_pwm) |
Get interrupt status of PDC transfer, synchronous channels and comparison. More... | |
bool | pwm_get_protect_status (Pwm *p_pwm, pwm_protect_t *p_protect) |
Get PWM write protect status. More... | |
uint32_t | pwm_init (Pwm *p_pwm, pwm_clock_t *clock_config) |
Initialize the PWM source clock (clock A and clock B). More... | |
void | pwm_pdc_disable_interrupt (Pwm *p_pwm, uint32_t ul_sources) |
Disable the interrupt of PDC transfer. More... | |
void | pwm_pdc_enable_interrupt (Pwm *p_pwm, uint32_t ul_sources) |
Enable the interrupt of PDC transfer. More... | |
void | pwm_pdc_set_request_mode (Pwm *p_pwm, pwm_pdc_request_mode_t request_mode, uint32_t ul_cmp_unit) |
Set PDC transfer request mode. More... | |
void | pwm_set_dma_duty (Pwm *p_pwm, uint32_t ul_dma_duty_value) |
Set dma duty. More... | |
void | pwm_set_ext_trigger_mode (Pwm *p_pwm, pwm_channel_t *p_channel, uint32_t ul_mode) |
set external trigger mode. More... | |
void | pwm_stepper_motor_init (Pwm *p_pwm, pwm_stepper_motor_pair_t pair, bool b_enable_gray, bool b_down) |
Initialize PWM stepper motor mode. More... | |
void | pwm_sync_change_period (Pwm *p_pwm, uint32_t ul_update_period) |
Change the wanted time between each update of the synchronous channels. More... | |
void | pwm_sync_disable_interrupt (Pwm *p_pwm, uint32_t ul_sources) |
Disable the interrupt of synchronous channels. More... | |
void | pwm_sync_enable_interrupt (Pwm *p_pwm, uint32_t ul_sources) |
Enable the interrupt of synchronous channel. More... | |
uint32_t | pwm_sync_get_period_counter (Pwm *p_pwm) |
Get the value of the synchronization update period counter. More... | |
uint32_t | pwm_sync_init (Pwm *p_pwm, pwm_sync_update_mode_t mode, uint32_t ul_update_period) |
Initialize synchronous channels update mode and period. More... | |
void | pwm_sync_unlock_update (Pwm *p_pwm) |
Unlock the update of synchronous channels. More... | |
#define PWM_CLOCK_DIV_MAX 256 |
Referenced by pwm_clocks_generate().
#define PWM_CLOCK_PRE_MAX 11 |
Referenced by pwm_clocks_generate().
#define PWM_WPCR_WPCMD_DISABLE_SW_PROT (PWM_WPCR_WPCMD(0)) |
Referenced by pwm_disable_protect().
#define PWM_WPCR_WPCMD_ENABLE_HW_PROT (PWM_WPCR_WPCMD(2)) |
Referenced by pwm_enable_protect().
#define PWM_WPCR_WPCMD_ENABLE_SW_PROT (PWM_WPCR_WPCMD(1)) |
Referenced by pwm_enable_protect().
#define PWM_WPCR_WPKEY_PASSWD 0x50574D00 |
Referenced by pwm_disable_protect(), and pwm_enable_protect().
void pwm_channel_disable | ( | Pwm * | p_pwm, |
uint32_t | ul_channel | ||
) |
Disable the PWM channel.
p_pwm | Pointer to a PWM instance. |
ul_channel | PWM channel number to disable. |
Referenced by main().
void pwm_channel_disable_interrupt | ( | Pwm * | p_pwm, |
uint32_t | ul_event, | ||
uint32_t | ul_fault | ||
) |
Disable the interrupt of a channel counter event and fault protection.
p_pwm | Pointer to a PWM instance. |
ul_event | Bitmask of channel number to disable counter event interrupt. |
ul_fault | Bitmask of channel number to disable fault protection interrupt(ignored by SAM3N/SAM4N/SAM4C/SAM4CP/SAM4CM). |
References UNUSED.
Referenced by main().
void pwm_channel_enable | ( | Pwm * | p_pwm, |
uint32_t | ul_channel | ||
) |
Enable the PWM channel.
p_pwm | Pointer to a PWM instance. |
ul_channel | PWM channel number to enable. |
Referenced by main().
void pwm_channel_enable_interrupt | ( | Pwm * | p_pwm, |
uint32_t | ul_event, | ||
uint32_t | ul_fault | ||
) |
Enable the interrupt of a channel counter event and fault protection.
p_pwm | Pointer to a PWM instance. |
ul_event | Channel number to enable counter event interrupt. |
ul_fault | Channel number to enable fault protection interrupt(ignored by SAM3N/SAM4N/SAM4C/SAM4CP/SAM4CM). |
References UNUSED.
Referenced by main().
uint32_t pwm_channel_get_counter | ( | Pwm * | p_pwm, |
pwm_channel_t * | p_channel | ||
) |
Return channel counter value.
p_pwm | Pointer to a PWM instance. |
p_channel | Configurations of the specified PWM channel. |
References pwm_channel_t::channel.
uint32_t pwm_channel_get_interrupt_mask | ( | Pwm * | p_pwm | ) |
Get channel counter event and fault protection trigger interrupt mask.
p_pwm | Pointer to a PWM instance. |
uint32_t pwm_channel_get_interrupt_status | ( | Pwm * | p_pwm | ) |
Get channel counter event and fault protection trigger interrupt status.
p_pwm | Pointer to a PWM instance. |
Referenced by PWM0_Handler().
uint32_t pwm_channel_get_status | ( | Pwm * | p_pwm | ) |
Check which PWM channel is enabled.
p_pwm | Pointer to a PWM instance. |
p_channel | Configurations of the specified PWM channel. |
uint32_t pwm_channel_init | ( | Pwm * | p_pwm, |
pwm_channel_t * | p_channel | ||
) |
Initialize one PWM channel.
p_pwm | Pointer to a PWM instance. |
p_channel | Configurations of the specified PWM channel. |
0 | if initialization succeeds, otherwise fails. |
References pwm_channel_t::alignment, pwm_channel_t::b_deadtime_generator, pwm_output_t::b_override_pwmh, pwm_output_t::b_override_pwml, pwm_channel_t::b_pwmh_output_inverted, pwm_channel_t::b_pwml_output_inverted, pwm_channel_t::b_sync_ch, pwm_channel_t::channel, pwm_channel_t::counter_event, pwm_channel_t::fault_id, pwm_channel_t::output_selection, pwm_output_t::override_level_pwmh, pwm_output_t::override_level_pwml, pwm_channel_t::polarity, PWM_HIGH, PWM_HIGHZ, PWM_SPREAD_SPECTRUM_MODE_RANDOM, pwm_channel_t::spread_spectrum_mode, pwm_channel_t::ul_duty, pwm_channel_t::ul_fault_output_pwmh, pwm_channel_t::ul_fault_output_pwml, pwm_channel_t::ul_period, pwm_channel_t::ul_prescaler, and pwm_channel_t::ul_spread.
Referenced by main().
void pwm_channel_update_dead_time | ( | Pwm * | p_pwm, |
pwm_channel_t * | p_channel, | ||
uint16_t | us_deadtime_pwmh, | ||
uint16_t | us_deadtime_pwml | ||
) |
Change dead-time value for PWM outputs.
p_pwm | Pointer to a PWM instance. |
p_channel | Configurations of the specified PWM channel. |
us_deadtime_pwmh | New dead-time value for PWMH output. |
us_deadtime_pwml | New dead-time value for PWML output. |
References pwm_channel_t::channel, pwm_channel_t::us_deadtime_pwmh, and pwm_channel_t::us_deadtime_pwml.
uint32_t pwm_channel_update_duty | ( | Pwm * | p_pwm, |
pwm_channel_t * | p_channel, | ||
uint32_t | ul_duty | ||
) |
Change the duty cycle of the PWM channel.
p_pwm | Pointer to a PWM instance. |
p_channel | Configurations of the specified PWM channel. |
ul_duty | New duty cycle value. |
0 | if changing succeeds, otherwise fails. |
Check parameter
References pwm_channel_t::channel, PWM_INVALID_ARGUMENT, pwm_channel_t::ul_duty, and pwm_channel_t::ul_period.
Referenced by PWM0_Handler().
void pwm_channel_update_output | ( | Pwm * | p_pwm, |
pwm_channel_t * | p_channel, | ||
pwm_output_t * | p_output, | ||
bool | b_sync | ||
) |
Change output selection of the PWM channel.
p_pwm | Pointer to a PWM instance. |
p_channel | Configurations of the specified PWM channel. |
p_output | New PWM channel output selection. |
b_sync | Boolean of changing of output selection. Set true to change the output synchronously (at the beginning of the next PWM period). Set false to change the output asynchronously (at the end of the execution of the function). |
References pwm_output_t::b_override_pwmh, pwm_output_t::b_override_pwml, pwm_channel_t::channel, pwm_channel_t::output_selection, pwm_output_t::override_level_pwmh, and pwm_output_t::override_level_pwml.
uint32_t pwm_channel_update_period | ( | Pwm * | p_pwm, |
pwm_channel_t * | p_channel, | ||
uint32_t | ul_period | ||
) |
Change the period of the PWM channel.
p_pwm | Pointer to a PWM instance. |
p_channel | Configurations of the specified PWM channel. |
ul_period | New period value. |
0 | if changing succeeds, otherwise fails. |
Check parameter
References pwm_channel_t::channel, PWM_INVALID_ARGUMENT, pwm_channel_t::ul_duty, and pwm_channel_t::ul_period.
void pwm_channel_update_polarity_mode | ( | Pwm * | p_pwm, |
pwm_channel_t * | p_channel, | ||
bool | polarity_inversion_flag, | ||
pwm_level_t | polarity_value | ||
) |
Change polarity mode.
p_pwm | Pointer to a PWM instance. |
p_channel | Configurations of the specified PWM channel. |
polarity_inversion_flag | Polarity invertion. |
polarity_flag | Polarity value. |
References pwm_channel_t::channel, pwm_channel_t::polarity, and PWM_HIGH.
void pwm_channel_update_spread | ( | Pwm * | p_pwm, |
pwm_channel_t * | p_channel, | ||
uint32_t | ul_spread | ||
) |
Change spread spectrum value.
p_pwm | Pointer to a PWM instance. |
p_channel | Configurations of the specified PWM channel. |
ul_spread | New spread spectrum value. |
References pwm_channel_t::ul_spread.
|
static |
Find a prescaler/divisor couple to generate the desired ul_frequency from ul_mck.
ul_frequency | Desired frequency in Hz. |
ul_mck | Master clock frequency in Hz. |
Return | the value to be set in the PWM Clock Register (PWM Mode Register for SAM3N/SAM4N/SAM4C/SAM4CP/SAM4CM) or PWM_INVALID_ARGUMENT if the configuration cannot be met. |
References PWM_CLOCK_DIV_MAX, PWM_CLOCK_PRE_MAX, and PWM_INVALID_ARGUMENT.
Referenced by pwm_init().
uint32_t pwm_cmp_change_setting | ( | Pwm * | p_pwm, |
pwm_cmp_t * | p_cmp | ||
) |
Change the setting of PWM comparison.
p_pwm | Pointer to a PWM instance. |
p_cmp | Configurations of PWM comparison tagged by unit. |
0 | if changing succeeds, otherwise fails. |
Boolean of generating a match pulse
Boolean of generating a match pulse
Boolean of comparison enable
References pwm_cmp_t::b_enable, pwm_cmp_t::b_is_decrementing, pwm_cmp_t::b_pulse_on_line_0, pwm_cmp_t::b_pulse_on_line_1, pwm_cmp_t::ul_period, pwm_cmp_t::ul_trigger, pwm_cmp_t::ul_update_period, pwm_cmp_t::ul_value, and pwm_cmp_t::unit.
void pwm_cmp_disable_interrupt | ( | Pwm * | p_pwm, |
uint32_t | ul_sources, | ||
pwm_cmp_interrupt_t | type | ||
) |
Disable the interrupt of comparison.
p_pwm | Pointer to a PWM instance. |
ul_sources | Bitmask of comparison unit. |
type | PWM_CMP_MATCH disables the match interrupt of the unit. PWM_CMP_UPDATE disables the update interrupt of the comparison unit. |
References PWM_CMP_MATCH, and PWM_CMP_UPDATE.
void pwm_cmp_enable_interrupt | ( | Pwm * | p_pwm, |
uint32_t | ul_sources, | ||
pwm_cmp_interrupt_t | type | ||
) |
Enable the interrupt of comparison.
p_pwm | Pointer to a PWM instance. |
ul_sources | Bitmask of comparison unit. |
type | PWM_CMP_MATCH enables the match interrupt of the unit. PWM_CMP_UPDATE enables the update interrupt of the comparison unit. |
References PWM_CMP_MATCH, and PWM_CMP_UPDATE.
uint32_t pwm_cmp_get_period_counter | ( | Pwm * | p_pwm, |
uint32_t | ul_cmp_unit | ||
) |
Report the value of the comparison period counter.
p_pwm | Pointer to a PWM instance. |
ul_cmp_unit | PWM comparison unit number. |
uint32_t pwm_cmp_get_update_counter | ( | Pwm * | p_pwm, |
uint32_t | ul_cmp_unit | ||
) |
Report the value of the comparison update period counter.
p_pwm | Pointer to a PWM instance. |
ul_cmp_unit | PWM comparison unit number. |
uint32_t pwm_cmp_init | ( | Pwm * | p_pwm, |
pwm_cmp_t * | p_cmp | ||
) |
Initialize PWM comparison unit.
p_pwm | Pointer to a PWM instance. |
p_cmp | Configurations of PWM comparison tagged by unit. |
0 | if initialization succeeds, otherwise fails. |
Boolean of generating a match pulse
Boolean of generating a match pulse
Boolean of comparison enable
References pwm_cmp_t::b_enable, pwm_cmp_t::b_is_decrementing, pwm_cmp_t::b_pulse_on_line_0, pwm_cmp_t::b_pulse_on_line_1, pwm_cmp_t::ul_period, pwm_cmp_t::ul_trigger, pwm_cmp_t::ul_update_period, pwm_cmp_t::ul_value, and pwm_cmp_t::unit.
void pwm_disable_protect | ( | Pwm * | p_pwm, |
uint32_t | ul_group | ||
) |
Disable PWM write protect.
p_pwm | Pointer to a PWM instance. |
ul_group | Bitmask of PWM register group. |
References PWM_WPCR_WPCMD_DISABLE_SW_PROT, and PWM_WPCR_WPKEY_PASSWD.
void pwm_enable_protect | ( | Pwm * | p_pwm, |
uint32_t | ul_group, | ||
bool | b_sw | ||
) |
Enable PWM write protect.
p_pwm | Pointer to a PWM instance. |
ul_group | Bitmask of PWM register group. |
b_sw | Boolean of software protect. True for software protect and false for hardware protect. |
References PWM_WPCR_WPCMD_ENABLE_HW_PROT, PWM_WPCR_WPCMD_ENABLE_SW_PROT, and PWM_WPCR_WPKEY_PASSWD.
void pwm_fault_clear_status | ( | Pwm * | p_pwm, |
pwm_fault_id_t | id | ||
) |
Clear a fault input.
p_pwm | Pointer to a PWM instance. |
id | Faulty ID. |
pwm_level_t pwm_fault_get_input_level | ( | Pwm * | p_pwm, |
pwm_fault_id_t | id | ||
) |
uint32_t pwm_fault_get_status | ( | Pwm * | p_pwm | ) |
Get fault status.
p_pwm | Pointer to a PWM instance. |
uint32_t pwm_fault_init | ( | Pwm * | p_pwm, |
pwm_fault_t * | p_fault | ||
) |
Initialize the behavior of a fault input.
p_pwm | Pointer to a PWM instance. |
p_fault | Configurations of a fault input. |
0 | if configuration succeeds, otherwise fails. |
Polarity of fault input
Boolean of clearing fault flag
Boolean of fault filtering
References pwm_fault_t::b_clear, pwm_fault_t::b_filtered, pwm_fault_t::fault_id, pwm_fault_t::polarity, and PWM_HIGH.
uint32_t pwm_get_interrupt_mask | ( | Pwm * | p_pwm | ) |
Get interrupt mask of PDC transfer, synchronous channels and comparison.
p_pwm | Pointer to a PWM instance. |
uint32_t pwm_get_interrupt_status | ( | Pwm * | p_pwm | ) |
Get interrupt status of PDC transfer, synchronous channels and comparison.
p_pwm | Pointer to a PWM instance. |
bool pwm_get_protect_status | ( | Pwm * | p_pwm, |
pwm_protect_t * | p_protect | ||
) |
Get PWM write protect status.
p_pwm | Pointer to a PWM instance. |
p_protect | Pointer to a structure stored PWM protect status. |
0 | Protection disabled. |
1 | Protection enabled. |
Bitmask of PWM register group for write protect software status
References pwm_protect_t::ul_hw_status, pwm_protect_t::ul_offset, and pwm_protect_t::ul_sw_status.
uint32_t pwm_init | ( | Pwm * | p_pwm, |
pwm_clock_t * | clock_config | ||
) |
Initialize the PWM source clock (clock A and clock B).
p_pwm | Pointer to a PWM instance. |
clock_config | PWM clock configuration. |
0 | if initialization succeeds, otherwise fails. |
References pwm_clocks_generate(), PWM_INVALID_ARGUMENT, pwm_clock_t::ul_clka, pwm_clock_t::ul_clkb, and pwm_clock_t::ul_mck.
Referenced by main().
void pwm_pdc_disable_interrupt | ( | Pwm * | p_pwm, |
uint32_t | ul_sources | ||
) |
Disable the interrupt of PDC transfer.
p_pwm | Pointer to a PWM instance. |
ul_sources | Bitmask of PWM PDC transfer interrupt sources. |
void pwm_pdc_enable_interrupt | ( | Pwm * | p_pwm, |
uint32_t | ul_sources | ||
) |
Enable the interrupt of PDC transfer.
p_pwm | Pointer to a PWM instance. |
ul_sources | Bitmask of PWM PDC transfer interrupt sources. |
void pwm_pdc_set_request_mode | ( | Pwm * | p_pwm, |
pwm_pdc_request_mode_t | request_mode, | ||
uint32_t | ul_cmp_unit | ||
) |
Set PDC transfer request mode.
p_pwm | Pointer to a PWM instance. |
request_mode | PDC transfer request mode. |
ul_cmp_unit | PWM comparison unit number for PDC transfer request. |
void pwm_set_dma_duty | ( | Pwm * | p_pwm, |
uint32_t | ul_dma_duty_value | ||
) |
Set dma duty.
p_pwm | Pointer to a PWM instance. |
ul_dma_duty_value | The dma duty to be set. |
void pwm_set_ext_trigger_mode | ( | Pwm * | p_pwm, |
pwm_channel_t * | p_channel, | ||
uint32_t | ul_mode | ||
) |
set external trigger mode.
p_pwm | Pointer to a PWM instance. |
p_channel | Configurations of the specified PWM channel. |
ul_mode | The external trigger mode to be set. |
References pwm_channel_t::channel.
void pwm_stepper_motor_init | ( | Pwm * | p_pwm, |
pwm_stepper_motor_pair_t | pair, | ||
bool | b_enable_gray, | ||
bool | b_down | ||
) |
Initialize PWM stepper motor mode.
p_pwm | Pointer to a PWM instance. |
pair | PWM channels used by stepper motor. |
b_enable_gray | Set true to enable gray count generation. Set false to disable it. |
b_down | Set true to use down counter. Set false to use up counter. |
void pwm_sync_change_period | ( | Pwm * | p_pwm, |
uint32_t | ul_update_period | ||
) |
Change the wanted time between each update of the synchronous channels.
p_pwm | Pointer to a PWM instance. |
ul_update_period | Time between each update of the synchronous channels. |
void pwm_sync_disable_interrupt | ( | Pwm * | p_pwm, |
uint32_t | ul_sources | ||
) |
Disable the interrupt of synchronous channels.
p_pwm | Pointer to a PWM instance. |
ul_sources | Bitmask of PWM synchronous channels interrupt sources. |
void pwm_sync_enable_interrupt | ( | Pwm * | p_pwm, |
uint32_t | ul_sources | ||
) |
Enable the interrupt of synchronous channel.
p_pwm | Pointer to a PWM instance. |
ul_sources | Bitmask of PWM synchronous channels interrupt sources. |
uint32_t pwm_sync_get_period_counter | ( | Pwm * | p_pwm | ) |
Get the value of the synchronization update period counter.
p_pwm | Pointer to a PWM instance. |
uint32_t pwm_sync_init | ( | Pwm * | p_pwm, |
pwm_sync_update_mode_t | mode, | ||
uint32_t | ul_update_period | ||
) |
Initialize synchronous channels update mode and period.
p_pwm | Pointer to a PWM instance. |
mode | Synchronous channels update mode. |
ul_update_period | Time between each update of the synchronous channels. |
0 | if initialization succeeds, otherwise fails. |
void pwm_sync_unlock_update | ( | Pwm * | p_pwm | ) |
Unlock the update of synchronous channels.
p_pwm | Pointer to a PWM instance. |