summaryrefslogtreecommitdiff
path: root/layouts/community/ortho_4x12/junonum
diff options
context:
space:
mode:
authorJuno Nguyen <juno.ngx@gmail.com>2023-02-10 05:07:00 +0800
committerGitHub <noreply@github.com>2023-02-09 13:07:00 -0800
commitcdaac2586164178dcf99fc2d72c5a506c99ef09a (patch)
tree80739bbd56b97f9c26dc61cf1a351d34b1b960f1 /layouts/community/ortho_4x12/junonum
parent40f0325af85110388626d154331d6e3d4f4077c5 (diff)
[Keymap] junonum: community keymap improvement (#19727)
Co-authored-by: Minh-tri Nguyen <mtngx@PigeonMac.local> Co-authored-by: Joel Challis <git@zvecr.com>
Diffstat (limited to 'layouts/community/ortho_4x12/junonum')
-rw-r--r--layouts/community/ortho_4x12/junonum/keymap.c293
-rw-r--r--layouts/community/ortho_4x12/junonum/rules.mk10
2 files changed, 163 insertions, 140 deletions
diff --git a/layouts/community/ortho_4x12/junonum/keymap.c b/layouts/community/ortho_4x12/junonum/keymap.c
index 416949aecc..311a94d7ee 100644
--- a/layouts/community/ortho_4x12/junonum/keymap.c
+++ b/layouts/community/ortho_4x12/junonum/keymap.c
@@ -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
-#include "muse.h"
+
+#ifdef AUDIO_ENABLE
+# include "muse.h"
+#endif
enum planck_layers {
_QWERTY,
@@ -120,39 +139,33 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
#ifdef AUDIO_ENABLE
-float plover_song[][2] = SONG(PLOVER_SOUND);
-float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND);
-
-float caps_song_on[][2] = SONG(NUM_LOCK_ON_SOUND);
-float caps_song_off[][2] = SONG(SCROLL_LOCK_ON_SOUND);
-
-// Custom songs for DPAD layer status
-float dpad_song_on[][2] = {
- HD_NOTE(_A4), HD_NOTE(_A4), HD_NOTE(_A4),
- QD_NOTE(_F4), QD_NOTE(_C5), HD_NOTE(_A4),
- QD_NOTE(_F4), QD_NOTE(_C5), WD_NOTE(_A4)
-};
-
-float dpad_song_off[][2] = {
- ED_NOTE(_C6), ED_NOTE(_C6),
- ED_NOTE(_C6), ED_NOTE(_C6),
- W__NOTE(_REST), QD_NOTE(_GS5),
- QD_NOTE(_AS5), Q__NOTE(_C6),
- Q__NOTE(_AS5), Q__NOTE(_C6)
-};
+ float plover_song[][2] = SONG(PLOVER_SOUND);
+ float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND);
+
+ float caps_song_on[][2] = SONG(NUM_LOCK_ON_SOUND);
+ float caps_song_off[][2] = SONG(SCROLL_LOCK_ON_SOUND);
+
+ // Custom songs for DPAD layer status
+ float dpad_song_on[][2] = {
+ HD_NOTE(_A4), HD_NOTE(_A4), HD_NOTE(_A4),
+ QD_NOTE(_F4), QD_NOTE(_C5), HD_NOTE(_A4),
+ QD_NOTE(_F4), QD_NOTE(_C5), WD_NOTE(_A4)
+ };
+
+ float dpad_song_off[][2] = {
+ ED_NOTE(_C6), ED_NOTE(_C6),
+ ED_NOTE(_C6), ED_NOTE(_C6),
+ W__NOTE(_REST), QD_NOTE(_GS5),
+ QD_NOTE(_AS5), Q__NOTE(_C6),
+ Q__NOTE(_AS5), Q__NOTE(_C6)
+ };
#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);
- switch (get_highest_layer(state)) {
+# ifdef BACKLIGHT_ENABLE
+ // LED control, lighting up when Fn layer is activated
+ switch (get_highest_layer(state)) {
case _QWERTY:
backlight_set(0);
break;
@@ -162,112 +175,111 @@ layer_state_t layer_state_set_user(layer_state_t state) {
case _DPAD:
backlight_set(3);
break;
- }
+ }
+# endif
+
return state;
}
-#endif
-
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
- case QWERTY:
- if (record->event.pressed) {
- print("mode just switched to qwerty and this is a huge string\n");
- set_single_persistent_default_layer(_QWERTY);
- }
- return false;
- break;
- case COLEMAK:
- if (record->event.pressed) {
- set_single_persistent_default_layer(_COLEMAK);
- }
- return false;
- break;
- case DVORAK:
- if (record->event.pressed) {
- set_single_persistent_default_layer(_DVORAK);
- }
- return false;
- break;
- case BACKLIT:
- if (record->event.pressed) {
- register_code(KC_RSFT);
-#ifdef BACKLIGHT_ENABLE
+ case QWERTY:
+ if (record->event.pressed) {
+ print("mode just switched to qwerty and this is a huge string\n");
+ set_single_persistent_default_layer(_QWERTY);
+ }
+ return false;
+ break;
+ case COLEMAK:
+ if (record->event.pressed) {
+ set_single_persistent_default_layer(_COLEMAK);
+ }
+ return false;
+ break;
+ case DVORAK:
+ if (record->event.pressed) {
+ set_single_persistent_default_layer(_DVORAK);
+ }
+ return false;
+ break;
+ case BACKLIT:
+ if (record->event.pressed) {
+ register_code(KC_RSFT);
+# ifdef BACKLIGHT_ENABLE
backlight_step();
-#endif
-#ifdef KEYBOARD_planck_rev5
+# endif
+# ifdef KEYBOARD_planck_rev5
writePinLow(E6);
-#endif
- } else {
- unregister_code(KC_RSFT);
-#ifdef KEYBOARD_planck_rev5
+# endif
+ } else {
+ unregister_code(KC_RSFT);
+# ifdef KEYBOARD_planck_rev5
writePinHigh(E6);
-#endif
- }
- return false;
- break;
- case PLOVER:
- if (record->event.pressed) {
-#ifdef AUDIO_ENABLE
+# endif
+ }
+ return false;
+ break;
+ case PLOVER:
+ if (record->event.pressed) {
+# ifdef AUDIO_ENABLE
stop_all_notes();
PLAY_SONG(plover_song);
-#endif
- layer_off(_RAISE);
- layer_off(_LOWER);
- layer_off(_ADJUST);
- layer_on(_PLOVER);
- if (!eeconfig_is_enabled()) {
- eeconfig_init();
- }
- keymap_config.raw = eeconfig_read_keymap();
- keymap_config.nkro = 1;
- eeconfig_update_keymap(keymap_config.raw);
+# endif
+ layer_off(_RAISE);
+ layer_off(_LOWER);
+ layer_off(_ADJUST);
+ layer_on(_PLOVER);
+ if (!eeconfig_is_enabled()) {
+ eeconfig_init();
}
- return false;
- break;
- case EXT_PLV:
- if (record->event.pressed) {
-#ifdef AUDIO_ENABLE
+ keymap_config.raw = eeconfig_read_keymap();
+ keymap_config.nkro = 1;
+ eeconfig_update_keymap(keymap_config.raw);
+ }
+ return false;
+ break;
+ case EXT_PLV:
+ if (record->event.pressed) {
+# ifdef AUDIO_ENABLE
PLAY_SONG(plover_gb_song);
-#endif
- layer_off(_PLOVER);
- }
- return false;
- break;
-
- // Play audio upon switching Caps Lock and custom layers
+# endif
+ layer_off(_PLOVER);
+ }
+ return false;
+ break;
- case KC_CAPS:
- if (record->event.pressed) {
-#ifdef AUDIO_ENABLE
+ // Play audio upon switching Caps Lock and custom layers
+ case KC_CAPS:
+ if (record->event.pressed) {
+# ifdef AUDIO_ENABLE
if (host_keyboard_led_state().caps_lock) {
PLAY_SONG(caps_song_off);
} else {
PLAY_SONG(caps_song_on);
}
-#endif
- }
- return true;
+# endif
+ }
+ return true;
- case DP_ON:
- if (record->event.pressed) {
- } else { // only actived upon key release
-#ifdef AUDIO_ENABLE
+ case DP_ON:
+ if (record->event.pressed) {
+ } else { // only actived upon key release
+# ifdef AUDIO_ENABLE
PLAY_SONG(dpad_song_on);
-#endif
+# endif
- layer_off(_FN1);
- layer_on(_DPAD);
- }
+ layer_off(_FN1);
+ layer_on(_DPAD);
+ }
- case DP_OFF:
- if (record->event.pressed) {
-#ifdef AUDIO_ENABLE
+ case DP_OFF:
+ if (record->event.pressed) {
+# ifdef AUDIO_ENABLE
PLAY_SONG(dpad_song_off);
-#endif
+# endif
- layer_off(_DPAD);
- }
+ layer_off(_DPAD);
+ }
}
return true;
}
@@ -305,28 +317,28 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
bool dip_switch_update_user(uint8_t index, bool active) {
switch (index) {
- case 0:
- if (active) {
-#ifdef AUDIO_ENABLE
+ case 0:
+ if (active) {
+# ifdef AUDIO_ENABLE
PLAY_SONG(plover_song);
-#endif
- layer_on(_ADJUST);
- } else {
-#ifdef AUDIO_ENABLE
+# endif
+ layer_on(_ADJUST);
+ } else {
+# ifdef AUDIO_ENABLE
PLAY_SONG(plover_gb_song);
-#endif
- layer_off(_ADJUST);
- }
- break;
- case 1:
- if (active) {
- muse_mode = true;
- } else {
- muse_mode = false;
-#ifdef AUDIO_ENABLE
+# endif
+ layer_off(_ADJUST);
+ }
+ break;
+ case 1:
+ if (active) {
+ muse_mode = true;
+ } else {
+ muse_mode = false;
+# ifdef AUDIO_ENABLE
stop_all_notes();
-#endif
- }
+# endif
+ }
}
return true;
}
@@ -349,10 +361,19 @@ void matrix_scan_user(void) {
bool music_mask_user(uint16_t keycode) {
switch (keycode) {
- case RAISE:
- case LOWER:
- return false;
- default:
- return true;
+ case RAISE:
+ case LOWER:
+ return false;
+ default:
+ 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
diff --git a/layouts/community/ortho_4x12/junonum/rules.mk b/layouts/community/ortho_4x12/junonum/rules.mk
index 72e6214d23..ecb8d8aa1a 100644
--- a/layouts/community/ortho_4x12/junonum/rules.mk
+++ b/layouts/community/ortho_4x12/junonum/rules.mk
@@ -1,13 +1,15 @@
-SRC += muse.c
+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
+ BACKLIGHT_ENABLE = yes
else
- BACKLIGHT_ENABLE = no
+ BACKLIGHT_ENABLE = no
endif
ifeq ($(strip $(KEYBOARD)), vitamins_included/rev1)
- NKRO_ENABLE = no
+ NKRO_ENABLE = no
endif
MIDI_ENABLE=no