diff 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
line wrap: on
line diff
--- a/Macro/PartialMap/kll.h	Thu May 05 12:57:30 2016 -0700
+++ b/Macro/PartialMap/kll.h	Sun May 08 18:50:28 2016 -0700
@@ -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
@@ -49,6 +49,20 @@
 #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
 // e.g. mk20s  -> 32 bit
@@ -159,7 +173,8 @@
 } Capability;
 
 // Total Number of Capabilities
-#define CapabilitiesNum sizeof( CapabilitiesList ) / sizeof( Capability )
+// (generated by KLL)
+#define CapabilitiesNum CapabilitiesNum_KLL
 
 
 // -- Result Macros
@@ -179,7 +194,8 @@
 
 // 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 @@
 
 // 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 @@
 //  * 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