summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
authorZay950 <Zay950@users.noreply.github.com>2017-03-29 12:00:38 -0700
committerGitHub <noreply@github.com>2017-03-29 12:00:38 -0700
commit2366ebfbbdeb6ec29cc9a0facda44d666305dd6e (patch)
tree883efed0b7260f3143f5a2a879bc3844a8255e0b /quantum
parent80c5ada3394c5ad8087df00ef878eb2cbcd87d70 (diff)
parent942f2ccee44bdb2e251553e9730cd8d59307d8b2 (diff)
Merge branch 'master' into to_push
Diffstat (limited to 'quantum')
-rw-r--r--quantum/analog.c16
-rw-r--r--quantum/analog.h16
-rw-r--r--quantum/api.c195
-rw-r--r--quantum/api.h75
-rw-r--r--quantum/api/api_sysex.c72
-rw-r--r--quantum/api/api_sysex.h26
-rw-r--r--quantum/audio/audio.c334
-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.h42
-rw-r--r--quantum/audio/voices.c137
-rw-r--r--quantum/audio/voices.h21
-rw-r--r--quantum/audio/wave.h18
-rw-r--r--quantum/config_common.h169
-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.h311
-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.h74
-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.h77
-rw-r--r--quantum/keymap_extras/keymap_neo2.h15
-rw-r--r--quantum/keymap_extras/keymap_nordic.h17
-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.c164
-rwxr-xr-xquantum/light_ws2812.h28
-rw-r--r--quantum/matrix.c331
-rw-r--r--quantum/pincontrol.h52
-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.c141
-rw-r--r--quantum/process_keycode/process_music.h24
-rw-r--r--quantum/process_keycode/process_printer.c270
-rw-r--r--quantum/process_keycode/process_printer.h24
-rw-r--r--quantum/process_keycode/process_printer_bb.c276
-rw-r--r--quantum/process_keycode/process_tap_dance.c22
-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.c196
-rw-r--r--quantum/process_keycode/process_unicode.h174
-rw-r--r--quantum/process_keycode/process_unicode_common.c101
-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.c313
-rw-r--r--quantum/quantum.h47
-rw-r--r--quantum/quantum_keycodes.h600
-rw-r--r--quantum/rgblight.c211
-rw-r--r--quantum/rgblight.h44
-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.h15
-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, 5330 insertions, 1705 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
new file mode 100644
index 0000000000..52dfe23e17
--- /dev/null
+++ b/quantum/api.c
@@ -0,0 +1,195 @@
+/* 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"
+
+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
+ }
+
+}
diff --git a/quantum/api.h b/quantum/api.h
new file mode 100644
index 0000000000..efc0ddca12
--- /dev/null
+++ b/quantum/api.h
@@ -0,0 +1,75 @@
+/* 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_
+
+#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_t