summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/analog.c16
-rw-r--r--quantum/analog.h16
-rw-r--r--quantum/api.c18
-rw-r--r--quantum/api.h18
-rw-r--r--quantum/api/api_sysex.c75
-rw-r--r--quantum/api/api_sysex.h18
-rw-r--r--quantum/audio/audio.c337
-rw-r--r--quantum/audio/audio.h17
-rw-r--r--quantum/audio/audio_pwm.c15
-rw-r--r--quantum/audio/luts.c16
-rw-r--r--quantum/audio/luts.h18
-rw-r--r--quantum/audio/musical_notes.h18
-rw-r--r--quantum/audio/song_list.h54
-rw-r--r--quantum/audio/voices.c16
-rw-r--r--quantum/audio/voices.h17
-rw-r--r--quantum/audio/wave.h18
-rw-r--r--quantum/config_common.h24
-rw-r--r--quantum/dynamic_macro.h16
-rw-r--r--quantum/fauxclicky.c68
-rw-r--r--quantum/fauxclicky.h99
-rw-r--r--quantum/keycode_config.c18
-rw-r--r--quantum/keycode_config.h16
-rw-r--r--quantum/keymap.h316
-rw-r--r--quantum/keymap_common.c28
-rw-r--r--quantum/keymap_extras/keymap_bepo.h15
-rw-r--r--quantum/keymap_extras/keymap_br_abnt2.h16
-rw-r--r--quantum/keymap_extras/keymap_canadian_multilingual.h15
-rw-r--r--quantum/keymap_extras/keymap_colemak.h15
-rw-r--r--quantum/keymap_extras/keymap_dvorak.h15
-rw-r--r--quantum/keymap_extras/keymap_dvp.h16
-rw-r--r--quantum/keymap_extras/keymap_fr_ch.h15
-rw-r--r--quantum/keymap_extras/keymap_french.h19
-rw-r--r--quantum/keymap_extras/keymap_french_osx.h17
-rw-r--r--quantum/keymap_extras/keymap_german.h16
-rw-r--r--quantum/keymap_extras/keymap_german_ch.h15
-rw-r--r--quantum/keymap_extras/keymap_german_osx.h15
-rw-r--r--quantum/keymap_extras/keymap_jp.h17
-rw-r--r--quantum/keymap_extras/keymap_neo2.h15
-rw-r--r--quantum/keymap_extras/keymap_nordic.h15
-rw-r--r--quantum/keymap_extras/keymap_norwegian.h15
-rw-r--r--quantum/keymap_extras/keymap_plover.h15
-rw-r--r--quantum/keymap_extras/keymap_russian.h77
-rw-r--r--quantum/keymap_extras/keymap_spanish.h15
-rw-r--r--quantum/keymap_extras/keymap_uk.h15
-rw-r--r--quantum/keymap_extras/keymap_unicode_cyrillic.h163
-rwxr-xr-xquantum/light_ws2812.c19
-rwxr-xr-xquantum/light_ws2812.h14
-rw-r--r--quantum/matrix.c17
-rw-r--r--quantum/pincontrol.h15
-rw-r--r--quantum/process_keycode/process_audio.c62
-rw-r--r--quantum/process_keycode/process_audio.h11
-rw-r--r--quantum/process_keycode/process_chording.c18
-rw-r--r--quantum/process_keycode/process_chording.h18
-rw-r--r--quantum/process_keycode/process_combo.c150
-rw-r--r--quantum/process_keycode/process_combo.h59
-rw-r--r--quantum/process_keycode/process_leader.c18
-rw-r--r--quantum/process_keycode/process_leader.h18
-rw-r--r--quantum/process_keycode/process_midi.c307
-rw-r--r--quantum/process_keycode/process_midi.h243
-rw-r--r--quantum/process_keycode/process_music.c134
-rw-r--r--quantum/process_keycode/process_music.h24
-rw-r--r--quantum/process_keycode/process_printer.c18
-rw-r--r--quantum/process_keycode/process_printer.h18
-rw-r--r--quantum/process_keycode/process_printer_bb.c18
-rw-r--r--quantum/process_keycode/process_tap_dance.c24
-rw-r--r--quantum/process_keycode/process_tap_dance.h16
-rw-r--r--quantum/process_keycode/process_ucis.c149
-rw-r--r--quantum/process_keycode/process_ucis.h51
-rw-r--r--quantum/process_keycode/process_unicode.c272
-rw-r--r--quantum/process_keycode/process_unicode.h175
-rw-r--r--quantum/process_keycode/process_unicode_common.c115
-rw-r--r--quantum/process_keycode/process_unicode_common.h148
-rw-r--r--quantum/process_keycode/process_unicodemap.c72
-rw-r--r--quantum/process_keycode/process_unicodemap.h25
-rw-r--r--quantum/quantum.c252
-rw-r--r--quantum/quantum.h38
-rw-r--r--quantum/quantum_keycodes.h600
-rw-r--r--quantum/rgblight.c51
-rw-r--r--quantum/rgblight.h28
-rw-r--r--quantum/serial_link/LICENSE2
-rw-r--r--quantum/template/Makefile17
-rw-r--r--quantum/template/config.h27
-rw-r--r--quantum/template/keymaps/default/Makefile22
-rw-r--r--quantum/template/keymaps/default/config.h18
-rw-r--r--quantum/template/keymaps/default/keymap.c17
-rw-r--r--quantum/template/rules.mk3
-rw-r--r--quantum/template/template.c15
-rw-r--r--quantum/template/template.h17
-rw-r--r--quantum/variable_trace.c16
-rw-r--r--quantum/variable_trace.h16
-rw-r--r--quantum/visualizer/visualizer.c58
-rw-r--r--quantum/visualizer/visualizer.h9
92 files changed, 3688 insertions, 1554 deletions
diff --git a/quantum/analog.c b/quantum/analog.c
index 49b84ee0e8..1ec38df75d 100644
--- a/quantum/analog.c
+++ b/quantum/analog.c
@@ -1,3 +1,19 @@
+/* Copyright 2015 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 <http://www.gnu.org/licenses/>.
+ */
+
// Simple analog to digitial conversion
#include <avr/io.h>
diff --git a/quantum/analog.h b/quantum/analog.h
index 9b95a93bef..8d93de7dc2 100644
--- a/quantum/analog.h
+++ b/quantum/analog.h
@@ -1,3 +1,19 @@
+/* Copyright 2015 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 <http://www.gnu.org/licenses/>.
+ */
+
#ifndef _analog_h_included__
#define _analog_h_included__
diff --git a/quantum/api.c b/quantum/api.c
index 6a7c0a4332..52dfe23e17 100644
--- a/quantum/api.c
+++ b/quantum/api.c
@@ -1,3 +1,19 @@
+/* Copyright 2016 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 <http://www.gnu.org/licenses/>.
+ */
+
#include "api.h"
#include "quantum.h"
@@ -176,4 +192,4 @@ void process_api(uint16_t length, uint8_t * data) {
// #endif
}
-} \ No newline at end of file
+}
diff --git a/quantum/api.h b/quantum/api.h
index 00dcdb8954..efc0ddca12 100644
--- a/quantum/api.h
+++ b/quantum/api.h
@@ -1,3 +1,19 @@
+/* Copyright 2016 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 <http://www.gnu.org/licenses/>.
+ */
+
#ifndef _API_H_
#define _API_H_
@@ -56,4 +72,4 @@ 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
+#endif
diff --git a/quantum/api/api_sysex.c b/quantum/api/api_sysex.c
index a4a554e764..6a2ee90124 100644
--- a/quantum/api/api_sysex.c
+++ b/quantum/api/api_sysex.c
@@ -1,4 +1,21 @@
+/* Copyright 2016 Jack Humbert, Fred Sundvik
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
#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: ");
@@ -6,24 +23,50 @@ void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes,
// send_byte(bytes[i]);
// SEND_STRING(" ");
// }
- uint8_t * precode = malloc(sizeof(uint8_t) * (length + 2));
- precode[0] = message_type;
- precode[1] = data_type;
- memcpy(precode + 2, bytes, length);
- uint8_t * encoded = malloc(sizeof(uint8_t) * (sysex_encoded_length(length + 2)));
- uint16_t encoded_length = sysex_encode(encoded, precode, length + 2);
- uint8_t * array = malloc(sizeof(uint8_t) * (encoded_length + 5));
- array[0] = 0xF0;
- array[1] = 0x00;
- array[2] = 0x00;
- array[3] = 0x00;
- array[encoded_length + 4] = 0xF7;
- memcpy(array + 4, encoded, encoded_length);
- midi_send_array(&midi_device, encoded_length + 5, array);
+ 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(array[i]);
+ // send_byte(buffer[i]);
// SEND_STRING(" ");
// }
-} \ No newline at end of file
+}
diff --git a/quantum/api/api_sysex.h b/quantum/api/api_sysex.h
index b947b60e54..a23f00f572 100644
--- a/quantum/api/api_sysex.h
+++ b/quantum/api/api_sysex.h
@@ -1,3 +1,19 @@
+/* Copyright 2016 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 <http://www.gnu.org/licenses/>.
+ */
+
#ifndef _API_SYSEX_H_
#define _API_SYSEX_H_
@@ -7,4 +23,4 @@ void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes,
#define SEND_BYTES(mt, dt, b, l) send_bytes_sysex(mt, dt, b, l)
-#endif \ No newline at end of file
+#endif
diff --git a/quantum/audio/audio.c b/quantum/audio/audio.c
index 2a315fd168..597073611a 100644
--- a/quantum/audio/audio.c
+++ b/quantum/audio/audio.c
@@ -1,3 +1,18 @@
+/* Copyright 2016 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 <http://www.gnu.org/licenses/>.
+ */
#include <stdio.h>
#include <string.h>
//#include <math.h>
@@ -89,15 +104,15 @@ void audio_init()
}
audio_config.raw = eeconfig_read_audio();