1
0
Fork 0

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
This commit is contained in:
Fred Sundvik 2016-12-29 12:13:30 +02:00
parent 273faa4d9c
commit dd685eceb2
4 changed files with 71 additions and 27 deletions

View file

@ -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