Archived
1
0

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:
Jacob Alexander 2014-09-27 11:58:56 -07:00
parent aeaaaaa468
commit 775e4eab8f
4 changed files with 48 additions and 3 deletions

View File

@ -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.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.state -> <last key 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 -> <Type of macro>
// TriggerMacro.guide -> [<combo length>|<key1 type>|<key1 state>|<key1>...<keyn type>|<keyn state>|<keyn>|<combo length>...|0]
// TriggerMacro.result -> <index to result macro>
//
@ -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 );
// <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
// * 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

24
Macro/Common/setup.cmake Normal file
View 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
#

View File

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