Microchip® Advanced Software Framework

EPD_hw_timer.h File Reference
#include <stdint.h>

Data Structures

struct  tc_control_reg
 TC Configuration structure. More...
 

Typedefs

typedef enum tc_cc_channel_t TC_CC_CHANNEL_t
 
typedef enum TC_CLKSEL_enum TC_CLKSEL_t
 
typedef enum tc_co_mode_enum TC_CO_MODE_t
 
typedef enum TC_MODE_enum TC_WG_MODE_t
 

Enumerations

enum  tc_co_mode_enum {
  CO_NORMAL = 0X00,
  CO_TOGGLE = 0X01,
  CO_CLEAR = 0X02,
  CO_SET = 0X03
}
 Timer Modes of operation. More...
 

Functions

static void tc_clear_cc (volatile void *tc, enum tc_cc_channel_t channel_index, uint16_t value)
 Write Compare register with timer Value. More...
 
static void tc_clear_ic (volatile void *tc, enum tc_cc_channel_t channel_index, uint16_t value)
 Write Compare register with timer Value. More...
 
void tc_disable_compare_int (volatile void *p_tc, enum tc_cc_channel_t channel_index)
 Disable Compare Interrupt in channel C. More...
 
void tc_disable_overflow_int (volatile void *p_tc, enum tc_cc_channel_t channel_index)
 Disable Overflow Interrupt. More...
 
void tc_initc (volatile void *p_tc, TC_CC_CHANNEL_t channel_index, struct tc_control_reg *p_control_reg)
 Configure TC for timer, waveform generation or capture. More...
 
static void tc_set_clk_source (volatile void *tc, TC_CC_CHANNEL_t channel_index, TC_CLKSEL_t mode)
 Sets a timer in a particular mode of operation. More...
 
static void tc_set_co_mode (volatile void *tc, TC_CC_CHANNEL_t channel_index, TC_CO_MODE_t mode)
 Sets a timer in a particular mode of operation. More...
 
static void tc_set_wg_mode (volatile void *tc, TC_CC_CHANNEL_t channel_index, TC_WG_MODE_t mode)
 Sets a timer in a particular mode of operation. More...
 
void tc_start (volatile void *p_tc, struct tc_control_reg *p_control_reg)
 to start the running timer More...
 
void tc_stop (volatile void *p_tc)
 to stop the running timer More...
 
static void tc_write_ic (volatile void *tc, enum tc_cc_channel_t channel_index, uint16_t value)
 Write Compare register with timer Value. More...
 

typedef enum TC_MODE_enum TC_WG_MODE_t

Timer Modes of operation.

Enumerator
CO_NORMAL 
CO_TOGGLE 
CO_CLEAR 
CO_SET 

static void tc_clear_cc ( volatile void *  tc,
enum tc_cc_channel_t  channel_index,
uint16_t  value 
)
inlinestatic

Write Compare register with timer Value.

Parameters
tcTimer Address
channel_indexCompare Channel to be used
valueCompare value to be written

Referenced by PWM_start_toggle().

static void tc_clear_ic ( volatile void *  tc,
enum tc_cc_channel_t  channel_index,
uint16_t  value 
)
inlinestatic

Write Compare register with timer Value.

Parameters
tcTimer Address
channel_indexCompare Channel to be used
valueCompare value to be written

Referenced by PWM_start_toggle().

void tc_disable_compare_int ( volatile void *  p_tc,
enum tc_cc_channel_t  channel_index 
)

Disable Compare Interrupt in channel C.

Parameters
tcTimer Address

References clear_compa_flag(), clear_compb_flag(), clear_compc_flag(), TC_COMPA, TC_COMPB, TC_COMPC, tc_disable_compa_int(), tc_disable_compb_int(), and tc_disable_compc_int().

Referenced by tc_initc(), and tc_stop().

void tc_disable_overflow_int ( volatile void *  p_tc,
enum tc_cc_channel_t  channel_index 
)

Disable Overflow Interrupt.

Parameters
tcTimer Address

References clear_ovf_flag(), TC_COMPA, TC_COMPB, TC_COMPC, and tc_disable_ovf_int().

Referenced by tc_initc().

void tc_initc ( volatile void *  p_tc,
TC_CC_CHANNEL_t  channel_index,
struct tc_control_reg p_control_reg 
)

Configure TC for timer, waveform generation or capture.

Parameters
p_tcPointer to a TC instance.
ul_channelChannel to configure.
ul_modeControl mode register value to set.

References tc_control_reg::co_mode, tc_disable_compare_int(), tc_disable_overflow_int(), tc_set_co_mode(), tc_set_wg_mode(), and tc_control_reg::wg_mode.

Referenced by initialize_EPD_timer(), and PWM_start_toggle().

static void tc_set_clk_source ( volatile void *  tc,
TC_CC_CHANNEL_t  channel_index,
TC_CLKSEL_t  mode 
)
inlinestatic

Sets a timer in a particular mode of operation.

Parameters
tcTimer Address
modeEnum value of the selected mode

References TCCRB_OFFSET.

Referenced by tc_start(), and tc_stop().

static void tc_set_co_mode ( volatile void *  tc,
TC_CC_CHANNEL_t  channel_index,
TC_CO_MODE_t  mode 
)
inlinestatic

Sets a timer in a particular mode of operation.

Parameters
tcTimer Address
modeEnum value of the selected mode

References CO_CLEAR, CO_NORMAL, CO_SET, CO_TOGGLE, TC_COMPA, TC_COMPB, and TC_COMPC.

Referenced by tc_initc().

static void tc_set_wg_mode ( volatile void *  tc,
TC_CC_CHANNEL_t  channel_index,
TC_WG_MODE_t  mode 
)
inlinestatic

Sets a timer in a particular mode of operation.

Parameters
tcTimer Address
modeEnum value of the selected mode

References CO_NORMAL, CTC_Mode1, CTC_Mode2, PWM_Mode1, PWM_Mode10, PWM_Mode11, PWM_Mode12, PWM_Mode2, PWM_Mode3, PWM_Mode4, PWM_Mode5, PWM_Mode6, PWM_Mode7, PWM_Mode8, PWM_Mode9, and TCCRB_OFFSET.

Referenced by tc_initc().

void tc_start ( volatile void *  p_tc,
struct tc_control_reg p_control_reg 
)

to start the running timer

References tc_control_reg::cs_select, and tc_set_clk_source().

Referenced by initialize_EPD_timer(), and PWM_start_toggle().

void tc_stop ( volatile void *  p_tc)
static void tc_write_ic ( volatile void *  tc,
enum tc_cc_channel_t  channel_index,
uint16_t  value 
)
inlinestatic

Write Compare register with timer Value.

Parameters
tcTimer Address
channel_indexCompare Channel to be used
valueCompare value to be written

Referenced by PWM_start_toggle().