Pulse Width Modulation (PWM) driver for SAM.
Copyright (c) 2011-2019 Microchip Technology Inc. and its subsidiaries.
#include "pwm.h"
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... | |
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... | |
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... | |
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_init (Pwm *p_pwm, pwm_clock_t *clock_config) |
Initialize the PWM source clock (clock A and clock B). More... | |