Hi,
I need to transfer many "32 bit float" variables between two DSPs through SPI.
However, the register is alaways 16bit that I need to split the "32bit float" variable into two parts.
I used the C type union like
union mytype {
float a;
uint16_t b[2];
};
It works well but I get the new problem that it is hard to know whether the received 16bit data is for b[0] or b[1] at startup. (The two DSP may power on at different time, so the 1st data may not always be b[0]).
I tried to split the 32bit float into 4 bytes, and when I transfer the 16bit, I add a tag before the 8bit data. That also works perfect. But I got performance slow down doubled.
So what I want is to split a float into two 16-bit chunks, each of them also carrying information about if it's the first chunk or the second. Or use some pointer? Can someone help me?
Thanks in advance.