Uses the same fonts as the SPI_TFT_ILI9341 Library (I have many, and a html/php font editor for that)

Revision:
7:2616ae4dd315
Parent:
5:dad648238df3
Child:
8:a569bc50b552
--- a/SPI_TFT_ILI9225.cpp	Wed Nov 23 10:15:47 2016 +0000
+++ b/SPI_TFT_ILI9225.cpp	Wed Nov 23 11:05:33 2016 +0000
@@ -53,7 +53,8 @@
     init();
 }
 
-bool TFT_22_ILI9225::claim (FILE *stream) {
+bool TFT_22_ILI9225::claim (FILE *stream)
+{
     if ( _path == NULL) {
         fprintf(stderr, "claim requires a name to be given in the instantioator of the TextDisplay instance!\r\n");
         return false;
@@ -67,8 +68,8 @@
     return true;
 } 
 
-void TFT_22_ILI9225::_orientCoordinates(uint16_t &x1, uint16_t &y1) {
-
+void TFT_22_ILI9225::_orientCoordinates(uint16_t &x1, uint16_t &y1)
+{
     switch (_orientation) {
         case 0:  // ok
             break;
@@ -87,11 +88,13 @@
     }
 }
 
-void TFT_22_ILI9225::_setWindowMax(void) {
+void TFT_22_ILI9225::_setWindowMax(void)
+{
     _setWindow(0, 0, maxX(), maxY());
 }
 
-void TFT_22_ILI9225::_setWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) {
+void TFT_22_ILI9225::_setWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1)
+{
     _orientCoordinates(x0, y0);
     _orientCoordinates(x1, y1);
 
@@ -188,7 +191,8 @@
     background(COLOR_BLACK);
 }
 
-void TFT_22_ILI9225::cls() {
+void TFT_22_ILI9225::cls()
+{
     setBacklightOff();
     _setWindowMax();
     _rs = 1;
@@ -207,21 +211,25 @@
     fillrect(0, 0, maxX(), maxY(), color);
 }
 
-void TFT_22_ILI9225::invert(bool flag) {
+void TFT_22_ILI9225::invert(bool flag)
+{
     _writeCommand(0x00, flag ? ILI9225C_INVON : ILI9225C_INVOFF);
 }
 
-void TFT_22_ILI9225::setBacklight(double brightness) {
+void TFT_22_ILI9225::setBacklight(double brightness)
+{
     // PWM output to control backlight
     _brightness = brightness;
     _led.write(pow(brightness, 2)); // power(x, 2): For the eye better brightness response
 }
 
-void TFT_22_ILI9225::setBacklightOff(void) {
+void TFT_22_ILI9225::setBacklightOff(void)
+{
     _led.write(0.0f);
 }
 
-void TFT_22_ILI9225::setBacklightOn(void) {
+void TFT_22_ILI9225::setBacklightOn(void)
+{
     setBacklight(_brightness);
 }
 
@@ -341,15 +349,28 @@
     }
 }
 
+void TFT_22_ILI9225::hline(uint16_t x0, uint16_t x1, uint16_t y, uint16_t color) {
+    for (uint16_t x = x0; x < x1; x++) {
+        pixel(x, y, color);
+    } 
+}
+
+void TFT_22_ILI9225::vline(uint16_t x, uint16_t y0, uint16_t y1, uint16_t color) {
+    for (uint16_t y = y0; y < y1; y++) {
+        pixel(x, y, color);
+    } 
+}
+
 void TFT_22_ILI9225::rect(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color) {
-    line(x1, y1, x1, y2, color);
-    line(x1, y1, x2, y1, color);
-    line(x1, y2, x2, y2, color);
-    line(x2, y1, x2, y2, color);
+    
+    vline(x1, y1, y2, color);
+    hline(x1, x2, y1, color);
+    hline(x1, x2, y2, color);
+    vline(x2, y1, y2, color);
 }
 
 void TFT_22_ILI9225::fillrect(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color) {
-
+    
     _setWindow(x1, y1, x2, y2);
     _startData();
     for (uint16_t t = (y2 - y1 + 1) * (x2 - x1 + 1); t > 0; t--) {