From 91bc0cd5909007bb3608cb37880af8447c7ac877 Mon Sep 17 00:00:00 2001 From: Diego Roversi Date: Sun, 19 Nov 2017 09:25:23 +0100 Subject: Start of the refactoring of the keyboard layout Add some comments and definition to clarify how data is used --- TERES-HID/KeyboardMouse.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/TERES-HID/KeyboardMouse.h b/TERES-HID/KeyboardMouse.h index dfa68e2..52267ff 100644 --- a/TERES-HID/KeyboardMouse.h +++ b/TERES-HID/KeyboardMouse.h @@ -100,13 +100,22 @@ const void* ReportData, const uint16_t ReportSize); -const int keys[224] = {HID_KEYBOARD_SC_LEFT_CONTROL,HID_KEYBOARD_SC_GRAVE_ACCENT_AND_TILDE,HID_KEYBOARD_SC_F1,HID_KEYBOARD_SC_F2,HID_KEYBOARD_SC_5_AND_PERCENTAGE,HID_KEYBOARD_SC_6_AND_CARET,HID_KEYBOARD_SC_EQUAL_AND_PLUS,HID_KEYBOARD_SC_F8,HID_KEYBOARD_SC_MINUS_AND_UNDERSCORE,0,HID_KEYBOARD_SC_F9,HID_KEYBOARD_SC_DELETE,0,0, +const int keys[224] = { + // Y6 + HID_KEYBOARD_SC_LEFT_CONTROL,HID_KEYBOARD_SC_GRAVE_ACCENT_AND_TILDE,HID_KEYBOARD_SC_F1,HID_KEYBOARD_SC_F2,HID_KEYBOARD_SC_5_AND_PERCENTAGE,HID_KEYBOARD_SC_6_AND_CARET,HID_KEYBOARD_SC_EQUAL_AND_PLUS,HID_KEYBOARD_SC_F8,HID_KEYBOARD_SC_MINUS_AND_UNDERSCORE,0,HID_KEYBOARD_SC_F9,HID_KEYBOARD_SC_DELETE,0,0, + // Y1 0,HID_KEYBOARD_SC_TAB,HID_KEYBOARD_SC_CAPS_LOCK,HID_KEYBOARD_SC_F3,HID_KEYBOARD_SC_T,HID_KEYBOARD_SC_Y,HID_KEYBOARD_SC_CLOSING_BRACKET_AND_CLOSING_BRACE,HID_KEYBOARD_SC_F7,HID_KEYBOARD_SC_OPENING_BRACKET_AND_OPENING_BRACE,0,HID_KEYBOARD_SC_BACKSPACE,0,0,HID_KEYBOARD_SC_LEFT_SHIFT, + // Y2 0,HID_KEYBOARD_SC_A,HID_KEYBOARD_SC_S,HID_KEYBOARD_SC_D,HID_KEYBOARD_SC_F,HID_KEYBOARD_SC_J,HID_KEYBOARD_SC_K,HID_KEYBOARD_SC_L,HID_KEYBOARD_SC_SEMICOLON_AND_COLON,0,HID_KEYBOARD_SC_BACKSLASH_AND_PIPE,0,0,HID_KEYBOARD_SC_RIGHT_SHIFT, + // Y3 0,HID_KEYBOARD_SC_ESCAPE,0,HID_KEYBOARD_SC_F4,HID_KEYBOARD_SC_G,HID_KEYBOARD_SC_H,HID_KEYBOARD_SC_F6,0,HID_KEYBOARD_SC_APOSTROPHE_AND_QUOTE,HID_KEYBOARD_SC_LEFT_ALT,HID_KEYBOARD_SC_F11,HID_KEYBOARD_SC_SPACE,0,HID_KEYBOARD_SC_UP_ARROW, + // Y4 HID_KEYBOARD_SC_RIGHT_CONTROL,HID_KEYBOARD_SC_Z,HID_KEYBOARD_SC_X,HID_KEYBOARD_SC_C,HID_KEYBOARD_SC_V,HID_KEYBOARD_SC_M,HID_KEYBOARD_SC_COMMA_AND_LESS_THAN_SIGN,HID_KEYBOARD_SC_DOT_AND_GREATER_THAN_SIGN,0,0,HID_KEYBOARD_SC_ENTER,0,0,0, + // Y5 0,0,0,0,HID_KEYBOARD_SC_B,HID_KEYBOARD_SC_N,0,HID_KEYBOARD_SC_COMPOSE,HID_KEYBOARD_SC_SLASH_AND_QUESTION_MARK,HID_KEYBOARD_SC_RIGHT_ALT,HID_KEYBOARD_SC_F12,HID_KEYBOARD_SC_DOWN_ARROW,HID_KEYBOARD_SC_RIGHT_ARROW,HID_KEYBOARD_SC_LEFT_ARROW, + // y0 0,HID_KEYBOARD_SC_Q,HID_KEYBOARD_SC_W,HID_KEYBOARD_SC_E,HID_KEYBOARD_SC_R,HID_KEYBOARD_SC_U,HID_KEYBOARD_SC_I,HID_KEYBOARD_SC_O,HID_KEYBOARD_SC_P,0,0,0,0,0, + // /y7 HID_KEYBOARD_SC_F5,HID_KEYBOARD_SC_1_AND_EXCLAMATION,HID_KEYBOARD_SC_2_AND_AT,HID_KEYBOARD_SC_3_AND_HASHMARK,HID_KEYBOARD_SC_4_AND_DOLLAR,HID_KEYBOARD_SC_7_AND_AMPERSAND,HID_KEYBOARD_SC_8_AND_ASTERISK,HID_KEYBOARD_SC_9_AND_OPENING_PARENTHESIS,HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS,HID_KEYBOARD_SC_PRINT_SCREEN,HID_KEYBOARD_SC_F10,0,0,0, HID_KEYBOARD_SC_LEFT_CONTROL,HID_KEYBOARD_SC_GRAVE_ACCENT_AND_TILDE,HID_KEYBOARD_SC_SLEEP,HID_KEY_WLAN,HID_KEYBOARD_SC_5_AND_PERCENTAGE,HID_KEYBOARD_SC_6_AND_CARET,HID_KEYBOARD_SC_EQUAL_AND_PLUS,HID_KEY_BRIGTHNESS_UP,HID_KEYBOARD_SC_MINUS_AND_UNDERSCORE,0,HID_KEY_DISPLAY_SWITCH,HID_KEYBOARD_SC_DELETE,0,0, @@ -131,8 +140,11 @@ const int keym[112] = {HID_KEYBOARD_MODIFIER_LEFTCTRL,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -//const int rowX[14]={12,13,5,6,1,A4,A1,7,A3,30,A2,A0,31,4}; -const uint8_t rowY[8]={0xbf,0xfd,0x7f,0xfe,0xef,0xdf,0xfb,0xf7}; +#define CFF(x) (255 - (1 << (x))) +#define BIT(x) ( 1 << (x) ) +// const int rowX[14]={12,13,5,6,1,A4,A1,7,A3,30,A2,A0,31,4}; +const uint8_t rowY[8] = { CFF(6), CFF(1), CFF(7), CFF(0), CFF(4), CFF(5), CFF(2), CFF(3) }; +// const uint8_t rowY[8]={0xbf,0xfd,0x7f,0xfe,0xef,0xdf,0xfb,0xf7}; const uint8_t rowYN[8]={0x40,0x02,0x80,0x01,0x10,0x20,0x04,0x08}; -- cgit v1.2.3