update main.py to allow dynamic selection of keyboard implementation based on 'settings.toml' config

This commit is contained in:
KemoNine 2023-07-30 09:56:11 -04:00
parent 5c156220a9
commit b6c552e9e9
2 changed files with 21 additions and 2 deletions

View file

@ -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)

11
main.py
View file

@ -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)