From 4eb191c8457cea597598751dce198e2ab9136110 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sat, 7 Jan 2023 13:34:25 +0800 Subject: [PATCH] lotus: Add ifdef for pico variant Pico doesn't expose all the pins so it'll be a bit different. Just for prototyping. Signed-off-by: Daniel Schaefer --- keyboards/lotus/config.h | 4 ++++ keyboards/lotus/lotus.c | 21 ++++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/keyboards/lotus/config.h b/keyboards/lotus/config.h index b9308e6968..2c07eb8439 100644 --- a/keyboards/lotus/config.h +++ b/keyboards/lotus/config.h @@ -5,6 +5,10 @@ #include +// Prototype for Lotus with Raspberry Pi Pico +// SDB is mapped to GP22 +#define PICO_LOTUS + // 18-digit serial number. Must be programmed at factory // TODO: Figure out how to do that. Probably a script to compile qmk #define SERIAL_NUMBER "FRALDLvvccxxxxxxxx" diff --git a/keyboards/lotus/lotus.c b/keyboards/lotus/lotus.c index 649ffefeb7..921cbeb472 100644 --- a/keyboards/lotus/lotus.c +++ b/keyboards/lotus/lotus.c @@ -6,13 +6,17 @@ #define MUX_ENABLE_GPIO GP4 #define BOOT_DONE_GPIO GP5 -// SDB +// Pin SDB to enable the RGB controller +#ifdef PICO_LOTUS // 22 only on RPi Pico because it doesn't have GP29 #define IS31FL3743A_ENABLE_GPIO GP22 -//#define IS31FL3743A_ENABLE_GPIO GP29 +#else +#define IS31FL3743A_ENABLE_GPIO GP29 +#endif +void keyboard_post_init_kb(void) { + keyboard_post_init_user(); -void keyboard_post_init_user(void) { // Enable debug output debug_enable = true; debug_matrix = true; @@ -22,14 +26,21 @@ void keyboard_post_init_user(void) { /** * Hook into early keyboard initialization */ -void keyboard_pre_init_user(void) { +void keyboard_pre_init_kb(void) { + keyboard_pre_init_user(); + // Mark boot as done. // Before this, when holding down both alt keys QSPI_SS is pulled low to put // the RP2040 in bootloader mode during reset. setPinOutput(BOOT_DONE_GPIO); writePinHigh(BOOT_DONE_GPIO); - // TODO: Do we ever need to disable it to save power? + //// TODO: Do we ever need to disable it to save power? +#ifndef PICO_LOTUS + setPinOutput(MUX_ENABLE_GPIO); + writePinHigh(MUX_ENABLE_GPIO); +#endif + #ifdef RGB_MATRIX_ENABLE //// TODO: Do we ever need to disable it to save power? setPinOutput(IS31FL3743A_ENABLE_GPIO);