From f139c3db8d2b21e5d4d68b85bfdd705c20fcd795 Mon Sep 17 00:00:00 2001 From: Louis Orleans Date: Fri, 16 Mar 2018 13:22:33 -0700 Subject: layout(preonic): update to dudeofawesome's layout (#2507) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🎉 duplicate default Preonic keymap * ✨ add Workman layout * 🚚 swap backspace and delete * ✨ enable hold enter for shift * 🚚 swap media play and next * 💄 use Planck startup sound * 💄 add Workman layer sound * ✨ add numpad layer * 💄 add new workman sound * 📝 add README * 🎨 fix layout formatting * 📝 add image of numpad layer * 📦 changing chibios submodule version to match upstream/master's version * ✨ add caps lock key on adjust layer * ✨ reworking numpad layer to match a real numpad * ✨ add double tap to activate numpad * 📝 fix layout comments * 📝 update numpad layer render * ✨ adding operator keys to left hand on numpad * 🎨 shorten numpad keycodes * 🎨 remove redundant breaks * 📝 update numpad layer render * 🎨 fix indentation * 🔧 add rules file * ✨🔊 play sound when switching to numpad layer * 🔨 use userspace sounds --- keyboards/preonic/keymaps/dudeofawesome/config.h | 27 ++--- keyboards/preonic/keymaps/dudeofawesome/keymap.c | 130 ++++++++++++---------- keyboards/preonic/keymaps/dudeofawesome/readme.md | 2 +- keyboards/preonic/keymaps/dudeofawesome/rules.mk | 5 + 4 files changed, 88 insertions(+), 76 deletions(-) (limited to 'keyboards') diff --git a/keyboards/preonic/keymaps/dudeofawesome/config.h b/keyboards/preonic/keymaps/dudeofawesome/config.h index 566fac3ed3..48bd13ba45 100644 --- a/keyboards/preonic/keymaps/dudeofawesome/config.h +++ b/keyboards/preonic/keymaps/dudeofawesome/config.h @@ -1,27 +1,20 @@ #ifndef CONFIG_USER_H #define CONFIG_USER_H -#include "config_common.h" +#include "../../config.h" +#include "dudeofawesome.h" #define TAPPING_TOGGLE 2 #ifdef AUDIO_ENABLE - #define STARTUP_SONG SONG(PLANCK_SOUND) - // #define STARTUP_SONG SONG(NO_SOUND) - - #define WORKMAN_SOUND \ - E__NOTE(_GS7), \ - ED_NOTE(_E7), \ - S__NOTE(_REST), \ - E__NOTE(_A6), \ - S__NOTE(_REST), \ - ED_NOTE(_GS6), - - #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ - SONG(WORKMAN_SOUND), \ - SONG(COLEMAK_SOUND), \ - SONG(DVORAK_SOUND) \ - } + #define STARTUP_SONG SONG(PLANCK_SOUND) + // #define STARTUP_SONG SONG(NO_SOUND) + + #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ + SONG(WORKMAN_SOUND), \ + SONG(COLEMAK_SOUND), \ + SONG(DVORAK_SOUND) \ + } #endif #define MUSIC_MASK (keycode != KC_NO) diff --git a/keyboards/preonic/keymaps/dudeofawesome/keymap.c b/keyboards/preonic/keymaps/dudeofawesome/keymap.c index e8faf670be..dbe7fb6488 100644 --- a/keyboards/preonic/keymaps/dudeofawesome/keymap.c +++ b/keyboards/preonic/keymaps/dudeofawesome/keymap.c @@ -213,63 +213,77 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { - case QWERTY: - if (record->event.pressed) { - set_single_persistent_default_layer(_QWERTY); - } - return false; - break; - case WORKMAN: - if (record->event.pressed) { - set_single_persistent_default_layer(_WORKMAN); - } - 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 LOWER: - if (record->event.pressed) { - layer_on(_LOWER); - update_tri_layer(_LOWER, _RAISE, _ADJUST); - } else { - layer_off(_LOWER); - update_tri_layer(_LOWER, _RAISE, _ADJUST); - } - return false; - break; - case RAISE: - if (record->event.pressed) { - layer_on(_RAISE); - update_tri_layer(_LOWER, _RAISE, _ADJUST); - } else { - layer_off(_RAISE); - update_tri_layer(_LOWER, _RAISE, _ADJUST); - } - return false; - break; - case BACKLIT: - if (record->event.pressed) { - register_code(KC_RSFT); - #ifdef BACKLIGHT_ENABLE - backlight_step(); - #endif - PORTE &= ~(1<<6); - } else { - unregister_code(KC_RSFT); - PORTE |= (1<<6); - } - return false; - break; + case QWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWERTY); } - return true; + return false; + case WORKMAN: + if (record->event.pressed) { + set_single_persistent_default_layer(_WORKMAN); + } + return false; + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + } + return false; + case DVORAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_DVORAK); + } + return false; + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + case BACKLIT: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + PORTE &= ~(1<<6); + } else { + unregister_code(KC_RSFT); + PORTE |= (1<<6); + } + return false; + } + return true; +}; + +bool numpadActive = false; + +float tone_numpad_on[][2] = SONG(NUMPAD_ON_SOUND); + +void matrix_scan_user (void) { + uint8_t layer = biton32(layer_state); + + switch (layer) { + case _NUMPAD: + if (!numpadActive) { + numpadActive = true; + PLAY_SONG(tone_numpad_on); + } + break; + default: + if (numpadActive) { + numpadActive = false; + } + } }; diff --git a/keyboards/preonic/keymaps/dudeofawesome/readme.md b/keyboards/preonic/keymaps/dudeofawesome/readme.md index 244442494d..a5d89fc828 100644 --- a/keyboards/preonic/keymaps/dudeofawesome/readme.md +++ b/keyboards/preonic/keymaps/dudeofawesome/readme.md @@ -10,7 +10,7 @@ - Dvorak - Colemak - Numpad layer - ![numpad layer](https://i.imgur.com/V5iGHZg.png) + ![numpad layer](https://i.imgur.com/IH8sWmQ.png) - Audio ## Building and flashing diff --git a/keyboards/preonic/keymaps/dudeofawesome/rules.mk b/keyboards/preonic/keymaps/dudeofawesome/rules.mk index e69de29bb2..4434d3de7e 100644 --- a/keyboards/preonic/keymaps/dudeofawesome/rules.mk +++ b/keyboards/preonic/keymaps/dudeofawesome/rules.mk @@ -0,0 +1,5 @@ +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = yes # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. -- cgit v1.2.3