Microchip® Advanced Software Framework

tc_config Struct Reference

TC configuration structure.

Configuration struct for a TC instance. This structure should be initialized by the tc_get_config_defaults function before being modified by the user application.

#include <tc.h>

Data Fields

union {
   struct tc_16bit_config   counter_16_bit
 Struct for 16-bit specific timer configuration. More...
 
   struct tc_32bit_config   counter_32_bit
 Struct for 32-bit specific timer configuration. More...
 
   struct tc_8bit_config   counter_8_bit
 Struct for 8-bit specific timer configuration. More...
 
}; 
 Access the different counter size settings through this configuration member. More...
 
enum tc_clock_prescaler clock_prescaler
 Specifies the prescaler value for GCLK_TC. More...
 
enum gclk_generator clock_source
 GCLK generator used to clock the peripheral. More...
 
enum tc_count_direction count_direction
 Specifies the direction for the TC to count. More...
 
enum tc_counter_size counter_size
 Specifies either 8-, 16-, or 32-bit counter size. More...
 
bool double_buffering_enabled
 Set to true to enable double buffering write. More...
 
bool enable_capture_on_channel [NUMBER_OF_COMPARE_CAPTURE_CHANNELS]
 Specifies which channel(s) to enable channel capture operation on. More...
 
bool enable_capture_on_IO [NUMBER_OF_COMPARE_CAPTURE_CHANNELS]
 Specifies which channel(s) to enable I/O capture operation on. More...
 
bool on_demand
 Run on demand. More...
 
bool oneshot
 When true, one-shot will stop the TC on next hardware or software re-trigger event or overflow/underflow. More...
 
struct tc_pwm_channel pwm_channel [NUMBER_OF_COMPARE_CAPTURE_CHANNELS]
 Specifies the PWM channel for TC. More...
 
enum tc_reload_action reload_action
 Specifies the reload or reset time of the counter and prescaler resynchronization on a re-trigger event for the TC. More...
 
bool run_in_standby
 When true the module is enabled during standby. More...
 
enum tc_wave_generation wave_generation
 Specifies which waveform generation mode to use. More...
 
uint8_t waveform_invert_output
 Specifies which channel(s) to invert the waveform on. More...
 

union { ... }

Access the different counter size settings through this configuration member.

enum tc_clock_prescaler tc_config::clock_prescaler

Specifies the prescaler value for GCLK_TC.

Referenced by tc_get_config_defaults(), and tc_init().

enum gclk_generator tc_config::clock_source

GCLK generator used to clock the peripheral.

Referenced by init_xosc32k_fail_detector(), tc_get_config_defaults(), and tc_init().

enum tc_count_direction tc_config::count_direction

Specifies the direction for the TC to count.

Referenced by tc_get_config_defaults(), and tc_init().

struct tc_16bit_config tc_config::counter_16_bit

Struct for 16-bit specific timer configuration.

Referenced by init_xosc32k_fail_detector(), tc_get_config_defaults(), and tc_init().

struct tc_32bit_config tc_config::counter_32_bit

Struct for 32-bit specific timer configuration.

Referenced by tc_init().

struct tc_8bit_config tc_config::counter_8_bit

Struct for 8-bit specific timer configuration.

Referenced by tc_init().

enum tc_counter_size tc_config::counter_size

Specifies either 8-, 16-, or 32-bit counter size.

Referenced by tc_get_config_defaults(), and tc_init().

bool tc_config::double_buffering_enabled

Set to true to enable double buffering write.

When enabled any write through tc_set_top_value(), tc_set_compare_value() and will direct to the buffer register as buffered value, and the buffered value will be committed to effective register on UPDATE condition, if update is not locked.

Referenced by tc_get_config_defaults(), and tc_init().

bool tc_config::enable_capture_on_channel[NUMBER_OF_COMPARE_CAPTURE_CHANNELS]

Specifies which channel(s) to enable channel capture operation on.

Referenced by tc_get_config_defaults(), and tc_init().

bool tc_config::enable_capture_on_IO[NUMBER_OF_COMPARE_CAPTURE_CHANNELS]

Specifies which channel(s) to enable I/O capture operation on.

Referenced by tc_get_config_defaults(), and tc_init().

bool tc_config::on_demand

Run on demand.

Referenced by tc_get_config_defaults(), and tc_init().

bool tc_config::oneshot

When true, one-shot will stop the TC on next hardware or software re-trigger event or overflow/underflow.

Referenced by tc_get_config_defaults(), and tc_init().

struct tc_pwm_channel tc_config::pwm_channel[NUMBER_OF_COMPARE_CAPTURE_CHANNELS]

Specifies the PWM channel for TC.

Referenced by tc_get_config_defaults(), and tc_init().

enum tc_reload_action tc_config::reload_action

Specifies the reload or reset time of the counter and prescaler resynchronization on a re-trigger event for the TC.

Referenced by tc_get_config_defaults(), and tc_init().

bool tc_config::run_in_standby

When true the module is enabled during standby.

Referenced by tc_get_config_defaults(), and tc_init().

enum tc_wave_generation tc_config::wave_generation

Specifies which waveform generation mode to use.

Referenced by init_xosc32k_fail_detector(), tc_get_config_defaults(), and tc_init().

uint8_t tc_config::waveform_invert_output

Specifies which channel(s) to invert the waveform on.

For SAM L21/L22/C20/C21, it's also used to invert I/O input pin.

Referenced by tc_get_config_defaults(), and tc_init().