Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

70 lines
2.7KB

  1. #ifndef __PGMSPACE_H_
  2. #define __PGMSPACE_H_ 1
  3. #include <inttypes.h>
  4. #define PROGMEM
  5. #define PGM_P const char *
  6. #define PSTR(str) (str)
  7. #define _SFR_BYTE(n) (n)
  8. typedef void prog_void;
  9. typedef char prog_char;
  10. typedef unsigned char prog_uchar;
  11. typedef int8_t prog_int8_t;
  12. typedef uint8_t prog_uint8_t;
  13. typedef int16_t prog_int16_t;
  14. typedef uint16_t prog_uint16_t;
  15. typedef int32_t prog_int32_t;
  16. typedef uint32_t prog_uint32_t;
  17. #define memchr_P(str, c, len) memchr((str), (c), (len))
  18. #define memcmp_P(a, b, n) memcmp((a), (b), (n))
  19. #define memcpy_P(dest, src, num) memcpy((dest), (src), (num))
  20. #define memmem_P(a, alen, b, blen) memmem((a), (alen), (b), (blen))
  21. #define memrchr_P(str, val, len) memrchr((str), (val), (len))
  22. #define strcat_P(dest, src) strcat((dest), (src))
  23. #define strchr_P(str, c) strchr((str), (c))
  24. #define strchrnul_P(str, c) strchrnul((str), (c))
  25. #define strcmp_P(a, b) strcmp((a), (b))
  26. #define strcpy_P(dest, src) strcpy((dest), (src))
  27. #define strcasecmp_P(a, b) strcasecmp((a), (b))
  28. #define strcasestr_P(a, b) strcasestr((a), (b))
  29. #define strlcat_P(dest, src, len) strlcat((dest), (src), (len))
  30. #define strlcpy_P(dest, src, len) strlcpy((dest), (src), (len))
  31. #define strlen_P(s) strlen((const char *)(s))
  32. #define strnlen_P(str, len) strnlen((str), (len))
  33. #define strncmp_P(a, b, n) strncmp((a), (b), (n))
  34. #define strncasecmp_P(a, b, n) strncasecmp((a), (b), (n))
  35. #define strncat_P(a, b, n) strncat((a), (b), (n))
  36. #define strncpy_P(a, b, n) strncpy((a), (b), (n))
  37. #define strpbrk_P(str, chrs) strpbrk((str), (chrs))
  38. #define strrchr_P(str, c) strrchr((str), (c))
  39. #define strsep_P(strp, delim) strsep((strp), (delim))
  40. #define strspn_P(str, chrs) strspn((str), (chrs))
  41. #define strstr_P(a, b) strstr((a), (b))
  42. #define sprintf_P(s, ...) sprintf((s), __VA_ARGS__)
  43. #define vfprintf_P(fp, s, ...) vfprintf((fp), (s), __VA_ARGS__)
  44. #define printf_P(...) printf(__VA_ARGS__)
  45. #define snprintf_P(s, n, ...) snprintf((s), (n), __VA_ARGS__)
  46. #define vsprintf_P(s, ...) vsprintf((s), __VA_ARGS__)
  47. #define vsnprintf_P(s, n, ...) vsnprintf((s), (n), __VA_ARGS__)
  48. #define fprintf_P(fp, ...) fprintf((fp), __VA_ARGS__)
  49. #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
  50. #define pgm_read_word(addr) (*(const unsigned short *)(addr))
  51. #define pgm_read_dword(addr) (*(const unsigned long *)(addr))
  52. #define pgm_read_float(addr) (*(const float *)(addr))
  53. #define pgm_read_byte_near(addr) pgm_read_byte(addr)
  54. #define pgm_read_word_near(addr) pgm_read_word(addr)
  55. #define pgm_read_dword_near(addr) pgm_read_dword(addr)
  56. #define pgm_read_float_near(addr) pgm_read_float(addr)
  57. #define pgm_read_byte_far(addr) pgm_read_byte(addr)
  58. #define pgm_read_word_far(addr) pgm_read_word(addr)
  59. #define pgm_read_dword_far(addr) pgm_read_dword(addr)
  60. #define pgm_read_float_far(addr) pgm_read_float(addr)
  61. #endif