PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
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.

RA8875_CPU_commons.h 5.8KB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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. #elif defined(__LM4F120H5QR__) || defined(__TM4C123GH6PM__)//stellaris first version
  34. #define NEEDS_SET_MODULE
  35. #define _FASTCPU
  36. #elif defined(__MSP430MCU__)//MSP430???
  37. // don't know
  38. #elif defined(TMS320F28069)//C2000???
  39. // don't know
  40. #elif defined(__CC3200R1M1RGC__)//CC3200???
  41. // don't know
  42. #endif
  43. static uint8_t SPImodule;
  44. static uint8_t SPDR;
  45. #elif defined(__AVR__)
  46. /*
  47. --------------------------------------------------------------
  48. 8 BIT AVR BOARDS (UNO,YUN,LEONARDO,ETC.)
  49. Fully supported (tested)
  50. --------------------------------------------------------------
  51. */
  52. #if !defined(_FORCE_PROGMEM__)
  53. #define _FORCE_PROGMEM__
  54. #endif
  55. #define __PRGMTAG_ PROGMEM
  56. #include "Arduino.h"
  57. #include <math.h>
  58. #include <avr/pgmspace.h>
  59. #elif defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MKL26Z64__)
  60. /*
  61. --------------------------------------------------------------
  62. TEENSY 3, TEENSY 3.1, TEENSY 3.2, TEENSY LC
  63. Fully supported (tested)
  64. --------------------------------------------------------------
  65. */
  66. #define ___TEENSYES
  67. #define _FASTCPU
  68. #include "Arduino.h"
  69. #include <avr/pgmspace.h>//Teensy3 and AVR arduinos can use pgmspace.h
  70. #if defined(_FORCE_PROGMEM__)
  71. #undef _FORCE_PROGMEM__
  72. #define PROGMEM __attribute__((section(".progmem.data")))
  73. #endif
  74. #define __PRGMTAG_
  75. #elif defined(__32MX320F128H__) || defined(__32MX795F512L__) //chipkit uno, chipkit max
  76. /*
  77. --------------------------------------------------------------
  78. CHIPKIT UNO, CHIPKIT MAX
  79. Partially supported and never tested
  80. --------------------------------------------------------------
  81. */
  82. #define ___CHIPKIT
  83. #define _FASTCPU
  84. #include "Arduino.h"
  85. #ifndef __PGMSPACE_H_
  86. #define __PGMSPACE_H_ 1
  87. #define PROGMEM
  88. #define PGM_P const char *
  89. #define PSTR(str) (str)
  90. #define pgm_read_byte_near(addr) pgm_read_byte(addr)
  91. #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
  92. #define pgm_read_word(addr) (*(const unsigned short *)(addr))
  93. #endif
  94. #define __PRGMTAG_
  95. #elif defined (__arm__) && defined(_VARIANT_ARDUINO_DUE_X_)
  96. /*
  97. --------------------------------------------------------------
  98. ARDUINO DUE
  99. Fully supported (tested)
  100. --------------------------------------------------------------
  101. */
  102. #define ___DUESTUFF
  103. #define _FASTCPU
  104. #include "Arduino.h"
  105. #ifndef __PGMSPACE_H_
  106. #define __PGMSPACE_H_ 1
  107. #define PROGMEM
  108. #define PGM_P const char *
  109. #define PSTR(str) (str)
  110. #define pgm_read_byte_near(addr) pgm_read_byte(addr)
  111. #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
  112. #define pgm_read_word(addr) (*(const unsigned short *)(addr))
  113. #endif
  114. #define __PRGMTAG_
  115. #elif defined (__arm__) && defined(__SAM3X8E__)
  116. /*
  117. --------------------------------------------------------------
  118. ARDUINO DUE COMPATIBLE
  119. Fully supported (as DUE, tested)
  120. --------------------------------------------------------------
  121. */
  122. #define ___DUESTUFF
  123. #define _FASTCPU
  124. #include "Arduino.h"
  125. #ifndef __PGMSPACE_H_
  126. #define __PGMSPACE_H_ 1
  127. #define PROGMEM
  128. #define PGM_P const char *
  129. #define PSTR(str) (str)
  130. #define pgm_read_byte_near(addr) pgm_read_byte(addr)
  131. #define pgm_read_byte(addr) (*(const unsigned char *)(addr))
  132. #define pgm_read_word(addr) (*(const unsigned short *)(addr))
  133. #endif
  134. #elif defined(STM32F2XX) || defined(STM32F10X_MD) || defined(STM32_SERIES_F1) || defined(STM32_SERIES_F2)
  135. /*
  136. --------------------------------------------------------------
  137. STM32 BOARDS
  138. Initial support and actually won't compile
  139. --------------------------------------------------------------
  140. */
  141. #define ___STM32STUFF
  142. #include "Arduino.h"
  143. #if defined(_FORCE_PROGMEM__)
  144. #undef _FORCE_PROGMEM__
  145. #endif
  146. #define __PRGMTAG_
  147. #elif defined(__arm__) && !defined(__XTENSA__) && !defined(___TEENSYES)
  148. /*
  149. --------------------------------------------------------------
  150. ARM generic
  151. Mistery....
  152. --------------------------------------------------------------
  153. */
  154. #if defined(_FORCE_PROGMEM__)
  155. #undef _FORCE_PROGMEM__
  156. #endif
  157. #include "Arduino.h"
  158. #define __PRGMTAG_
  159. #warning "Generic Arm detected, not sure if your board it's compatible!"
  160. #elif defined(__XTENSA__)
  161. /*
  162. --------------------------------------------------------------
  163. XTENSA (ESP)
  164. It compiles but never tested
  165. --------------------------------------------------------------
  166. */
  167. #include "Arduino.h"
  168. #if defined(_FORCE_PROGMEM__)
  169. #undef _FORCE_PROGMEM__
  170. #define PROGMEM __attribute__((section(".progmem.data")))
  171. #endif
  172. #define __PRGMTAG_
  173. #else
  174. #error "your board it's not supported yet!"
  175. #endif
  176. #include "Print.h"
  177. #endif