diff options
author | Damien <Dbroqua@users.noreply.github.com> | 2016-12-09 19:44:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-09 19:44:03 +0100 |
commit | 13c4080a1d77cb1dfdf48df8a42e78b9dc483912 (patch) | |
tree | 66fd988d98a32e1437fbc6cb80bee03c056722a7 /quantum/api/api_sysex.c | |
parent | a849bdc5811b2bb69df8e3b0948c8e81c0dfa9d4 (diff) | |
parent | 985a091a739c99736d5b17de5161831488dbc219 (diff) | |
download | qmk_firmware-13c4080a1d77cb1dfdf48df8a42e78b9dc483912.tar.gz qmk_firmware-13c4080a1d77cb1dfdf48df8a42e78b9dc483912.zip |
Merge pull request #13 from jackhumbert/master
Merged from qmk
Diffstat (limited to 'quantum/api/api_sysex.c')
-rw-r--r-- | quantum/api/api_sysex.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/quantum/api/api_sysex.c b/quantum/api/api_sysex.c new file mode 100644 index 0000000000..a4a554e764 --- /dev/null +++ b/quantum/api/api_sysex.c @@ -0,0 +1,29 @@ +#include "api_sysex.h" + +void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes, uint16_t length) { + // SEND_STRING("\nTX: "); + // for (uint8_t i = 0; i < length; i++) { + // 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); + + // SEND_STRING("\nTD: "); + // for (uint8_t i = 0; i < encoded_length + 5; i++) { + // send_byte(array[i]); + // SEND_STRING(" "); + // } +}
\ No newline at end of file |