From 523c8315a22772fc3e605e21b14821b148c48a09 Mon Sep 17 00:00:00 2001 From: Richard Titmuss Date: Thu, 14 Jan 2021 06:50:18 +0100 Subject: [Keyboard] Improvements for the Torn keyboard (#11268) * Add bongo cat animation * Map all keys on base layer ... to make it easier to test newly built keyboards. The encoders are optional and can be placed in different locations. * Fix Torn in QMK configurator This removes additional variables defined in the keymap.c file, so that the default firmware can be compiled by the configurator. Co-authored-by: Richard Titmuss --- keyboards/torn/torn_encoder.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'keyboards/torn/torn_encoder.c') diff --git a/keyboards/torn/torn_encoder.c b/keyboards/torn/torn_encoder.c index ef9b0873fb..9178388d0f 100644 --- a/keyboards/torn/torn_encoder.c +++ b/keyboards/torn/torn_encoder.c @@ -31,18 +31,24 @@ static int8_t encoder_LUT[] = {0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, static uint8_t encoder_state = 0; static int8_t encoder_pulses = 0; -extern const uint16_t PROGMEM encoder_keymaps[][2][2]; +__attribute__((weak)) extern const uint16_t PROGMEM encoder_keymaps[][2][2]; + +const uint16_t encoder_default[2][2] = { { KC_PGDN, KC_PGUP }, { KC__VOLDOWN, KC__VOLUP } }; /** * Tap on encoder updates using the encoder keymap */ void encoder_update_kb(uint8_t index, bool clockwise) { - int layer = get_highest_layer(layer_state); - uint16_t code; - do { - code = pgm_read_word(&encoder_keymaps[layer--][index][clockwise]); - } while (code == KC_TRNS); + + if (encoder_keymaps) { + int layer = get_highest_layer(layer_state); + do { + code = pgm_read_word(&encoder_keymaps[layer--][index][clockwise]); + } while (code == KC_TRNS); + } else { + code = encoder_default[index][clockwise]; + } tap_code16(code); } -- cgit v1.2.3