Example to illustrate the basic PWMA Function of generating waveform to two different PWMA channels.
Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.
#include <asf.h>
Macros | |
Example Configuration | |
#define | EXAMPLE_PWMA_GCLK_ID AVR32_SCIF_GCLK_PWMA |
GCLK number for PWMA Module. More... | |
#define | EXAMPLE_PWMA_GCLK_FREQUENCY 48000000 |
Output frequency of the PWMA Generic clock. More... | |
#define | EXAMPLE_PWMA_GCLK_SOURCE AVR32_SCIF_GC_USES_CLK_PBA |
Source for PWMA Generic clock. More... | |
#define | EXAMPLE_PWMA_OUTPUT_FREQUENCY 2000000 |
PWMA output frequency. More... | |
#define | EXAMPLE_PWMA_CHANNEL_ID1 11 |
Channel index number of PWMA Module. More... | |
#define | EXAMPLE_PWMA_PIN1 AVR32_PWMA_11_PIN |
Corresponding GPIO pin number of the EXAMPLE_PWMA_CHANNEL_ID1. More... | |
#define | EXAMPLE_PWMA_FUNCTION1 AVR32_PWMA_11_FUNCTION |
Corresponding pin function number of EXAMPLE_PWMA_PIN1. More... | |
#define | EXAMPLE_PWMA_CHANNEL_ID2 27 |
Channel index number of PWMA Module. More... | |
#define | EXAMPLE_PWMA_PIN2 AVR32_PWMA_27_PIN |
Corresponding GPIO pin number of the EXAMPLE_PWMA_CHANNEL_ID2. More... | |
#define | EXAMPLE_PWMA_FUNCTION2 AVR32_PWMA_27_FUNCTION |
Corresponding pin function number of EXAMPLE_PWMA_PIN2. More... | |
#define | ERROR_LED LED2_GPIO |
LED Shows the status of the PWMA configuration. More... | |
#define | PWMA_SPREAD 10 |
SPREAD value to be loaded to the PWMA Module. More... | |
#define | PWMA_INTERRUPT_PRIORITY 0 |
Priority level of the PWMA interrupt. More... | |
Functions | |
ISR (tofl_irq, AVR32_PWMA_IRQ_GROUP, PWMA_INTERRUPT_PRIORITY) | |
TOFL ISR Routine. More... | |
int | main (void) |
Main Application Routine -Initialize the system clocks -Configure and Enable the PWMA Generic clock -Configure and Enable the PWMA Module -Load Duty cycle value using Interlinked multi-value mode -Register and Enable the Interrupt -Enter into sleep mode . More... | |
Variables | |
volatile avr32_pwma_t * | pwma = &AVR32_PWMA |
Global variable to Store the PWMA module address. More... | |
#define ERROR_LED LED2_GPIO |
LED Shows the status of the PWMA configuration.
Referenced by main(), and pwma_init().
#define EXAMPLE_PWMA_CHANNEL_ID1 11 |
Channel index number of PWMA Module.
Referenced by main().
#define EXAMPLE_PWMA_CHANNEL_ID2 27 |
Channel index number of PWMA Module.
Referenced by main().
#define EXAMPLE_PWMA_FUNCTION1 AVR32_PWMA_11_FUNCTION |
Corresponding pin function number of EXAMPLE_PWMA_PIN1.
Referenced by main().
#define EXAMPLE_PWMA_FUNCTION2 AVR32_PWMA_27_FUNCTION |
Corresponding pin function number of EXAMPLE_PWMA_PIN2.
Referenced by main().
#define EXAMPLE_PWMA_GCLK_FREQUENCY 48000000 |
Output frequency of the PWMA Generic clock.
Referenced by init_pwm(), main(), and pwma_init().
#define EXAMPLE_PWMA_GCLK_ID AVR32_SCIF_GCLK_PWMA |
GCLK number for PWMA Module.
Referenced by main(), and pwma_init().
#define EXAMPLE_PWMA_GCLK_SOURCE AVR32_SCIF_GC_USES_CLK_PBA |
Source for PWMA Generic clock.
Referenced by main(), and pwma_init().
#define EXAMPLE_PWMA_OUTPUT_FREQUENCY 2000000 |
PWMA output frequency.
Referenced by main(), and pwma_init().
#define EXAMPLE_PWMA_PIN1 AVR32_PWMA_11_PIN |
Corresponding GPIO pin number of the EXAMPLE_PWMA_CHANNEL_ID1.
Referenced by main().
#define EXAMPLE_PWMA_PIN2 AVR32_PWMA_27_PIN |
Corresponding GPIO pin number of the EXAMPLE_PWMA_CHANNEL_ID2.
Referenced by main().
#define PWMA_INTERRUPT_PRIORITY 0 |
Priority level of the PWMA interrupt.
Referenced by main().
#define PWMA_SPREAD 10 |
SPREAD value to be loaded to the PWMA Module.
Referenced by main().
ISR | ( | tofl_irq | , |
AVR32_PWMA_IRQ_GROUP | , | ||
PWMA_INTERRUPT_PRIORITY | |||
) |
TOFL ISR Routine.
tofl_irq | ISR Routine name |
AVR32_PWMA_IRQ_GROUP | Group under which the PWMA interrupt lies |
PWMA_INTERRUPT_PRIORITY | Priority level of the interrupt |
References pwma.
int main | ( | void | ) |
Main Application Routine -Initialize the system clocks
-Configure and Enable the PWMA Generic clock
-Configure and Enable the PWMA Module
-Load Duty cycle value using Interlinked multi-value mode
-Register and Enable the Interrupt
-Enter into sleep mode
.
References cpu_irq_disable, cpu_irq_enable, delay_init, delay_ms, div_ceil, ERROR_LED, EXAMPLE_PWMA_CHANNEL_ID1, EXAMPLE_PWMA_CHANNEL_ID2, EXAMPLE_PWMA_FUNCTION1, EXAMPLE_PWMA_FUNCTION2, EXAMPLE_PWMA_GCLK_FREQUENCY, EXAMPLE_PWMA_GCLK_ID, EXAMPLE_PWMA_GCLK_SOURCE, EXAMPLE_PWMA_OUTPUT_FREQUENCY, EXAMPLE_PWMA_PIN1, EXAMPLE_PWMA_PIN2, FAIL, genclk_enable_config(), gpio_enable_module(), gpio_tgl_gpio_pin(), irq_initialize_vectors, irq_register_handler, pm_sleep(), pwma, pwma_config_enable(), PWMA_INTERRUPT_PRIORITY, pwma_set_multiple_values(), PWMA_SPREAD, sysclk_get_cpu_hz(), sysclk_get_pba_hz(), and sysclk_init().
volatile avr32_pwma_t* pwma = &AVR32_PWMA |
Global variable to Store the PWMA module address.