X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Scan%2FMatrixARM%2Fmatrix_scan.h;h=06ae75fbb1b3d5e492f6ee15caf16bbf27e9070a;hb=5f262ea4b68a07e9b94ce0a49c0f7196e5f32b3b;hp=bdf727e531abf5c3bf11d20a7e0659be3aa1bd2c;hpb=d6345c307fa4c64deb3f293fe91760f05c928120;p=kiibohd-controller.git diff --git a/Scan/MatrixARM/matrix_scan.h b/Scan/MatrixARM/matrix_scan.h index bdf727e..06ae75f 100644 --- a/Scan/MatrixARM/matrix_scan.h +++ b/Scan/MatrixARM/matrix_scan.h @@ -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 @@ -19,11 +19,27 @@ * THE SOFTWARE. */ -#ifndef __MATRIX_SCAN_H -#define __MATRIX_SCAN_H +#pragma once // ----- Includes ----- +// KLL Generated Defines +#include + + + +// ----- 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 +126,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,8 +137,5 @@ typedef struct KeyState { // ----- Functions ----- void Matrix_setup(); -void Matrix_scan( uint16_t scanNum, uint8_t firstScan ); - - -#endif // __MATRIX_SCAN_H +void Matrix_scan( uint16_t scanNum );