diff options
author | Ryan <fauxpark@gmail.com> | 2021-10-06 19:34:46 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-06 19:34:46 +1100 |
commit | d8f0c8783a0da2e5f49d10bb0119a5be7bb4b261 (patch) | |
tree | c2e7a99d6cf3d67dd3ee60975865264d94c55ce6 | |
parent | a94c6fa620ce8daf6436773accec89965c675ce5 (diff) | |
download | qmk_firmware-d8f0c8783a0da2e5f49d10bb0119a5be7bb4b261.tar.gz qmk_firmware-d8f0c8783a0da2e5f49d10bb0119a5be7bb4b261.zip |
Remove sysex API (#14723)
-rw-r--r-- | common_features.mk | 8 | ||||
-rw-r--r-- | docs/faq_misc.md | 2 | ||||
-rw-r--r-- | docs/getting_started_make_guide.md | 4 | ||||
-rw-r--r-- | layouts/community/ergodox/jackhumbert/keymap.c | 5 | ||||
-rw-r--r-- | quantum/api.c | 182 | ||||
-rw-r--r-- | quantum/api.h | 55 | ||||
-rw-r--r-- | quantum/api/api_sysex.c | 72 | ||||
-rw-r--r-- | quantum/api/api_sysex.h | 25 | ||||
-rw-r--r-- | quantum/quantum.c | 23 | ||||
-rw-r--r-- | quantum/quantum.h | 2 | ||||
-rw-r--r-- | show_options.mk | 1 | ||||
-rw-r--r-- | tmk_core/protocol/lufa/lufa.h | 11 | ||||
-rw-r--r-- | tmk_core/protocol/midi/qmk_midi.c | 41 | ||||
-rw-r--r-- | users/nstickney/rules.mk | 1 |
14 files changed, 7 insertions, 425 deletions
diff --git a/common_features.mk b/common_features.mk index d7b0f826a..e3b42a961 100644 --- a/common_features.mk +++ b/common_features.mk | |||
@@ -46,14 +46,6 @@ else ifeq ($(strip $(DEBUG_MATRIX_SCAN_RATE_ENABLE)), api) | |||
46 | OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE | 46 | OPT_DEFS += -DDEBUG_MATRIX_SCAN_RATE |
47 | endif | 47 | endif |
48 | 48 | ||
49 | ifeq ($(strip $(API_SYSEX_ENABLE)), yes) | ||
50 | OPT_DEFS += -DAPI_SYSEX_ENABLE | ||
51 | OPT_DEFS += -DAPI_ENABLE | ||
52 | MIDI_ENABLE=yes | ||
53 | SRC += $(QUANTUM_DIR)/api/api_sysex.c | ||
54 | SRC += $(QUANTUM_DIR)/api.c | ||
55 | endif | ||
56 | |||
57 | ifeq ($(strip $(COMMAND_ENABLE)), yes) | 49 | ifeq ($(strip $(COMMAND_ENABLE)), yes) |
58 | SRC += $(QUANTUM_DIR)/command.c | 50 | SRC += $(QUANTUM_DIR)/command.c |
59 | OPT_DEFS += -DCOMMAND_ENABLE | 51 | OPT_DEFS += -DCOMMAND_ENABLE |
diff --git a/docs/faq_misc.md b/docs/faq_misc.md index 9ab2b69a8..41d17906b 100644 --- a/docs/faq_misc.md +++ b/docs/faq_misc.md | |||
@@ -36,7 +36,7 @@ Size after: | |||
36 | can retry, loading that one | 36 | can retry, loading that one |
37 | - Some of the options you might specify in your keyboard's Makefile | 37 | - Some of the options you might specify in your keyboard's Makefile |
38 | consume extra memory; watch out for BOOTMAGIC_ENABLE, | 38 | consume extra memory; watch out for BOOTMAGIC_ENABLE, |
39 | MOUSEKEY_ENABLE, EXTRAKEY_ENABLE, CONSOLE_ENABLE, API_SYSEX_ENABLE | 39 | MOUSEKEY_ENABLE, EXTRAKEY_ENABLE, CONSOLE_ENABLE |
40 | - DFU tools do /not/ allow you to write into the bootloader (unless | 40 | - DFU tools do /not/ allow you to write into the bootloader (unless |
41 | you throw in an extra fruit salad of options), so there is little risk | 41 | you throw in an extra fruit salad of options), so there is little risk |
42 | there. | 42 | there. |
diff --git a/docs/getting_started_make_guide.md b/docs/getting_started_make_guide.md index 70390a510..deef7520e 100644 --- a/docs/getting_started_make_guide.md +++ b/docs/getting_started_make_guide.md | |||
@@ -125,10 +125,6 @@ This allows you output audio on the C6 pin (needs abstracting). See the [audio p | |||
125 | 125 | ||
126 | Use this to debug changes to variable values, see the [tracing variables](unit_testing.md#tracing-variables) section of the Unit Testing page for more information. | 126 | Use this to debug changes to variable values, see the [tracing variables](unit_testing.md#tracing-variables) section of the Unit Testing page for more information. |
127 | 127 | ||
128 | `API_SYSEX_ENABLE` | ||
129 | |||
130 | This enables using the Quantum SYSEX API to send strings (somewhere?) | ||
131 | |||
132 | `KEY_LOCK_ENABLE` | 128 | `KEY_LOCK_ENABLE` |
133 | 129 | ||
134 | This enables [key lock](feature_key_lock.md). | 130 | This enables [key lock](feature_key_lock.md). |
diff --git a/layouts/community/ergodox/jackhumbert/keymap.c b/layouts/community/ergodox/jackhumbert/keymap.c index 745d632d0..9d357881e 100644 --- a/layouts/community/ergodox/jackhumbert/keymap.c +++ b/layouts/community/ergodox/jackhumbert/keymap.c | |||
@@ -85,11 +85,6 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) | |||
85 | eeconfig_init(); | 85 | eeconfig_init(); |
86 | } | 86 | } |
87 | break; | 87 | break; |
88 | case 2: | ||
89 | if (record->event.pressed) { // For resetting EEPROM | ||
90 | api_send_unicode(0x0CA0); | ||
91 | } | ||
92 | break; | ||
93 | } | 88 | } |
94 | return MACRO_NONE; | 89 | return MACRO_NONE; |
95 | }; | 90 | }; |
diff --git a/quantum/api.c b/quantum/api.c deleted file mode 100644 index 168574458..000000000 --- a/quantum/api.c +++ /dev/null | |||
@@ -1,182 +0,0 @@ | |||
1 | /* Copyright 2016 Jack Humbert | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #include "api.h" | ||
18 | #include "quantum.h" | ||
19 | |||
20 | void dword_to_bytes(uint32_t dword, uint8_t* bytes) { | ||
21 | bytes[0] = (dword >> 24) & 0xFF; | ||
22 | bytes[1] = (dword >> 16) & 0xFF; | ||
23 | bytes[2] = (dword >> 8) & 0xFF; | ||
24 | bytes[3] = (dword >> 0) & 0xFF; | ||
25 | } | ||
26 | |||
27 | 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]; } | ||
28 | |||
29 | __attribute__((weak)) bool process_api_quantum(uint8_t length, uint8_t* data) { return process_api_keyboard(length, data); } | ||
30 | |||
31 | __attribute__((weak)) bool process_api_keyboard(uint8_t length, uint8_t* data) { return process_api_user(length, data); } | ||
32 | |||
33 | __attribute__((weak)) bool process_api_user(uint8_t length, uint8_t* data) { return true; } | ||
34 | |||
35 | void process_api(uint16_t length, uint8_t* data) { | ||
36 | // SEND_STRING("\nRX: "); | ||
37 | // for (uint8_t i = 0; i < length; i++) { | ||
38 | // send_byte(data[i]); | ||
39 | // SEND_STRING(" "); | ||
40 | // } | ||
41 | if (!process_api_quantum(length, data)) return; | ||
42 | |||
43 | switch (data[0]) { | ||
44 | case MT_SET_DATA: | ||
45 | switch (data[1]) { | ||
46 | case DT_DEFAULT_LAYER: { | ||
47 | eeconfig_update_default_layer(data[2]); | ||
48 | default_layer_set((uint32_t)(data[2])); | ||
49 | break; | ||
50 | } | ||
51 | case DT_KEYMAP_OPTIONS: { | ||
52 | eeconfig_update_keymap(data[2]); | ||
53 | break; | ||
54 | } | ||
55 | case DT_RGBLIGHT: { | ||
56 | #ifdef RGBLIGHT_ENABLE | ||
57 | uint32_t rgblight = bytes_to_dword(data, 2); | ||
58 | eeconfig_update_rgblight(rgblight); | ||
59 | #endif | ||
60 | break; | ||
61 | } | ||
62 | } | ||
63 | case MT_GET_DATA: | ||
64 | switch (data[1]) { | ||
65 | case DT_HANDSHAKE: { | ||
66 | MT_GET_DATA_ACK(DT_HANDSHAKE, NULL, 0); | ||
67 | break; | ||
68 | } | ||
69 | case DT_DEBUG: { | ||
70 | uint8_t debug_bytes[1] = {eeprom_read_byte(EECONFIG_DEBUG)}; | ||
71 | MT_GET_DATA_ACK(DT_DEBUG, debug_bytes, 1); | ||
72 | break; | ||
73 | } | ||
74 | case DT_DEFAULT_LAYER: { | ||
75 | uint8_t default_bytes[1] = {eeprom_read_byte(EECONFIG_DEFAULT_LAYER)}; | ||
76 | MT_GET_DATA_ACK(DT_DEFAULT_LAYER, default_bytes, 1); | ||
77 | break; | ||
78 | } | ||
79 | case DT_CURRENT_LAYER: { | ||
80 | uint8_t layer_state_bytes[4]; | ||
81 | dword_to_bytes(layer_state, layer_state_bytes); | ||
82 | MT_GET_DATA_ACK(DT_CURRENT_LAYER, layer_state_bytes, 4); | ||
83 | break; | ||
84 | } | ||
85 | case DT_AUDIO: { | ||
86 | #ifdef AUDIO_ENABLE | ||
87 | uint8_t audio_bytes[1] = {eeprom_read_byte(EECONFIG_AUDIO)}; | ||
88 | MT_GET_DATA_ACK(DT_AUDIO, audio_bytes, 1); | ||
89 | #else | ||
90 | MT_GET_DATA_ACK(DT_AUDIO, NULL, 0); | ||
91 | #endif | ||
92 | break; | ||
93 | } | ||
94 | case DT_BACKLIGHT: { | ||
95 | #ifdef BACKLIGHT_ENABLE | ||
96 | uint8_t backlight_bytes[1] = {eeprom_read_byte(EECONFIG_BACKLIGHT)}; | ||
97 | MT_GET_DATA_ACK(DT_BACKLIGHT, backlight_bytes, 1); | ||
98 | #else | ||
99 | MT_GET_DATA_ACK(DT_BACKLIGHT, NULL, 0); | ||
100 | #endif | ||
101 | break; | ||
102 | } | ||
103 | case DT_RGBLIGHT: { | ||
104 | #ifdef RGBLIGHT_ENABLE | ||
105 | uint8_t rgblight_bytes[4]; | ||
106 | dword_to_bytes(eeconfig_read_rgblight(), rgblight_bytes); | ||
107 | MT_GET_DATA_ACK(DT_RGBLIGHT, rgblight_bytes, 4); | ||
108 | #else | ||
109 | MT_GET_DATA_ACK(DT_RGBLIGHT, NULL, 0); | ||
110 | #endif | ||
111 | break; | ||
112 | } | ||
113 | case DT_KEYMAP_OPTIONS: { | ||
114 | uint8_t keymap_bytes[1] = {eeconfig_read_keymap()}; | ||
115 | MT_GET_DATA_ACK(DT_KEYMAP_OPTIONS, keymap_bytes, 1); | ||
116 | break; | ||
117 | } | ||
118 | case DT_KEYMAP_SIZE: { | ||
119 | uint8_t keymap_size[2] = {MATRIX_ROWS, MATRIX_COLS}; | ||
120 | MT_GET_DATA_ACK(DT_KEYMAP_SIZE, keymap_size, 2); | ||
121 | break; | ||
122 | } | ||
123 | // This may be too much | ||
124 | // case DT_KEYMAP: { | ||
125 | // uint8_t keymap_data[MATRIX_ROWS * MATRIX_COLS * 4 + 3]; | ||
126 | // keymap_data[0] = data[2]; | ||
127 | // keymap_data[1] = MATRIX_ROWS; | ||
128 | // keymap_data[2] = MATRIX_COLS; | ||
129 | // for (int i = 0; i < MATRIX_ROWS; i++) { | ||
130 | // for (int j = 0; j < MATRIX_COLS; j++) { | ||
131 | // keymap_data[3 + (i*MATRIX_COLS*2) + (j*2)] = pgm_read_word(&keymaps[data[2]][i][j]) >> 8; | ||
132 | // keymap_data[3 + (i*MATRIX_COLS*2) + (j*2) + 1] = pgm_read_word(&keymaps[data[2]][i][j]) & 0xFF; | ||
133 | // } | ||
134 | // } | ||
135 | // MT_GET_DATA_ACK(DT_KEYMAP, keymap_data, MATRIX_ROWS * MATRIX_COLS * 4 + 3); | ||
136 | // // uint8_t keymap_data[5]; | ||
137 | // // keymap_data[0] = data[2]; | ||
138 | // // keymap_data[1] = data[3]; | ||
139 | // // keymap_data[2] = data[4]; | ||
140 | // // keymap_data[3] = pgm_read_word(&keymaps[data[2]][data[3]][data[4]]) >> 8; | ||
141 | // // keymap_data[4] = pgm_read_word(&keymaps[data[2]][data[3]][data[4]]) & 0xFF; | ||
142 | |||
143 | // // MT_GET_DATA_ACK(DT_KEYMAP, keymap_data, 5); | ||
144 | // break; | ||
145 | // } | ||
146 | default: | ||
147 | break; | ||
148 | } | ||
149 | break; | ||
150 | case MT_SET_DATA_ACK: | ||
151 | case MT_GET_DATA_ACK: | ||
152 | break; | ||
153 | case MT_SEND_DATA: | ||
154 | break; | ||
155 | case MT_SEND_DATA_ACK: | ||
156 | break; | ||
157 | case MT_EXE_ACTION: | ||
158 | break; | ||
159 | case MT_EXE_ACTION_ACK: | ||
160 | break; | ||
161 | case MT_TYPE_ERROR: | ||
162 | break; | ||
163 | default:; // command not recognised | ||
164 | SEND_BYTES(MT_TYPE_ERROR, DT_NONE, data, length); | ||
165 | break; | ||
166 | |||
167 | // #ifdef RGBLIGHT_ENABLE | ||
168 | // case 0x27: ; // RGB LED functions | ||
169 | // switch (*data++) { | ||
170 | // case 0x00: ; // Update HSV | ||
171 | // rgblight_sethsv((data[0] << 8 | data[1]) % 360, data[2], data[3]); | ||
172 | // break; | ||
173 | // case 0x01: ; // Update RGB | ||
174 | // break; | ||
175 | // case 0x02: ; // Update mode | ||
176 | // rgblight_mode(data[0]); | ||
177 | // break; | ||
178 | // } | ||
179 | // break; | ||
180 | // #endif | ||
181 | } | ||
182 | } | ||
diff --git a/quantum/api.h b/quantum/api.h deleted file mode 100644 index 0a30e9d6c..000000000 --- a/quantum/api.h +++ /dev/null | |||
@@ -1,55 +0,0 @@ | |||
1 | /* Copyright 2016 Jack Humbert | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #pragma once | ||
18 | |||
19 | #ifdef __AVR__ | ||
20 | # include "lufa.h" | ||
21 | #endif | ||
22 | |||
23 | enum MESSAGE_TYPE { | ||
24 | MT_GET_DATA = 0x10, // Get data from keyboard | ||
25 | MT_GET_DATA_ACK = 0x11, // returned data to process (ACK) | ||
26 | MT_SET_DATA = 0x20, // Set data on keyboard | ||
27 | MT_SET_DATA_ACK = 0x21, // returned data to confirm (ACK) | ||
28 | MT_SEND_DATA = 0x30, // Sending data/action from keyboard | ||
29 | MT_SEND_DATA_ACK = 0x31, // returned data/action confirmation (ACK) | ||
30 | MT_EXE_ACTION = 0x40, // executing actions on keyboard | ||
31 | MT_EXE_ACTION_ACK = 0x41, // return confirmation/value (ACK) | ||
32 | MT_TYPE_ERROR = 0x80 // type not recognised (ACK) | ||
33 | }; | ||
34 | |||
35 | 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 }; | ||
36 | |||
37 | void dword_to_bytes(uint32_t dword, uint8_t* bytes); | ||
38 | uint32_t bytes_to_dword(uint8_t* bytes, uint8_t index); | ||
39 | |||
40 | #define MT_GET_DATA(data_type, data, length) SEND_BYTES(MT_GET_DATA, data_type, data, length) | ||
41 | #define MT_GET_DATA_ACK(data_type, data, length) SEND_BYTES(MT_GET_DATA_ACK, data_type, data, length) | ||
42 | #define MT_SET_DATA(data_type, data, length) SEND_BYTES(MT_SET_DATA, data_type, data, length) | ||
43 | #define MT_SET_DATA_ACK(data_type, data, length) SEND_BYTES(MT_SET_DATA_ACK, data_type, data, length) | ||
44 | #define MT_SEND_DATA(data_type, data, length) SEND_BYTES(MT_SEND_DATA, data_type, data, length) | ||
45 | #define MT_SEND_DATA_ACK(data_type, data, length) SEND_BYTES(MT_SEND_DATA_ACK, data_type, data, length) | ||
46 | #define MT_EXE_ACTION(data_type, data, length) SEND_BYTES(MT_EXE_ACTION, data_type, data, length) | ||
47 | #define MT_EXE_ACTION_ACK(data_type, data, length) SEND_BYTES(MT_EXE_ACTION_ACK, data_type, data, length) | ||
48 | |||
49 | void process_api(uint16_t length, uint8_t* data); | ||
50 | |||
51 | __attribute__((weak)) bool process_api_quantum(uint8_t length, uint8_t* data); | ||
52 | |||
53 | __attribute__((weak)) bool process_api_keyboard(uint8_t length, uint8_t* data); | ||
54 | |||
55 | __attribute__((weak)) bool process_api_user(uint8_t length, uint8_t* data); | ||
diff --git a/quantum/api/api_sysex.c b/quantum/api/api_sysex.c deleted file mode 100644 index 07c90cf80..000000000 --- a/quantum/api/api_sysex.c +++ /dev/null | |||
@@ -1,72 +0,0 @@ | |||
1 | /* Copyright 2016 Jack Humbert, Fred Sundvik | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | #include "api_sysex.h" | ||
17 | #include "sysex_tools.h" | ||
18 | #include "print.h" | ||
19 | #include "qmk_midi.h" | ||
20 | |||
21 | void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t* bytes, uint16_t length) { | ||
22 | // SEND_STRING("\nTX: "); | ||
23 | // for (uint8_t i = 0; i < length; i++) { | ||
24 | // send_byte(bytes[i]); | ||
25 | // SEND_STRING(" "); | ||
26 | // } | ||
27 | if (length > API_SYSEX_MAX_SIZE) { | ||
28 | xprintf("Sysex msg too big %d %d %d", message_type, data_type, length); | ||
29 | return; | ||
30 | } | ||
31 | |||
32 | // The buffer size required is calculated as the following | ||
33 | // API_SYSEX_MAX_SIZE is the maximum length | ||
34 | // In addition to that we have a two byte message header consisting of the message_type and data_type | ||
35 | // This has to be encoded with an additional overhead of one byte for every starting 7 bytes | ||
36 | // We just add one extra byte in case it's not divisible by 7 | ||
37 | // Then we have an unencoded header consisting of 4 bytes | ||
38 | // Plus a one byte terminator | ||
39 | const unsigned message_header = 2; | ||
40 | const unsigned unencoded_message = API_SYSEX_MAX_SIZE + message_header; | ||
41 | const unsigned encoding_overhead = unencoded_message / 7 + 1; | ||
42 | const unsigned encoded_size = unencoded_message + encoding_overhead; | ||
43 | const unsigned unencoded_header = 4; | ||
44 | const unsigned terminator = 1; | ||
45 | const unsigned buffer_size = encoded_size + unencoded_header + terminator; | ||
46 | uint8_t buffer[encoded_size + unencoded_header + terminator]; | ||
47 | // The unencoded header | ||
48 | buffer[0] = 0xF0; | ||
49 | buffer[1] = 0x00; | ||
50 | buffer[2] = 0x00; | ||
51 | buffer[3] = 0x00; | ||
52 | |||
53 | // We copy the message to the end of the array, this way we can do an inplace encoding, using the same | ||
54 | // buffer for both input and output | ||
55 | const unsigned message_size = length + message_header; | ||
56 | uint8_t* unencoded_start = buffer + buffer_size - message_size; | ||
57 | uint8_t* ptr = unencoded_start; | ||
58 | *(ptr++) = message_type; | ||
59 | *(ptr++) = data_type; | ||
60 | memcpy(ptr, bytes, length); | ||
61 | |||
62 | unsigned encoded_length = sysex_encode(buffer + unencoded_header, unencoded_start, message_size); | ||
63 | unsigned final_size = unencoded_header + encoded_length + terminator; | ||
64 | buffer[final_size - 1] = 0xF7; | ||
65 | midi_send_array(&midi_device, final_size, buffer); | ||
66 | |||
67 | // SEND_STRING("\nTD: "); | ||
68 | // for (uint8_t i = 0; i < encoded_length + 5; i++) { | ||
69 | // send_byte(buffer[i]); | ||
70 | // SEND_STRING(" "); | ||
71 | // } | ||
72 | } | ||
diff --git a/quantum/api/api_sysex.h b/quantum/api/api_sysex.h deleted file mode 100644 index eb0a18848..000000000 --- a/quantum/api/api_sysex.h +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | /* Copyright 2016 Jack Humbert | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #pragma once | ||
18 | |||
19 | #include "api.h" | ||
20 | |||
21 | #define API_SYSEX_MAX_SIZE 32 | ||
22 | |||
23 | void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t* bytes, uint16_t length); | ||
24 | |||
25 | #define SEND_BYTES(mt, dt, b, l) send_bytes_sysex(mt, dt, b, l) | ||
diff --git a/quantum/quantum.c b/quantum/quantum.c index 326c8370b..ac8857df8 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
@@ -25,10 +25,6 @@ | |||
25 | # include "backlight.h" | 25 | # include "backlight.h" |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #ifdef API_ENABLE | ||
29 | # include "api.h" | ||
30 | #endif | ||
31 | |||
32 | #ifdef MIDI_ENABLE | 28 | #ifdef MIDI_ENABLE |
33 | # include "process_midi.h" | 29 | # include "process_midi.h" |
34 | #endif | 30 | #endif |
@@ -145,12 +141,13 @@ void reset_keyboard(void) { | |||
145 | /* Convert record into usable keycode via the contained event. */ | 141 | /* Convert record into usable keycode via the contained event. */ |
146 | uint16_t get_record_keycode(keyrecord_t *record, bool update_layer_cache) { | 142 | uint16_t get_record_keycode(keyrecord_t *record, bool update_layer_cache) { |
147 | #ifdef COMBO_ENABLE | 143 | #ifdef COMBO_ENABLE |
148 | if (record->keycode) { return record->keycode; } | 144 | if (record->keycode) { |
145 | return record->keycode; | ||
146 | } | ||
149 | #endif | 147 | #endif |
150 | return get_event_keycode(record->event, update_layer_cache); | 148 | return get_event_keycode(record->event, update_layer_cache); |
151 | } | 149 | } |
152 | 150 | ||
153 | |||
154 | /* Convert event into usable keycode. Checks the layer cache to ensure that it | 151 | /* Convert event into usable keycode. Checks the layer cache to ensure that it |
155 | * retains the correct keycode after a layer change, if the key is still pressed. | 152 | * retains the correct keycode after a layer change, if the key is still pressed. |
156 | * "update_layer_cache" is to ensure that it only updates the layer cache when | 153 | * "update_layer_cache" is to ensure that it only updates the layer cache when |
@@ -179,12 +176,12 @@ uint16_t get_event_keycode(keyevent_t event, bool update_layer_cache) { | |||
179 | bool pre_process_record_quantum(keyrecord_t *record) { | 176 | bool pre_process_record_quantum(keyrecord_t *record) { |
180 | if (!( | 177 | if (!( |
181 | #ifdef COMBO_ENABLE | 178 | #ifdef COMBO_ENABLE |
182 | process_combo(get_record_keycode(record, true), record) && | 179 | process_combo(get_record_keycode(record, true), record) && |
183 | #endif | 180 | #endif |
184 | true)) { | 181 | true)) { |
185 | return false; | 182 | return false; |
186 | } | 183 | } |
187 | return true; // continue processing | 184 | return true; // continue processing |
188 | } | 185 | } |
189 | 186 | ||
190 | /* Get keycode, and then call keyboard function */ | 187 | /* Get keycode, and then call keyboard function */ |
@@ -468,14 +465,6 @@ void matrix_scan_quantum() { | |||
468 | # include "hd44780.h" | 465 | # include "hd44780.h" |
469 | #endif | 466 | #endif |
470 | 467 | ||
471 | void api_send_unicode(uint32_t unicode) { | ||
472 | #ifdef API_ENABLE | ||
473 | uint8_t chunk[4]; | ||
474 | dword_to_bytes(unicode, chunk); | ||
475 | MT_SEND_DATA(DT_UNICODE, chunk, 5); | ||
476 | #endif | ||
477 | } | ||
478 | |||
479 | //------------------------------------------------------------------------------ | 468 | //------------------------------------------------------------------------------ |
480 | // Override these functions in your keymap file to play different tunes on | 469 | // Override these functions in your keymap file to play different tunes on |
481 | // different events such as startup and bootloader jump | 470 | // different events such as startup and bootloader jump |
diff --git a/quantum/quantum.h b/quantum/quantum.h index 5cbe84d0c..9250f5acc 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h | |||
@@ -237,5 +237,3 @@ void led_set_user(uint8_t usb_led); | |||
237 | void led_set_kb(uint8_t usb_led); | 237 | void led_set_kb(uint8_t usb_led); |
238 | bool led_update_user(led_t led_state); | 238 | bool led_update_user(led_t led_state); |
239 | bool led_update_kb(led_t led_state); | 239 | bool led_update_kb(led_t led_state); |
240 | |||
241 | void api_send_unicode(uint32_t unicode); | ||
diff --git a/show_options.mk b/show_options.mk index 2cae1cfa1..35fca9c6b 100644 --- a/show_options.mk +++ b/show_options.mk | |||
@@ -40,7 +40,6 @@ OTHER_OPTION_NAMES = \ | |||
40 | UCIS_ENABLE \ | 40 | UCIS_ENABLE \ |
41 | UNICODEMAP_ENABLE \ | 41 | UNICODEMAP_ENABLE \ |
42 | UNICODE_COMMON \ | 42 | UNICODE_COMMON \ |
43 | API_SYSEX_ENABLE \ | ||
44 | AUTO_SHIFT_ENABLE \ | 43 | AUTO_SHIFT_ENABLE \ |
45 | AUTO_SHIFT_MODIFIERS \ | 44 | AUTO_SHIFT_MODIFIERS \ |
46 | COMBO_ENABLE \ | 45 | COMBO_ENABLE \ |
diff --git a/tmk_core/protocol/lufa/lufa.h b/tmk_core/protocol/lufa/lufa.h index 348a84c03..6a5205609 100644 --- a/tmk_core/protocol/lufa/lufa.h +++ b/tmk_core/protocol/lufa/lufa.h | |||
@@ -56,14 +56,3 @@ extern host_driver_t lufa_driver; | |||
56 | #ifdef __cplusplus | 56 | #ifdef __cplusplus |
57 | } | 57 | } |
58 | #endif | 58 | #endif |
59 | |||
60 | #ifdef API_ENABLE | ||
61 | # include "api.h" | ||
62 | #endif | ||
63 | |||
64 | #ifdef API_SYSEX_ENABLE | ||
65 | # include "api_sysex.h" | ||
66 | // Allocate space for encoding overhead. | ||
67 | // The header and terminator are not stored to save a few bytes of precious ram | ||
68 | # define MIDI_SYSEX_BUFFER (API_SYSEX_MAX_SIZE + API_SYSEX_MAX_SIZE / 7 + (API_SYSEX_MAX_SIZE % 7 ? 1 : 0)) | ||
69 | #endif | ||
diff --git a/tmk_core/protocol/midi/qmk_midi.c b/tmk_core/protocol/midi/qmk_midi.c index c18dbf993..3a454d61a 100644 --- a/tmk_core/protocol/midi/qmk_midi.c +++ b/tmk_core/protocol/midi/qmk_midi.c | |||
@@ -4,9 +4,6 @@ | |||
4 | #include "midi.h" | 4 | #include "midi.h" |
5 | #include "usb_descriptor.h" | 5 | #include "usb_descriptor.h" |
6 | #include "process_midi.h" | 6 | #include "process_midi.h" |
7 | #if API_SYSEX_ENABLE | ||
8 | # include "api_sysex.h" | ||
9 | #endif | ||
10 | 7 | ||
11 | /******************************************************************************* | 8 | /******************************************************************************* |
12 | * MIDI | 9 | * MIDI |
@@ -124,41 +121,6 @@ static void cc_callback(MidiDevice* device, uint8_t chan, uint8_t num, uint8_t v | |||
124 | // midi_send_cc(device, (chan + 1) % 16, num, val); | 121 | // midi_send_cc(device, (chan + 1) % 16, num, val); |
125 | } | 122 | } |
126 | 123 | ||
127 | #ifdef API_SYSEX_ENABLE | ||
128 | uint8_t midi_buffer[MIDI_SYSEX_BUFFER] = {0}; | ||
129 | |||
130 | static void sysex_callback(MidiDevice* device, uint16_t start, uint8_t length, uint8_t* data) { | ||
131 | // SEND_STRING("\n"); | ||
132 | // send_word(start); | ||
133 | // SEND_STRING(": "); | ||
134 | // Don't store the header | ||
135 | int16_t pos = start - 4; | ||
136 | for (uint8_t place = 0; place < length; place++) { | ||
137 | // send_byte(*data); | ||
138 | if (pos >= 0) { | ||
139 | if (*data == 0xF7) { | ||
140 | // SEND_STRING("\nRD: "); | ||
141 | // for (uint8_t i = 0; i < start + place + 1; i++){ | ||
142 | // send_byte(midi_buffer[i]); | ||
143 | // SEND_STRING(" "); | ||
144 | // } | ||
145 | const unsigned decoded_length = sysex_decoded_length(pos); | ||
146 | uint8_t decoded[API_SYSEX_MAX_SIZE]; | ||
147 | sysex_decode(decoded, midi_buffer, pos); | ||
148 | process_api(decoded_length, decoded); | ||
149 | return; | ||
150 | } else if (pos >= MIDI_SYSEX_BUFFER) { | ||
151 | return; | ||
152 | } | ||
153 | midi_buffer[pos] = *data; | ||
154 | } | ||
155 | // SEND_STRING(" "); | ||
156 | data++; | ||
157 | pos++; | ||
158 | } | ||
159 | } | ||
160 | #endif | ||
161 | |||
162 | void midi_init(void); | 124 | void midi_init(void); |
163 | 125 | ||
164 | void setup_midi(void) { | 126 | void setup_midi(void) { |
@@ -170,7 +132,4 @@ void setup_midi(void) { | |||
170 | midi_device_set_pre_input_process_func(&midi_device, usb_get_midi); | 132 | midi_device_set_pre_input_process_func(&midi_device, usb_get_midi); |
171 | midi_register_fallthrough_callback(&midi_device, fallthrough_callback); | 133 | midi_register_fallthrough_callback(&midi_device, fallthrough_callback); |
172 | midi_register_cc_callback(&midi_device, cc_callback); | 134 | midi_register_cc_callback(&midi_device, cc_callback); |
173 | #ifdef API_SYSEX_ENABLE | ||
174 | midi_register_sysex_callback(&midi_device, sysex_callback); | ||
175 | #endif | ||
176 | } | 135 | } |
diff --git a/users/nstickney/rules.mk b/users/nstickney/rules.mk index 0f189e8a4..6b3671ddb 100644 --- a/users/nstickney/rules.mk +++ b/users/nstickney/rules.mk | |||
@@ -25,7 +25,6 @@ UCIS_ENABLE = no | |||
25 | LTO_ENABLE = yes | 25 | LTO_ENABLE = yes |
26 | 26 | ||
27 | # https://beta.docs.qmk.fm/developing-qmk/qmk-reference/getting_started_make_guide#rules-mk-options | 27 | # https://beta.docs.qmk.fm/developing-qmk/qmk-reference/getting_started_make_guide#rules-mk-options |
28 | API_SYSEX_ENABLE = no | ||
29 | AUDIO_ENABLE = no | 28 | AUDIO_ENABLE = no |
30 | BOOTMAGIC_ENABLE = no | 29 | BOOTMAGIC_ENABLE = no |
31 | COMMAND_ENABLE = no | 30 | COMMAND_ENABLE = no |