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
Revision 62:ba5d33438fda, committed 2014-08-17
- Comitter:
- WiredHome
- Date:
- Sun Aug 17 15:38:51 2014 +0000
- Parent:
- 61:8f3153bf0baa
- Child:
- 66:468a11f05580
- Child:
- 69:636867df24a1
- Commit message:
- Fixed a bug in the pixel API which was visible when line( ) with same x,y coordinates for both points was used.
Changed in this revision
| RA8875.cpp | Show annotated file Show diff for this revision Revisions of this file |
| RA8875.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/RA8875.cpp Sun Aug 17 13:46:06 2014 +0000
+++ b/RA8875.cpp Sun Aug 17 15:38:51 2014 +0000
@@ -738,12 +738,17 @@
RetCode_t RA8875::pixel(loc_t x, loc_t y, color_t color)
{
+ RetCode_t ret;
+
+ PERFORMANCE_RESET;
#if 1
- return pixelStream(&color, 1, x,y);
+ ret = pixelStream(&color, 1, x,y);
#else
foreground(color);
- return pixel(x,y);
+ ret = pixel(x,y);
#endif
+ REGISTERPERFORMANCE(PRF_DRAWPIXEL);
+ return ret;
}
@@ -753,11 +758,15 @@
PERFORMANCE_RESET;
color_t color = GetForeColor();
+ #if 1
+ ret = pixelStream(&color, 1, x, y);
+ #else
WriteCommand(0x40,0x00); // Graphics write mode
SetGraphicsCursor(x, y);
WriteCommand(0x02);
WriteDataW(color);
ret = noerror;
+ #endif
REGISTERPERFORMANCE(PRF_DRAWPIXEL);
return ret;
}
@@ -835,9 +844,9 @@
RetCode_t RA8875::line(loc_t x1, loc_t y1, loc_t x2, loc_t y2)
{
PERFORMANCE_RESET;
- if (x1 == x2 && y1 == y2)
+ if (x1 == x2 && y1 == y2) {
pixel(x1, y1);
- else {
+ } else {
WriteCommandW(0x91, x1);
WriteCommandW(0x93, y1);
WriteCommandW(0x95, x2);
@@ -1567,6 +1576,41 @@
y2 = rand() % 272;
display.line(x,y, x2,y2, display.DOSColor(i));
}
+ display.foreground(BrightRed);
+ pc.printf("fg %08X %08X %08X\r\n", RGB(255,0,0), BrightRed, display.GetForeColor());
+ display.foreground(BrightGreen);
+ pc.printf("fg %08X %08X %08X\r\n", RGB(0,255,0), BrightGreen, display.GetForeColor());
+ display.foreground(BrightBlue);
+ pc.printf("fg %08X %08X %08X\r\n", RGB(0,0,255), BrightBlue, display.GetForeColor());
+ display.line(55,50, 79,74, BrightRed);
+ display.line(57,50, 81,74, BrightGreen);
+ display.line(59,50, 83,74, BrightBlue);
+ // horz
+ display.line(30,40, 32,40, BrightRed);
+ display.line(30,42, 32,42, BrightGreen);
+ display.line(30,44, 32,44, BrightBlue);
+ // vert
+ display.line(20,40, 20,42, BrightRed);
+ display.line(22,40, 22,42, BrightGreen);
+ display.line(24,40, 24,42, BrightBlue);
+ // compare point to line-point
+ display.pixel(20,50, BrightRed);
+ display.pixel(22,50, BrightGreen);
+ display.pixel(24,50, BrightBlue);
+ display.line(20,52, 20,52, BrightRed);
+ display.line(22,52, 22,52, BrightGreen);
+ display.line(24,52, 24,52, BrightBlue);
+
+ // point
+ display.line(50,50, 50,50, Red);
+ display.line(52,52, 52,52, Green);
+ display.line(54,54, 54,54, Blue);
+ display.line(60,60, 60,60, BrightRed);
+ display.line(62,62, 62,62, BrightGreen);
+ display.line(64,64, 64,64, BrightBlue);
+ display.line(70,70, 70,70, DarkRed);
+ display.line(72,72, 72,72, DarkGreen);
+ display.line(74,74, 74,74, DarkBlue);
}
--- a/RA8875.h Sun Aug 17 13:46:06 2014 +0000
+++ b/RA8875.h Sun Aug 17 15:38:51 2014 +0000
@@ -12,7 +12,7 @@
// What better place for some test code than in here and the companion
// .cpp file. See also the bottom of this file.
-#define TESTENABLE
+//#define TESTENABLE
/// DOS colors - slightly color enhanced
#define Black (color_t)(RGB(0,0,0))
@@ -24,23 +24,23 @@
#define Brown (color_t)(RGB(187,187,0))
#define Gray (color_t)(RGB(187,187,187))
#define Charcoal (color_t)(RGB(85,85,85))
-#define BrightBlue (color_t)(RGB(85,85,255))
-#define BrightGreen (color_t)(RGB(85,255,85))
-#define BrightCyan (color_t)(RGB(85,255,255))
+#define BrightBlue (color_t)(RGB(0,0,255))
+#define BrightGreen (color_t)(RGB(0,255,0))
+#define BrightCyan (color_t)(RGB(0,255,255))
+#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 White (color_t)(RGB(255,255,255))
-#define DarkBlue (color_t)(RGB(0,0,64))
-#define DarkGreen (color_t)(RGB(0,64,0))
-#define DarkCyan (color_t)(RGB(0,64,64))
-#define DarkRed (color_t)(RGB(64,0,0))
-#define DarkMagenta (color_t)(RGB(64,0,64))
-#define DarkBrown (color_t)(RGB(64,64,0))
-#define DarkGray (color_t)(RGB(64,64,64))
+#define DarkBlue (color_t)(RGB(0,0,63))
+#define DarkGreen (color_t)(RGB(0,63,0))
+#define DarkCyan (color_t)(RGB(0,63,63))
+#define DarkRed (color_t)(RGB(63,0,0))
+#define DarkMagenta (color_t)(RGB(63,0,63))
+#define DarkBrown (color_t)(RGB(63,63,0))
+#define DarkGray (color_t)(RGB(63,63,63))
-#define BrightRed (color_t)(RGB(255,0,0))
//namespace SW_graphics
//{
