TC Quadrature Decoder Example for SAM4E.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
Data Structures | |
struct | tc_qdec_config |
TC QDEC configuration structure. More... | |
struct | tc_qdec_pins_config |
Configuration struct for the TCC module output pins. More... | |
struct | tc_qdec_results |
TC QDEC configuration structure. More... | |
Macros | |
#define | STRING_EOL "\r" |
#define | STRING_HEADER |
Functions | |
static void | config_tc_qdec_iopins (Tc *const hw, const struct tc_qdec_config *const config) |
configure TC QDEC IO pins. More... | |
static void | config_tc_qdec_mode_position (Tc *const hw, const struct tc_qdec_config *const config) |
configure TC QDEC for position mode. More... | |
static void | config_tc_qdec_mode_speed (Tc *const hw, const struct tc_qdec_config *const config) |
configure TC QDEC for speed mode. More... | |
static void | config_tc_qdec_mode_test_basetimer (Tc *const hw, const struct tc_qdec_config *const config) |
configure TC QDEC for test_basetimer mode. More... | |
static void | configure_console (void) |
Configure UART console. More... | |
static void | configure_tc_qdec (void) |
configure TC QDEC. 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_qdec_getresult (void) |
TC QDEC get results. More... | |
static void | tc_qdec_init (Tc *const hw, const struct tc_qdec_config *const config) |
Initialize TC QDEC. More... | |
static void | tc_qdec_printresults (void) |
TC QDEC print results. More... | |
Variables | |
static const uint32_t | divisors [5] = { 2, 8, 32, 128, 0} |
struct tc_qdec_config | qdec_config [QDEC_INSTANCE_MAX] |
struct tc_qdec_results | qdec_results [QDEC_INSTANCE_MAX] |
current values of position, speed, direction More... | |
#define STRING_EOL "\r" |
#define STRING_HEADER |
|
static |
configure TC QDEC IO pins.
References ioport_disable_pin(), ioport_set_pin_mode(), tc_qdec_config::pins, tc_qdec_pins_config::qdec_input_index_pin, tc_qdec_pins_config::qdec_input_index_pin_mux, tc_qdec_pins_config::qdec_input_pha_pin, tc_qdec_pins_config::qdec_input_pha_pin_mux, tc_qdec_pins_config::qdec_input_phb_pin, and tc_qdec_pins_config::qdec_input_phb_pin_mux.
Referenced by config_tc_qdec_mode_position(), and config_tc_qdec_mode_speed().
|
static |
configure TC QDEC for position mode.
References tc_qdec_config::channelid, config_tc_qdec_iopins(), sysclk_enable_peripheral_clock(), tc_init(), and tc_set_block_mode().
Referenced by tc_qdec_init().
|
static |
configure TC QDEC for speed mode.
References tc_qdec_config::channelid, config_tc_qdec_iopins(), sysclk_enable_peripheral_clock(), sysclk_get_peripheral_bus_hz(), tc_init(), tc_set_block_mode(), and tc_write_rc().
Referenced by tc_qdec_init().
|
static |
configure TC QDEC for test_basetimer mode.
References tc_qdec_config::channelid, tc_qdec_pins_config::enable_qdec_test_wave_out_pin, ioport_disable_pin(), ioport_set_pin_mode(), tc_qdec_config::pins, tc_qdec_pins_config::qdec_test_basetimer_out_pin, tc_qdec_pins_config::qdec_test_basetimer_out_pin_mux, sysclk_enable_peripheral_clock(), sysclk_get_peripheral_bus_hz(), tc_init(), tc_start(), and tc_write_rc().
Referenced by tc_qdec_init().
|
static |
Configure UART console.
References uart_rs232_options::baudrate, and stdio_serial_init().
Referenced by main().
|
static |
|
static |
int main | ( | void | ) |
Application entry point for tc_capture_waveform example.
References board_init(), configure_console(), configure_tc_qdec(), display_menu(), gpio_toggle_pin, sysclk_init(), tc_qdec_getresult(), tc_qdec_printresults(), and wdt_disable().
|
static |
TC QDEC get results.
References tc_qdec_config::qdec, tc_qdec_results::qdec_cv0, tc_qdec_results::qdec_cv1, tc_qdec_results::qdec_dir, qdec_results, tc_qdec_results::qdec_speed, and TC_RA.
Referenced by main().
|
static |
Initialize TC QDEC.
References config_tc_qdec_mode_position(), config_tc_qdec_mode_speed(), config_tc_qdec_mode_test_basetimer(), tc_qdec_config::mode, and tc_start().
Referenced by configure_tc_qdec().
|
static |
TC QDEC print results.
References delay_us, tc_qdec_results::qdec_cv0, tc_qdec_results::qdec_cv1, tc_qdec_results::qdec_dir, qdec_results, and tc_qdec_results::qdec_speed.
Referenced by main().
|
static |
struct tc_qdec_config qdec_config[QDEC_INSTANCE_MAX] |
struct tc_qdec_results qdec_results[QDEC_INSTANCE_MAX] |
current values of position, speed, direction
Referenced by tc_qdec_getresult(), and tc_qdec_printresults().