Mercurial > louis > kiibohd-controller
comparison Macro/PartialMap/kll.h @ 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 | 66eccdd9ced5 |
children |
comparison
equal
deleted
inserted
replaced
432:1a2fb67b0237 | 433:0f7a6b593dc4 |
---|---|
1 /* Copyright (C) 2014-2015 by Jacob Alexander | 1 /* Copyright (C) 2014-2016 by Jacob Alexander |
2 * | 2 * |
3 * This file is free software: you can redistribute it and/or modify | 3 * This file is free software: you can redistribute it and/or modify |
4 * it under the terms of the GNU General Public License as published by | 4 * it under the terms of the GNU General Public License as published by |
5 * the Free Software Foundation, either version 3 of the License, or | 5 * the Free Software Foundation, either version 3 of the License, or |
6 * (at your option) any later version. | 6 * (at your option) any later version. |
47 #else | 47 #else |
48 #error "Invalid StateWordSize, possible values: 32, 16 and 8." | 48 #error "Invalid StateWordSize, possible values: 32, 16 and 8." |
49 #endif | 49 #endif |
50 | 50 |
51 // - NOTE - | 51 // - NOTE - |
52 // It is possible to change the maximum number of trigger/result index sizes | |
53 // This will affect SRAM and flash usage, so it can be used to fit code on smaller uCs. | |
54 // Also allows for over 4 billion triggers and results (triggers and results have separate indices) | |
55 #if IndexWordSize_define == 32 | |
56 typedef uint32_t index_uint_t; | |
57 #elif IndexWordSize_define == 16 | |
58 typedef uint16_t index_uint_t; | |
59 #elif IndexWordSize_define == 8 | |
60 typedef uint8_t index_uint_t; | |
61 #else | |
62 #error "Invalid IndexWordSize, possible values: 32, 16 and 8." | |
63 #endif | |
64 | |
65 // - NOTE - | |
52 // Native pointer length | 66 // Native pointer length |
53 // This needs to be defined per microcontroller | 67 // This needs to be defined per microcontroller |
54 // e.g. mk20s -> 32 bit | 68 // e.g. mk20s -> 32 bit |
55 // atmega -> 16 bit | 69 // atmega -> 16 bit |
56 #if defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) || defined(_mk20dx256vlh7_) // ARM | 70 #if defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) || defined(_mk20dx256vlh7_) // ARM |
157 const void *func; | 171 const void *func; |
158 const uint8_t argCount; | 172 const uint8_t argCount; |
159 } Capability; | 173 } Capability; |
160 | 174 |
161 // Total Number of Capabilities | 175 // Total Number of Capabilities |
162 #define CapabilitiesNum sizeof( CapabilitiesList ) / sizeof( Capability ) | 176 // (generated by KLL) |
177 #define CapabilitiesNum CapabilitiesNum_KLL | |
163 | 178 |
164 | 179 |
165 // -- Result Macros | 180 // -- Result Macros |
166 | 181 |
167 // Guide_RM / Define_RM Pair | 182 // Guide_RM / Define_RM Pair |
177 | 192 |
178 // -- Result Macro List | 193 // -- Result Macro List |
179 | 194 |
180 // Total number of result macros (rm's) | 195 // Total number of result macros (rm's) |
181 // Used to create pending rm's table | 196 // Used to create pending rm's table |
182 #define ResultMacroNum sizeof( ResultMacroList ) / sizeof( ResultMacro ) | 197 // (generated by KLL) |
198 #define ResultMacroNum ResultMacroNum_KLL | |
183 | 199 |
184 | 200 |
185 // -- Trigger Macros | 201 // -- Trigger Macros |
186 | 202 |
187 // Guide_TM / Define_TM Trigger Setup | 203 // Guide_TM / Define_TM Trigger Setup |
197 | 213 |
198 // -- Trigger Macro List | 214 // -- Trigger Macro List |
199 | 215 |
200 // Total number of trigger macros (tm's) | 216 // Total number of trigger macros (tm's) |
201 // Used to create pending tm's table | 217 // Used to create pending tm's table |
202 #define TriggerMacroNum sizeof( TriggerMacroList ) / sizeof( TriggerMacro ) | 218 // (generated by KLL) |
219 #define TriggerMacroNum TriggerMacroNum_KLL | |
203 | 220 |
204 | 221 |
205 | 222 |
206 // ----- Trigger Maps ----- | 223 // ----- Trigger Maps ----- |
207 | 224 |
246 // * map - Trigger map | 263 // * map - Trigger map |
247 // * name - Name of the trigger map | 264 // * name - Name of the trigger map |
248 // * first - First scan code used (most keyboards start at 0, some start higher e.g. 0x40) | 265 // * first - First scan code used (most keyboards start at 0, some start higher e.g. 0x40) |
249 #define Layer_IN( map, name, first ) { map, name, first, sizeof( map ) / sizeof( nat_ptr_t ) - 1 + first } | 266 #define Layer_IN( map, name, first ) { map, name, first, sizeof( map ) / sizeof( nat_ptr_t ) - 1 + first } |
250 | 267 |
251 // Total number of layers | 268 // Total number of layers (generated by KLL) |
252 #define LayerNum sizeof( LayerIndex ) / sizeof( Layer ) | 269 #define LayerNum LayerNum_KLL |
253 | 270 |