DSO138_SourceCodes_v037.rar
[DSO138] / Command.h
1 //////////////////////////////////////////////////////////////////////////////
2 //
3 //      Filename:       Command.h
4 //      Version:                
5 //      Data:           
6 //
7 //      Author:         Liu, Zemin
8 //      Company:        JYE Tech
9 //
10 //-----------------------------------------------------------------------------
11 //
12 //      Target:                 STM32F103C8 
13 //      Tool chain:     CodeSourcery G++
14 //
15 //-----------------------------------------------------------------------------
16 //      Required files:
17 //
18 //-----------------------------------------------------------------------------
19 //      Notes:
20 //
21 //
22 //-----------------------------------------------------------------------------
23 //      Revision History:
24 //
25 ///////////////////////////////////////////////////////////////////////////////
26 //
27 //
28 #ifndef Command_h
29 #define Command_h
30
31 #include        "Common.h"
32
33 // ============== Key Analysis Definitions =====================
34
35 typedef struct {
36         // Keypad processing variables
37         U16     Flags;
38         U16     KScanBuf;
39         U16     KScanCode;
40         U16     KeyCode;
41         U16     KeyParam;
42         U16     KeyCodeBuf;
43         U16     KCount;                 // Key debounce counter
44         U16     KDebounceVal;   // Debounce timing length (number of scans)
45         U16     KHCount;                // Key hold counter
46         U16     KTimeChk;               // Key time check 
47
48         } KEYPAD;
49
50 enum    KeypadFlags {
51         KF_DoKeyScan            = 0,
52
53         };
54
55 // -- Key-Event mapping 
56 typedef struct  {
57         U8      Keycode;
58         U8      Event;
59         }KeyEvent ;
60
61 // -- Key code conversion 
62 typedef struct  {
63         U16     ScanCode;
64         U8      Keycode;
65         }KeyMap ;
66
67 // --------------------------------------
68 // Keypad 
69 typedef struct  {
70         U16     ScanCode;
71         U8      KeyCode;
72         U8      KeyParam;
73         }KeyScanCode;
74
75 // -- Key Code Definitions 
76 enum    KeyCodes {
77         KC_void = 0,                            
78         KC_SW1,                         
79         KC_SW2,                         
80         KC_SW3,                         
81         KC_SW4,                         
82         KC_SW1H,                                
83         KC_SW2H,                                
84         KC_SW3H,                                
85         KC_SW4H,                
86         };
87
88 // Pushbutton processing parameters
89 #define NoKey                   0xFFFF  
90
91 #define KD_val                  2               // 
92 #define KD_val1                 5               // 
93 #define KH_val                  20              // 
94 #define KR_Time         1       
95
96 // Setting status
97 #define SettingStatus_Initialized               0xF3C5
98
99
100 // ===========================================================
101 //      Export variables
102 // ===========================================================
103 //
104 extern  KEYPAD  Keypad;
105 extern  U16     Flags;
106
107 // ===========================================================
108 //      Function Declarations
109 // ===========================================================
110 //
111 void    AppInit();
112 void KeyScan(void);
113 void    KeyConvert(KeyScanCode *KSCTab, U16 KSCode);
114 U8      KeyEventMap(U8 keycode, KeyEvent *kvmap);
115 void    KeyProc(void);
116 void    DoKeyOk(void);
117 void    DoKeyInc(void);
118 void    DoKeyDec(void);
119 void    DoKeySel(void);
120 void    DoKeyOkH(void);
121 void    DoKeyIncH(void);
122 void    DoKeyDecH(void);
123 void    DoKeySelH(void);
124 void    LedBlink(void);
125 void    TestMode(void);
126
127
128 #endif
129