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.

extFontRom2.ino 2.0KB

3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. // begin display: Choose from: RA8875_480x272, RA8875_800x480, RA8875_800x480ALT, Adafruit_480x272, Adafruit_800x480
  28. tft.begin(RA8875_800x480);
  29. tft.setRotation(0);//works at any rotation as well
  30. tft.setExternalFontRom(ER3304_1, GB2312);//we set the correct ROM
  31. tft.setFont(EXTFONT);//enable ROM
  32. tft.setFontSize(X16);//not all ROM have X16,X24,X32 so check your ROM datasheet!
  33. tft.setFontScale(1);//with ROM font we can use scaling as well
  34. //Font ROM uses same commads as internal fonts....
  35. tft.setTextColor(0xFFFF);
  36. tft.setCursor(CENTER, CENTER);
  37. tft.print("CENTER");
  38. tft.setCursor(0, 0);
  39. tft.println("ROM ascii");
  40. tft.println("«·½¿Æ¼¼ÓÐÏÞ¹«Ë¾");
  41. //tft.println("ÉîÛÚÐñÈÕ¶");
  42. //now switch to internal font
  43. tft.setFont(INTFONT);
  44. tft.println("Internal ascii");
  45. //so you can switch between INTFONT and EXTFONT by using setFont
  46. //without loosing the initial assignments!
  47. }
  48. void loop()
  49. {
  50. }