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.

rotationTest.ino 1.5KB

3 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. }