#ifndef _DEFS_H_ #define _DEFS_H_ #include #include #define ENABLE_DEBUG #ifdef ENABLE_DEBUG #define xENABLE_DEBUG_MAIN #define ENABLE_DEBUG_BT #define xENABLE_DEBUG_EX_OBD #define xENABLE_DEBUG_CV520 #endif/*ENABLE_DEBUG*/ /* takes a byte out of a uint32_t : var - uint32_t, ByteNum - byte to take out (0 - 3) */ #define BREAK_UINT32( var, ByteNum ) \ (uint8_t)((uint32_t)(((var) >>((ByteNum) * 8)) & 0x00FF)) #define BUILD_UINT32(Byte0, Byte1, Byte2, Byte3) \ ((uint32_t)((uint32_t)((Byte0) & 0x00FF) \ + ((uint32_t)((Byte1) & 0x00FF) << 8) \ + ((uint32_t)((Byte2) & 0x00FF) << 16) \ + ((uint32_t)((Byte3) & 0x00FF) << 24))) #define BUILD_UINT16(loByte, hiByte) \ ((uint16_t)(((loByte) & 0x00FF) + (((hiByte) & 0x00FF) << 8))) #define HI_UINT16(a) (((a) >> 8) & 0xFF) #define LO_UINT16(a) ((a) & 0xFF) #ifndef BV #define BV(n) (1ul << (n)) #endif #ifndef ABS #define ABS(n) (((n) < 0) ? -(n) : (n)) #endif #ifndef MAX #define MAX(a, b) ((a >= b) ? (a) : (b)) #endif #ifndef MIN #define MIN(a, b) ((a < b) ? (a) : (b)) #endif const double GLB_EPSILON = 1e-6; //#define htonl(a) ((((uint32_t)(a) & 0xff000000) >> 24) | \ // (((uint32_t)(a) & 0x00ff0000) >> 8) | \ // (((uint32_t)(a) & 0x0000ff00) << 8) | \ // (((uint32_t)(a) & 0x000000ff) << 24)) //#define htons(a) ((((uint16_t)(a) & 0xff00) >> 8) | (((uint16_t)(a) & 0x00ff) << 8)) //#define ntohl(a) htonl(a) //#define ntohs(a) htons(a) #endif