23 lines
502 B
C
23 lines
502 B
C
|
|
#ifndef __UTILS_H
|
|||
|
|
#define __UTILS_H
|
|||
|
|
|
|||
|
|
#include "type.h"
|
|||
|
|
|
|||
|
|
// <20>ߵ<EFBFBD><DFB5>ֽ<EFBFBD>˳<EFBFBD><CBB3>
|
|||
|
|
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<55><53>CRC<52>㷨
|
|||
|
|
u16 MODBUS_RTU_CRC16(u8 *puchMsg, u16 usDataLen);
|
|||
|
|
|
|||
|
|
#endif
|