summaryrefslogtreecommitdiffhomepage
path: root/digital/zigbit/bitcloud/stack/Components/SystemEnvironment/include/sysTimer.h
blob: 4420725d67f3c3a7b0bcb3123e14713e6f7a102d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/**************************************************************************//**
  \file  sysTimer.h

  \brief Simple interface of HAL application timer.

  \author
    Atmel Corporation: http://www.atmel.com \n
    Support email: avr@atmel.com

  Copyright (c) 2008-2011, Atmel Corporation. All rights reserved.
  Licensed under Atmel's Limited License Agreement (BitCloudTM).

  \internal
   History:
    2010-10-18 Max Gekk - Created.
   Last change:
    $Id: sysTimer.h 17448 2011-06-09 13:53:59Z ataradov $
 ******************************************************************************/
#if !defined _SYS_TIMER_H
#define _SYS_TIMER_H

/******************************************************************************
                               Includes section
 ******************************************************************************/
#include <appTimer.h>

/******************************************************************************
                                Types section
 ******************************************************************************/
/* Internal states of system timer. */
typedef enum _SYS_TimerState_t
{
  SYS_TIMER_STOPPED = 0x00,
  SYS_TIMER_STARTED = 0x01
} SYS_TimerState_t;

/* Type of the system timer. */
typedef struct _SYS_Timer_t
{
  SYS_TimerState_t state;
  HAL_AppTimer_t timer;
} SYS_Timer_t;


/******************************************************************************
                              Prototypes section
 ******************************************************************************/
/******************************************************************************
  \brief Initialize the System Timer.

  \param[in] sysTimer - timer pointer will be initialized.
  \param[in] mode - timer mode:  TIMER_ONE_SHOT_MODE or TIMER_REPEAT_MODE.
  \param[in] interval - timer interval (milliseconds).
  \param[in] handler - timer handler function pointer.

  \return None.
 *****************************************************************************/
void SYS_InitTimer(SYS_Timer_t *const sysTimer, const TimerMode_t mode, 
  const uint32_t interval, void (*handler)(void));

/******************************************************************************
  \brief Start the HAL Application Timer.

  \param[in] appTimer - timer pointer will be started.
  \return None.
 ******************************************************************************/
void SYS_StartTimer(SYS_Timer_t *const sysTimer);

/******************************************************************************
  \brief Stop the HAL Application Timer.

  \param[in] appTimer - timer pointer will be stopped.

  \return None.
 *****************************************************************************/
void SYS_StopTimer(SYS_Timer_t *const sysTimer); 

#endif /* _SYS_TIMER_H */
/** eof sysTimer.h */