diff --git a/Makefile b/Makefile
index b429200fe..5ed757dc2 100644
--- a/Makefile
+++ b/Makefile
@@ -419,7 +419,7 @@ define BUILD_TEST
MAKE_TARGET := $2
COMMAND := $1
MAKE_CMD := $$(MAKE) -r -R -C $(ROOT_DIR) -f build_test.mk $$(MAKE_TARGET)
- MAKE_VARS := TEST=$$(TEST_NAME) FULL_TESTS=$$(FULL_TESTS)
+ MAKE_VARS := TEST=$$(TEST_NAME) FULL_TESTS="$$(FULL_TESTS)"
MAKE_MSG := $$(MSG_MAKE_TEST)
$$(eval $$(call BUILD))
ifneq ($$(MAKE_TARGET),clean)
diff --git a/build_full_test.mk b/build_full_test.mk
index 94356d575..170020b96 100644
--- a/build_full_test.mk
+++ b/build_full_test.mk
@@ -21,12 +21,13 @@ $(TEST)_SRC= \
$(TEST_PATH)/keymap.c \
$(TMK_COMMON_SRC) \
$(QUANTUM_SRC) \
+ $(SRC) \
tests/test_common/matrix.c \
tests/test_common/test_driver.cpp \
tests/test_common/keyboard_report_util.cpp \
tests/test_common/test_fixture.cpp
$(TEST)_SRC += $(patsubst $(ROOTDIR)/%,%,$(wildcard $(TEST_PATH)/*.cpp))
-$(TEST)_DEFS=$(TMK_COMMON_DEFS)
+$(TEST)_DEFS=$(TMK_COMMON_DEFS) $(OPT_DEFS)
$(TEST)_CONFIG=$(TEST_PATH)/config.h
VPATH+=$(TOP_DIR)/tests/test_common
\ No newline at end of file
diff --git a/docs/custom_quantum_functions.md b/docs/custom_quantum_functions.md
index c017c0cdb..10a718431 100644
--- a/docs/custom_quantum_functions.md
+++ b/docs/custom_quantum_functions.md
@@ -36,7 +36,7 @@ enum my_keycodes {
## Programming The Behavior Of Any Keycode
-When you want to override the behavior of an existing key, or define the behavior for a new key, you should use the `process_record_kb()' and `process_record_user()` functions. These are called by QMK during key processing before the actual key event is handled. If these functions return `true` QMK will process the keycodes as usual. That can be handy for extending the functionality of a key rather than replacing it. If these functions return `false` QMK will skip the normal key handling, and it will be up you to send any key up or down events that are required.
+When you want to override the behavior of an existing key, or define the behavior for a new key, you should use the `process_record_kb()` and `process_record_user()` functions. These are called by QMK during key processing before the actual key event is handled. If these functions return `true` QMK will process the keycodes as usual. That can be handy for extending the functionality of a key rather than replacing it. If these functions return `false` QMK will skip the normal key handling, and it will be up you to send any key up or down events that are required.
These function are called every time a key is pressed or released.
diff --git a/docs/modding_your_keyboard.md b/docs/modding_your_keyboard.md
index 44e6e6e72..a58fbd52b 100644
--- a/docs/modding_your_keyboard.md
+++ b/docs/modding_your_keyboard.md
@@ -1,52 +1,52 @@
## Audio output from a speaker
-Your keyboard can make sounds! If you've got a Planck, Preonic, or basically any keyboard that allows access to the C6 or B5 port (`#define C6_AUDIO` and `#define B5_AUDIO`), you can hook up a simple speaker and make it beep. You can use those beeps to indicate layer transitions, modifiers, special keys, or just to play some funky 8bit tunes.
+Your keyboard can make sounds! If you've got a Planck, Preonic, or basically any AVR keyboard that allows access to the C6 or B5 port (`#define C6_AUDIO` and/or `#define B5_AUDIO`), you can hook up a simple speaker and make it beep. You can use those beeps to indicate layer transitions, modifiers, special keys, or just to play some funky 8bit tunes.
-The audio code lives in [quantum/audio/audio.h](https://github.com/qmk/qmk_firmware/blob/master/quantum/audio/audio.h) and in the other files in the audio directory. It's enabled by default on the Planck [stock keymap](https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/default/keymap.c). Here are the important bits:
+If you add `AUDIO_ENABLE = yes` to your `rules.mk`, there's a couple different sounds that will automatically be enabled without any other configuration:
```
-#include "audio.h"
+STARTUP_SONG // plays when the keyboard starts up (audio.c)
+GOODBYE_SONG // plays when you press the RESET key (quantum.c)
+AG_NORM_SONG // plays when you press AG_NORM (quantum.c)
+AG_SWAP_SONG // plays when you press AG_SWAP (quantum.c)
+MUSIC_ON_SONG // plays when music mode is activated (process_music.c)
+MUSIC_OFF_SONG // plays when music mode is deactivated (process_music.c)
+CHROMATIC_SONG // plays when the chromatic music mode is selected (process_music.c)
+GUITAR_SONG // plays when the guitar music mode is selected (process_music.c)
+VIOLIN_SONG // plays when the violin music mode is selected (process_music.c)
+MAJOR_SONG // plays when the major music mode is selected (process_music.c)
```
-Then, lower down the file:
+You can override the default songs by doing something like this in your `config.h`:
-```
-float tone_startup[][2] = {
- ED_NOTE(_E7 ),
- E__NOTE(_CS7),
- E__NOTE(_E6 ),
- E__NOTE(_A6 ),
- M__NOTE(_CS7, 20)
-};
+```c
+#ifdef AUDIO_ENABLE
+ #define STARTUP_SONG SONG(STARTUP_SOUND)
+#endif
```
-This is how you write a song. Each of these lines is a note, so we have a little ditty composed of five notes here.
+A full list of sounds can be found in [quantum/audio/song_list.h](https://github.com/qmk/qmk_firmware/blob/master/quantum/audio/song_list.h) - feel free to add your own to this list! All available notes can be seen in [quantum/audio/musical_notes.h](https://github.com/qmk/qmk_firmware/blob/master/quantum/audio/musical_notes.h).
-Then, we have this chunk:
+To play a custom sound at a particular time, you can define a song like this (near the top of the file):
-```
-float tone_qwerty[][2] = SONG(QWERTY_SOUND);
-float tone_dvorak[][2] = SONG(DVORAK_SOUND);
-float tone_colemak[][2] = SONG(COLEMAK_SOUND);
-float tone_plover[][2] = SONG(PLOVER_SOUND);
-float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND);
-
-float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
-float goodbye[][2] = SONG(GOODBYE_SOUND);
+```c
+float my_song[][2] = SONG(QWERTY_SOUND);
```
-Wherein we bind predefined songs (from [quantum/audio/song_list.h](https://github.com/qmk/qmk_firmware/blob/master/quantum/audio/song_list.h)) into named variables. This is one optimization that helps save on memory: These songs only take up memory when you reference them in your keymap, because they're essentially all preprocessor directives.
+And then play your song like this:
-So now you have something called `tone_plover` for example. How do you make it play the Plover tune, then? If you look further down the keymap, you'll see this:
-
-```
-PLAY_NOTE_ARRAY(tone_plover, false, 0); // Signature is: Song name, repeat, rest style
+```c
+PLAY_SONG(my_song);
```
-This is inside one of the macros. So when that macro executes, your keyboard plays that particular chime.
+Alternatively, you can play it in a loop like this:
-"Rest style" in the method signature above (the last parameter) specifies if there's a rest (a moment of silence) between the notes.
+```c
+PLAY_LOOP(my_song);
+```
+
+It's advised that you wrap all audio features in `#ifdef AUDIO_ENABLE` / `#endif` to avoid causing problems when audio isn't built into the keyboard.
## Music mode
@@ -59,6 +59,11 @@ Keycodes available:
* `MU_ON` - Turn music mode on
* `MU_OFF` - Turn music mode off
* `MU_TOG` - Toggle music mode
+* `MU_MOD` - Cycle through the music modes:
+ * `CHROMATIC_MODE` - Chromatic scale, row changes the octave
+ * `GUITAR_MODE` - Chromatic scale, but the row changes the string (+5 st)
+ * `VIOLIN_MODE` - Chromatic scale, but the row changes the string (+7 st)
+ * `MAJOR_MODE` - Major scale
In music mode, the following keycodes work differently, and don't pass through:
@@ -68,6 +73,16 @@ In music mode, the following keycodes work differently, and don't pass through:
* `KC_UP` - speed-up playback
* `KC_DOWN` - slow-down playback
+By default, `MUSIC_MASK` is set to `keycode < 0xFF` which means keycodes less than `0xFF` are turned into notes, and don't output anything. You can change this by defining this in your `config.h` like this:
+
+ #define MUSIC_MASK keycode != KC_NO
+
+Which will capture all keycodes - be careful, this will get you stuck in music mode until you restart your keyboard!
+
+The pitch standard (`PITCH_STANDARD_A`) is 440.0f by default - to change this, add something like this to your `config.h`:
+
+ #define PITCH_STANDARD_A 432.0f
+
## MIDI functionalty
This is still a WIP, but check out `quantum/keymap_midi.c` to see what's happening. Enable from the Makefile.
diff --git a/keyboards/kc60/keymaps/workman-dead/keymap.c b/keyboards/kc60/keymaps/workman-dead/keymap.c
index 9e3b9bb65..36e1c6506 100644
--- a/keyboards/kc60/keymaps/workman-dead/keymap.c
+++ b/keyboards/kc60/keymaps/workman-dead/keymap.c
@@ -6,9 +6,6 @@
#define _FUN 3
#define _MS 4
-#define _______ KC_NO
-#define XXXXXXX KC_TRNS
-
#define _DK_ACT 0
#define _DK_REL 1
#define _KC_COMS 2
diff --git a/keyboards/planck/keymaps/default/config.h b/keyboards/planck/keymaps/default/config.h
index 4c6158199..b406e2fed 100644
--- a/keyboards/planck/keymaps/default/config.h
+++ b/keyboards/planck/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/planck/keymaps/default/keymap.c b/keyboards/planck/keymaps/default/keymap.c
index 61275cb26..f71a2b59b 100644
--- a/keyboards/planck/keymaps/default/keymap.c
+++ b/keyboards/planck/keymaps/default/keymap.c
@@ -1,20 +1,24 @@
-// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
-// this is the style you want to emulate.
+/* 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 .
+ */
#include "planck.h"
#include "action_layer.h"
-#ifdef AUDIO_ENABLE
- #include "audio.h"
-#endif
-#include "eeconfig.h"
extern keymap_config_t keymap_config;
-// 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 planck_layers {
_QWERTY,
_COLEMAK,
@@ -36,10 +40,6 @@ enum planck_keycodes {
EXT_PLV
};
-// Fillers to make layering more clear
-#define _______ KC_TRNS
-#define XXXXXXX KC_NO
-
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty
@@ -164,7 +164,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[_ADJUST] = {
{_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL },
- {_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______},
+ {_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______},
{_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
}
@@ -173,50 +173,27 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
#ifdef AUDIO_ENABLE
-
-float tone_startup[][2] = SONG(STARTUP_SOUND);
-float tone_qwerty[][2] = SONG(QWERTY_SOUND);
-float tone_dvorak[][2] = SONG(DVORAK_SOUND);
-float tone_colemak[][2] = SONG(COLEMAK_SOUND);
-float tone_plover[][2] = SONG(PLOVER_SOUND);
-float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND);
-float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
-
-float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
+ float plover_song[][2] = SONG(PLOVER_SOUND);
+ float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_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;
@@ -255,7 +232,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
stop_all_notes();
- PLAY_NOTE_ARRAY(tone_plover, false, 0);
+ PLAY_SONG(plover_song);
#endif
layer_off(_RAISE);
layer_off(_LOWER);
@@ -273,7 +250,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case EXT_PLV:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
- PLAY_NOTE_ARRAY(tone_plover_gb, false, 0);
+ PLAY_SONG(plover_gb_song);
#endif
layer_off(_PLOVER);
}
@@ -281,37 +258,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
}
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
+}
\ No newline at end of file
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 .
+ */
+
#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
diff --git a/keyboards/roadkit/keymaps/singlesBrent/Makefile b/keyboards/roadkit/keymaps/singlesBrent/Makefile
new file mode 100644
index 000000000..b61d6cca2
--- /dev/null
+++ b/keyboards/roadkit/keymaps/singlesBrent/Makefile
@@ -0,0 +1,22 @@
+# Build Options
+# change to "no" to disable the options, or define them in the Makefile in
+# the appropriate keymap folder that will get included automatically
+#
+BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
+EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
+CONSOLE_ENABLE = no # Console for debug(+400)
+COMMAND_ENABLE = yes # Commands for debug and configuration
+NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
+MIDI_ENABLE = no # MIDI controls
+AUDIO_ENABLE = no # Audio output on port C6
+UNICODE_ENABLE = no # Unicode
+BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
+RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
+SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
+TAP_DANCE_ENABLE = yes # Enable Tap Dance functionality
+
+ifndef QUANTUM_DIR
+ include ../../../../Makefile
+endif
\ No newline at end of file
diff --git a/keyboards/roadkit/keymaps/singlesBrent/config.h b/keyboards/roadkit/keymaps/singlesBrent/config.h
new file mode 100644
index 000000000..57468e122
--- /dev/null
+++ b/keyboards/roadkit/keymaps/singlesBrent/config.h
@@ -0,0 +1,15 @@
+#ifndef CONFIG_USER_H
+#define CONFIG_USER_H
+
+#include "../../config.h"
+
+// place overrides here
+#define TAPPING_TERM 175
+
+#ifdef BACKLIGHT_ENABLE
+ #define BACKLIGHT_PIN B5
+ #define BACKLIGHT_LEVELS 3
+ #define BACKLIGHT_ON_STATE 0
+#endif
+
+#endif
\ No newline at end of file
diff --git a/keyboards/roadkit/keymaps/singlesBrent/keymap.c b/keyboards/roadkit/keymaps/singlesBrent/keymap.c
new file mode 100644
index 000000000..13197346a
--- /dev/null
+++ b/keyboards/roadkit/keymaps/singlesBrent/keymap.c
@@ -0,0 +1,242 @@
+#include "roadkit.h"
+#include "action_layer.h"
+#include "eeconfig.h"
+
+extern keymap_config_t keymap_config;
+
+// 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.
+
+#define _NP 0
+#define _L1 1
+#define _L2 2
+#define _L3 3
+
+// Macro name shortcuts
+#define NUMPAD M(_NP)
+#define LAYER1 M(_L1)
+#define LAYER2 M(_L2)
+#define LAYER3 M(_L3)
+
+// Fillers to make layering more clear
+#define _______ KC_TRNS
+#define XXXXXXX KC_NO
+
+void matrix_init_user(void) {
+ backlight_level(4);
+}
+
+
+
+//Tap Dance Declarations
+
+enum {
+
+ TD_EQUAL_NP = 0,
+ TD_KP_PLUS_L1,
+ TD_DOT_L2,
+ TD_0_L3
+
+};
+
+//Tap Dance Definitions
+
+
+ //TD equal to turn on layer NP
+void _td_equal_tg_finished (qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 1) {
+ register_code(KC_EQUAL);
+ } else if (state->count == 2) {
+ backlight_set(3);
+ layer_on(_NP);
+ layer_off(_L1);
+ layer_off(_L2);
+ layer_off(_L3);
+ }
+}
+
+void _td_equal_tg_reset (qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 1) {
+ unregister_code(KC_EQUAL);
+ }
+}
+
+
+ //TD kp plus to toggle layer 1
+void _td_kp_plus_tg_finished (qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 1) {
+ register_code(KC_KP_PLUS);
+ } else if (state->count == 2) {
+// layer_invert(_L1);
+ backlight_set(2);
+ layer_on(_L1);
+ layer_off(_L2);
+ layer_off(_L3);
+ }
+}
+
+void _td_kp_plus_tg_reset (qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 1) {
+ unregister_code(KC_KP_PLUS);
+ }
+}
+
+
+ //TD dot to toggle layer 2
+void _td_dot_tg_finished (qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 1) {
+ register_code(KC_DOT);
+ } else if (state->count == 2) {
+ backlight_set(1);
+ layer_on(_L2);
+ layer_off(_L1);
+ layer_off(_L3);
+ }
+}
+
+void _td_dot_tg_reset (qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 1) {
+ unregister_code(KC_DOT);
+ }
+}
+
+ //TD 0 to toggle layer 3
+void _td_0_tg_finished (qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 1) {
+ register_code(KC_0);
+ } else if (state->count == 2) {
+ backlight_set(0);
+ layer_on(_L3);
+ layer_off(_L1);
+ layer_off(_L2);
+ }
+}
+
+void _td_0_tg_reset (qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 1) {
+ unregister_code(KC_0);
+ }
+}
+
+//TD Actions
+qk_tap_dance_action_t tap_dance_actions[] = {
+ [TD_EQUAL_NP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, _td_equal_tg_finished, _td_equal_tg_reset),
+ [TD_KP_PLUS_L1] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, _td_kp_plus_tg_finished, _td_kp_plus_tg_reset),
+ [TD_DOT_L2] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, _td_dot_tg_finished, _td_dot_tg_reset),
+ [TD_0_L3] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, _td_0_tg_finished, _td_0_tg_reset)
+};
+
+
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+/* Numberpad
+ * ,-----------------------.
+ * | 7 | 8 | 9 | / |
+ * |-----`-----`-----`-----|
+ * | 4 | 5 | 6 | * |
+ * |-----`-----`-----`-----|
+ * | 1 | 2 | 3 | - |
+ * |-----`-----`-----`-----|
+ * | 0 | . | + | = |
+ * `-----`-----`-----`-----'
+ * Tapdances:
+ * | L3 | L2 | L1 | NP |
+ * `-----`-----`-----`-----'
+ */
+ [_NP] = /* Numpad */
+ SINGLES_KEYMAP(KC_7, KC_8, KC_9, KC_SLASH, \
+ KC_4, KC_5, KC_6, KC_KP_ASTERISK, \
+ KC_1, KC_2, KC_3, KC_MINUS, \
+ TD(TD_0_L3), TD(TD_DOT_L2), TD(TD_KP_PLUS_L1), TD(TD_EQUAL_NP)),
+
+/* L1
+ * ,-----------------------.
+ * | Esc |Bksp |Home |PgUp |
+ * |-----`-----`-----`-----|
+ * | Tab | Up | End |PgDn |
+ * |-----`-----`-----`-----|
+ * |Left |Down |Right|Enter|
+ * |-----`-----`-----`-----|
+ * | 0 | . | + | = |
+ * `-----`-----`-----`-----'
+ */
+ [_L1] = /* LAYER 1 */
+ SINGLES_KEYMAP(KC_ESCAPE, KC_BSPACE, KC_HOME, KC_PGUP, \
+ KC_TAB, KC_UP, KC_END, KC_PGDOWN, \
+ KC_LEFT, KC_DOWN, KC_RIGHT, KC_KP_ENTER, \
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
+
+/* L2
+ * ,-----------------------.
+ * |Sleep|LClik|RClik|VolUp|
+ * |-----`-----`-----`-----|
+ * |AltF4| F11 |WinTb|VolDn|
+ * |-----`-----`-----`-----|
+ * |PrvTk|Play |NxtTk|Mute |
+ * |-----`-----`-----`-----|
+ * | 0 | . | + | = |
+ * `-----`-----`-----`-----'
+ */
+ [_L2] = /* LAYER 2 */
+ SINGLES_KEYMAP(KC_SYSTEM_SLEEP, KC_MS_BTN1, KC_MS_BTN2, KC_AUDIO_VOL_UP, \
+ LALT(KC_F4), KC_F11, LGUI(KC_TAB), KC_AUDIO_VOL_DOWN, \
+ KC_MEDIA_PREV_TRACK, KC_MEDIA_PLAY_PAUSE, KC_MEDIA_NEXT_TRACK, KC_AUDIO_MUTE, \
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
+
+
+/* L3 needs cut, copy, paste, undo, again (redo), find, calc, www back, www forward, F5
+ * ,-----------------------.
+ * |WBack|WHome|WFor | F5 |
+ * |-----`-----`-----`-----|
+ * |Calc |Undo |Redo |WSrch|
+ * |-----`-----`-----`-----|
+ * | Cut |Copy |Paste|Find |
+ * |-----`-----`-----`-----|
+ * | 0 | . | + | = |
+ * `-----`-----`-----`-----'
+ */
+ [_L3] = /* LAYER 3 */
+ SINGLES_KEYMAP(KC_WWW_BACK, KC_WWW_HOME, KC_WWW_FORWARD, KC_F5, \
+ KC_CALCULATOR, LCTL(KC_Z), LCTL(KC_Y), KC_WWW_SEARCH, \
+ LCTL(KC_X), LCTL(KC_C), LCTL(KC_V), LCTL(KC_F), \
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
+};
+
+const uint16_t PROGMEM fn_actions[] = {
+
+};
+
+void persistent_default_layer_set(uint16_t default_layer) {
+ eeconfig_update_default_layer(default_layer);
+ default_layer_set(default_layer);
+}
+
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
+{
+ switch(id) {
+ case _L3:
+ if (record->event.pressed) {
+ persistent_default_layer_set(1UL<<_L3);
+ }
+ break;
+ case _L2:
+ if (record->event.pressed) {
+ persistent_default_layer_set(1UL<<_L2);
+ }
+ break;
+ case _L1:
+ if (record->event.pressed) {
+ persistent_default_layer_set(1UL<<_L1);
+ }
+ break;
+ case _NP:
+ if (record->event.pressed) {
+ persistent_default_layer_set(1UL<<_NP);
+ }
+ break;
+ }
+ return MACRO_NONE;
+};
diff --git a/keyboards/roadkit/keymaps/singlesBrent/readme.md b/keyboards/roadkit/keymaps/singlesBrent/readme.md
new file mode 100644
index 000000000..48ea4a8b3
--- /dev/null
+++ b/keyboards/roadkit/keymaps/singlesBrent/readme.md
@@ -0,0 +1,3 @@
+# The singles keymap for roadkit
+
+This keymap has a base layer with numpad functionality, and then a second layer with some additional keys. The user is encouraged to develop their own keymap using this as a starting point.
diff --git a/keyboards/tada68/keymaps/maartenwut/keymap.c b/keyboards/tada68/keymaps/maartenwut/keymap.c
index d1e63a6b3..8ddd6e305 100755
--- a/keyboards/tada68/keymaps/maartenwut/keymap.c
+++ b/keyboards/tada68/keymaps/maartenwut/keymap.c
@@ -30,15 +30,6 @@
#define LSHIFT OSM(MOD_LSFT)
#define SPACE LT(_AR, KC_SPC)
-#define MACRO_BREATH_TOGGLE 13
-#define MACRO_BREATH_SPEED_INC 14
-#define MACRO_BREATH_SPEED_DEC 15
-#define MACRO_BREATH_DEFAULT 16
-#define M_BRTOG M(MACRO_BREATH_TOGGLE)
-#define M_BSPDU M(MACRO_BREATH_SPEED_INC)
-#define M_BSPDD M(MACRO_BREATH_SPEED_DEC)
-#define M_BDFLT M(MACRO_BREATH_DEFAULT)
-
static uint16_t key_timer;
enum emoticons {
@@ -76,7 +67,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |----------------------------------------------------------------|
* | |MsL|MsD|MsR| |_GA| | | | | | | |Hme |
* |----------------------------------------------------------------|
- * | | |BL-|BL+|BL |BR-|BR+|BR | |VoU|VoD|Mut| |MwU|End |
+ * | | | | | | | | | |VoU|VoD|Mut| |MwU|End |
* |----------------------------------------------------------------|
* | | | | | | | |MwL|MwD|MwR |
* `----------------------------------------------------------------'
@@ -84,13 +75,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_FL] = KEYMAP_ANSI(
KC_GRV, 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_PSCR, \
TRNS, KC_BTN1, KC_MS_U, KC_BTN2, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TO(_LO), \
- TRNS, KC_MS_L, KC_MS_D, KC_MS_R, TRNS, TG(_GA), TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, KC_HOME, \
- TRNS, TRNS, BL_DEC, BL_INC, BL_TOGG, M_BSPDD, M_BSPDU, M_BRTOG, TRNS, KC_VOLD, KC_VOLU, KC_MUTE, TRNS, KC_WH_U, KC_END, \
+ TRNS, KC_MS_L, KC_MS_D, KC_MS_R, TRNS, TG(_GA), TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, KC_HOME, \
+ TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, KC_VOLD, KC_VOLU, KC_MUTE, TRNS, KC_WH_U, KC_END, \
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, KC_WH_L, KC_WH_D, KC_WH_R),
/* Keymap _AR: Arrow layer
* ,----------------------------------------------------------------.
- * | | | | | | | | | | | | | | | |
+ * |~` | F1|F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12| | |
* |----------------------------------------------------------------|
* |Lenny| | | | | | | | | | | | | | |
* |----------------------------------------------------------------|
@@ -102,7 +93,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `----------------------------------------------------------------'
*/
[_AR] = KEYMAP_ANSI(
- TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
+ KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, TRNS, TRNS, \
LENNY, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
DWNHRT, TRNS, TRNS, TRNS, TRNS, TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, TRNS, TRNS, TRNS, TRNS, \
SHRUG, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
@@ -408,29 +399,16 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
}
}
break;
- case MACRO_BREATH_TOGGLE:
- if (record->event.pressed) {
- breathing_toggle();
- }
- break;
-
- case MACRO_BREATH_SPEED_INC:
- if (record->event.pressed) {
- breathing_speed_inc(1);
- }
- break;
-
- case MACRO_BREATH_SPEED_DEC:
- if (record->event.pressed) {
- breathing_speed_dec(1);
- }
- break;
-
- case MACRO_BREATH_DEFAULT:
- if (record->event.pressed) {
- breathing_defaults();
- }
- break;
}
return MACRO_NONE;
};
+
+void led_set_user(uint8_t usb_led) {
+ if (usb_led & (1<.
*/
+
#include
#include
//#include
@@ -98,7 +99,6 @@ uint16_t note_position = 0;
float (* notes_pointer)[][2];
uint16_t notes_count;
bool notes_repeat;
-float notes_rest;
bool note_resting = false;
uint8_t current_note = 0;
@@ -119,9 +119,17 @@ audio_config_t audio_config;
uint16_t envelope_index = 0;
bool glissando = true;
+#ifndef STARTUP_SONG
+ #define STARTUP_SONG SONG(STARTUP_SOUND)
+#endif
+float startup_song[][2] = STARTUP_SONG;
+
void audio_init()
{
+ if (audio_initialized)
+ return;
+
// Check EEPROM
if (!eeconfig_is_enabled())
{
@@ -169,6 +177,11 @@ void audio_init()
#endif
audio_initialized = true;
+
+ if (audio_config.enable) {
+ PLAY_SONG(startup_song);
+ }
+
}
void stop_all_notes()
@@ -402,9 +415,12 @@ ISR(TIMER3_COMPA_vect)
note_position++;
bool end_of_note = false;
if (TIMER_3_PERIOD > 0) {
- end_of_note = (note_position >= (note_length / TIMER_3_PERIOD * 0xFFFF));
+ if (!note_resting)
+ end_of_note = (note_position >= (note_length / TIMER_3_PERIOD * 0xFFFF - 1));
+ else
+ end_of_note = (note_position >= (note_length));
} else {
- end_of_note = (note_position >= (note_length * 0x7FF));
+ end_of_note = (note_position >= (note_length));
}
if (end_of_note) {
@@ -419,11 +435,16 @@ ISR(TIMER3_COMPA_vect)
return;
}
}
- if (!note_resting && (notes_rest > 0)) {
+ if (!note_resting) {
note_resting = true;
- note_frequency = 0;
- note_length = notes_rest;
current_note--;
+ if ((*notes_pointer)[current_note][0] == (*notes_pointer)[current_note + 1][0]) {
+ note_frequency = 0;
+ note_length = 1;
+ } else {
+ note_frequency = (*notes_pointer)[current_note][0];
+ note_length = 1;
+ }
} else {
note_resting = false;
envelope_index = 0;
@@ -534,9 +555,12 @@ ISR(TIMER1_COMPA_vect)
note_position++;
bool end_of_note = false;
if (TIMER_1_PERIOD > 0) {
- end_of_note = (note_position >= (note_length / TIMER_1_PERIOD * 0xFFFF));
+ if (!note_resting)
+ end_of_note = (note_position >= (note_length / TIMER_1_PERIOD * 0xFFFF - 1));
+ else
+ end_of_note = (note_position >= (note_length));
} else {
- end_of_note = (note_position >= (note_length * 0x7FF));
+ end_of_note = (note_position >= (note_length));
}
if (end_of_note) {
@@ -551,11 +575,16 @@ ISR(TIMER1_COMPA_vect)
return;
}
}
- if (!note_resting && (notes_rest > 0)) {
+ if (!note_resting) {
note_resting = true;
- note_frequency = 0;
- note_length = notes_rest;
current_note--;
+ if ((*notes_pointer)[current_note][0] == (*notes_pointer)[current_note + 1][0]) {
+ note_frequency = 0;
+ note_length = 1;
+ } else {
+ note_frequency = (*notes_pointer)[current_note][0];
+ note_length = 1;
+ }
} else {
note_resting = false;
envelope_index = 0;
@@ -624,7 +653,7 @@ void play_note(float freq, int vol) {
}
-void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat, float n_rest)
+void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat)
{
if (!audio_initialized) {
@@ -649,7 +678,6 @@ void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat, float n_rest)
notes_pointer = np;
notes_count = n_count;
notes_repeat = n_repeat;
- notes_rest = n_rest;
place = 0;
current_note = 0;
diff --git a/quantum/audio/audio.h b/quantum/audio/audio.h
index 27fdc2ab6..79e0da229 100644
--- a/quantum/audio/audio.h
+++ b/quantum/audio/audio.h
@@ -86,7 +86,7 @@ void play_sample(uint8_t * s, uint16_t l, bool r);
void play_note(float freq, int vol);
void stop_note(float freq);
void stop_all_notes(void);
-void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat, float n_rest);
+void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat);
#define SCALE (int8_t []){ 0 + (12*0), 2 + (12*0), 4 + (12*0), 5 + (12*0), 7 + (12*0), 9 + (12*0), 11 + (12*0), \
0 + (12*1), 2 + (12*1), 4 + (12*1), 5 + (12*1), 7 + (12*1), 9 + (12*1), 11 + (12*1), \
@@ -98,8 +98,10 @@ void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat, float n_rest)
// length. This works around the limitation of C's sizeof operation on pointers.
// The global float array for the song must be used here.
#define NOTE_ARRAY_SIZE(x) ((int16_t)(sizeof(x) / (sizeof(x[0]))))
-#define PLAY_NOTE_ARRAY(note_array, note_repeat, note_rest_style) play_notes(¬e_array, NOTE_ARRAY_SIZE((note_array)), (note_repeat), (note_rest_style));
-
+#define PLAY_NOTE_ARRAY(note_array, note_repeat, deprecated_arg) play_notes(¬e_array, NOTE_ARRAY_SIZE((note_array)), (note_repeat)); \
+ _Pragma ("message \"'PLAY_NOTE_ARRAY' macro is deprecated\"")
+#define PLAY_SONG(note_array) play_notes(¬e_array, NOTE_ARRAY_SIZE((note_array)), false)
+#define PLAY_LOOP(note_array) play_notes(¬e_array, NOTE_ARRAY_SIZE((note_array)), true)
bool is_playing_notes(void);
diff --git a/quantum/audio/musical_notes.h b/quantum/audio/musical_notes.h
index a3aaa2f19..647b69564 100644
--- a/quantum/audio/musical_notes.h
+++ b/quantum/audio/musical_notes.h
@@ -51,12 +51,6 @@
#define ED_NOTE(n) EIGHTH_DOT_NOTE(n)
#define SD_NOTE(n) SIXTEENTH_DOT_NOTE(n)
-// Note Styles
-// Staccato makes sure there is a rest between each note. Think: TA TA TA
-// Legato makes notes flow together. Think: TAAA
-#define STACCATO 0.01
-#define LEGATO 0
-
// Note Timbre
// Changes how the notes sound
#define TIMBRE_12 0.125
@@ -65,7 +59,6 @@
#define TIMBRE_75 0.750
#define TIMBRE_DEFAULT TIMBRE_50
-
// Notes - # = Octave
#define NOTE_REST 0.00
diff --git a/quantum/audio/song_list.h b/quantum/audio/song_list.h
index db2d1a94c..f355d371b 100644
--- a/quantum/audio/song_list.h
+++ b/quantum/audio/song_list.h
@@ -18,9 +18,7 @@
#ifndef SONG_LIST_H
#define SONG_LIST_H
-#define COIN_SOUND \
- E__NOTE(_A5 ),\
- HD_NOTE(_E6 ),
+#define NO_SOUND
#define ODE_TO_JOY \
Q__NOTE(_E4), Q__NOTE(_E4), Q__NOTE(_F4), Q__NOTE(_G4), \
@@ -55,18 +53,29 @@
E__NOTE(_CS4), E__NOTE(_B4), QD_NOTE(_AS4), \
E__NOTE(_AS4), E__NOTE(_AS4), QD_NOTE(_B4),
+#define STARTUP_SOUND \
+ E__NOTE(_E6), \
+ E__NOTE(_A6), \
+ ED_NOTE(_E7),
+
#define GOODBYE_SOUND \
E__NOTE(_E7), \
E__NOTE(_A6), \
ED_NOTE(_E6),
-#define STARTUP_SOUND \
+#define PLANCK_SOUND \
ED_NOTE(_E7 ), \
E__NOTE(_CS7), \
E__NOTE(_E6 ), \
E__NOTE(_A6 ), \
M__NOTE(_CS7, 20),
+#define PREONIC_SOUND \
+ M__NOTE(_B5, 20), \
+ E__NOTE(_B6), \
+ M__NOTE(_DS6, 20), \
+ E__NOTE(_B6),
+
#define QWERTY_SOUND \
E__NOTE(_GS6 ), \
E__NOTE(_A6 ), \
@@ -107,7 +116,8 @@
S__NOTE(_REST), \
ED_NOTE(_E7 ),
-#define MUSIC_SCALE_SOUND \
+
+#define MUSIC_ON_SOUND \
E__NOTE(_A5 ), \
E__NOTE(_B5 ), \
E__NOTE(_CS6), \
@@ -117,6 +127,50 @@
E__NOTE(_GS6), \
E__NOTE(_A6 ),
+#define MUSIC_SCALE_SOUND MUSIC_ON_SOUND
+
+#define MUSIC_OFF_SOUND \
+ E__NOTE(_A6 ), \
+ E__NOTE(_GS6 ), \
+ E__NOTE(_FS6), \
+ E__NOTE(_E6 ), \
+ E__NOTE(_D6 ), \
+ E__NOTE(_CS6), \
+ E__NOTE(_B5), \
+ E__NOTE(_A5 ),
+
+#define VOICE_CHANGE_SOUND \
+ Q__NOTE(_A5 ), \
+ Q__NOTE(_CS6), \
+ Q__NOTE(_E6 ), \
+ Q__NOTE(_A6 ),
+
+#define CHROMATIC_SOUND \
+ Q__NOTE(_A5 ), \
+ Q__NOTE(_AS5 ), \
+ Q__NOTE(_B5), \
+ Q__NOTE(_C6 ), \
+ Q__NOTE(_CS6 ),
+
+#define MAJOR_SOUND \
+ Q__NOTE(_A5 ), \
+ Q__NOTE(_B5 ), \
+ Q__NOTE(_CS6), \
+ Q__NOTE(_D6 ), \
+ Q__NOTE(_E6 ),
+
+#define GUITAR_SOUND \
+ Q__NOTE(_E5 ), \
+ Q__NOTE(_A5), \
+ Q__NOTE(_D6 ), \
+ Q__NOTE(_G6 ),
+
+#define VIOLIN_SOUND \
+ Q__NOTE(_G5 ), \
+ Q__NOTE(_D6), \
+ Q__NOTE(_A6 ), \
+ Q__NOTE(_E7 ),
+
#define CAPS_LOCK_ON_SOUND \
E__NOTE(_A3), \
E__NOTE(_B3),
@@ -141,6 +195,16 @@
E__NOTE(_E5), \
E__NOTE(_D5),
+#define AG_NORM_SOUND \
+ E__NOTE(_A5), \
+ E__NOTE(_A5),
+
+#define AG_SWAP_SOUND \
+ SD_NOTE(_B5), \
+ SD_NOTE(_A5), \
+ SD_NOTE(_B5), \
+ SD_NOTE(_A5),
+
#define UNICODE_WINDOWS \
E__NOTE(_B5), \
S__NOTE(_E6),
diff --git a/quantum/config_common.h b/quantum/config_common.h
index c88e02d91..4c6a702af 100644
--- a/quantum/config_common.h
+++ b/quantum/config_common.h
@@ -100,4 +100,6 @@
#define API_SYSEX_MAX_SIZE 32
+#include "song_list.h"
+
#endif
diff --git a/quantum/process_keycode/process_audio.c b/quantum/process_keycode/process_audio.c
index 0b6380ed3..32057ae8d 100644
--- a/quantum/process_keycode/process_audio.c
+++ b/quantum/process_keycode/process_audio.c
@@ -1,10 +1,19 @@
#include "audio.h"
#include "process_audio.h"
+#ifndef VOICE_CHANGE_SONG
+ #define VOICE_CHANGE_SONG SONG(VOICE_CHANGE_SOUND)
+#endif
+float voice_change_song[][2] = VOICE_CHANGE_SONG;
+
+#ifndef PITCH_STANDARD_A
+ #define PITCH_STANDARD_A 440.0f
+#endif
+
static float compute_freq_for_midi_note(uint8_t note)
{
// https://en.wikipedia.org/wiki/MIDI_tuning_standard
- return pow(2.0, (note - 69) / 12.0) * 440.0f;
+ return pow(2.0, (note - 69) / 12.0) * PITCH_STANDARD_A;
}
bool process_audio(uint16_t keycode, keyrecord_t *record) {
@@ -20,12 +29,9 @@ bool process_audio(uint16_t keycode, keyrecord_t *record) {
}
if (keycode == AU_TOG && record->event.pressed) {
- if (is_audio_on())
- {
+ if (is_audio_on()) {
audio_off();
- }
- else
- {
+ } else {
audio_on();
}
return false;
@@ -33,13 +39,13 @@ bool process_audio(uint16_t keycode, keyrecord_t *record) {
if (keycode == MUV_IN && record->event.pressed) {
voice_iterate();
- music_scale_user();
+ PLAY_SONG(voice_change_song);
return false;
}
if (keycode == MUV_DE && record->event.pressed) {
voice_deiterate();
- music_scale_user();
+ PLAY_SONG(voice_change_song);
return false;
}
diff --git a/quantum/process_keycode/process_music.c b/quantum/process_keycode/process_music.c
index 217dca280..63841d1e8 100644
--- a/quantum/process_keycode/process_music.c
+++ b/quantum/process_keycode/process_music.c
@@ -27,6 +27,7 @@
bool music_activated = false;
uint8_t music_starting_note = 0x0C;
int music_offset = 7;
+uint8_t music_mode = MUSIC_MODE_CHROMATIC;
// music sequencer
static bool music_sequence_recording = false;
@@ -39,6 +40,39 @@ static uint8_t music_sequence_position = 0;
static uint16_t music_sequence_timer = 0;
static uint16_t music_sequence_interval = 100;
+#ifdef AUDIO_ENABLE
+ #ifndef MUSIC_ON_SONG
+ #define MUSIC_ON_SONG SONG(MUSIC_ON_SOUND)
+ #endif
+ #ifndef MUSIC_OFF_SONG
+ #define MUSIC_OFF_SONG SONG(MUSIC_OFF_SOUND)
+ #endif
+ #ifndef CHROMATIC_SONG
+ #define CHROMATIC_SONG SONG(CHROMATIC_SOUND)
+ #endif
+ #ifndef GUITAR_SONG
+ #define GUITAR_SONG SONG(GUITAR_SOUND)
+ #endif
+ #ifndef VIOLIN_SONG
+ #define VIOLIN_SONG SONG(VIOLIN_SOUND)
+ #endif
+ #ifndef MAJOR_SONG
+ #define MAJOR_SONG SONG(MAJOR_SOUND)
+ #endif
+ float music_mode_songs[NUMBER_OF_MODES][5][2] = {
+ CHROMATIC_SONG,
+ GUITAR_SONG,
+ VIOLIN_SONG,
+ MAJOR_SONG
+ };
+ float music_on_song[][2] = MUSIC_ON_SONG;
+ float music_off_song[][2] = MUSIC_OFF_SONG;
+#endif
+
+#ifndef MUSIC_MASK
+ #define MUSIC_MASK keycode < 0xFF
+#endif
+
static void music_noteon(uint8_t note) {
#ifdef AUDIO_ENABLE
process_audio_noteon(note);
@@ -79,70 +113,71 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
}
if (keycode == MU_TOG && record->event.pressed) {
- if (music_activated)
- {
+ if (music_activated) {
music_off();
- }
- else
- {
+ } else {
music_on();
}
return false;
}
+ if (keycode == MU_MOD && record->event.pressed) {
+ music_mode_cycle();
+ return false;
+ }
+
if (music_activated) {
-
- if (keycode == KC_LCTL && record->event.pressed) { // Start recording
- music_all_notes_off();
- music_sequence_recording = true;
- music_sequence_recorded = false;
- music_sequence_playing = false;
- music_sequence_count = 0;
- return false;
- }
-
- if (keycode == KC_LALT && record->event.pressed) { // Stop recording/playing
- music_all_notes_off();
- if (music_sequence_recording) { // was recording
- music_sequence_recorded = true;
+ if (record->event.pressed) {
+ if (keycode == KC_LCTL) { // Start recording
+ music_all_notes_off();
+ music_sequence_recording = true;
+ music_sequence_recorded = false;
+ music_sequence_playing = false;
+ music_sequence_count = 0;
+ return false;
+ }
+
+ if (keycode == KC_LALT) { // Stop recording/playing
+ music_all_notes_off();
+ if (music_sequence_recording) { // was recording
+ music_sequence_recorded = true;
+ }
+ music_sequence_recording = false;
+ music_sequence_playing = false;
+ return false;
+ }
+
+ if (keycode == KC_LGUI && music_sequence_recorded) { // Start playing
+ music_all_notes_off();
+ music_sequence_recording = false;
+ music_sequence_playing = true;
+ music_sequence_position = 0;
+ music_sequence_timer = 0;
+ return false;
+ }
+
+ if (keycode == KC_UP) {
+ music_sequence_interval-=10;
+ return false;
+ }
+
+ if (keycode == KC_DOWN) {
+ music_sequence_interval+=10;
+ return false;
}
- music_sequence_recording = false;
- music_sequence_playing = false;
- return false;
}
- if (keycode == KC_LGUI && record->event.pressed && music_sequence_recorded) { // Start playing
- music_all_notes_off();
- music_sequence_recording = false;
- music_sequence_playing = true;
- music_sequence_position = 0;
- music_sequence_timer = 0;
- return false;
- }
-
- if (keycode == KC_UP) {
- if (record->event.pressed)
- music_sequence_interval-=10;
- return false;
- }
-
- if (keycode == KC_DOWN) {
- if (record->event.pressed)
- music_sequence_interval+=10;
- return false;
- }
-
- #define MUSIC_MODE_GUITAR
-
- #ifdef MUSIC_MODE_CHROMATIC
- uint8_t note = (music_starting_note + record->event.key.col + music_offset - 3)+12*(MATRIX_ROWS - record->event.key.row);
- #elif defined(MUSIC_MODE_GUITAR)
- uint8_t note = (music_starting_note + record->event.key.col + music_offset + 32)+5*(MATRIX_ROWS - record->event.key.row);
- #elif defined(MUSIC_MODE_VIOLIN)
- uint8_t note = (music_starting_note + record->event.key.col + music_offset + 32)+7*(MATRIX_ROWS - record->event.key.row);
- #else
- uint8_t note = (music_starting_note + SCALE[record->event.key.col + music_offset] - 3)+12*(MATRIX_ROWS - record->event.key.row);
- #endif
+ uint8_t note;
+ if (music_mode == MUSIC_MODE_CHROMATIC)
+ note = (music_starting_note + record->event.key.col + music_offset - 3)+12*(MATRIX_ROWS - record->event.key.row);
+ else if (music_mode == MUSIC_MODE_GUITAR)
+ note = (music_starting_note + record->event.key.col + music_offset + 32)+5*(MATRIX_ROWS - record->event.key.row);
+ else if (music_mode == MUSIC_MODE_VIOLIN)
+ note = (music_starting_note + record->event.key.col + music_offset + 32)+7*(MATRIX_ROWS - record->event.key.row);
+ else if (music_mode == MUSIC_MODE_MAJOR)
+ note = (music_starting_note + SCALE[record->event.key.col + music_offset] - 3)+12*(MATRIX_ROWS - record->event.key.row);
+ else
+ note = music_starting_note;
if (record->event.pressed) {
music_noteon(note);
@@ -154,7 +189,7 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
music_noteoff(note);
}
- if (keycode < 0xFF) // ignores all normal keycodes, but lets RAISE, LOWER, etc through
+ if (MUSIC_MASK)
return false;
}
@@ -175,12 +210,26 @@ void music_toggle(void) {
void music_on(void) {
music_activated = 1;
+ #ifdef AUDIO_ENABLE
+ PLAY_SONG(music_on_song);
+ #endif
music_on_user();
}
void music_off(void) {
- music_activated = 0;
music_all_notes_off();
+ music_activated = 0;
+ #ifdef AUDIO_ENABLE
+ PLAY_SONG(music_off_song);
+ #endif
+}
+
+void music_mode_cycle(void) {
+ music_all_notes_off();
+ music_mode = (music_mode + 1) % NUMBER_OF_MODES;
+ #ifdef AUDIO_ENABLE
+ PLAY_SONG(music_mode_songs[music_mode]);
+ #endif
}
void matrix_scan_music(void) {
diff --git a/quantum/process_keycode/process_music.h b/quantum/process_keycode/process_music.h
index 8dfbf041f..ee027197c 100644
--- a/quantum/process_keycode/process_music.h
+++ b/quantum/process_keycode/process_music.h
@@ -21,6 +21,14 @@
#if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
+enum music_modes {
+ MUSIC_MODE_CHROMATIC,
+ MUSIC_MODE_GUITAR,
+ MUSIC_MODE_VIOLIN,
+ MUSIC_MODE_MAJOR,
+ NUMBER_OF_MODES
+};
+
bool process_music(uint16_t keycode, keyrecord_t *record);
bool is_music_on(void);
@@ -31,6 +39,7 @@ void music_off(void);
void music_on_user(void);
void music_scale_user(void);
void music_all_notes_off(void);
+void music_mode_cycle(void);
void matrix_scan_music(void);
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 36e586d31..b76a11418 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -30,6 +30,25 @@ extern backlight_config_t backlight_config;
#include "fauxclicky.h"
#endif
+#ifdef AUDIO_ENABLE
+ #ifndef GOODBYE_SONG
+ #define GOODBYE_SONG SONG(GOODBYE_SOUND)
+ #endif
+ #ifndef AG_NORM_SONG
+ #define AG_NORM_SONG SONG(AG_NORM_SOUND)
+ #endif
+ #ifndef AG_SWAP_SONG
+ #define AG_SWAP_SONG SONG(AG_SWAP_SOUND)
+ #endif
+ #ifndef DEFAULT_LAYER_SONGS
+ #define DEFAULT_LAYER_SONGS { }
+ #endif
+ float goodbye_song[][2] = GOODBYE_SONG;
+ float ag_norm_song[][2] = AG_NORM_SONG;
+ float ag_swap_song[][2] = AG_SWAP_SONG;
+ float default_layer_songs[][16][2] = DEFAULT_LAYER_SONGS;
+#endif
+
static void do_code16 (uint16_t code, void (*f) (uint8_t)) {
switch (code) {
case QK_MODS ... QK_MODS_MAX:
@@ -116,9 +135,15 @@ void reset_keyboard(void) {
clear_keyboard();
#if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_ENABLE_BASIC))
music_all_notes_off();
+ uint16_t timer_start = timer_read();
+ PLAY_SONG(goodbye_song);
shutdown_user();
-#endif
+ while(timer_elapsed(timer_start) < 250)
+ wait_ms(1);
+ stop_all_notes();
+#else
wait_ms(250);
+#endif
#ifdef CATERINA_BOOTLOADER
*(uint16_t *)0x0800 = 0x7777; // these two are a-star-specific
#endif
@@ -351,6 +376,9 @@ bool process_record_quantum(keyrecord_t *record) {
case MAGIC_SWAP_ALT_GUI:
keymap_config.swap_lalt_lgui = true;
keymap_config.swap_ralt_rgui = true;
+ #ifdef AUDIO_ENABLE
+ PLAY_SONG(ag_swap_song);
+ #endif
break;
case MAGIC_UNSWAP_CONTROL_CAPSLOCK:
keymap_config.swap_control_capslock = false;
@@ -379,6 +407,9 @@ bool process_record_quantum(keyrecord_t *record) {
case MAGIC_UNSWAP_ALT_GUI:
keymap_config.swap_lalt_lgui = false;
keymap_config.swap_ralt_rgui = false;
+ #ifdef AUDIO_ENABLE
+ PLAY_SONG(ag_norm_song);
+ #endif
break;
case MAGIC_TOGGLE_NKRO:
keymap_config.nkro = !keymap_config.nkro;
@@ -521,6 +552,14 @@ void send_string_with_delay(const char *str, uint8_t interval) {
}
}
+void set_single_persistent_default_layer(uint8_t default_layer) {
+ #ifdef AUDIO_ENABLE
+ PLAY_SONG(default_layer_songs[default_layer]);
+ #endif
+ eeconfig_update_default_layer(1U<