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.
Fork of RA8875 by
Diff: RA8875.cpp
- Revision:
- 32:0e4f2ae512e2
- Parent:
- 31:c72e12cd5c67
- Child:
- 37:f19b7e7449dc
--- a/RA8875.cpp Mon Jan 20 19:19:48 2014 +0000 +++ b/RA8875.cpp Tue Jan 21 03:28:36 2014 +0000 @@ -159,9 +159,9 @@ return font[2]; } -RetCode_t RA8875::locate(unsigned int x, unsigned int y) +RetCode_t RA8875::locate(unsigned int column, unsigned int row) { - return SetTextCursor(x * fontwidth(), y * fontheight()); + return SetTextCursor(column * fontwidth(), row * fontheight()); } int RA8875::columns(void) @@ -174,15 +174,13 @@ return height() / fontheight(); } -int RA8875::width(void) +uint16_t RA8875::width(void) { - //return RA8875_DISPLAY_WIDTH; return (ReadCommand(0x14) + 1) * 8; } -int RA8875::height(void) +uint16_t RA8875::height(void) { - //return RA8875_DISPLAY_HEIGHT; return (ReadCommand(0x19) | (ReadCommand(0x1A) << 8)) + 1; } @@ -365,6 +363,24 @@ return c; } +RetCode_t RA8875::_StartGraphicsStream(void) +{ + WriteCommand(0x40,0x00); // Graphics write mode + WriteCommand(0x02); // Prepare for streaming data + return noerror; +} + +RetCode_t RA8875::_EndGraphicsStream(void) +{ + return noerror; +} + +RetCode_t RA8875::putp(color_t pixel) +{ + WriteData(pixel & 0xFF); + WriteData(pixel >> 8); + return noerror; +} void RA8875::puts(unsigned int x, unsigned int y, const char * string) { @@ -378,7 +394,6 @@ if ((mwcr0 & 0x80) == 0x00) WriteCommand(0x40,0x80); // Put in Text mode if not already - if (*string != '\0') { #if 1 while (*string) { // @TODO calling individual _putc is slower... optimizations? @@ -398,7 +413,7 @@ } } -RetCode_t RA8875::SetMemoryCursor(unsigned int x, unsigned int y) +RetCode_t RA8875::SetGraphicsCursor(uint16_t x, uint16_t y) { WriteCommand(0x46, x & 0xFF); WriteCommand(0x47, x >> 8); @@ -407,7 +422,7 @@ return noerror; } -RetCode_t RA8875::SetWindow(unsigned int x, unsigned int y, unsigned int width, unsigned int height) +RetCode_t RA8875::window(unsigned int x, unsigned int y, unsigned int width, unsigned int height) { WriteCommand(0x30, x & 0xFF); // HSAW0 WriteCommand(0x31, x >> 8); // HSAW1 @@ -452,7 +467,7 @@ PERFORMANCE_RESET; color_t color = GetForeColor(); WriteCommand(0x40,0x00); // Graphics write mode - SetMemoryCursor(x, y); + SetGraphicsCursor(x, y); WriteCommand(0x02); //start data write WriteData(color & 0xFF); WriteData(color >> 8); @@ -934,7 +949,7 @@ WriteCommand(0x1f, 0x01); //VPWR //VSYNC Polarity ,VSYNC Pulse Width[6:0] // Clear ram image - SetWindow(0,0, width(), height()); // Initialize to full screen + window(0,0, width(), height()); // Initialize to full screen SetTextCursorControl(); foreground(Blue); background(Black); @@ -1075,7 +1090,7 @@ pc.printf("Web Color Test\r\n"); display.background(Black); display.foreground(Blue); - display.SetWindow(0,0, display.width(), display.height()); + display.window(0,0, display.width(), display.height()); display.cls(); display.puts(0,0, "Web Color Test\r\n"); display.SetTextFontSize(1,2);