diff options
| author | Jack Humbert <jack.humb@gmail.com> | 2016-11-23 20:16:38 -0500 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2016-11-23 20:16:38 -0500 |
| commit | cefa8468fb5f28bd67a0c02d371a4aef0964e20c (patch) | |
| tree | 70503054c509f86b30c0279e97cf946cf6aa2353 /tmk_core/protocol/lufa/lufa.c | |
| parent | 2e23689b8e3222982082c1f5a4f8ce7686f9658b (diff) | |
| download | qmk_firmware-cefa8468fb5f28bd67a0c02d371a4aef0964e20c.tar.gz qmk_firmware-cefa8468fb5f28bd67a0c02d371a4aef0964e20c.zip | |
travis pls
Diffstat (limited to 'tmk_core/protocol/lufa/lufa.c')
| -rw-r--r-- | tmk_core/protocol/lufa/lufa.c | 49 |
1 files changed, 2 insertions, 47 deletions
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 |
