Uses the same fonts as the SPI_TFT_ILI9341 Library (I have many, and a html/php font editor for that)
Diff: SPI_TFT_ILI9225.h
- Revision:
- 10:a640680b5309
- Parent:
- 9:680f6c9940b3
- Child:
- 13:9e6589dc8864
--- a/SPI_TFT_ILI9225.h Wed Nov 23 11:57:11 2016 +0000 +++ b/SPI_TFT_ILI9225.h Wed Nov 23 12:35:40 2016 +0000 @@ -107,180 +107,276 @@ public: + /** Constructor + * + */ TFT_22_ILI9225(PinName sdi, PinName clk, PinName cs, PinName rs, PinName rst, PinName led, const char *name); - //TFT_22_ILI9225(PinName RST, PinName RS, PinName CS, PinName LED); + /** Claim standard output + * + */ virtual bool claim (FILE *stream); - /// Initialization + /** Initialization + * + */ void init(void); - /// Clear the screen + /** Clear the screen + * + */ void cls(void); - /// fill the screen with color: + /** Fill the screen with color + * + * @param color + * + */ void fill(uint16_t color); - /// Invert screen - /// @param flag true to invert, false for normal screen + /** Invert screen + * + * @param flag true to invert, false for normal screen + * + */ void invert(bool flag); - /// Switch backlight on or off - /// @param flag true=on, false=off - void setBacklight(double value); + /** Set backlight brightness + * + * @param brightness + * + */ + void setBacklight(double brightness); - /// Switch backlight off + /** Switch backlight off + * + */ void setBacklightOff(void); - /// Switch backlight on + /** Switch backlight on + * + */ void setBacklightOn(void); - /// Switch display on or off - /// @param flag true=on, false=off + /** Switch display on or off + * + * @param flag true=on, false=off + * + */ void setDisplay(bool flag); - /// Set orientation - /// @param orientation orientation, 0=portrait, 1=right rotated landscape, 2=reverse portrait, 3=left rotated landscape + /** Set orientation + * + * @param orientation orientation: + * 0=ILI9225_PORTRAIT_L : SD card at the left side + * 1=ILI9225_LANDSCAPE_B : SD card at the bottom side + * 2=ILI9225_PORTRAIT_R : SD card at the right side + * 3=ILI9225_LANDSCAPE_T : SD card at the top side + * + */ void setOrientation(uint8_t orientation); - /// Get orientation - /// @return orientation orientation, 0=portrait, 1=right rotated landscape, 2=reverse portrait, 3=left rotated landscape + /** Get orientation + * + * @return orientation orientation, 0=portrait, 1=right rotated landscape, 2=reverse portrait, 3=left rotated landscape + * + */ uint8_t getOrientation(void); - /// Font size, x-axis - /// @return horizontal size of current font, in pixels + /** Font size, x-axis + * + * @return horizontal size of current font, in pixels + * + */ uint8_t fontX(void); - /// Font size, y-axis - /// @return vertical size of current font, in pixels + /** Font size, y-axis + * + * @return vertical size of current font, in pixels + * + */ uint8_t fontY(void); - /// Screen size, x-axis - /// @return horizontal size of the screen, in pixels - /// @note 219 means 0..219 coordinates (decimal) + /** Screen size, x-axis + * + * @return horizontal size of the screen, in pixels + * @note 219 means 0..219 coordinates (decimal) + * + */ uint16_t maxX(void); - /// Screen size, x-axis - /// @return horizontal size of the screen, in pixels - /// @note 220 means 220 pixels and thus 0..219 coordinates (decimal) + /** Screen size, x-axis + * + * @return horizontal size of the screen, in pixels + * @note 220 means 220 pixels and thus 0..219 coordinates (decimal) + * + */ uint16_t width(void); - /// Screen size, y-axis - /// @return vertical size of the screen, in pixels - /// @note 175 means 0..175 coordinates (decimal) + /** Screen size, y-axis + * + * @return vertical size of the screen, in pixels + * @note 175 means 0..175 coordinates (decimal) + * + */ uint16_t maxY(void); - /// Screen size, y-axis - /// @return vertical size of the screen, in pixels - /// @note 176 means 176 pixels and thus 0..175 coordinates (decimal) + /** Screen size, y-axis + * + * @return vertical size of the screen, in pixels + * @note 176 means 176 pixels and thus 0..175 coordinates (decimal) + * + */ uint16_t height(void); // Graphics functions - /// Draw pixel - /// @param x1 point coordinate, x-axis - /// @param y1 point coordinate, y-axis - /// @param color 16-bit color + /** Draw pixel + * + * @param x1 point coordinate, x-axis + * @param y1 point coordinate, y-axis + * @param color 16-bit color + * + */ void pixel(uint16_t x1, uint16_t y1, uint16_t color); - /// Draw line, rectangle coordinates - /// @param x1 top left coordinate, x-axis - /// @param y1 top left coordinate, y-axis - /// @param x2 bottom right coordinate, x-axis - /// @param y2 bottom right coordinate, y-axis - /// @param color 16-bit color + /** Draw line, rectangle coordinates + * + * @param x1 top left coordinate, x-axis + * @param y1 top left coordinate, y-axis + * @param x2 bottom right coordinate, x-axis + * @param y2 bottom right coordinate, y-axis + * @param color 16-bit color + * + */ void line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color); - /// Draw hline, rectangle coordinates - /// @param x1 top left coordinate, x-axis - /// @param x2 bottom right coordinate, x-axis - /// @param y bottom right coordinate, y-axis - /// @param color 16-bit color + /** Draw hline, rectangle coordinates + * + * @param x1 top left coordinate, x-axis + * @param x2 bottom right coordinate, x-axis + * @param y bottom right coordinate, y-axis + * @param color 16-bit color + * + */ void hline(uint16_t x1, uint16_t x2, uint16_t y, uint16_t color); - /// Draw vline, rectangle coordinates - /// @param x top left coordinate, x-axis - /// @param y1 top left coordinate, y-axis - /// @param y2 bottom right coordinate, y-axis - /// @param color 16-bit color + /** Draw vline, rectangle coordinates + * + * @param x top left coordinate, x-axis + * @param y1 top left coordinate, y-axis + * @param y2 bottom right coordinate, y-axis + * @param color 16-bit color + * + */ void vline(uint16_t x, uint16_t y1, uint16_t y2, uint16_t color); - /// Draw rectangle, rectangle coordinates - /// @param x1 top left coordinate, x-axis - /// @param y1 top left coordinate, y-axis - /// @param x2 bottom right coordinate, x-axis - /// @param y2 bottom right coordinate, y-axis - /// @param color 16-bit color + /** Draw rectangle, rectangle coordinates + * + * @param x1 top left coordinate, x-axis + * @param y1 top left coordinate, y-axis + * @param x2 bottom right coordinate, x-axis + * @param y2 bottom right coordinate, y-axis + * @param color 16-bit color + * + */ void rect(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color); - /// Draw solid rectangle, rectangle coordinates - /// @param x1 top left coordinate, x-axis - /// @param y1 top left coordinate, y-axis - /// @param x2 bottom right coordinate, x-axis - /// @param y2 bottom right coordinate, y-axis - /// @param color 16-bit color + /** Draw solid rectangle, rectangle coordinates + * + * @param x1 top left coordinate, x-axis + * @param y1 top left coordinate, y-axis + * @param x2 bottom right coordinate, x-axis + * @param y2 bottom right coordinate, y-axis + * @param color 16-bit color + * + */ void fillrect(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color); - /// Draw circle - /// @param x0 center, point coordinate, x-axis - /// @param y0 center, point coordinate, y-axis - /// @param radius radius - /// @param color 16-bit color + /** Draw circle + * + * @param x0 center, point coordinate, x-axis + * @param y0 center, point coordinate, y-axis + * @param radius radius + * @param color 16-bit color + * + */ void circle(uint16_t x0, uint16_t y0, uint16_t radius, uint16_t color); - /// Draw solid circle - /// @param x0 center, point coordinate, x-axis - /// @param y0 center, point coordinate, y-axis - /// @param radius radius - /// @param color 16-bit color + /** Draw solid circle + * + * @param x0 center, point coordinate, x-axis + * @param y0 center, point coordinate, y-axis + * @param radius radius + * @param color 16-bit color + * + */ void fillcircle(uint8_t x0, uint8_t y0, uint8_t radius, uint16_t color); - /// Draw triangle, triangle coordinates - /// @param x1 corner 1 coordinate, x-axis - /// @param y1 corner 1 coordinate, y-axis - /// @param x2 corner 2 coordinate, x-axis - /// @param y2 corner 2 coordinate, y-axis - /// @param x3 corner 3 coordinate, x-axis - /// @param y3 corner 3 coordinate, y-axis - /// @param color 16-bit color + /** Draw triangle, triangle coordinates + * + * @param x1 corner 1 coordinate, x-axis + * @param y1 corner 1 coordinate, y-axis + * @param x2 corner 2 coordinate, x-axis + * @param y2 corner 2 coordinate, y-axis + * @param x3 corner 3 coordinate, x-axis + * @param y3 corner 3 coordinate, y-axis + * @param color 16-bit color + * + */ void triangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t x3, uint16_t y3, uint16_t color); - /// Draw solid triangle, triangle coordinates - /// @param x1 corner 1 coordinate, x-axis - /// @param y1 corner 1 coordinate, y-axis - /// @param x2 corner 2 coordinate, x-axis - /// @param y2 corner 2 coordinate, y-axis - /// @param x3 corner 3 coordinate, x-axis - /// @param y3 corner 3 coordinate, y-axis - /// @param color 16-bit color + /** Draw solid triangle, triangle coordinates + * + * @param x1 corner 1 coordinate, x-axis + * @param y1 corner 1 coordinate, y-axis + * @param x2 corner 2 coordinate, x-axis + * @param y2 corner 2 coordinate, y-axis + * @param x3 corner 3 coordinate, x-axis + * @param y3 corner 3 coordinate, y-axis + * @param color 16-bit color + * + */ void filltriangle(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t x3, uint16_t y3, uint16_t color); - /// Draw line/filled rectangle, rectangle coordinates - /// @param x1 top left coordinate, x-axis - /// @param y1 top left coordinate, y-axis - /// @param x2 bottom right coordinate, x-axis - /// @param y2 bottom right coordinate, y-axis - /// @param rad defines the redius of the circle - /// @param fill fill yes or no - /// @param color 16-bit color + /** Draw line/filled rectangle, rectangle coordinates + * + * @param x1 top left coordinate, x-axis + * @param y1 top left coordinate, y-axis + * @param x2 bottom right coordinate, x-axis + * @param y2 bottom right coordinate, y-axis + * @param rad defines the redius of the circle + * @param fill fill yes or no + * @param color 16-bit color + * + */ void roundrect(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t rad, bool fill, uint16_t color); - /// Calculate 16-bit color from 8-bit Red-Green-Blue components - /// @param red red component, 0x00..0xff - /// @param green green component, 0x00..0xff - /// @param blue blue component, 0x00..0xff - /// @return 16-bit color + /** Calculate 16-bit color from 8-bit Red-Green-Blue components + * + * @param red red component, 0x00..0xff + * @param green green component, 0x00..0xff + * @param blue blue component, 0x00..0xff + * @return 16-bit color + * + */ uint16_t setColor(uint8_t red, uint8_t green, uint8_t blue); - /// Calculate 8-bit Red-Green-Blue components from 16-bit color - /// @param rgb 16-bit color - /// @param red red component, 0x00..0xff - /// @param green green component, 0x00..0xff - /// @param blue blue component, 0x00..0xff + /** Calculate 8-bit Red-Green-Blue components from 16-bit color + * + * @param rgb 16-bit color + * @param red red component, 0x00..0xff + * @param green green component, 0x00..0xff + * @param blue blue component, 0x00..0xff + * + */ void splitColor(uint16_t rgb, uint8_t &red, uint8_t &green, uint8_t &blue); - /// Set current font - /// @param font Font name + /** Set current font + * + * @param font Font name + * + */ void setFont(uint8_t* font); /** put a char on the screen @@ -300,12 +396,46 @@ */ void character(int x, int y, int c); - void foreground(uint16_t colour); + /** Set text foreground color + * + * @param color + * + */ + void foreground(uint16_t color); + + /** Set text background color + * + * @param color + * + */ + void background(uint16_t color); - void background(uint16_t colour); + /** Set grapical cursor position + * + * @param x + * @param y + * + */ void locate(int x, int y); + + /** Set text cursor position + * + * @param x + * @param y + * + */ void gotoxy(int x, int y); + + /** Set text cursor at 0,0 + * + */ void home(void); + + /** Set spacing in pixels between text lines + * + * @param line_spacing spacing in pixels between text lines + * + */ void linespacing(int line_spacing); /** calculate the max number of char in a line @@ -324,6 +454,12 @@ */ virtual int rows(void); + /** Make an ascii string from an unicode string + * + * @param uni_str + * @param ascii_str + * + */ void unicode2ascii(char *uni_str, char *ascii_str); void window (unsigned int x, unsigned int y, unsigned int w, unsigned int h); @@ -341,15 +477,68 @@ uint16_t _foreground; uint16_t _background; + /** Swap two values + * + * @param a b + * @param a b + * + */ void _swap(uint16_t &a, uint16_t &b); + + /** Maximize window to entire screen + * + */ void _setWindowMax(void); + + /** Set window + * + * @param x0 + * @param y0 + * @param x1 + * @param y1 + * + */ void _setWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1); - void _orientCoordinates(uint16_t &x1, uint16_t &y1); + + /** Set coordinates + * + * @param x + * @param y + * + */ + void _orientCoordinates(uint16_t &x, uint16_t &y); + + /** Write register + * + * @param uint16_t register + * @param uint16_t data + * + */ void _writeRegister(uint16_t reg, uint16_t data); + /** Start writing data + * + */ void _startData(void); + + /** End writing data + * + */ void _endData(void); + + /** Write data + * + * @param uint16_t data + * + */ void _writeData(uint16_t data); + + /** Write a command + * + * @param HI + * @param LO + * + */ void _writeCommand(uint8_t HI, uint8_t LO); float _brightness;