PARC example.
Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.
#include <string.h>
#include <asf.h>
#include <conf_board.h>
#include <conf_clock.h>
#include <conf_example.h>
#include <ioport.h>
#include <sysclk.h>
Macros | |
#define | BUFFER_SIZE 64 |
Size of the receive buffer used by the PDCA, in bytes. More... | |
#define | PDCA_PARC_CHANNEL 0 |
#define | PDCA_PID_PARC 16 |
#define | STRING_EOL "\r" |
#define | STRING_HEADER |
#define | TC_FREQ 10 |
Timer counter frequency in Hz. More... | |
Functions | |
static void | configure_console (void) |
Configure UART for debug message output. More... | |
static void | configure_tc (void) |
Configure Timer Counter 0 (TC0) to generate an interrupt every 200ms. More... | |
int | main (void) |
Application entry point for PARC example. More... | |
static void | pdca_parc_callback (enum pdca_channel_status status) |
The callback function for PDCA channel of PARC. More... | |
void | TC00_Handler (void) |
Interrupt handler for TC00. More... | |
Variables | |
static uint8_t | gs_puc_buffer [BUFFER_SIZE] |
Receive buffer. More... | |
static uint8_t | gs_puc_nextbuffer [BUFFER_SIZE] |
Next Receive buffer. More... | |
struct parc_config | parc_configex |
PARC configure stuct. More... | |
pdca_channel_config_t | PDCA_PARC_OPTIONS |
PDCA channel options. More... | |
#define BUFFER_SIZE 64 |
Size of the receive buffer used by the PDCA, in bytes.
Referenced by main(), pdca_parc_callback(), and TC00_Handler().
#define PDCA_PARC_CHANNEL 0 |
Referenced by main(), and pdca_parc_callback().
#define PDCA_PID_PARC 16 |
#define STRING_EOL "\r" |
#define STRING_HEADER |
Referenced by main().
#define TC_FREQ 10 |
Timer counter frequency in Hz.
Referenced by configure_tc().
|
static |
Configure UART for debug message output.
References uart_rs232_options::baudrate, and stdio_serial_init().
Referenced by main().
|
static |
Configure Timer Counter 0 (TC0) to generate an interrupt every 200ms.
This interrupt will be used to flush USART input and echo back.
References sysclk_enable_peripheral_clock(), sysclk_get_peripheral_bus_hz(), tc_enable_interrupt(), tc_find_mck_divisor(), TC_FREQ, tc_init(), and tc_write_rc().
Referenced by main().
int main | ( | void | ) |
Application entry point for PARC example.
[parc_variables]
[parc_variables]
[parc_get_defaults]
[parc_get_defaults]
[parc_init_enable_and_start] [parc_init_enable_and_start_1]
[parc_init_enable_and_start_1]
[parc_init_enable_and_start_2]
[parc_init_enable_and_start_2] [parc_init_enable_and_start]
References board_init(), BUFFER_SIZE, parc_config::capture_mode, configure_console(), configure_tc(), gs_puc_buffer, IOPORT_PIN_LEVEL_HIGH, ioport_set_pin_level(), PARC_BOTH_CAPTURE, parc_enable(), PARC_EVEN_CAPTURE, parc_get_config_defaults(), parc_init(), PARC_SMODE_ALWAYS, PARC_SMODE_PCEN1_AND_PCEN2_H, parc_start_capture(), pdca_channel_enable(), pdca_channel_set_callback(), pdca_channel_set_config(), pdca_channel_write_load(), pdca_enable(), pdca_parc_callback(), PDCA_PARC_CHANNEL, parc_config::smode, STRING_HEADER, sysclk_init(), tc_start(), and usart_read().
|
static |
The callback function for PDCA channel of PARC.
status | PDCA channel status |
References BUFFER_SIZE, gs_puc_buffer, pdca_channel_disable(), pdca_channel_disable_interrupt(), PDCA_PARC_CHANNEL, and UNUSED.
Referenced by main().
void TC00_Handler | ( | void | ) |
Interrupt handler for TC00.
Record the number of bytes received, and then restart a read transfer on the USART if the transfer was stopped.
References BUFFER_SIZE, ioport_toggle_pin_level(), and tc_get_status().
|
static |
Receive buffer.
Referenced by main(), and pdca_parc_callback().
|
static |
Next Receive buffer.
struct parc_config parc_configex |
PARC configure stuct.
pdca_channel_config_t PDCA_PARC_OPTIONS |
PDCA channel options.