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.

78 lines
2.3KB

  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. uint16_t tx, ty;
  30. void setup()
  31. {
  32. tft.begin(RA8875_800x480);
  33. //tft.changeMode(TEXT);
  34. tft.setTextColor(RA8875_WHITE);
  35. //now set the external rom font ER3303_1 an unified chinese font chip,
  36. //it contains also some ASCII char and use GB12345 encoding.
  37. //It's important to read your font chip datasheet or you will
  38. //get from nothing ti garbage on screen!
  39. tft.setExternalFontRom(ER3303_1,GB12345);
  40. //switch to external rom
  41. tft.setFont(EXTFONT);
  42. //now write some chinese....
  43. //note that when using ext font chip the size will be X24
  44. //since most of font maps are 24x24.
  45. tft.print("ÉîÛÚÐñÈÕ¶«·½¿Æ¼¼ÓÐÏÞ¹«Ë¾"); //
  46. //the X16 sixe of ROM ER3303_1 can also use ASCII...
  47. tft.setFontSize(X16);//switch to X16
  48. tft.setTextColor(RA8875_RED);
  49. tft.setCursor(0,50);
  50. tft.println("ABCD 1234567890"); //I will use println this time!
  51. //switch to internal rom
  52. tft.setFont(INTFONT);
  53. tft.setTextColor(RA8875_GREEN);
  54. tft.println("ABCD 1234567890");
  55. //not bad neh? you can use different encodings without use
  56. //any MCU memory, just add an hardware font chip and istruct library.
  57. tft.setFont(EXTFONT);
  58. //you can switching back on the fly to EXTFONT
  59. tft.print("ÉîÛÚÐñÈÕ¶«·½¿Æ¼¼ÓÐÏÞ¹«Ë¾");
  60. //voilà
  61. }
  62. void loop()
  63. {
  64. }