diff options
Diffstat (limited to 'quantum')
| -rw-r--r-- | quantum/audio.c | 146 | ||||
| -rw-r--r-- | quantum/audio.h | 18 | ||||
| -rw-r--r-- | quantum/keymap_common.c | 258 | ||||
| -rw-r--r-- | quantum/keymap_common.h | 32 | ||||
| -rw-r--r-- | quantum/musical_notes.h | 182 | ||||
| -rw-r--r-- | quantum/quantum.mk | 1 | ||||
| -rw-r--r-- | quantum/tools/README.md | 6 | ||||
| -rw-r--r-- | quantum/tools/eeprom_reset.hex | 9 |
8 files changed, 489 insertions, 163 deletions
diff --git a/quantum/audio.c b/quantum/audio.c index 50e5505fe..5edcccdbe 100644 --- a/quantum/audio.c +++ b/quantum/audio.c | |||
| @@ -8,6 +8,8 @@ | |||
| 8 | #include "audio.h" | 8 | #include "audio.h" |
| 9 | #include "keymap_common.h" | 9 | #include "keymap_common.h" |
| 10 | 10 | ||
| 11 | #include "eeconfig.h" | ||
| 12 | |||
| 11 | #define PI 3.14159265 | 13 | #define PI 3.14159265 |
| 12 | 14 | ||
| 13 | // #define PWM_AUDIO | 15 | // #define PWM_AUDIO |
| @@ -30,6 +32,8 @@ int voice_place = 0; | |||
| 30 | double frequency = 0; | 32 | double frequency = 0; |
| 31 | int volume = 0; | 33 | int volume = 0; |
| 32 | long position = 0; | 34 | long position = 0; |
| 35 | int duty_place = 1; | ||
| 36 | int duty_counter = 0; | ||
| 33 | 37 | ||
| 34 | double frequencies[8] = {0, 0, 0, 0, 0, 0, 0, 0}; | 38 | double frequencies[8] = {0, 0, 0, 0, 0, 0, 0, 0}; |
| 35 | int volumes[8] = {0, 0, 0, 0, 0, 0, 0, 0}; | 39 | int volumes[8] = {0, 0, 0, 0, 0, 0, 0, 0}; |
| @@ -57,6 +61,25 @@ uint8_t notes_length; | |||
| 57 | bool notes_repeat; | 61 | bool notes_repeat; |
| 58 | uint8_t current_note = 0; | 62 | uint8_t current_note = 0; |
| 59 | 63 | ||
| 64 | audio_config_t audio_config; | ||
| 65 | |||
| 66 | |||
| 67 | void audio_toggle(void) { | ||
| 68 | audio_config.enable ^= 1; | ||
| 69 | eeconfig_write_audio(audio_config.raw); | ||
| 70 | } | ||
| 71 | |||
| 72 | void audio_on(void) { | ||
| 73 | audio_config.enable = 1; | ||
| 74 | eeconfig_write_audio(audio_config.raw); | ||
| 75 | } | ||
| 76 | |||
| 77 | void audio_off(void) { | ||
| 78 | audio_config.enable = 0; | ||
| 79 | eeconfig_write_audio(audio_config.raw); | ||
| 80 | } | ||
| 81 | |||
| 82 | |||
| 60 | void stop_all_notes() { | 83 | void stop_all_notes() { |
| 61 | voices = 0; | 84 | voices = 0; |
| 62 | #ifdef PWM_AUDIO | 85 | #ifdef PWM_AUDIO |
| @@ -77,58 +100,66 @@ void stop_all_notes() { | |||
| 77 | } | 100 | } |
| 78 | 101 | ||
| 79 | void stop_note(double freq) { | 102 | void stop_note(double freq) { |
| 80 | #ifdef PWM_AUDIO | 103 | if (note) { |
| 81 | freq = freq / SAMPLE_RATE; | ||
| 82 | #endif | ||
| 83 | for (int i = 7; i >= 0; i--) { | ||
| 84 | if (frequencies[i] == freq) { | ||
| 85 | frequencies[i] = 0; | ||
| 86 | volumes[i] = 0; | ||
| 87 | for (int j = i; (j < 7); j++) { | ||
| 88 | frequencies[j] = frequencies[j+1]; | ||
| 89 | frequencies[j+1] = 0; | ||
| 90 | volumes[j] = volumes[j+1]; | ||
| 91 | volumes[j+1] = 0; | ||
| 92 | } | ||
| 93 | } | ||
| 94 | } | ||
| 95 | voices--; | ||
| 96 | if (voices < 0) | ||
| 97 | voices = 0; | ||
| 98 | if (voices == 0) { | ||
| 99 | #ifdef PWM_AUDIO | 104 | #ifdef PWM_AUDIO |
| 100 | TIMSK3 &= ~_BV(OCIE3A); | 105 | freq = freq / SAMPLE_RATE; |
| 101 | #else | ||
| 102 | TIMSK3 &= ~_BV(OCIE3A); | ||
| 103 | TCCR3A &= ~_BV(COM3A1); | ||
| 104 | #endif | 106 | #endif |
| 105 | frequency = 0; | 107 | for (int i = 7; i >= 0; i--) { |
| 106 | volume = 0; | 108 | if (frequencies[i] == freq) { |
| 107 | note = false; | 109 | frequencies[i] = 0; |
| 108 | } else { | 110 | volumes[i] = 0; |
| 109 | double freq = frequencies[voices - 1]; | 111 | for (int j = i; (j < 7); j++) { |
| 110 | int vol = volumes[voices - 1]; | 112 | frequencies[j] = frequencies[j+1]; |
| 111 | double starting_f = frequency; | 113 | frequencies[j+1] = 0; |
| 112 | if (frequency < freq) { | 114 | volumes[j] = volumes[j+1]; |
| 113 | sliding = true; | 115 | volumes[j+1] = 0; |
| 114 | for (double f = starting_f; f <= freq; f += ((freq - starting_f) / 2000.0)) { | 116 | } |
| 115 | frequency = f; | ||
| 116 | } | 117 | } |
| 117 | sliding = false; | 118 | } |
| 118 | } else if (frequency > freq) { | 119 | voices--; |
| 119 | sliding = true; | 120 | if (voices < 0) |
| 120 | for (double f = starting_f; f >= freq; f -= ((starting_f - freq) / 2000.0)) { | 121 | voices = 0; |
| 121 | frequency = f; | 122 | if (voices == 0) { |
| 123 | #ifdef PWM_AUDIO | ||
| 124 | TIMSK3 &= ~_BV(OCIE3A); | ||
| 125 | #else | ||
| 126 | TIMSK3 &= ~_BV(OCIE3A); | ||
| 127 | TCCR3A &= ~_BV(COM3A1); | ||
| 128 | #endif | ||
| 129 | frequency = 0; | ||
| 130 | volume = 0; | ||
| 131 | note = false; | ||
| 132 | } else { | ||
| 133 | double freq = frequencies[voices - 1]; | ||
| 134 | int vol = volumes[voices - 1]; | ||
| 135 | double starting_f = frequency; | ||
| 136 | if (frequency < freq) { | ||
| 137 | sliding = true; | ||
| 138 | for (double f = starting_f; f <= freq; f += ((freq - starting_f) / 2000.0)) { | ||
| 139 | frequency = f; | ||
| 140 | } | ||
| 141 | sliding = false; | ||
| 142 | } else if (frequency > freq) { | ||
| 143 | sliding = true; | ||
| 144 | for (double f = starting_f; f >= freq; f -= ((starting_f - freq) / 2000.0)) { | ||
| 145 | frequency = f; | ||
| 146 | } | ||
| 147 | sliding = false; | ||
| 122 | } | 148 | } |
| 123 | sliding = false; | 149 | frequency = freq; |
| 150 | volume = vol; | ||
| 124 | } | 151 | } |
| 125 | frequency = freq; | ||
| 126 | volume = vol; | ||
| 127 | } | 152 | } |
| 128 | } | 153 | } |
| 129 | 154 | ||
| 130 | void init_notes() { | 155 | void init_notes() { |
| 131 | 156 | ||
| 157 | /* check signature */ | ||
| 158 | if (!eeconfig_is_enabled()) { | ||
| 159 | eeconfig_init(); | ||
| 160 | } | ||
| 161 | audio_config.raw = eeconfig_read_audio(); | ||
| 162 | |||
| 132 | #ifdef PWM_AUDIO | 163 | #ifdef PWM_AUDIO |
| 133 | PLLFRQ = _BV(PDIV2); | 164 | PLLFRQ = _BV(PDIV2); |
| 134 | PLLCSR = _BV(PLLE); | 165 | PLLCSR = _BV(PLLE); |
| @@ -160,7 +191,6 @@ void init_notes() { | |||
| 160 | 191 | ||
| 161 | 192 | ||
| 162 | ISR(TIMER3_COMPA_vect) { | 193 | ISR(TIMER3_COMPA_vect) { |
| 163 | |||
| 164 | if (note) { | 194 | if (note) { |
| 165 | #ifdef PWM_AUDIO | 195 | #ifdef PWM_AUDIO |
| 166 | if (voices == 1) { | 196 | if (voices == 1) { |
| @@ -213,13 +243,19 @@ ISR(TIMER3_COMPA_vect) { | |||
| 213 | if (frequency > 0) { | 243 | if (frequency > 0) { |
| 214 | // ICR3 = (int)(((double)F_CPU) / frequency); // Set max to the period | 244 | // ICR3 = (int)(((double)F_CPU) / frequency); // Set max to the period |
| 215 | // OCR3A = (int)(((double)F_CPU) / frequency) >> 1; // Set compare to half the period | 245 | // OCR3A = (int)(((double)F_CPU) / frequency) >> 1; // Set compare to half the period |
| 216 | if (place > 10) { | 246 | voice_place %= voices; |
| 247 | if (place > (frequencies[voice_place] / 500)) { | ||
| 217 | voice_place = (voice_place + 1) % voices; | 248 | voice_place = (voice_place + 1) % voices; |
| 218 | place = 0.0; | 249 | place = 0.0; |
| 219 | } | 250 | } |
| 220 | ICR3 = (int)(((double)F_CPU) / frequencies[voice_place]); // Set max to the period | 251 | ICR3 = (int)(((double)F_CPU) / frequencies[voice_place]); // Set max to the period |
| 221 | OCR3A = (int)(((double)F_CPU) / frequencies[voice_place]) >> 1; // Set compare to half the period | 252 | OCR3A = (int)(((double)F_CPU) / frequencies[voice_place]) >> 1 * duty_place; // Set compare to half the period |
| 222 | place++; | 253 | place++; |
| 254 | // if (duty_counter > (frequencies[voice_place] / 500)) { | ||
| 255 | // duty_place = (duty_place % 3) + 1; | ||
| 256 | // duty_counter = 0; | ||
| 257 | // } | ||
| 258 | // duty_counter++; | ||
| 223 | } | 259 | } |
| 224 | #endif | 260 | #endif |
| 225 | } | 261 | } |
| @@ -288,9 +324,16 @@ ISR(TIMER3_COMPA_vect) { | |||
| 288 | 324 | ||
| 289 | } | 325 | } |
| 290 | 326 | ||
| 327 | if (!audio_config.enable) { | ||
| 328 | notes = false; | ||
| 329 | note = false; | ||
| 330 | } | ||
| 291 | } | 331 | } |
| 292 | 332 | ||
| 293 | void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat) { | 333 | void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat) { |
| 334 | |||
| 335 | if (audio_config.enable) { | ||
| 336 | |||
| 294 | if (note) | 337 | if (note) |
| 295 | stop_all_notes(); | 338 | stop_all_notes(); |
| 296 | notes = true; | 339 | notes = true; |
| @@ -319,7 +362,12 @@ void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat) { | |||
| 319 | #endif | 362 | #endif |
| 320 | } | 363 | } |
| 321 | 364 | ||
| 365 | } | ||
| 366 | |||
| 322 | void play_sample(uint8_t * s, uint16_t l, bool r) { | 367 | void play_sample(uint8_t * s, uint16_t l, bool r) { |
| 368 | |||
| 369 | if (audio_config.enable) { | ||
| 370 | |||
| 323 | stop_all_notes(); | 371 | stop_all_notes(); |
| 324 | place_int = 0; | 372 | place_int = 0; |
| 325 | sample = s; | 373 | sample = s; |
| @@ -330,9 +378,15 @@ void play_sample(uint8_t * s, uint16_t l, bool r) { | |||
| 330 | TIMSK3 |= _BV(OCIE3A); | 378 | TIMSK3 |= _BV(OCIE3A); |
| 331 | #else | 379 | #else |
| 332 | #endif | 380 | #endif |
| 381 | |||
| 382 | } | ||
| 383 | |||
| 333 | } | 384 | } |
| 334 | 385 | ||
| 335 | void play_note(double freq, int vol) { | 386 | void play_note(double freq, int vol) { |
| 387 | |||
| 388 | if (audio_config.enable && voices < 8) { | ||
| 389 | |||
| 336 | if (notes) | 390 | if (notes) |
| 337 | stop_all_notes(); | 391 | stop_all_notes(); |
| 338 | note = true; | 392 | note = true; |
| @@ -367,4 +421,6 @@ void play_note(double freq, int vol) { | |||
| 367 | TCCR3A |= _BV(COM3A1); | 421 | TCCR3A |= _BV(COM3A1); |
| 368 | #endif | 422 | #endif |
| 369 | 423 | ||
| 424 | } | ||
| 425 | |||
| 370 | } \ No newline at end of file | 426 | } \ No newline at end of file |
diff --git a/quantum/audio.h b/quantum/audio.h index 31f9a3579..58270015d 100644 --- a/quantum/audio.h +++ b/quantum/audio.h | |||
| @@ -3,9 +3,21 @@ | |||
| 3 | #include <avr/io.h> | 3 | #include <avr/io.h> |
| 4 | #include <util/delay.h> | 4 | #include <util/delay.h> |
| 5 | 5 | ||
| 6 | typedef union { | ||
| 7 | uint8_t raw; | ||
| 8 | struct { | ||
| 9 | bool enable :1; | ||
| 10 | uint8_t level :7; | ||
| 11 | }; | ||
| 12 | } audio_config_t; | ||
| 13 | |||
| 14 | void audio_toggle(void); | ||
| 15 | void audio_on(void); | ||
| 16 | void audio_off(void); | ||
| 17 | |||
| 6 | void play_sample(uint8_t * s, uint16_t l, bool r); | 18 | void play_sample(uint8_t * s, uint16_t l, bool r); |
| 7 | void play_note(double freq, int vol); | 19 | void play_note(double freq, int vol); |
| 8 | void stop_note(double freq); | 20 | void stop_note(double freq); |
| 9 | void stop_all_notes(void); | 21 | void stop_all_notes(); |
| 10 | void init_notes(void); | 22 | void init_notes(); |
| 11 | void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat); \ No newline at end of file | 23 | void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat); |
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index e3030a886..b91916685 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c | |||
| @@ -27,6 +27,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 27 | #include "keymap_midi.h" | 27 | #include "keymap_midi.h" |
| 28 | #include "bootloader.h" | 28 | #include "bootloader.h" |
| 29 | 29 | ||
| 30 | extern keymap_config_t keymap_config; | ||
| 31 | |||
| 30 | #include <stdio.h> | 32 | #include <stdio.h> |
| 31 | #include <inttypes.h> | 33 | #include <inttypes.h> |
| 32 | #ifdef AUDIO_ENABLE | 34 | #ifdef AUDIO_ENABLE |
| @@ -47,120 +49,9 @@ action_t action_for_key(uint8_t layer, keypos_t key) | |||
| 47 | // 16bit keycodes - important | 49 | // 16bit keycodes - important |
| 48 | uint16_t keycode = keymap_key_to_keycode(layer, key); | 50 | uint16_t keycode = keymap_key_to_keycode(layer, key); |
| 49 | 51 | ||
| 50 | if (keycode >= 0x0100 && keycode < 0x2000) { | ||
| 51 | // Has a modifier | ||
| 52 | action_t action; | ||
| 53 | // Split it up | ||
| 54 | action.code = ACTION_MODS_KEY(keycode >> 8, keycode & 0xFF); // adds modifier to key | ||
| 55 | return action; | ||
| 56 | } else if (keycode >= 0x2000 && keycode < 0x3000) { | ||
| 57 | // Is a shortcut for function layer, pull last 12bits | ||
| 58 | // This means we have 4,096 FN macros at our disposal | ||
| 59 | return keymap_func_to_action(keycode & 0xFFF); | ||
| 60 | } else if (keycode >= 0x3000 && keycode < 0x4000) { | ||
| 61 | // When the code starts with 3, it's an action macro. | ||
| 62 | action_t action; | ||
| 63 | action.code = ACTION_MACRO(keycode & 0xFF); | ||
| 64 | return action; | ||
| 65 | #ifdef BACKLIGHT_ENABLE | ||
| 66 | } else if (keycode >= BL_0 && keycode <= BL_15) { | ||
| 67 | action_t action; | ||
| 68 | action.code = ACTION_BACKLIGHT_LEVEL(keycode & 0x000F); | ||
| 69 | return action; | ||
| 70 | } else if (keycode == BL_DEC) { | ||
| 71 | action_t action; | ||
| 72 | action.code = ACTION_BACKLIGHT_DECREASE(); | ||
| 73 | return action; | ||
| 74 | } else if (keycode == BL_INC) { | ||
| 75 | action_t action; | ||
| 76 | action.code = ACTION_BACKLIGHT_INCREASE(); | ||
| 77 | return action; | ||
| 78 | } else if (keycode == BL_TOGG) { | ||
| 79 | action_t action; | ||
| 80 | action.code = ACTION_BACKLIGHT_TOGGLE(); | ||
| 81 | return action; | ||
| 82 | } else if (keycode == BL_STEP) { | ||
| 83 | action_t action; | ||
| 84 | action.code = ACTION_BACKLIGHT_STEP(); | ||
| 85 | return action; | ||
| 86 | #endif | ||
| 87 | } else if (keycode == RESET) { // RESET is 0x5000, which is why this is here | ||
| 88 | action_t action; | ||
| 89 | clear_keyboard(); | ||
| 90 | #ifdef AUDIO_ENABLE | ||
| 91 | play_notes(&goodbye, 3, false); | ||
| 92 | #endif | ||
| 93 | _delay_ms(250); | ||
| 94 | #ifdef ATREUS_ASTAR | ||
| 95 | *(uint16_t *)0x0800 = 0x7777; // these two are a-star-specific | ||
| 96 | #endif | ||
| 97 | bootloader_jump(); | ||
| 98 | return action; | ||
| 99 | } else if (keycode == DEBUG) { // DEBUG is 0x5001 | ||
| 100 | // TODO: Does this actually work? | ||
| 101 | action_t action; | ||
| 102 | print("\nDEBUG: enabled.\n"); | ||
| 103 | debug_enable = true; | ||
| 104 | return action; | ||
| 105 | } else if (keycode >= 0x5000 && keycode < 0x6000) { | ||
| 106 | // Layer movement shortcuts | ||
| 107 | // See .h to see constraints/usage | ||
| 108 | int type = (keycode >> 0x8) & 0xF; | ||
| 109 | if (type == 0x1) { | ||
| 110 | // Layer set "GOTO" | ||
| 111 | int when = (keycode >> 0x4) & 0x3; | ||
| 112 | int layer = keycode & 0xF; | ||
| 113 | action_t action; | ||
| 114 | action.code = ACTION_LAYER_SET(layer, when); | ||
| 115 | return action; | ||
| 116 | } else if (type == 0x2) { | ||
| 117 | // Momentary layer | ||
| 118 | int layer = keycode & 0xFF; | ||
| 119 | action_t action; | ||
| 120 | action.code = ACTION_LAYER_MOMENTARY(layer); | ||
| 121 | return action; | ||
| 122 | } else if (type == 0x3) { | ||
| 123 | // Set default layer | ||
| 124 | int layer = keycode & 0xFF; | ||
| 125 | action_t action; | ||
| 126 | action.code = ACTION_DEFAULT_LAYER_SET(layer); | ||
| 127 | return action; | ||
| 128 | } else if (type == 0x4) { | ||
| 129 | // Set default layer | ||
| 130 | int layer = keycode & 0xFF; | ||
| 131 | action_t action; | ||
| 132 | action.code = ACTION_LAYER_TOGGLE(layer); | ||
| 133 | return action; | ||
| 134 | } | ||
| 135 | #ifdef MIDI_ENABLE | ||
| 136 | } else if (keycode >= 0x6000 && keycode < 0x7000) { | ||
| 137 | action_t action; | ||
| 138 | action.code = ACTION_FUNCTION_OPT(keycode & 0xFF, (keycode & 0x0F00) >> 8); | ||
| 139 | return action; | ||
| 140 | #endif | ||
| 141 | } else if (keycode >= 0x7000 && keycode < 0x8000) { | ||
| 142 | action_t action; | ||
| 143 | action.code = ACTION_MODS_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF); | ||
| 144 | return action; | ||
| 145 | } else if (keycode >= 0x8000 && keycode < 0x9000) { | ||
| 146 | action_t action; | ||
| 147 | action.code = ACTION_LAYER_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF); | ||
| 148 | return action; | ||
| 149 | #ifdef UNICODE_ENABLE | ||
| 150 | } else if (keycode >= 0x8000000) { | ||
| 151 | action_t action; | ||
| 152 | uint16_t unicode = keycode & ~(0x8000); | ||
| 153 | action.code = ACTION_FUNCTION_OPT(unicode & 0xFF, (unicode & 0xFF00) >> 8); | ||
| 154 | return action; | ||
| 155 | #endif | ||
| 156 | } else { | ||
| 157 | |||
| 158 | } | ||
| 159 | |||
| 160 | switch (keycode) { | 52 | switch (keycode) { |
| 161 | case KC_FN0 ... KC_FN31: | 53 | case KC_FN0 ... KC_FN31: |
| 162 | return keymap_fn_to_action(keycode); | 54 | return keymap_fn_to_action(keycode); |
| 163 | #ifdef BOOTMAGIC_ENABLE | ||
| 164 | case KC_CAPSLOCK: | 55 | case KC_CAPSLOCK: |
| 165 | case KC_LOCKING_CAPS: | 56 | case KC_LOCKING_CAPS: |
| 166 | if (keymap_config.swap_control_capslock || keymap_config.capslock_to_control) { | 57 | if (keymap_config.swap_control_capslock || keymap_config.capslock_to_control) { |
| @@ -224,7 +115,6 @@ action_t action_for_key(uint8_t layer, keypos_t key) | |||
| 224 | return keycode_to_action(KC_BSLASH); | 115 | return keycode_to_action(KC_BSLASH); |
| 225 | } | 116 | } |
| 226 | return keycode_to_action(KC_BSPACE); | 117 | return keycode_to_action(KC_BSPACE); |
| 227 | #endif | ||
| 228 | default: | 118 | default: |
| 229 | return keycode_to_action(keycode); | 119 | return keycode_to_action(keycode); |
| 230 | } | 120 | } |
| @@ -265,6 +155,142 @@ static action_t keycode_to_action(uint16_t keycode) | |||
| 265 | case KC_TRNS: | 155 | case KC_TRNS: |
| 266 | action.code = ACTION_TRANSPARENT; | 156 | action.code = ACTION_TRANSPARENT; |
| 267 | break; | 157 | break; |
| 158 | case 0x0100 ... 0x1FFF: ; | ||
| 159 | // Has a modifier | ||
| 160 | // Split it up | ||
| 161 | action.code = ACTION_MODS_KEY(keycode >> 8, keycode & 0xFF); // adds modifier to key | ||
| 162 | break; | ||
| 163 | case 0x2000 ... 0x2FFF: | ||
| 164 | // Is a shortcut for function layer, pull last 12bits | ||
| 165 | // This means we have 4,096 FN macros at our disposal | ||
| 166 | return keymap_func_to_action(keycode & 0xFFF); | ||
| 167 | break; | ||
| 168 | case 0x3000 ... 0x3FFF: ; | ||
| 169 | // When the code starts with 3, it's an action macro. | ||
| 170 | action.code = ACTION_MACRO(keycode & 0xFF); | ||
| 171 | break; | ||
| 172 | #ifdef BACKLIGHT_ENABLE | ||
| 173 | case BL_0 ... BL_15: | ||
| 174 | action.code = ACTION_BACKLIGHT_LEVEL(keycode & 0x000F); | ||
| 175 | break; | ||
| 176 | case BL_DEC: | ||
| 177 | action.code = ACTION_BACKLIGHT_DECREASE(); | ||
| 178 | break; | ||
| 179 | case BL_INC: | ||
| 180 | action.code = ACTION_BACKLIGHT_INCREASE(); | ||
| 181 | break; | ||
| 182 | case BL_TOGG: | ||
| 183 | action.code = ACTION_BACKLIGHT_TOGGLE(); | ||
| 184 | break; | ||
| 185 | case BL_STEP: | ||
| 186 | action.code = ACTION_BACKLIGHT_STEP(); | ||
| 187 | break; | ||
| 188 | #endif | ||
| 189 | case RESET: ; // RESET is 0x5000, which is why this is here | ||
| 190 | clear_keyboard(); | ||
| 191 | #ifdef AUDIO_ENABLE | ||
| 192 | play_notes(&goodbye, 3, false); | ||
| 193 | #endif | ||
| 194 | _delay_ms(250); | ||
| 195 | #ifdef ATREUS_ASTAR | ||
| 196 | *(uint16_t *)0x0800 = 0x7777; // these two are a-star-specific | ||
| 197 | #endif | ||
| 198 | bootloader_jump(); | ||
| 199 | break; | ||
| 200 | case DEBUG: ; // DEBUG is 0x5001 | ||
| 201 | print("\nDEBUG: enabled.\n"); | ||
| 202 | debug_enable = true; | ||
| 203 | break; | ||
| 204 | case 0x5002 ... 0x50FF: | ||
| 205 | // MAGIC actions (BOOTMAGIC without the boot) | ||
| 206 | if (!eeconfig_is_enabled()) { | ||
| 207 | eeconfig_init(); | ||
| 208 | } | ||
| 209 | /* keymap config */ | ||
| 210 | keymap_config.raw = eeconfig_read_keymap(); | ||
| 211 | if (keycode == MAGIC_SWAP_CONTROL_CAPSLOCK) { | ||
| 212 | keymap_config.swap_control_capslock = 1; | ||
| 213 | } else if (keycode == MAGIC_CAPSLOCK_TO_CONTROL) { | ||
| 214 | keymap_config.capslock_to_control = 1; | ||
| 215 | } else if (keycode == MAGIC_SWAP_LALT_LGUI) { | ||
| 216 | keymap_config.swap_lalt_lgui = 1; | ||
| 217 | } else if (keycode == MAGIC_SWAP_RALT_RGUI) { | ||
| 218 | keymap_config.swap_ralt_rgui = 1; | ||
| 219 | } else if (keycode == MAGIC_NO_GUI) { | ||
| 220 | keymap_config.no_gui = 1; | ||
| 221 | } else if (keycode == MAGIC_SWAP_GRAVE_ESC) { | ||
| 222 | keymap_config.swap_grave_esc = 1; | ||
| 223 | } else if (keycode == MAGIC_SWAP_BACKSLASH_BACKSPACE) { | ||
| 224 | keymap_config.swap_backslash_backspace = 1; | ||
| 225 | } else if (keycode == MAGIC_HOST_NKRO) { | ||
| 226 | keymap_config.nkro = 1; | ||
| 227 | } else if (keycode == MAGIC_SWAP_ALT_GUI) { | ||
| 228 | keymap_config.swap_lalt_lgui = 1; | ||
| 229 | keymap_config.swap_ralt_rgui = 1; | ||
| 230 | } | ||
| 231 | /* UNs */ | ||
| 232 | else if (keycode == MAGIC_UNSWAP_CONTROL_CAPSLOCK) { | ||
| 233 | keymap_config.swap_control_capslock = 0; | ||
| 234 | } else if (keycode == MAGIC_UNCAPSLOCK_TO_CONTROL) { | ||
| 235 | keymap_config.capslock_to_control = 0; | ||
| 236 | } else if (keycode == MAGIC_UNSWAP_LALT_LGUI) { | ||
| 237 | keymap_config.swap_lalt_lgui = 0; | ||
| 238 | } else if (keycode == MAGIC_UNSWAP_RALT_RGUI) { | ||
| 239 | keymap_config.swap_ralt_rgui = 0; | ||
| 240 | } else if (keycode == MAGIC_UNNO_GUI) { | ||
| 241 | keymap_config.no_gui = 0; | ||
| 242 | } else if (keycode == MAGIC_UNSWAP_GRAVE_ESC) { | ||
| 243 | keymap_config.swap_grave_esc = 0; | ||
| 244 | } else if (keycode == MAGIC_UNSWAP_BACKSLASH_BACKSPACE) { | ||
| 245 | keymap_config.swap_backslash_backspace = 0; | ||
| 246 | } else if (keycode == MAGIC_UNHOST_NKRO) { | ||
| 247 | keymap_config.nkro = 0; | ||
| 248 | } else if (keycode == MAGIC_UNSWAP_ALT_GUI) { | ||
| 249 | keymap_config.swap_lalt_lgui = 0; | ||
| 250 | keymap_config.swap_ralt_rgui = 0; | ||
| 251 | } | ||
| 252 | eeconfig_write_keymap(keymap_config.raw); | ||
| 253 | break; | ||
| 254 | case 0x5100 ... 0x5FFF: ; | ||
| 255 | // Layer movement shortcuts | ||
| 256 | // See .h to see constraints/usage | ||
| 257 | int type = (keycode >> 0x8) & 0xF; | ||
| 258 | if (type == 0x1) { | ||
| 259 | // Layer set "GOTO" | ||
| 260 | int when = (keycode >> 0x4) & 0x3; | ||
| 261 | int layer = keycode & 0xF; | ||
| 262 | action.code = ACTION_LAYER_SET(layer, when); | ||
| 263 | } else if (type == 0x2) { | ||
| 264 | // Momentary layer | ||
| 265 | int layer = keycode & 0xFF; | ||
| 266 | action.code = ACTION_LAYER_MOMENTARY(layer); | ||
| 267 | } else if (type == 0x3) { | ||
| 268 | // Set default layer | ||
| 269 | int layer = keycode & 0xFF; | ||
| 270 | action.code = ACTION_DEFAULT_LAYER_SET(layer); | ||
| 271 | } else if (type == 0x4) { | ||
| 272 | // Set default layer | ||
| 273 | int layer = keycode & 0xFF; | ||
| 274 | action.code = ACTION_LAYER_TOGGLE(layer); | ||
| 275 | } | ||
| 276 | break; | ||
| 277 | #ifdef MIDI_ENABLE | ||
| 278 | case 0x6000 ... 0x6FFF: | ||
| 279 | action.code = ACTION_FUNCTION_OPT(keycode & 0xFF, (keycode & 0x0F00) >> 8); | ||
| 280 | break; | ||
| 281 | #endif | ||
| 282 | case 0x7000 ... 0x7FFF: | ||
| 283 | action.code = ACTION_MODS_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF); | ||
| 284 | break; | ||
| 285 | case 0x8000 ... 0x8FFF: | ||
| 286 | action.code = ACTION_LAYER_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF); | ||
| 287 | break; | ||
| 288 | #ifdef UNICODE_ENABLE | ||
| 289 | case 0x8000000 ... 0x8FFFFFF: | ||
| 290 | uint16_t unicode = keycode & ~(0x8000); | ||
| 291 | action.code = ACTION_FUNCTION_OPT(unicode & 0xFF, (unicode & 0xFF00) >> 8); | ||
| 292 | break; | ||
| 293 | #endif | ||
| 268 | default: | 294 | default: |
| 269 | action.code = ACTION_NO; | 295 | action.code = ACTION_NO; |
| 270 | break; | 296 | break; |
| @@ -291,3 +317,11 @@ action_t keymap_func_to_action(uint16_t keycode) | |||
| 291 | // For FUNC without 8bit limit | 317 | // For FUNC without 8bit limit |
| 292 | return (action_t){ .code = pgm_read_word(&fn_actions[(int)keycode]) }; | 318 | return (action_t){ .code = pgm_read_word(&fn_actions[(int)keycode]) }; |
| 293 | } | 319 | } |
| 320 | |||
| 321 | void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) { | ||
| 322 | if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { | ||
| 323 | layer_on(layer3); | ||
| 324 | } else { | ||
| 325 | layer_off(layer3); | ||
| 326 | } | ||
| 327 | } | ||
diff --git a/quantum/keymap_common.h b/quantum/keymap_common.h index 4a877d2a7..ce87e4770 100644 --- a/quantum/keymap_common.h +++ b/quantum/keymap_common.h | |||
| @@ -30,7 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 30 | // #include "print.h" | 30 | // #include "print.h" |
| 31 | #include "debug.h" | 31 | #include "debug.h" |
| 32 | 32 | ||
| 33 | #ifdef BOOTMAGIC_ENABLE | ||
| 34 | /* NOTE: Not portable. Bit field order depends on implementation */ | 33 | /* NOTE: Not portable. Bit field order depends on implementation */ |
| 35 | typedef union { | 34 | typedef union { |
| 36 | uint16_t raw; | 35 | uint16_t raw; |
| @@ -45,8 +44,6 @@ typedef union { | |||
| 45 | bool nkro:1; | 44 | bool nkro:1; |
| 46 | }; | 45 | }; |
| 47 | } keymap_config_t; | 46 | } keymap_config_t; |
| 48 | keymap_config_t keymap_config; | ||
| 49 | #endif | ||
| 50 | 47 | ||
| 51 | 48 | ||
| 52 | /* translates key to keycode */ | 49 | /* translates key to keycode */ |
| @@ -168,6 +165,30 @@ extern const uint16_t fn_actions[]; | |||
| 168 | #define RESET 0x5000 | 165 | #define RESET 0x5000 |
| 169 | #define DEBUG 0x5001 | 166 | #define DEBUG 0x5001 |
| 170 | 167 | ||
| 168 | // MAGIC keycodes | ||
| 169 | #define MAGIC_SWAP_CONTROL_CAPSLOCK 0x5002 | ||
| 170 | #define MAGIC_UNSWAP_CONTROL_CAPSLOCK 0x5003 | ||
| 171 | #define MAGIC_CAPSLOCK_TO_CONTROL 0x5004 | ||
| 172 | #define MAGIC_UNCAPSLOCK_TO_CONTROL 0x5005 | ||
| 173 | #define MAGIC_SWAP_LALT_LGUI 0x5006 | ||
| 174 | #define MAGIC_UNSWAP_LALT_LGUI 0x5007 | ||
| 175 | #define MAGIC_SWAP_RALT_RGUI 0x5008 | ||
| 176 | #define MAGIC_UNSWAP_RALT_RGUI 0x5009 | ||
| 177 | #define MAGIC_NO_GUI 0x500a | ||
| 178 | #define MAGIC_UNNO_GUI 0x500b | ||
| 179 | #define MAGIC_SWAP_GRAVE_ESC 0x500c | ||
| 180 | #define MAGIC_UNSWAP_GRAVE_ESC 0x500d | ||
| 181 | #define MAGIC_SWAP_BACKSLASH_BACKSPACE 0x500e | ||
| 182 | #define MAGIC_UNSWAP_BACKSLASH_BACKSPACE 0x500f | ||
| 183 | #define MAGIC_HOST_NKRO 0x5010 | ||
| 184 | #define MAGIC_UNHOST_NKRO 0x5011 | ||
| 185 | #define MAGIC_SWAP_ALT_GUI 0x5012 | ||
| 186 | #define MAGIC_UNSWAP_ALT_GUI 0x5013 | ||
| 187 | |||
| 188 | #define AG_SWAP MAGIC_SWAP_ALT_GUI | ||
| 189 | #define AG_NORM MAGIC_UNSWAP_ALT_GUI | ||
| 190 | |||
| 191 | |||
| 171 | // GOTO layer - 16 layers max | 192 | // GOTO layer - 16 layers max |
| 172 | // when: | 193 | // when: |
| 173 | // ON_PRESS = 1 | 194 | // ON_PRESS = 1 |
| @@ -208,5 +229,10 @@ extern const uint16_t fn_actions[]; | |||
| 208 | #define UNICODE(n) (n | 0x8000) | 229 | #define UNICODE(n) (n | 0x8000) |
| 209 | #define UC(n) UNICODE(n) | 230 | #define UC(n) UNICODE(n) |
| 210 | 231 | ||
| 232 | // For tri-layer | ||
| 233 | void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3); | ||
| 234 | #define IS_LAYER_ON(layer) ((layer_state) & (1UL<<(layer))) | ||
| 235 | #define IS_LAYER_OFF(layer) ((!layer_state) & (1UL<<(layer))) | ||
| 236 | |||
| 211 | 237 | ||
| 212 | #endif | 238 | #endif |
diff --git a/quantum/musical_notes.h b/quantum/musical_notes.h new file mode 100644 index 000000000..79f04fd98 --- /dev/null +++ b/quantum/musical_notes.h | |||
| @@ -0,0 +1,182 @@ | |||
| 1 | #ifndef MUSICAL_NOTES_H | ||
| 2 | #define MUSICAL_NOTES_H | ||
| 3 | |||
| 4 | // Tempo Placeholder | ||
| 5 | #define TEMPO 120 | ||
| 6 | |||
| 7 | |||
| 8 | // Note Types | ||
| 9 | #define WHOLE_NOTE(note) {(NOTE##note), 64} | ||
| 10 | #define HALF_NOTE(note) {(NOTE##note), 32} | ||
| 11 | #define QUARTER_NOTE(note) {(NOTE##note), 16} | ||
| 12 | #define EIGTH_NOTE(note) {(NOTE##note), 8} | ||
| 13 | #define SIXTEENTH_NOTE(note) {(NOTE##note), 4} | ||
| 14 | |||
| 15 | // Note Types Short | ||
| 16 | #define W_NOTE(n) WHOLE_NOTE(n) | ||
| 17 | #define H_NOTE(n) HALF_NOTE(n) | ||
| 18 | #define Q_NOTE(n) QUARTER_NOTE(n) | ||
| 19 | #define E_NOTE(n) EIGTH_NOTE(n) | ||
| 20 | #define S_NOTE(n) SIXTEENTH_NOTE(n) | ||
| 21 | |||
| 22 | |||
| 23 | // Notes - # = Octave | ||
| 24 | #define NOTE_REST 0.00 | ||
| 25 | #define NOTE_C0 16.35 | ||
| 26 | #define NOTE_CS0 17.32 | ||
| 27 | #define NOTE_D0 18.35 | ||
| 28 | #define NOTE_DS0 19.45 | ||
| 29 | #define NOTE_E0 20.60 | ||
| 30 | #define NOTE_F0 21.83 | ||
| 31 | #define NOTE_FS0 23.12 | ||
| 32 | #define NOTE_G0 24.50 | ||
| 33 | #define NOTE_GS0 25.96 | ||
| 34 | #define NOTE_A0 27.50 | ||
| 35 | #define NOTE_AS0 29.14 | ||
| 36 | #define NOTE_B0 30.87 | ||
| 37 | #define NOTE_C1 32.70 | ||
| 38 | #define NOTE_CS1 34.65 | ||
| 39 | #define NOTE_D1 36.71 | ||
| 40 | #define NOTE_DS1 38.89 | ||
| 41 | #define NOTE_E1 41.20 | ||
| 42 | #define NOTE_F1 43.65 | ||
| 43 | #define NOTE_FS1 46.25 | ||
| 44 | #define NOTE_G1 49.00 | ||
| 45 | #define NOTE_GS1 51.91 | ||
| 46 | #define NOTE_A1 55.00 | ||
| 47 | #define NOTE_AS1 58.27 | ||
| 48 | #define NOTE_B1 61.74 | ||
| 49 | #define NOTE_C2 65.41 | ||
| 50 | #define NOTE_CS2 69.30 | ||
| 51 | #define NOTE_D2 73.42 | ||
| 52 | #define NOTE_DS2 77.78 | ||
| 53 | #define NOTE_E2 82.41 | ||
| 54 | #define NOTE_F2 87.31 | ||
| 55 | #define NOTE_FS2 92.50 | ||
| 56 | #define NOTE_G2 98.00 | ||
| 57 | #define NOTE_GS2 103.83 | ||
| 58 | #define NOTE_A2 110.00 | ||
| 59 | #define NOTE_AS2 116.54 | ||
| 60 | #define NOTE_B2 123.47 | ||
| 61 | #define NOTE_C3 130.81 | ||
| 62 | #define NOTE_CS3 138.59 | ||
| 63 | #define NOTE_D3 146.83 | ||
| 64 | #define NOTE_DS3 155.56 | ||
| 65 | #define NOTE_E3 164.81 | ||
| 66 | #define NOTE_F3 174.61 | ||
| 67 | #define NOTE_FS3 185.00 | ||
| 68 | #define NOTE_G3 196.00 | ||
| 69 | #define NOTE_GS3 207.65 | ||
| 70 | #define NOTE_A3 220.00 | ||
| 71 | #define NOTE_AS3 233.08 | ||
| 72 | #define NOTE_B3 246.94 | ||
| 73 | #define NOTE_C4 261.63 | ||
| 74 | #define NOTE_CS4 277.18 | ||
| 75 | #define NOTE_D4 293.66 | ||
| 76 | #define NOTE_DS4 311.13 | ||
| 77 | #define NOTE_E4 329.63 | ||
| 78 | #define NOTE_F4 349.23 | ||
| 79 | #define NOTE_FS4 369.99 | ||
| 80 | #define NOTE_G4 392.00 | ||
| 81 | #define NOTE_GS4 415.30 | ||
| 82 | #define NOTE_A4 440.00 | ||
| 83 | #define NOTE_AS4 466.16 | ||
| 84 | #define NOTE_B4 493.88 | ||
| 85 | #define NOTE_C5 523.25 | ||
| 86 | #define NOTE_CS5 554.37 | ||
| 87 | #define NOTE_D5 587.33 | ||
| 88 | #define NOTE_DS5 622.25 | ||
| 89 | #define NOTE_E5 659.26 | ||
| 90 | #define NOTE_F5 698.46 | ||
| 91 | #define NOTE_FS5 739.99 | ||
| 92 | #define NOTE_G5 783.99 | ||
| 93 | #define NOTE_GS5 830.61 | ||
| 94 | #define NOTE_A5 880.00 | ||
| 95 | #define NOTE_AS5 932.33 | ||
| 96 | #define NOTE_B5 987.77 | ||
| 97 | #define NOTE_C6 1046.50 | ||
| 98 | #define NOTE_CS6 1108.73 | ||
| 99 | #define NOTE_D6 1174.66 | ||
| 100 | #define NOTE_DS6 1244.51 | ||
| 101 | #define NOTE_E6 1318.51 | ||
| 102 | #define NOTE_F6 1396.91 | ||
| 103 | #define NOTE_FS6 1479.98 | ||
| 104 | #define NOTE_G6 1567.98 | ||
| 105 | #define NOTE_GS6 1661.22 | ||
| 106 | #define NOTE_A6 1760.00 | ||
| 107 | #define NOTE_AS6 1864.66 | ||
| 108 | #define NOTE_B6 1975.53 | ||
| 109 | #define NOTE_C7 2093.00 | ||
| 110 | #define NOTE_CS7 2217.46 | ||
| 111 | #define NOTE_D7 2349.32 | ||
| 112 | #define NOTE_DS7 2489.02 | ||
| 113 | #define NOTE_E7 2637.02 | ||
| 114 | #define NOTE_F7 2793.83 | ||
| 115 | #define NOTE_FS7 2959.96 | ||
| 116 | #define NOTE_G7 3135.96 | ||
| 117 | #define NOTE_GS7 3322.44 | ||
| 118 | #define NOTE_A7 3520.00 | ||
| 119 | #define NOTE_AS7 3729.31 | ||
| 120 | #define NOTE_B7 3951.07 | ||
| 121 | #define NOTE_C8 4186.01 | ||
| 122 | #define NOTE_CS8 4434.92 | ||
| 123 | #define NOTE_D8 4698.64 | ||
| 124 | #define NOTE_DS8 4978.03 | ||
| 125 | #define NOTE_E8 5274.04 | ||
| 126 | #define NOTE_F8 5587.65 | ||
| 127 | #define NOTE_FS8 5919.91 | ||
| 128 | #define NOTE_G8 6271.93 | ||
| 129 | #define NOTE_GS8 6644.88 | ||
| 130 | #define NOTE_A8 7040.00 | ||
| 131 | #define NOTE_AS8 7458.62 | ||
| 132 | #define NOTE_B8 7902.13 | ||
| 133 | |||
| 134 | // Flat Aliases | ||
| 135 | #define NOTE_DF0 NOTE_CS0 | ||
| 136 | #define NOTE_EF0 NOTE_DS0 | ||
| 137 | #define NOTE_GF0 NOTE_FS0 | ||
| 138 | #define NOTE_AF0 NOTE_GS0 | ||
| 139 | #define NOTE_BF0 NOTE_AS0 | ||
| 140 | #define NOTE_DF1 NOTE_CS1 | ||
| 141 | #define NOTE_EF1 NOTE_DS1 | ||
| 142 | #define NOTE_GF1 NOTE_FS1 | ||
| 143 | #define NOTE_AF1 NOTE_GS1 | ||
| 144 | #define NOTE_BF1 NOTE_AS1 | ||
| 145 | #define NOTE_DF2 NOTE_CS2 | ||
| 146 | #define NOTE_EF2 NOTE_DS2 | ||
| 147 | #define NOTE_GF2 NOTE_FS2 | ||
| 148 | #define NOTE_AF2 NOTE_GS2 | ||
| 149 | #define NOTE_BF2 NOTE_AS2 | ||
| 150 | #define NOTE_DF3 NOTE_CS3 | ||
| 151 | #define NOTE_EF3 NOTE_DS3 | ||
| 152 | #define NOTE_GF3 NOTE_FS3 | ||
| 153 | #define NOTE_AF3 NOTE_GS3 | ||
| 154 | #define NOTE_BF3 NOTE_AS3 | ||
| 155 | #define NOTE_DF4 NOTE_CS4 | ||
| 156 | #define NOTE_EF4 NOTE_DS4 | ||
| 157 | #define NOTE_GF4 NOTE_FS4 | ||
| 158 | #define NOTE_AF4 NOTE_GS4 | ||
| 159 | #define NOTE_BF4 NOTE_AS4 | ||
| 160 | #define NOTE_DF5 NOTE_CS5 | ||
| 161 | #define NOTE_EF5 NOTE_DS5 | ||
| 162 | #define NOTE_GF5 NOTE_FS5 | ||
| 163 | #define NOTE_AF5 NOTE_GS5 | ||
| 164 | #define NOTE_BF5 NOTE_AS5 | ||
| 165 | #define NOTE_DF6 NOTE_CS6 | ||
| 166 | #define NOTE_EF6 NOTE_DS6 | ||
| 167 | #define NOTE_GF6 NOTE_FS6 | ||
| 168 | #define NOTE_AF6 NOTE_GS6 | ||
| 169 | #define NOTE_BF6 NOTE_AS6 | ||
| 170 | #define NOTE_DF7 NOTE_CS7 | ||
| 171 | #define NOTE_EF7 NOTE_DS7 | ||
| 172 | #define NOTE_GF7 NOTE_FS7 | ||
| 173 | #define NOTE_AF7 NOTE_GS7 | ||
| 174 | #define NOTE_BF7 NOTE_AS7 | ||
| 175 | #define NOTE_DF8 NOTE_CS8 | ||
| 176 | #define NOTE_EF8 NOTE_DS8 | ||
| 177 | #define NOTE_GF8 NOTE_FS8 | ||
| 178 | #define NOTE_AF8 NOTE_GS8 | ||
| 179 | #define NOTE_BF8 NOTE_AS8 | ||
| 180 | |||
| 181 | |||
| 182 | #endif \ No newline at end of file | ||
diff --git a/quantum/quantum.mk b/quantum/quantum.mk index 17bb50171..1fe7390eb 100644 --- a/quantum/quantum.mk +++ b/quantum/quantum.mk | |||
| @@ -46,6 +46,7 @@ endif | |||
| 46 | 46 | ||
| 47 | # Search Path | 47 | # Search Path |
| 48 | VPATH += $(TOP_DIR)/$(QUANTUM_DIR) | 48 | VPATH += $(TOP_DIR)/$(QUANTUM_DIR) |
| 49 | VPATH += $(TOP_DIR)/$(QUANTUM_DIR)/keymap_extras | ||
| 49 | 50 | ||
| 50 | include $(TMK_DIR)/protocol/lufa.mk | 51 | include $(TMK_DIR)/protocol/lufa.mk |
| 51 | 52 | ||
diff --git a/quantum/tools/README.md b/quantum/tools/README.md new file mode 100644 index 000000000..070214423 --- /dev/null +++ b/quantum/tools/README.md | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | `eeprom_reset.hex` is to reset the eeprom on the Atmega32u4, like this: | ||
| 2 | |||
| 3 | dfu-programmer atmega32u4 erase | ||
| 4 | dfu-programmer atmega32u4 flash --eeprom eeprom-reset.bin | ||
| 5 | |||
| 6 | You'll need to reflash afterwards, because DFU requires the flash to be erased before messing with the eeprom. \ No newline at end of file | ||
diff --git a/quantum/tools/eeprom_reset.hex b/quantum/tools/eeprom_reset.hex new file mode 100644 index 000000000..a8a75389f --- /dev/null +++ b/quantum/tools/eeprom_reset.hex | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | :10000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 | ||
| 2 | :10001000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0 | ||
| 3 | :10002000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 | ||
| 4 | :10003000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD0 | ||
| 5 | :10004000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC0 | ||
| 6 | :10005000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB0 | ||
| 7 | :10006000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA0 | ||
| 8 | :10007000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF90 | ||
| 9 | :00000001FF | ||
