struct float_h_l
{
uint16_t hl16[2];
float f32;
};
struct float_h_l floatRead(float f)
{
struct float_h_l read;
uint16_t *a = (uint16_t*)&f;
read.hl16[1]=a[0];
read.hl16[0]=a[1];
return read;
}
struct float_h_l floatWrite(uint16_t h,uint16_t l)
{
struct float_h_l write;
uint16_t *a = (uint16_t*)&write.f32;
a[1] =h;
a[0] =l;
return write;
}
————————————————
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/weixin_41729209/article/details/136270556
|