Microchip® Advanced Software Framework

pwm.h File Reference

Pulse Width Modulation (PWM) driver for SAM.

Copyright (c) 2011-2019 Microchip Technology Inc. and its subsidiaries.

#include "compiler.h"

Data Structures

struct  pwm_channel_t
 Input parameters when configuring a PWM channel mode. More...
 
struct  pwm_clock_t
 Input parameters when initializing PWM. More...
 

Macros

#define PWM_INVALID_ARGUMENT   0xFFFF
 

Typedefs

typedef enum _pwm_ch_t pwm_ch_t
 Definitions for PWM channel number. More...
 

Enumerations

enum  _pwm_ch_t {
  PWM_CHANNEL_0 = 0,
  PWM_CHANNEL_1 = 1,
  PWM_CHANNEL_2 = 2,
  PWM_CHANNEL_3 = 3
}
 Definitions for PWM channel number. More...
 
enum  pwm_align_t {
  PWM_ALIGN_LEFT = (0 << 8),
  PWM_ALIGN_CENTER = (1 << 8)
}
 Definitions for PWM channel alignment. More...
 
enum  pwm_level_t {
  PWM_LOW = LOW,
  PWM_HIGH = HIGH
}
 Definitions for PWM level. More...
 

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...
 
uint32_t pwm_init (Pwm *p_pwm, pwm_clock_t *clock_config)
 Initialize the PWM source clock (clock A and clock B). More...
 

#define PWM_INVALID_ARGUMENT   0xFFFF

typedef enum _pwm_ch_t pwm_ch_t

Definitions for PWM channel number.

enum _pwm_ch_t

Definitions for PWM channel number.

Enumerator
PWM_CHANNEL_0 
PWM_CHANNEL_1 
PWM_CHANNEL_2 
PWM_CHANNEL_3 

Definitions for PWM channel alignment.

Enumerator
PWM_ALIGN_LEFT 
PWM_ALIGN_CENTER 

Definitions for PWM level.

Enumerator
PWM_LOW 
PWM_HIGH