|
SAM4SD32 (SAM4S-EK2)
|
See Quickstart guide for SAM PWM module. More...
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. | |
| 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. | |
| void | pwm_channel_enable (Pwm *p_pwm, uint32_t ul_channel) |
| Enable the PWM channel. | |
| 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. | |
| uint32_t | pwm_channel_get_counter (Pwm *p_pwm, pwm_channel_t *p_channel) |
| Return channel counter value. | |
| uint32_t | pwm_channel_get_interrupt_mask (Pwm *p_pwm) |
| Get channel counter event and fault protection trigger interrupt mask. | |
| uint32_t | pwm_channel_get_interrupt_status (Pwm *p_pwm) |
| Get channel counter event and fault protection trigger interrupt status. | |
| uint32_t | pwm_channel_get_status (Pwm *p_pwm) |
| Check which PWM channel is enabled. | |
| uint32_t | pwm_channel_init (Pwm *p_pwm, pwm_channel_t *p_channel) |
| Initialize one PWM channel. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| uint32_t | pwm_cmp_change_setting (Pwm *p_pwm, pwm_cmp_t *p_cmp) |
| Change the setting of PWM comparison. | |
| void | pwm_cmp_disable_interrupt (Pwm *p_pwm, uint32_t ul_sources, pwm_cmp_interrupt_t type) |
| Disable the interrupt of comparison. | |
| void | pwm_cmp_enable_interrupt (Pwm *p_pwm, uint32_t ul_sources, pwm_cmp_interrupt_t type) |
| Enable the interrupt of comparison. | |
| uint32_t | pwm_cmp_get_period_counter (Pwm *p_pwm, uint32_t ul_cmp_unit) |
| Report the value of the comparison period counter. | |
| uint32_t | pwm_cmp_get_update_counter (Pwm *p_pwm, uint32_t ul_cmp_unit) |
| Report the value of the comparison update period counter. | |
| uint32_t | pwm_cmp_init (Pwm *p_pwm, pwm_cmp_t *p_cmp) |
| Initialize PWM comparison unit. | |
| void | pwm_disable_protect (Pwm *p_pwm, uint32_t ul_group) |
| Disable PWM write protect. | |
| void | pwm_enable_protect (Pwm *p_pwm, uint32_t ul_group, bool b_sw) |
| Enable PWM write protect. | |
| void | pwm_fault_clear_status (Pwm *p_pwm, pwm_fault_id_t id) |
| Clear a fault input. | |
| pwm_level_t | pwm_fault_get_input_level (Pwm *p_pwm, pwm_fault_id_t id) |
| Get the level of a fault input. | |
| uint32_t | pwm_fault_get_status (Pwm *p_pwm) |
| Get fault status. | |
| uint32_t | pwm_fault_init (Pwm *p_pwm, pwm_fault_t *p_fault) |
| Initialize the behavior of a fault input. | |
| uint32_t | pwm_get_interrupt_mask (Pwm *p_pwm) |
| Get interrupt mask of PDC transfer, synchronous channels and comparison. | |
| uint32_t | pwm_get_interrupt_status (Pwm *p_pwm) |
| Get interrupt status of PDC transfer, synchronous channels and comparison. | |
| bool | pwm_get_protect_status (Pwm *p_pwm, pwm_protect_t *p_protect) |
| Get PWM write protect status. | |
| uint32_t | pwm_init (Pwm *p_pwm, pwm_clock_t *clock_config) |
| Initialize the PWM source clock (clock A and clock B). | |
| void | pwm_pdc_disable_interrupt (Pwm *p_pwm, uint32_t ul_sources) |
| Disable the interrupt of PDC transfer. | |
| void | pwm_pdc_enable_interrupt (Pwm *p_pwm, uint32_t ul_sources) |
| Enable the interrupt of PDC transfer. | |
| 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. | |
| 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. | |
| void | pwm_sync_change_period (Pwm *p_pwm, uint32_t ul_update_period) |
| Change the wanted 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. | |
| void | pwm_sync_enable_interrupt (Pwm *p_pwm, uint32_t ul_sources) |
| Enable the interrupt of synchronous channel. | |
| uint32_t | pwm_sync_get_period_counter (Pwm *p_pwm) |
| Get the value of the synchronization update period counter. | |
| 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. | |
| void | pwm_sync_unlock_update (Pwm *p_pwm) |
| Unlock the update of synchronous channels. | |
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.
| #define PWM_CLOCK_DIV_MAX 256 |
Definition at line 74 of file pwm.c.
Referenced by pwm_clocks_generate().
| #define PWM_CLOCK_PRE_MAX 11 |
Definition at line 75 of file pwm.c.
Referenced by pwm_clocks_generate().
| #define PWM_WPCR_WPCMD_DISABLE_SW_PROT (PWM_WPCR_WPCMD(0)) |
Definition at line 63 of file pwm.c.
Referenced by pwm_disable_protect().
| #define PWM_WPCR_WPCMD_ENABLE_HW_PROT (PWM_WPCR_WPCMD(2)) |
Definition at line 71 of file pwm.c.
Referenced by pwm_enable_protect().
| #define PWM_WPCR_WPCMD_ENABLE_SW_PROT (PWM_WPCR_WPCMD(1)) |
Definition at line 67 of file pwm.c.
Referenced by pwm_enable_protect().
| #define PWM_WPCR_WPKEY_PASSWD 0x50574D00 |
Definition at line 59 of file pwm.c.
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. |
Definition at line 410 of file pwm.c.
References Pwm::PWM_DIS.
| 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). |
Definition at line 488 of file pwm.c.
References Pwm::PWM_IDR1.
| 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. |
Definition at line 397 of file pwm.c.
References Pwm::PWM_ENA.
| 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). |
Definition at line 467 of file pwm.c.
References Pwm::PWM_IER1.
| 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. |
Definition at line 383 of file pwm.c.
References pwm_channel_t::channel, PwmCh_num::PWM_CCNT, and Pwm::PWM_CH_NUM.
| 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. |
Definition at line 450 of file pwm.c.
References Pwm::PWM_IMR1.
| 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. |
Definition at line 434 of file pwm.c.
References Pwm::PWM_ISR1.
| uint32_t pwm_channel_get_status | ( | Pwm * | p_pwm | ) |
Check which PWM channel is enabled.
| p_pwm | Pointer to a PWM instance. |
Definition at line 422 of file pwm.c.
References Pwm::PWM_SR.
| 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. |
Definition at line 160 of file pwm.c.
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, PwmCh_num::PWM_CDTY, Pwm::PWM_CH_NUM, PwmCh_num::PWM_CMR, PwmCh_num::PWM_CPRD, PwmCh_num::PWM_DT, PWM_DT_DTH, PWM_DT_DTL, Pwm::PWM_FPE, Pwm::PWM_FPV, PWM_HIGH, Pwm::PWM_OOV, PWM_OOV_OOVH0, PWM_OOV_OOVL0, Pwm::PWM_OS, PWM_OS_OSH0, PWM_OS_OSL0, Pwm::PWM_SCM, pwm_channel_t::ul_duty, pwm_channel_t::ul_fault_output_pwmh, pwm_channel_t::ul_fault_output_pwml, pwm_channel_t::ul_period, and pwm_channel_t::ul_prescaler.
| 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. |
Definition at line 554 of file pwm.c.
References pwm_channel_t::channel, Pwm::PWM_CH_NUM, PwmCh_num::PWM_DTUPD, PWM_DTUPD_DTHUPD, PWM_DTUPD_DTLUPD, 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
Definition at line 348 of file pwm.c.
References pwm_channel_t::channel, PwmCh_num::PWM_CDTYUPD, Pwm::PWM_CH_NUM, PwmCh_num::PWM_CMR, PWM_INVALID_ARGUMENT, pwm_channel_t::ul_duty, and pwm_channel_t::ul_period.
| 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). |
Definition at line 510 of file pwm.c.
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, pwm_output_t::override_level_pwml, Pwm::PWM_OOV, PWM_OOV_OOVH0, PWM_OOV_OOVL0, Pwm::PWM_OSC, Pwm::PWM_OSCUPD, Pwm::PWM_OSS, and Pwm::PWM_OSSUPD.
| 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
Definition at line 314 of file pwm.c.
References pwm_channel_t::channel, Pwm::PWM_CH_NUM, PwmCh_num::PWM_CMR, PwmCh_num::PWM_CPRDUPD, PWM_INVALID_ARGUMENT, pwm_channel_t::ul_duty, and pwm_channel_t::ul_period.
|
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. |
Definition at line 87 of file pwm.c.
References PWM_CLOCK_DIV_MAX, PWM_CLOCK_PRE_MAX, and PWM_INVALID_ARGUMENT.
Referenced by pwm_init().
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
Definition at line 696 of file pwm.c.
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::PWM_CMP, PWM_CMPM_CEN, PWM_CMPM_CPR, PWM_CMPM_CTR, PWM_CMPM_CUPR, PwmCmp::PWM_CMPMUPD, PWM_CMPV_CV, PwmCmp::PWM_CMPVUPD, Pwm::PWM_ELMR, 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. |
Definition at line 787 of file pwm.c.
References PWM_CMP_MATCH, PWM_CMP_UPDATE, and Pwm::PWM_IDR2.
| 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. |
Definition at line 767 of file pwm.c.
References PWM_CMP_MATCH, PWM_CMP_UPDATE, and Pwm::PWM_IER2.
| 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. |
Definition at line 739 of file pwm.c.
References Pwm::PWM_CMP, PwmCmp::PWM_CMPM, PWM_CMPM_CPRCNT, and PWM_CMPM_CPRCNT_Pos.
| 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. |
Definition at line 753 of file pwm.c.
References Pwm::PWM_CMP, PwmCmp::PWM_CMPM, PWM_CMPM_CUPRCNT, and PWM_CMPM_CUPRCNT_Pos.
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
Definition at line 653 of file pwm.c.
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::PWM_CMP, PwmCmp::PWM_CMPM, PWM_CMPM_CEN, PWM_CMPM_CPR, PWM_CMPM_CTR, PWM_CMPM_CUPR, PwmCmp::PWM_CMPV, PWM_CMPV_CV, Pwm::PWM_ELMR, 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. |
Definition at line 956 of file pwm.c.
References Pwm::PWM_WPCR, 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. |
Definition at line 933 of file pwm.c.
References Pwm::PWM_WPCR, 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. |
Definition at line 640 of file pwm.c.
References Pwm::PWM_FCR.
| pwm_level_t pwm_fault_get_input_level | ( | Pwm * | p_pwm, |
| pwm_fault_id_t | id ) |
Get the level of a fault input.
| p_pwm | Pointer to a PWM instance. |
| id | Faulty ID. |
Definition at line 626 of file pwm.c.
References Pwm::PWM_FSR, PWM_HIGH, and PWM_LOW.
| uint32_t pwm_fault_get_status | ( | Pwm * | p_pwm | ) |
Get fault status.
| p_pwm | Pointer to a PWM instance. |
Definition at line 613 of file pwm.c.
References Pwm::PWM_FSR.
| 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
Definition at line 577 of file pwm.c.
References pwm_fault_t::b_clear, pwm_fault_t::b_filtered, pwm_fault_t::fault_id, pwm_fault_t::polarity, Pwm::PWM_FMR, 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. |
Definition at line 1008 of file pwm.c.
References Pwm::PWM_IMR2.
| 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. |
Definition at line 996 of file pwm.c.
References Pwm::PWM_ISR2.
| 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
Definition at line 971 of file pwm.c.
References Pwm::PWM_WPSR, PWM_WPSR_WPVS, PWM_WPSR_WPVSRC_Msk, PWM_WPSR_WPVSRC_Pos, 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. |
Definition at line 119 of file pwm.c.
References Pwm::PWM_CLK, pwm_clocks_generate(), PWM_INVALID_ARGUMENT, pwm_clock_t::ul_clka, pwm_clock_t::ul_clkb, and pwm_clock_t::ul_mck.
| 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. |
Definition at line 839 of file pwm.c.
References Pwm::PWM_IDR2.
| 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. |
Definition at line 828 of file pwm.c.
References Pwm::PWM_IER2.
| 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. |
Definition at line 809 of file pwm.c.
References Pwm::PWM_SCM, PWM_SCM_PTRCS, PWM_SCM_PTRCS_Msk, and PWM_SCM_PTRM.
| 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. |
Definition at line 1023 of file pwm.c.
References Pwm::PWM_SMMR, PWM_SMMR_DOWN0, and PWM_SMMR_GCEN0.
| 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. |
Definition at line 887 of file pwm.c.
References Pwm::PWM_SCUPUPD, and PWM_SCUPUPD_UPRUPD.
| 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. |
Definition at line 921 of file pwm.c.
References Pwm::PWM_IDR2.
| 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. |
Definition at line 910 of file pwm.c.
References Pwm::PWM_IER2.
| 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. |
Definition at line 899 of file pwm.c.
References Pwm::PWM_SCUP, and PWM_SCUP_UPRCNT.
| 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. |
Definition at line 854 of file pwm.c.
References Pwm::PWM_SCM, PWM_SCM_UPDM_Msk, Pwm::PWM_SCUP, and PWM_SCUP_UPR.
| void pwm_sync_unlock_update | ( | Pwm * | p_pwm | ) |
Unlock the update of synchronous channels.
| p_pwm | Pointer to a PWM instance. |
Definition at line 876 of file pwm.c.
References Pwm::PWM_SCUC, and PWM_SCUC_UPDULOCK.