AppFuncLib.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /***
  2. * @Author: chenjie
  3. * @Date: 2022-06-06
  4. * @LastEditTime: 2022-10-27
  5. * @LastEditors: chenjie
  6. * @Description:
  7. * @FilePath: \S32K146_4G\code\app\lib\AppFuncLib.h
  8. * @Copyright (c) 2022 by chenjie, All Rights Reserved.
  9. */
  10. #ifndef APPFUNCLIB_H_
  11. #define APPFUNCLIB_H_
  12. #include "hal_adapter.h"
  13. #include <stdarg.h>
  14. #include "stdio.h"
  15. #ifndef va_copy
  16. #define va_copy(dst, src) memcpy(&(dst), &(src), sizeof(va_list))
  17. #endif
  18. uint16 GetErrorNum(uint16 *ErrorArray, uint8 Errorlen);
  19. uint8 PutErrorNum(uint16 *ErrorArray, uint8 Errorlen, uint16 ErrorNum);
  20. uint16 ATstrdel(char *str);
  21. uint16 mstrlen(const char *s);
  22. int mstrncmp(const char *s1, const char *s2, int n);
  23. unsigned char HexToChar(unsigned char bHex);
  24. unsigned char CharToHex(unsigned char bChar);
  25. uint8 AtStrCompare(const char *a, const char *b);
  26. unsigned short CRC16_Modbus(unsigned char *pdata, int len);
  27. uint8 bcc_chk(uint8 *data, uint16 length);
  28. char *Myitoa(int value, char *result, int base);
  29. // 整数转字符串
  30. int _itoa(int num, char buf[32]);
  31. int _i2a(int num, char buf[32], int radix);
  32. // 浮点转字符串
  33. int _ftoa(double val, char buf[32], int eps);
  34. // 浮点转字符串,范围(-1,1)
  35. int __ftoa(double val, char buf[32], int eps);
  36. // 替代sprintf
  37. int _sprintf(char *dst, const char *format, ...);
  38. //串口校验
  39. uint16 crc_chk(uint8 *data, uint8 length);
  40. #endif /* APPFUNCLIB_H_ */