diff options
Diffstat (limited to 'quantum')
90 files changed, 6436 insertions, 1635 deletions
diff --git a/quantum/audio/audio.c b/quantum/audio/audio.c index 32f64417ed..ead5fbf3e9 100644 --- a/quantum/audio/audio.c +++ b/quantum/audio/audio.c @@ -6,7 +6,7 @@ #include <avr/io.h> #include "print.h" #include "audio.h" -#include "keymap_common.h" +#include "keymap.h" #include "eeconfig.h" @@ -475,20 +475,3 @@ void increase_tempo(uint8_t tempo_change) { note_tempo -= tempo_change; } } - - -//------------------------------------------------------------------------------ -// Override these functions in your keymap file to play different tunes on -// startup and bootloader jump -__attribute__ ((weak)) -void play_startup_tone() {} - -__attribute__ ((weak)) -void play_goodbye_tone() {} - -__attribute__ ((weak)) -void audio_on_user() {} - -__attribute__ ((weak)) -void play_music_scale() {} -//------------------------------------------------------------------------------ diff --git a/quantum/audio/audio.h b/quantum/audio/audio.h index b46f587bb4..47f326ea0a 100644 --- a/quantum/audio/audio.h +++ b/quantum/audio/audio.h @@ -1,3 +1,6 @@ +#ifndef AUDIO_H +#define AUDIO_H + #include <stdint.h> #include <stdbool.h> #include <avr/io.h> @@ -5,9 +8,7 @@ #include "musical_notes.h" #include "song_list.h" #include "voices.h" - -#ifndef AUDIO_H -#define AUDIO_H +#include "quantum.h" // Largely untested PWM audio mode (doesn't sound as good) // #define PWM_AUDIO @@ -87,9 +88,4 @@ void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat, float n_rest) bool is_playing_notes(void); -void play_goodbye_tone(void); -void play_startup_tone(void); -void audio_on_user(void); -void play_music_scale(void); - #endif
\ No newline at end of file diff --git a/quantum/audio/audio_pwm.c b/quantum/audio/audio_pwm.c index 328a253a7e..f820eec1be 100644 --- a/quantum/audio/audio_pwm.c +++ b/quantum/audio/audio_pwm.c @@ -6,7 +6,7 @@ #include <avr/io.h> #include "print.h" #include "audio.h" -#include "keymap_common.h" +#include "keymap.h" #include "eeconfig.h" diff --git a/quantum/config_common.h b/quantum/config_common.h index 02f11d979c..09a4fe7010 100644 --- a/quantum/config_common.h +++ b/quantum/config_common.h @@ -5,46 +5,46 @@ #define COL2ROW 0 #define ROW2COL 1 /* I/O pins */ -#define B0 { .input_addr = 3, .bit = 0 } -#define B1 { .input_addr = 3, .bit = 1 } -#define B2 { .input_addr = 3, .bit = 2 } -#define B3 { .input_addr = 3, .bit = 3 } -#define B4 { .input_addr = 3, .bit = 4 } -#define B5 { .input_addr = 3, .bit = 5 } -#define B6 { .input_addr = 3, .bit = 6 } -#define B7 { .input_addr = 3, .bit = 7 } -#define C0 { .input_addr = 6, .bit = 0 } -#define C1 { .input_addr = 6, .bit = 1 } -#define C2 { .input_addr = 6, .bit = 2 } -#define C3 { .input_addr = 6, .bit = 3 } -#define C4 { .input_addr = 6, .bit = 4 } -#define C5 { .input_addr = 6, .bit = 5 } -#define C6 { .input_addr = 6, .bit = 6 } -#define C7 { .input_addr = 6, .bit = 7 } -#define D0 { .input_addr = 9, .bit = 0 } -#define D1 { .input_addr = 9, .bit = 1 } -#define D2 { .input_addr = 9, .bit = 2 } -#define D3 { .input_addr = 9, .bit = 3 } -#define D4 { .input_addr = 9, .bit = 4 } -#define D5 { .input_addr = 9, .bit = 5 } -#define D6 { .input_addr = 9, .bit = 6 } -#define D7 { .input_addr = 9, .bit = 7 } -#define E0 { .input_addr = 0xC, .bit = 0 } -#define E1 { .input_addr = 0xC, .bit = 1 } -#define E2 { .input_addr = 0xC, .bit = 2 } -#define E3 { .input_addr = 0xC, .bit = 3 } -#define E4 { .input_addr = 0xC, .bit = 4 } -#define E5 { .input_addr = 0xC, .bit = 5 } -#define E6 { .input_addr = 0xC, .bit = 6 } -#define E7 { .input_addr = 0xC, .bit = 7 } -#define F0 { .input_addr = 0xF, .bit = 0 } -#define F1 { .input_addr = 0xF, .bit = 1 } -#define F2 { .input_addr = 0xF, .bit = 2 } -#define F3 { .input_addr = 0xF, .bit = 3 } -#define F4 { .input_addr = 0xF, .bit = 4 } -#define F5 { .input_addr = 0xF, .bit = 5 } -#define F6 { .input_addr = 0xF, .bit = 6 } -#define F7 { .input_addr = 0xF, .bit = 7 } +#define B0 0x30 +#define B1 0x31 +#define B2 0x32 +#define B3 0x33 +#define B4 0x34 +#define B5 0x35 +#define B6 0x36 +#define B7 0x37 +#define C0 0x60 +#define C1 0x61 +#define C2 0x62 +#define C3 0x63 +#define C4 0x64 +#define C5 0x65 +#define C6 0x66 +#define C7 0x67 +#define D0 0x90 +#define D1 0x91 +#define D2 0x92 +#define D3 0x93 +#define D4 0x94 +#define D5 0x95 +#define D6 0x96 +#define D7 0x97 +#define E0 0xC0 +#define E1 0xC1 +#define E2 0xC2 +#define E3 0xC3 +#define E4 0xC4 +#define E5 0xC5 +#define E6 0xC6 +#define E7 0xC7 +#define F0 0xF0 +#define F1 0xF1 +#define F2 0xF2 +#define F3 0xF3 +#define F4 0xF4 +#define F5 0xF5 +#define F6 0xF6 +#define F7 0xF7 /* USART configuration */ #ifdef BLUETOOTH_ENABLE diff --git a/quantum/keycode_config.c b/quantum/keycode_config.c new file mode 100644 index 0000000000..6d90781a17 --- /dev/null +++ b/quantum/keycode_config.c @@ -0,0 +1,74 @@ +#include "keycode_config.h" + +extern keymap_config_t keymap_config; + +uint16_t keycode_config(uint16_t keycode) { + + switch (keycode) { + case KC_CAPSLOCK: + case KC_LOCKING_CAPS: + if (keymap_config.swap_control_capslock || keymap_config.capslock_to_control) { + return KC_LCTL; + } + return keycode; + case KC_LCTL: + if (keymap_config.swap_control_capslock) { + return KC_CAPSLOCK; + } + return KC_LCTL; + case KC_LALT: + if (keymap_config.swap_lalt_lgui) { + if (keymap_config.no_gui) { + return KC_NO; + } + return KC_LGUI; + } + return KC_LALT; + case KC_LGUI: + if (keymap_config.swap_lalt_lgui) { + return KC_LALT; + } + if (keymap_config.no_gui) { + return KC_NO; + } + return KC_LGUI; + case KC_RALT: + if (keymap_config.swap_ralt_rgui) { + if (keymap_config.no_gui) { + return KC_NO; + } + return KC_RGUI; + } + return KC_RALT; + case KC_RGUI: + if (keymap_config.swap_ralt_rgui) { + return KC_RALT; + } + if (keymap_config.no_gui) { + return KC_NO; + } + return KC_RGUI; + case KC_GRAVE: + if (keymap_config.swap_grave_esc) { + return KC_ESC; + } + return KC_GRAVE; + case KC_ESC: + if (keymap_config.swap_grave_esc) { + return KC_GRAVE; + } + return KC_ESC; + case KC_BSLASH: + if (keymap_config.swap_backslash_backspace) { + return KC_BSPACE; + } + return KC_BSLASH; + case KC_BSPACE: + if (keymap_config.swap_backslash_backspace) { + return KC_BSLASH; + } + return KC_BSPACE; + default: + return keycode; + } +}
\ No newline at end of file diff --git a/quantum/keycode_config.h b/quantum/keycode_config.h new file mode 100644 index 0000000000..6216eefc90 --- /dev/null +++ b/quantum/keycode_config.h @@ -0,0 +1,21 @@ +#include "eeconfig.h" +#include "keycode.h" + +uint16_t keycode_config(uint16_t keycode); + +/* NOTE: Not portable. Bit field order depends on implementation */ +typedef union { + uint16_t raw; + struct { + bool swap_control_capslock:1; + bool capslock_to_control:1; + bool swap_lalt_lgui:1; + bool swap_ralt_rgui:1; + bool no_gui:1; + bool swap_grave_esc:1; + bool swap_backslash_backspace:1; + bool nkro:1; + }; +} keymap_config_t; + +extern keymap_config_t keymap_config; diff --git a/quantum/keymap.h b/quantum/keymap.h new file mode 100644 index 0000000000..a158651839 --- /dev/null +++ b/quantum/keymap.h @@ -0,0 +1,338 @@ +/* +Copyright 2012,2013 Jun Wako <wakojun@gmail.com> + +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 |