Ver código fonte

Preparing for SimpleMap macro module

- Will use only flash memory (no ram usage for each layer or macro)
- Only supports combinations, no sequences.
simple
Jacob Alexander 9 anos atrás
pai
commit
775e4eab8f

Macro/PartialMap/kll.h → Macro/Common/kll.h Ver arquivo



// ----- Structs ----- // ----- 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 // -- Result Macro
// Defines the sequence of combinations to as the Result of Trigger 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 // For RAM optimization reasons, ResultMacro has been split into ResultMacro and ResultMacroRecord structures
// Default Args (always sent): key state/analog of last key // Default Args (always sent): key state/analog of last key
// Combo Length of 0 signifies end of sequence // Combo Length of 0 signifies end of sequence
// //
// ResultMacro.guide -> [<combo length>|<capability index>|<arg1>|<argn>|<capability index>|...|<combo length>|...|0]
// ResultMacro.type -> <Type of macro>
// ResultMacro.guide -> [<combo length>|<capability index>|<arg1>|<argn>|<capability index>|...|<combo length>|...|0]
// ResultMacro.triggerKey -> <scanCode of last key in TriggerMacro>
// //
// ResultMacroRecord.pos -> <current combo position> // ResultMacroRecord.pos -> <current combo position>
// ResultMacroRecord.state -> <last key state> // ResultMacroRecord.state -> <last key state>


// ResultMacro struct, one is created per ResultMacro, no duplicates // ResultMacro struct, one is created per ResultMacro, no duplicates
typedef struct ResultMacro { typedef struct ResultMacro {
const MacroType type;
const uint8_t *guide; const uint8_t *guide;
const uint8_t triggerKey;
} ResultMacro; } ResultMacro;


typedef struct ResultMacroRecord { typedef struct ResultMacroRecord {
// //
// Combo Length of 0 signifies end of sequence // Combo Length of 0 signifies end of sequence
// //
// TriggerMacro.type -> <Type of macro>
// TriggerMacro.guide -> [<combo length>|<key1 type>|<key1 state>|<key1>...<keyn type>|<keyn state>|<keyn>|<combo length>...|0] // TriggerMacro.guide -> [<combo length>|<key1 type>|<key1 state>|<key1>...<keyn type>|<keyn state>|<keyn>|<combo length>...|0]
// TriggerMacro.result -> <index to result macro> // TriggerMacro.result -> <index to result macro>
// //


// TriggerMacro struct, one is created per TriggerMacro, no duplicates // TriggerMacro struct, one is created per TriggerMacro, no duplicates
typedef struct TriggerMacro { typedef struct TriggerMacro {
const MacroType type;
const uint8_t *guide; const uint8_t *guide;
const var_uint_t result; const var_uint_t result;
} TriggerMacro; } TriggerMacro;
// * index - Trigger Macro index number // * index - Trigger Macro index number
// * trigger - Trigger Macro guide (see TriggerMacro) // * trigger - Trigger Macro guide (see TriggerMacro)
// Define_TM( index, result ); // Define_TM( index, result );
// <State-ful sequence of combinations TriggerMacro>
// * index - Trigger Macro index number
// * result - Result Macro index number which is triggered by this Trigger Macro
// Define_STM( index, result );
// <State-less single combination TriggerMacro>
// * index - Trigger Macro index number // * index - Trigger Macro index number
// * result - Result Macro index number which is triggered by this Trigger Macro // * result - Result Macro index number which is triggered by this Trigger Macro
#define Guide_TM( index ) const uint8_t tm##index##_guide[] #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 // -- Trigger Macro List

+ 24
- 0
Macro/Common/setup.cmake Ver arquivo

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


Macro/PartialMap/usb_hid.h → Macro/Common/usb_hid.h Ver arquivo


+ 1
- 1
Macro/PartialMap/setup.cmake Ver arquivo

###| CMake Kiibohd Controller Macro Module |###
###| CMake Kiibohd Controller PartialMap Macro Module |###
# #
# Written by Jacob Alexander in 2014-2015 for the Kiibohd Controller # Written by Jacob Alexander in 2014-2015 for the Kiibohd Controller
# #