summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/api.c179
-rw-r--r--quantum/api.h59
-rw-r--r--quantum/api/api_sysex.c57
-rw-r--r--quantum/api/api_sysex.h10
-rw-r--r--quantum/audio/audio.c15
-rw-r--r--quantum/audio/voices.c121
-rw-r--r--quantum/audio/voices.h4
-rw-r--r--quantum/config_common.h147
-rw-r--r--quantum/dynamic_macro.h9
-rw-r--r--quantum/keycode_config.h5
-rw-r--r--quantum/keymap.h297
-rw-r--r--quantum/keymap_common.c16
-rw-r--r--quantum/keymap_extras/keymap_br_abnt2.h58
-rw-r--r--quantum/keymap_extras/keymap_canadian_multilingual.h255
-rw-r--r--quantum/keymap_extras/keymap_dvorak.h4
-rw-r--r--quantum/keymap_extras/keymap_dvp.h82
-rw-r--r--quantum/keymap_extras/keymap_jp.h62
-rw-r--r--quantum/keymap_extras/keymap_nordic.h2
-rwxr-xr-xquantum/light_ws2812.c151
-rwxr-xr-xquantum/light_ws2812.h14
-rw-r--r--quantum/matrix.c326
-rw-r--r--quantum/pincontrol.h37
-rw-r--r--quantum/process_keycode/process_midi.c4
-rw-r--r--quantum/process_keycode/process_music.c15
-rw-r--r--quantum/process_keycode/process_printer.c254
-rw-r--r--quantum/process_keycode/process_printer.h8
-rw-r--r--quantum/process_keycode/process_printer_bb.c260
-rw-r--r--quantum/process_keycode/process_tap_dance.c6
-rw-r--r--quantum/process_keycode/process_tap_dance.h10
-rw-r--r--quantum/process_keycode/process_unicode.c52
-rw-r--r--quantum/process_keycode/process_unicode.h14
-rw-r--r--quantum/quantum.c175
-rw-r--r--quantum/quantum.h11
-rw-r--r--quantum/quantum_keycodes.h313
-rw-r--r--quantum/rgblight.c228
-rw-r--r--quantum/rgblight.h26
-rw-r--r--quantum/variable_trace.c110
-rw-r--r--quantum/variable_trace.h34
38 files changed, 2776 insertions, 654 deletions
diff --git a/quantum/api.c b/quantum/api.c
new file mode 100644
index 0000000000..6a7c0a4332
--- /dev/null
+++ b/quantum/api.c
@@ -0,0 +1,179 @@
+#include "api.h"
+#include "quantum.h"
+
+void dword_to_bytes(uint32_t dword, uint8_t * bytes) {
+ bytes[0] = (dword >> 24) & 0xFF;
+ bytes[1] = (dword >> 16) & 0xFF;
+ bytes[2] = (dword >> 8) & 0xFF;
+ bytes[3] = (dword >> 0) & 0xFF;
+}
+
+uint32_t bytes_to_dword(uint8_t * bytes, uint8_t index) {
+ return ((uint32_t)bytes[index + 0] << 24) | ((uint32_t)bytes[index + 1] << 16) | ((uint32_t)bytes[index + 2] << 8) | (uint32_t)bytes[index + 3];
+}
+
+__attribute__ ((weak))
+bool process_api_quantum(uint8_t length, uint8_t * data) {
+ return process_api_keyboard(length, data);
+}
+
+__attribute__ ((weak))
+bool process_api_keyboard(uint8_t length, uint8_t * data) {
+ return process_api_user(length, data);
+}
+
+__attribute__ ((weak))
+bool process_api_user(uint8_t length, uint8_t * data) {
+ return true;
+}
+
+void process_api(uint16_t length, uint8_t * data) {
+ // SEND_STRING("\nRX: ");
+ // for (uint8_t i = 0; i < length; i++) {
+ // send_byte(data[i]);
+ // SEND_STRING(" ");
+ // }
+ if (!process_api_quantum(length, data))
+ return;
+
+ switch (data[0]) {
+ case MT_SET_DATA:
+ switch (data[1]) {
+ case DT_DEFAULT_LAYER: {
+ eeconfig_update_default_layer(data[2]);
+ default_layer_set((uint32_t)(data[2]));
+ break;
+ }
+ case DT_KEYMAP_OPTIONS: {
+ eeconfig_update_keymap(data[2]);
+ break;
+ }
+ case DT_RGBLIGHT: {
+ #ifdef RGBLIGHT_ENABLE
+ uint32_t rgblight = bytes_to_dword(data, 2);
+ rgblight_update_dword(rgblight);
+ #endif
+ break;
+ }
+ }
+ case MT_GET_DATA:
+ switch (data[1]) {
+ case DT_HANDSHAKE: {
+ MT_GET_DATA_ACK(DT_HANDSHAKE, NULL, 0);
+ break;
+ }
+ case DT_DEBUG: {
+ uint8_t debug_bytes[1] = { eeprom_read_byte(EECONFIG_DEBUG) };
+ MT_GET_DATA_ACK(DT_DEBUG, debug_bytes, 1);
+ break;
+ }
+ case DT_DEFAULT_LAYER: {
+ uint8_t default_bytes[1] = { eeprom_read_byte(EECONFIG_DEFAULT_LAYER) };
+ MT_GET_DATA_ACK(DT_DEFAULT_LAYER, default_bytes, 1);
+ break;
+ }
+ case DT_CURRENT_LAYER: {
+ uint8_t layer_state_bytes[4];
+ dword_to_bytes(layer_state, layer_state_bytes);
+ MT_GET_DATA_ACK(DT_CURRENT_LAYER, layer_state_bytes, 4);
+ break;
+ }
+ case DT_AUDIO: {
+ #ifdef AUDIO_ENABLE
+ uint8_t audio_bytes[1] = { eeprom_read_byte(EECONFIG_AUDIO) };
+ MT_GET_DATA_ACK(DT_AUDIO, audio_bytes, 1);
+ #else
+ MT_GET_DATA_ACK(DT_AUDIO, NULL, 0);
+ #endif
+ break;
+ }
+ case DT_BACKLIGHT: {
+ #ifdef BACKLIGHT_ENABLE
+ uint8_t backlight_bytes[1] = { eeprom_read_byte(EECONFIG_BACKLIGHT) };
+ MT_GET_DATA_ACK(DT_BACKLIGHT, backlight_bytes, 1);
+ #else
+ MT_GET_DATA_ACK(DT_BACKLIGHT, NULL, 0);
+ #endif
+ break;
+ }
+ case DT_RGBLIGHT: {
+ #ifdef RGBLIGHT_ENABLE
+ uint8_t rgblight_bytes[4];
+ dword_to_bytes(eeconfig_read_rgblight(), rgblight_bytes);
+ MT_GET_DATA_ACK(DT_RGBLIGHT, rgblight_bytes, 4);
+ #else
+ MT_GET_DATA_ACK(DT_RGBLIGHT, NULL, 0);
+ #endif
+ break;
+ }
+ case DT_KEYMAP_OPTIONS: {
+ uint8_t keymap_bytes[1] = { eeconfig_read_keymap() };
+ MT_GET_DATA_ACK(DT_KEYMAP_OPTIONS, keymap_bytes, 1);
+ break;
+ }
+ case DT_KEYMAP_SIZE: {
+ uint8_t keymap_size[2] = {MATRIX_ROWS, MATRIX_COLS};
+ MT_GET_DATA_ACK(DT_KEYMAP_SIZE, keymap_size, 2);
+ break;
+ }
+ // This may be too much
+ // case DT_KEYMAP: {
+ // uint8_t keymap_data[MATRIX_ROWS * MATRIX_COLS * 4 + 3];
+ // keymap_data[0] = data[2];
+ // keymap_data[1] = MATRIX_ROWS;
+ // keymap_data[2] = MATRIX_COLS;
+ // for (int i = 0; i < MATRIX_ROWS; i++) {
+ // for (int j = 0; j < MATRIX_COLS; j++) {
+ // keymap_data[3 + (i*MATRIX_COLS*2) + (j*2)] = pgm_read_word(&keymaps[data[2]][i][j]) >> 8;
+ // keymap_data[3 + (i*MATRIX_COLS*2) + (j*2) + 1] = pgm_read_word(&keymaps[data[2]][i][j]) & 0xFF;
+ // }
+ // }
+ // MT_GET_DATA_ACK(DT_KEYMAP, keymap_data, MATRIX_ROWS * MATRIX_COLS * 4 + 3);
+ // // uint8_t keymap_data[5];
+ // // keymap_data[0] = data[2];
+ // // keymap_data[1] = data[3];
+ // // keymap_data[2] = data[4];
+ // // keymap_data[3] = pgm_read_word(&keymaps[data[2]][data[3]][data[4]]) >> 8;
+ // // keymap_data[4] = pgm_read_word(&keymaps[data[2]][data[3]][data[4]]) & 0xFF;
+
+ // // MT_GET_DATA_ACK(DT_KEYMAP, keymap_data, 5);
+ // break;
+ // }
+ default:
+ break;
+ }
+ break;
+ case MT_SET_DATA_ACK:
+ case MT_GET_DATA_ACK:
+ break;
+ case MT_SEND_DATA:
+ break;
+ case MT_SEND_DATA_ACK:
+ break;
+ case MT_EXE_ACTION:
+ break;
+ case MT_EXE_ACTION_ACK:
+ break;
+ case MT_TYPE_ERROR:
+ break;
+ default: ; // command not recognised
+ SEND_BYTES(MT_TYPE_ERROR, DT_NONE, data, length);
+ break;
+
+ // #ifdef RGBLIGHT_ENABLE
+ // case 0x27: ; // RGB LED functions
+ // switch (*data++) {
+ // case 0x00: ; // Update HSV
+ // rgblight_sethsv((data[0] << 8 | data[1]) % 360, data[2], data[3]);
+ // break;
+ // case 0x01: ; // Update RGB
+ // break;
+ // case 0x02: ; // Update mode
+ // rgblight_mode(data[0]);
+ // break;
+ // }
+ // break;
+ // #endif
+ }
+
+} \ No newline at end of file
diff --git a/quantum/api.h b/quantum/api.h
new file mode 100644
index 0000000000..00dcdb8954
--- /dev/null
+++ b/quantum/api.h
@@ -0,0 +1,59 @@
+#ifndef _API_H_
+#define _API_H_
+
+#include "lufa.h"
+
+enum MESSAGE_TYPE {
+ MT_GET_DATA = 0x10, // Get data from keyboard
+ MT_GET_DATA_ACK = 0x11, // returned data to process (ACK)
+ MT_SET_DATA = 0x20, // Set data on keyboard
+ MT_SET_DATA_ACK = 0x21, // returned data to confirm (ACK)
+ MT_SEND_DATA = 0x30, // Sending data/action from keyboard
+ MT_SEND_DATA_ACK = 0x31, // returned data/action confirmation (ACK)
+ MT_EXE_ACTION = 0x40, // executing actions on keyboard
+ MT_EXE_ACTION_ACK =0x41, // return confirmation/value (ACK)
+ MT_TYPE_ERROR = 0x80 // type not recofgnised (ACK)
+};
+
+enum DATA_TYPE {
+ DT_NONE = 0x00,
+ DT_HANDSHAKE,
+ DT_DEFAULT_LAYER,
+ DT_CURRENT_LAYER,
+ DT_KEYMAP_OPTIONS,
+ DT_BACKLIGHT,
+ DT_RGBLIGHT,
+ DT_UNICODE,
+ DT_DEBUG,
+ DT_AUDIO,
+ DT_QUANTUM_ACTION,
+ DT_KEYBOARD_ACTION,
+ DT_USER_ACTION,
+ DT_KEYMAP_SIZE,
+ DT_KEYMAP
+};
+
+void dword_to_bytes(uint32_t dword, uint8_t * bytes);
+uint32_t bytes_to_dword(uint8_t * bytes, uint8_t index);
+
+#define MT_GET_DATA(data_type, data, length) SEND_BYTES(MT_GET_DATA, data_type, data, length)
+#define MT_GET_DATA_ACK(data_type, data, length) SEND_BYTES(MT_GET_DATA_ACK, data_type, data, length)
+#define MT_SET_DATA(data_type, data, length) SEND_BYTES(MT_SET_DATA, data_type, data, length)
+#define MT_SET_DATA_ACK(data_type, data, length) SEND_BYTES(MT_SET_DATA_ACK, data_type, data, length)
+#define MT_SEND_DATA(data_type, data, length) SEND_BYTES(MT_SEND_DATA, data_type, data, length)
+#define MT_SEND_DATA_ACK(data_type, data, length) SEND_BYTES(MT_SEND_DATA_ACK, data_type, data, length)
+#define MT_EXE_ACTION(data_type, data, length) SEND_BYTES(MT_EXE_ACTION, data_type, data, length)
+#define MT_EXE_ACTION_ACK(data_type, data, length) SEND_BYTES(MT_EXE_ACTION_ACK, data_type, data, length)
+
+void process_api(uint16_t length, uint8_t * data);
+
+__attribute__ ((weak))
+bool process_api_quantum(uint8_t length, uint8_t * data);
+
+__attribute__ ((weak))
+bool process_api_keyboard(uint8_t length, uint8_t * data);
+
+__attribute__ ((weak))
+bool process_api_user(uint8_t length, uint8_t * data);
+
+#endif \ No newline at end of file
diff --git a/quantum/api/api_sysex.c b/quantum/api/api_sysex.c
new file mode 100644
index 0000000000..868f854b92
--- /dev/null
+++ b/quantum/api/api_sysex.c
@@ -0,0 +1,57 @@
+#include "api_sysex.h"
+#include "sysex_tools.h"
+#include "print.h"
+
+void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes, uint16_t length) {
+ // SEND_STRING("\nTX: ");
+ // for (uint8_t i = 0; i < length; i++) {
+ // send_byte(bytes[i]);
+ // SEND_STRING(" ");
+ // }
+ if (length > API_SYSEX_MAX_SIZE) {
+ xprintf("Sysex msg too big %d %d %d", message_type, data_type, length);
+ return;
+ }
+
+
+ // The buffer size required is calculated as the following
+ // API_SYSEX_MAX_SIZE is the maximum length
+ // In addition to that we have a two byte message header consisting of the message_type and data_type
+ // This has to be encoded with an additional overhead of one byte for every starting 7 bytes
+ // We just add one extra byte in case it's not divisible by 7
+ // Then we have an unencoded header consisting of 4 bytes
+ // Plus a one byte terminator
+ const unsigned message_header = 2;
+ const unsigned unencoded_message = API_SYSEX_MAX_SIZE + message_header;
+ const unsigned encoding_overhead = unencoded_message / 7 + 1;
+ const unsigned encoded_size = unencoded_message + encoding_overhead;
+ const unsigned unencoded_header = 4;
+ const unsigned terminator = 1;
+ const unsigned buffer_size = encoded_size + unencoded_header + terminator;
+ uint8_t buffer[encoded_size + unencoded_header + terminator];
+ // The unencoded header
+ buffer[0] = 0xF0;
+ buffer[1] = 0x00;
+ buffer[2] = 0x00;
+ buffer[3] = 0x00;
+
+ // We copy the message to the end of the array, this way we can do an inplace encoding, using the same
+ // buffer for both input and output
+ const unsigned message_size = length + message_header;
+ uint8_t* unencoded_start = buffer + buffer_size - message_size;
+ uint8_t* ptr = unencoded_start;
+ *(ptr++) = message_type;
+ *(ptr++) = data_type;
+ memcpy(ptr, bytes, length);
+
+ unsigned encoded_length = sysex_encode(buffer + unencoded_header, unencoded_start, message_size);
+ unsigned final_size = unencoded_header + encoded_length + terminator;
+ buffer[final_size - 1] = 0xF7;
+ midi_send_array(&midi_device, final_size, buffer);
+
+ // SEND_STRING("\nTD: ");
+ // for (uint8_t i = 0; i < encoded_length + 5; i++) {
+ // send_byte(buffer[i]);
+ // SEND_STRING(" ");
+ // }
+}
diff --git a/quantum/api/api_sysex.h b/quantum/api/api_sysex.h
new file mode 100644
index 0000000000..b947b60e54
--- /dev/null
+++ b/quantum/api/api_sysex.h
@@ -0,0 +1,10 @@
+#ifndef _API_SYSEX_H_
+#define _API_SYSEX_H_
+
+#include "api.h"
+
+void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes, uint16_t length);
+
+#define SEND_BYTES(mt, dt, b, l) send_bytes_sysex(mt, dt, b, l)
+
+#endif \ No newline at end of file
diff --git a/quantum/audio/audio.c b/quantum/audio/audio.c
index ead5fbf3e9..2a315fd168 100644
--- a/quantum/audio/audio.c
+++ b/quantum/audio/audio.c
@@ -77,6 +77,7 @@ static bool audio_initialized = false;
audio_config_t audio_config;
uint16_t envelope_index = 0;
+bool glissando = true;
void audio_init()
{
@@ -205,13 +206,17 @@ ISR(TIMER3_COMPA_vect)
freq = frequencies[voice_place];
#endif
} else {
- if (frequency != 0 && frequency < frequencies[voices - 1] && frequency < frequencies[voices - 1] * pow(2, -440/frequencies[voices - 1]/12/2)) {
- frequency = frequency * pow(2, 440/frequency/12/2);
- } else if (frequency != 0 && frequency > frequencies[voices - 1] && frequency > frequencies[voices - 1] * pow(2, 440/frequencies[voices - 1]/12/2)) {
- frequency = frequency * pow(2, -440/frequency/12/2);
+ if (glissando) {
+ if (frequency != 0 && frequency < frequencies[voices - 1] && frequency < frequencies[voices - 1] * pow(2, -440/frequencies[voices - 1]/12/2)) {
+ frequency = frequency * pow(2, 440/frequency/12/2);
+ } else if (frequency != 0 && frequency > frequencies[voices - 1] && frequency > frequencies[voices - 1] * pow(2, 440/frequencies[voices - 1]/12/2)) {
+ frequency = frequency * pow(2, -440/frequency/12/2);
+ } else {
+ frequency = frequencies[voices - 1];
+ }
} else {
frequency = frequencies[voices - 1];
- }
+ }
#ifdef VIBRATO_ENABLE
if (vibrato_strength > 0) {
diff --git a/quantum/audio/voices.c b/quantum/audio/voices.c
index 6d4172a06c..8326e91eaa 100644
--- a/quantum/audio/voices.c
+++ b/quantum/audio/voices.c
@@ -6,6 +6,7 @@
extern uint16_t envelope_index;
extern float note_timbre;
extern float polyphony_rate;
+extern bool glissando;
voice_type voice = default_voice;
@@ -18,7 +19,7 @@ void voice_iterate() {
}
void voice_deiterate() {
- voice = (voice - 1) % number_of_voices;
+ voice = (voice - 1 + number_of_voices) % number_of_voices;
}
float voice_envelope(float frequency) {
@@ -27,11 +28,122 @@ float voice_envelope(float frequency) {
switch (voice) {
case default_voice:
+ glissando = true;
note_timbre = TIMBRE_50;
polyphony_rate = 0;
break;
+ #ifdef AUDIO_VOICES
+
+ case something:
+ glissando = false;
+ polyphony_rate = 0;
+ switch (compensated_index) {
+ case 0 ... 9:
+ note_timbre = TIMBRE_12;
+ break;
+
+ case 10 ... 19:
+ note_timbre = TIMBRE_25;
+ break;
+
+ case 20 ... 200:
+ note_timbre = .125 + .125;
+ break;
+
+ default:
+ note_timbre = .125;
+ break;
+ }
+ break;
+
+ case drums:
+ glissando = false;
+ polyphony_rate = 0;
+ // switch (compensated_index) {
+ // case 0 ... 10:
+ // note_timbre = 0.5;
+ // break;
+ // case 11 ... 20:
+ // note_timbre = 0.5 * (21 - compensated_index) / 10;
+ // break;
+ // default:
+ // note_timbre = 0;
+ // break;
+ // }
+ // frequency = (rand() % (int)(frequency * 1.2 - frequency)) + (frequency * 0.8);
+
+ if (frequency < 80.0) {
+
+ } else if (frequency < 160.0) {
+
+ // Bass drum: 60 - 100 Hz
+ frequency = (rand() % (int)(40)) + 60;
+ switch (envelope_index) {
+ case 0 ... 10:
+ note_timbre = 0.5;
+ break;
+ case 11 ... 20:
+ note_timbre = 0.5 * (21 - envelope_index) / 10;
+ break;
+ default:
+ note_timbre = 0;
+ break;
+ }
+
+ } else if (frequency < 320.0) {
+
+
+ // Snare drum: 1 - 2 KHz
+ frequency = (rand() % (int)(1000)) + 1000;
+ switch (envelope_index) {
+ case 0 ... 5:
+ note_timbre = 0.5;
+ break;
+ case 6 ... 20:
+ note_timbre = 0.5 * (21 - envelope_index) / 15;
+ break;
+ default:
+ note_timbre = 0;
+ break;
+ }
+
+ } else if (frequency < 640.0) {
+
+ // Closed Hi-hat: 3 - 5 KHz
+ frequency = (rand() % (int)(2000)) + 3000;
+ switch (envelope_index) {
+ case 0 ... 15:
+ note_timbre = 0.5;
+ break;
+ case 16 ... 20:
+ note_timbre = 0.5 * (21 - envelope_index) / 5;
+ break;
+ default:
+ note_timbre = 0;
+ break;
+ }
+
+ } else if (frequency < 1280.0) {
+
+ // Open Hi-hat: 3 - 5 KHz
+ frequency = (rand() % (int)(2000)) + 3000;
+ switch (envelope_index) {
+ case 0 ... 35:
+ note_timbre = 0.5;
+ break;
+ case 36 ... 50:
+ note_timbre = 0.5 * (51 - envelope_index) / 15;
+ break;
+ default:
+ note_timbre = 0;
+ break;
+ }
+
+ }
+ break;
case butts_fader:
+ glissando = true;
polyphony_rate = 0;
switch (compensated_index) {
case 0 ... 9:
@@ -79,6 +191,7 @@ float voice_envelope(float frequency) {
case duty_osc:
// This slows the loop down a substantial amount, so higher notes may freeze
+ glissando = true;
polyphony_rate = 0;
switch (compensated_index) {
default:
@@ -93,6 +206,7 @@ float voice_envelope(float frequency) {
break;
case duty_octave_down:
+ glissando = true;
polyphony_rate = 0;
note_timbre = (envelope_index % 2) * .125 + .375 * 2;
if ((envelope_index % 4) == 0)
@@ -101,6 +215,7 @@ float voice_envelope(float frequency) {
note_timbre = 0;
break;
case delayed_vibrato:
+ glissando = true;
polyphony_rate = 0;
note_timbre = TIMBRE_50;
#define VOICE_VIBRATO_DELAY 150
@@ -155,11 +270,11 @@ float voice_envelope(float frequency) {
// note_timbre = 0.25;
// break;
+ #endif
+
default:
break;
}
return frequency;
}
-
-
diff --git a/quantum/audio/voices.h b/quantum/audio/voices.h
index b2495b23b5..52f7e006d6 100644
--- a/quantum/audio/voices.h
+++ b/quantum/audio/voices.h
@@ -11,6 +11,9 @@ float voice_envelope(float frequency);
typedef enum {
default_voice,
+ #ifdef AUDIO_VOICES
+ something,
+ drums,
butts_fader,
octave_crunch,
duty_osc,
@@ -21,6 +24,7 @@ typedef enum {
// duty_fourth_down,
// duty_third_down,
// duty_fifth_third_down,
+ #endif
number_of_voices // important that this is last
} voice_type;
diff --git a/quantum/config_common.h b/quantum/config_common.h
index 8ed5f4a106..4bdb2065d9 100644
--- a/quantum/config_common.h
+++ b/quantum/config_common.h
@@ -5,55 +5,56 @@
#define COL2ROW 0
#define ROW2COL 1
/* I/O pins */
-#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
-#define A0 0x00
-#define A1 0x01
-#define A2 0x02
-#define A3 0x03
-#define A4 0x04
-#define A5 0x05
-#define A6 0x06
-#define A7 0x07
-
+#ifndef F0
+ #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
+ #define A0 0x00
+ #define A1 0x01
+ #define A2 0x02
+ #define A3 0x03
+ #define A4 0x04
+ #define A5 0x05
+ #define A6 0x06
+ #define A7 0x07
+#endif
/* USART configuration */
#ifdef BLUETOOTH_ENABLE
@@ -76,53 +77,9 @@
} while(0)
# else
# error "USART configuration is needed."
+# endif
#endif
-// I'm fairly sure these aren't needed, but oh well - Jack
-
-/*
- * PS/2 Interrupt configuration
- */
-#ifdef PS2_USE_INT
-/* uses INT1 for clock line(ATMega32U4) */
-#define PS2_CLOCK_PORT PORTD
-#define PS2_CLOCK_PIN PIND
-#define PS2_CLOCK_DDR DDRD
-#define PS2_CLOCK_BIT 1
-
-#define PS2_DATA_PORT PORTD
-#define PS2_DATA_PIN PIND
-#define PS2_DATA_DDR DDRD
-#define PS2_DATA_BIT 0
-
-#define PS2_INT_INIT() do { \
- EICRA |= ((1<<ISC11) | \
- (0<<ISC10)); \
-} while (0)
-#define PS2_INT_ON() do { \
- EIMSK |= (1<<INT1); \
-} while (0)
-#define PS2_INT_OFF() do { \
- EIMSK &= ~(1<<INT1); \
-} while (0)
-#define PS2_INT_VECT INT1_vect
-#endif
-
-/*
- * PS/2 Busywait configuration
- */
-#ifdef PS2_USE_BUSYWAIT
-#define PS2_CLOCK_PORT PORTD
-#define PS2_CLOCK_PIN PIND
-#define PS2_CLOCK_DDR DDRD
-#define PS2_CLOCK_BIT 1
-
-#define PS2_DATA_PORT PORTD
-#define PS2_DATA_PIN PIND
-#define PS2_DATA_DDR DDRD
-#define PS2_DATA_BIT 0
-#endif
-
-#endif
+#define API_SYSEX_MAX_SIZE 32
#endif
diff --git a/quantum/dynamic_macro.h b/quantum/dynamic_macro.h
index a3ad61bc7e..e6dbc5b9c1 100644
--- a/quantum/dynamic_macro.h
+++ b/quantum/dynamic_macro.h
@@ -8,8 +8,13 @@
/* May be overridden with a custom value. Be aware that the effective
* macro length is half of this value: each keypress is recorded twice
* because of the down-event and up-event. This is not a bug, it's the
- * intended behavior. */
-#define DYNAMIC_MACRO_SIZE 256
+ * intended behavior.
+ *
+ * Usually it should be fine to set the macro size to at least 256 but
+ * there have been reports of it being too much in some users' cases,
+ * so 128 is considered a safe default.
+ */
+#define DYNAMIC_MACRO_SIZE 128
#endif
/* DYNAMIC_MACRO_RANGE must be set as the last element of user's
diff --git a/quantum/keycode_config.h b/quantum/keycode_config.h
index 6216eefc90..c15b0d32f8 100644
--- a/quantum/keycode_config.h
+++ b/quantum/keycode_config.h
@@ -1,6 +1,9 @@
#include "eeconfig.h"
#include "keycode.h"
+#ifndef KEYCODE_CONFIG_H
+#define KEYCODE_CONFIG_H
+
uint16_t keycode_config(ui