]> git.donarmstrong.com Git - kiibohd-controller.git/blobdiff - Macro/PartialMap/kll.h
Initial refactoring of PartialMap for supporting custom Triggers
[kiibohd-controller.git] / Macro / PartialMap / kll.h
index e5e964f0e2460f14720f54901a984c328875b522..c7016a335f75bb0a29581e67211d7c60d3aa53d2 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014-2015 by Jacob Alexander
+/* Copyright (C) 2014-2016 by Jacob Alexander
  *
  * This file is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -48,6 +48,20 @@ typedef uint8_t  var_uint_t;
 #error "Invalid StateWordSize, possible values: 32, 16 and 8."
 #endif
 
+// - NOTE -
+// It is possible to change the maximum number of trigger/result index sizes
+// This will affect SRAM and flash usage, so it can be used to fit code on smaller uCs.
+// Also allows for over 4 billion triggers and results (triggers and results have separate indices)
+#if IndexWordSize_define == 32
+typedef uint32_t index_uint_t;
+#elif IndexWordSize_define == 16
+typedef uint16_t index_uint_t;
+#elif IndexWordSize_define == 8
+typedef uint8_t index_uint_t;
+#else
+#error "Invalid IndexWordSize, possible values: 32, 16 and 8."
+#endif
+
 // - NOTE -
 // Native pointer length
 // This needs to be defined per microcontroller
@@ -159,7 +173,8 @@ typedef struct Capability {
 } Capability;
 
 // Total Number of Capabilities
-#define CapabilitiesNum sizeof( CapabilitiesList ) / sizeof( Capability )
+// (generated by KLL)
+#define CapabilitiesNum CapabilitiesNum_KLL
 
 
 // -- Result Macros
@@ -179,7 +194,8 @@ typedef struct Capability {
 
 // Total number of result macros (rm's)
 // Used to create pending rm's table
-#define ResultMacroNum sizeof( ResultMacroList ) / sizeof( ResultMacro )
+// (generated by KLL)
+#define ResultMacroNum ResultMacroNum_KLL
 
 
 // -- Trigger Macros
@@ -199,7 +215,8 @@ typedef struct Capability {
 
 // Total number of trigger macros (tm's)
 // Used to create pending tm's table
-#define TriggerMacroNum sizeof( TriggerMacroList ) / sizeof( TriggerMacro )
+// (generated by KLL)
+#define TriggerMacroNum TriggerMacroNum_KLL
 
 
 
@@ -248,6 +265,6 @@ typedef struct Layer {
 //  * first - First scan code used (most keyboards start at 0, some start higher e.g. 0x40)
 #define Layer_IN( map, name, first ) { map, name, first, sizeof( map ) / sizeof( nat_ptr_t ) - 1 + first }
 
-// Total number of layers
-#define LayerNum sizeof( LayerIndex ) / sizeof( Layer )
+// Total number of layers (generated by KLL)
+#define LayerNum LayerNum_KLL