Hi
I have a strut variable that I am using as a packet template for communication within my C application:
The payload of the packets can change from anywhere from 11 bytes to 84 bytes, however defining the payload length in the way shown above leaves allot of unused space in the payload.Code:typedef struct { uint8_t header[HEADER_OFFSET]; uint8_t payload[MAX_PACKET_LENGTH]; uint8_t footer[AFFIX_LENGTH - FOOTER_OFFSET]; } PACK GenericPacket_t;
Eg: If I want to send an 11 byte message the payload will still contain another 73 unused bytes)
The packets sizes are especially critical with my system, done anyone know how I could define the structure above without forever setting the payload size to the maximum but still be able to send a full 84 byte message if I need to?
thanks for any advice you can give
David
PS: I cannot use dynamic memory allocation - at all