sys.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef __SYS_H
  2. #define __SYS_H
  3. #include "stm32f10x.h"
  4. typedef unsigned int clock_t; /* cpu time type */
  5. typedef unsigned int time_t; /* date/time in unix secs past 1-Jan-70 */
  6. #define UART_RECV_SIZE 1024 //接收缓存大小
  7. #define RECV_SIZE UART_RECV_SIZE + 200 //有效数据缓存大小
  8. /*---------------------------------------------------------------------------*/
  9. /* Type Definition Macros */
  10. /*---------------------------------------------------------------------------*/
  11. typedef int socklen_t;
  12. typedef long long int int64;
  13. typedef unsigned long long int uint64;
  14. typedef _Bool uint1;
  15. typedef unsigned char uint8;
  16. typedef char int8;
  17. typedef unsigned short uint16;
  18. typedef short int16;
  19. typedef unsigned int uint32;
  20. typedef int int32;
  21. void byteToHexStr(const unsigned char* source, char* dest, int sourceLen);
  22. void inttohex(uint16 value,uint8 *hex);
  23. void letterSwitch(char *str, int flag);
  24. int my_atoi(char *str);
  25. char* my_itoa(int num,char* str,int radix);
  26. /**
  27. * @title 分割字符串
  28. * @Param src:要分割字符串,seperator:分隔符, dest:分割后字符串地址, size:分割的数量
  29. */
  30. void split(char *src,const char *separator,char *dest[],int size);
  31. /**
  32. * @Title split,分割字符串
  33. * @Param 要分割字符串,seperator:分隔符, dest:分割后字符串地址,limit:分割限制数量
  34. */
  35. void splitCharLimit(char *str, char seprator, char *dest[], int limit);
  36. /**
  37. * @title 延时函数
  38. * @Param ms:延时时间(单位ms)
  39. */
  40. uint8_t memmem(uint8_t * result,uint16_t result_length, uint8_t *rdystring,uint8_t rdylen);
  41. #endif