From 25f7aad376edf8bef6e4d6d6a8cb71feee77d096 Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 26 Jul 2024 11:12:23 +0100 Subject: [PATCH] don't assume ps/2 keyboard --- hardware.cpp | 6 +++--- hardware.h | 2 +- hw/esp8bit.h | 8 +++++--- hw/node32s-example.h | 8 +++++--- hw/stellarpad-example.h | 8 +++++--- hw/ttgo-t7-v14-mini32.h | 8 +++++--- 6 files changed, 24 insertions(+), 16 deletions(-) diff --git a/hardware.cpp b/hardware.cpp index 76f5b5e..4fccbca 100644 --- a/hardware.cpp +++ b/hardware.cpp @@ -26,7 +26,7 @@ spiram sram(SPIRAM_SIZE); Memory memory; -#if defined(USE_KBD) +#if defined(USE_PS2_KBD) && !defined(USE_OWN_KBD) #include "ps2drv.h" PS2Driver ps2; #endif @@ -75,8 +75,8 @@ void hardware_init(CPU &cpu) { _cpu = &cpu; memory.begin(); -#if defined(USE_KBD) - ps2.begin(KBD_DATA, KBD_IRQ); +#if defined(USE_PS2_KBD) && !defined(USE_OWN_KBD) + ps2.begin(PS2_KBD_DATA, PS2_KBD_IRQ); #endif #if defined(TFT_BACKLIGHT) diff --git a/hardware.h b/hardware.h index 2455890..13e09b2 100644 --- a/hardware.h +++ b/hardware.h @@ -15,7 +15,7 @@ void hardware_init(class CPU &); void hardware_checkpoint(class Stream &); void hardware_restore(class Stream &); -#if defined(__PS2DRV_H__) && defined(USE_KBD) +#if defined(__PS2DRV_H__) && defined(USE_PS2_KBD) extern class PS2Driver ps2; #endif #if defined(__SPIRAM_H__) && defined(USE_SPIRAM) diff --git a/hw/esp8bit.h b/hw/esp8bit.h index 4af9385..fb08602 100644 --- a/hw/esp8bit.h +++ b/hw/esp8bit.h @@ -17,9 +17,11 @@ //#define LOAD_GLCD // PS/2 keyboard -#define USE_KBD -#define KBD_IRQ D3 -#define KBD_DATA D4 +#if !defined(USE_OWN_KBD) +#define USE_PS2_KBD +#define PS2_KBD_IRQ D3 +#define PS2_KBD_DATA D4 +#endif // SPI-RAM #if !defined(NO_SPIRAM) diff --git a/hw/node32s-example.h b/hw/node32s-example.h index c88e5e6..992d954 100644 --- a/hw/node32s-example.h +++ b/hw/node32s-example.h @@ -24,9 +24,11 @@ //#define TFT_RST 26 // PS/2 keyboard -#define USE_KBD -#define KBD_DATA 34 -#define KBD_IRQ 35 +#if !defined(USE_OWN_KBD) +#define USE_PS2_KBD +#define PS2_KBD_DATA 34 +#define PS2_KBD_IRQ 35 +#endif // Storage #if !defined(NO_STORAGE) diff --git a/hw/stellarpad-example.h b/hw/stellarpad-example.h index 831175f..331322f 100644 --- a/hw/stellarpad-example.h +++ b/hw/stellarpad-example.h @@ -3,9 +3,11 @@ #define RAM_SIZE 0x3000u // PS/2 keyboard -#define USE_KBD -#define KBD_DATA PE_4 -#define KBD_IRQ PE_5 +#if !defined(USE_OWN_KBD) +#define USE_PS2_KBD +#define PS2_KBD_DATA PE_4 +#define PS2_KBD_IRQ PE_5 +#endif // Storage #if !defined(NO_STORAGE) diff --git a/hw/ttgo-t7-v14-mini32.h b/hw/ttgo-t7-v14-mini32.h index 3cfe9bd..9256f0d 100644 --- a/hw/ttgo-t7-v14-mini32.h +++ b/hw/ttgo-t7-v14-mini32.h @@ -9,9 +9,11 @@ #endif // PS/2 Keyboard -#define USE_KBD -#define KBD_DATA 32 -#define KBD_IRQ 33 +#if !defined(USE_OWN_KBD) +#define USE_PS2_KBD +#define PS2_KBD_DATA 32 +#define PS2_KBD_IRQ 33 +#endif // 64kB RAM #define RAM_SIZE 0x10000u