PWM SYNC example for SAM.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
Macros | |
#define | DUTY_BUFFER_LENGTH ((PERIOD_VALUE - INIT_DUTY_VALUE + 1) * 3) |
Duty cycle buffer length for three channels. More... | |
#define | INIT_DEAD_TIME 5 |
Initial dead time value. More... | |
#define | INIT_DUTY_VALUE 0 |
Initial duty cycle value. More... | |
#define | MAX_SYNC_UPDATE_PERIOD PWM_SCUP_UPR_Msk |
Maximum synchronous update period. More... | |
#define | PERIOD_VALUE 50 |
PWM period value. More... | |
#define | PWM_FREQUENCY 50 |
PWM frequency in Hz. More... | |
#define | STRING_EOL "\r" |
#define | STRING_HEADER |
Functions | |
static void | configure_console (void) |
Configure the Console UART. More... | |
static void | display_menu (void) |
Display menu. More... | |
static uint8_t | get_num_value (void) |
Get numeric value from console. More... | |
int | main (void) |
Application entry point for PWM PDC example. More... | |
void | PWM_Handler (void) |
Interrupt handler for the PWM controller. More... | |
Variables | |
pdc_packet_t | g_pdc_tx_packet |
PDC transfer packet. More... | |
uint16_t | g_us_duty_buffer [DUTY_BUFFER_LENGTH] |
Duty cycle buffer for PDC transfer. More... | |
#define DUTY_BUFFER_LENGTH ((PERIOD_VALUE - INIT_DUTY_VALUE + 1) * 3) |
Duty cycle buffer length for three channels.
Referenced by main(), and PWM_Handler().
#define INIT_DEAD_TIME 5 |
Initial dead time value.
Referenced by main().
#define INIT_DUTY_VALUE 0 |
Initial duty cycle value.
Referenced by main().
#define MAX_SYNC_UPDATE_PERIOD PWM_SCUP_UPR_Msk |
Maximum synchronous update period.
Referenced by main().
#define PERIOD_VALUE 50 |
PWM period value.
Referenced by main().
#define PWM_FREQUENCY 50 |
PWM frequency in Hz.
Referenced by main().
#define STRING_EOL "\r" |
#define STRING_HEADER |
Referenced by main().
|
static |
Configure the Console UART.
References uart_rs232_options::baudrate, stdio_serial_init(), and sysclk_enable_peripheral_clock().
Referenced by main().
|
static |
Display menu.
Referenced by main().
|
static |
Get numeric value from console.
References uart_read().
Referenced by main().
int main | ( | void | ) |
Application entry point for PWM PDC example.
References board_init(), pwm_channel_t::channel, configure_console(), display_menu(), DUTY_BUFFER_LENGTH, g_us_duty_buffer, get_num_value(), INIT_DEAD_TIME, INIT_DUTY_VALUE, MAX_SYNC_UPDATE_PERIOD, pdc_enable_transfer(), pdc_tx_init(), PERIOD_VALUE, pmc_enable_periph_clk(), pwm_channel_disable(), pwm_channel_enable(), pwm_channel_init(), PWM_FREQUENCY, PWM_HIGH, pwm_init(), PWM_LOW, STRING_HEADER, sysclk_get_cpu_hz(), sysclk_init(), uart_read(), pdc_packet::ul_addr, pwm_clock_t::ul_clka, pwm_channel_t::ul_prescaler, and pdc_packet::ul_size.
void PWM_Handler | ( | void | ) |
Interrupt handler for the PWM controller.
References DUTY_BUFFER_LENGTH, g_us_duty_buffer, pdc_enable_transfer(), pdc_tx_init(), pdc_packet::ul_addr, and pdc_packet::ul_size.
pdc_packet_t g_pdc_tx_packet |
PDC transfer packet.
uint16_t g_us_duty_buffer[DUTY_BUFFER_LENGTH] |
Duty cycle buffer for PDC transfer.
Referenced by main(), and PWM_Handler().