Просмотр исходного кода

Initial work for KLL macro support

simple
Jacob Alexander 10 лет назад
Родитель
Сommit
89193f807e
3 измененных файлов: 55 добавлений и 6 удалений
  1. 39
    1
      Macro/PartialMap/macro.c
  2. 9
    0
      Macro/PartialMap/macro.h
  3. 7
    5
      Macro/PartialMap/usb_hid.h

+ 39
- 1
Macro/PartialMap/macro.c Просмотреть файл

@@ -73,6 +73,44 @@ uint8_t macroDebugMode = 0;

// ----- 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 @@ inline void Macro_process()
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 );

+ 9
- 0
Macro/PartialMap/macro.h Просмотреть файл

@@ -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 -----



+ 7
- 5
Macro/PartialMap/usb_hid.h Просмотреть файл

@@ -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 "-"