Library to control a QVGA TFT connected to SPI. You can use printf to print text The lib can handle different fonts, draw lines, circles, rect and bmp
Diff: SPI_TFT.h
- Revision:
- 6:fc33e4a5713e
- Parent:
- 5:2db1b8070d94
- Child:
- 8:e1f5232d93a0
--- a/SPI_TFT.h Sat Jul 30 22:15:35 2011 +0000 +++ b/SPI_TFT.h Wed Aug 31 20:51:14 2011 +0000 @@ -9,6 +9,10 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + + /* change the char position handling + * use pixel (x,y) instadt of colum row */ + #ifndef MBED_SPI_TFT_H #define MBED_SPI_TFT_H @@ -41,8 +45,11 @@ #define Cyan 0x07FF /* 0, 255, 255 */ #define Red 0xF800 /* 255, 0, 0 */ #define Magenta 0xF81F /* 255, 0, 255 */ -#define Yellow 0xFFE0 /* 255, 255, 0 */ +#define Yellow 0xFFE0 /* 255, 255, 0 */ #define White 0xFFFF /* 255, 255, 255 */ +#define Orange 0xFD20 /* 255, 165, 0 */ +#define GreenYellow 0xAFE5 /* 173, 255, 47 */ + /** Display control class, based on GraphicsDisplay and TextDisplay * @@ -73,7 +80,7 @@ * TFT.locate(0,0); * printf(" Hello Mbed 0"); * TFT.set_font((unsigned char*) Arial24x23); // select font 2 - * TFT.locate(2,5); + * TFT.locate(48,115); * TFT.printf("Bigger Font"); * } * @endcode @@ -164,11 +171,10 @@ /** setup cursor position * - * @param column 0 to max - * @param row 0 to max - * max depend on font size + * @param x x-position (top left) + * @param y y-position */ - void locate(int column, int row); + void locate(int x, int y); /** Fill the screen with _backgroun color * @@ -201,12 +207,12 @@ /** draw a character on given position out of the active font to the TFT * - * @param col column - * @param row row + * @param x x-position of char (top left) + * @param y y-position * @param c char to print * */ - virtual void character(int col, int row, int c); + virtual void character(int x, int y, int c); /** paint a bitmap on the TFT * @@ -222,6 +228,9 @@ * use edit -> copy block -> C Source to export C array * paste this array into your program * + * define the array as static const unsigned char to put it into flash memory + * cast the pointer to (unsigned char *) : + * tft.Bitmap(10,40,309,50,(unsigned char *)scala); */ void Bitmap(unsigned int x, unsigned int y, unsigned int w, unsigned int h,unsigned char *bitmap); @@ -369,6 +378,7 @@ unsigned int orientation; unsigned int char_x; + unsigned int char_y; };