I am trying to fill a struct with a byte array. I am porting this code over from another MCU, but I can’t seem to get the values to fill properly. The values are incorrect. Has anyone attempted to do this and been successful on spark? Here is a paired down example.
typedef struct packet_t
{
int16_t temperature; /**< Current Temperature */
int16_t rampRate; /**< Current Ramp Rate */
};
uint8_t payload[4];
//payload filled with 2 16bit integers
packet_t *sp = (packet_t*)payload;