annotate Macro/PartialMap/trigger.c @ 433:0f7a6b593dc4

Initial refactoring of PartialMap for supporting custom Triggers - Requires a recent KLL - Functionality wise, nothing has changed
author Jacob Alexander <haata@kiibohd.com>
date Sun, 08 May 2016 18:50:28 -0700
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
433
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
1 /* Copyright (C) 2014-2016 by Jacob Alexander
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
2 *
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
3 * This file is free software: you can redistribute it and/or modify
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
4 * it under the terms of the GNU General Public License as published by
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
5 * the Free Software Foundation, either version 3 of the License, or
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
6 * (at your option) any later version.
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
7 *
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
8 * This file is distributed in the hope that it will be useful,
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
11 * GNU General Public License for more details.
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
12 *
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
13 * You should have received a copy of the GNU General Public License
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
14 * along with this file. If not, see <http://www.gnu.org/licenses/>.
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
15 */
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
16
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
17 // ----- Includes -----
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
18
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
19 // Compiler Includes
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
20 #include <Lib/MacroLib.h>
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
21
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
22 // Project Includes
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
23 #include <led.h>
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
24 #include <print.h>
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
25
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
26 // Local Includes
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
27 #include "trigger.h"
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
28 #include "kll.h"
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
29
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
30
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
31
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
32 // ----- Enums -----
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
33
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
34 // Bit positions are important, passes (correct key) always trump incorrect key votes
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
35 typedef enum TriggerMacroVote {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
36 TriggerMacroVote_Release = 0x10, // Correct key
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
37 TriggerMacroVote_PassRelease = 0x18, // Correct key (both pass and release)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
38 TriggerMacroVote_Pass = 0x8, // Correct key
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
39 TriggerMacroVote_DoNothingRelease = 0x4, // Incorrect key
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
40 TriggerMacroVote_DoNothing = 0x2, // Incorrect key
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
41 TriggerMacroVote_Fail = 0x1, // Incorrect key
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
42 TriggerMacroVote_Invalid = 0x0, // Invalid state
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
43 } TriggerMacroVote;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
44
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
45 typedef enum TriggerMacroEval {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
46 TriggerMacroEval_DoNothing,
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
47 TriggerMacroEval_DoResult,
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
48 TriggerMacroEval_DoResultAndRemove,
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
49 TriggerMacroEval_Remove,
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
50 } TriggerMacroEval;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
51
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
52
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
53
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
54 // ----- Generated KLL Variables -----
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
55
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
56 extern const Capability CapabilitiesList[];
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
57
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
58 extern const TriggerMacro TriggerMacroList[];
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
59 extern TriggerMacroRecord TriggerMacroRecordList[];
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
60
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
61 extern const ResultMacro ResultMacroList[];
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
62
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
63
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
64
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
65 // ----- Variables -----
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
66
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
67 // Key Trigger List Buffer and Layer Cache
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
68 // The layer cache is set on press only, hold and release events refer to the value set on press
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
69 extern TriggerGuide macroTriggerListBuffer[];
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
70 extern var_uint_t macroTriggerListBufferSize;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
71 extern var_uint_t macroTriggerListLayerCache[];
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
72
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
73 // Pending Trigger Macro Index List
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
74 // * Any trigger macros that need processing from a previous macro processing loop
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
75 // TODO, figure out a good way to scale this array size without wasting too much memory, but not rejecting macros
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
76 // Possibly could be calculated by the KLL compiler
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
77 // XXX It may be possible to calculate the worst case using the KLL compiler
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
78 index_uint_t macroTriggerMacroPendingList[ TriggerMacroNum ] = { 0 };
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
79 index_uint_t macroTriggerMacroPendingListSize = 0;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
80
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
81
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
82
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
83 // ----- Protected Macro Functions -----
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
84
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
85 extern nat_ptr_t *Macro_layerLookup( TriggerGuide *guide, uint8_t latch_expire );
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
86
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
87 extern void Macro_appendResultMacroToPendingList( const TriggerMacro *triggerMacro );
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
88
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
89
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
90
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
91 // ----- Functions -----
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
92
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
93 // Determine if long ResultMacro (more than 1 seqence element)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
94 inline uint8_t Macro_isLongResultMacro( const ResultMacro *macro )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
95 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
96 // Check the second sequence combo length
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
97 // If non-zero return non-zero (long sequence)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
98 // 0 otherwise (short sequence)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
99 var_uint_t position = 1;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
100 for ( var_uint_t result = 0; result < macro->guide[0]; result++ )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
101 position += ResultGuideSize( (ResultGuide*)&macro->guide[ position ] );
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
102 return macro->guide[ position ];
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
103 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
104
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
105
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
106 // Determine if long TriggerMacro (more than 1 sequence element)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
107 inline uint8_t Macro_isLongTriggerMacro( const TriggerMacro *macro )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
108 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
109 // Check the second sequence combo length
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
110 // If non-zero return non-zero (long sequence)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
111 // 0 otherwise (short sequence)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
112 return macro->guide[ macro->guide[0] * TriggerGuideSize + 1 ];
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
113 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
114
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
115
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
116 // Votes on the given key vs. guide, short macros
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
117 inline TriggerMacroVote Macro_evalShortTriggerMacroVote( TriggerGuide *key, TriggerGuide *guide )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
118 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
119 // Depending on key type
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
120 switch ( guide->type )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
121 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
122 // Normal State Type
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
123 case 0x00:
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
124 // For short TriggerMacros completely ignore incorrect keys
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
125 if ( guide->scanCode == key->scanCode )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
126 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
127 switch ( key->state )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
128 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
129 // Correct key, pressed, possible passing
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
130 case 0x01:
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
131 return TriggerMacroVote_Pass;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
132
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
133 // Correct key, held, possible passing or release
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
134 case 0x02:
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
135 return TriggerMacroVote_PassRelease;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
136
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
137 // Correct key, released, possible release
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
138 case 0x03:
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
139 return TriggerMacroVote_Release;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
140 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
141 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
142
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
143 return TriggerMacroVote_DoNothing;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
144
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
145 // LED State Type
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
146 case 0x01:
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
147 erro_print("LED State Type - Not implemented...");
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
148 break;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
149
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
150 // Analog State Type
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
151 case 0x02:
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
152 erro_print("Analog State Type - Not implemented...");
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
153 break;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
154
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
155 // Invalid State Type
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
156 default:
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
157 erro_print("Invalid State Type. This is a bug.");
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
158 break;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
159 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
160
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
161 // XXX Shouldn't reach here
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
162 return TriggerMacroVote_Invalid;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
163 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
164
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
165
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
166 // Votes on the given key vs. guide, long macros
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
167 // A long macro is defined as a guide with more than 1 combo
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
168 inline TriggerMacroVote Macro_evalLongTriggerMacroVote( TriggerGuide *key, TriggerGuide *guide )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
169 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
170 // Depending on key type
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
171 switch ( guide->type )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
172 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
173 // Normal State Type
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
174 case 0x00:
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
175 // Depending on the state of the buffered key, make voting decision
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
176 // Incorrect key
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
177 if ( guide->scanCode != key->scanCode )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
178 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
179 switch ( key->state )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
180 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
181 // Wrong key, pressed, fail
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
182 case 0x01:
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
183 return TriggerMacroVote_Fail;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
184
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
185 // Wrong key, held, do not pass (no effect)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
186 case 0x02:
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
187 return TriggerMacroVote_DoNothing;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
188
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
189 // Wrong key released, fail out if pos == 0
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
190 case 0x03:
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
191 return TriggerMacroVote_DoNothing | TriggerMacroVote_DoNothingRelease;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
192 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
193 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
194
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
195 // Correct key
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
196 else
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
197 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
198 switch ( key->state )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
199 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
200 // Correct key, pressed, possible passing
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
201 case 0x01:
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
202 return TriggerMacroVote_Pass;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
203
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
204 // Correct key, held, possible passing or release
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
205 case 0x02:
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
206 return TriggerMacroVote_PassRelease;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
207
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
208 // Correct key, released, possible release
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
209 case 0x03:
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
210 return TriggerMacroVote_Release;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
211 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
212 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
213
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
214 break;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
215
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
216 // LED State Type
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
217 case 0x01:
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
218 erro_print("LED State Type - Not implemented...");
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
219 break;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
220
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
221 // Analog State Type
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
222 case 0x02:
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
223 erro_print("Analog State Type - Not implemented...");
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
224 break;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
225
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
226 // Invalid State Type
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
227 default:
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
228 erro_print("Invalid State Type. This is a bug.");
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
229 break;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
230 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
231
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
232 // XXX Shouldn't reach here
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
233 return TriggerMacroVote_Invalid;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
234 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
235
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
236
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
237 // Evaluate/Update TriggerMacro
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
238 TriggerMacroEval Macro_evalTriggerMacro( var_uint_t triggerMacroIndex )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
239 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
240 // Lookup TriggerMacro
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
241 const TriggerMacro *macro = &TriggerMacroList[ triggerMacroIndex ];
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
242 TriggerMacroRecord *record = &TriggerMacroRecordList[ triggerMacroIndex ];
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
243
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
244 // Check if macro has finished and should be incremented sequence elements
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
245 if ( record->state == TriggerMacro_Release )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
246 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
247 record->state = TriggerMacro_Waiting;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
248 record->pos = record->pos + macro->guide[ record->pos ] * TriggerGuideSize + 1;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
249 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
250
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
251 // Current Macro position
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
252 var_uint_t pos = record->pos;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
253
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
254 // Length of the combo being processed
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
255 uint8_t comboLength = macro->guide[ pos ] * TriggerGuideSize;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
256
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
257 // If no combo items are left, remove the TriggerMacro from the pending list
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
258 if ( comboLength == 0 )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
259 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
260 return TriggerMacroEval_Remove;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
261 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
262
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
263 // Check if this is a long Trigger Macro
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
264 uint8_t longMacro = Macro_isLongTriggerMacro( macro );
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
265
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
266 // Iterate through the items in the combo, voting the on the key state
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
267 // If any of the pressed keys do not match, fail the macro
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
268 //
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
269 // The macro is waiting for input when in the TriggerMacro_Waiting state
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
270 // Once all keys have been pressed/held (only those keys), entered TriggerMacro_Press state (passing)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
271 // Transition to the next combo (if it exists) when a single key is released (TriggerMacro_Release state)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
272 // On scan after position increment, change to TriggerMacro_Waiting state
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
273 // TODO Add support for system LED states (NumLock, CapsLock, etc.)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
274 // TODO Add support for analog key states
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
275 // TODO Add support for 0x00 Key state (not pressing a key, not all that useful in general)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
276 // TODO Add support for Press/Hold/Release differentiation when evaluating (not sure if useful)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
277 TriggerMacroVote overallVote = TriggerMacroVote_Invalid;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
278 for ( uint8_t comboItem = pos + 1; comboItem < pos + comboLength + 1; comboItem += TriggerGuideSize )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
279 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
280 // Assign TriggerGuide element (key type, state and scancode)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
281 TriggerGuide *guide = (TriggerGuide*)(&macro->guide[ comboItem ]);
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
282
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
283 TriggerMacroVote vote = TriggerMacroVote_Invalid;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
284 // Iterate through the key buffer, comparing to each key in the combo
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
285 for ( var_uint_t key = 0; key < macroTriggerListBufferSize; key++ )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
286 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
287 // Lookup key information
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
288 TriggerGuide *keyInfo = &macroTriggerListBuffer[ key ];
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
289
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
290 // If vote is a pass (>= 0x08, no more keys in the combo need to be looked at)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
291 // Also mask all of the non-passing votes
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
292 vote |= longMacro
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
293 ? Macro_evalLongTriggerMacroVote( keyInfo, guide )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
294 : Macro_evalShortTriggerMacroVote( keyInfo, guide );
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
295 if ( vote >= TriggerMacroVote_Pass )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
296 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
297 vote &= TriggerMacroVote_Release | TriggerMacroVote_PassRelease | TriggerMacroVote_Pass;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
298 break;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
299 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
300 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
301
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
302 // If no pass vote was found after scanning all of the keys
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
303 // Fail the combo, if this is a short macro (long macros already will have a fail vote)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
304 if ( !longMacro && vote < TriggerMacroVote_Pass )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
305 vote |= TriggerMacroVote_Fail;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
306
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
307 // After voting, append to overall vote
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
308 overallVote |= vote;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
309 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
310
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
311 // If no pass vote was found after scanning the entire combo
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
312 // And this is the first position in the combo, just remove it (nothing important happened)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
313 if ( longMacro && overallVote & TriggerMacroVote_DoNothingRelease && pos == 0 )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
314 overallVote |= TriggerMacroVote_Fail;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
315
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
316 // Decide new state of macro after voting
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
317 // Fail macro, remove from pending list
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
318 if ( overallVote & TriggerMacroVote_Fail )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
319 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
320 return TriggerMacroEval_Remove;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
321 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
322 // Do nothing, incorrect key is being held or released
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
323 else if ( overallVote & TriggerMacroVote_DoNothing && longMacro )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
324 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
325 // Just doing nothing :)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
326 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
327 // If ready for transition and in Press state, set to Waiting and increment combo position
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
328 // Position is incremented (and possibly remove the macro from the pending list) on the next iteration
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
329 else if ( overallVote & TriggerMacroVote_Release && record->state == TriggerMacro_Press )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
330 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
331 record->state = TriggerMacro_Release;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
332
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
333 // If this is the last combo in the sequence, remove from the pending list
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
334 if ( macro->guide[ record->pos + macro->guide[ record->pos ] * TriggerGuideSize + 1 ] == 0 )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
335 return TriggerMacroEval_DoResultAndRemove;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
336 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
337 // If passing and in Waiting state, set macro state to Press
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
338 else if ( overallVote & TriggerMacroVote_Pass
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
339 && ( record->state == TriggerMacro_Waiting || record->state == TriggerMacro_Press ) )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
340 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
341 record->state = TriggerMacro_Press;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
342
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
343 // If in press state, and this is the final combo, send request for ResultMacro
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
344 // Check to see if the result macro only has a single element
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
345 // If this result macro has more than 1 key, only send once
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
346 // TODO Add option to have long macro repeat rate
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
347 if ( macro->guide[ pos + comboLength + 1 ] == 0 )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
348 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
349 // Long result macro (more than 1 combo)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
350 if ( Macro_isLongResultMacro( &ResultMacroList[ macro->result ] ) )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
351 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
352 // Only ever trigger result once, on press
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
353 if ( overallVote == TriggerMacroVote_Pass )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
354 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
355 return TriggerMacroEval_DoResultAndRemove;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
356 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
357 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
358 // Short result macro
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
359 else
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
360 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
361 // Only trigger result once, on press, if long trigger (more than 1 combo)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
362 if ( Macro_isLongTriggerMacro( macro ) )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
363 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
364 return TriggerMacroEval_DoResultAndRemove;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
365 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
366 // Otherwise, trigger result continuously
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
367 else
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
368 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
369 return TriggerMacroEval_DoResult;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
370 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
371 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
372 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
373 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
374 // Otherwise, just remove the macro on key release
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
375 // One more result has to be called to indicate to the ResultMacro that the key transitioned to the release state
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
376 else if ( overallVote & TriggerMacroVote_Release )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
377 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
378 return TriggerMacroEval_DoResultAndRemove;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
379 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
380
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
381 // If this is a short macro, just remove it
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
382 // The state can be rebuilt on the next iteration
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
383 if ( !longMacro )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
384 return TriggerMacroEval_Remove;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
385
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
386 return TriggerMacroEval_DoNothing;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
387 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
388
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
389
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
390 // Update pending trigger list
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
391 inline void Macro_updateTriggerMacroPendingList()
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
392 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
393 // Iterate over the macroTriggerListBuffer to add any new Trigger Macros to the pending list
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
394 for ( var_uint_t key = 0; key < macroTriggerListBufferSize; key++ )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
395 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
396 // TODO LED States
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
397 // TODO Analog Switches
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
398 // Only add TriggerMacro to pending list if key was pressed (not held, released or off)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
399 if ( macroTriggerListBuffer[ key ].state == 0x00 && macroTriggerListBuffer[ key ].state != 0x01 )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
400 continue;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
401
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
402 // TODO Analog
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
403 // If this is a release case, indicate to layer lookup for possible latch expiry
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
404 uint8_t latch_expire = macroTriggerListBuffer[ key ].state == 0x03;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
405
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
406 // Lookup Trigger List
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
407 nat_ptr_t *triggerList = Macro_layerLookup( &macroTriggerListBuffer[ key ], latch_expire );
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
408
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
409 // If there was an error during lookup, skip
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
410 if ( triggerList == 0 )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
411 continue;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
412
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
413 // Number of Triggers in list
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
414 nat_ptr_t triggerListSize = triggerList[0];
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
415
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
416 // Iterate over triggerList to see if any TriggerMacros need to be added
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
417 // First item is the number of items in the TriggerList
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
418 for ( var_uint_t macro = 1; macro < triggerListSize + 1; macro++ )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
419 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
420 // Lookup trigger macro index
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
421 var_uint_t triggerMacroIndex = triggerList[ macro ];
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
422
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
423 // Iterate over macroTriggerMacroPendingList to see if any macro in the scancode's
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
424 // triggerList needs to be added
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
425 var_uint_t pending = 0;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
426 for ( ; pending < macroTriggerMacroPendingListSize; pending++ )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
427 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
428 // Stop scanning if the trigger macro index is found in the pending list
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
429 if ( macroTriggerMacroPendingList[ pending ] == triggerMacroIndex )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
430 break;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
431 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
432
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
433 // If the triggerMacroIndex (macro) was not found in the macroTriggerMacroPendingList
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
434 // Add it to the list
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
435 if ( pending == macroTriggerMacroPendingListSize )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
436 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
437 macroTriggerMacroPendingList[ macroTriggerMacroPendingListSize++ ] = triggerMacroIndex;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
438
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
439 // Reset macro position
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
440 TriggerMacroRecordList[ triggerMacroIndex ].pos = 0;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
441 TriggerMacroRecordList[ triggerMacroIndex ].state = TriggerMacro_Waiting;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
442 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
443 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
444 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
445 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
446
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
447
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
448
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
449 void Trigger_state( uint8_t type, uint8_t state, uint8_t index )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
450 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
451 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
452
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
453
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
454 uint8_t Trigger_update( uint8_t type, uint8_t state, uint8_t index )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
455 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
456 return 0;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
457 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
458
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
459
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
460 void Trigger_setup()
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
461 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
462 // Initialize TriggerMacro states
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
463 for ( var_uint_t macro = 0; macro < TriggerMacroNum; macro++ )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
464 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
465 TriggerMacroRecordList[ macro ].pos = 0;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
466 TriggerMacroRecordList[ macro ].state = TriggerMacro_Waiting;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
467 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
468 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
469
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
470
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
471 void Trigger_process()
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
472 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
473 // Update pending trigger list, before processing TriggerMacros
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
474 Macro_updateTriggerMacroPendingList();
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
475
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
476 // Tail pointer for macroTriggerMacroPendingList
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
477 // Macros must be explicitly re-added
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
478 var_uint_t macroTriggerMacroPendingListTail = 0;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
479
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
480 // Iterate through the pending TriggerMacros, processing each of them
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
481 for ( var_uint_t macro = 0; macro < macroTriggerMacroPendingListSize; macro++ )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
482 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
483 switch ( Macro_evalTriggerMacro( macroTriggerMacroPendingList[ macro ] ) )
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
484 {
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
485 // Trigger Result Macro (purposely falling through)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
486 case TriggerMacroEval_DoResult:
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
487 // Append ResultMacro to PendingList
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
488 Macro_appendResultMacroToPendingList( &TriggerMacroList[ macroTriggerMacroPendingList[ macro ] ] );
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
489
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
490 default:
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
491 macroTriggerMacroPendingList[ macroTriggerMacroPendingListTail++ ] = macroTriggerMacroPendingList[ macro ];
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
492 break;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
493
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
494 // Trigger Result Macro and Remove (purposely falling through)
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
495 case TriggerMacroEval_DoResultAndRemove:
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
496 // Append ResultMacro to PendingList
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
497 Macro_appendResultMacroToPendingList( &TriggerMacroList[ macroTriggerMacroPendingList[ macro ] ] );
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
498
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
499 // Remove Macro from Pending List, nothing to do, removing by default
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
500 case TriggerMacroEval_Remove:
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
501 break;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
502 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
503 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
504
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
505 // Update the macroTriggerMacroPendingListSize with the tail pointer
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
506 macroTriggerMacroPendingListSize = macroTriggerMacroPendingListTail;
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
507 }
0f7a6b593dc4 Initial refactoring of PartialMap for supporting custom Triggers
Jacob Alexander <haata@kiibohd.com>
parents:
diff changeset
508