更换语言:
   Contact us
  • Follow CooCox
  •         
  • CooCox Market
  •         
  • Tech Support
  •     
Home  › COX Tick Interface

COX Tick Interface

Version: 1.00 - 13. June 2009

Contents

Overview

A Tick Timer provides a versatile means of generating interrupts at specified time intervals. It is intended for calling a function at a specified period once or repeatedly.


Interface Definition

Tick Interface definition : A COX TICK Interface is a structure variable of COX_TICK_PI type, it contains a list of pointers to the functions that implement the standard functions specified by COX.

PIO Interface
typedef struct {
COX_Status (*Init)     (float interval);
void       (*Start)    (void);
void       (*Stop)     (void);
float      (*Read)     (void);
void       (*Reset)    (void);
COX_Status (*Interval) (float interval);
void       (*Delay)    (float delay_time);
COX_Status (*Event)    (uint8_t index, TICK_Handler handler, float period, uint8_t evt_mode);
} COX_TICK_PI_Def;
typedef const COX_TICK_PI_Def COX_TICK_PI;
Member
COX_Status      (*Init)   (float interval);
/* Initialize the peripheral, specify the interval in second */
void            (*Start)  (void);
/* Start the tick timer */
void            (*Stop)   (void);
/* Stop the tick timer */
float           (*Read)   (void);
/* Get the time passed in second */
void            (*Reset)  (void);
/* Reset the timer to 0 */
COX_Status      (*Interval)(float interval);
/* Set tick interval */
void            (*Delay)   (float delay_time);
/* Delaly some time */
COX_Status      (*Event)   (uint8_t index, TICK_Handler handler, float period, uint8_t evt);
/* Setup the event */


Global Define

Name Description
COX_TICK_EVT_NONE None event
COX_TICK_EVT_SINGLE
Single event
COX_TICK_EVT_PERIODIC
Periodic event

Standard Function

Name Description
Init Initialize the tick timer
Start Start the tick timer
Stop Stop the tick timer
Read Get the time passed in milliseconds
Reset Reset the timer to 0
Interval Set tick interval
Delay Delaly some time
Event Setup the event

COX_Status Init (float interval)
Description Initialize the tick timer
Parameter interval : specify the interval in seconds
Return Code
  • COX_SUCCESS : Success
  • COX_ERROR : The specified interval is not supported
void Start (void)
Description Start the tick timer
Parameter None
Return Code None
void Stop (void)
Description Stop the tick timer
Parameter None
Return Code None
float Read (void)
Description Get the time passed in milliseconds
Parameter none
Return Code The time passed in seconds
void Reset (void)
Description Reset the timer to 0
Parameter None
Return Code None
COX_Status Interval (float interval)
Description Set tick interval
Parameter interval : specify the interval in seconds
Return Code
  • COX_SUCCESS : Success
  • COX_ERROR : The specified interval is not supported
void Delay (float delay_time)
Description Delaly some time
Parameter delay_time : Specify the time in seconds
Return Code None
COX_Status Event (TICK_Handler handler, float period, uint8_t evt_mode)
Description Setup the event
Parameter

evt_handler : Attach a function to be called by the period

period : Specify the event period in second

evt : Event mode, should be :

  • COX_TICK_EVT_NONE : None event
  • COX_TICK_EVT_SINGLE : The function will be called after none period
  • COX_TICK_EVT_PERIODIC : The function will be called periodically
Return Code COX_SUCCESS or COX_ERROR

Available Interface

Vendor Chip Interface Description
NXP LPC17xx Series pi_tick Tick Interface based on SysTick

 

© 2009 -2011 CooCox - Terms of Use         Business Model         Market             About us