aboutsummaryrefslogtreecommitdiffstats
path: root/tmk_core/protocol/lufa/lufa.h
diff options
context:
space:
mode:
authorGravatar Fred Sundvik <fsundvik@gmail.com>2016-12-29 12:13:30 +0200
committerGravatar Fred Sundvik <fsundvik@gmail.com>2016-12-29 12:13:30 +0200
commitdd685eceb2045371d38f24d454f1ab08ca7416f4 (patch)
treeeef012131a9ce190512a899d4850e34741989a26 /tmk_core/protocol/lufa/lufa.h
parent273faa4d9cd5a84207548f83ba550c9efee90933 (diff)
downloadqmk_firmware-dd685eceb2045371d38f24d454f1ab08ca7416f4.tar.gz
API Sysex fixes
Fix memory leaks by using stack instead of malloc Reduce memory usage by having less temporary bufffers Remove warnings by adding includes Decrease code size by 608 bytes (mostly due to not linking malloc) More robust handling of buffer overflows
Diffstat (limited to 'tmk_core/protocol/lufa/lufa.h')
-rw-r--r--tmk_core/protocol/lufa/lufa.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/tmk_core/protocol/lufa/lufa.h b/tmk_core/protocol/lufa/lufa.h
index b11854101..a049fd43c 100644
--- a/tmk_core/protocol/lufa/lufa.h
+++ b/tmk_core/protocol/lufa/lufa.h
@@ -70,7 +70,6 @@ typedef struct {
#ifdef MIDI_ENABLE
void MIDI_Task(void);
MidiDevice midi_device;
- #define MIDI_SYSEX_BUFFER 32
#endif
#ifdef API_ENABLE
@@ -79,6 +78,9 @@ typedef struct {
#ifdef API_SYSEX_ENABLE
#include "api_sysex.h"
+ // Allocate space for encoding overhead.
+ //The header and terminator are not stored to save a few bytes of precious ram
+ #define MIDI_SYSEX_BUFFER (API_SYSEX_MAX_SIZE + API_SYSEX_MAX_SIZE / 7 + (API_SYSEX_MAX_SIZE % 7 ? 1 : 0))
#endif
// #if LUFA_VERSION_INTEGER < 0x120730