From b6c552e9e9d2c1ca0c835b4eb62f68e5999720e7 Mon Sep 17 00:00:00 2001 From: KemoNine Date: Sun, 30 Jul 2023 09:56:11 -0400 Subject: [PATCH] update main.py to allow dynamic selection of keyboard implementation based on 'settings.toml' config --- ardux/hardware/quagboard.py | 12 ++++++++++++ main.py | 11 +++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 ardux/hardware/quagboard.py diff --git a/ardux/hardware/quagboard.py b/ardux/hardware/quagboard.py new file mode 100644 index 0000000..e84f42f --- /dev/null +++ b/ardux/hardware/quagboard.py @@ -0,0 +1,12 @@ +from ardux.kb import _ArduxKeyboard +from kmk.scanners import DiodeOrientation + +# Quagboard Implementation +class QuagboardArduxKeyboard(_ArduxKeyboard): + def setup_physical_config(self): + self.diode_orientation = DiodeOrientation.COL2ROW + self.row_pins = (board.GP0,) + #right hand pins + #self.col_pins = (board.GP1, board.GP2, board.GP3, board.GP4, board.GP5, board.GP6, board.GP7, board.GP8 , board.GP10 , board.GP9) + #left hand pins + self.col_pins = (board.GP4, board.GP3, board.GP2, board.GP1, board.GP8, board.GP7, board.GP6, board.GP5 , board.GP9 , board.GP10) diff --git a/main.py b/main.py index 6d7ae09..49a453b 100644 --- a/main.py +++ b/main.py @@ -3,8 +3,15 @@ import os ##### # Main keyboard object -from ardux.hardware.thepaintbrush import ThePaintbrushArduxKeyboard -ardux_keyboard = ThePaintbrushArduxKeyboard() +ardux_board = os.getenv('ARDUX_BOARD') +if ardux_board == 'thepaintbrush': + from ardux.hardware.thepaintbrush import ThePaintbrushArduxKeyboard + ardux_keyboard = ThePaintbrushArduxKeyboard() +elif ardux_board == 'quagboard': + from ardux.hardware.quagboard import QuagboardArduxKeyboard + ardux_keyboard = QuagboardArduxKeyboard() +else: + raise NotImplementedError('Please configure the proper keyboard in "settings.toml"') ##### # NeoPixel on kb2040 (tune accordingly / remove if different mcu)