[Keymap] junonum: community keymap improvement (#19727)

Co-authored-by: Minh-tri Nguyen <mtngx@PigeonMac.local>
Co-authored-by: Joel Challis <git@zvecr.com>
This commit is contained in:
Juno Nguyen 2023-02-10 05:07:00 +08:00 committed by GitHub
parent 40f0325af8
commit cdaac25861
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 160 additions and 137 deletions

View File

@ -1,5 +1,24 @@
/* Copyright 2023 Juno Nguyen <juno.ngx@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/>.
*/
#include QMK_KEYBOARD_H
#ifdef AUDIO_ENABLE
# include "muse.h"
#endif
enum planck_layers {
_QWERTY,
@ -142,16 +161,10 @@ float dpad_song_off[][2] = {
};
#endif
#ifndef BACKLIGHT_ENABLE
layer_state_t layer_state_set_user(layer_state_t state) {
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
}
#else
layer_state_t layer_state_set_user(layer_state_t state) {
// LED control, lighting up when Fn layer is activated
state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
# ifdef BACKLIGHT_ENABLE
// LED control, lighting up when Fn layer is activated
switch (get_highest_layer(state)) {
case _QWERTY:
backlight_set(0);
@ -163,11 +176,11 @@ layer_state_t layer_state_set_user(layer_state_t state) {
backlight_set(3);
break;
}
# endif
return state;
}
#endif
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
@ -236,7 +249,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
// Play audio upon switching Caps Lock and custom layers
case KC_CAPS:
if (record->event.pressed) {
# ifdef AUDIO_ENABLE
@ -356,3 +368,12 @@ bool music_mask_user(uint16_t keycode) {
return true;
}
}
#ifdef RGBLIGHT_ENABLE
void keyboard_post_init_user(void) {
rgblight_enable_noeeprom(); // Enables RGB, without saving settings
// Vibrant cyan
rgblight_sethsv_noeeprom(HSV_SPRINGGREEN);
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
}
#endif

View File

@ -1,4 +1,6 @@
ifeq ($(strip $(AUDIO_ENABLE)), yes)
SRC += muse.c
endif
ifeq ($(strip $(KEYBOARD)),$(filter $(strip $(KEYBOARD)), planck/rev2 planck/rev3 planck/rev4 planck/rev5))
BACKLIGHT_ENABLE = yes