Fork of David Smart's RA8875 library for the purpose of adding touch screen support

Fork of RA8875 by David Smart

Revision:
25:9556a3a9b7cc
Parent:
24:8ca861acf12d
Child:
28:ed102fc442c4
--- a/RA8875.cpp	Fri Jan 17 02:10:18 2014 +0000
+++ b/RA8875.cpp	Fri Jan 17 03:16:51 2014 +0000
@@ -647,30 +647,36 @@
     return ret;
 }
 
-RetCode_t RA8875::ellipse(unsigned int x, unsigned int y, unsigned int R1, unsigned int R2, color_t color, fill_t fillit)
+RetCode_t RA8875::ellipse(unsigned int x, unsigned int y, unsigned int radius1, unsigned int radius2, color_t color, fill_t fillit)
 {
     foreground(color);
-    return ellipse(x,y,R1,R2,fillit);
+    return ellipse(x,y,radius1,radius2,fillit);
 }
 
-RetCode_t RA8875::ellipse(unsigned int x, unsigned int y, unsigned int R1, unsigned int R2, fill_t fillit)
+RetCode_t RA8875::fillellipse(unsigned int x, unsigned int y, unsigned int radius1, unsigned int radius2, color_t color, fill_t fillit)
+{
+    foreground(color);
+    return ellipse(x,y,radius1,radius2,fillit);
+}
+        
+RetCode_t RA8875::ellipse(unsigned int x, unsigned int y, unsigned int radius1, unsigned int radius2, fill_t fillit)
 {
     RetCode_t ret = noerror;
     
     PERFORMANCE_RESET;
-    if (R1 <= 0 || R2 <= 0) {
+    if (radius1 <= 0 || radius2 <= 0) {
         ;   // do nothing
-    } else if (R1 == 1 && R2 == 1) {
+    } else if (radius1 == 1 && radius2 == 1) {
         pixel(x, y);
     } else {
         WriteCommand(0xA5, x & 0xFF);
         WriteCommand(0xA6, x >> 8);
         WriteCommand(0xA7, y & 0xFF);
         WriteCommand(0xA8, y >> 8);
-        WriteCommand(0xA1, R1 & 0xFF);
-        WriteCommand(0xA2, R1 >> 8);
-        WriteCommand(0xA3, R2 & 0xFF);
-        WriteCommand(0xA4, R2 >> 8);
+        WriteCommand(0xA1, radius1 & 0xFF);
+        WriteCommand(0xA2, radius1 >> 8);
+        WriteCommand(0xA3, radius2 & 0xFF);
+        WriteCommand(0xA4, radius2 >> 8);
         
         unsigned char drawCmd = 0x00;   // Ellipse
         if (fillit == FILL)
@@ -903,42 +909,6 @@
 //
 //    Everything from here down is test code.
 
-void ValentineMessage(RA8875 & display, Serial & pc) 
-{
-    pc.printf("Write Sample text\r\n");
-    display.background(BrightRed);
-    display.foreground(White);
-    display.cls();
-    display.SetTextFontControl(NOFILL);
-    for (int i=0; i<20 ; i++) {
-        int sz = rand() & 1 + 1;
-        int rx = rand() % 360 + 0;
-        int ry = rand() % 250 + 0;
-        if (sz == 1)
-            rx /= 2;
-        display.SetTextCursor(rx, ry);
-        display.SetTextFontSize(sz, sz);
-        display.puts("David loves Louize");
-        wait_ms(50);
-    }
-    display.SetTextFontSize(2,2);
-    wait_ms(1000);
-    // Make a heart shape
-    display.ellipse(300, 120, 40, 50, FILL);
-    display.ellipse(370, 120, 40, 50, FILL);
-    display.triangle(265,145, 405,145, 335,230, FILL);
-    wait_ms(2500);
-    display.foreground(Blue);
-    display.puts(300,90, "Be My");
-    wait_ms(500);
-    display.puts(262,118, "Valentine");
-    // put a few things back the way they were
-    display.SetTextFontControl(FILL);
-    display.SetTextFontSize(1,1);
-    display.background(Black);
-}
-
-
 void TextCursorTest(RA8875 & display, Serial & pc)
 {
     const char * iCursor = "The I-Beam cursor should be visible for this text, but it should not be blinking while writing this text.\r\n";
@@ -948,10 +918,10 @@
     const char * p;
     
     pc.printf("Text Cursor Test\r\n");
-    display.Backlight_u8(255);
     display.background(Black);
     display.foreground(Blue);
     display.cls();
+    display.Backlight_u8(255);
     display.puts(0,0, "Text Cursor Test.");
     
     // visible, non-blinking
@@ -1277,8 +1247,7 @@
                   "R - Rectangles      O - rOund rectangles\r\n"
                   "T - Triangles                        \r\n"
                   "C - Circles         E - Ellipses\r\n"
-                  "V - Valentine       r - reset  \r\n"
-                  "A - Auto Test mode                  \r\n"
+                  "A - Auto Test mode  r - reset  \r\n"
                   "> ");
         if (automode == -1 || pc.readable()) {
             automode = -1;
@@ -1326,9 +1295,6 @@
             case 'E':
                 EllipseTest(lcd, pc);
                 break;
-            case 'V':
-                ValentineMessage(lcd, pc);
-                break;
             case 'r':
                 pc.printf("Resetting ...\r\n");
                 wait_ms(20);