KSM edits to RA8875

Dependents:   Liz_Test_Code

Revision:
29:422616aa04bd
Parent:
25:9556a3a9b7cc
Child:
30:e0f2da88bdf6
--- a/RA8875.h	Fri Jan 17 17:24:05 2014 +0000
+++ b/RA8875.h	Sun Jan 19 04:24:16 2014 +0000
@@ -12,7 +12,7 @@
 
 // What better place for some test code than in here and the companion
 // .cpp file. See also the bottom of this file.
-//#define TESTENABLE
+#define TESTENABLE
 
 #define RGB(r,g,b) ( ((r<<8)&0xF800) | ((g<<3)&0x07E0) | (b>>3) )
 
@@ -66,25 +66,34 @@
     BLOCK       ///< Block cursor
 } cursor_t;
 
-/// return values from functions
+// return values from functions moved into TextDisplay.h
 //typedef enum
 //{
 //    noerror,
 //    bad_parameter
 //} RetCode_t;
 
+
 /// This is a graphics library for the Raio RA8875 Display Controller chip
 /// attached to a 4-wire SPI interface.
 ///
-/// It offers both primitive and high level APIs.
+/// It offers both primitive and high level APIs.\\
 /// Central to this API is a coordinate system, where the origin (0,0) is in
 /// the top-left corner of the display, and the width extends positive to the
 /// right and the height extends positive toward the bottom.
 ///
 /// As there are both graphics and text commands, one must take care to use
 /// the proper coordinate system for each. Some of the text APIs are in units
-/// of column and row, which is measured in character positions (so dependent
-/// on the font size).
+/// of column and row, which is measured in character positions (and dependent
+/// on the font size), and other text APIs permit pixel level positioning.
+///
+/// @todo Add 2-Layer support.
+/// @todo Find out why it can't shift frequency after constructor runs.
+/// @todo Bitmap support.
+/// @todo Add Hardware reset signal.
+/// @todo Add Touch Screen support.
+/// @todo Add Keypad Support.
+/// @todo Add high level objects - x-y graph, meter, others...
 /// 
 class RA8875 : public GraphicsDisplay
 {
@@ -240,7 +249,19 @@
     /// @returns success/failure code. @see RetCode_t.
     ///
     RetCode_t SetTextCursor(unsigned int x, unsigned int y);
-    
+
+    /// Get the current cursor horizontal position in pixels.
+    ///
+    /// @returns cursor position horizontal offset.
+    ///
+    unsigned int GetTextCursor_X(void);
+
+    /// Get the current cursor vertical position in pixels.
+    ///
+    /// @returns cursor position vertical offset.
+    ///
+    unsigned int GetTextCursor_Y(void);
+
     /// Configure additional Cursor Control settings.
     ///
     /// This API lets you modify other cursor control settings; 
@@ -770,7 +791,7 @@
     ///   - the number of bytes per vertical line (width of the array)
     /// @returns error code.
     ///
-    RetCode_t set_font(const unsigned char * font);
+    RetCode_t set_font(const unsigned char * font = NULL);
 
     /// Get the RGB value for a DOS color.
     ///
@@ -824,6 +845,20 @@
     ///
     RetCode_t init(void);
     
+    /// Internal function to put a character using the built-in (internal) font engine
+    ///
+    /// @param is the character to put to the screen.
+    /// @returns the character put.
+    ///
+    int _internal_putc(int c);
+    
+    /// Internal function to put a character using the external font engine
+    ///
+    /// @param is the character to put to the screen.
+    /// @returns the character put.
+    ///
+    int _external_putc(int c);
+    
     /// Select the peripheral to use it.
     ///
     /// @param chipsel when true will select the peripheral, and when false
@@ -855,6 +890,7 @@
     DigitalOut cs;                  ///< chip select pin, assumed active low
     DigitalOut res;                 ///< reset pin, assumed active low
     const unsigned char * font;     ///< reference to an external font somewhere in memory
+    unsigned int cursor_x, cursor_y;    ///< used for external fonts only
     
     #ifdef PERF_METRICS
     typedef enum