summaryrefslogtreecommitdiff
path: root/keyboards/preonic/keymaps/dudeofawesome/keymap.c
diff options
context:
space:
mode:
authorLouis Orleans <louis@orleans.io>2018-03-16 13:22:33 -0700
committerJack Humbert <jack.humb@gmail.com>2018-03-16 16:22:33 -0400
commitf139c3db8d2b21e5d4d68b85bfdd705c20fcd795 (patch)
tree6908510d19e8e68ba865fc1d79281b64aa8d7a87 /keyboards/preonic/keymaps/dudeofawesome/keymap.c
parent48321c3eee6218aaaa5287747e3ee5ac14617518 (diff)
layout(preonic): update to dudeofawesome's layout (#2507)
* 🎉 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
Diffstat (limited to 'keyboards/preonic/keymaps/dudeofawesome/keymap.c')
-rw-r--r--keyboards/preonic/keymaps/dudeofawesome/keymap.c130
1 files changed, 72 insertions, 58 deletions
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;
+ }
+ }
};