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

Revision:
6:0f26c28b9bc0
Parent:
5:dad648238df3
Child:
7:2616ae4dd315
--- a/SPI_TFT_ILI9225.h	Wed Nov 23 10:08:24 2016 +0000
+++ b/SPI_TFT_ILI9225.h	Wed Nov 23 10:15:47 2016 +0000
@@ -102,25 +102,6 @@
 #define COLOR_SNOW           RGB888_RGB565(0xFFFAFAu)
 #define COLOR_YELLOW         RGB888_RGB565(0xFFFF00u)
 
-/* Font defines */
-#define FONT_HEADER_SIZE 4 // 1: pixel width of 1 font character, 2: pixel height, 
-#define readFontByte(x) pgm_read_byte(&cfont.font[x])  
-
-extern uint8_t Terminal6x8[];
-extern uint8_t Terminal11x16[];
-extern uint8_t Terminal12x16[];
-extern uint8_t Trebuchet_MS16x21[];
-
-struct _currentFont
-{
-    uint8_t* font;
-    uint8_t width;
-    uint8_t height;
-    uint8_t offset;
-    uint8_t numchars;
-    uint8_t nbrows;
-};
-
 /// Main and core class
 class TFT_22_ILI9225 : public Stream {
 
@@ -194,19 +175,13 @@
     /// @note   176 means 176 pixels and thus 0..175 coordinates (decimal)
     uint16_t height(void);
 
-    /// Draw circle
-    /// @param  x0 center, point coordinate, x-axis
-    /// @param  y0 center, point coordinate, y-axis
-    /// @param  radius radius
-    /// @param  color 16-bit color
-    void circle(uint16_t x0, uint16_t y0, uint16_t radius, uint16_t color);
+    // Graphics functions
 
-    /// Draw solid circle
-    /// @param  x0 center, point coordinate, x-axis
-    /// @param  y0 center, point coordinate, y-axis
-    /// @param  radius radius
+    /// Draw pixel
+    /// @param  x1 point coordinate, x-axis
+    /// @param  y1 point coordinate, y-axis
     /// @param  color 16-bit color
-    void fillcircle(uint8_t x0, uint8_t y0, uint8_t radius, uint16_t color);
+    void pixel(uint16_t x1, uint16_t y1, uint16_t color);
 
     /// Draw line, rectangle coordinates
     /// @param  x1 top left coordinate, x-axis
@@ -232,25 +207,19 @@
     /// @param  color 16-bit color
     void fillrect(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);
 
-    /// Draw pixel
-    /// @param  x1 point coordinate, x-axis
-    /// @param  y1 point coordinate, y-axis
+    /// Draw circle
+    /// @param  x0 center, point coordinate, x-axis
+    /// @param  y0 center, point coordinate, y-axis
+    /// @param  radius radius
     /// @param  color 16-bit color
-    void pixel(uint16_t x1, uint16_t y1, uint16_t color);
+    void circle(uint16_t x0, uint16_t y0, uint16_t radius, uint16_t color);
 
-    /// Calculate 16-bit color from 8-bit Red-Green-Blue components
-    /// @param  red red component, 0x00..0xff
-    /// @param  green green component, 0x00..0xff
-    /// @param  blue blue component, 0x00..0xff
-    /// @return 16-bit color
-    uint16_t setColor(uint8_t red, uint8_t green, uint8_t blue);
-
-    /// Calculate 8-bit Red-Green-Blue components from 16-bit color
-    /// @param  rgb 16-bit color
-    /// @param  red red component, 0x00..0xff
-    /// @param  green green component, 0x00..0xff
-    /// @param  blue blue component, 0x00..0xff
-    void splitColor(uint16_t rgb, uint8_t &red, uint8_t &green, uint8_t &blue);
+    /// Draw solid circle
+    /// @param  x0 center, point coordinate, x-axis
+    /// @param  y0 center, point coordinate, y-axis
+    /// @param  radius radius
+    /// @param  color 16-bit color
+    void fillcircle(uint8_t x0, uint8_t y0, uint8_t radius, uint16_t color);
 
     /// Draw triangle, triangle coordinates
     /// @param  x1 corner 1 coordinate, x-axis
@@ -272,25 +241,39 @@
     /// @param  color 16-bit color
     void filltriangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t x3, uint16_t y3, uint16_t color);
 
+    /// Calculate 16-bit color from 8-bit Red-Green-Blue components
+    /// @param  red red component, 0x00..0xff
+    /// @param  green green component, 0x00..0xff
+    /// @param  blue blue component, 0x00..0xff
+    /// @return 16-bit color
+    uint16_t setColor(uint8_t red, uint8_t green, uint8_t blue);
+
+    /// Calculate 8-bit Red-Green-Blue components from 16-bit color
+    /// @param  rgb 16-bit color
+    /// @param  red red component, 0x00..0xff
+    /// @param  green green component, 0x00..0xff
+    /// @param  blue blue component, 0x00..0xff
+    void splitColor(uint16_t rgb, uint8_t &red, uint8_t &green, uint8_t &blue);
+
     /// Set current font
     /// @param  font Font name
     void setFont(uint8_t* font);
 
-  /** put a char on the screen
-   *
-   * @param value char to print
-   * @returns printed char
-   *
-   */
-  virtual int putc(int value);
+    /** put a char on the screen
+     *
+     * @param value char to print
+     * @returns printed char
+     *
+     */
+    virtual int putc(int value);
 
-  /** draw a character on given position out of the active font to the TFT
-   *
-   * @param x x-position of char (top left) 
-   * @param y y-position
-   * @param c char to print
-   *
-   */    
+    /** draw a character on given position out of the active font to the TFT
+     *
+     * @param x x-position of char (top left) 
+     * @param y y-position
+     * @param c char to print
+     *
+     */    
     void character(int x, int y, int c);
 
     void foreground(uint16_t colour);
@@ -358,8 +341,6 @@
 
     PwmOut _led;
 
-    _currentFont cfont;
-
     // character location
     uint16_t _column;
     uint16_t _row;