Microchip® Advanced Software Framework

winc1500/http_downloader_example/iot/sw_timer.h File Reference

SW Timer component for the IoT(Internet of things) service.

Copyright (c) 2016-2018 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>
#include <stdint.h>
#include "conf_sw_timer.h"

Data Structures

struct  sw_timer_config
 SW timer configuration structure. More...
 
struct  sw_timer_handle
 SW timer handler structure. More...
 
struct  sw_timer_module
 SW timer module structure. More...
 

Typedefs

typedef void(* sw_timer_callback_t )(struct sw_timer_module *const module, int timer_id, void *context, int period)
 Callback Function type of time out event in the timer. More...
 

Functions

void sw_timer_disable (struct sw_timer_module *const module_inst)
 Stop the timer. More...
 
void sw_timer_disable_callback (struct sw_timer_module *const module_inst, int timer_id)
 Disable callback. More...
 
void sw_timer_enable (struct sw_timer_module *const module_inst)
 Start the timer. More...
 
void sw_timer_enable_callback (struct sw_timer_module *const module_inst, int timer_id, uint32_t delay)
 Enables callback. More...
 
void sw_timer_get_config_defaults (struct sw_timer_config *const config)
 Get default configuration of SW timer. More...
 
void sw_timer_init (struct sw_timer_module *const module_inst, struct sw_timer_config *const config)
 Initialize the SW timer module. More...
 
int sw_timer_register_callback (struct sw_timer_module *const module_inst, sw_timer_callback_t callback, void *context, uint32_t period)
 Register callback. More...
 
void sw_timer_task (struct sw_timer_module *const module_inst)
 Checks the time out of each timer handlers. More...
 
void sw_timer_unregister_callback (struct sw_timer_module *const module_inst, int timer_id)
 Unregister callback. More...
 

typedef void(* sw_timer_callback_t)(struct sw_timer_module *const module, int timer_id, void *context, int period)

Callback Function type of time out event in the timer.

Parameters
[in]timer_idID of timer.
[in]contextPrivate data of timer.
[in]contextPeriod of timer handle.

void sw_timer_disable ( struct sw_timer_module *const  module_inst)

Stop the timer.

Parameters
[in]module_instPointer of timer.
void sw_timer_disable_callback ( struct sw_timer_module *const  module_inst,
int  timer_id 
)

Disable callback.

Disable the callback function registered by the sw_timer_register_callback.

Parameters
[in]module_instPointer to USART software instance struct
[in]timer_idTimer ID .
void sw_timer_enable ( struct sw_timer_module *const  module_inst)

Start the timer.

Parameters
[in]module_instPointer of timer.
void sw_timer_enable_callback ( struct sw_timer_module *const  module_inst,
int  timer_id,
uint32_t  delay 
)

Enables callback.

Enables the callback function registered by the sw_timer_register_callback.

Parameters
[in]module_instPointer to USART software instance struct
[in]timer_idTimer ID .
[in]delayInitialization value of timer.
void sw_timer_get_config_defaults ( struct sw_timer_config *const  config)

Get default configuration of SW timer.

Parameters
[in]configPointer of configuration structure which will be used in the timer.

Get default configuration of SW timer.

This function performs to the increasing the tick count.

Parameters
[in]moduleInstance of the TCC.
[in]configPointer of configuration structure which will be used in the timer.

Get default configuration of SW timer.

This function performs to the increasing the tick count.

Parameters
[in]moduleInstance of the TCC.
void sw_timer_init ( struct sw_timer_module *const  module_inst,
struct sw_timer_config *const  config 
)

Initialize the SW timer module.

Parameters
[in]module_instPointer of timer.
[in]configPointer of configuration structure which will be used in the timer.
int sw_timer_register_callback ( struct sw_timer_module *const  module_inst,
sw_timer_callback_t  callback,
void *  context,
uint32_t  period 
)

Register callback.

Parameters
[in]module_instPointer of timer.
[in]callbackCallback entry of time out.
[in]contextPrivate data of timer.
[in]periodPeriod of timer.
Returns
If negative value, registering timer was failed. Otherwise this value is ID of timer.
void sw_timer_task ( struct sw_timer_module *const  module_inst)

Checks the time out of each timer handlers.

This function must be called continuously for the checking the expiration of the timer handle.

Parameters
[in]module_instPointer to USART software instance struct
void sw_timer_unregister_callback ( struct sw_timer_module *const  module_inst,
int  timer_id 
)

Unregister callback.

Parameters
[in]module_instPointer of timer.
[in]timer_idTimer ID .