Lib for the new LCD Display with ILI9341 controller with rounded (outlined and filled) rectangles added
Fork of SPI_TFT_ILI9341 by
Diff: SPI_TFT_ILI9341.h
- Revision:
- 14:70665f0a182f
- Parent:
- 13:b2b3e5430f81
diff -r b2b3e5430f81 -r 70665f0a182f SPI_TFT_ILI9341.h --- a/SPI_TFT_ILI9341.h Wed Jun 25 16:51:27 2014 +0000 +++ b/SPI_TFT_ILI9341.h Tue Mar 24 01:33:24 2015 +0000 @@ -42,6 +42,15 @@ #define Orange 0xFD20 /* 255, 165, 0 */ #define GreenYellow 0xAFE5 /* 173, 255, 47 */ +static inline void swap(int16_t &a, int16_t &b) +{ + int16_t t = a; + + a = b; + b = t; +} + + /** Display control class, based on GraphicsDisplay and TextDisplay * @@ -121,8 +130,20 @@ * @param color 16 bit color * * */ - void circle(int x, int y, int r, int colour); - + void circle(int x0, int y0, int r, int color); + void drawCircleHelper( int16_t x0, int16_t y0, int16_t r, uint8_t cornername, uint16_t color); + void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); + + void drawRoundRect(int16_t x, int16_t y, int16_t w, int16_t h, int16_t r, uint16_t color); + void fillRoundRect(int16_t x, int16_t y, int16_t w, int16_t h, int16_t r, uint16_t color); + +void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color); +void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color); + + +void drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color); +void fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color); + /** draw a filled circle * * @param x0,y0 center @@ -130,7 +151,9 @@ * @param color 16 bit color * */ void fillcircle(int x, int y, int r, int colour); - + void fillCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, int16_t delta, uint16_t color); + + /** draw a 1 pixel line * @@ -140,7 +163,7 @@ * */ void line(int x0, int y0, int x1, int y1, int colour); - + /** draw a rect * * @param x0,y0 top left corner @@ -224,7 +247,6 @@ */ void Bitmap(unsigned int x, unsigned int y, unsigned int w, unsigned int h,unsigned char *bitmap); - /** paint a 16 bit BMP from filesytem on the TFT (slow) * * @param x,y : position of upper left corner @@ -276,14 +298,14 @@ * @returns ID */ int Read_ID(void); - + + DigitalOut _cs; DigitalOut _reset; DigitalOut _dc; unsigned char* font; - - + protected: @@ -320,9 +342,7 @@ * @param h window height in pixels */ virtual void window (unsigned int x,unsigned int y, unsigned int w, unsigned int h); - - /** Init the ILI9341 controller * */ @@ -404,7 +424,6 @@ unsigned int char_y; unsigned char spi_num; - }; #endif