From a5e914de4be108d50ace91345e128dd5baf4fd72 Mon Sep 17 00:00:00 2001 From: 0xmac Date: Mon, 2 Dec 2024 10:37:30 +0100 Subject: [PATCH] Changed keyboard register to mem map --- src/keyboard.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/keyboard.c b/src/keyboard.c index 4110d82..7b077dd 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2,10 +2,10 @@ #include extern uint8_t systemRegister; +extern uint8_t keyboardResult; +extern sfKeyCode currentKey; -static uint8_t keyboardResult; - -static sfKeyCode scanMatrix[48] = { +const static sfKeyCode scanMatrix[48] = { sfKeyNum1, sfKeyNum2, sfKeyNum3, sfKeyNum4, sfKeyNum5, sfKeyNum6, sfKeyNum7, sfKeyNum8, sfKeyQ, sfKeyW, sfKeyE, sfKeyR, sfKeyT, sfKeyY, sfKeyU, sfKeyI, sfKeyA, sfKeyS, sfKeyD, sfKeyF, sfKeyG, sfKeyH, sfKeyJ, sfKeyK, @@ -15,11 +15,11 @@ static sfKeyCode scanMatrix[48] = { }; -void scanKeyboard(const sfKeyCode key){ +void scanKeyboard(){ keyboardResult = 0; for (int i = 0; i < 8; i++) { - if (key == scanMatrix[i + (((systemRegister & 0x07) % 6) * 8)]){ + if (currentKey == scanMatrix[i + (((systemRegister & 0x07) % 6) * 8)]){ keyboardResult |= (0x80 >> i); } }