summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2018-05-09 03:46:29 +0200
committerskullydazed <skullydazed@users.noreply.github.com>2018-09-25 22:28:36 +0200
commite72e4b6920299176a322a2862f930b7ee5f73dff (patch)
tree1bd34f2b6fe46d08589699d5b47c984fc66d26f7 /quantum
parentb7e25f9ec4203670f2434e82608554ba284cf1f3 (diff)
downloadqmk_firmware-e72e4b6920299176a322a2862f930b7ee5f73dff.tar.gz
qmk_firmware-e72e4b6920299176a322a2862f930b7ee5f73dff.tar.xz
Store Clicky status in EEPROM
Diffstat (limited to 'quantum')
-rw-r--r--quantum/audio/audio.c8
-rw-r--r--quantum/process_keycode/process_clicky.c14
2 files changed, 11 insertions, 11 deletions
diff --git a/quantum/audio/audio.c b/quantum/audio/audio.c
index c948a60d6..6d6833ec1 100644
--- a/quantum/audio/audio.c
+++ b/quantum/audio/audio.c
@@ -223,7 +223,7 @@ void audio_init()
TCCR1B = (1 << WGM13) | (1 << WGM12) | (0 << CS12) | (1 << CS11) | (0 << CS10);
TIMER_1_PERIOD = (uint16_t)(((float)F_CPU) / (440 * CPU_PRESCALER));
TIMER_1_DUTY_CYCLE = (uint16_t)((((float)F_CPU) / (440 * CPU_PRESCALER)) * note_timbre);
- #endif
+ #endif
audio_initialized = true;
}
@@ -231,7 +231,7 @@ void audio_init()
if (audio_config.enable) {
PLAY_SONG(startup_song);
}
-
+
}
void stop_all_notes()
@@ -464,7 +464,7 @@ ISR(TIMER3_AUDIO_vect)
note_position++;
bool end_of_note = false;
if (TIMER_3_PERIOD > 0) {
- if (!note_resting)
+ if (!note_resting)
end_of_note = (note_position >= (note_length / TIMER_3_PERIOD * 0xFFFF - 1));
else
end_of_note = (note_position >= (note_length));
@@ -604,7 +604,7 @@ ISR(TIMER1_AUDIO_vect)
note_position++;
bool end_of_note = false;
if (TIMER_1_PERIOD > 0) {
- if (!note_resting)
+ if (!note_resting)
end_of_note = (note_position >= (note_length / TIMER_1_PERIOD * 0xFFFF - 1));
else
end_of_note = (note_position >= (note_length));
diff --git a/quantum/process_keycode/process_clicky.c b/quantum/process_keycode/process_clicky.c
index 1e950d111..bd2f1b3b3 100644
--- a/quantum/process_keycode/process_clicky.c
+++ b/quantum/process_keycode/process_clicky.c
@@ -3,11 +3,6 @@
#ifdef AUDIO_CLICKY
-#ifdef AUDIO_CLICKY_ON
-bool clicky_enable = true;
-#else // AUDIO_CLICKY_ON
-bool clicky_enable = false;
-#endif // AUDIO_CLICKY_ON
#ifndef AUDIO_CLICKY_FREQ_DEFAULT
#define AUDIO_CLICKY_FREQ_DEFAULT 440.0f
#endif // !AUDIO_CLICKY_FREQ_DEFAULT
@@ -27,6 +22,8 @@ bool clicky_enable = false;
float clicky_freq = AUDIO_CLICKY_FREQ_DEFAULT;
float clicky_song[][2] = {{AUDIO_CLICKY_FREQ_DEFAULT, 3}, {AUDIO_CLICKY_FREQ_DEFAULT, 1}}; // 3 and 1 --> durations
+extern audio_config_t audio_config;
+
#ifndef NO_MUSIC_MODE
extern bool music_activated;
extern bool midi_activated;
@@ -42,7 +39,10 @@ void clicky_play(void) {
}
bool process_clicky(uint16_t keycode, keyrecord_t *record) {
- if (keycode == CLICKY_TOGGLE && record->event.pressed) { clicky_enable = !clicky_enable; }
+ if (keycode == CLICKY_TOGGLE && record->event.pressed) {
+ audio_config.clicky ^= 1;
+ eeconfig_update_audio(audio_config.raw);
+ }
if (keycode == CLICKY_RESET && record->event.pressed) { clicky_freq = AUDIO_CLICKY_FREQ_DEFAULT; }
@@ -60,7 +60,7 @@ bool process_clicky(uint16_t keycode, keyrecord_t *record) {
}
- if ( clicky_enable ) {
+ if ( audio_config.clicky ) {
if (record->event.pressed) {
clicky_play();;
}