TC Example application for AVR UC3 TC driver.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include <stdint.h>
#include <stdbool.h>
#include "tc.h"
#include "sysclk.h"
#include "board.h"
#include "gpio.h"
#include "intc.h"
#include "conf_example.h"
Functions | |
int | main (void) |
Main function. More... | |
static void | tc_init (volatile avr32_tc_t *tc) |
TC Initialization. More... | |
static void | tc_irq (void) |
TC interrupt. More... | |
Variables | |
static volatile uint32_t | tc_tick = 0 |
static volatile bool | update_timer = true |
int main | ( | void | ) |
Main function.
Main function performs the following:
References cpu_irq_disable, cpu_irq_enable, EXAMPLE_TC, INTC_init_interrupts(), INTC_register_interrupt(), sysclk_enable_peripheral_clock(), sysclk_init(), tc_init(), tc_irq(), timer, and update_timer.
|
static |
TC Initialization.
Initializes and start the TC module with the following:
tc | Base address of the TC module |
References tc_waveform_opt_t::channel, tc_interrupt_t::etrgs, sysclk_get_pba_hz(), TC_CLOCK_SOURCE_TC3, tc_configure_interrupts(), TC_EVT_EFFECT_NOOP, tc_init_waveform(), TC_SEL_NO_EDGE, tc_start(), TC_WAVEFORM_SEL_UP_MODE_RC_TRIGGER, and tc_write_rc().
Referenced by main().
|
static |
TC interrupt.
The ISR handles RC compare interrupt and sets the update_timer flag to update the timer value.
References EXAMPLE_TC, EXAMPLE_TOGGLE_PIN, gpio_tgl_gpio_pin(), tc_read_sr(), tc_tick, and update_timer.
Referenced by main().
|
static |
Referenced by tc_irq().