1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-25 01:05:21 +03:00

Allocate trampReqBuffer on the stack

Saves 16 bytes of RAM
This commit is contained in:
Alberto García Hierro 2018-03-05 11:57:45 +00:00
parent fc91b1d573
commit 37a6b32a30

View file

@ -66,7 +66,6 @@ static vtxDevice_t vtxTramp = {
static serialPort_t *trampSerialPort = NULL;
static uint8_t trampReqBuffer[16];
static uint8_t trampRespBuffer[16];
typedef enum {
@ -100,11 +99,6 @@ uint8_t trampFreqRetries = 0;
uint16_t trampConfPower = 0;
uint8_t trampPowerRetries = 0;
static void trampWriteBuf(uint8_t *buf)
{
serialWriteBuf(trampSerialPort, buf, 16);
}
static uint8_t trampChecksum(uint8_t *trampBuf)
{
uint8_t cksum = 0;
@ -120,13 +114,14 @@ void trampCmdU16(uint8_t cmd, uint16_t param)
if (!trampSerialPort)
return;
uint8_t trampReqBuffer[16];
memset(trampReqBuffer, 0, ARRAYLEN(trampReqBuffer));
trampReqBuffer[0] = 15;
trampReqBuffer[1] = cmd;
trampReqBuffer[2] = param & 0xff;
trampReqBuffer[3] = (param >> 8) & 0xff;
trampReqBuffer[14] = trampChecksum(trampReqBuffer);
trampWriteBuf(trampReqBuffer);
serialWriteBuf(trampSerialPort, trampReqBuffer, sizeof(trampReqBuffer));
}
void trampSetFreq(uint16_t freq)