This is a port of Henning Kralsen's UTFT library for Arduino/chipKIT to mbed, refactored to make full use of C inheritance and access control, in order to reduce work when implementing new drivers and at the same time make the code more readable and easier to maintain. As of now supported are SSD1289 (16-bit interface), HX8340-B (serial interface) and ST7735 (serial interface). Drivers for other controllers will be added as time and resources to acquire the displays to test the code permit.

Dependents:   UTFT_SSD1289

Fork of TFTLCD by Todor Todorov

Revision:
21:e5c1e8ffada1
Parent:
20:4bdca8d8dadc
Child:
22:4c169297f374
--- a/lcd_base.h	Fri Dec 21 06:05:15 2012 +0000
+++ b/lcd_base.h	Sat Jan 26 02:55:46 2013 +0000
@@ -32,7 +32,7 @@
 #define TFTLCD_BASE_H
 
 #include "mbed.h"
-#include "fonts.h"
+#include "terminus.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -126,22 +126,22 @@
  */
 typedef enum Alignment_enum align_t;
 
-/** \struct Font_struct
- *  \brief Describes fonts and their properties.
- *  \sa Comments in fonts.h
- */
-struct Font_struct
-{
-    const    char* font; /**< A pointer to the first byte in the font. */
-    unsigned char  width; /**< The width of each character, in pixels. */
-    unsigned char  height; /**< Height of each character, in pixels. */
-    unsigned char  offset; /**< Offset of the first character in the font. */
-    unsigned char  numchars; /**< Count of the available characters in the font. */
-};
-/** \typedef font_metrics_t
- *  \brief Convenience shortcut for fonts properties.
- */
-typedef struct Font_struct font_metrics_t;
+///** \struct Font_struct
+// *  \brief Describes fonts and their properties.
+// *  \sa Comments in fonts.h
+// */
+//struct Font_struct
+//{
+//    const    char* font; /**< A pointer to the first byte in the font. */
+//    unsigned char  width; /**< The width of each character, in pixels. */
+//    unsigned char  height; /**< Height of each character, in pixels. */
+//    unsigned char  offset; /**< Offset of the first character in the font. */
+//    unsigned char  numchars; /**< Count of the available characters in the font. */
+//};
+///** \typedef font_metrics_t
+// *  \brief Convenience shortcut for fonts properties.
+// */
+//typedef struct Font_struct font_metrics_t;
 
 /** \struct Bitmap_struct
  *  \brief Describes an image.
@@ -242,7 +242,7 @@
      * \param font A pointer to the font data.
      * \sa Comments in file fonts.h
      */
-    virtual void SetFont( const char* font );
+    virtual void SetFont( const font_t* font );
     
     /** Gets the display width.
      *  \return Display width in pixels.
@@ -254,6 +254,16 @@
      */
     unsigned short GetHeight( void );
     
+    /** Gets the font width.
+     *  \return The current font width.
+     */
+    uint8_t GetFontWidth( void );
+    
+    /** Gets the font height.
+     *  \return The current font height.
+     */
+    uint8_t GetFontHeight( void );
+    
     /** Fills the whole screen with a single color.
      * \param color The color to be used. The value must be in RGB-565 format.
      * \remarks The special values -1 and -2 signify the preset background and foreground colors, respectively.
@@ -528,7 +538,7 @@
     orientation_t   _orientation;
     colordepth_t    _colorDepth;
     unsigned int    _foreground, _background;
-    font_metrics_t  _font;
+    const font_t*   _font;
 };
 
 #ifdef __cplusplus