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.

64 lines
1.9KB

  1. /******************************************************************
  2. An example of how use an external ROM chip with RA8875, this time
  3. the ER3303_1 (same as GT23L24T3Y or GT30H24T3Y), an unified chinese
  4. font rom.
  5. In short:
  6. 1) use setExternalFontRom to set ROM and it's correct encoding
  7. 2) use setFont(EXTFONT) to use the external font
  8. 3) to switch back to internal font ROM, use setFont(INTFONT)
  9. Library can handle the following Font ROM:
  10. GT21L16T1W, GT21H16T1W, GT23L16U2W, GT30H24T3Y, GT23L24T3Y, GT23L24M1Z,
  11. GT23L32S4W, GT30H32S4W, ER3303_1
  12. Each font ROM has it's encoding so follow font rom datasheet!
  13. Not working? You don't have the correct font rom installed!
  14. Choose yours!
  15. ******************************************************************/
  16. #include <SPI.h>
  17. #include <RA8875.h>
  18. #define RA8875_CS 10
  19. #define RA8875_RESET 9//any pin or 255 to disable it!
  20. RA8875 tft = RA8875(RA8875_CS, RA8875_RESET);
  21. void setup()
  22. {
  23. // Serial.begin(38400);
  24. // long unsigned debug_start = millis ();
  25. // while (!Serial && ((millis () - debug_start) <= 5000)) ;
  26. // Serial.println("RA8875 start");
  27. tft.begin(RA8875_800x480);
  28. tft.setRotation(0);//works at any rotation as well
  29. tft.setExternalFontRom(ER3304_1, GB2312);//we set the correct ROM
  30. tft.setFont(EXTFONT);//enable ROM
  31. tft.setFontSize(X16);//not all ROM have X16,X24,X32 so check your ROM datasheet!
  32. tft.setFontScale(1);//with ROM font we can use scaling as well
  33. //Font ROM uses same commads as internal fonts....
  34. tft.setTextColor(0xFFFF);
  35. tft.setCursor(CENTER, CENTER);
  36. tft.print("CENTER");
  37. tft.setCursor(0, 0);
  38. tft.println("ROM ascii");
  39. tft.println("«·½¿Æ¼¼ÓÐÏÞ¹«Ë¾");
  40. //tft.println("ÉîÛÚÐñÈÕ¶");
  41. //now switch to internal font
  42. tft.setFont(INTFONT);
  43. tft.println("Internal ascii");
  44. //so you can switch between INTFONT and EXTFONT by using setFont
  45. //without loosing the initial assignments!
  46. }
  47. void loop()
  48. {
  49. }