NewAskSin
 All Classes Files Functions Variables Groups Pages
Power.h
1 //- -----------------------------------------------------------------------------------------------------------------------
2 // AskSin driver implementation
3 // 2013-08-03 <trilu@gmx.de> Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
4 //- -----------------------------------------------------------------------------------------------------------------------
5 //- AskSin power management function --------------------------------------------------------------------------------------
6 //- with a lot of support from martin876 at FHEM forum
7 //- -----------------------------------------------------------------------------------------------------------------------
8 
9 #ifndef _PW_H
10 #define _PW_H
11 
12 #include "HAL.h"
13 
14 // - power modes to implement -----------
15 // 0 - 19.9ma; no power management
16 // 1 - wake up every 250ms, check for wakeup signal on air and stay awake accordingly, timer gets updated every 250ms
17 // 2 - deep sleep, wakeup every 250ms, not able to receive anything while sleeping, timer gets updated every 256ms
18 // 3 - 0.04ma; deep sleep, wakeup every 8 seconds, not able to receive anything while sleeping, timer gets updated every 8192ms
19 // 4 - 0.00ma; deep sleep, wakeup only on interrupt
20 
21 class PW {
22  friend class AS;
23 
24  private: //---------------------------------------------------------------------------------------------------------
25  protected: //---------------------------------------------------------------------------------------------------------
26  class AS *pHM; // pointer to main class for function calls
27 
28  uint8_t pwrMode :3; // remember the level of power savings
29  uint8_t chkCCBurst :1;
30  uint8_t comStat :1;
31  uint8_t tmpCCBurst :1;
32 
33  public: //---------------------------------------------------------------------------------------------------------
34 
35  public: //---------------------------------------------------------------------------------------------------------
36  void setMode(uint8_t mode);
37  void stayAwake(uint16_t time);
38 
39  protected: //---------------------------------------------------------------------------------------------------------
40  private: //---------------------------------------------------------------------------------------------------------
41  PW();
42  void init(AS *ptrMain);
43  void poll(void);
44 };
45 
46 #endif
Main class for implementation of the AskSin protocol stack. Every device needs exactly one instance o...
Definition: AS.h:39
void init(void)
Initialize the AS module.
Definition: AS.cpp:20
Definition: Power.h:21
void poll(void)
Poll routine for regular operation.
Definition: AS.cpp:44