Copyright (c) 2013-2020 Microchip Technology Inc.
and its subsidiaries.
#include <compiler.h>
#include <parts.h>
#include "tc.h"
#include "tc_interrupt.h"
#include "hw_timer.h"
#include "clock.h"
#include <system_interrupt.h>
#include "common_hw_timer.h"
#include "conf_hw_timer.h"
Macros | |
#define | TIMER_PERIOD UINT16_MAX |
Functions | |
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... | |
static void | tc_cca_callback (struct tc_module *const module_instance) |
hw timer compare callback More... | |
static void | tc_ovf_callback (struct tc_module *const module_instance) |
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 disable overflow interrupt More... | |
uint8_t | tmr_init (void) |
to initialize 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 | |
struct tc_module | module_inst |
bool | sys_sleep |
struct tc_config | timer_config |
#define TIMER_PERIOD UINT16_MAX |
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().
|
static |
|
static |
References tmr_ovf_callback().
Referenced by tmr_init().
void tmr_disable_cc_interrupt | ( | void | ) |
to disable compare interrupt
References module_inst, TC_CALLBACK_CC_CHANNEL0, and tc_disable_callback().
void tmr_disable_ovf_interrupt | ( | void | ) |
to disable overflow interrupt
References module_inst, TC_CALLBACK_OVERFLOW, and tc_disable_callback().
void tmr_enable_cc_interrupt | ( | void | ) |
to enable compare interrupt
References module_inst, TC_CALLBACK_CC_CHANNEL0, tc_clear_status(), tc_enable_callback(), and TC_STATUS_CHANNEL_0_MATCH.
void tmr_enable_ovf_interrupt | ( | void | ) |
to disable overflow interrupt
References module_inst, TC_CALLBACK_OVERFLOW, and tc_enable_callback().
uint8_t tmr_init | ( | void | ) |
to initialize hw timer
References tc_config::clock_prescaler, tc_config::clock_source, tc_16bit_config::compare_capture_channel, tc_config::counter_16_bit, DEF_1MHZ, GCLK_GENERATOR_1, module_inst, tc_config::run_in_standby, sys_sleep, system_gclk_gen_get_hz(), TC_CALLBACK_CC_CHANNEL0, TC_CALLBACK_OVERFLOW, tc_cca_callback(), TC_CLOCK_PRESCALER_DIV2, tc_enable(), tc_enable_callback(), tc_get_config_defaults(), tc_init(), tc_ovf_callback(), tc_register_callback(), TIMER, timer_config, and TIMER_PERIOD.
uint16_t tmr_read_count | ( | void | ) |
read the actual timer count from register
References module_inst, and tc_get_count_value().
void tmr_stop | ( | void | ) |
to stop the running timer
References module_inst, and tc_disable().
void tmr_write_cmpreg | ( | uint16_t | compare_value | ) |
to load compare value in channel compare register
References module_inst, TC_COMPARE_CAPTURE_CHANNEL_0, and tc_set_compare_value().
struct tc_module module_inst |
bool sys_sleep |
Referenced by tmr_init().
struct tc_config timer_config |
Referenced by tmr_init().