From b0f0d2e9ca18d8604225bed3c984e4cf1b4c4b3c Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Wed, 10 Feb 2016 20:31:09 +0100 Subject: Initial import --- Command.h | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 Command.h (limited to 'Command.h') diff --git a/Command.h b/Command.h new file mode 100644 index 0000000..5301749 --- /dev/null +++ b/Command.h @@ -0,0 +1,129 @@ +////////////////////////////////////////////////////////////////////////////// +// +// 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 + -- cgit v1.2.3