changeset 166:2fba36caf039

Initial work for KLL macro support
author Jacob Alexander <haata@kiibohd.com>
date Sat, 14 Jun 2014 11:00:29 -0700
parents 0d992d26114f
children 81f0936706ab
files Macro/PartialMap/macro.c Macro/PartialMap/macro.h Macro/PartialMap/usb_hid.h
diffstat 3 files changed, 55 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Macro/PartialMap/macro.c	Mon Jun 09 23:01:32 2014 -0700
+++ b/Macro/PartialMap/macro.c	Sat Jun 14 11:00:29 2014 -0700
@@ -73,6 +73,44 @@
 
 // ----- Functions -----
 
+// Looks up the start of the function ptr list for the active layer, by scan code
+inline void *Macro_layerLookup( uint8_t scanCode )
+{
+	// TODO
+	return 0;
+}
+
+
+// Called for each key from the Scan Module for one of three cases:
+//  1. Key is pressed         (PRESSED)
+//  2. Key is being held down (HELD)
+//  3. Key is released        (RELEASED)
+// If Scan Module is for an analog sense keyboard, do not use the defined keystates
+// This function should not be called if not pressed (depressed) or at 0%
+inline void Macro_keyUpdate( uint8_t scanCode, uint8_t state )
+{
+	// Do layer lookup to find which capabilities to map
+	void *capabilities = Macro_layerLookup( scanCode );
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 inline void Macro_bufferAdd( uint8_t byte )
 {
 	// Make sure we haven't overflowed the key buffer
@@ -129,7 +167,7 @@
 		return;
 
 	// Loop through input buffer
-	for ( uint8_t index = 0; index < KeyIndex_BufferUsed; index++ )
+	for ( uint8_t index = 0; index < KeyIndex_BufferUsed && !macroDebugMode; index++ )
 	{
 		//print(" KEYS: ");
 		//printInt8( KeyIndex_BufferUsed );
--- a/Macro/PartialMap/macro.h	Mon Jun 09 23:01:32 2014 -0700
+++ b/Macro/PartialMap/macro.h	Sat Jun 14 11:00:29 2014 -0700
@@ -29,6 +29,15 @@
 
 
 
+// ----- Defines -----
+
+// Key states (DO NOT USE for analog keyboards)
+#define DEPRESSED 0
+#define  RELEASED 1
+#define   PRESSED 254
+#define      HELD 255
+
+
 // ----- Variables -----
 
 
--- a/Macro/PartialMap/usb_hid.h	Mon Jun 09 23:01:32 2014 -0700
+++ b/Macro/PartialMap/usb_hid.h	Sat Jun 14 11:00:29 2014 -0700
@@ -81,7 +81,8 @@
 #define KEY_NUMBER         0x32
 #define KEY_SEMICOLON      0x33
 #define KEY_QUOTE          0x34
-#define KEY_TILDE          0x35
+#define KEY_TILDE          0x35 // TODO Removeme (old definition)
+#define KEY_BACKTICK       0x35
 #define KEY_COMMA          0x36
 #define KEY_PERIOD         0x37
 #define KEY_SLASH          0x38
@@ -128,7 +129,8 @@
 #define KEYPAD_9           0x61
 #define KEYPAD_0           0x62
 #define KEYPAD_PERIOD      0x63
-#define KEY_ISO_BACKSLASH  0x64
+#define KEY_ISO_BACKSLASH  0x64 // TODO Removeme (old definition)
+#define KEY_ISO_SLASH      0x64
 #define KEY_APP            0x65
 #define KEYBOARD_STATUS    0x66 // Used for indicating status or errors, not a key
 #define KEYPAD_EQUAL       0x67
@@ -158,9 +160,9 @@
 #define KEY_MUTE           0x7F
 #define KEY_VOL_UP         0x80
 #define KEY_VOL_DOWN       0x81
-#define KEY_CAPS_LLOCK     0x82 // "Locking" Scroll Lock (Old keyboards with Locking Caps Lock)
-#define KEY_NUM_LLOCK      0x83
-#define KEY_SCROLL_LLOCK   0x84
+#define KEY_CAPS_TLOCK     0x82 // Toggle "Locking" Scroll Lock (Old keyboards with Locking Caps Lock)
+#define KEY_NUM_TLOCK      0x83
+#define KEY_SCROLL_TLOCK   0x84
 #define KEYPAD_COMMA       0x85 // Brazillian (See spec)
 #define KEYPAD_EQUAL_AS    0x86 // AS/400 Keyboard (See spec)
 #define KEY_INTER1         0x87 // KANJI1 - Brazillian and Japanese "Ru" and "-"