Updates to mlego m65 (#20220)

Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
This commit is contained in:
Alin Marin Elena 2023-10-12 06:26:20 +01:00 committed by GitHub
parent c72d661b93
commit 007c0c1db4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 822 additions and 1508 deletions

View file

@ -1,19 +1,5 @@
/*
Copyright 2021-2022 Alin M Elena <alinm.elena@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Copyright 2020-2023 alin m elena (@alinelena)
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
@ -51,69 +37,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
// clang-format on
bool led_update_user(led_t led_state) {
// Disable the default LED update code, so that lock LEDs could be reused to show layer status.
return false;
}
void matrix_scan_user(void) {
toggle_leds();
}
bool process_record_user(uint16_t keycode, keyrecord_t* record) {
switch (keycode) {
case (TT(_LWR)):
if (!record->event.pressed && record->tap.count == TAPPING_TOGGLE) {
// This runs before the TT() handler toggles the layer state, so the current layer state is the opposite of the final one after toggle.
set_led_toggle(_LWR, !layer_state_is(_LWR));
}
return true;
break;
case (TT(_RSE)):
if (record->event.pressed && record->tap.count == TAPPING_TOGGLE) {
set_led_toggle(_RSE, !layer_state_is(_RSE));
}
return true;
break;
default:
return true;
}
}
layer_state_t layer_state_set_user(layer_state_t state) {
#ifdef RGBLIGHT_ENABLE
set_rgb_layers(state);
#if defined(ENCODER_MAP_ENABLE)
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
[_QW] = {ENCODER_CCW_CW(KC_VOLD, KC_VOLU)},
#if defined(RGBLIGHT_ENABLE)
[_LWR] = {ENCODER_CCW_CW(RGB_HUD, RGB_HUI)},
[_RSE] = {ENCODER_CCW_CW(RGB_VAD, RGB_VAI)},
[_ADJ] = {ENCODER_CCW_CW(RGB_RMOD, RGB_MOD)},
# else
[_LWR] = {ENCODER_CCW_CW(KC_MNXT, KC_MPRV)},
[_RSE] = {ENCODER_CCW_CW(KC_MFFD, KC_MRWD)},
[_ADJ] = {ENCODER_CCW_CW(KC_PGDN, KC_PGUP)},
#endif
return update_tri_layer_state(state, _LWR, _RSE, _ADJ);
}
#ifdef RGBLIGHT_ENABLE
layer_state_t default_layer_state_set_user(layer_state_t state) {
set_default_rgb_layers(state);
return state;
}
};
#endif
void keyboard_post_init_user(void) {
#ifdef RGBLIGHT_ENABLE
// Enable the LED layers
rgblight_layers = my_rgb();
#endif
#ifdef OLED_ENABLE
init_timer();
#endif
}