-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCommand.h
More file actions
129 lines (110 loc) · 2.55 KB
/
Command.h
File metadata and controls
129 lines (110 loc) · 2.55 KB
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
127
128
//////////////////////////////////////////////////////////////////////////////
//
// Filename: Command.h
// Version:
// Data:
//
// Author: Liu, Zemin
// Company: JYE Tech
//
//-----------------------------------------------------------------------------
//
// Target: STM32F103C8
// Tool chain: CodeSourcery G++
//
//-----------------------------------------------------------------------------
// Required files:
//
//-----------------------------------------------------------------------------
// Notes:
//
//
//-----------------------------------------------------------------------------
// Revision History:
//
///////////////////////////////////////////////////////////////////////////////
//
//
#ifndef Command_h
#define Command_h
#include "Common.h"
// ============== Key Analysis Definitions =====================
typedef struct {
// Keypad processing variables
U16 Flags;
U16 KScanBuf;
U16 KScanCode;
U16 KeyCode;
U16 KeyParam;
U16 KeyCodeBuf;
U16 KCount; // Key debounce counter
U16 KDebounceVal; // Debounce timing length (number of scans)
U16 KHCount; // Key hold counter
U16 KTimeChk; // Key time check
} KEYPAD;
enum KeypadFlags {
KF_DoKeyScan = 0,
};
// -- Key-Event mapping
typedef struct {
U8 Keycode;
U8 Event;
}KeyEvent ;
// -- Key code conversion
typedef struct {
U16 ScanCode;
U8 Keycode;
}KeyMap ;
// --------------------------------------
// Keypad
typedef struct {
U16 ScanCode;
U8 KeyCode;
U8 KeyParam;
}KeyScanCode;
// -- Key Code Definitions
enum KeyCodes {
KC_void = 0,
KC_SW1,
KC_SW2,
KC_SW3,
KC_SW4,
KC_SW1H,
KC_SW2H,
KC_SW3H,
KC_SW4H,
};
// Pushbutton processing parameters
#define NoKey 0xFFFF
#define KD_val 2 //
#define KD_val1 5 //
#define KH_val 20 //
#define KR_Time 1
// Setting status
#define SettingStatus_Initialized 0xF3C5
// ===========================================================
// Export variables
// ===========================================================
//
extern KEYPAD Keypad;
extern U16 Flags;
// ===========================================================
// Function Declarations
// ===========================================================
//
void AppInit();
void KeyScan(void);
void KeyConvert(KeyScanCode *KSCTab, U16 KSCode);
U8 KeyEventMap(U8 keycode, KeyEvent *kvmap);
void KeyProc(void);
void DoKeyOk(void);
void DoKeyInc(void);
void DoKeyDec(void);
void DoKeySel(void);
void DoKeyOkH(void);
void DoKeyIncH(void);
void DoKeyDecH(void);
void DoKeySelH(void);
void LedBlink(void);
void TestMode(void);
#endif