summaryrefslogtreecommitdiffhomepage
path: root/digital/zigbit/bitcloud/stack/Components/HAL/include/appTimer.h
blob: 9c241ab6666dae911e12d1a936345f62c1530cbc (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
80
81
/***************************************************************************//**
  \file  appTimer.h

  \brief The header file describes the appTimer interface.

  \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:
    5/12/07 A. Khromykh - Created
 ******************************************************************************/
/******************************************************************************
 *   WARNING: CHANGING THIS FILE MAY AFFECT CORE FUNCTIONALITY OF THE STACK.  *
 *   EXPERT USERS SHOULD PROCEED WITH CAUTION.                                *
 ******************************************************************************/

#ifndef _APPTIMER_H
#define _APPTIMER_H

// \cond
/******************************************************************************
                   Includes section
******************************************************************************/
#include <types.h>
#include <bcTimer.h>
#include <halAppClock.h>
// \endcond

/******************************************************************************
                   Types section
******************************************************************************/
/** \brief fields of structure: \n
    uint32_t interval - timer firing interval. Interval must be more than 10 ms (set by user) \n
    TimerMode_t mode - timer work mode (set by user). Must be chosen from: \n
           TIMER_REPEAT_MODE \n
           TIMER_ONE_SHOT_MODE \n
    void (*callback)(void) - pointer to timer callback function (set by user). */
typedef Timer_t HAL_AppTimer_t;

/******************************************************************************
                   Prototypes section
******************************************************************************/
/**************************************************************************//**
\brief Starts to count an interval (starts user timer).

\param[in]
  appTimer - pointer to the timer structure (HAL_AppTimer_t is typedef Timer_t)

\return
 -1 - pointer is NULL
  0 - success
******************************************************************************/
int HAL_StartAppTimer(HAL_AppTimer_t *appTimer);

/**************************************************************************//**
\brief Stops the user timer.

\param[in]
  appTimer - pointer to the timer structure.

\return
 -1 - there is no appTimer started or pointer is NULL
  0 - success
******************************************************************************/
int HAL_StopAppTimer(HAL_AppTimer_t *appTimer);

/**************************************************************************//**
\brief Gets system time.

\return
  time since power up in milliseconds(8 bytes).
******************************************************************************/
BcTime_t HAL_GetSystemTime(void);

#endif /*_APPTIMER_H*/
//eof appTimer.h