Library to control a Graphics TFT connected to 4-wire SPI - revised for the Raio RA8875 Display Controller.

Dependents:   FRDM_RA8875_mPaint RA8875_Demo RA8875_KeyPadDemo SignalGenerator ... more

Fork of SPI_TFT by Peter Drescher

See Components - RA8875 Based Display

Enhanced touch-screen support - where it previous supported both the Resistive Touch and Capacitive Touch based on the FT5206 Touch Controller, now it also has support for the GSL1680 Touch Controller.

Offline Help Manual (Windows chm)

/media/uploads/WiredHome/ra8875.zip.bin (download, rename to .zip and unzip)

Revision:
202:a22cbc04f332
Parent:
200:ae29b60d087c
Child:
203:704df2dbd3e6
--- a/RA8875.h	Sun Mar 29 18:12:24 2020 +0000
+++ b/RA8875.h	Thu Apr 30 13:51:32 2020 +0000
@@ -496,8 +496,8 @@
 #define DarkBrown       (color_t)(RGB(63,63,0))
 #define DarkGray        (color_t)(RGB(63,63,63))
 
-#define min(a,b) ((a<b)?a:b)
-#define max(a,b) ((a>b)?a:b)
+#define RAmin(a,b) ((a<b)?a:b)
+#define RAmax(a,b) ((a>b)?a:b)
 
 
 //namespace SW_graphics
@@ -1083,7 +1083,8 @@
     /// @endcode
     ///
     /// @param[out] TouchPoint is a pointer to a point_t, which is set as the touch point,
-    ///             if a touch is registered.
+    ///             if a touch is registered. The coordinate system is based on the
+    ///             graphics orientation (@ref SetGraphicsOrientation(), @ref GetGraphicsOrientation())
     /// @returns a value indicating the state of the touch,
     ///         - no_cal:   no calibration matrix is available, touch coordinates are not returned.
     ///         - no_touch: no touch is detected, touch coordinates are not returned.
@@ -1741,6 +1742,9 @@
     /// Prepare the controller to write text to the screen by positioning
     /// the cursor.
     ///
+    /// @note If the cursor location is not valid (not on-screen), the
+    ///     cursor is not set and no error is generated.
+    ///
     /// @code
     ///     lcd.SetTextCursor(100, 25);
     ///     lcd.puts("Hello");
@@ -1756,6 +1760,9 @@
     /// Prepare the controller to write text to the screen by positioning
     /// the cursor.
     ///
+    /// @note If the cursor location is not valid (not on-screen), the
+    ///     cursor is not set.
+    ///
     /// @code
     ///     point_t point = {100, 25};
     ///     lcd.SetTextCursor(point);
@@ -1825,6 +1832,16 @@
     RetCode_t SetTextFont(font_t font = ISO8859_1);
 
 
+    /// Translate an (x,y) orientation in the display hardware coordinates
+    /// into (x,y) coordinates given the current orientation.
+    ///
+    /// @param[in] x is the hardware x coordinate
+    /// @param[in] y is the hardware y coordinate
+    /// @returns the translated coordinates as a point
+    ///
+    point_t TranslateOrientation(loc_t x, loc_t y);
+
+
     /// Gets the display orientation
     ///
 
@@ -2027,14 +2044,26 @@
     ///
     RetCode_t GetTextFontSize(HorizontalScale * hScale, VerticalScale * vScale);
 
-    /// put a character on the screen.
+    /// Get the width of a string (or character) based on the current font.
     ///
     /// @param[in] text is a pointer to a text string to evaluate.
     /// @param[in] charOnly defaults to false, which computes over the whole string.
     /// @returns width in pixels, given the selected font and scale.
     ///
-    dim_t GetTextWidth(const char * text, bool charOnly = false);
-
+    dim_t GetTextWidth(const char* text, bool charOnly = false);
+
+    /// Get the rectange of a string (or character) based on the current font.
+    ///
+    /// @note This computes the rect without considering wordwrap. It will
+    ///     treat <cr> as a return to left margin and <lf> as a vertical
+    ///     advance. It will also use the currently selected font metrics,
+    ///     which includes proportional fonts.
+    ///
+    /// @param[in] text is a pointer to a text string to evaluate.
+    /// @param[in] charOnly defaults to false, which computes over the whole string.
+    /// @returns rectangle that holds this text, as a rect_t
+    ///
+    rect_t GetTextRect(const char* text, bool charOnly = false);
 
     /// put a character on the screen.
     ///
@@ -3604,7 +3633,9 @@
     RetCode_t (FPointerDummy::*method_callback)(filecmd_t cmd, uint8_t * buffer, uint16_t size);
     RetCode_t (* idle_callback)(IdleReason_T reason, uint16_t param);
 
+#if 0
     point_t TranslateOrientation(point_t rawPoint);
+#endif
 };