Preparing for SimpleMap macro module
- Will use only flash memory (no ram usage for each layer or macro) - Only supports combinations, no sequences.
This commit is contained in:
parent
aeaaaaa468
commit
775e4eab8f
@ -64,6 +64,15 @@ typedef uint16_t nat_ptr_t;
|
|||||||
|
|
||||||
// ----- 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
|
||||||
@ -72,7 +81,9 @@ typedef uint16_t nat_ptr_t;
|
|||||||
// 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>
|
||||||
@ -80,7 +91,9 @@ typedef uint16_t nat_ptr_t;
|
|||||||
|
|
||||||
// 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 {
|
||||||
@ -117,6 +130,7 @@ typedef struct ResultGuide {
|
|||||||
//
|
//
|
||||||
// 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>
|
||||||
//
|
//
|
||||||
@ -132,6 +146,7 @@ typedef enum TriggerMacroState {
|
|||||||
|
|
||||||
// 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;
|
||||||
@ -190,10 +205,16 @@ typedef struct Capability {
|
|||||||
// * 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
Macro/Common/setup.cmake
Normal file
24
Macro/Common/setup.cmake
Normal file
@ -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
|
||||||
|
#
|
||||||
|
|
@ -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
|
# Written by Jacob Alexander in 2014-2015 for the Kiibohd Controller
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user