-
-
Save JamPsym/672d7b050ca23a856194e70209816bf3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IQ200: | |
uint8_t tbuffer[512]; | |
void transmit_float(float* fbuffer, size_t tran_length) | |
{ | |
// transform float into uint8_t | |
for(size_t j=0; j<tran_length; j++) | |
{ | |
union float_union {float f; uint8_t f_ui[4];} uf; | |
uf.f = fbuffer[j]; | |
// single float | |
for(size_t i=0; i<4; i++) // little endian | |
{ | |
tbuffer[4*j + i] = uf.f_ui[i]; | |
} | |
} | |
send_bytes(&tbuffer[0], tran_length*4); | |
} | |
//vs | |
void transmit_float(float* fbuffer, size_t tran_length) | |
{ | |
send_bytes(fbuffer, tran_length*4); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment