diff options
| -rw-r--r-- | keyboards/ergodox/infinity/rules.mk | 2 | ||||
| -rw-r--r-- | keyboards/ergodox/keymaps/jack/Makefile | 4 | ||||
| -rw-r--r-- | quantum/quantum.c | 9 | ||||
| -rw-r--r-- | quantum/quantum.h | 2 | ||||
| -rw-r--r-- | tmk_core/protocol/lufa/lufa.c | 49 | ||||
| -rw-r--r-- | tmk_core/protocol/lufa/lufa.h | 42 |
6 files changed, 56 insertions, 52 deletions
diff --git a/keyboards/ergodox/infinity/rules.mk b/keyboards/ergodox/infinity/rules.mk index ccb735a48..473a6dfec 100644 --- a/keyboards/ergodox/infinity/rules.mk +++ b/keyboards/ergodox/infinity/rules.mk | |||
| @@ -63,6 +63,8 @@ VISUALIZER_ENABLE ?= no #temporarily disabled to make everything compile | |||
| 63 | LCD_ENABLE ?= yes | 63 | LCD_ENABLE ?= yes |
| 64 | LED_ENABLE ?= yes | 64 | LED_ENABLE ?= yes |
| 65 | LCD_BACKLIGHT_ENABLE ?= yes | 65 | LCD_BACKLIGHT_ENABLE ?= yes |
| 66 | MIDI_ENABLE = no | ||
| 67 | RGBLIGHT_ENABLE = no | ||
| 66 | 68 | ||
| 67 | ifndef QUANTUM_DIR | 69 | ifndef QUANTUM_DIR |
| 68 | include ../../../Makefile | 70 | include ../../../Makefile |
diff --git a/keyboards/ergodox/keymaps/jack/Makefile b/keyboards/ergodox/keymaps/jack/Makefile index 7c257af50..3ca69bb92 100644 --- a/keyboards/ergodox/keymaps/jack/Makefile +++ b/keyboards/ergodox/keymaps/jack/Makefile | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | RGBLIGHT_ENABLE = yes | 1 | RGBLIGHT_ENABLE ?= yes |
| 2 | MIDI_ENABLE = yes | 2 | MIDI_ENABLE ?= yes |
| 3 | 3 | ||
| 4 | ifndef QUANTUM_DIR | 4 | ifndef QUANTUM_DIR |
| 5 | include ../../../../Makefile | 5 | include ../../../../Makefile |
diff --git a/quantum/quantum.c b/quantum/quantum.c index f9f1ef22d..8372a7adc 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
| @@ -847,8 +847,13 @@ void send_nibble(uint8_t number) { | |||
| 847 | } | 847 | } |
| 848 | } | 848 | } |
| 849 | 849 | ||
| 850 | 850 | void send_unicode_midi(uint32_t unicode) { | |
| 851 | 851 | #ifdef MIDI_ENABLE | |
| 852 | uint8_t chunk[4]; | ||
| 853 | dword_to_bytes(unicode, chunk); | ||
| 854 | MT_SEND_DATA(DT_UNICODE, chunk, 5); | ||
| 855 | #endif | ||
| 856 | } | ||
| 852 | 857 | ||
| 853 | __attribute__ ((weak)) | 858 | __attribute__ ((weak)) |
| 854 | void led_set_user(uint8_t usb_led) { | 859 | void led_set_user(uint8_t usb_led) { |
diff --git a/quantum/quantum.h b/quantum/quantum.h index 3d35f11fa..316da15b9 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h | |||
| @@ -119,4 +119,6 @@ void send_nibble(uint8_t number); | |||
| 119 | void led_set_user(uint8_t usb_led); | 119 | void led_set_user(uint8_t usb_led); |
| 120 | void led_set_kb(uint8_t usb_led); | 120 | void led_set_kb(uint8_t usb_led); |
| 121 | 121 | ||
| 122 | void send_unicode_midi(uint32_t unicode); | ||
| 123 | |||
| 122 | #endif | 124 | #endif |
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index c3234b8ce..eae3e8f29 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c | |||
| @@ -72,7 +72,7 @@ | |||
| 72 | #include "virtser.h" | 72 | #include "virtser.h" |
| 73 | #endif | 73 | #endif |
| 74 | 74 | ||
| 75 | #ifdef RGB_MIDI | 75 | #if (defined(RGB_MIDI) | defined(RGBLIGHT_ANIMATIONS)) & defined(RGBLIGHT_ENABLE) |
| 76 | #include "rgblight.h" | 76 | #include "rgblight.h" |
| 77 | #endif | 77 | #endif |
| 78 | 78 | ||
| @@ -1156,35 +1156,6 @@ uint32_t bytes_to_dword(uint8_t * bytes, uint8_t index) { | |||
| 1156 | return ((uint32_t)bytes[index + 0] << 24) | ((uint32_t)bytes[index + 1] << 16) | ((uint32_t)bytes[index + 2] << 8) | (uint32_t)bytes[index + 3]; | 1156 | return ((uint32_t)bytes[index + 0] << 24) | ((uint32_t)bytes[index + 1] << 16) | ((uint32_t)bytes[index + 2] << 8) | (uint32_t)bytes[index + 3]; |
| 1157 | } | 1157 | } |
| 1158 | 1158 | ||
| 1159 | enum MESSAGE_TYPE { | ||
| 1160 | MT_GET_DATA = 0x10, // Get data from keyboard | ||
| 1161 | MT_GET_DATA_ACK = 0x11, // returned data to process (ACK) | ||
| 1162 | MT_SET_DATA = 0x20, // Set data on keyboard | ||
| 1163 | MT_SET_DATA_ACK = 0x21, // returned data to confirm (ACK) | ||
| 1164 | MT_SEND_DATA = 0x30, // Sending data/action from keyboard | ||
| 1165 | MT_SEND_DATA_ACK = 0x31, // returned data/action confirmation (ACK) | ||
| 1166 | MT_EXE_ACTION = 0x40, // executing actions on keyboard | ||
| 1167 | MT_EXE_ACTION_ACK =0x41, // return confirmation/value (ACK) | ||
| 1168 | MT_TYPE_ERROR = 0x80 // type not recofgnised (ACK) | ||
| 1169 | }; | ||
| 1170 | |||
| 1171 | enum DATA_TYPE { | ||
| 1172 | DT_NONE = 0x00, | ||
| 1173 | DT_HANDSHAKE, | ||
| 1174 | DT_DEFAULT_LAYER, | ||
| 1175 | DT_CURRENT_LAYER, | ||
| 1176 | DT_KEYMAP_OPTIONS, | ||
| 1177 | DT_BACKLIGHT, | ||
| 1178 | DT_RGBLIGHT, | ||
| 1179 | DT_UNICODE, | ||
| 1180 | DT_DEBUG, | ||
| 1181 | DT_AUDIO, | ||
| 1182 | DT_QUANTUM_ACTION, | ||
| 1183 | DT_KEYBOARD_ACTION, | ||
| 1184 | DT_USER_ACTION, | ||
| 1185 | |||
| 1186 | }; | ||
| 1187 | |||
| 1188 | void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes, uint8_t length) { | 1159 | void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes, uint8_t length) { |
| 1189 | // SEND_STRING("\nTX: "); | 1160 | // SEND_STRING("\nTX: "); |
| 1190 | // for (uint8_t i = 0; i < length; i++) { | 1161 | // for (uint8_t i = 0; i < length; i++) { |
| @@ -1213,15 +1184,6 @@ void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes, | |||
| 1213 | // } | 1184 | // } |
| 1214 | } | 1185 | } |
| 1215 | 1186 | ||
| 1216 | #define MT_GET_DATA(data_type, data, length) send_bytes_sysex(MT_GET_DATA, data_type, data, length) | ||
| 1217 | #define MT_GET_DATA_ACK(data_type, data, length) send_bytes_sysex(MT_GET_DATA_ACK, data_type, data, length) | ||
| 1218 | #define MT_SET_DATA(data_type, data, length) send_bytes_sysex(MT_SET_DATA, data_type, data, length) | ||
| 1219 | #define MT_SET_DATA_ACK(data_type, data, length) send_bytes_sysex(MT_SET_DATA_ACK, data_type, data, length) | ||
| 1220 | #define MT_SEND_DATA(data_type, data, length) send_bytes_sysex(MT_SEND_DATA, data_type, data, length) | ||
| 1221 | #define MT_SEND_DATA_ACK(data_type, data, length) send_bytes_sysex(MT_SEND_DATA_ACK, data_type, data, length) | ||
| 1222 | #define MT_EXE_ACTION(data_type, data, length) send_bytes_sysex(MT_EXE_ACTION, data_type, data, length) | ||
| 1223 | #define MT_EXE_ACTION_ACK(data_type, data, length) send_bytes_sysex(MT_EXE_ACTION_ACK, data_type, data, length) | ||
| 1224 | |||
| 1225 | __attribute__ ((weak)) | 1187 | __attribute__ ((weak)) |
| 1226 | bool sysex_process_quantum(uint8_t length, uint8_t * data) { | 1188 | bool sysex_process_quantum(uint8_t length, uint8_t * data) { |
| 1227 | return sysex_process_keyboard(length, data); | 1189 | return sysex_process_keyboard(length, data); |
| @@ -1312,7 +1274,7 @@ void sysex_buffer_callback(MidiDevice * device, uint8_t length, uint8_t * data) | |||
| 1312 | dword_to_bytes(eeconfig_read_rgblight(), rgblight_bytes); | 1274 | dword_to_bytes(eeconfig_read_rgblight(), rgblight_bytes); |
| 1313 | MT_GET_DATA_ACK(DT_RGBLIGHT, rgblight_bytes, 4); | 1275 | MT_GET_DATA_ACK(DT_RGBLIGHT, rgblight_bytes, 4); |
| 1314 | #else | 1276 | #else |
| 1315 | MT_GET_DATA_ACK(DT_RGBLIGHT, NULL, 0) | 1277 | MT_GET_DATA_ACK(DT_RGBLIGHT, NULL, 0); |
| 1316 | #endif | 1278 | #endif |
| 1317 | break; | 1279 | break; |
| 1318 | } | 1280 | } |
| @@ -1360,11 +1322,4 @@ void sysex_buffer_callback(MidiDevice * device, uint8_t length, uint8_t * data) | |||
| 1360 | 1322 | ||
| 1361 | } | 1323 | } |
| 1362 | 1324 | ||
| 1363 | void send_unicode_midi(uint32_t unicode) { | ||
| 1364 | uint8_t chunk[4]; | ||
| 1365 | dword_to_bytes(unicode, chunk); | ||
| 1366 | MT_SEND_DATA(DT_UNICODE, chunk, 5); | ||
| 1367 | } | ||
| 1368 | |||
| 1369 | |||
| 1370 | #endif | 1325 | #endif |
diff --git a/tmk_core/protocol/lufa/lufa.h b/tmk_core/protocol/lufa/lufa.h index 99b089f42..0962dda8d 100644 --- a/tmk_core/protocol/lufa/lufa.h +++ b/tmk_core/protocol/lufa/lufa.h | |||
| @@ -74,8 +74,9 @@ typedef struct { | |||
| 74 | 74 | ||
| 75 | void sysex_callback(MidiDevice * device, uint16_t start, uint8_t length, uint8_t * data); | 75 | void sysex_callback(MidiDevice * device, uint16_t start, uint8_t length, uint8_t * data); |
| 76 | void sysex_buffer_callback(MidiDevice * device, uint8_t length, uint8_t * data); | 76 | void sysex_buffer_callback(MidiDevice * device, uint8_t length, uint8_t * data); |
| 77 | void send_unicode_midi(uint32_t unicode); | ||
| 78 | void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes, uint8_t length); | 77 | void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes, uint8_t length); |
| 78 | void dword_to_bytes(uint32_t dword, uint8_t * bytes); | ||
| 79 | uint32_t bytes_to_dword(uint8_t * bytes, uint8_t index); | ||
| 79 | 80 | ||
| 80 | __attribute__ ((weak)) | 81 | __attribute__ ((weak)) |
| 81 | bool sysex_process_quantum(uint8_t length, uint8_t * data); | 82 | bool sysex_process_quantum(uint8_t length, uint8_t * data); |
| @@ -86,6 +87,45 @@ typedef struct { | |||
| 86 | __attribute__ ((weak)) | 87 | __attribute__ ((weak)) |
| 87 | bool sysex_process_user(uint8_t length, uint8_t * data); | 88 | bool sysex_process_user(uint8_t length, uint8_t * data); |
| 88 | 89 | ||
| 90 | enum MESSAGE_TYPE { | ||
| 91 | MT_GET_DATA = 0x10, // Get data from keyboard | ||
| 92 | MT_GET_DATA_ACK = 0x11, // returned data to process (ACK) | ||
| 93 | MT_SET_DATA = 0x20, // Set data on keyboard | ||
| 94 | MT_SET_DATA_ACK = 0x21, // returned data to confirm (ACK) | ||
| 95 | MT_SEND_DATA = 0x30, // Sending data/action from keyboard | ||
| 96 | MT_SEND_DATA_ACK = 0x31, // returned data/action confirmation (ACK) | ||
| 97 | MT_EXE_ACTION = 0x40, // executing actions on keyboard | ||
| 98 | MT_EXE_ACTION_ACK =0x41, // return confirmation/value (ACK) | ||
| 99 | MT_TYPE_ERROR = 0x80 // type not recofgnised (ACK) | ||
| 100 | }; | ||
| 101 | |||
| 102 | enum DATA_TYPE { | ||
| 103 | DT_NONE = 0x00, | ||
| 104 | DT_HANDSHAKE, | ||
| 105 | DT_DEFAULT_LAYER, | ||
| 106 | DT_CURRENT_LAYER, | ||
| 107 | DT_KEYMAP_OPTIONS, | ||
| 108 | DT_BACKLIGHT, | ||
| 109 | DT_RGBLIGHT, | ||
| 110 | DT_UNICODE, | ||
| 111 | DT_DEBUG, | ||
| 112 | DT_AUDIO, | ||
| 113 | DT_QUANTUM_ACTION, | ||
| 114 | DT_KEYBOARD_ACTION, | ||
| 115 | DT_USER_ACTION, | ||
| 116 | |||
| 117 | }; | ||
| 118 | |||
| 119 | |||
| 120 | #define MT_GET_DATA(data_type, data, length) send_bytes_sysex(MT_GET_DATA, data_type, data, length) | ||
| 121 | #define MT_GET_DATA_ACK(data_type, data, length) send_bytes_sysex(MT_GET_DATA_ACK, data_type, data, length) | ||
| 122 | #define MT_SET_DATA(data_type, data, length) send_bytes_sysex(MT_SET_DATA, data_type, data, length) | ||
| 123 | #define MT_SET_DATA_ACK(data_type, data, length) send_bytes_sysex(MT_SET_DATA_ACK, data_type, data, length) | ||
| 124 | #define MT_SEND_DATA(data_type, data, length) send_bytes_sysex(MT_SEND_DATA, data_type, data, length) | ||
| 125 | #define MT_SEND_DATA_ACK(data_type, data, length) send_bytes_sysex(MT_SEND_DATA_ACK, data_type, data, length) | ||
| 126 | #define MT_EXE_ACTION(data_type, data, length) send_bytes_sysex(MT_EXE_ACTION, data_type, data, length) | ||
| 127 | #define MT_EXE_ACTION_ACK(data_type, data, length) send_bytes_sysex(MT_EXE_ACTION_ACK, data_type, data, length) | ||
| 128 | |||
| 89 | #endif | 129 | #endif |
| 90 | 130 | ||
| 91 | // #if LUFA_VERSION_INTEGER < 0x120730 | 131 | // #if LUFA_VERSION_INTEGER < 0x120730 |
