Microchip® Advanced Software Framework

tc_capture_waveform_example.c File Reference

TC Capture Waveform Example for SAM.

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

#include <asf.h>
#include <conf_board.h>
#include <conf_clock.h>

Data Structures

struct  waveconfig_t
 [tc_capture_selection] More...
 

Macros

#define STRING_EOL   "\r"
 
#define STRING_HEADER
 
#define TC_CAPTURE_TIMER_SELECTION   TC_CMR_TCCLKS_TIMER_CLOCK3
 [tc_capture_selection] More...
 

Functions

static void configure_console (void)
 [tc_capture_irq_handler_end] More...
 
static void display_menu (void)
 Display the user menu on the UART. More...
 
int main (void)
 Application entry point for tc_capture_waveform example. More...
 
static void tc_capture_initialize (void)
 Configure TC TC_CHANNEL_CAPTURE in capture operating mode. More...
 
void TC_Handler (void)
 [tc_capture_init] More...
 
static void tc_waveform_initialize (void)
 Configure TC TC_CHANNEL_WAVEFORM in waveform operating mode. More...
 

Variables

static const uint32_t divisors [5] = { 2, 8, 32, 128, 0}
 
const uint8_t gc_uc_nbconfig
 Number of available wave configurations. More...
 
static struct waveconfig_t gc_waveconfig []
 TC waveform configurations. More...
 
static uint8_t gs_uc_configuration = 0
 Current wave configuration. More...
 
static uint32_t gs_ul_captured_pulses
 Capture status. More...
 
static uint32_t gs_ul_captured_ra
 
static uint32_t gs_ul_captured_rb
 

#define STRING_EOL   "\r"
#define STRING_HEADER
Value:
"--TC capture waveform Example --\r\n" \
"-- "BOARD_NAME " --\r\n" \
"-- Compiled: "__DATE__ " "__TIME__ " --"STRING_EOL
#define BOARD_NAME
Definition: inc/app_init.h:140
#define STRING_EOL
Definition: tc_capture_waveform_example.c:49
#define TC_CAPTURE_TIMER_SELECTION   TC_CMR_TCCLKS_TIMER_CLOCK3

[tc_capture_selection]

Referenced by main().

static void configure_console ( void  )
static

[tc_capture_irq_handler_end]

Configure UART console.

References uart_rs232_options::baudrate, CONF_UART, CONF_UART_BAUDRATE, CONF_UART_CHAR_LENGTH, CONF_UART_PARITY, CONF_UART_STOP_BITS, and stdio_serial_init().

Referenced by main().

static void display_menu ( void  )
static

Display the user menu on the UART.

References gc_uc_nbconfig, TC_CHANNEL_CAPTURE, TC_PERIPHERAL, waveconfig_t::us_dutycycle, and waveconfig_t::us_frequency.

Referenced by main().

int main ( void  )

Application entry point for tc_capture_waveform example.

Returns
Unused (ANSI-C compatibility).

[tc_waveform_gpio]

Configure PIO Pins for TC

Disable I/O to enable peripheral mode)

[tc_waveform_gpio]

[tc_capture_gpio]

Configure PIO Pins for TC

Disable I/O to enable peripheral mode)

[tc_capture_gpio]

[tc_waveform_init_call]

[tc_waveform_init_call]

[tc_capture_init_call]

[tc_capture_init_call]

[tc_capture_init_irq]

Configure TC interrupts for TC TC_CHANNEL_CAPTURE only

[tc_capture_init_irq]

[tc_capture_init_module_irq]

[tc_capture_init_module_irq]

[tc_capture_start_now]

[tc_capture_start_now]

References board_init(), BOARD_NAME, configure_console(), display_menu(), gs_ul_captured_ra, ioport_disable_pin(), ioport_set_pin_mode(), key, PIN_TC_CAPTURE, PIN_TC_CAPTURE_MUX, PIN_TC_WAVEFORM, PIN_TC_WAVEFORM_MUX, sysclk_get_peripheral_bus_hz(), sysclk_init(), TC, tc_capture_initialize(), TC_CAPTURE_TIMER_SELECTION, TC_CHANNEL_CAPTURE, TC_CHANNEL_WAVEFORM, tc_disable_interrupt(), tc_enable_interrupt(), TC_IRQn, TC_PERIPHERAL, tc_start(), and tc_waveform_initialize().

static void tc_capture_initialize ( void  )
static

Configure TC TC_CHANNEL_CAPTURE in capture operating mode.

[tc_capture_init]

Referenced by main().

void TC_Handler ( void  )

[tc_capture_init]

Interrupt handler for the TC TC_CHANNEL_CAPTURE[tc_capture_irq_handler_start]

[tc_capture_irq_handler_start] [tc_capture_irq_handler_status]

[tc_capture_irq_handler_status]

[tc_capture_irq_handler_read_ra]

[tc_capture_irq_handler_read_ra] [tc_capture_irq_handler_read_rb]

[tc_capture_irq_handler_read_rb]

[tc_capture_irq_handler_end]

const uint32_t divisors[5] = { 2, 8, 32, 128, 0}
static

Referenced by tc_find_mck_divisor().

const uint8_t gc_uc_nbconfig
Initial value:
= sizeof(gc_waveconfig)
/ sizeof(struct waveconfig_t)
static struct waveconfig_t gc_waveconfig[]
TC waveform configurations.
Definition: tc_capture_waveform_example.c:68
[tc_capture_selection]
Definition: tc_capture_waveform_example.c:58

Number of available wave configurations.

Referenced by display_menu().

struct waveconfig_t gc_waveconfig[]
static
Initial value:
= {
{TC_CMR_TCCLKS_TIMER_CLOCK4, 178, 30},
{TC_CMR_TCCLKS_TIMER_CLOCK3, 375, 50},
{TC_CMR_TCCLKS_TIMER_CLOCK3, 800, 75},
{TC_CMR_TCCLKS_TIMER_CLOCK2, 1000, 80},
{TC_CMR_TCCLKS_TIMER_CLOCK2, 4000, 55}
}

TC waveform configurations.

uint8_t gs_uc_configuration = 0
static

Current wave configuration.

Referenced by tc_waveform_initialize().

uint32_t gs_ul_captured_pulses
static

Capture status.

uint32_t gs_ul_captured_ra
static

Referenced by main().

uint32_t gs_ul_captured_rb
static