]> git.donarmstrong.com Git - kiibohd-controller.git/blobdiff - Scan/MatrixARM/matrix_scan.h
Adding timing based debounce code
[kiibohd-controller.git] / Scan / MatrixARM / matrix_scan.h
index 06ae75fbb1b3d5e492f6ee15caf16bbf27e9070a..810e6d9ddee0146a1f8a580ecb21750003aa3fb1 100644 (file)
 #error "Debounce threshold is too high... 32 bit max. Check .kll defines."
 #endif
 
+#if   ( MinDebounceTime_define > 0xFF )
+#error "MinDebounceTime is a maximum of 255 ms"
+#elif ( MinDebounceTime_define < 0x00 )
+#error "MinDebounceTime is a minimum 0 ms"
+#endif
+
 
 
 // ----- Enums -----
@@ -126,11 +132,12 @@ typedef struct GPIO_Pin {
 
 // Debounce Element
 typedef struct KeyState {
-       KeyPosition     prevState;
-       KeyPosition     curState;
        DebounceCounter activeCount;
        DebounceCounter inactiveCount;
-} KeyState;
+       KeyPosition     prevState;
+       KeyPosition     curState;
+       uint8_t         prevDecisionTime;
+} __attribute__((packed)) KeyState;