#ifndef _RA8875_CPU_H_ #define _RA8875_CPU_H_ /* CPU based Preprocessor directives file. RA8875 Library support many MCU's so I wroted this to simplify the overall code. Part of RA8875 library from https://github.com/sumotoy/RA8875 RA8875 fast SPI library for RAiO SPI RA8875 drived TFT Copyright (C) 2014 egidio massimo costa sumotoy (a t) gmail.com This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* -------------------------------------------------------------- ENERGIA BASED BOARDS Partially supported and actually never tested -------------------------------------------------------------- */ #if defined(ENERGIA) #include "Energia.h" #undef byte #define byte uint8_t #if defined(__TM4C129XNCZAD__) || defined(__TM4C1294NCPDT__)//tiva??? #define NEEDS_SET_MODULE #define _FASTCPU #if defined(_FORCE_PROGMEM__)//arm do not need this #undef _FORCE_PROGMEM__//force library not use PROGMEM #endif #define __PRGMTAG_ #elif defined(__LM4F120H5QR__) || defined(__TM4C123GH6PM__)//stellaris first version #define NEEDS_SET_MODULE #define _FASTCPU #if defined(_FORCE_PROGMEM__)//arm do not need this #undef _FORCE_PROGMEM__//force library not use PROGMEM #endif #define __PRGMTAG_ #elif defined(__MSP430MCU__)//MSP430??? // don't know #elif defined(TMS320F28069)//C2000??? // don't know #elif defined(__CC3200R1M1RGC__)//CC3200??? // don't know #endif static uint8_t SPImodule; static uint8_t SPDR; #elif defined(__AVR__) /* -------------------------------------------------------------- 8 BIT AVR BOARDS (UNO,YUN,LEONARDO,ETC.) Fully supported (tested) -------------------------------------------------------------- */ #if !defined(_FORCE_PROGMEM__)//avr need this #define _FORCE_PROGMEM__ #endif #include "Arduino.h" #include #include #include #define __PRGMTAG_ PROGMEM #elif defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MKL26Z64__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) /* -------------------------------------------------------------- TEENSY 3, TEENSY 3.1, TEENSY 3.2, TEENSY LC Fully supported (tested) -------------------------------------------------------------- */ #define ___TEENSYES #define _FASTCPU//It's a fast CPU with a fast SPI #include "Arduino.h" #if defined(_FORCE_PROGMEM__)//arm do not need this //#include #undef _FORCE_PROGMEM__//force library not use PROGMEM //Mmm... Maybe not needed. Maybe useful for user code? //#define PROGMEM __attribute__((section(".progmem.data"))) #endif #define __PRGMTAG_ #elif defined(__MK64FX512__) || defined(__MK66FX1M0__) || defined(__IMXRT1062__) /* -------------------------------------------------------------- FUTURE TEENSY PRODUCTS will be supported in future -------------------------------------------------------------- */ #define ___TEENSYES #define _FASTCPU//It's a fast CPU with a fast SPI #include "Arduino.h" #if defined(_FORCE_PROGMEM__)//arm do not need this //#include #undef _FORCE_PROGMEM__//force library not use PROGMEM //Mmm... Maybe not needed. Maybe useful for user code? //#define PROGMEM __attribute__((section(".progmem.data"))) #endif #define __PRGMTAG_ #elif defined(__32MX320F128H__) || defined(__32MX795F512L__) //chipkit uno, chipkit max /* -------------------------------------------------------------- CHIPKIT UNO, CHIPKIT MAX Partially supported and never tested the following defines need some changes! -------------------------------------------------------------- */ #define ___CHIPKIT #define _FASTCPU//It's a fast CPU with a fast SPI #include "Arduino.h" #if defined(_FORCE_PROGMEM__) #undef _FORCE_PROGMEM__ #endif #ifndef __PGMSPACE_H_ #define __PGMSPACE_H_ 1 #define PROGMEM //following probably useless! #define PGM_P const char * #define PSTR(str) (str) #define pgm_read_byte_near(addr) pgm_read_byte(addr) #define pgm_read_byte(addr) (*(const unsigned char *)(addr)) #define pgm_read_word(addr) (*(const unsigned short *)(addr)) #endif #define __PRGMTAG_ #elif defined (__arm__) && defined(ARDUINO_ARCH_SAM) /* -------------------------------------------------------------- ARDUINO DUE Fully supported (tested) -------------------------------------------------------------- */ #define ___DUESTUFF #define _FASTCPU//It's a fast CPU with a fast SPI #include "Arduino.h" #include #ifndef __PGMSPACE_H_ #define __PGMSPACE_H_ 1 #define PROGMEM //following probably useless! ARM do not need PROGMEM #define PGM_P const char * #define PSTR(str) (str) #define pgm_read_byte_near(addr) pgm_read_byte(addr) #define pgm_read_byte(addr) (*(const unsigned char *)(addr)) #define pgm_read_word(addr) (*(const unsigned short *)(addr)) #endif #define __PRGMTAG_ #elif defined (__arm__) && defined(ARDUINO_ARCH_SAMD) /* -------------------------------------------------------------- ARDUINO ZERO Actually NOT supported -------------------------------------------------------------- */ #include "Arduino.h" #include #define ___ZEROSTUFF #error "your board it's not supported yet!" #elif defined (__arm__) && defined(__SAM3X8E__) /* -------------------------------------------------------------- ARDUINO DUE COMPATIBLE Fully supported (as DUE, tested) -------------------------------------------------------------- */ #define ___DUESTUFF #define _FASTCPU #include "Arduino.h" #include #ifndef __PGMSPACE_H_ #define __PGMSPACE_H_ 1 #define PROGMEM //following probably useless! ARM do not need PROGMEM #define PGM_P const char * #define PSTR(str) (str) #define pgm_read_byte_near(addr) pgm_read_byte(addr) #define pgm_read_byte(addr) (*(const unsigned char *)(addr)) #define pgm_read_word(addr) (*(const unsigned short *)(addr)) #endif #elif !defined(SPARK) && (defined(STM32F2XX) || defined(STM32F10X_MD) || defined(STM32_SERIES_F1) || defined(STM32_SERIES_F2)) /* -------------------------------------------------------------- STM32 BOARDS Initial support and actually won't compile -------------------------------------------------------------- */ #define ___STM32STUFF #include "Arduino.h" #if defined(_FORCE_PROGMEM__) #undef _FORCE_PROGMEM__ #endif #define __PRGMTAG_ #elif defined(ESP8266) /* -------------------------------------------------------------- XTENSA (ESP8266) It compiles but never tested -------------------------------------------------------------- */ #include "Arduino.h" #include //#define _FASTCPU #if defined(_FORCE_PROGMEM__) //#undef _FORCE_PROGMEM__ #define PROGMEM __attribute__((section(".progmem.data")))//Really necessary? Prolly not #endif #define __PRGMTAG_ #elif defined (__arm__) && defined(SPARK) /* -------------------------------------------------------------- PARTICLE PHOTON, ETC. Still in development -------------------------------------------------------------- */ #include "application.h" #include "math.h" /* #define pgm_read_byte(addr) (*(const unsigned char *)(addr)) #define pgm_read_byte_near(addr) (*(const unsigned char *)(addr)) #define pgm_read_word(addr) (*(const unsigned short *)(addr)) #define pgm_read_word_near(addr) (*(const unsigned short *)(addr)) */ #ifndef bitRead #define bitRead(a,b) ((a) & (1<<(b))) #endif #ifndef bitWrite #define __bitSet(value, bit) ((value) |= (1UL << (bit))) #define __bitClear(value, bit) ((value) &= ~(1UL << (bit))) #define bitWrite(value, bit, bitvalue) (bitvalue ? __bitSet(value, bit) : __bitClear(value, bit)) #endif #ifndef PI #define PI 3.14159265358979323846 #endif #if defined(_FORCE_PROGMEM__) #undef _FORCE_PROGMEM__ #endif #undef PROGMEM //prolly not needed but fix the compiler warning #define PROGMEM __attribute__((section(".progmem.data"))) // #define __PRGMTAG_ #elif defined(__arm__) && !defined(ESP8266) && !defined(___TEENSYES) && !defined(SPARK) && !defined(STM32F2XX) && !defined(STM32F10X_MD) && !defined(STM32_SERIES_F1) && !defined(STM32_SERIES_F2) && !defined(ESP8266) /* -------------------------------------------------------------- ARM generic Mistery.... -------------------------------------------------------------- */ #if defined(_FORCE_PROGMEM__) #undef _FORCE_PROGMEM__ #endif #include "Arduino.h" #define __PRGMTAG_ #warning "Generic Arm detected, not sure if your board it's compatible!" /* -------------------------------------------------------------- NOT SUPPORTED -------------------------------------------------------------- */ #else #error "your board it's not supported yet!" #endif #include "Print.h" #endif