#ifndef __UTILS_H #define __UTILS_H #include "type.h" // µßµ¹×Ö½Ú˳Ðò uint16_t ntohs(uint16_t n); uint32_t ntohl(uint32_t n); float ntohf(float f); #define htons(n) ntohs(n) #define htonl(n) ntohl(n) #define htonf(f) ntohf(f) uint16_t Byte2IntS(uint8_t *buf, int pos); void Int2ByteS(uint8_t *buf, int pos, uint16_t val); uint32_t Byte2IntL(uint8_t *buf, int pos); void Int2ByteL(uint8_t *buf, int pos, uint32_t val); // MODBUSµÄCRCËã·¨ u16 MODBUS_RTU_CRC16(u8 *puchMsg, u16 usDataLen); #endif