KSM edits to RA8875

Dependents:   Liz_Test_Code

Revision:
37:f19b7e7449dc
Parent:
33:b6b710758ab3
Child:
38:38d503b4fad6
--- a/RA8875.h	Sat Jan 25 00:00:02 2014 +0000
+++ b/RA8875.h	Sat Jan 25 19:47:33 2014 +0000
@@ -69,7 +69,7 @@
 ///
 /// @todo Add Scroll support for text.
 /// @todo Add 2-Layer support.
-/// @todo Improve sync between internal and externa font support - cursor, window, scroll.
+/// @todo Improve sync between internal and external font support - cursor, window, scroll.
 /// @todo Find out why it can't shift frequency after constructor runs.
 /// @todo Add Hardware reset signal.
 /// @todo Add Touch Screen support.
@@ -182,13 +182,13 @@
     ///
     /// @returns font width in pixels.
     ///    
-    unsigned int fontwidth(void);
+    dim_t fontwidth(void);
     
     /// get the height in pixels of the currently active font
     ///
     /// @returns font height in pixels.
     ///    
-    unsigned int fontheight(void);
+    dim_t fontheight(void);
     
     /// get the number of colums based on the currently active font
     ///
@@ -220,7 +220,7 @@
     /// @param row is the vertical position in character positions
     /// @returns success/failure code. @see RetCode_t.
     ///
-    virtual RetCode_t locate(unsigned int column, unsigned int row);
+    virtual RetCode_t locate(textloc_t column, textloc_t row);
 
     /// Prepare the controller to write text to the screen by positioning
     /// the cursor.
@@ -229,19 +229,25 @@
     /// @param y is the vertical position in pixels (from the top edge)
     /// @returns success/failure code. @see RetCode_t.
     ///
-    RetCode_t SetTextCursor(unsigned int x, unsigned int y);
+    RetCode_t SetTextCursor(loc_t x, loc_t y);
 
+    /// Get the current cursor position in pixels.
+    ///
+    /// @returns cursor position.
+    ///
+    point_t GetTextCursor(void);
+    
     /// Get the current cursor horizontal position in pixels.
     ///
     /// @returns cursor position horizontal offset.
     ///
-    unsigned int GetTextCursor_X(void);
+    loc_t GetTextCursor_X(void);
 
     /// Get the current cursor vertical position in pixels.
     ///
     /// @returns cursor position vertical offset.
     ///
-    unsigned int GetTextCursor_Y(void);
+    loc_t GetTextCursor_Y(void);
 
     /// Configure additional Cursor Control settings.
     ///
@@ -337,7 +343,7 @@
     /// @param y is the vertical position in pixels (from the top edge)
     /// @param string is the null terminated string to send to the display.
     ///
-    void puts(unsigned int x, unsigned int y, const char * string);
+    void puts(loc_t x, loc_t y, const char * string);
     
     /// Prepare the controller to write binary data to the screen by positioning
     /// the memory cursor.
@@ -346,7 +352,7 @@
     /// @param y is the vertical position in pixels (from the top edge)
     /// @returns success/failure code. @see RetCode_t.
     ///
-    virtual RetCode_t SetGraphicsCursor(uint16_t x, uint16_t y);
+    virtual RetCode_t SetGraphicsCursor(loc_t x, loc_t y);
     
     /// Set the window, which controls where items are written to the screen.
     ///
@@ -360,7 +366,7 @@
     /// @param height is the window height in pixels.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    virtual RetCode_t window(unsigned int x, unsigned int y, unsigned int width, unsigned int height);
+    virtual RetCode_t window(loc_t x, loc_t y, dim_t width, dim_t height);
     
     /// Clear the screen.
     ///
@@ -407,18 +413,18 @@
     
     /// Set the foreground color.
     ///
-    /// @param R is the red element of the color.
-    /// @param G is the green element of the color.
-    /// @param B is the blue element of the color.
+    /// @param r is the red element of the color.
+    /// @param g is the green element of the color.
+    /// @param b is the blue element of the color.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    virtual RetCode_t foreground(unsigned char R, unsigned char G, unsigned char B);
+    virtual RetCode_t foreground(unsigned char r, unsigned char g, unsigned char b);
     
     /// Get the current foreground color value.
     ///
     /// @returns the current foreground color.
     ///
-    unsigned int GetForeColor(void);
+    color_t GetForeColor(void);
         
     /// Draw a pixel in the specified color.
     ///
@@ -430,7 +436,7 @@
     /// @param color defines the color for the pixel.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    virtual RetCode_t pixel(unsigned int x, unsigned int y, color_t color);
+    virtual RetCode_t pixel(loc_t x, loc_t y, color_t color);
     
     /// Draw a pixel in the current foreground color.
     ///
@@ -438,7 +444,7 @@
     /// @param y is the veritical offset to this pixel.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    virtual RetCode_t pixel(unsigned int x, unsigned int y);
+    virtual RetCode_t pixel(loc_t x, loc_t y);
     
     /// Draw a line in the specified color
     ///
@@ -452,7 +458,7 @@
     /// @param color defines the foreground color.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    RetCode_t line(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, 
+    RetCode_t line(loc_t x1, loc_t y1, loc_t x2, loc_t y2, 
         color_t color);
 
     /// Draw a line
@@ -465,7 +471,7 @@
     /// @param y2 is the vertical end of the line.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    RetCode_t line(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2);
+    RetCode_t line(loc_t x1, loc_t y1, loc_t x2, loc_t y2);
 
     /// Draw a rectangle in the specified color
     ///
@@ -480,7 +486,7 @@
     /// @param fillit is optional to FILL the rectangle. default is NOFILL.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    RetCode_t rect(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, 
+    RetCode_t rect(loc_t x1, loc_t y1, loc_t x2, loc_t y2, 
         color_t color, fill_t fillit = NOFILL);
 
     /// Draw a filled rectangle in the specified color
@@ -496,7 +502,7 @@
     /// @param fillit is optional to NOFILL the rectangle. default is FILL.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    virtual RetCode_t fillrect(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, 
+    virtual RetCode_t fillrect(loc_t x1, loc_t y1, loc_t x2, loc_t y2, 
         color_t color, fill_t fillit = FILL);
 
     /// Draw a rectangle
@@ -510,7 +516,7 @@
     /// @param fillit is optional to FILL the rectangle. default is NOFILL.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    RetCode_t rect(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, 
+    RetCode_t rect(loc_t x1, loc_t y1, loc_t x2, loc_t y2, 
         fill_t fillit = NOFILL);
 
     /// Draw a filled rectangle with rounded corners using the specified color.
@@ -537,8 +543,8 @@
     /// @param fillit is optional to FILL the rectangle. default is NOFILL.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    RetCode_t fillroundrect(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, 
-        unsigned int radius1, unsigned int radius2, color_t color, fill_t fillit = FILL);
+    RetCode_t fillroundrect(loc_t x1, loc_t y1, loc_t x2, loc_t y2, 
+        dim_t radius1, dim_t radius2, color_t color, fill_t fillit = FILL);
 
     /// Draw a rectangle with rounded corners using the specified color.
     ///
@@ -564,8 +570,8 @@
     /// @param fillit is optional to FILL the rectangle. default is NOFILL.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    RetCode_t roundrect(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, 
-        unsigned int radius1, unsigned int radius2, color_t color, fill_t fillit = NOFILL);
+    RetCode_t roundrect(loc_t x1, loc_t y1, loc_t x2, loc_t y2, 
+        dim_t radius1, dim_t radius2, color_t color, fill_t fillit = NOFILL);
 
     /// Draw a rectangle with rounded corners.
     ///
@@ -587,8 +593,8 @@
     /// @param fillit is optional to FILL the rectangle. default is NOFILL.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    RetCode_t roundrect(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, 
-        unsigned int radius1, unsigned int radius2, fill_t fillit = NOFILL);
+    RetCode_t roundrect(loc_t x1, loc_t y1, loc_t x2, loc_t y2, 
+        dim_t radius1, dim_t radius2, fill_t fillit = NOFILL);
 
     /// Draw a triangle in the specified color.
     ///
@@ -605,8 +611,8 @@
     /// @param fillit is optional to FILL the rectangle. default is NOFILL.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    RetCode_t triangle(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, 
-        unsigned int x3, unsigned int y3, color_t color, fill_t fillit = NOFILL);
+    RetCode_t triangle(loc_t x1, loc_t y1, loc_t x2, loc_t y2, 
+        loc_t x3, loc_t y3, color_t color, fill_t fillit = NOFILL);
     
     /// Draw a filled triangle in the specified color.
     ///
@@ -623,8 +629,8 @@
     /// @param fillit is optional to FILL the rectangle. default is NOFILL.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    RetCode_t filltriangle(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, 
-        unsigned int x3, unsigned int y3, color_t color, fill_t fillit = FILL);
+    RetCode_t filltriangle(loc_t x1, loc_t y1, loc_t x2, loc_t y2, 
+        loc_t x3, loc_t y3, color_t color, fill_t fillit = FILL);
 
     /// Draw a triangle
     ///
@@ -639,8 +645,8 @@
     /// @param fillit is optional to FILL the rectangle. default is NOFILL.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    RetCode_t triangle(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, 
-        unsigned int x3, unsigned int y3, fill_t fillit = NOFILL);
+    RetCode_t triangle(loc_t x1, loc_t y1, loc_t x2, loc_t y2, 
+        loc_t x3, loc_t y3, fill_t fillit = NOFILL);
     
     /// Draw a circle using the specified color.
     ///
@@ -653,7 +659,7 @@
     /// @param color defines the foreground color.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    RetCode_t circle(unsigned int x, unsigned int y, unsigned int radius, color_t color, fill_t fillit = NOFILL);
+    RetCode_t circle(loc_t x, loc_t y, dim_t radius, color_t color, fill_t fillit = NOFILL);
 
     /// Draw a filled circle using the specified color.
     ///
@@ -666,7 +672,7 @@
     /// @param color defines the foreground color.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    RetCode_t fillcircle(unsigned int x, unsigned int y, unsigned int radius, color_t color, fill_t fillit = FILL);
+    RetCode_t fillcircle(loc_t x, loc_t y, dim_t radius, color_t color, fill_t fillit = FILL);
 
     /// Draw a circle.
     ///
@@ -677,7 +683,7 @@
     /// @param radius defines the size of the circle.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    RetCode_t circle(unsigned int x, unsigned int y, unsigned int radius, fill_t fillit = NOFILL);
+    RetCode_t circle(loc_t x, loc_t y, dim_t radius, fill_t fillit = NOFILL);
 
     /// Draw an Ellipse using the specified color
     ///
@@ -692,7 +698,7 @@
     /// @param fillit defines whether the circle is filled or not.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    RetCode_t ellipse(unsigned int x, unsigned int y, unsigned int radius1, unsigned int radius2, 
+    RetCode_t ellipse(loc_t x, loc_t y, dim_t radius1, dim_t radius2, 
         color_t color, fill_t fillit = NOFILL);
 
     /// Draw a filled Ellipse using the specified color
@@ -708,7 +714,7 @@
     /// @param fillit defines whether the circle is filled or not.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    RetCode_t fillellipse(unsigned int x, unsigned int y, unsigned int radius1, unsigned int radius2, 
+    RetCode_t fillellipse(loc_t x, loc_t y, dim_t radius1, dim_t radius2, 
         color_t color, fill_t fillit = FILL);
 
     /// Draw an Ellipse
@@ -722,7 +728,7 @@
     /// @param fillit defines whether the circle is filled or not.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    RetCode_t ellipse(unsigned int x, unsigned int y, unsigned int radius1, unsigned int radius2, fill_t fillit = NOFILL);
+    RetCode_t ellipse(loc_t x, loc_t y, dim_t radius1, dim_t radius2, fill_t fillit = NOFILL);
     
     /// Control display power
     ///
@@ -910,7 +916,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
+    loc_t cursor_x, cursor_y;    ///< used for external fonts only
     
     #ifdef PERF_METRICS
     typedef enum