53 lines
679 B
C
53 lines
679 B
C
#ifndef _UTIL_H
|
|
#define _UTIL_H
|
|
#include <stdint.h>
|
|
|
|
|
|
typedef union
|
|
{
|
|
uint32_t data;
|
|
char byte[4];
|
|
} Int;
|
|
typedef union
|
|
{
|
|
float data;
|
|
char byte[4];
|
|
} Float;
|
|
|
|
|
|
typedef union{
|
|
int16_t value;
|
|
char byte[2];
|
|
}Int16Tobyte;
|
|
|
|
|
|
|
|
typedef union
|
|
{
|
|
uint32_t val;
|
|
uint8_t valBuf[4];
|
|
} DSH_INT_U;
|
|
|
|
typedef union
|
|
{
|
|
float val;
|
|
uint8_t valBuf[4];
|
|
} DSH_FLOAT_U;
|
|
|
|
|
|
|
|
|
|
float Bytes2Float (char * data);
|
|
uint32_t Bytes2Int (char * data);
|
|
int hexstr_to_hexbyte (char *src, char *obj, uint16_t length);
|
|
float iee754_to_float (char * data);
|
|
uint32_t byte_to_Inverse(char * data);
|
|
// 754 תfloat
|
|
float float_to_iee754 (float ff1,char * data);
|
|
|
|
int16_t Bytes2Int16 (char * data);
|
|
|
|
#endif
|
|
|
|
|