PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

275 行
9.1KB

  1. #ifndef _RA8875_CPU_H_
  2. #define _RA8875_CPU_H_
  3. /*
  4. CPU based Preprocessor directives file.
  5. RA8875 Library support many MCU's so I wroted this to simplify the overall code.
  6. Part of RA8875 library from https://github.com/sumotoy/RA8875
  7. RA8875 fast SPI library for RAiO SPI RA8875 drived TFT
  8. Copyright (C) 2014 egidio massimo costa sumotoy (a t) gmail.com
  9. This program is free software: you can redistribute it and/or modify
  10. it under the terms of the GNU General Public License as published by
  11. the Free Software Foundation, either version 3 of the License, or
  12. (at your option) any later version.
  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. You should have received a copy of the GNU General Public License
  18. along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. /*
  21. --------------------------------------------------------------
  22. ENERGIA BASED BOARDS
  23. Partially supported and actually never tested
  24. --------------------------------------------------------------
  25. */
  26. #if defined(ENERGIA)
  27. #include "Energia.h"
  28. #undef byte
  29. #define byte uint8_t
  30. #if defined(__TM4C129XNCZAD__) || defined(__TM4C1294NCPDT__)//tiva???
  31. #define NEEDS_SET_MODULE
  32. #define _FASTCPU
  33. #if defined(_FORCE_PROGMEM__)//arm do not need this
  34. #undef _FORCE_PROGMEM__//force library not use PROGMEM
  35. #endif
  36. #define __PRGMTAG_
  37. #elif defined(__LM4F120H5QR__) || defined(__TM4C123GH6PM__)//stellaris first version
  38. #define NEEDS_SET_MODULE
  39. #define _FASTCPU
  40. #if defined(_FORCE_PROGMEM__)//arm do not need this
  41. #undef _FORCE_PROGMEM__//force library not use PROGMEM
  42. #endif
  43. #define __PRGMTAG_
  44. #elif defined(__MSP430MCU__)//MSP430???
  45. // don't know
  46. #elif defined(TMS320F28069)//C2000???
  47. // don't know
  48. #elif defined(__CC3200R1M1RGC__)//CC3200???
  49. // don't know
  50. #endif
  51. static uint8_t SPImodule;
  52. static uint8_t SPDR;
  53. #elif defined(__AVR__)
  54. /*
  55. --------------------------------------------------------------
  56. 8 BIT AVR BOARDS (UNO,YUN,LEONARDO,ETC.)
  57. Fully supported (tested)
  58. --------------------------------------------------------------
  59. */
  60. #if !defined(_FORCE_PROGMEM__)//avr need this
  61. #define _FORCE_PROGMEM__
  62. #endif
  63. #include "Arduino.h"
  64. #include <pins_arduino.h>
  65. #include <math.h>
  66. #include <avr/pgmspace.h>
  67. #define __PRGMTAG_ PROGMEM
  68. #elif defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MKL26Z64__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
  69. /*
  70. --------------------------------------------------------------
  71. TEENSY 3, TEENSY 3.1, TEENSY 3.2, TEENSY LC
  72. Fully supported (tested)
  73. --------------------------------------------------------------
  74. */
  75. #define ___TEENSYES
  76. #define _FASTCPU//It's a fast CPU with a fast SPI
  77. #include "Arduino.h"
  78. #if defined(_FORCE_PROGMEM__)//arm do not need this
  79. //#include <avr/pgmspace.h>
  80. #undef _FORCE_PROGMEM__//force library not use PROGMEM
  81. //Mmm... Maybe not needed. Maybe useful for user code?
  82. //#define PROGMEM __attribute__((section(".progmem.data")))
  83. #endif
  84. #define __PRGMTAG_
  85. #elif defined(__MK64FX512__) || defined(__MK66FX1M0__) || defined(__IMXRT1062__)
  86. /*
  87. --------------------------------------------------------------
  88. FUTURE TEENSY PRODUCTS
  89. will be supported in future
  90. --------------------------------------------------------------
  91. */
  92. #define ___TEENSYES
  93. #define _FASTCPU//It's a fast CPU with a fast SPI
  94. #include "Arduino.h"
  95. #if defined(_FORCE_PROGMEM__)//arm do not need this
  96. //#include <avr/pgmspace.h>
  97. #undef _FORCE_PROGMEM__//force library not use PROGMEM
  98. //Mmm... Maybe not needed. Maybe useful for user code?
  99. //#define PROGMEM __attribute__((section(".progmem.data")))
  100. #endif
  101. #define __PRGMTAG_
  102. #elif defined(__32MX320F128H__) || defined(__32MX795F512L__) //chipkit uno, chipkit max
  103. /*
  104. --------------------------------------------------------------
  105. CHIPKIT UNO, CHIPKIT MAX
  106. Partially supported and never tested
  107. the following defines need some changes!
  108. --------------------------------------------------------------
  109. */
  110. #define ___CHIPKIT
  111. #define _FASTCPU//It's a fast CPU with a fast SPI
  112. #include "Arduino.h"
  113. #if defined(_FORCE_PROGMEM__)
  114. #undef _FORCE_PROGMEM__
  115. #endif
  116. #ifndef __PGMSPACE_H_
  117. #define __PGMSPACE_H_ 1
  118. #define PROGMEM
  119. //following probably useless!
  120. #define PGM_P const char *
  121. #define PSTR(str) (str)
  122. #define pgm_read_byte_near(addr) pgm_read_byte(addr)
  123. #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
  124. #define pgm_read_word(addr) (*(const unsigned short *)(addr))
  125. #endif
  126. #define __PRGMTAG_
  127. #elif defined (__arm__) && defined(ARDUINO_ARCH_SAM)
  128. /*
  129. --------------------------------------------------------------
  130. ARDUINO DUE
  131. Fully supported (tested)
  132. --------------------------------------------------------------
  133. */
  134. #define ___DUESTUFF
  135. #define _FASTCPU//It's a fast CPU with a fast SPI
  136. #include "Arduino.h"
  137. #include <pins_arduino.h>
  138. #ifndef __PGMSPACE_H_
  139. #define __PGMSPACE_H_ 1
  140. #define PROGMEM
  141. //following probably useless! ARM do not need PROGMEM
  142. #define PGM_P const char *
  143. #define PSTR(str) (str)
  144. #define pgm_read_byte_near(addr) pgm_read_byte(addr)
  145. #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
  146. #define pgm_read_word(addr) (*(const unsigned short *)(addr))
  147. #endif
  148. #define __PRGMTAG_
  149. #elif defined (__arm__) && defined(ARDUINO_ARCH_SAMD)
  150. /*
  151. --------------------------------------------------------------
  152. ARDUINO ZERO
  153. Actually NOT supported
  154. --------------------------------------------------------------
  155. */
  156. #include "Arduino.h"
  157. #include <pins_arduino.h>
  158. #define ___ZEROSTUFF
  159. #error "your board it's not supported yet!"
  160. #elif defined (__arm__) && defined(__SAM3X8E__)
  161. /*
  162. --------------------------------------------------------------
  163. ARDUINO DUE COMPATIBLE
  164. Fully supported (as DUE, tested)
  165. --------------------------------------------------------------
  166. */
  167. #define ___DUESTUFF
  168. #define _FASTCPU
  169. #include "Arduino.h"
  170. #include <pins_arduino.h>
  171. #ifndef __PGMSPACE_H_
  172. #define __PGMSPACE_H_ 1
  173. #define PROGMEM
  174. //following probably useless! ARM do not need PROGMEM
  175. #define PGM_P const char *
  176. #define PSTR(str) (str)
  177. #define pgm_read_byte_near(addr) pgm_read_byte(addr)
  178. #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
  179. #define pgm_read_word(addr) (*(const unsigned short *)(addr))
  180. #endif
  181. #elif !defined(SPARK) && (defined(STM32F2XX) || defined(STM32F10X_MD) || defined(STM32_SERIES_F1) || defined(STM32_SERIES_F2))
  182. /*
  183. --------------------------------------------------------------
  184. STM32 BOARDS
  185. Initial support and actually won't compile
  186. --------------------------------------------------------------
  187. */
  188. #define ___STM32STUFF
  189. #include "Arduino.h"
  190. #if defined(_FORCE_PROGMEM__)
  191. #undef _FORCE_PROGMEM__
  192. #endif
  193. #define __PRGMTAG_
  194. #elif defined(ESP8266)
  195. /*
  196. --------------------------------------------------------------
  197. XTENSA (ESP8266)
  198. It compiles but never tested
  199. --------------------------------------------------------------
  200. */
  201. #include "Arduino.h"
  202. #include <pins_arduino.h>
  203. //#define _FASTCPU
  204. #if defined(_FORCE_PROGMEM__)
  205. //#undef _FORCE_PROGMEM__
  206. #define PROGMEM __attribute__((section(".progmem.data")))//Really necessary? Prolly not
  207. #endif
  208. #define __PRGMTAG_
  209. #elif defined (__arm__) && defined(SPARK)
  210. /*
  211. --------------------------------------------------------------
  212. PARTICLE PHOTON, ETC.
  213. Still in development
  214. --------------------------------------------------------------
  215. */
  216. #include "application.h"
  217. #include "math.h"
  218. /*
  219. #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
  220. #define pgm_read_byte_near(addr) (*(const unsigned char *)(addr))
  221. #define pgm_read_word(addr) (*(const unsigned short *)(addr))
  222. #define pgm_read_word_near(addr) (*(const unsigned short *)(addr))
  223. */
  224. #ifndef bitRead
  225. #define bitRead(a,b) ((a) & (1<<(b)))
  226. #endif
  227. #ifndef bitWrite
  228. #define __bitSet(value, bit) ((value) |= (1UL << (bit)))
  229. #define __bitClear(value, bit) ((value) &= ~(1UL << (bit)))
  230. #define bitWrite(value, bit, bitvalue) (bitvalue ? __bitSet(value, bit) : __bitClear(value, bit))
  231. #endif
  232. #ifndef PI
  233. #define PI 3.14159265358979323846
  234. #endif
  235. #if defined(_FORCE_PROGMEM__)
  236. #undef _FORCE_PROGMEM__
  237. #endif
  238. #undef PROGMEM
  239. //prolly not needed but fix the compiler warning
  240. #define PROGMEM __attribute__((section(".progmem.data")))
  241. //
  242. #define __PRGMTAG_
  243. #elif defined(__arm__) && !defined(ESP8266) && !defined(___TEENSYES) && !defined(SPARK) && !defined(STM32F2XX) && !defined(STM32F10X_MD) && !defined(STM32_SERIES_F1) && !defined(STM32_SERIES_F2) && !defined(ESP8266)
  244. /*
  245. --------------------------------------------------------------
  246. ARM generic
  247. Mistery....
  248. --------------------------------------------------------------
  249. */
  250. #if defined(_FORCE_PROGMEM__)
  251. #undef _FORCE_PROGMEM__
  252. #endif
  253. #include "Arduino.h"
  254. #define __PRGMTAG_
  255. #warning "Generic Arm detected, not sure if your board it's compatible!"
  256. /*
  257. --------------------------------------------------------------
  258. NOT SUPPORTED
  259. --------------------------------------------------------------
  260. */
  261. #else
  262. #error "your board it's not supported yet!"
  263. #endif
  264. #include "Print.h"
  265. #endif