My Marlin configs for Fabrikator Mini and CTC i3 Pro B
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.

progmem.h 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. #ifndef __AVR__
  24. #ifndef __PGMSPACE_H_
  25. // This define should prevent reading the system pgmspace.h if included elsewhere
  26. // This is not normally needed.
  27. #define __PGMSPACE_H_ 1
  28. #endif
  29. #ifndef PROGMEM
  30. #define PROGMEM
  31. #endif
  32. #ifndef PGM_P
  33. #define PGM_P const char *
  34. #endif
  35. #ifndef PSTR
  36. #define PSTR(str) (str)
  37. #endif
  38. #ifndef F
  39. class __FlashStringHelper;
  40. #define F(str) (reinterpret_cast<const __FlashStringHelper *>(PSTR(str)))
  41. #endif
  42. #ifndef _SFR_BYTE
  43. #define _SFR_BYTE(n) (n)
  44. #endif
  45. #ifndef memchr_P
  46. #define memchr_P(str, c, len) memchr((str), (c), (len))
  47. #endif
  48. #ifndef memcmp_P
  49. #define memcmp_P(a, b, n) memcmp((a), (b), (n))
  50. #endif
  51. #ifndef memcpy_P
  52. #define memcpy_P(dest, src, num) memcpy((dest), (src), (num))
  53. #endif
  54. #ifndef memmem_P
  55. #define memmem_P(a, alen, b, blen) memmem((a), (alen), (b), (blen))
  56. #endif
  57. #ifndef memrchr_P
  58. #define memrchr_P(str, val, len) memrchr((str), (val), (len))
  59. #endif
  60. #ifndef strcat_P
  61. #define strcat_P(dest, src) strcat((dest), (src))
  62. #endif
  63. #ifndef strchr_P
  64. #define strchr_P(str, c) strchr((str), (c))
  65. #endif
  66. #ifndef strchrnul_P
  67. #define strchrnul_P(str, c) strchrnul((str), (c))
  68. #endif
  69. #ifndef strcmp_P
  70. #define strcmp_P(a, b) strcmp((a), (b))
  71. #endif
  72. #ifndef strcpy_P
  73. #define strcpy_P(dest, src) strcpy((dest), (src))
  74. #endif
  75. #ifndef strcasecmp_P
  76. #define strcasecmp_P(a, b) strcasecmp((a), (b))
  77. #endif
  78. #ifndef strcasestr_P
  79. #define strcasestr_P(a, b) strcasestr((a), (b))
  80. #endif
  81. #ifndef strlcat_P
  82. #define strlcat_P(dest, src, len) strlcat((dest), (src), (len))
  83. #endif
  84. #ifndef strlcpy_P
  85. #define strlcpy_P(dest, src, len) strlcpy((dest), (src), (len))
  86. #endif
  87. #ifndef strlen_P
  88. #define strlen_P(s) strlen((const char *)(s))
  89. #endif
  90. #ifndef strnlen_P
  91. #define strnlen_P(str, len) strnlen((str), (len))
  92. #endif
  93. #ifndef strncmp_P
  94. #define strncmp_P(a, b, n) strncmp((a), (b), (n))
  95. #endif
  96. #ifndef strncasecmp_P
  97. #define strncasecmp_P(a, b, n) strncasecmp((a), (b), (n))
  98. #endif
  99. #ifndef strncat_P
  100. #define strncat_P(a, b, n) strncat((a), (b), (n))
  101. #endif
  102. #ifndef strncpy_P
  103. #define strncpy_P(a, b, n) strncpy((a), (b), (n))
  104. #endif
  105. #ifndef strpbrk_P
  106. #define strpbrk_P(str, chrs) strpbrk((str), (chrs))
  107. #endif
  108. #ifndef strrchr_P
  109. #define strrchr_P(str, c) strrchr((str), (c))
  110. #endif
  111. #ifndef strsep_P
  112. #define strsep_P(pstr, delim) strsep((pstr), (delim))
  113. #endif
  114. #ifndef strspn_P
  115. #define strspn_P(str, chrs) strspn((str), (chrs))
  116. #endif
  117. #ifndef strstr_P
  118. #define strstr_P(a, b) strstr((a), (b))
  119. #endif
  120. #ifndef sprintf_P
  121. #define sprintf_P(s, ...) sprintf((s), __VA_ARGS__)
  122. #endif
  123. #ifndef vfprintf_P
  124. #define vfprintf_P(s, ...) vfprintf((s), __VA_ARGS__)
  125. #endif
  126. #ifndef printf_P
  127. #define printf_P(...) printf(__VA_ARGS__)
  128. #endif
  129. #ifndef snprintf_P
  130. #define snprintf_P(s, n, ...) snprintf((s), (n), __VA_ARGS__)
  131. #endif
  132. #ifndef vsprintf_P
  133. #define vsprintf_P(s, ...) vsprintf((s),__VA_ARGS__)
  134. #endif
  135. #ifndef vsnprintf_P
  136. #define vsnprintf_P(s, n, ...) vsnprintf((s), (n),__VA_ARGS__)
  137. #endif
  138. #ifndef fprintf_P
  139. #define fprintf_P(s, ...) fprintf((s), __VA_ARGS__)
  140. #endif
  141. #ifndef pgm_read_byte
  142. #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
  143. #endif
  144. #ifndef pgm_read_word
  145. #define pgm_read_word(addr) (*(const unsigned short *)(addr))
  146. #endif
  147. #ifndef pgm_read_dword
  148. #define pgm_read_dword(addr) (*(const unsigned long *)(addr))
  149. #endif
  150. #ifndef pgm_read_float
  151. #define pgm_read_float(addr) (*(const float *)(addr))
  152. #endif
  153. #ifndef pgm_read_byte_near
  154. #define pgm_read_byte_near(addr) pgm_read_byte(addr)
  155. #endif
  156. #ifndef pgm_read_word_near
  157. #define pgm_read_word_near(addr) pgm_read_word(addr)
  158. #endif
  159. #ifndef pgm_read_dword_near
  160. #define pgm_read_dword_near(addr) pgm_read_dword(addr)
  161. #endif
  162. #ifndef pgm_read_float_near
  163. #define pgm_read_float_near(addr) pgm_read_float(addr)
  164. #endif
  165. #ifndef pgm_read_byte_far
  166. #define pgm_read_byte_far(addr) pgm_read_byte(addr)
  167. #endif
  168. #ifndef pgm_read_word_far
  169. #define pgm_read_word_far(addr) pgm_read_word(addr)
  170. #endif
  171. #ifndef pgm_read_dword_far
  172. #define pgm_read_dword_far(addr) pgm_read_dword(addr)
  173. #endif
  174. #ifndef pgm_read_float_far
  175. #define pgm_read_float_far(addr) pgm_read_float(addr)
  176. #endif
  177. #ifndef pgm_read_pointer
  178. #define pgm_read_pointer
  179. #endif
  180. // Fix bug in pgm_read_ptr
  181. #undef pgm_read_ptr
  182. #define pgm_read_ptr(addr) (*((void**)(addr)))
  183. #endif // __AVR__