]> git.donarmstrong.com Git - kiibohd-controller.git/blobdiff - Scan/MatrixARM/matrix_scan.h
Merge pull request #25 from smasher816/master
[kiibohd-controller.git] / Scan / MatrixARM / matrix_scan.h
index bdf727e531abf5c3bf11d20a7e0659be3aa1bd2c..13839a192d88edd69efa29014ca8c122d88583e7 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014 by Jacob Alexander
+/* Copyright (C) 2014-2015 by Jacob Alexander
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
 
 // ----- Includes -----
 
+// KLL Generated Defines
+#include <kll_defs.h>
+
+
+
+// ----- Defines -----
+
+#if   ( DebounceDivThreshold_define < 0xFF + 1 )
+#define DebounceCounter uint8_t
+#elif ( DebounceDivThreshold_define < 0xFFFF + 1 )
+#define DebounceCounter uint16_t
+#elif ( DebounceDivThreshold_define < 0xFFFFFFFF + 1 )
+#define DebounceCounter uint32_t
+#else
+#error "Debounce threshold is too high... 32 bit max. Check .kll defines."
+#endif
+
 
 
 // ----- Enums -----
@@ -110,10 +127,10 @@ typedef struct GPIO_Pin {
 
 // Debounce Element
 typedef struct KeyState {
-       KeyPosition prevState;
-       KeyPosition curState;
-       uint8_t activeCount;
-       uint8_t inactiveCount;
+       KeyPosition     prevState;
+       KeyPosition     curState;
+       DebounceCounter activeCount;
+       DebounceCounter inactiveCount;
 } KeyState;
 
 
@@ -121,7 +138,7 @@ typedef struct KeyState {
 // ----- Functions -----
 
 void Matrix_setup();
-void Matrix_scan( uint16_t scanNum, uint8_t firstScan );
+void Matrix_scan( uint16_t scanNum );
 
 
 #endif // __MATRIX_SCAN_H