KSM edits to RA8875

Dependents:   Liz_Test_Code

Revision:
81:01da2e34283d
Parent:
79:544eb4964795
Child:
82:f7d300f26540
--- a/RA8875.h	Sun Dec 28 19:58:18 2014 +0000
+++ b/RA8875.h	Sun Dec 28 21:50:28 2014 +0000
@@ -25,6 +25,7 @@
 /// 
 /// @code 
 /// RA8875 lcd(p5, p6, p7, p12, NC, "tft");
+/// lcd.init();
 /// lcd.foreground(Blue);
 /// lcd.line(0,0, 479,271);
 /// ...
@@ -76,7 +77,7 @@
 #define Cyan        (color_t)(RGB(0,187,187))
 #define Red         (color_t)(RGB(187,0,0))
 #define Magenta     (color_t)(RGB(187,0,187))
-#define Brown       (color_t)(RGB(187,187,0))
+#define Brown       (color_t)(RGB(63,63,0))
 #define Gray        (color_t)(RGB(187,187,187))
 #define Charcoal    (color_t)(RGB(85,85,85))
 #define BrightBlue  (color_t)(RGB(0,0,255))
@@ -85,7 +86,7 @@
 #define BrightRed   (color_t)(RGB(255,0,0))
 #define Orange      (color_t)(RGB(255,85,85))
 #define Pink        (color_t)(RGB(255,85,255))
-#define Yellow      (color_t)(RGB(255,255,85))
+#define Yellow      (color_t)(RGB(187,187,0))
 #define White       (color_t)(RGB(255,255,255))
 
 #define DarkBlue    (color_t)(RGB(0,0,63))
@@ -121,7 +122,7 @@
 ///
 /// int main()
 /// {
-///     lcd.init(480,272,16);
+///     lcd.init();
 ///     lcd.printf("printing 3 x 2 = %d", 3*2);
 ///     lcd.circle(       400,25,  25,               BrightRed);
 ///     lcd.fillcircle(   400,25,  15,               RGB(128,255,128));
@@ -224,7 +225,7 @@
     ///
     /// int main()
     /// {
-    ///     lcd.init(true,255,480,272,16); // powerup, backlight full, w x h x c
+    ///     lcd.init();
     ///     lcd.printf("printing 3 x 2 = %d", 3*2);
     ///     lcd.circle(400,25, 25, BrightRed);
     /// }
@@ -249,15 +250,24 @@
     
     /// Initialize the driver.
     ///
+    /// @param[in] width in pixels to configure the display for. This parameter is optional
+    ///             and the default is 480.
+    /// @param[in] height in pixels to configure the display for. This parameter is optional
+    ///             and the default is 272.
+    /// @param[in] color_bpp can be either 8 or 16, but must be consistent
+    ///             with the width and height parameters. This parameter is optional
+    ///             and the default is 16.
     /// @param[in] power defines if the display should be left in the power-on or off state.
-    ///            If power is true (on), the backlight is set to 100%.
-    /// @param[in] width in pixels to configure the display for.
-    /// @param[in] height in pixels to configure the display for.
-    /// @param[in] color_bpp can be either 8 or 16, but must be consistent
-    ///     with the width and height parameters.
+    ///            If power is true (on), the backlight is set to 100%. This parameter is optional
+    ///             and the default is true (on). @see Power.
+    /// @param[in] keypadon defines if the keypad support should be enabled. This parameter is optional
+    ///             and the default is true (enabled). @see KeypadInit.
+    /// @param[in] touchscreeenon defines if the keypad support should be enabled. This parameter is optional
+    ///             and the default is true (enabled). @see TouchPanelInit.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    RetCode_t init(bool poweron, int width, int height, int color_bpp);
+    RetCode_t init(int width = 480, int height = 272, int color_bpp = 16, 
+        bool poweron = true, bool keypadon = true, bool touchscreeenon = true);
     
     /// Get a pointer to the error code.
     ///
@@ -442,7 +452,7 @@
     /// @note The returned values are not in display (pixel) units but are in analog to
     ///     digital converter units.
     /// 
-    /// @note This API is usually not needed. @see TouchPanelCalibrate. 
+    /// @note This API is usually not needed. @see TouchPanelComputeCalibration. 
     ///     @see TouchPanelReadable.
     /// 
     /// @param[out] x is the x scale a/d value.
@@ -460,7 +470,7 @@
     /// @note The returned values are not in display (pixel) units but are in analog to
     ///     digital converter units.
     /// 
-    /// @note This API is usually not needed. @see TouchPanelCalibrate. 
+    /// @note This API is usually not needed. @see TouchPanelComputeCalibration. 
     ///     @see TouchPanelReadable.
     /// 
     /// @param[out] x is the x scale a/d value.
@@ -479,7 +489,7 @@
     /// matrix on the next power cycle. By doing so, it can avoid the
     /// need to calibrate on every power cycle.
     ///
-    /// @note The methods "TouchPanelCalibrate", "TouchPanelReadable", and
+    /// @note The methods "TouchPanelComputeCalibration", "TouchPanelReadable", and
     ///     indirectly the "TouchPanelSetMatrix" methods are all derived
     ///     from a program by Carlos E. Vidales. See the copyright note
     ///     for further details. See also the article
@@ -513,7 +523,40 @@
     ///             non-volatile memory to recover the calibration after a power fail.
     /// @returns success/failure code. @see RetCode_t.
     ///
-    RetCode_t TouchPanelCalibrate(point_t display[3], point_t screen[3], tpMatrix_t * matrix);
+    RetCode_t TouchPanelComputeCalibration(point_t display[3], point_t screen[3], tpMatrix_t * matrix);
+
+
+    /// Perform the touch panel calibration process.
+    ///
+    /// This method provides the easy "shortcut" to calibrating the touch panel.
+    /// The process will automatically generate the calibration points, present
+    /// the targets on-screen, detect the touches, compute the calibration
+    /// matrix, and optionally provide the calibration matrix to the calling code
+    /// for persistence in non-volatile memory.
+    ///
+    /// @param[out] matrix is an optional parameter to hold the calibration matrix 
+    ///             as a result of the calibration. This can be saved in  
+    ///             non-volatile memory to recover the calibration after a power fail.
+    /// @returns success/failure code. @see RetCode_t.
+    ///
+    RetCode_t TouchPanelCalibrate(tpMatrix_t * matrix);
+
+    /// Perform the touch panel calibration process.
+    ///
+    /// This method provides the easy "shortcut" to calibrating the touch panel.
+    /// The process will automatically generate the calibration points, present
+    /// the targets on-screen, detect the touches, compute the calibration
+    /// matrix, and optionally provide the calibration matrix to the calling code
+    /// for persistence in non-volatile memory.
+    ///
+    /// @param[in] msg is a text message to present on the screen during the
+    ///             calibration process.
+    /// @param[out] matrix is an optional parameter to hold the calibration matrix 
+    ///             as a result of the calibration. This can be saved in  
+    ///             non-volatile memory to recover the calibration after a power fail.
+    /// @returns success/failure code. @see RetCode_t.
+    ///
+    RetCode_t TouchPanelCalibrate(const char * msg, tpMatrix_t * matrix = NULL);
 
     /// Get the screen calibrated point of touch.
     ///
@@ -568,7 +611,7 @@
     /// Set the calibration matrix for the touch panel.
     ///
     /// This method is used to set the calibration matrix for the touch panel. After
-    /// performing the calibration (@see TouchPanelCalibrate), the matrix can be stored.
+    /// performing the calibration (@see TouchPanelComputeCalibration), the matrix can be stored.
     /// On a subsequence power cycle, the matrix may be restored from non-volatile and
     /// passed in to this method. It will then be held to perform the corrections when
     /// reading the touch panel point.
@@ -1166,12 +1209,36 @@
     /// @note As a side effect, this changes the current
     ///     foreground color for subsequent operations.
     ///
+    /// @param[in] rect defines the rectangle.
+    /// @param[in] color defines the foreground color.
+    /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL.
+    /// @returns success/failure code. @see RetCode_t.
+    ///
+    RetCode_t rect(rect_t rect, color_t color, fill_t fillit);
+    
+     /// Draw a filled rectangle in the specified color
+    ///
+    /// @note As a side effect, this changes the current
+    ///     foreground color for subsequent operations.
+    ///
+    /// @param[in] rect defines the rectangle.
+    /// @param[in] color defines the foreground color.
+    /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL.
+    /// @returns success/failure code. @see RetCode_t.
+    ///
+    RetCode_t fillrect(rect_t rect, color_t color, fill_t fillit = FILL);
+
+    /// Draw a rectangle in the specified color
+    ///
+    /// @note As a side effect, this changes the current
+    ///     foreground color for subsequent operations.
+    ///
     /// @param[in] x1 is the horizontal start of the line.
     /// @param[in] y1 is the vertical start of the line.
     /// @param[in] x2 is the horizontal end of the line.
     /// @param[in] y2 is the vertical end of the line.
     /// @param[in] color defines the foreground color.
-    /// @param[in] fillit is optional to FILL the rectangle. default is NOFILL.
+    /// @param[in] fillit is optional to FILL the rectangle. default is FILL.
     /// @returns success/failure code. @see RetCode_t.
     ///
     RetCode_t rect(loc_t x1, loc_t y1, loc_t x2, loc_t y2,