diff --git a/Macro/PartialMap/kll.h b/Macro/Common/kll.h similarity index 88% rename from Macro/PartialMap/kll.h rename to Macro/Common/kll.h index 492e1ba..ebfbc59 100644 --- a/Macro/PartialMap/kll.h +++ b/Macro/Common/kll.h @@ -64,6 +64,15 @@ typedef uint16_t nat_ptr_t; // ----- Structs ----- +// -- Macro Type +// Defines what type of Macro the struct defines +// Always the first field +typedef enum MacroType { + MacroType_Normal, // Sequence of Combos + MacroType_Simple, // Single combination (no state required) +} MacroType; + + // -- Result Macro // Defines the sequence of combinations to as the Result of Trigger Macro // For RAM optimization reasons, ResultMacro has been split into ResultMacro and ResultMacroRecord structures @@ -72,7 +81,9 @@ typedef uint16_t nat_ptr_t; // Default Args (always sent): key state/analog of last key // Combo Length of 0 signifies end of sequence // -// ResultMacro.guide -> [|||||...||...|0] +// ResultMacro.type -> +// ResultMacro.guide -> [|||||...||...|0] +// ResultMacro.triggerKey -> // // ResultMacroRecord.pos -> // ResultMacroRecord.state -> @@ -80,7 +91,9 @@ typedef uint16_t nat_ptr_t; // ResultMacro struct, one is created per ResultMacro, no duplicates typedef struct ResultMacro { + const MacroType type; const uint8_t *guide; + const uint8_t triggerKey; } ResultMacro; typedef struct ResultMacroRecord { @@ -117,6 +130,7 @@ typedef struct ResultGuide { // // Combo Length of 0 signifies end of sequence // +// TriggerMacro.type -> // TriggerMacro.guide -> [|||...|||...|0] // TriggerMacro.result -> // @@ -132,6 +146,7 @@ typedef enum TriggerMacroState { // TriggerMacro struct, one is created per TriggerMacro, no duplicates typedef struct TriggerMacro { + const MacroType type; const uint8_t *guide; const var_uint_t result; } TriggerMacro; @@ -190,10 +205,16 @@ typedef struct Capability { // * index - Trigger Macro index number // * trigger - Trigger Macro guide (see TriggerMacro) // Define_TM( index, result ); +// +// * index - Trigger Macro index number +// * result - Result Macro index number which is triggered by this Trigger Macro +// Define_STM( index, result ); +// // * index - Trigger Macro index number // * result - Result Macro index number which is triggered by this Trigger Macro #define Guide_TM( index ) const uint8_t tm##index##_guide[] -#define Define_TM( index, result ) { tm##index##_guide, result } +#define Define_TM( index, result ) { MacroType_Normal, tm##index##_guide, result } +#define Define_STM( index, result ) { MacroType_Simple, tm##index##_guide, result } // -- Trigger Macro List diff --git a/Macro/Common/setup.cmake b/Macro/Common/setup.cmake new file mode 100644 index 0000000..80207d5 --- /dev/null +++ b/Macro/Common/setup.cmake @@ -0,0 +1,24 @@ +###| CMake Kiibohd Controller Macro Module |### +# +# Written by Jacob Alexander in 2014 for the Kiibohd Controller +# +# Released into the Public Domain +# +### + +### +# Warning, that this module is not meant to be built stand-alone +# +message( FATAL_ERROR +"The 'Common' module is not a stand-alone module, and requires further setup." +) + +### +# Module C files +# + + +### +# Module Specific Options +# + diff --git a/Macro/PartialMap/usb_hid.h b/Macro/Common/usb_hid.h similarity index 100% rename from Macro/PartialMap/usb_hid.h rename to Macro/Common/usb_hid.h diff --git a/Macro/PartialMap/setup.cmake b/Macro/PartialMap/setup.cmake index 7f72689..750f974 100644 --- a/Macro/PartialMap/setup.cmake +++ b/Macro/PartialMap/setup.cmake @@ -1,4 +1,4 @@ -###| CMake Kiibohd Controller Macro Module |### +###| CMake Kiibohd Controller PartialMap Macro Module |### # # Written by Jacob Alexander in 2014-2015 for the Kiibohd Controller #