NewAskSin
 All Classes Files Functions Variables Groups Pages
ConfButton.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 config key function --------------------------------------------------------------------------------------------
6 //- with a lot of support from martin876 at FHEM forum
7 //- -----------------------------------------------------------------------------------------------------------------------
8 
9 #ifndef _CB_H
10 #define _CB_H
11 
12 #include "HAL.h"
13 
14 
15 // - scenario 00 ----------------------------
16 // no config button used
17 //
18 // - scenario 01 ----------------------------
19 // short press = pair
20 // long press = nothing
21 // double long = nothing
22 // double long release = reset
23 //
24 // - scenario 02 ----------------------------
25 // short press = toggle channel one
26 // long press = pair
27 // double long = nothing
28 // double long release = reset
29 //
30 // if 0x18 localResDis available, take care of it and enable or disable double long
31 
54 class CB {
55  friend class AS;
56 
57  public: //---------------------------------------------------------------------------------------------------------
58  protected: //---------------------------------------------------------------------------------------------------------
59  private: //---------------------------------------------------------------------------------------------------------
60  class AS *pHM; // pointer to main class for function calls
61 
62  public: //---------------------------------------------------------------------------------------------------------
63  uint8_t scn :3; // scenario indicator
64  uint8_t btn :3; // result of chkPCINT
65 
66  uint8_t armFlg :1; // armed flag, will be set on first touch
67 
68  uint8_t lstLng :1; // remember a long press
69  uint8_t lngRpt :1; // remember last key press to detect double or long
70  uint8_t dblLng :1; // check for a double long
71 
72  uint8_t lstSht :1; // remember that last key was a short
73 
74  uint8_t pciByte; // PCI byte, indicate interrupt channel
75  uint8_t pciBit; // PCI bit indicate bit number in PCI channel byte
76 
77  public: //---------------------------------------------------------------------------------------------------------
78  void config(uint8_t mode, uint8_t pcIntByte, uint8_t pcIntBit);
79 
80  protected: //---------------------------------------------------------------------------------------------------------
81  private: //---------------------------------------------------------------------------------------------------------
82  CB();
83 
84  void init(AS *ptrMain);
85  void poll(void);
86 
87  void outSignal(uint8_t mode);
88 
89 };
90 
91 #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
Class for the handling the configuration key of the device Right now there are three possible scenari...
Definition: ConfButton.h:54
void poll(void)
Poll routine for regular operation.
Definition: AS.cpp:44