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.

fontRendering.ino 1.5KB

3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. This shows the capabilities of the library text engine that is
  3. extremely flexible and simple! All commands are the same for all type of text
  4. (INT,EXT or Render ones) and things like println works too.
  5. You can use all the print() options (like print(var,HEX), etc. Take a look the print command
  6. in the arduino guide!)
  7. */
  8. #include <SPI.h>
  9. #include <RA8875.h>
  10. #include "fonts/akashi_36.c"//minipixel
  11. #define RA8875_RESET 9//any pin or nothing!
  12. #if defined(NEEDS_SET_MODULE)//Energia, this case is for stellaris/tiva
  13. RA8875 tft = RA8875(3);//select SPI module 3
  14. /*
  15. for module 3 (stellaris)
  16. SCLK: PD_0
  17. MOSI: PD_3
  18. MISO: PD_2
  19. SS: PD_1
  20. */
  21. #endif
  22. void setup()
  23. {
  24. // Serial.begin(38400);
  25. // long unsigned debug_start = millis ();
  26. // while (!Serial && ((millis () - debug_start) <= 5000)) ;
  27. // Serial.println("RA8875 start");
  28. tft.begin(RA8875_800x480);
  29. tft.setRotation(0);//works at any rotation as well
  30. tft.setFont(&akashi_36);
  31. tft.setFontScale(3);
  32. tft.setCursor(CENTER,0);
  33. tft.setTextColor(RA8875_GREEN);//notice that! After grandient text will be this color!
  34. //grandient it's one shot, text color will be reset as the one choosed by setTextColor
  35. tft.setTextGrandient(RA8875_RED,RA8875_CYAN);//works also with rendered text!
  36. tft.println("CD 0123");
  37. tft.println("ABCD");//notice that correctly goes in another line
  38. tft.setFont(INT);
  39. tft.setTextColor(RA8875_WHITE);//Force white
  40. tft.println("this is the internal text.");//notice that correctly goes in another line too!
  41. }
  42. void loop()
  43. {
  44. }