PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

56 líneas
1.5KB

  1. /*
  2. this sketch demostrate the ability to rotate screen .
  3. since his introduction, setRotation created some problems in library
  4. because RA8875 does most of his stuff internally so from library version 0.69b21
  5. code has many changes to fix the rotation issues.
  6. */
  7. #include <SPI.h>
  8. #include <RA8875.h>
  9. #define RA8875_CS 10 //see below...
  10. #define RA8875_RESET 9//any pin or 255 to disable it!
  11. RA8875 tft = RA8875(RA8875_CS,RA8875_RESET);//arduino's
  12. void setup()
  13. {
  14. Serial.begin(38400);
  15. //long unsigned debug_start = millis ();
  16. //while (!Serial && ((millis () - debug_start) <= 5000)) ;
  17. //Serial.println("RA8875 start");
  18. tft.begin(RA8875_800x480);
  19. }
  20. uint8_t rot = 0;
  21. void loop()
  22. {
  23. tft.fillWindow();
  24. tft.setRotation(rot);
  25. tft.setCursor(0,0);
  26. tft.print("[rotation ");
  27. tft.print(rot);
  28. tft.print("]");
  29. tft.setCursor(100,0);
  30. tft.print("txt shifted to X100");
  31. tft.setCursor(0,20);
  32. tft.print("txt shifted to Y20");
  33. tft.drawCircle(tft.width()/2,tft.height()/2,50,RA8875_GREEN);
  34. tft.drawRect((tft.width()/2)-50,(tft.height()/2)-25,100,50,RA8875_YELLOW);
  35. tft.drawEllipse(tft.width()/2,tft.height()/2,50,25,RA8875_CYAN);
  36. tft.drawTriangle((tft.width()/2)-50,(tft.height()/2)-25,tft.width()/2,(tft.height()/2)+25,(tft.width()/2)+50,(tft.height()/2)-25,RA8875_RED);
  37. tft.drawPixel(tft.width()/2,tft.height()/2,RA8875_WHITE);
  38. tft.drawFastVLine(tft.width()/2,(tft.height()/2)-60,60,RA8875_RED);
  39. tft.drawFastHLine((tft.width()/2)-60,tft.height()/2,60,RA8875_RED);
  40. delay(3000);
  41. if (rot > 3) rot = 0;
  42. rot++;
  43. }