Microchip® Advanced Software Framework

common_sw_timer.h File Reference

Copyright (c) 2013-2018 Microchip Technology Inc.

and its subsidiaries.

#include "compiler.h"
#include "status_codes.h"
#include "conf_common_sw_timer.h"

Data Structures

struct  timer_info_tag
 

Macros

#define ADD_TIME(a, b)   ((a) + (b))
 Adds two time values. More...
 
#define HW_TIME_MASK   (0xFFFF)
 
#define MAX_NO_OF_TIMERS   (25)
 
#define MAX_TIMEOUT   (0x7FFFFFFF)
 
#define MIN_TIMEOUT   (0x80)
 
#define NO_TIMER   (0xFF)
 
#define SUB_TIME(a, b)   ((a) - (b))
 Subtracts two time values. More...
 
#define SYS_TIME_SHIFT_MASK   (16)
 
#define TOTAL_TIMERS   TOTAL_NUMBER_OF_TIMERS
 

Typedefs

typedef enum sw_timeout_type_tag sw_timeout_type_t
 Timeout type. More...
 
typedef void(* timer_expiry_cb_t )(void *)
 
typedef struct timer_info_tag timer_info_t
 

Enumerations

enum  sw_timeout_type_tag {
  SW_TIMEOUT_RELATIVE,
  SW_TIMEOUT_ABSOLUTE
}
 Timeout type. More...
 

Functions

status_code_t sw_timer_get_id (uint8_t *timer_id)
 Returns a timer id to be used before starting a timer. More...
 
uint32_t sw_timer_get_residual_time (uint8_t timer_id)
 
uint32_t sw_timer_get_time (void)
 Gets current time. More...
 
void sw_timer_init (void)
 Initializes the Software Timer module. More...
 
bool sw_timer_is_running (uint8_t timer_id)
 Checks whether a given timer is running or not. More...
 
uint32_t sw_timer_next_timer_expiry_duration (void)
 
void sw_timer_run_residual_time (uint32_t offset)
 
void sw_timer_service (void)
 Handles Queues and Callbacks for Expired Timers. More...
 
status_code_t sw_timer_start (uint8_t timer_id, uint32_t timer_count, sw_timeout_type_t timeout_type, FUNC_PTR timer_cb, void *param_cb)
 Starts a timer. More...
 
status_code_t sw_timer_stop (uint8_t timer_id)
 Stops a running timer. More...