Copyright (c) 2014-2018 Microchip Technology Inc.
and its subsidiaries.
#include <compiler.h>
#include <parts.h>
#include "tc.h"
#include "hw_timer.h"
#include "sysclk.h"
#include "common_hw_timer.h"
#include "conf_hw_timer.h"
Functions | |
static void | configure_irq_handler (void) |
to register the timer callback with the corresponding handler ID More... | |
void | restore_cpu_interrupt (uint8_t flags) |
to restore saved interrupt status More... | |
uint8_t | save_cpu_interrupt (void) |
to save current interrupt status More... | |
static void | tc0_callback (void) |
static void | tc1_callback (void) |
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... | |
void | tmr_enable_ovf_interrupt (void) |
to enable overflow 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... | |
Variables | |
static tc_interrupt_t | tc_interrupt |
uint8_t | timer_multiplier |
tmr_callback_t | tmr_callback |
|
static |
to register the timer callback with the corresponding handler ID
References irq_register_handler, tc0_callback(), tc1_callback(), and TIMER.
Referenced by tmr_init().
void restore_cpu_interrupt | ( | uint8_t | flags | ) |
uint8_t save_cpu_interrupt | ( | void | ) |
to save current interrupt status
References cpu_irq_save().
|
static |
References status, tc_get_interrupt_settings(), tc_read_sr(), TIMER, tmr_cca_callback(), and tmr_ovf_callback().
Referenced by configure_irq_handler().
|
static |
References status, tc_get_interrupt_settings(), tc_read_sr(), TIMER, tmr_cca_callback(), and tmr_ovf_callback().
Referenced by configure_irq_handler().
void tmr_disable_cc_interrupt | ( | void | ) |
to disable compare interrupt
References tc_interrupt_t::cpcs, tc_configure_interrupts(), and TIMER.
Referenced by tmr_init().
void tmr_disable_ovf_interrupt | ( | void | ) |
to disable overflow interrupt
References tc_interrupt_t::covfs, tc_configure_interrupts(), and TIMER.
void tmr_enable_cc_interrupt | ( | void | ) |
to enable compare interrupt
References tc_interrupt_t::cpcs, tc_configure_interrupts(), tc_read_sr(), and TIMER.
void tmr_enable_ovf_interrupt | ( | void | ) |
to enable overflow interrupt
References tc_interrupt_t::covfs, tc_configure_interrupts(), tc_read_sr(), and TIMER.
Referenced by tmr_init().
uint8_t tmr_init | ( | void | ) |
to initialiaze hw timer
References tc_waveform_opt_t::channel, configure_irq_handler(), DEF_1MHZ, sysclk_enable_peripheral_clock(), sysclk_get_peripheral_bus_hz(), TC_BURST_NOT_GATED, TC_CLOCK_RISING_EDGE, TC_CLOCK_SOURCE_TC2, TC_EVT_EFFECT_NOOP, TC_EXT_EVENT_SEL_TIOB_INPUT, tc_init_waveform(), TC_SEL_NO_EDGE, tc_start(), TC_WAVEFORM_SEL_UP_MODE, TIMER, timer_multiplier, tmr_disable_cc_interrupt(), and tmr_enable_ovf_interrupt().
uint16_t tmr_read_count | ( | void | ) |
read the actual timer count from register
References tc_read_tc(), and TIMER.
void tmr_write_cmpreg | ( | uint16_t | compare_value | ) |
to load compare value in channel compare register
References tc_write_rc(), and TIMER.
|
static |
Referenced by init_timer(), and tc_init().
uint8_t timer_multiplier |
Referenced by tmr_init().
tmr_callback_t tmr_callback |