summaryrefslogtreecommitdiffhomepage
path: root/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/rfBattery.h
blob: 2d1a65cbdbcd6429db360de18c8e98bbc1c0f7fe (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/**************************************************************************//**
  \file rfBattery.h
    
  \brief Prototypes of battery monitor functions and corresponding types.
    Powered by RF chip.

  \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:     
      15/01/08 A. Mandychev - Created.
******************************************************************************/

#ifndef _RFBATTERY_H
#define _RFBATTERY_H

/******************************************************************************
                    Includes section
******************************************************************************/
#include <types.h>
#include <macCommon.h>

/******************************************************************************
                    Define(s) section
******************************************************************************/
 
/******************************************************************************
                    Types section
******************************************************************************/

//! Possible set of battery monitor values.
typedef enum
{
  RF_1V70_BAT_VTG = 0x0,
  RF_1V75_BAT_VTG = 0x1,
  RF_1V80_BAT_VTG = 0x2,
  RF_1V85_BAT_VTG = 0x3,
  RF_1V90_BAT_VTG = 0x4,
  RF_1V95_BAT_VTG = 0x5,
  RF_2V00_BAT_VTG = 0x6,
  RF_2V05_BAT_VTG = 0x7,
  RF_2V10_BAT_VTG = 0x8,
  RF_2V15_BAT_VTG = 0x9,
  RF_2V20_BAT_VTG = 0xA,
  RF_2V25_BAT_VTG = 0xB,
  RF_2V30_BAT_VTG = 0xC,
  RF_2V35_BAT_VTG = 0xD,
  RF_2V40_BAT_VTG = 0xE,
  RF_2V45_BAT_VTG = 0xF,
  RF_2V550_BAT_VTG = 0x10 | 0x0,
  RF_2V625_BAT_VTG = 0x10 | 0x1,
  RF_2V700_BAT_VTG = 0x10 | 0x2,
  RF_2V775_BAT_VTG = 0x10 | 0x3,
  RF_2V850_BAT_VTG = 0x10 | 0x4,
  RF_2V925_BAT_VTG = 0x10 | 0x5,
  RF_3V000_BAT_VTG = 0x10 | 0x6,
  RF_3V075_BAT_VTG = 0x10 | 0x7,
  RF_3V150_BAT_VTG = 0x10 | 0x8,
  RF_3V225_BAT_VTG = 0x10 | 0x9,
  RF_3V300_BAT_VTG = 0x10 | 0xA,
  RF_3V375_BAT_VTG = 0x10 | 0xB,
  RF_3V450_BAT_VTG = 0x10 | 0xC,
  RF_3V525_BAT_VTG = 0x10 | 0xD,
  RF_3V600_BAT_VTG = 0x10 | 0xE,
  RF_3V675_BAT_VTG = 0x10 | 0xF,
} RF_BatteryMonVtg_t;

/**
 * \brief Battery monitor status type.
*  RF_SUCCESS_BAT_MON_STATUS means that voltage threshold has been 
*  successfuly set. RF_BatteryMonInd() will appeared when supply voltage
*  is lower than voltage threshold.
*  RF_FAIL_BAT_MON_STATUS means that voltage threshold hasn't been 
*  successfuly set. Because supply voltage is lower than voltage threshold.
*  RF_BatteryMonInd() wont appeared in this case.
*/
typedef enum 
{
  RF_SUCCESS_BAT_MON_STATUS,  
  RF_FAIL_BAT_MON_STATUS,
} RF_BatteryMonStatus_t;

//! Battery monitor confirm structure.
typedef struct
{
  //! Status of RF_BatteryMonReq. 
  RF_BatteryMonStatus_t status;
} RF_BatteryMonConf_t;

//! Battery monitor request structure.
typedef struct
{
  //! Service field - for internal needs.
  MAC_Service_t  service;
  //! Threshold voltage.
  RF_BatteryMonVtg_t voltage;
  //! Confirm structure on RF_BatteryMonReq.
  RF_BatteryMonConf_t confirm;
  //! Callback on RF_BatteryMonReq.
  void (*RF_BatteryMonConf)(RF_BatteryMonConf_t *conf);
} RF_BatteryMonReq_t;

/******************************************************************************
                    Prototypes section
******************************************************************************/
/**************************************************************************//**
  \brief Sets battery monitor voltage. 
  \param reqParams - request parameters structure pointer. 
  \return none. 
******************************************************************************/
void RF_BatteryMonReq(RF_BatteryMonReq_t *reqParams);

/**************************************************************************//**
  \brief Inidicates that supply voltage drop below the configured threshold. 
  \return none.
******************************************************************************/
extern void RF_BatteryMonInd(void);

#endif /*_RFBATTERY_H*/

// eof rfBattery.h