summaryrefslogtreecommitdiffstats
path: root/keyboards/preonic
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/preonic')
-rw-r--r--keyboards/preonic/keymaps/default/config.h13
-rw-r--r--keyboards/preonic/keymaps/default/keymap.c101
2 files changed, 33 insertions, 81 deletions
diff --git a/keyboards/preonic/keymaps/default/config.h b/keyboards/preonic/keymaps/default/config.h
index 4c6158199..003fd259c 100644
--- a/keyboards/preonic/keymaps/default/config.h
+++ b/keyboards/preonic/keymaps/default/config.h
@@ -3,6 +3,18 @@
#include "../../config.h"
+#ifdef AUDIO_ENABLE
+ #define STARTUP_SONG SONG(PLANCK_SOUND)
+ // #define STARTUP_SONG SONG(NO_SOUND)
+
+ #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \
+ SONG(COLEMAK_SOUND), \
+ SONG(DVORAK_SOUND) \
+ }
+#endif
+
+#define MUSIC_MASK (keycode != KC_NO)
+
/*
* MIDI options
*/
@@ -13,6 +25,7 @@
/* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on
*/
+
#define MIDI_BASIC
/* enable advanced MIDI features:
diff --git a/keyboards/preonic/keymaps/default/keymap.c b/keyboards/preonic/keymaps/default/keymap.c
index 2516a726b..01f40542c 100644
--- a/keyboards/preonic/keymaps/default/keymap.c
+++ b/keyboards/preonic/keymaps/default/keymap.c
@@ -1,14 +1,21 @@
+/* Copyright 2015-2017 Jack Humbert
+ *
+ * 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 "preonic.h"
#include "action_layer.h"
-#include "eeconfig.h"
-#ifdef AUDIO_ENABLE
- #include "audio.h"
-#endif
-
-// Each layer gets a name for readability, which is then used in the keymap matrix below.
-// The underscores don't mean anything - you can have a layer called STUFF or any other name.
-// Layer names don't all need to be of the same length, obviously, and you can also skip them
-// entirely and just use numbers.
enum preonic_layers {
_QWERTY,
@@ -28,10 +35,6 @@ enum preonic_keycodes {
BACKLIT
};
-// Fillers to make layering more clear
-#define _______ KC_TRNS
-#define XXXXXXX KC_NO
-
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty
@@ -155,7 +158,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_ADJUST] = {
{KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12},
{_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL},
- {_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______},
+ {_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______},
{_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
}
@@ -163,54 +166,23 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
-#ifdef AUDIO_ENABLE
-float tone_startup[][2] = {
- {NOTE_B5, 20},
- {NOTE_B6, 8},
- {NOTE_DS6, 20},
- {NOTE_B6, 8}
-};
-
-float tone_qwerty[][2] = SONG(QWERTY_SOUND);
-float tone_dvorak[][2] = SONG(DVORAK_SOUND);
-float tone_colemak[][2] = SONG(COLEMAK_SOUND);
-
-float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
-
-float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
-#endif
-
-void persistent_default_layer_set(uint16_t default_layer) {
- eeconfig_update_default_layer(default_layer);
- default_layer_set(default_layer);
-}
-
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
- #ifdef AUDIO_ENABLE
- PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
- #endif
- persistent_default_layer_set(1UL<<_QWERTY);
+ set_single_persistent_default_layer(_QWERTY);
}
return false;
break;
case COLEMAK:
if (record->event.pressed) {
- #ifdef AUDIO_ENABLE
- PLAY_NOTE_ARRAY(tone_colemak, false, 0);
- #endif
- persistent_default_layer_set(1UL<<_COLEMAK);
+ set_single_persistent_default_layer(_COLEMAK);
}
return false;
break;
case DVORAK:
if (record->event.pressed) {
- #ifdef AUDIO_ENABLE
- PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
- #endif
- persistent_default_layer_set(1UL<<_DVORAK);
+ set_single_persistent_default_layer(_DVORAK);
}
return false;
break;
@@ -248,36 +220,3 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return true;
};
-
-void matrix_init_user(void) {
- #ifdef AUDIO_ENABLE
- startup_user();
- #endif
-}
-
-#ifdef AUDIO_ENABLE
-
-void startup_user()
-{
- _delay_ms(20); // gets rid of tick
- PLAY_NOTE_ARRAY(tone_startup, false, 0);
-}
-
-void shutdown_user()
-{
- PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
- _delay_ms(150);
- stop_all_notes();
-}
-
-void music_on_user(void)
-{
- music_scale_user();
-}
-
-void music_scale_user(void)
-{
- PLAY_NOTE_ARRAY(music_scale, false, 0);
-}
-
-#endif