PWM LED example for SAM.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | INIT_DUTY_VALUE 0 |
Initial duty cycle value. More... | |
#define | PERIOD_VALUE 100 |
Period value of PWM output waveform. More... | |
#define | PWM_FREQUENCY 1000 |
PWM frequency in Hz. More... | |
#define | STRING_EOL "\r" |
#define | STRING_HEADER |
Functions | |
static void | configure_console (void) |
Configure the Console UART. More... | |
int | main (void) |
Application entry point for PWM with LED example. More... | |
void | PWM0_Handler (void) |
Interrupt handler for the PWM controller. More... | |
Variables | |
pwm_channel_t | g_pwm_channel_led |
PWM channel instance for LEDs. More... | |
#define INIT_DUTY_VALUE 0 |
Initial duty cycle value.
Referenced by main(), and PWM0_Handler().
#define PERIOD_VALUE 100 |
Period value of PWM output waveform.
Referenced by main(), and PWM0_Handler().
#define PWM_FREQUENCY 1000 |
PWM frequency in Hz.
Referenced by main(), and PWM0_Handler().
#define STRING_EOL "\r" |
#define STRING_HEADER |
Referenced by main().
|
static |
Configure the Console UART.
References uart_rs232_options::baudrate, CONF_UART, CONF_UART_BAUDRATE, CONF_UART_CHAR_LENGTH, CONF_UART_PARITY, CONF_UART_STOP_BITS, CONSOLE_UART_ID, stdio_serial_init(), and sysclk_enable_peripheral_clock().
Referenced by main().
int main | ( | void | ) |
Application entry point for PWM with LED example.
Output PWM waves on LEDs to make them fade in and out.
References pwm_channel_t::alignment, board_init(), pwm_channel_t::channel, configure_console(), INIT_DUTY_VALUE, PERIOD_VALUE, PIN_PWM_LED0_CHANNEL, PIN_PWM_LED1_CHANNEL, pmc_enable_periph_clk(), pwm_channel_t::polarity, PWM_ALIGN_CENTER, PWM_ALIGN_LEFT, pwm_channel_disable(), pwm_channel_disable_interrupt(), pwm_channel_enable(), pwm_channel_enable_interrupt(), pwm_channel_init(), PWM_FREQUENCY, PWM_HIGH, pwm_init(), PWM_LOW, STRING_HEADER, sysclk_get_cpu_hz(), sysclk_get_peripheral_hz(), sysclk_init(), pwm_clock_t::ul_clka, pwm_channel_t::ul_duty, pwm_channel_t::ul_period, and pwm_channel_t::ul_prescaler.
void PWM0_Handler | ( | void | ) |
Interrupt handler for the PWM controller.
References pwm_channel_t::channel, INIT_DUTY_VALUE, PERIOD_VALUE, PIN_PWM_LED0_CHANNEL, PIN_PWM_LED1_CHANNEL, pwm_channel_get_interrupt_status(), pwm_channel_update_duty(), and PWM_FREQUENCY.
pwm_channel_t g_pwm_channel_led |
PWM channel instance for LEDs.