LCD LIB
Fork of RA8875 by
Revision 103:7e0464ca6c5c, committed 2016-02-07
- Comitter:
- WiredHome
- Date:
- Sun Feb 07 23:18:01 2016 +0000
- Parent:
- 102:fc60bfa0199f
- Child:
- 104:8d1d3832a215
- Commit message:
- Added missing APIs for Get/SetTextCursor using point_t.; Fixed a defect in touch; if no point was requested, just polling for touch-state, it would return the no calibration value during a touch.
Changed in this revision
--- a/RA8875.cpp Sat Jan 23 16:58:54 2016 +0000 +++ b/RA8875.cpp Sun Feb 07 23:18:01 2016 +0000 @@ -628,6 +628,10 @@ return 8; } +RetCode_t RA8875::SetTextCursor(point_t p) +{ + return SetTextCursor(p.x, p.y); +} RetCode_t RA8875::SetTextCursor(loc_t x, loc_t y) { @@ -639,6 +643,14 @@ return noerror; } +point_t RA8875::GetTextCursor(void) +{ + point_t p; + + p.x = GetTextCursor_X(); + p.y = GetTextCursor_Y(); + return p; +} loc_t RA8875::GetTextCursor_Y(void) {
--- a/RA8875.h Sat Jan 23 16:58:54 2016 +0000 +++ b/RA8875.h Sun Feb 07 23:18:01 2016 +0000 @@ -579,7 +579,7 @@ /// } while (t.read_ms() < 30000); /// @endcode /// - /// @param[out] TouchPoint is the touch point, if a touch is registered. + /// @param[inout] TouchPoint is a pointer to a point_t, which is set as the touch point, if a touch is registered. /// @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. @@ -984,6 +984,20 @@ /// RetCode_t SetTextCursor(loc_t x, loc_t y); + /// Prepare the controller to write text to the screen by positioning + /// the cursor. + /// + /// @code + /// point_t point = {100, 25}; + /// lcd.SetTextCursor(point); + /// lcd.puts("Hello"); + /// @endcode + /// + /// @param[in] p is the x:y point in pixels from the top-left. + /// @returns success/failure code. @see RetCode_t. + /// + RetCode_t SetTextCursor(point_t p); + /// Get the current cursor position in pixels. /// /// @code
--- a/RA8875_Touch.cpp Sat Jan 23 16:58:54 2016 +0000 +++ b/RA8875_Touch.cpp Sun Feb 07 23:18:01 2016 +0000 @@ -178,20 +178,22 @@ TouchCode_t ts = TouchPanelA2DFiltered(&a2dX, &a2dY); if (ts != no_touch) { - if (tpMatrix.Divider != 0 && TouchPoint) { - /* Operation order is important since we are doing integer */ - /* math. Make sure you add all terms together before */ - /* dividing, so that the remainder is not rounded off */ - /* prematurely. */ - TouchPoint->x = ( (tpMatrix.An * a2dX) + - (tpMatrix.Bn * a2dY) + - tpMatrix.Cn - ) / tpMatrix.Divider ; + if (tpMatrix.Divider != 0) { + if (TouchPoint) { + /* Operation order is important since we are doing integer */ + /* math. Make sure you add all terms together before */ + /* dividing, so that the remainder is not rounded off */ + /* prematurely. */ + TouchPoint->x = ( (tpMatrix.An * a2dX) + + (tpMatrix.Bn * a2dY) + + tpMatrix.Cn + ) / tpMatrix.Divider ; - TouchPoint->y = ( (tpMatrix.Dn * a2dX) + - (tpMatrix.En * a2dY) + - tpMatrix.Fn - ) / tpMatrix.Divider ; + TouchPoint->y = ( (tpMatrix.Dn * a2dX) + + (tpMatrix.En * a2dY) + + tpMatrix.Fn + ) / tpMatrix.Divider ; + } } else { ts = no_cal; }
--- a/TextDisplay.cpp Sat Jan 23 16:58:54 2016 +0000 +++ b/TextDisplay.cpp Sun Feb 07 23:18:01 2016 +0000 @@ -31,6 +31,11 @@ } } +TextDisplay::~TextDisplay() +{ + delete _path; +} + int TextDisplay::_putc(int value) { INFO("_putc(%d)", value);
--- a/TextDisplay.h Sat Jan 23 16:58:54 2016 +0000 +++ b/TextDisplay.h Sun Feb 07 23:18:01 2016 +0000 @@ -35,6 +35,10 @@ /// TextDisplay(const char *name = NULL); + /// destructor to clean up + /// + ~TextDisplay(); + /// output a character at the given position /// /// @note this method may be overridden in a derived class.