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.

105 lines
2.7KB

  1. /***************************************************
  2. This is our GFX example for the Adafruit ILI9488 Breakout and Shield
  3. ----> http://www.adafruit.com/products/1651
  4. Check out the links above for our tutorials and wiring diagrams
  5. These displays use SPI to communicate, 4 or 5 pins are required to
  6. interface (RST is optional)
  7. Adafruit invests time and resources providing this open source code,
  8. please support Adafruit and open-source hardware by purchasing
  9. products from Adafruit!
  10. Written by Limor Fried/Ladyada for Adafruit Industries.
  11. MIT license, all text above must be included in any redistribution
  12. ****************************************************/
  13. #include <SPI.h>
  14. #include <ILI9488_t3.h>
  15. #include <ILI9488_t3_font_ComicSansMS.h>
  16. //#define TEENSY64
  17. // For the Adafruit shield, these are the default.
  18. #if defined(__MK66FX1M0__) && !defined(TEENSY64)
  19. #define TFT_RST 8
  20. #define TFT_DC 9
  21. #define TFT_CS 10
  22. ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST);
  23. #elif defined(__IMXRT1052__) || defined(__IMXRT1062__)
  24. // On Teensy 4 beta with Paul's breakout out:
  25. // Using pins (MOSI, MISO, SCK which are labeled on Audio board breakout location
  26. // which are not in the Normal processor positions
  27. // Also DC=10(CS), CS=9(BCLK) and RST 23(MCLK)
  28. #define TFT_RST 23
  29. #define TFT_DC 9
  30. #define TFT_CS 10
  31. ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST);
  32. #elif defined(TEENSY64)
  33. #define TFT_RST 255
  34. #define TFT_DC 20
  35. #define TFT_CS 21
  36. #define TFT_SCK 14
  37. #define TFT_MISO 39
  38. #define TFT_MOSI 28
  39. ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCK, TFT_MISO);
  40. #else
  41. #error "This example App will only work with Teensy 3.6 or Teensy 4."
  42. #endif
  43. // If using the breakout, change pins as desired
  44. //Adafruit_ILI9488 tft = Adafruit_ILI9488(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);
  45. void setup() {
  46. Serial.begin(9600);
  47. tft.begin();
  48. tft.setRotation(3);
  49. tft.fillScreen(ILI9488_BLACK);
  50. while (!Serial) ;
  51. tft.setTextColor(ILI9488_WHITE); tft.setTextSize(4);
  52. tft.enableScroll();
  53. tft.setScrollTextArea(0,0,120,240);
  54. tft.setScrollBackgroundColor(ILI9488_GREEN);
  55. tft.setCursor(180, 100);
  56. tft.setFont(ComicSansMS_12);
  57. tft.print("Fixed text");
  58. tft.setCursor(0, 0);
  59. tft.setTextColor(ILI9488_BLACK);
  60. for(int i=0;i<20;i++){
  61. tft.print(" this is line ");
  62. tft.println(i);
  63. delay(500);
  64. }
  65. tft.fillScreen(ILI9488_BLACK);
  66. tft.setScrollTextArea(40,50,120,120);
  67. tft.setScrollBackgroundColor(ILI9488_GREEN);
  68. tft.setFont(ComicSansMS_10);
  69. tft.setTextSize(1);
  70. tft.setCursor(40, 50);
  71. for(int i=0;i<20;i++){
  72. tft.print(" this is line ");
  73. tft.println(i);
  74. delay(500);
  75. }
  76. }
  77. void loop(void) {
  78. }