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.

72 lines
2.0KB

  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_RESET 9//any pin or nothing!
  19. #if defined(NEEDS_SET_MODULE)//Energia, this case is for stellaris/tiva
  20. RA8875 tft = RA8875(3);//select SPI module 3
  21. /*
  22. for module 3 (stellaris)
  23. SCLK: PD_0
  24. MOSI: PD_3
  25. MISO: PD_2
  26. SS: PD_1
  27. */
  28. #endif
  29. void setup()
  30. {
  31. // Serial.begin(38400);
  32. // long unsigned debug_start = millis ();
  33. // while (!Serial && ((millis () - debug_start) <= 5000)) ;
  34. // Serial.println("RA8875 start");
  35. tft.begin(RA8875_800x480);
  36. tft.setRotation(0);//works at any rotation as well
  37. tft.setExternalFontRom(ER3304_1, GB2312);//we set the correct ROM
  38. tft.setFont(EXTFONT);//enable ROM
  39. tft.setFontSize(X16);//not all ROM have X16,X24,X32 so check your ROM datasheet!
  40. tft.setFontScale(1);//with ROM font we can use scaling as well
  41. //Font ROM uses same commads as internal fonts....
  42. tft.setTextColor(0xFFFF);
  43. tft.setCursor(CENTER, CENTER);
  44. tft.print("CENTER");
  45. tft.setCursor(0, 0);
  46. tft.println("ROM ascii");
  47. tft.println("«·½¿Æ¼¼ÓÐÏÞ¹«Ë¾");
  48. //tft.println("ÉîÛÚÐñÈÕ¶");
  49. //now switch to internal font
  50. tft.setFont(INTFONT);
  51. tft.println("Internal ascii");
  52. //so you can switch between INTFONT and EXTFONT by using setFont
  53. //without loosing the initial assignments!
  54. }
  55. void loop()
  56. {
  57. }