Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: FRDM_RA8875_mPaint RA8875_Demo RA8875_KeyPadDemo SignalGenerator ... more
Fork of SPI_TFT by
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)
TextDisplay.cpp
- Committer:
- WiredHome
- Date:
- 2020-05-25
- Revision:
- 206:83edda283d90
- Parent:
- 198:9b6851107426
File content as of revision 206:83edda283d90:
// mbed TextDisplay Display Library Base Class
// Copyright © 2007-2009 sford
// Released under the MIT License: http://mbed.org/license/mit
#include "TextDisplay.h"
//#define DEBUG "Text"
// ...
// INFO("Stuff to show %d", var); // new-line is automatically appended
//
#if (defined(DEBUG) && !defined(TARGET_LPC11U24))
#define INFO(x, ...) std::printf("[INF %s %3d] " x "\r\n", DEBUG, __LINE__, ##__VA_ARGS__);
#define WARN(x, ...) std::printf("[WRN %s %3d] " x "\r\n", DEBUG, __LINE__, ##__VA_ARGS__);
#define ERR(x, ...) std::printf("[ERR %s %3d] " x "\r\n", DEBUG, __LINE__, ##__VA_ARGS__);
#else
#define INFO(x, ...)
#define WARN(x, ...)
#define ERR(x, ...)
#endif
TextDisplay::TextDisplay(const char *name) : Stream(name)
{
_row = 0;
_column = 0;
_foreground = 0;
_background = 0;
if (name == NULL) {
_path = NULL;
} else {
int len = strlen(name) + 2;
_path = new char[len];
snprintf(_path, len, "/%s", name);
}
}
TextDisplay::~TextDisplay()
{
delete [] _path;
}
int TextDisplay::_putc(int value)
{
INFO("_putc(%d)", value);
if(value == '\n') {
_column = 0;
_row++;
if(_row >= rows()) {
_row = 0;
}
} else {
character(_column, _row, value);
_column++;
if(_column >= columns()) {
_column = 0;
_row++;
if(_row >= rows()) {
_row = 0;
}
}
}
return value;
}
// crude cls implementation, should generally be overwritten in derived class
RetCode_t TextDisplay::cls(uint16_t layers)
{
INFO("cls()");
locate(0, 0);
for(int i=0; i<columns()*rows(); i++) {
putc(' ');
}
return noerror;
}
point_t TextDisplay::locate(textloc_t column, textloc_t row)
{
point_t oldPt;
oldPt.x = _column; oldPt.y = _row;
INFO("locate(%d,%d)", column, row);
_column = column;
_row = row;
return oldPt;
}
int TextDisplay::_getc()
{
return -1;
}
color_t TextDisplay::foreground(uint16_t color)
{
color_t oldColor = _foreground;
//INFO("foreground(%4X)", color);
_foreground = color;
return oldColor;
}
color_t TextDisplay::background(uint16_t color)
{
color_t oldColor = _background;
//INFO("background(%4X)", color);
_background = color;
return oldColor;
}
bool TextDisplay::claim(FILE *stream)
{
if ( _path == NULL) {
fprintf(stderr, "claim requires a name to be given in the instantiator of the TextDisplay instance!\r\n");
return false;
}
if (freopen(_path, "w", stream) == NULL) {
return false; // Failed, should not happen
}
// make sure we use line buffering
setvbuf(stdout, NULL, _IOLBF, columns());
return true;
}

RA8875: 4" to 8" (WQVGA, WVGA, Multi-Touch, Keypad)