BurstSPI support for improved performance

Fork of RA8875 by David Smart

Revision:
83:7bad0068cca0
Parent:
82:f7d300f26540
Child:
84:e102021864b5
--- a/RA8875.cpp	Tue Dec 30 23:45:37 2014 +0000
+++ b/RA8875.cpp	Thu Jan 01 20:35:37 2015 +0000
@@ -418,20 +418,8 @@
 
 RetCode_t RA8875::WriteCommandW(uint8_t command, uint16_t data)
 {
-#if 1
     WriteCommand(command, data & 0xFF);
     WriteCommand(command+1, data >> 8);
-#else
-    // This should be a little faster, but doesn't work...
-    INFO("WriteCommandW(%02X, %04X)", command, data);
-    _select(true);
-    _spiwrite(0x80);
-    _spiwrite(command);
-    //_spiwrite(0x00);     // dummy
-    _spiwrite(data & 0xFF);
-    _spiwrite(data >> 8);
-    _select(false);
-#endif
     return noerror;
 }
 
@@ -439,7 +427,7 @@
 RetCode_t RA8875::WriteCommand(unsigned char command, unsigned int data)
 {
     _select(true);
-    _spiwrite(0x80);         // cmd: write command
+    _spiwrite(0x80);            // RS:1 (Cmd/Status), RW:0 (Write)
     _spiwrite(command);
     if (data <= 0xFF) {   // only if in the valid range
         _spiwrite(0x00);
@@ -453,7 +441,7 @@
 RetCode_t RA8875::WriteDataW(uint16_t data)
 {
     _select(true);
-    _spiwrite(0x00);         // cmd: write data
+    _spiwrite(0x00);            // RS:0 (Data), RW:0 (Write)
     _spiwrite(data & 0xFF);
     _spiwrite(data >> 8);
     _select(false);
@@ -464,7 +452,7 @@
 RetCode_t RA8875::WriteData(unsigned char data)
 {
     _select(true);
-    _spiwrite(0x00);
+    _spiwrite(0x00);            // RS:0 (Data), RW:0 (Write)
     _spiwrite(data);
     _select(false);
     return noerror;
@@ -483,7 +471,7 @@
     unsigned char data;
 
     _select(true);
-    _spiwrite(0x40);
+    _spiwrite(0x40);            // RS:0 (Data), RW:1 (Read)
     data = _spiread();
     _select(false);
     return data;
@@ -495,7 +483,7 @@
     uint16_t data;
 
     _select(true);
-    _spiwrite(0x40);
+    _spiwrite(0x40);            // RS:0 (Data), RW:1 (Read)
     data  = _spiread();
     data |= (_spiread() << 8);
     _select(false);
@@ -508,7 +496,7 @@
     unsigned char data;
 
     _select(true);
-    _spiwrite(0xC0);         // These two bits are for the special "Status Read" [STSR]
+    _spiwrite(0xC0);            // RS:1 (Cmd/Status), RW:1 (Read) (Read STSR)
     data = _spiread();
     _select(false);
     return data;
@@ -1019,6 +1007,18 @@
 }
 
 
+RetCode_t RA8875::line(point_t p1, point_t p2)
+{
+    return line(p1.x, p1.y, p2.x, p2.y);
+}
+
+
+RetCode_t RA8875::line(point_t p1, point_t p2, color_t color)
+{
+    return line(p1.x, p1.y, p2.x, p2.y, color);
+}
+
+
 RetCode_t RA8875::line(loc_t x1, loc_t y1, loc_t x2, loc_t y2, color_t color)
 {
     foreground(color);
@@ -1196,6 +1196,29 @@
     return ret;
 }
 
+
+RetCode_t RA8875::circle(point_t p, dim_t radius,
+                         color_t color, fill_t fillit)
+{
+    foreground(color);
+    return circle(p.x,p.y,radius,fillit);
+}
+
+
+RetCode_t RA8875::fillcircle(point_t p, dim_t radius,
+                             color_t color, fill_t fillit)
+{
+    foreground(color);
+    return circle(p.x,p.y,radius,fillit);
+}
+
+
+RetCode_t RA8875::circle(point_t p, dim_t radius, fill_t fillit)
+{
+    return circle(p.x,p.y,radius,fillit);
+}
+
+
 RetCode_t RA8875::circle(loc_t x, loc_t y, dim_t radius,
                          color_t color, fill_t fillit)
 {