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:
- 21:3c1efb192927
- Parent:
- 20:6e2e4a8372eb
- Child:
- 23:a50ded45dbaf
--- a/RA8875.cpp Sun Jan 12 18:44:58 2014 +0000 +++ b/RA8875.cpp Sun Jan 12 21:11:15 2014 +0000 @@ -468,13 +468,15 @@ return roundrect(x1,y1,x2,y2,radius1,radius2,fillit); } -RetCode_t RA8875::roundrect(unsigned int x1, unsigned int y1 ,unsigned int x2, unsigned int y2, +RetCode_t RA8875::roundrect(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, unsigned int radius1, unsigned int radius2, fill_t fillit) { RetCode_t ret = noerror; PERFORMANCE_RESET; - if (x1 == x2 && y1 == y2) { + if (x1 > x2 || y1 > y2 || (radius1 > (x2-x1)/2) || (radius2 > (y2-y1)/2) ) { + ret = bad_parameter; + } else if (x1 == x2 && y1 == y2) { pixel(x1, y1); } else if (x1 == x2) { line(x1, y1, x2, y2); @@ -490,12 +492,16 @@ WriteCommand(0x97, y2 & 0xFF); WriteCommand(0x98, y2 >> 8); - //while (r && r > (x2 - x1) || r > (y2 - y1)) - // r--; WriteCommand(0xA1, radius1 & 0xFF); WriteCommand(0xA2, radius1 >> 8); WriteCommand(0xA3, radius2 & 0xFF); WriteCommand(0xA4, radius2 >> 8); + + // Should not need this... + WriteCommand(0xA5, 0 & 0xFF); + WriteCommand(0xA6, 0 >> 8); + WriteCommand(0xA7, 0 & 0xFF); + WriteCommand(0xA8, 0 >> 8); unsigned char drawCmd = 0x20; // Rounded Rectangle if (fillit == FILL) @@ -504,7 +510,7 @@ WriteCommand(0xA0, 0x80 + drawCmd); // Start drawing. while (ReadCommand(0xA0) & 0x80) { // await completion. wait_us(POLLWAITuSec); - } + } } REGISTERPERFORMANCE(PRF_DRAWROUNDEDRECTANGLE); return ret;