]> git.donarmstrong.com Git - kiibohd-controller.git/blobdiff - Macro/PartialMap/kll.h
Code cleanup
[kiibohd-controller.git] / Macro / PartialMap / kll.h
index 0df2cd40c62ccfaff32085294611030ecbb7e5a9..e5e964f0e2460f14720f54901a984c328875b522 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 by Jacob Alexander
+/* Copyright (C) 2014-2015 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
  * along with this file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef __kll_h
-#define __kll_h
+#pragma once
 
 // ----- Includes -----
 
+// KLL Generated Defines
+#include <kll_defs.h>
+
 // Project Includes
 #include <print.h>
 #include <scan_loop.h>
 // It is possible to change the maximum state and indexing positions of the state machine.
 // This usually affects the SRAM usage quite a bit, so it can be used to fit the code on smaller uCs
 // Or to allow for nearly infinite states.
-// TODO Make selectable from layout variable
-//typedef uint32_t var_uint_t;
-//typedef uint16_t var_uint_t;
+#if StateWordSize_define == 32
+typedef uint32_t var_uint_t;
+#elif StateWordSize_define == 16
+typedef uint16_t var_uint_t;
+#elif StateWordSize_define == 8
 typedef uint8_t  var_uint_t;
+#else
+#error "Invalid StateWordSize, possible values: 32, 16 and 8."
+#endif
 
 // - NOTE -
 // Native pointer length
 // This needs to be defined per microcontroller
 // e.g. mk20s  -> 32 bit
 //      atmega -> 16 bit
-#if defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) // ARM
+#if defined(_mk20dx128_) || defined(_mk20dx128vlf5_) || defined(_mk20dx256_) || defined(_mk20dx256vlh7_) // ARM
 typedef uint32_t nat_ptr_t;
 #elif defined(_at90usb162_) || defined(_atmega32u4_) || defined(_at90usb646_) || defined(_at90usb1286_) // AVR
 typedef uint16_t nat_ptr_t;
@@ -244,7 +251,3 @@ typedef struct Layer {
 // Total number of layers
 #define LayerNum sizeof( LayerIndex ) / sizeof( Layer )
 
-
-
-#endif // __kll_h
-