From a593ebe06d3f4af7baa89d2d48f593786ea15dff Mon Sep 17 00:00:00 2001 From: Pascal Getreuer Date: Wed, 5 Feb 2025 16:07:45 -0800 Subject: [PATCH] Add chordal_hold_layout weak def for Moonlander. --- keyboards/zsa/moonlander/moonlander.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/keyboards/zsa/moonlander/moonlander.c b/keyboards/zsa/moonlander/moonlander.c index ca448f4d46..1743593235 100644 --- a/keyboards/zsa/moonlander/moonlander.c +++ b/keyboards/zsa/moonlander/moonlander.c @@ -23,6 +23,25 @@ keyboard_config_t keyboard_config; bool mcp23018_leds[3] = {0, 0, 0}; bool is_launching = false; +#ifdef CHORDAL_HOLD +// On Moonlander, the default definition of `chordal_hold_layout` in keyboard.c +// is unusable, since it unfortunately gets generated from the Halfmoon's +// layout. We make a manual definition here to correct this. +// +// This definition and the definition in keyboard.c are weak definitions so that +// the user may override them with their own strong definition. If there is no +// strong definition, the linker uses the first weak definition encountered, +// which is this one (https://maskray.me/blog/2021-04-25-weak-symbol). +__attribute__((weak)) const char chordal_hold_layout[MATRIX_ROWS][MATRIX_COLS] PROGMEM = LAYOUT( + 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'R', 'R', 'R', 'R', 'R', 'R', 'R', + 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'R', 'R', 'R', 'R', 'R', 'R', 'R', + 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'R', 'R', 'R', 'R', 'R', 'R', 'R', + 'L', 'L', 'L', 'L', 'L', 'L', 'R', 'R', 'R', 'R', 'R', 'R', + 'L', 'L', 'L', 'L', 'L', 'L', 'R', 'R', 'R', 'R', 'R', 'R', + 'L', 'L', 'L', 'R', 'R', 'R' +); +#endif + #if defined(DEFERRED_EXEC_ENABLE) # if defined(DYNAMIC_MACRO_ENABLE) deferred_token dynamic_macro_token = INVALID_DEFERRED_TOKEN;