/*******************************************************************************
*                                                                              *
* Copyright 2010 Rheinmetall Canada Inc.                                  	   *
*                                                                              *
* No part of this document may be reproduced, stored in                        *
* a retrieval system, or transmitted, in any form or by any means,             *
* electronic, mechanical, photocopying, recording, or otherwise,               *
* without the prior written permission of Rheinmetall Canada Inc.              *
*                                                                              *
*******************************************************************************/
/*
	Description:
	This is a template file for standard C header file.

*/

/* ************************************************************************** */
/* Revision:
000 20100616 HCAM
	Original version.

### YYYYMMDD Initial, Bug Identification
	Change description.
 */

#ifndef TIMER_H
#define TIMER_H


/* ************************************************************************** */
/* Includes */
#include "define.h"

/* ************************************************************************** */
/* Defines */


/* ************************************************************************** */
/* Type definitions */
typedef enum 
{
	HEARTBEAT_LED_TMR = 0,
    CHALET_POWER_RELAY_COIL_TIMER,
    SLEEP_FCN_TIMER,
    BATTERY_MONITOR_TIMER,
    CHALET_POWER_RELAY_AUTOTURNOFF_TIMER,
    WIFI_RECONNECT_TIMER,
	TIMER_MAX_ID
}eTimerID;

typedef struct
{
	unsigned int uiStart;
	unsigned int uiMillisecCounter;
	unsigned int uiSecondCounter;
	unsigned int uiPeriodMillisec;
	unsigned int uiPeriodSecond;
	bool bRunning;
} stTimer;

/* ************************************************************************** */
/* Prototypes */
void TimerInit(void);
int IsMilliSecTimerExpired(eTimerID p_eTimerID);
int IsSecTimerExpired(eTimerID p_eTimerID);
int IsTimerExpired(eTimerID p_eTimerID);
void TimerStart(eTimerID p_eTimerID, unsigned int p_uiPeriod);
void TimerStartSeconds(eTimerID p_eTimerID, unsigned int p_uiPeriod);
void TimerStop(eTimerID p_eTimerID);
void TimerReset(eTimerID p_eTimerID);
bool IsTimerRunning(eTimerID p_eTimerID);

void Sleep(unsigned int millisecs);

#endif
//EOF

