skyyuzhang
(Skyyuzhang)
November 23, 2018, 7:02am
1
I found that many data tpye is float16 actually it is my first heard of float16 . my adc data length is uint16_t so
How do I convert uint16_t into a float16 thanyou!!!
Convert your integer to the native float
type first, then use canardConvertNativeFloatToFloat16
:
/**
* Float16 marshaling helpers.
* These functions convert between the native float and 16-bit float.
* It is assumed that the native float is IEEE 754 single precision float, otherwise results will be unpredictable.
* Vast majority of modern computers and microcontrollers use IEEE 754, so this limitation should not affect
* portability.
*/
uint16_t canardConvertNativeFloatToFloat16(float value);
float canardConvertFloat16ToNativeFloat(uint16_t value);