Reference

Last revision 2026/01/22

The article outlines various API functions for screen display, such as setTextSize and fillScreen, and explains the coordinate systems used for graphical and text display on a 2.2” screen, providing users with the knowledge to optimize their display outputs.

API Function

The following codes are just one part of the API funciotn description. For more information, please refer to ST7687S Library Introduction and Display Library Introduction.

/*!
 * @The functionality of the function: set the size of the text
 *
 * @The formal parameter size refers to the text size based on the font(6×8). Size is rounded to the integer greater than 0; if size is 1, the pixel points the font occupied will be 6×8. if it is 2, that will be 12×16. The text out of the screen cannot be displayed;
 *   
 */
void setTextSize(uint8_t size)
/*!
 * @The functionality of the screen: refresh the color of the screen
 *
 * @The formal parameter color: values range[0, 65535] or 4-bit hexadecimal code
There are 19 common defined colors in the function library, and users can also customize other colors;
 *   
 */
void fillScreen(uint16_t color);
/*!
 * @the functionality of the function: draw pixel point
 *
 * @the formal parameter:the coordinate data of the pixel point x on the x axis, values range[-128, 128]
 *                        the coordinate data of the pixel y on the y axis, values range[-128, 128] and the relationship between x and y should be: x^2 y^2<=128^2;
 *                 color:values range [0,65535]or 4-bit hexadecimal code;
 *   
 */
void drawPixel(int16_t x, int16_t y, uint16_t color);
/*!
 * @the functionality of the function:draw the line between the two points
 *
 * @the formal parameter:x0,x1;y0,y1values range[-128,128] the relationship between(x0,y0)and(x1,y1)should be: x^2 y^2<=64^2;
 *                 color:set the color of the line, values range [0,65535] or 4-bit hexadecimal code ;
 *   
 */
void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color);
/*!
 * @the functionality of the function:draw the horizontal line with the starting point (x,y)
 * @the formal parameter:the coordinate of the starting point x on the x axis, values rage[-128,128] 
 *                        the coordinate of the starting point y on the y axis, values range [-128,128] and the relationship of x and y should be: x^2 y^2<=64^2;
 *                 width: the width of the horizontal line, values range [0,256]
 *                 color:set the color of the horizontal line, values range [0,65535] or 4-bit hexadecimal code;
 *   
 */
void drawHLine(int16_t x, int16_t y, int16_t width, uint16_t color);
/*!
 * @the functionality of the function:draw the vertical line with the starting point(x,y)
 *
 * @the formal parameter:the coordinate of the starting point x on the x axis, values range [-128,128]
 *                        the coordinate of the starting point y on the y axis, values range [-128,128] and the relationship of x and y should be: x^2 y^2<=64^2;
 *                height: the height of the vertical line, values range[0,256]
 *                 color:set the color of the vertical line, values range [0,65535] or 4-bit
hexadecimal code;
 *   
 */
void drawVLine(int16_t x, int16_t y, int16_t height, uint16_t color);
/*!
 * @the functionality of the function:set the initial coordinates of character printing 
 *
 * @the formal parameter:the coordinate of the starting point x on the x axis, values: x>=0 
 *        the coordinate of the starting y on the y axis, values y>=0 and the relationship of x and y should be: (x-64)^2 (y-64)^2<=6^2; 
 *  
 */
void setCursor(int16_t x, int16_t y);

Coordinates Axis Diagram of the Screen

The graphic display coordinates and the text display coordinates of the 2.2”screen are two different coordinates systems. The origin of the graphic display coordinates begin from the centre point of the screen while that of the later one begins from the top left hand side of the screen.

Was this article helpful?

TOP