You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
преди 11 години
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* Simple compatibility headers for AVR code used with ARM chips
  2. * Copyright (c) 2015 Paul Stoffregen <paul@pjrc.com>
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5. * of this software and associated documentation files (the "Software"), to deal
  6. * in the Software without restriction, including without limitation the rights
  7. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. * copies of the Software, and to permit persons to whom the Software is
  9. * furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. * THE SOFTWARE.
  21. */
  22. #ifndef __PGMSPACE_H_
  23. #define __PGMSPACE_H_ 1
  24. #include <inttypes.h>
  25. #define PROGMEM
  26. #define PGM_P const char *
  27. #define PSTR(str) (str)
  28. #define _SFR_BYTE(n) (n)
  29. typedef void prog_void;
  30. typedef char prog_char;
  31. typedef unsigned char prog_uchar;
  32. typedef int8_t prog_int8_t;
  33. typedef uint8_t prog_uint8_t;
  34. typedef int16_t prog_int16_t;
  35. typedef uint16_t prog_uint16_t;
  36. typedef int32_t prog_int32_t;
  37. typedef uint32_t prog_uint32_t;
  38. #define memchr_P(str, c, len) memchr((str), (c), (len))
  39. #define memcmp_P(a, b, n) memcmp((a), (b), (n))
  40. #define memcpy_P(dest, src, num) memcpy((dest), (src), (num))
  41. #define memmem_P(a, alen, b, blen) memmem((a), (alen), (b), (blen))
  42. #define memrchr_P(str, val, len) memrchr((str), (val), (len))
  43. #define strcat_P(dest, src) strcat((dest), (src))
  44. #define strchr_P(str, c) strchr((str), (c))
  45. #define strchrnul_P(str, c) strchrnul((str), (c))
  46. #define strcmp_P(a, b) strcmp((a), (b))
  47. #define strcpy_P(dest, src) strcpy((dest), (src))
  48. #define strcasecmp_P(a, b) strcasecmp((a), (b))
  49. #define strcasestr_P(a, b) strcasestr((a), (b))
  50. #define strlcat_P(dest, src, len) strlcat((dest), (src), (len))
  51. #define strlcpy_P(dest, src, len) strlcpy((dest), (src), (len))
  52. #define strlen_P(s) strlen((const char *)(s))
  53. #define strnlen_P(str, len) strnlen((str), (len))
  54. #define strncmp_P(a, b, n) strncmp((a), (b), (n))
  55. #define strncasecmp_P(a, b, n) strncasecmp((a), (b), (n))
  56. #define strncat_P(a, b, n) strncat((a), (b), (n))
  57. #define strncpy_P(a, b, n) strncpy((a), (b), (n))
  58. #define strpbrk_P(str, chrs) strpbrk((str), (chrs))
  59. #define strrchr_P(str, c) strrchr((str), (c))
  60. #define strsep_P(strp, delim) strsep((strp), (delim))
  61. #define strspn_P(str, chrs) strspn((str), (chrs))
  62. #define strstr_P(a, b) strstr((a), (b))
  63. #define sprintf_P(s, ...) sprintf((s), __VA_ARGS__)
  64. #define vfprintf_P(fp, s, ...) vfprintf((fp), (s), __VA_ARGS__)
  65. #define printf_P(...) printf(__VA_ARGS__)
  66. #define snprintf_P(s, n, ...) snprintf((s), (n), __VA_ARGS__)
  67. #define vsprintf_P(s, ...) vsprintf((s), __VA_ARGS__)
  68. #define vsnprintf_P(s, n, ...) vsnprintf((s), (n), __VA_ARGS__)
  69. #define fprintf_P(fp, ...) fprintf((fp), __VA_ARGS__)
  70. #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
  71. #define pgm_read_word(addr) (*(const unsigned short *)(addr))
  72. #define pgm_read_dword(addr) (*(const unsigned long *)(addr))
  73. #define pgm_read_float(addr) (*(const float *)(addr))
  74. #define pgm_read_byte_near(addr) pgm_read_byte(addr)
  75. #define pgm_read_word_near(addr) pgm_read_word(addr)
  76. #define pgm_read_dword_near(addr) pgm_read_dword(addr)
  77. #define pgm_read_float_near(addr) pgm_read_float(addr)
  78. #define pgm_read_byte_far(addr) pgm_read_byte(addr)
  79. #define pgm_read_word_far(addr) pgm_read_word(addr)
  80. #define pgm_read_dword_far(addr) pgm_read_dword(addr)
  81. #define pgm_read_float_far(addr) pgm_read_float(addr)
  82. #endif