]> git.donarmstrong.com Git - kiibohd-controller.git/blobdiff - Scan/matrix/matrix.h
Formalizing code module structure and inheritance (Large Commit)
[kiibohd-controller.git] / Scan / matrix / matrix.h
index 4b728df2a1262442860a3ed13f55627351ca88c4..7af35acf44dbcdefa698570b24800396301accf4 100644 (file)
 #ifndef __MATRIX_H
 #define __MATRIX_H
 
+// ----- Includes -----
+
+// Compiler Includes
+#include <stdint.h>
+
+
 // ----- Quick Map (don't change) -----
 #define pinA0  0
 #define pinA1  1
 
 
 // ----- Key Settings -----
-#define keyboardSize 16  // # of keys
+#define KEYBOARD_SIZE 16 // # of keys
+#define MAX_ROW_SIZE  16 // # of keys in the largest row
 
 
 
 // ----- Matrix Configuration -----
-static uint8_t matrix_pinout[][] = {
+static const uint8_t matrix_pinout[][MAX_ROW_SIZE + 1] = {
 
 
 
@@ -111,6 +118,7 @@ static uint8_t matrix_pinout[][] = {
 // The mode allows for optimization in the kind of scanning algorithms that are done
 // 
 // The key numbers are used to translate into the keymap table (array) (and always start from 1, not 0).
+// Thus if a row doesn't use all the key positions, you can denote it as 0, which will be ignored/skipped on each scan
 // See the keymap.h file for the various preconfigured arrays.
 
 // Scan Mode | Col 1 | Col 2 | Col 3 | Col 4 | Col 4 | ...
@@ -135,11 +143,13 @@ static uint8_t matrix_pinout[][] = {
 };
 
 
+
 // ----- Variables -----
 
 // NOTE: Highest Bit: Valid keypress (0x80 is valid keypress)
 //        Other Bits: Pressed state sample counter
-uint8_t keyboardDetectArray[keyboardSize + 1];
+extern              uint8_t KeyIndex_Array [KEYBOARD_SIZE + 1];
+       static const uint8_t KeyIndex_Size = KEYBOARD_SIZE;