PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

63 linhas
1.6KB

  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_RESET 9//any pin or nothing!
  10. #if defined(NEEDS_SET_MODULE)//Energia, this case is for stellaris/tiva
  11. RA8875 tft = RA8875(3);//select SPI module 3
  12. /*
  13. for module 3 (stellaris)
  14. SCLK: PD_0
  15. MOSI: PD_3
  16. MISO: PD_2
  17. SS: PD_1
  18. */
  19. #endif
  20. void setup()
  21. {
  22. Serial.begin(38400);
  23. //long unsigned debug_start = millis ();
  24. //while (!Serial && ((millis () - debug_start) <= 5000)) ;
  25. //Serial.println("RA8875 start");
  26. tft.begin(RA8875_800x480);
  27. }
  28. uint8_t rot = 0;
  29. void loop()
  30. {
  31. tft.fillWindow();
  32. tft.setRotation(rot);
  33. tft.setCursor(0,0);
  34. tft.print("[rotation ");
  35. tft.print(rot);
  36. tft.print("]");
  37. tft.setCursor(100,0);
  38. tft.print("txt shifted to X100");
  39. tft.setCursor(0,20);
  40. tft.print("txt shifted to Y20");
  41. tft.drawCircle(tft.width()/2,tft.height()/2,50,RA8875_GREEN);
  42. tft.drawRect((tft.width()/2)-50,(tft.height()/2)-25,100,50,RA8875_YELLOW);
  43. tft.drawEllipse(tft.width()/2,tft.height()/2,50,25,RA8875_CYAN);
  44. 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);
  45. tft.drawPixel(tft.width()/2,tft.height()/2,RA8875_WHITE);
  46. tft.drawFastVLine(tft.width()/2,(tft.height()/2)-60,60,RA8875_RED);
  47. tft.drawFastHLine((tft.width()/2)-60,tft.height()/2,60,RA8875_RED);
  48. delay(3000);
  49. if (rot > 3) rot = 0;
  50. rot++;
  51. }