Question

I am using the following C library file to try and send 9 floating point values over UART: https://github.com/microbuilder/LPC1343CodeBase/blob/master/core/uart/uart.c

In following the example in the comments, I came up with the following code:

#define UARTBUFFERSIZE 36 
float testVals[9] = {0.1, 0.2, 0.3, 0.5, 0.6, 0.7, 0.8, 0.9}; //global, just for testing

In my main code I have the following line to try and send testVals:

uartSend((float *)testVals, UARTBUFFERSIZE); 

main.c:94:4: warning: passing argument 1 of 'uartSend' from incompatible pointer type
core/uart/uart.h:67:6: note: expected 'uint8_t *' but argument is of type 'float *'

Do I have to use 'uint8_t' type, and will that let me send my floating point values?

Était-ce utile?

La solution

Just cast it to uint8_t*, it is safe. Your size for floats is set correctly 9 floats -> 9 x 4 bytes.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top