Google Chat: zj734465502@gmail.com
+86-0755-88291180
sales01@spotpear.com
dragon_manager@163.com
services01@spotpear.com
manager01@spotpear.com
WhatsApp:13246739196
】Material
document
program
software
Chinese character modeling software
Image2Lcd image taking software
】Product parameters
Working voltage: 3.3V/5V (please ensure that the power supply voltage and logic voltage are consistent, otherwise it will not work properly)
Communication interface: SPI
Screen type: IPS
Control chip: NV3030B
Resolution: 240(H)RGB x 280(V)
Display size: 30.197 x 35.230 mm
Pixel pitch: 0.1258(H) x 0.1258(V) mm
Product size: 33 × 40 mm
】Function pin
The 1.83-inch LCD uses the GH1.25 8PIN interface. Please refer to the pin connection table according to different hardware (please connect according to the pin definition table. The color of the cable in the picture is for reference only, and the actual color shall prevail)
】Raspberry Pi hardware connection
The routines we provide are based on Raspberry Pi 4B, and the connection methods provided also correspond to the pins of Raspberry Pi 4B. If you need to transplant the program, please connect according to the actual pins.
LCD | Raspberry Pi | |
BCM2835 encoding | Board physical pin number | |
VCC | 3.3V | 3.3V |
GND | GND | GND |
DIN | MOSI | 19 |
CLK | SCLK | twenty three |
CS | CE0 | twenty four |
DC | 25 | twenty two |
RST | 27 | 13 |
BL | 18 | 12 |
The connection diagram is as follows:
】STM32 hardware connection
The routines we provide are based on the XNUCLEO-F103RB development board. The connection methods provided also correspond to the pins of STM32F103RBT6. If you need to transplant the program, please connect according to the actual pins.
LCD | STM32 |
VCC | 3.3V |
GND | GND |
DIN | PA7 |
CLK | PA5 |
CS | PB6 |
DC | PA8 |
RST | PA9 |
BL | PC7 |
The connection diagram is as follows:
】Arduino hardware connection
The routines we provide are based on the ATMEGA328P development board. The connection methods provided also correspond to the pins of Arduino UNO R3. If you need to transplant the program, please connect according to the actual pins.
LCD | UNO |
VCC | 5V |
GND | GND |
DIN | D11 |
CLK | D13 |
CS | D10 |
DC | D7 |
RST | D8 |
BL | D9 |
The connection diagram is as follows:
LCD | ESP32 |
VCC | 3V3 |
GND | GND |
DIN | IO11 |
CLK | IO12 |
CS | IO10 |
DC | IO46 |
RST | IO3 |
BL | IO8 |
The connection diagram is as follows:
LCD | Pico |
VCC | 3.3V |
GND | GND |
DIN | GP11 |
CLK | GP10 |
CS | GP9 |
DC | GP8 |
RST | GP12 |
BL | GP13 |
Taking Pico as an example, the connection diagram is as follows:
】LCD and its controller
[] The built-in controller used in this LCD is NV3030B, which is a 240 x RGB x 320 pixel LCD controller. The pixels of this LCD itself are 240 (H) RGB x 280 (V). At the same time, due to the initialization control, It is initialized to both horizontal and vertical screens, so the internal RAM of the LCD is not fully used.
[] The LCD supports 8-bit, 9-bit, 16-bit and 18-bit input color formats per pixel, namely RGB444, RGB565, and RGB666. This routine uses the RGB565 color format, which is also a commonly used RGB format.
[] LCD uses a four-wire SPI communication interface, which can greatly save GPIO ports and the communication speed will be faster.
】letter of agreement
Note: The difference from the traditional SPI protocol is that since it only needs to be displayed, the data line (MISO) sent from the slave to the host is hidden.
RESX is reset, pulled low when the module is powered on, and is usually set to 1;
CSX is the slave chip select, and the chip will be enabled only when CS is low.
D/CX is the data/command control pin of the chip. When DC = 0, write commands and when DC = 1, write data.
SDA is the transmitted data, that is, RGB data;
SCL is the SPI communication clock.
For SPI communication, data has a transmission timing, that is, the combination of clock phase (CPHA) and clock polarity (CPOL):
The level of CPHA determines whether the serial synchronization clock is on the first clock transition edge or the second clock The data on the transition edge is collected. When CPHA = 0, the data is collected on the first transition edge.
The level of CPOL determines the idle state level of the serial synchronization clock. CPOL = 0 is low level.
As can be seen from the figure, data begins to be transmitted when the first falling edge of SCLK begins. 8 bits of data are transmitted in one clock cycle. SPI0 is used to transmit bit by bit, with the high bit in front and the low bit in the back.
】Open SPI interface
PS: If you are using the Bullseye branch system, you need to change "apt-get" to "apt". The Bullseye branch system only supports Python3.
Open the Raspberry Pi terminal and enter the following commands to enter the configuration interface
sudo raspi-config Select Interfacing Options -> SPI -> Yes to enable the SPI interface
sudo reboot
#Open the Raspberry Pi terminal and run the following commands
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz
tar zxvf bcm2835-1.71.tar.gz
cd bcm2835-1.71/
sudo ./configure && sudo make && sudo make check && sudo make install
# For more information, please refer to the official website: http://www.airspayce.com/mikem/bcm2835/
#Open the Raspberry Pi terminal and run the following commands
cd
sudo apt-get install wiringpi
#For Raspberry Pi systems after May 2019 (you don’t need to execute it if it is earlier than before), you may need to upgrade:
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
gpio -v
# Run gpio -v and version 2.52 will appear. If it does not appear, there is an installation error.
#Bullseye branch system uses the following command:
git clone https://github.com/WiringPi/WiringPi
cd WiringPi
./build
gpio -v
# Run gpio -v and version 2.70 will appear. If it does not appear, there is an installation error.
#Open the Raspberry Pi terminal and run the following commands wget https://github.com/joan2937/lg/archive/master.zip unzip master.zip cd lg-master sudo make install # For more information, please refer to the official website: https://github.com/gpiozero/lg
#python2
sudo apt-get update
sudo apt-get install python-pip
sudo apt-get install python-pil
sudo apt-get install python-numpy
sudo pip install RPi.GPIO
sudo pip install spidev
#python3
sudo apt-get update
sudo apt-get install python3-pip
sudo apt-get install python3-pil
sudo apt-get install python3-numpy
sudo pip3 install RPi.GPIO
sudo pip3 install spidev
sudo apt-get install unzip -y
sudo wget https://www.waveshare.net/w/upload/6/6b/LCD_1.83_Code.zip
sudo unzip ./LCD_1.83_Code.zip
cd LCD_1.83_Code/RaspberryPi/
cdc
sudo make clean
sudo make -j
sudo ./main screen size
#0.85inch LCD Module
sudo ./main 0.85
#0.96inch LCD Module
sudo ./main 0.96
#1.14inch LCD Module
sudo ./main 1.14
#1.28inch LCD Module
sudo ./main 1.28
#1.3inch LCD Module
sudo ./main 1.3
#1.47inch LCD Module
sudo ./main 1.47
#1.5inch LCD Module
sudo ./main 1.5
#1.54inch LCD Module
sudo ./main 1.54
#1.8inch LCD Module
sudo ./main 1.8
#1.83inch LCD Module
sudo ./main 1.83
#2inch LCD Module
sudo ./main 2
#2.4inch LCD Module
sudo ./main 2.4
cd python/examples
ls -l
#python2
sudo python 0inch85_LCD_test.py
sudo python 0inch96_LCD_test.py
sudo python 1inch14_LCD_test.py
sudo python 1inch28_LCD_test.py
sudo python 1inch3_LCD_test.py
sudo python 1inch47_LCD_test.py
sudo python 1inch5_LCD_test.py
sudo python 1inch54_LCD_test.py
sudo python 1inch8_LCD_test.py
sudo python 1inch83_LCD_test.py
sudo python 2inch_LCD_test.py
sudo python 2inch4_LCD_test.py
#python3
sudo python3 0inch85_LCD_test.py
sudo python3 0inch96_LCD_test.py
sudo python3 1inch14_LCD_test.py
sudo python3 1inch28_LCD_test.py
sudo python3 1inch3_LCD_test.py
sudo python3 1inch47_LCD_test.py
sudo python3 1inch5_LCD_test.py
sudo python3 1inch54_LCD_test.py
sudo python3 1inch8_LCD_test.py
sudo python3 1inch83_LCD_test.py
sudo python3 2inch_LCD_test.py
sudo python3 2inch4_LCD_test.py
C language uses 3 ways to drive: BCM2835 library, WiringPi library and Dev library
By default, the Dev library is used for operation. If you need to use BCM2835 or WiringPi to drive, you can open RaspberryPi\c\Makefile and modify lines 13-15 as follows:
#define UBYTE uint8_t
#define UWORD uint16_t
#define UDOUBLE uint32_t
void DEV_Module_Init(void);
void DEV_Module_Exit(void);
Notice:
1. Here are some GPIO processing before and after using the LCD screen.
void DEV_Digital_Write(UWORD Pin, UBYTE Value);
UBYTE DEV_Digital_Read(UWORD Pin);
void DEV_SPI_WriteByte(UBYTE Value);
void Paint_NewImage(UBYTE *image, UWORD Width, UWORD Height, UWORD Rotate, UWORD Color)
parameter:
image: The name of the image cache, which is actually a pointer to the first address of the image cache;
Width: the width of the image cache;
Height: the height of the image cache;
Rotate: The angle of rotation of the image
Color: the initial color of the image;
void Paint_SelectImage(UBYTE *image)
parameter:
image: The name of the image cache, which is actually a pointer to the first address of the image cache;
void Paint_SetRotate(UWORD Rotate)
parameter:
Rotate: Image selection angle, you can choose ROTATE_0, ROTATE_90, ROTATE_180, ROTATE_270 corresponding to 0, 90, 180, 270 degrees respectively.
void Paint_SetMirroring(UBYTE mirror)
parameter:
mirror: The mirroring method of the image. You can choose MIRROR_NONE, MIRROR_HORIZONTAL, MIRROR_VERTICAL, and MIRROR_ORIGIN, which correspond to no mirroring, horizontal mirroring, vertical mirroring, and image center mirroring respectively.
void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
parameter:
Xpoint: point X position in the image cache
Ypoint: The Y position of the point in the image cache
Color: The color of the point display
void Paint_Clear(UWORD Color)
parameter:
Color: fill color
void Paint_ClearWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color)
parameter:
Xstart: X starting point coordinate of the window
Ystart: Y starting point coordinate of the window
Xend: X end coordinate of the window
Yend: Y end coordinate of the window
Color: fill color
void Paint_DrawPoint(UWORD Xpoint, UWORD Ypoint, UWORD Color, DOT_PIXEL Dot_Pixel, DOT_STYLE Dot_Style)
parameter:
Xpoint: X coordinate of point
Ypoint: Y coordinate of the point
Color: fill color
Dot_Pixel: Dot size, providing 8 default dot sizes.
typedef enum {
DOT_PIXEL_1X1 = 1, // 1 x 1
DOT_PIXEL_2X2 , // 2 X 2
DOT_PIXEL_3X3 , // 3 X 3
DOT_PIXEL_4X4 , // 4 X 4
DOT_PIXEL_5X5 , // 5 X 5
DOT_PIXEL_6X6 , // 6 X 6
DOT_PIXEL_7X7 , // 7 X 7
DOT_PIXEL_8X8 , // 8 X 8
} DOT_PIXEL;
Dot_Style: The style of the dot, whether the size expansion method is to expand with the dot as the center or with the dot as the lower left corner and expand to the upper right
typedef enum {
DOT_FILL_AROUND = 1,
DOT_FILL_RIGHTUP,
} DOT_STYLE;
void Paint_DrawLine(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, LINE_STYLE Line_Style, LINE_STYLE Line_Style)
parameter:
Xstart: X starting point coordinate of the line
Ystart: Y start coordinate of the line
Xend: X end coordinate of the line
Yend: Y end coordinate of the line
Color: fill color
Line_width: The width of the line, providing 8 default widths
typedef enum {
DOT_PIXEL_1X1 = 1, // 1 x 1
DOT_PIXEL_2X2 , // 2 X 2
DOT_PIXEL_3X3 , // 3 X 3
DOT_PIXEL_4X4 , // 4 X 4
DOT_PIXEL_5X5 , // 5 X 5
DOT_PIXEL_6X6 , // 6 X 6
DOT_PIXEL_7X7 , // 7 X 7
DOT_PIXEL_8X8 , // 8 X 8
} DOT_PIXEL;
Line_Style: Line style, select whether the lines are connected with straight lines or dotted lines.
typedef enum {
LINE_STYLE_SOLID = 0,
LINE_STYLE_DOTTED,
} LINE_STYLE;
void Paint_DrawRectangle(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
parameter:
Xstart: X starting point coordinate of the rectangle
Ystart: Y starting point coordinate of the rectangle
Xend: X end coordinate of the rectangle
Yend: Y end coordinate of the rectangle
Color: fill color
Line_width: The width of the four sides of the rectangle, providing 8 default widths
typedef enum {
DOT_PIXEL_1X1 = 1, // 1 x 1
DOT_PIXEL_2X2 , // 2 X 2
DOT_PIXEL_3X3 , // 3 X 3
DOT_PIXEL_4X4 , // 4 X 4
DOT_PIXEL_5X5 , // 5 X 5
DOT_PIXEL_6X6 , // 6 X 6
DOT_PIXEL_7X7 , // 7 X 7
DOT_PIXEL_8X8 , // 8 X 8
} DOT_PIXEL;
Draw_Fill: Fill, whether to fill the inside of the rectangle
typedef enum {
DRAW_FILL_EMPTY = 0,
DRAW_FILL_FULL,
} DRAW_FILL;
void Paint_DrawCircle(UWORD X_Center, UWORD Y_Center, UWORD Radius, UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
parameter:
X_Center: X coordinate of the center of the circle
Y_Center: Y coordinate of the center of the circle
Radius: the radius of the circle
Color: fill color
Line_width: The width of the arc, providing 8 default widths
typedef enum {
DOT_PIXEL_1X1 = 1, // 1 x 1
DOT_PIXEL_2X2 , // 2 X 2
DOT_PIXEL_3X3 , // 3 X 3
DOT_PIXEL_4X4 , // 4 X 4
DOT_PIXEL_5X5 , // 5 X 5
DOT_PIXEL_6X6 , // 6 X 6
DOT_PIXEL_7X7 , // 7 X 7
DOT_PIXEL_8X8 , // 8 X 8
} DOT_PIXEL;
Draw_Fill: Fill, whether to fill the inside of the circle
typedef enum {
DRAW_FILL_EMPTY = 0,
DRAW_FILL_FULL,
} DRAW_FILL;
void Paint_DrawChar(UWORD Xstart, UWORD Ystart, const char Ascii_Char, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
Ascii_Char: Ascii character
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
void Paint_DrawString_EN(UWORD Xstart, UWORD Ystart, const char * pString, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
pString: string, string is a pointer
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char * pString, cFONT* font, UWORD Color_Foreground, UWORD Color_Background)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
pString: string, string is a pointer
Font: GB2312 encoded character font library, the following fonts are provided in the Fonts folder:
font12CN: ascii character font 11*21, Chinese font 16*21
font24CN: ascii character font 24*41, Chinese font 32*41
Color_Foreground: font color
Color_Background: background color
void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, int32_t Number, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
Number: The displayed number is saved as a 32-bit int type, which can be displayed up to 2147483647.
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
void Paint_DrawFloatNum(UWORD Xpoint, UWORD Ypoint, double Number, UBYTE Decimal_Point, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background);
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
Number: The displayed number. Double type storage is used here, which is enough for common needs.
Decimal_Point: Displays the number of digits after the decimal point
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME *pTime, sFONT* Font, UWORD Color_Background, UWORD Color_Foreground)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
pTime: The displayed time. A time structure is defined here. Just pass the digits of hours, minutes and seconds to the parameters;
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
UBYTE GUI_ReadBmp(const char *path, UWORD Xstart, UWORD Ystart)
parameter:
path: relative path of BMP image
Xstart: X coordinate of the left vertex of the image, generally passed as 0 by default
Ystart: Y coordinate of the left vertex of the image, generally passed as 0 by default
def module_init()
def module_exit()
Notice:
1. Here are some GPIO treatments before and after using the LCD screen.
2. The module_init() function will be automatically called in the init() initialization program of the LCD screen, but module_exit() needs to be called by itself.
def digital_write(pin, value)
def digital_read(pin)
def spi_writebyte(data)
sudo python 0inch96_LCD_test.py
sudo python3 0inch96_LCD_test.py
im_r= image1.rotate(270)
sudo apt-get install python3-pil installation library
from PIL import Image,ImageDraw,ImageFont
image1 = Image.new("RGB", (disp.width, disp.height), "WHITE")
draw = ImageDraw.Draw(image1)
draw.line([(20, 10),(70, 60)], fill = "RED",width = 1)
draw.rectangle([(20,10),(70,60)],fill = "WHITE",outline="BLUE")
draw.arc((150,15,190,55),0, 360, fill =(0,255,0))
draw.ellipse((150,65,190,105), fill = (0,255,0))
Font1 = ImageFont.truetype("../Font/Font01.ttf",25)
Font2 = ImageFont.truetype("../Font/Font01.ttf",35)
Font3 = ImageFont.truetype("../Font/Font02.ttf",32)
draw.text((40, 50), 'WaveShare', fill = (128,255,128),font=Font2)
text= u"Weixue Electronics"
draw.text((74, 150),text, fill = "WHITE",font=Font3)
image = Image.open('../pic/LCD_1inch28.jpg')
#define UBYTE uint8_t
#define UWORD uint16_t
#define UDOUBLE uint32_t
void DEV_Module_Init(void);
void DEV_Module_Exit(void);
Notice:
1. Here is the processing of some GPIO before and after using the LCD screen;
2. After using the DEV_Module_Exit function, the LCD display will be turned off;
void DEV_Digital_Write(UWORD Pin, UBYTE Value);
UBYTE DEV_Digital_Read(UWORD Pin);
void DEV_SPI_WRITE(UBYTE _dat);
void Paint_NewImage(UWORD Width, UWORD Height, UWORD Rotate, UWORD Color);
parameter:
Width: the width of the image cache;
Height: the height of the image cache;
Rotate: The angle of rotation of the image
Color: the initial color of the image;
void Paint_SetClearFuntion(void (*Clear)(UWORD));
parameter:
Clear: Pointer to the screen clear function, used to quickly clear the screen to a certain color;
void Paint_SetDisplayFuntion(void (*Display)(UWORD,UWORD,UWORD));
parameter:
Display: Pointer to the picture pixel function, used to write data to the specified location in the LCD's internal RAM;
void Paint_SelectImage(UBYTE *image)
parameter:
image: The name of the image cache, which is actually a pointer to the first address of the image cache;
void Paint_SetRotate(UWORD Rotate)
parameter:
Rotate: Image selection angle, you can choose ROTATE_0, ROTATE_90, ROTATE_180, ROTATE_270 corresponding to 0, 90, 180, 270 degrees respectively.
void Paint_SetMirroring(UBYTE mirror)
parameter:
mirror: The mirroring method of the image. You can choose MIRROR_NONE, MIRROR_HORIZONTAL, MIRROR_VERTICAL, and MIRROR_ORIGIN, which correspond to no mirroring, horizontal mirroring, vertical mirroring, and image center mirroring respectively.
void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
parameter:
Xpoint: point X position in the image cache
Ypoint: The Y position of the point in the image cache
Color: The color of the point display
void Paint_Clear(UWORD Color)
parameter:
Color: fill color
void Paint_ClearWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color)
parameter:
Xstart: X starting point coordinate of the window
Ystart: Y starting point coordinate of the window
Xend: X end coordinate of the window
Yend: Y end coordinate of the window
Color: fill color
void Paint_DrawPoint(UWORD Xpoint, UWORD Ypoint, UWORD Color, DOT_PIXEL Dot_Pixel, DOT_STYLE Dot_Style)
parameter:
Xpoint: X coordinate of point
Ypoint: Y coordinate of the point
Color: fill color
Dot_Pixel: Dot size, providing 8 default dot sizes.
typedef enum {
DOT_PIXEL_1X1 = 1, // 1 x 1
DOT_PIXEL_2X2 , // 2 X 2
DOT_PIXEL_3X3 , // 3 X 3
DOT_PIXEL_4X4 , // 4 X 4
DOT_PIXEL_5X5 , // 5 X 5
DOT_PIXEL_6X6 , // 6 X 6
DOT_PIXEL_7X7 , // 7 X 7
DOT_PIXEL_8X8 , // 8 X 8
} DOT_PIXEL;
Dot_Style: The style of the dot, whether the size expansion method is to expand with the dot as the center or with the dot as the lower left corner and expand to the upper right
typedef enum {
DOT_FILL_AROUND = 1,
DOT_FILL_RIGHTUP,
} DOT_STYLE;
void Paint_DrawLine(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, LINE_STYLE Line_Style, LINE_STYLE Line_Style)
parameter:
Xstart: X starting point coordinate of the line
Ystart: Y start coordinate of the line
Xend: X end coordinate of the line
Yend: Y end coordinate of the line
Color: fill color
Line_width: The width of the line, providing 8 default widths
typedef enum {
DOT_PIXEL_1X1 = 1, // 1 x 1
DOT_PIXEL_2X2 , // 2 X 2
DOT_PIXEL_3X3 , // 3 X 3
DOT_PIXEL_4X4 , // 4 X 4
DOT_PIXEL_5X5 , // 5 X 5
DOT_PIXEL_6X6 , // 6 X 6
DOT_PIXEL_7X7 , // 7 X 7
DOT_PIXEL_8X8 , // 8 X 8
} DOT_PIXEL;
Line_Style: Line style, select whether the lines are connected with straight lines or dotted lines.
typedef enum {
LINE_STYLE_SOLID = 0,
LINE_STYLE_DOTTED,
} LINE_STYLE;
void Paint_DrawRectangle(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
parameter:
Xstart: X starting point coordinate of the rectangle
Ystart: Y starting point coordinate of the rectangle
Xend: X end coordinate of the rectangle
Yend: Y end coordinate of the rectangle
Color: fill color
Line_width: The width of the four sides of the rectangle, providing 8 default widths
typedef enum {
DOT_PIXEL_1X1 = 1, // 1 x 1
DOT_PIXEL_2X2 , // 2 X 2
DOT_PIXEL_3X3 , // 3 X 3
DOT_PIXEL_4X4 , // 4 X 4
DOT_PIXEL_5X5 , // 5 X 5
DOT_PIXEL_6X6 , // 6 X 6
DOT_PIXEL_7X7 , // 7 X 7
DOT_PIXEL_8X8 , // 8 X 8
} DOT_PIXEL;
Draw_Fill: Fill, whether to fill the inside of the rectangle
typedef enum {
DRAW_FILL_EMPTY = 0,
DRAW_FILL_FULL,
} DRAW_FILL;
void Paint_DrawCircle(UWORD X_Center, UWORD Y_Center, UWORD Radius, UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
parameter:
X_Center: X coordinate of the center of the circle
Y_Center: Y coordinate of the center of the circle
Radius: the radius of the circle
Color: fill color
Line_width: The width of the arc, providing 8 default widths
typedef enum {
DOT_PIXEL_1X1 = 1, // 1 x 1
DOT_PIXEL_2X2 , // 2 X 2
DOT_PIXEL_3X3 , // 3 X 3
DOT_PIXEL_4X4 , // 4 X 4
DOT_PIXEL_5X5 , // 5 X 5
DOT_PIXEL_6X6 , // 6 X 6
DOT_PIXEL_7X7 , // 7 X 7
DOT_PIXEL_8X8 , // 8 X 8
} DOT_PIXEL;
Draw_Fill: Fill, whether to fill the inside of the circle
typedef enum {
DRAW_FILL_EMPTY = 0,
DRAW_FILL_FULL,
} DRAW_FILL;
void Paint_DrawChar(UWORD Xstart, UWORD Ystart, const char Ascii_Char, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
Ascii_Char: Ascii character
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
void Paint_DrawString_EN(UWORD Xstart, UWORD Ystart, const char * pString, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
pString: string, string is a pointer
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char * pString, cFONT* font, UWORD Color_Foreground, UWORD Color_Background)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
pString: string, string is a pointer
Font: GB2312 encoded character font library, the following fonts are provided in the Fonts folder:
font12CN: ascii character font 11*21, Chinese font 16*21
font24CN: ascii character font 24*41, Chinese font 32*41
Color_Foreground: font color
Color_Background: background color
void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, int32_t Number, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
Number: The displayed number is saved as a 32-bit int type, which can be displayed up to 2147483647.
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
void Paint_DrawFloatNum(UWORD Xpoint, UWORD Ypoint, double Number, UBYTE Decimal_Point, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background);
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
Number: The displayed number. Double type storage is used here, which is enough for common needs.
Decimal_Point: Displays the number of digits after the decimal point
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME *pTime, sFONT* Font, UWORD Color_Background, UWORD Color_Foreground)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
pTime: The displayed time. A time structure is defined here. Just pass the digits of hours, minutes and seconds to the parameters;
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
void DEV_Digital_Write(int pin, int value)
int DEV_Digital_Read(int pin)
DEV_Delay_ms(unsigned int delaytime)
DEV_SPI_WRITE(unsigned char data)
void Paint_NewImage(UWORD Width, UWORD Height, UWORD Rotate, UWORD Color);
parameter:
Width: the width of the image cache;
Height: the height of the image cache;
Rotate: The angle of rotation of the image
Color: the initial color of the image;
void Paint_SetClearFuntion(void (*Clear)(UWORD));
parameter:
Clear: Pointer to the screen clear function, used to quickly clear the screen to a certain color;
void Paint_SetDisplayFuntion(void (*Display)(UWORD,UWORD,UWORD));
parameter:
Display: Pointer to the picture pixel function, used to write data to the specified location in the LCD's internal RAM;
void Paint_SelectImage(UBYTE *image)
parameter:
image: The name of the image cache, which is actually a pointer to the first address of the image cache;
void Paint_SetRotate(UWORD Rotate)
parameter:
Rotate: Image selection angle, you can choose ROTATE_0, ROTATE_90, ROTATE_180, ROTATE_270 corresponding to 0, 90, 180, 270 degrees respectively.
void Paint_SetMirroring(UBYTE mirror)
parameter:
mirror: The mirroring method of the image. You can choose MIRROR_NONE, MIRROR_HORIZONTAL, MIRROR_VERTICAL, and MIRROR_ORIGIN, which correspond to no mirroring, horizontal mirroring, vertical mirroring, and image center mirroring respectively.
void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
parameter:
Xpoint: point X position in the image cache
Ypoint: The Y position of the point in the image cache
Color: The color of the point display
void Paint_Clear(UWORD Color)
parameter:
Color: fill color
void Paint_ClearWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color)
parameter:
Xstart: X starting point coordinate of the window
Ystart: Y starting point coordinate of the window
Xend: X end coordinate of the window
Yend: Y end coordinate of the window
Color: fill color
void Paint_DrawPoint(UWORD Xpoint, UWORD Ypoint, UWORD Color, DOT_PIXEL Dot_Pixel, DOT_STYLE Dot_Style)
parameter:
Xpoint: X coordinate of point
Ypoint: Y coordinate of the point
Color: fill color
Dot_Pixel: Dot size, providing 8 default dot sizes.
typedef enum {
DOT_PIXEL_1X1 = 1, // 1 x 1
DOT_PIXEL_2X2 , // 2 X 2
DOT_PIXEL_3X3 , // 3 X 3
DOT_PIXEL_4X4 , // 4 X 4
DOT_PIXEL_5X5 , // 5 X 5
DOT_PIXEL_6X6 , // 6 X 6
DOT_PIXEL_7X7 , // 7 X 7
DOT_PIXEL_8X8 , // 8 X 8
} DOT_PIXEL;
Dot_Style: The style of the dot, whether the size expansion method is to expand with the dot as the center or with the dot as the lower left corner and expand to the upper right
typedef enum {
DOT_FILL_AROUND = 1,
DOT_FILL_RIGHTUP,
} DOT_STYLE;
void Paint_DrawLine(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, LINE_STYLE Line_Style, LINE_STYLE Line_Style)
parameter:
Xstart: X starting point coordinate of the line
Ystart: Y start coordinate of the line
Xend: X end coordinate of the line
Yend: Y end coordinate of the line
Color: fill color
Line_width: The width of the line, providing 8 default widths
typedef enum {
DOT_PIXEL_1X1 = 1, // 1 x 1
DOT_PIXEL_2X2 , // 2 X 2
DOT_PIXEL_3X3 , // 3 X 3
DOT_PIXEL_4X4 , // 4 X 4
DOT_PIXEL_5X5 , // 5 X 5
DOT_PIXEL_6X6 , // 6 X 6
DOT_PIXEL_7X7 , // 7 X 7
DOT_PIXEL_8X8 , // 8 X 8
} DOT_PIXEL;
Line_Style: Line style, select whether the lines are connected with straight lines or dotted lines.
typedef enum {
LINE_STYLE_SOLID = 0,
LINE_STYLE_DOTTED,
} LINE_STYLE;
void Paint_DrawRectangle(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
parameter:
Xstart: X starting point coordinate of the rectangle
Ystart: Y starting point coordinate of the rectangle
Xend: X end coordinate of the rectangle
Yend: Y end coordinate of the rectangle
Color: fill color
Line_width: The width of the four sides of the rectangle, providing 8 default widths
typedef enum {
DOT_PIXEL_1X1 = 1, // 1 x 1
DOT_PIXEL_2X2 , // 2 X 2
DOT_PIXEL_3X3 , // 3 X 3
DOT_PIXEL_4X4 , // 4 X 4
DOT_PIXEL_5X5 , // 5 X 5
DOT_PIXEL_6X6 , // 6 X 6
DOT_PIXEL_7X7 , // 7 X 7
DOT_PIXEL_8X8 , // 8 X 8
} DOT_PIXEL;
Draw_Fill: Fill, whether to fill the inside of the rectangle
typedef enum {
DRAW_FILL_EMPTY = 0,
DRAW_FILL_FULL,
} DRAW_FILL;
void Paint_DrawCircle(UWORD X_Center, UWORD Y_Center, UWORD Radius, UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
parameter:
X_Center: X coordinate of the center of the circle
Y_Center: Y coordinate of the center of the circle
Radius: the radius of the circle
Color: fill color
Line_width: The width of the arc, providing 8 default widths
typedef enum {
DOT_PIXEL_1X1 = 1, // 1 x 1
DOT_PIXEL_2X2 , // 2 X 2
DOT_PIXEL_3X3 , // 3 X 3
DOT_PIXEL_4X4 , // 4 X 4
DOT_PIXEL_5X5 , // 5 X 5
DOT_PIXEL_6X6 , // 6 X 6
DOT_PIXEL_7X7 , // 7 X 7
DOT_PIXEL_8X8 , // 8 X 8
} DOT_PIXEL;
Draw_Fill: Fill, whether to fill the inside of the circle
typedef enum {
DRAW_FILL_EMPTY = 0,
DRAW_FILL_FULL,
} DRAW_FILL;
void Paint_DrawChar(UWORD Xstart, UWORD Ystart, const char Ascii_Char, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
Ascii_Char: Ascii character
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
void Paint_DrawString_EN(UWORD Xstart, UWORD Ystart, const char * pString, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
pString: string, string is a pointer
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char * pString, cFONT* font, UWORD Color_Foreground, UWORD Color_Background)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
pString: string, string is a pointer
Font: GB2312 encoded character font library, the following fonts are provided in the Fonts folder:
font12CN: ascii character font 11*21, Chinese font 16*21
font24CN: ascii character font 24*41, Chinese font 32*41
Color_Foreground: font color
Color_Background: background color
void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, int32_t Number, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
Number: The displayed number is saved as a 32-bit int type, which can be displayed up to 2147483647.
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
void Paint_DrawFloatNum(UWORD Xpoint, UWORD Ypoint, double Number, UBYTE Decimal_Point, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background);
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
Number: The number displayed, here it is saved in double type.
Decimal_Point: Displays the number of digits after the decimal point
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME *pTime, sFONT* Font, UWORD Color_Background, UWORD Color_Foreground)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
pTime: The displayed time. A time structure is defined here. Just pass the digits of hours, minutes and seconds to the parameters;
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
void Paint_DrawImage(const unsigned char *image, UWORD xStart, UWORD yStart, UWORD W_Image, UWORD H_Image)
parameter:
image: image address, pointing to the image information you want to display
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
W_Image: image width
H_Image: image height
cd Pico/c
sudo nano main.c
mkdir build
cd build
export PICO_SDK_PATH=../../pico-sdk
cmake..
make -j
cp main.uf2 /media/pi/RPI-RP2/
#define UBYTE uint8_t
#define UWORD uint16_t
#define UDOUBLE uint32_t
void DEV_Module_Init(void);
void DEV_Module_Exit(void);
Notice:
1. Here are some GPIO processing before and after using the LCD screen.
void DEV_Digital_Write(UWORD Pin, UBYTE Value);
UBYTE DEV_Digital_Read(UWORD Pin);
void DEV_SPI_WriteByte(UBYTE Value);
void Paint_NewImage(UWORD *image, UWORD Width, UWORD Height, UWORD Rotate, UWORD Color)
parameter:
image: The name of the image cache, which is actually a pointer to the first address of the image cache;
Width: the width of the image cache;
Height: the height of the image cache;
Rotate: The angle of rotation of the image
Color: the initial color of the image;
void Paint_SelectImage(UBYTE *image)
parameter:
image: The name of the image cache, which is actually a pointer to the first address of the image cache;
void Paint_SetRotate(UWORD Rotate)
parameter:
Rotate: Image selection angle, you can choose ROTATE_0, ROTATE_90, ROTATE_180, ROTATE_270 corresponding to 0, 90, 180, 270 degrees respectively.
void Paint_SetMirroring(UBYTE mirror)
parameter:
mirror: The mirroring method of the image. You can choose MIRROR_NONE, MIRROR_HORIZONTAL, MIRROR_VERTICAL, and MIRROR_ORIGIN, which correspond to no mirroring, horizontal mirroring, vertical mirroring, and image center mirroring respectively.
void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
parameter:
Xpoint: point X position in the image cache
Ypoint: The Y position of the point in the image cache
Color: The color of the point display
void Paint_Clear(UWORD Color)
parameter:
Color: fill color
void Paint_ClearWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color)
parameter:
Xstart: X starting point coordinate of the window
Ystart: Y starting point coordinate of the window
Xend: X end coordinate of the window
Yend: Y end coordinate of the window
Color: fill color
void Paint_DrawPoint(UWORD Xpoint, UWORD Ypoint, UWORD Color, DOT_PIXEL Dot_Pixel, DOT_STYLE Dot_Style)
parameter:
Xpoint: X coordinate of point
Ypoint: Y coordinate of the point
Color: fill color
Dot_Pixel: Dot size, providing 8 default dot sizes.
typedef enum {
DOT_PIXEL_1X1 = 1, // 1 x 1
DOT_PIXEL_2X2 , // 2 X 2
DOT_PIXEL_3X3 , // 3 X 3
DOT_PIXEL_4X4 , // 4 X 4
DOT_PIXEL_5X5 , // 5 X 5
DOT_PIXEL_6X6 , // 6 X 6
DOT_PIXEL_7X7 , // 7 X 7
DOT_PIXEL_8X8 , // 8 X 8
} DOT_PIXEL;
Dot_Style: The style of the dot, whether the size expansion method is to expand with the dot as the center or with the dot as the lower left corner and expand to the upper right
typedef enum {
DOT_FILL_AROUND = 1,
DOT_FILL_RIGHTUP,
} DOT_STYLE;
void Paint_DrawLine(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, LINE_STYLE Line_Style, LINE_STYLE Line_Style)
parameter:
Xstart: X starting point coordinate of the line
Ystart: Y start coordinate of the line
Xend: X end coordinate of the line
Yend: Y end coordinate of the line
Color: fill color
Line_width: The width of the line, providing 8 default widths
typedef enum {
DOT_PIXEL_1X1 = 1, // 1 x 1
DOT_PIXEL_2X2 , // 2 X 2
DOT_PIXEL_3X3 , // 3 X 3
DOT_PIXEL_4X4 , // 4 X 4
DOT_PIXEL_5X5 , // 5 X 5
DOT_PIXEL_6X6 , // 6 X 6
DOT_PIXEL_7X7 , // 7 X 7
DOT_PIXEL_8X8 , // 8 X 8
} DOT_PIXEL;
Line_Style: Line style, select whether the lines are connected with straight lines or dotted lines.
typedef enum {
LINE_STYLE_SOLID = 0,
LINE_STYLE_DOTTED,
} LINE_STYLE;
void Paint_DrawRectangle(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
parameter:
Xstart: X starting point coordinate of the rectangle
Ystart: Y starting point coordinate of the rectangle
Xend: X end coordinate of the rectangle
Yend: Y end coordinate of the rectangle
Color: fill color
Line_width: The width of the four sides of the rectangle, providing 8 default widths
typedef enum {
DOT_PIXEL_1X1 = 1, // 1 x 1
DOT_PIXEL_2X2 , // 2 X 2
DOT_PIXEL_3X3 , // 3 X 3
DOT_PIXEL_4X4 , // 4 X 4
DOT_PIXEL_5X5 , // 5 X 5
DOT_PIXEL_6X6 , // 6 X 6
DOT_PIXEL_7X7 , // 7 X 7
DOT_PIXEL_8X8 , // 8 X 8
} DOT_PIXEL;
Draw_Fill: Fill, whether to fill the inside of the rectangle
typedef enum {
DRAW_FILL_EMPTY = 0,
DRAW_FILL_FULL,
} DRAW_FILL;
void Paint_DrawCircle(UWORD X_Center, UWORD Y_Center, UWORD Radius, UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
parameter:
X_Center: X coordinate of the center of the circle
Y_Center: Y coordinate of the center of the circle
Radius: the radius of the circle
Color: fill color
Line_width: The width of the arc, providing 8 default widths
typedef enum {
DOT_PIXEL_1X1 = 1, // 1 x 1
DOT_PIXEL_2X2 , // 2 X 2
DOT_PIXEL_3X3 , // 3 X 3
DOT_PIXEL_4X4 , // 4 X 4
DOT_PIXEL_5X5 , // 5 X 5
DOT_PIXEL_6X6 , // 6 X 6
DOT_PIXEL_7X7 , // 7 X 7
DOT_PIXEL_8X8 , // 8 X 8
} DOT_PIXEL;
Draw_Fill: Fill, whether to fill the inside of the circle
typedef enum {
DRAW_FILL_EMPTY = 0,
DRAW_FILL_FULL,
} DRAW_FILL;
void Paint_DrawChar(UWORD Xstart, UWORD Ystart, const char Ascii_Char, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
Ascii_Char: Ascii character
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
void Paint_DrawString_EN(UWORD Xstart, UWORD Ystart, const char * pString, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
pString: string, string is a pointer
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char * pString, cFONT* font, UWORD Color_Foreground, UWORD Color_Background)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
pString: string, string is a pointer
Font: GB2312 encoded character font library, the following fonts are provided in the Fonts folder:
font12CN: ascii character font 11*21, Chinese font 16*21
font24CN: ascii character font 24*41, Chinese font 32*41
Color_Foreground: font color
Color_Background: background color
void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, double Number, sFONT* Font, UWORD Digit,UWORD Color_Foreground, UWORD Color_Background);
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
Number: The displayed number is saved as a 32-bit int type, which can be displayed up to 2147483647.
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Digit: Display the number of decimal places
Color_Foreground: font color
Color_Background: background color
void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME *pTime, sFONT* Font, UWORD Color_Background, UWORD Color_Foreground)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
pTime: The displayed time. A time structure is defined here. Just pass the digits of hours, minutes and seconds to the parameters;
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
void DEV_Digital_Write(int pin, int value)
int DEV_Digital_Read(int pin)
DEV_Delay_ms(unsigned int delaytime)
DEV_SPI_WRITE(unsigned char data)
void Paint_NewImage(UWORD Width, UWORD Height, UWORD Rotate, UWORD Color);
parameter:
Width: the width of the image cache;
Height: the height of the image cache;
Rotate: The angle of rotation of the image
Color: the initial color of the image;
void Paint_SetClearFuntion(void (*Clear)(UWORD));
parameter:
Clear: Pointer to the screen clear function, used to quickly clear the screen to a certain color;
void Paint_SetDisplayFuntion(void (*Display)(UWORD,UWORD,UWORD));
parameter:
Display: Pointer to the picture pixel function, used to write data to the specified location in the LCD's internal RAM;
void Paint_SelectImage(UBYTE *image)
parameter:
image: The name of the image cache, which is actually a pointer to the first address of the image cache;
void Paint_SetRotate(UWORD Rotate)
parameter:
Rotate: Image selection angle, you can choose ROTATE_0, ROTATE_90, ROTATE_180, ROTATE_270 corresponding to 0, 90, 180, 270 degrees respectively.
void Paint_SetMirroring(UBYTE mirror)
parameter:
mirror: The mirroring method of the image. You can choose MIRROR_NONE, MIRROR_HORIZONTAL, MIRROR_VERTICAL, and MIRROR_ORIGIN, which correspond to no mirroring, horizontal mirroring, vertical mirroring, and image center mirroring respectively.
void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
parameter:
Xpoint: point X position in the image cache
Ypoint: The Y position of the point in the image cache
Color: The color of the point display
void Paint_Clear(UWORD Color)
parameter:
Color: fill color
void Paint_ClearWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color)
parameter:
Xstart: X starting point coordinate of the window
Ystart: Y starting point coordinate of the window
Xend: X end coordinate of the window
Yend: Y end coordinate of the window
Color: fill color
void Paint_DrawPoint(UWORD Xpoint, UWORD Ypoint, UWORD Color, DOT_PIXEL Dot_Pixel, DOT_STYLE Dot_Style)
parameter:
Xpoint: X coordinate of point
Ypoint: Y coordinate of the point
Color: fill color
Dot_Pixel: Dot size, providing 8 default dot sizes.
typedef enum {
DOT_PIXEL_1X1 = 1, // 1 x 1
DOT_PIXEL_2X2 , // 2 X 2
DOT_PIXEL_3X3 , // 3 X 3
DOT_PIXEL_4X4 , // 4 X 4
DOT_PIXEL_5X5 , // 5 X 5
DOT_PIXEL_6X6 , // 6 X 6
DOT_PIXEL_7X7 , // 7 X 7
DOT_PIXEL_8X8 , // 8 X 8
} DOT_PIXEL;
Dot_Style: The style of the dot, whether the size expansion method is to expand with the dot as the center or with the dot as the lower left corner and expand to the upper right
typedef enum {
DOT_FILL_AROUND = 1,
DOT_FILL_RIGHTUP,
} DOT_STYLE;
void Paint_DrawLine(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, LINE_STYLE Line_Style, LINE_STYLE Line_Style)
parameter:
Xstart: X starting point coordinate of the line
Ystart: Y start coordinate of the line
Xend: X end coordinate of the line
Yend: Y end coordinate of the line
Color: fill color
Line_width: The width of the line, providing 8 default widths
typedef enum {
DOT_PIXEL_1X1 = 1, // 1 x 1
DOT_PIXEL_2X2 , // 2 X 2
DOT_PIXEL_3X3 , // 3 X 3
DOT_PIXEL_4X4 , // 4 X 4
DOT_PIXEL_5X5 , // 5 X 5
DOT_PIXEL_6X6 , // 6 X 6
DOT_PIXEL_7X7 , // 7 X 7
DOT_PIXEL_8X8 , // 8 X 8
} DOT_PIXEL;
Line_Style: Line style, select whether the lines are connected with straight lines or dotted lines.
typedef enum {
LINE_STYLE_SOLID = 0,
LINE_STYLE_DOTTED,
} LINE_STYLE;
void Paint_DrawRectangle(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
parameter:
Xstart: X starting point coordinate of the rectangle
Ystart: Y starting point coordinate of the rectangle
Xend: X end coordinate of the rectangle
Yend: Y end coordinate of the rectangle
Color: fill color
Line_width: The width of the four sides of the rectangle, providing 8 default widths
typedef enum {
DOT_PIXEL_1X1 = 1, // 1 x 1
DOT_PIXEL_2X2 , // 2 X 2
DOT_PIXEL_3X3 , // 3 X 3
DOT_PIXEL_4X4 , // 4 X 4
DOT_PIXEL_5X5 , // 5 X 5
DOT_PIXEL_6X6 , // 6 X 6
DOT_PIXEL_7X7 , // 7 X 7
DOT_PIXEL_8X8 , // 8 X 8
} DOT_PIXEL;
Draw_Fill: Fill, whether to fill the inside of the rectangle
typedef enum {
DRAW_FILL_EMPTY = 0,
DRAW_FILL_FULL,
} DRAW_FILL;
void Paint_DrawCircle(UWORD X_Center, UWORD Y_Center, UWORD Radius, UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
parameter:
X_Center: X coordinate of the center of the circle
Y_Center: Y coordinate of the center of the circle
Radius: the radius of the circle
Color: fill color
Line_width: The width of the arc, providing 8 default widths
typedef enum {
DOT_PIXEL_1X1 = 1, // 1 x 1
DOT_PIXEL_2X2 , // 2 X 2
DOT_PIXEL_3X3 , // 3 X 3
DOT_PIXEL_4X4 , // 4 X 4
DOT_PIXEL_5X5 , // 5 X 5
DOT_PIXEL_6X6 , // 6 X 6
DOT_PIXEL_7X7 , // 7 X 7
DOT_PIXEL_8X8 , // 8 X 8
} DOT_PIXEL;
Draw_Fill: Fill, whether to fill the inside of the circle
typedef enum {
DRAW_FILL_EMPTY = 0,
DRAW_FILL_FULL,
} DRAW_FILL;
void Paint_DrawChar(UWORD Xstart, UWORD Ystart, const char Ascii_Char, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
Ascii_Char: Ascii character
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
void Paint_DrawString_EN(UWORD Xstart, UWORD Ystart, const char * pString, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
pString: string, string is a pointer
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char * pString, cFONT* font, UWORD Color_Foreground, UWORD Color_Background)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
pString: string, string is a pointer
Font: GB2312 encoded character font library, the following fonts are provided in the Fonts folder:
font12CN: ascii character font 11*21, Chinese font 16*21
font24CN: ascii character font 24*41, Chinese font 32*41
Color_Foreground: font color
Color_Background: background color
void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, int32_t Number, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
Number: The displayed number is saved as a 32-bit int type, which can be displayed up to 2147483647.
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
void Paint_DrawFloatNum(UWORD Xpoint, UWORD Ypoint, double Number, UBYTE Decimal_Point, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background);
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
Number: The number displayed, here it is saved in double type.
Decimal_Point: Displays the number of digits after the decimal point
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME *pTime, sFONT* Font, UWORD Color_Background, UWORD Color_Foreground)
parameter:
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
pTime: The displayed time. A time structure is defined here. Just pass the digits of hours, minutes and seconds to the parameters.
Font: Ascii code visual character font library, the following fonts are provided in the Fonts folder:
font8: 5*8 font
font12: 7*12 font
font16: 11*16 font
font20: 14*20 font
font24: 17*24 font
Color_Foreground: font color
Color_Background: background color
void Paint_DrawImage(const unsigned char *image, UWORD xStart, UWORD yStart, UWORD W_Image, UWORD H_Image)
parameter:
image: image address, pointing to the image information you want to display
Xstart: X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
W_Image: image width
H_Image: image height