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 UniGraphic by
Revision 10:668cf78ff93a, committed 2015-02-19
- Comitter:
- Geremia
- Date:
- Thu Feb 19 00:33:27 2015 +0000
- Parent:
- 9:1749ae993cfe
- Child:
- 11:b842b8e332cb
- Commit message:
- Added FastWindow for TFT (truncated set page/column cmds), which increases speed when plotting single pixels (around 20-25% faster?!?!)
Changed in this revision
--- a/Display/LCD.h Tue Feb 17 22:35:07 2015 +0000
+++ b/Display/LCD.h Thu Feb 19 00:33:27 2015 +0000
@@ -148,6 +148,7 @@
void setscrollarea (int startY, int areasize){};
void scroll (int lines){};
void scrollreset(){};
+ void FastWindow(bool enable){};
unsigned int tftID;
--- a/Display/TFT.cpp Tue Feb 17 22:35:07 2015 +0000
+++ b/Display/TFT.cpp Thu Feb 19 00:33:27 2015 +0000
@@ -36,6 +36,8 @@
set_auto_up(false); //we don't have framebuffer
topfixedareasize=0;
scrollareasize=0;
+ usefastwindow=false;
+ fastwindowready=false;
// cls();
// locate(0,0);
}
@@ -60,6 +62,8 @@
set_auto_up(false);
topfixedareasize=0;
scrollareasize=0;
+ usefastwindow=false;
+ fastwindowready=false;
// locate(0,0);
}
void TFT::wr_cmd8(unsigned char cmd)
@@ -157,11 +161,14 @@
if(o == 0) wr_cmd8(0x20);
else wr_cmd8(0x21);
}
+void TFT::FastWindow(bool enable)
+ {
+ usefastwindow=enable;
+ }
// TFT have both column and raw autoincrement inside a window, with internal counters
void TFT::window(int x, int y, int w, int h)
{
- //ili9486 does not like truncated 2A/2B cmds, at least in par mode
- //setting only start column/page would speedup, but needs a windowmax() before, maybe implement later
+ fastwindowready=false; // end raw/column going to be set to lower value than bottom-right corner
wr_cmd8(0x2A);
wr_data16(x); //start column
wr_data16(x+w-1);//end column
@@ -174,6 +181,7 @@
}
void TFT::window4read(int x, int y, int w, int h)
{
+ fastwindowready=false;
wr_cmd8(0x2A);
wr_data16(x); //start column
wr_data16(x+w-1);//end column
@@ -186,14 +194,47 @@
}
void TFT::pixel(int x, int y, unsigned short color)
{
- window(x,y,1,1);
+ if(usefastwindow) //ili9486 does not like truncated 2A/2B cmds, at least in par mode
+ {
+ if(fastwindowready) //setting only start column/page does speedup, but needs end raw/column previously set to bottom-right corner
+ {
+ wr_cmd8(0x2A);
+ wr_data16(x); //start column only
+ wr_cmd8(0x2B);
+ wr_data16(y); //start page only
+ wr_cmd8(0x2C); //write mem, just send pixels color next
+ }
+ else
+ {
+ window(x,y,width()-x,height()-y); // set also end raw/column to bottom-right corner
+ fastwindowready=true;
+ }
+ }
+ else window(x,y,1,1);
// proto->wr_gram(color); // 2C expects 16bit parameters
wr_gram(color);
}
unsigned short TFT::pixelread(int x, int y)
{
+ if(usefastwindow) //ili9486 does not like truncated 2A/2B cmds, at least in par mode
+ {
+ if(fastwindowready) //setting only start column/page does speedup, but needs end raw/column previously set to bottom-right corner
+ {
+ wr_cmd8(0x2A);
+ wr_data16(x); //start column only
+ wr_cmd8(0x2B);
+ wr_data16(y); //start page only
+ wr_cmd8(0x2E); //read mem, just pixelread next
+ }
+ else
+ {
+ window4read(x,y,width()-x,height()-y); // set also end raw/column to bottom-right corner
+ fastwindowready=true;
+ }
+ }
+ else window4read(x,y,1,1);
+
unsigned short color;
- window4read(x,y,1,1);
// proto->wr_gram(color); // 2C expects 16bit parameters
color = rd_gram();
if(mipistd) color = BGR2RGB(color); // in case, convert BGR to RGB (should depend on cmd36 bit3) but maybe is device specific
--- a/Display/TFT.h Tue Feb 17 22:35:07 2015 +0000
+++ b/Display/TFT.h Thu Feb 19 00:33:27 2015 +0000
@@ -110,10 +110,17 @@
virtual void set_orientation(int o);
/** Set ChipSelect high or low
- * @param enable 0/1
+ * @param enable true/false
*/
virtual void BusEnable(bool enable);
+ /** Enable fast window (default disabled)
+ * used to speedup functions that plots single pixels, like circle, oblique lines or just sparse pixels
+ * @param enable true/false
+ * @note most but not all controllers support this, even if datasheet tells they should
+ */
+ void FastWindow(bool enable);
+
/** Set scroll area boundaries
* scroll is done in hw but only on the native vertical axis
* TFTs are mainly native protrait view, so horizontal scroll if rotated in landscape view
@@ -232,6 +239,7 @@
unsigned int scrollbugfix;
bool mipistd;
+
private:
Protocols* proto;
@@ -249,6 +257,9 @@
int topfixedareasize;
int scrollareasize;
bool useNOP;
+ bool usefastwindow;
+ bool fastwindowready;
+
};
#endif
\ No newline at end of file
--- a/Graphics/GraphicsDisplay.h Tue Feb 17 22:35:07 2015 +0000
+++ b/Graphics/GraphicsDisplay.h Thu Feb 19 00:33:27 2015 +0000
@@ -69,9 +69,6 @@
* @param color defines the color for the pixel.
*/
virtual void pixel(int x, int y, unsigned short color) = 0;
-
-
-
/** Set the window, which controls where items are written to the screen.
* When something hits the window width, it wraps back to the left side
--- a/Inits/ILI9341.cpp Tue Feb 17 22:35:07 2015 +0000
+++ b/Inits/ILI9341.cpp Thu Feb 19 00:33:27 2015 +0000
@@ -25,6 +25,7 @@
init();
set_orientation(0);
cls();
+ FastWindow(true); // most but not all controllers support this, even if datasheet tells they should.
locate(0,0);
}
ILI9341::ILI9341(proto_t displayproto, int Hz, PinName mosi, PinName miso, PinName sclk, PinName CS, PinName reset, PinName DC, const char *name, unsigned int LCDSIZE_X , unsigned int LCDSIZE_Y)
@@ -35,6 +36,7 @@
identify(); // will collect tftID and set mipistd flag
init(); // per display custom init cmd sequence, implemented here
set_orientation(0); //TFT class does for MIPI standard and some ILIxxx
+ FastWindow(true); // most but not all controllers support this, even if datasheet tells they should.
cls();
locate(0,0);
}
--- a/Inits/ILI9486.cpp Tue Feb 17 22:35:07 2015 +0000
+++ b/Inits/ILI9486.cpp Thu Feb 19 00:33:27 2015 +0000
@@ -23,6 +23,7 @@
identify(); // will collect tftID and set mipistd flag
init();
set_orientation(0);
+ // FastWindow(true); // most but not all controllers support this, even if datasheet tells they should. ILI9486 does not, at least in par mode
cls();
locate(0,0);
}
@@ -34,6 +35,7 @@
identify(); // will collect tftID and set mipistd flag
init(); // per display custom init cmd sequence, implemented here
set_orientation(0); //TFT class does for MIPI standard and some ILIxxx
+ // FastWindow(true); // most but not all controllers support this, even if datasheet tells they should. ILI9486 does not, at least in par mode
cls();
locate(0,0);
}
--- a/Inits/TFT_MIPI.cpp Tue Feb 17 22:35:07 2015 +0000
+++ b/Inits/TFT_MIPI.cpp Thu Feb 19 00:33:27 2015 +0000
@@ -24,6 +24,7 @@
init();
// scrollbugfix=1; // when scrolling 1 line, the last line disappears, set to 1 to fix it, for ili9481 is set automatically in identify()
set_orientation(0);
+ // FastWindow(true); // most but not all controllers support this, even if datasheet tells they should. Give a try
cls();
locate(0,0);
}
@@ -36,6 +37,7 @@
init(); // per display custom init cmd sequence, implemented here
// scrollbugfix=1; // when scrolling 1 line, the last line disappears, set to 1 to fix it, for ili9481 is set automatically in identify()
set_orientation(0); //TFT class does for MIPI standard and some ILIxxx
+ // FastWindow(true); // most but not all controllers support this, even if datasheet tells they should. Give a try
cls();
locate(0,0);
}
