Copyright (c) 2014-2018 Microchip Technology Inc.
and its subsidiaries.
#include <compiler.h>
#include <parts.h>
#include "sysclk.h"
#include "hw_timer.h"
#include "tc_megarf.h"
#include "common_hw_timer.h"
#include "conf_hw_timer.h"
Macros | |
#define | TIMER_PERIOD UINT16_MAX |
Functions | |
static void | configure_tc_callback (volatile void *timer) |
to set compare interrupt callback according to the timer channel input More... | |
void | restore_cpu_interrupt (uint8_t flags) |
to restore saved interrupts status More... | |
uint8_t | save_cpu_interrupt (void) |
to save current interrupts status More... | |
void | tc_cca_callback (void) |
hw timer compare callback More... | |
void | tc_ovf_callback (void) |
hw timer overflow callback More... | |
void | tmr_disable_cc_interrupt (void) |
to disable compare interrupt More... | |
void | tmr_disable_ovf_interrupt (void) |
to disable overflow interrupt More... | |
void | tmr_enable_cc_interrupt (void) |
to enable compare interrupt More... | |
uint8_t | tmr_init (void) |
to initialiaze hw timer More... | |
uint16_t | tmr_read_count (void) |
read the actual timer count from register More... | |
void | tmr_stop (void) |
to stop the running timer More... | |
void | tmr_write_cmpreg (uint16_t compare_value) |
to load compare value in channel compare register More... | |
#define TIMER_PERIOD UINT16_MAX |
|
static |
to set compare interrupt callback according to the timer channel input
timer | - hw timer channel |
References tc_cca_callback(), tc_set_compa_interrupt_callback(), tc_set_compb_interrupt_callback(), and tc_set_compc_interrupt_callback().
Referenced by tmr_init().
void restore_cpu_interrupt | ( | uint8_t | flags | ) |
uint8_t save_cpu_interrupt | ( | void | ) |
to save current interrupts status
References cpu_irq_save().
void tc_cca_callback | ( | void | ) |
void tc_ovf_callback | ( | void | ) |
void tmr_disable_cc_interrupt | ( | void | ) |
to disable compare interrupt
References clear_compa_flag(), and tc_disable_compa_int().
void tmr_disable_ovf_interrupt | ( | void | ) |
to disable overflow interrupt
References clear_ovf_flag(), and tc_enable_ovf_int().
void tmr_enable_cc_interrupt | ( | void | ) |
to enable compare interrupt
References clear_compa_flag(), and tc_enable_compa_int().
uint8_t tmr_init | ( | void | ) |
to initialiaze hw timer
References configure_tc_callback(), DEF_1MHZ, NORMAL, sysclk_get_peripheral_bus_hz(), TC_CLKSEL_DIV1_gc, tc_disable_compa_int(), tc_enable(), tc_enable_ovf_int(), tc_ovf_callback(), tc_set_mode(), tc_set_overflow_interrupt_callback(), and tc_write_clock_source().
uint16_t tmr_read_count | ( | void | ) |
read the actual timer count from register
References tc_read_count().
void tmr_stop | ( | void | ) |
to stop the running timer
References tc_disable().
void tmr_write_cmpreg | ( | uint16_t | compare_value | ) |
to load compare value in channel compare register
References TC_COMPA, and tc_write_cc().