Download Print this page

Waveshare B08V5538C6 Manual

1.28inch lcd module

Advertisement

Quick Links

1 . 2 8 i n c h L C D M o d u l e
O v e r v i e w
I n t r o d u c t i o n
1 . 2 8 i n c h L C D D i s p l a y M o d u l e , I P S S c r e e n , 6 5 K R G B , 2 4 0 × 2 4 0
R e s o l u t i o n , S P I I n t e r f a c e .
S p e c i f i c a t i o n
O p e r a t i n g v o l t a g e : 3 . 3 V / 5 V
I n t e r f a c e : S P I
L C D t y p e : I P S
C o n t r o l l e r : G C 9 A 0 1
R e s o l u t i o n : 2 4 0 ( H ) R G B x 2 4 0 ( V )
Φ
D i s p l a y s i z e :
P i x e l s i z e : 0 . 1 3 5
D i m e n s i o n : 4 0 . 4 × 3 7 . 5 ( m m )
I n t e r f a c e D e s c r i p t i o n
R a s p b e r r y P i
P l e a s e c o n n e c t t h e L C D t o y o u r R a s p b e r r y P i b y t h e 8 P I N c a b l e a c c o r d i n g t o t h e t a b l e
b e l o w
U s e t h e p i n h e a d e r o r P H 2 . 0 8 P I N i n t e r f a c e , y o u n e e d t o c o n n e c t a c c o r d i n g t o t h e f o l l o w i n g
t a b l e
C o n n e c t t o R a s p b e r r y P i
L C D
V C C
G N D
D I N
C L K
C S
D S
R S T
B L
T h e 1 . 2 8 i n c h L C D u s e s t h e P H 2 . 0 8 P I N i n t e r f a c e , w h i c h c a n b e c o n n e c t e d t o t h e R a s p b e r r y
P i a c c o r d i n g t o t h e a b o v e t a b l e :
c o l o r o f t h e w i r i n g i n t h e p i c t u r e i s f o r r e f e r e n c e o n l y , a n d t h e a c t u a l c o l o r s h a l l p r e v a i l . )
S T M 3 2
T h e e x a m p l e w e p r o v i d e i s b a s e d o n S T M 3 2 F 1 0 3 R B T 6 , a n d t h e c o n n e c t i o n m e t h o d
p r o v i d e d i s a l s o t h e c o r r e s p o n d i n g p i n o f S T M 3 2 F 1 0 3 R B T 6 . I f y o u n e e d t o t r a n s p l a n t t h e
p r o g r a m , p l e a s e c o n n e c t a c c o r d i n g t o t h e a c t u a l p i n .
S T M 3 2 F 1 0 3 Z E T c o n n e c t i o n p i n c o r r e s p o n d e n c e
T a k e t h e
X N U C L E O - F 1 0 3 R B d e v e l o p m e n t b o a r d
e x a m p l e , t h e c o n n e c t i o n i s a s f o l l o w s :
A r d u i n o
A r d u i n o U N O C o n n e c t i o n p i n c o r r e s p o n d e n c e
T h e c o n n e c t i o n d i a g r a m i s a s f o l l o w s ( c l i c k t o e n l a r g e ) :
L C D & C o n t r o l l e r
T h e b u i l t - i n d r i v e r u s e d i n t h i s L C D i s G C 9 A 0 1 , w i t h a r e s o l u t i o n o f 2 4 0 R G B × 2 4 0 d o t s ,
1 2 9 , 6 0 0 b y t e s o f G R A M i n s i d e . T h i s L C D s u p p o r t s 1 2 / 1 6 / 1 8 - b i t d a t a b u s M C U i n t e r f a c e ,
n a m e l y t h e f o r m a t s o f R G B 4 4 4 , R G B 5 6 5 , R G B 6 6 6 , w h i c h a r e c o m m o n l y u s e d .
M o s t o f t h e L C D c o n t r o l l e r s c a n d e b u g t h e i r c o m m u n i c a t i o n w a y s s u c h a s b y 8 0 8 0 p a r a l l e l
i n t e r f a c e s , t h r e e - w i r e S P I , f o u r - w i r e S P I , a n d s o o n . T h i s L C D a d o p t s a f o u r - w i r e S P I
c o m m u n i c a t i o n i n t e r f a c e , w h i c h c a n g r e a t l y s a v e t h e G P I O p o r t , a n d t h e c o m m u n i c a t i o n
s p e e d w i l l b e f a s t e r .
M a y b e y o u h a v e d o u b t s t h a t a s t h e s c r e e n i s c i r c u l a r , w h i c h p o i n t i s t h e f i r s t p i x e l ? H o w
t o d e t e r m i n e t h e c o o r d i n a t e s ?
I n f a c t , y o u c a n p r e s u m e t h a t a s q u a r e s c r e e n d r a w s a n i n s c r i b e d c i r c l e i n i t . W e
o n l y d i s p l a y t h e c o n t e n t i n t h i s i n s c r i b e d c i r c l e , a n d t h e p i x e l s b e s i d e t h e s q u a r e
a r e d e l e t e d . T h e s a m e i s t r u e f o r m o s t o f t h e c i r c u l a r L C D s o n t h e m a r k e t .
C o m m u n i c a t i o n P r o t o c o l
N o t e : D i f f e r e n t f r o m t h e t r a d i t i o n a l S P I p r o t o c o l : t h e d a t a l i n e s e n t f r o m t h e s l a v e t o t h e
h o s t i s h i d d e n a s t h e L C D o n l y n e e d s t o b e d i s p l a y e d . P l e a s e r e f e r t o t h e t a b l e o n
D a t a s h e e t P a g e 1 0 5 .
R E S X : r e s e t , i t i s p u l l e d l o w w h e n t h e m o d u l e i s p o w e r e d o n , a n d i t i s u s u a l l y s e t t o 1 .
C S X : t h e s l a v e c h i p s e l e c t i o n a n d t h e c h i p w i l l b e e n a b l e d o n l y w h e n C S i s l o w .
D / C X : t h e d a t a / c o m m a n d c o n t r o l p i n o f t h e c h i p , w r i t e c o m m a n d w h e n D C = 0 , w r i t e d a t a
w h e n D C = 1
S D A : t h e t r a n s m i t t e d d a t a , t h a t i s , R G B d a t a ;
S C L : t h e S P I c o m m u n i c a t i o n c l o c k .
F o r S P I c o m m u n i c a t i o n , d a t a i s t r a n s m i t t e d w i t h t i m i n g , t h a t i s , t h e c o m b i n a t i o n o f c l o c k
p h a s e ( C P H A ) a n d c l o c k p o l a r i t y ( C P O L ) :
T h e l e v e l o f C P H A d e t e r m i n e s w h e t h e r t h e d a t a o f t h e s e r i a l s y n c h r o n i z a t i o n c l o c k i s
c o l l e c t e d o n t h e f i r s t c l o c k t r a n s i t i o n e d g e o r t h e s e c o n d c l o c k t r a n s i t i o n e d g e . W h e n C P H A
= 0 , d a t a a c q u i s i t i o n i s p e r f o r m e d o n t h e f i r s t t r a n s i t i o n e d g e ;
T h e l e v e l o f C P O L d e t e r m i n e s t h e i d l e s t a t e l e v e l o f t h e s e r i a l s y n c h r o n o u s c l o c k . C P O L = 0 ,
w h i c h i s a l o w l e v e l .
A s c a n b e s e e n f r o m t h e f i g u r e , w h e n t h e f i r s t f a l l i n g e d g e o f S C L K s t a r t s t o t r a n s m i t d a t a ,
8 b i t d a t a i s t r a n s m i t t e d i n o n e c l o c k c y c l e , u s i n g S P I 0 , b i t - b y - b i t t r a n s m i s s i o n , h i g h - o r d e r
f i r s t , a n d l o w - o r d e r a t l a s t .
W o r k i n g w i t h R a s p b e r r y P i
E n a b l e S P I i n t e r f a c e
P S : I f y o u a r e u s i n g t h e s y s t e m o f t h e B u l l s e y e b r a n c h , y o u n e e d t o c h a n g e " a p t - g e t " t o
" a p t " , t h e s y s t e m o f t h e B u l l s e y e b r a n c h o n l y s u p p o r t s P y t h o n 3 .
O p e n t e r m i n a l , u s e c o m m a n d
t o e n t e r t h e c o n f i g u r a t i o n
p a g e
sudo raspi-config
Choose Interfacing Option
s -> SPI -> Yes
e SPI interface
R e b o o t R a s p b e r r y P i
sudo reboot
P l e a s e m a k e s u r e t h e S P I i s n o t
o c c u p i e d b y o t h e r d e v i c e s , y o u
c a n c h e c k i n t h e m i d d l e o f
/ b o o t / c o n f i g . t x t
I n s t a l l L i b r a r i e s
I n s t a l l B C M 2 8 3 5 l i b r a r i e s
#Open the Raspberry Pi terminal and run the following command
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.68.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.a
irspayce.com/mikem/bcm2835/
I n s t a l l w i r i n g P i l i b r a r i e s
#Open the Raspberry Pi terminal and run the following command
sudo apt-get install wiringpi
#For Raspberry Pi systems after May 2019 (earlier than before, you may not
need to execute), 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, the ins
tallation is wrong
#Bullseye branch system use the following command:
git clone https://github.com/WiringPi/WiringPi
cd WiringPi
./build
gpio -v
# Run gpio -v and version 2.60 will appear. If it does not appear, it mean
s that there is an installation error
I n s t a l l P y t h o n l i b r a r i e s
#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
D o w n l o a d E x a m p l e s
O p e n R a s p b e r r y P i t e r m i n a l a n d r u n t h e f o l l o w i n g c o m m a n d
sudo apt-get install unzip -y
sudo wget https://www.waveshare.com/w/upload/8/8d/LCD_Module_RPI_code.zip
sudo unzip ./LCD_Module_RPI_code.zip
cd LCD_Module_RPI_code/RaspberryPi/
R u n t h e d e m o c o d e s
P l e a s e g o i n t o t h e R a s p b e r r y P i d i r e c t o r y ( d e m o c o d e s ) f i r s t a n d r u n t h e c o m m a n d s i n
t e r m i n a l
C c o d e s
R e - c o m p i l e t h e d e m o c o d e s
cd c
sudo make clean
sudo make -j 8
T h e t e s t p r o g r a m o f a l l s c r e e n s c a n b e c a l l e d d i r e c t l y b y e n t e r i n g t h e c o r r e s p o n d i n g s i z e
sudo ./main Screen Size
D e p e n d i n g o n t h e L C D , o n e o f t h e f o l l o w i n g c o m m a n d s s h o u l d b e e n t e r e d :
#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.54inch LCD Module
sudo ./main 1.54
#1.8inch LCD Module
sudo ./main 1.8
#2inch LCD Module
sudo ./main 2
#2.4inch LCD Module
sudo ./main 2.4
p y t h o n
E n t e r t h e p y t h o n p r o g r a m d i r e c t o r y a n d r u n t h e c o m m a n d l s - l
cd python/examples
ls -l
T e s t p r o g r a m s f o r a l l s c r e e n s c a n b e v i e w e d , s o r t e d b y s i z e :
0 i n c h 9 6 _ L C D _ t e s t . p y : 0 . 9 6 i n c h L C D t e s t p r o g r a m
1 i n c h 1 4 _ L C D _ t e s t . p y : 1 . 1 4 i n c h L C D t e s t p r o g r a m
1 i n c h 2 8 _ L C D _ t e s t . p y : 1 . 2 8 i n c h L C D t e s t p r o g r a m
1 i n c h 3 _ L C D _ t e s t . p y : 1 . 3 i n c h L C D t e s t p r o g r a m
1 i n c h 4 7 _ L C D _ t e s t . p y : 1 . 4 7 i n c h L C D t e s t p r o g r a m
1 i n c h 5 4 _ L C D _ t e s t . p y : 1 . 5 4 i n c h L C D t e s t p r o g r a m
1 i n c h 8 _ L C D _ t e s t . p y : 1 . 8 i n c h L C D t e s t p r o g r a m
2 i n c h _ L C D _ t e s t . p y : 2 i n c h L C D t e s t p r o g r a m
2 i n c h 4 _ L C D _ t e s t . p y : 2 i n c h 4 L C D t e s t p r o g r a m
J u s t r u n t h e p r o g r a m c o r r e s p o n d i n g t o t h e s c r e e n , t h e p r o g r a m s u p p o r t s p y t h o n 2 / 3
# python2
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 1inch54_LCD_test.py
sudo python 1inch8_LCD_test.py
sudo python 2inch_LCD_test.py
sudo python 2inch4_LCD_test.py
# python3
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 1inch54_LCD_test.py
sudo python3 1inch8_LCD_test.py
sudo python3 2inch_LCD_test.py
sudo python3 2inch4_LCD_test.py
U s i n g w i t h S T M 3 2
S o f t w a r e d e s c r i p t i o n
T h e d e m o i s d e v e l o p e d b a s e d o n t h e H A L l i b r a r y . D o w n l o a d t h e d e m o , f i n d t h e S T M 3 2
p r o g r a m f i l e d i r e c t o r y , a n d o p e n t h e L C D _ d e m o . u v p r o j x i n t h e
S T M 3 2 \ S T M 3 2 F 1 0 3 R B T 6 \ M D K - A R M d i r e c t o r y t o c h e c k t h e p r o g r a m .
O p e n m a i n . c , y o u c a n s e e a l l t h e t e s t p r o g r a m s , r e m o v e t h e c o m m e n t s i n f r o n t o f t h e
t e s t p r o g r a m s o n t h e c o r r e s p o n d i n g s c r e e n , a n d r e c o m p i l e a n d d o w n l o a d .
L C D _ 0 i n 9 6 _ t e s t ( ) 0 . 9 6 i n c h L C D t e s t p r o g r a m
L C D _ 1 i n 1 4 _ t e s t ( ) 1 . 1 4 i n c h L C D t e s t p r o g r a m
L C D _ 1 i n 2 8 _ t e s t ( ) 1 . 2 8 i n c h L C D t e s t p r o g r a m
L C D _ 1 i n 3 _ t e s t ( ) 1 . 3 i n c h L C D t e s t p r o g r a m
L C D _ 1 i n 5 4 _ t e s t ( ) 1 . 5 4 i n c h L C D t e s t p r o g r a m
L C D _ 1 i n 8 _ t e s t ( ) 1 . 8 i n c h L C D t e s t p r o g r a m
L C D _ 2 i n _ t e s t ( ) 2 i n c h L C D t e s t p r o g r a m
P r o g r a m D e s c r i p t i o n
U n d e r l y i n g h a r d w a r e i n t e r f a c e
D a t a t y p e
#define UBYTE
#define UWORD
#define UDOUBLE
M o d u l e i n i t i a l i z a t i o n a n d e x i t p r o c e s s i n g
UBYTE
System_Init(void);
void
System_Exit(void);
Note:
1.here is some GPIO processing before and after using the LCD screen.
2.After the System_Exit(void) function is used, the OLED display will be t
urned off;
W r i t e a n d r e a d G P I O
void
DEV_Digital_Write(UWORD Pin, UBYTE Value);
UBYTE
DEV_Digital_Read(UWORD Pin);
S P I w r i t e d a t a
UBYTE
SPI4W_Write_Byte(uint8_t value);
T h e u p p e r a p p l i c a t i o n
F o r t h e s c r e e n , i f y o u n e e d t o d r a w p i c t u r e s , d i s p l a y C h i n e s e a n d E n g l i s h c h a r a c t e r s ,
d i s p l a y p i c t u r e s , e t c . , y o u c a n u s e t h e u p p e r a p p l i c a t i o n t o d o , a n d w e p r o v i d e s o m e b a s i c
f u n c t i o n s h e r e a b o u t s o m e g r a p h i c s p r o c e s s i n g i n t h e d i r e c t o r y
S T M 3 2 \ S T M 3 2 F 1 0 3 R B \ U s e r \ G U I _ D E V \ G U I _ P a i n t . c ( . h )
N o t e : B e c a u s e o f t h e s i z e o f t h e i n t e r n a l R A M o f S T M 3 2 a n d a r d u i n o , t h e G U I i s d i r e c t l y
w r i t t e n t o t h e R A M o f t h e L C D .
T h e c h a r a c t e r f o n t w h i c h G U I d e p e n d e n t i s i n t h e d i r e c t o r y
S T M 3 2 \ S T M 3 2 F 1 0 3 R B \ U s e r \ F o n t s
N e w I m a g e P r o p e r t i e s : C r e a t e a n e w i m a g e p r o p e r t y , t h i s p r o p e r t y i n c l u d e s t h e i m a g e
b u f f e r n a m e , w i d t h , h e i g h t , f l i p A n g l e , c o l o r .
void Paint_NewImage(UWORD Width, UWORD Height, UWORD Rotate, UWORD Color)
Parameters:
Width: image buffer Width;
Height: the Height of the image buffer;
Rotate: Indicates the rotation Angle of an image
Color: the initial Color of the image;
S e t t h e c l e a r s c r e e n f u n c t i o n , u s u a l l y c a l l t h e c l e a r f u n c t i o n o f L C D d i r e c t l y .
void Paint_SetClearFuntion(void (*Clear)(UWORD));
parameter:
Clear : Pointer to the clear screen function, used to quickly clear th
e screen to a certain color;
S e t t h e d r a w i n g p i x e l f u n c t i o n
void Paint_SetDisplayFuntion(void (*Display)(UWORD,UWORD,UWORD));
parameter:
Display: Pointer to the pixel drawing function, which is used to write
data to the specified location in the internal RAM of the LCD;
S e l e c t i m a g e b u f f e r : t h e p u r p o s e o f t h e s e l e c t i o n i s t h a t y o u c a n c r e a t e m u l t i p l e i m a g e
a t t r i b u t e s , i m a g e b u f f e r c a n e x i s t m u l t i p l e , y o u c a n s e l e c t e a c h i m a g e y o u c r e a t e .
void Paint_SelectImage(UBYTE *image)
Parameters:
Image: the name of the image cache, which is actually a pointer to the
first address of the image buffer
I m a g e R o t a t i o n : S e t t h e s e l e c t e d i m a g e r o t a t i o n A n g l e , p r e f e r a b l y a f t e r
P a i n t _ S e l e c t I m a g e ( ) , y o u c a n c h o o s e t o r o t a t e 0 , 9 0 , 1 8 0 , 2 7 0 .
void Paint_SetRotate(UWORD Rotate)
Parameters:
Rotate: ROTATE_0, ROTATE_90, ROTATE_180, and ROTATE_270 correspond to
0, 90, 180, and 270 degrees respectively;
I m a g e m i r r o r f l i p : S e t t h e m i r r o r f l i p o f t h e s e l e c t e d i m a g e . Y o u c a n c h o o s e n o m i r r o r ,
h o r i z o n t a l m i r r o r , v e r t i c a l m i r r o r , o r i m a g e c e n t e r m i r r o r .
void Paint_SetMirroring(UBYTE mirror)
Parameters:
Mirror: indicates the image mirroring mode. MIRROR_NONE, MIRROR_HORIZO
NTAL, MIRROR_VERTICAL, MIRROR_ORIGIN correspond to no mirror, horizontal m
irror, vertical mirror, and about image center mirror respectively.
S e t p o i n t s o f d i s p l a y p o s i t i o n a n d c o l o r i n t h e b u f f e r : h e r e i s t h e c o r e G U I f u n c t i o n ,
p r o c e s s i n g p o i n t s d i s p l a y p o s i t i o n a n d c o l o r i n t h e b u f f e r .
void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
Parameters:
Xpoint: the X position of a point in the image buffer
Ypoint: Y position of a point in the image buffer
Color: indicates the Color of the dot
I m a g e b u f f e r f i l l c o l o r : F i l l s t h e i m a g e b u f f e r w i t h a c o l o r , u s u a l l y u s e d t o f l a s h t h e
s c r e e n i n t o b l a n k .
void Paint_Clear(UWORD Color)
Parameters:
Color: fill Color
I m a g e b u f f e r p a r t o f t h e w i n d o w f i l l i n g c o l o r : t h e i m a g e b u f f e r p a r t o f t h e w i n d o w f i l l e d
w i t h a c e r t a i n c o l o r , g e n e r a l l y a s a w i n d o w w h i t e w a s h i n g f u n c t i o n , o f t e n u s e d f o r t i m e
d i s p l a y , w h i t e w a s h i n g o n a s e c o n d
void Paint_ClearWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yen
d, UWORD Color)
Parameters:
Xstart: the x-starting coordinate of the window
Ystart: indicates the Y starting point of the window
Xend: the x-end coordinate of the window
Yend: indicates the y-end coordinate of the window
Color: fill Color
D r a w p o i n t s : I n t h e i m a g e b u f f e r , d r a w p o i n t s o n ( X p o i n t , Y p o i n t ) , y o u c a n c h o o s e t h e
c o l o r , t h e s i z e o f t h e p o i n t , t h e s t y l e o f t h e p o i n t .
void Paint_DrawPoint(UWORD Xpoint, UWORD Ypoint, UWORD Color, DOT_PIXEL Do
t_Pixel, DOT_STYLE Dot_Style)
Parameters:
Xpoint: indicates the X coordinate of a point
Ypoint: indicates the Y coordinate of a point
Color: fill Color
Dot_Pixel: The size of the dot, providing a default of eight size poin
ts
typedef enum {
DOT_PIXEL_1X1
DOT_PIXEL_2X2
DOT_PIXEL_3X3
DOT_PIXEL_4X4
DOT_PIXEL_5X5
DOT_PIXEL_6X6
DOT_PIXEL_7X7
DOT_PIXEL_8X8
} DOT_PIXEL;
Dot_Style: the size of a point that expands from the center of the poi
nt or from the bottom left corner of the point to the right and up
typedef enum {
DOT_FILL_AROUND
DOT_FILL_RIGHTUP,
} DOT_STYLE;
L i n e d r a w i n g : I n t h e i m a g e b u f f e r , l i n e f r o m ( X s t a r t , Y s t a r t ) t o ( X e n d , Y e n d ) , y o u c a n
c h o o s e t h e c o l o r , l i n e w i d t h , l i n e s t y l e .
void Paint_DrawLine(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UW
ORD Color, LINE_STYLE Line_Style ,
Parameters:
Xstart: the x-starting coordinate of a line
Ystart: indicates the Y starting point of a line
Xend: x-terminus of a line
Yend: the y-end coordinate of a line
Color: fill Color
Line_width: The width of the line, which provides a default of eight w
idths
typedef enum {
DOT_PIXEL_1X1
DOT_PIXEL_2X2
DOT_PIXEL_3X3
DOT_PIXEL_4X4
DOT_PIXEL_5X5
DOT_PIXEL_6X6
DOT_PIXEL_7X7
DOT_PIXEL_8X8
} DOT_PIXEL;
Line_Style: line style. Select whether the lines are joined in a strai
ght or dashed way
typedef enum {
LINE_STYLE_SOLID = 0,
LINE_STYLE_DOTTED,
} LINE_STYLE;
D r a w r e c t a n g l e : I n t h e i m a g e b u f f e r , d r a w a r e c t a n g l e f r o m ( X s t a r t , Y s t a r t ) t o ( X e n d ,
Y e n d ) , y o u c a n c h o o s e t h e c o l o r , t h e w i d t h o f t h e l i n e , w h e t h e r t o f i l l t h e i n s i d e o f t h e
r e c t a n g l e .
void Paint_DrawRectangle(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yen
d, UWORD Color, DOT_PIXEL Line_width,
Parameters:
Xstart: the starting X coordinate of the rectangle
Ystart: indicates the Y starting point of the rectangle
Xend: X terminus of the rectangle
Yend: specifies the y-end coordinate of the rectangle
Color: fill Color
Line_width: The width of the four sides of a rectangle. Default ei
ght widths are provided
typedef enum {
} DOT_PIXEL;
Draw_Fill: Fill, whether to fill the inside of the rectangle
typedef enum {
} DRAW_FILL;
D r a w c i r c l e : I n t h e i m a g e b u f f e r , d r a w a c i r c l e o f R a d i u s w i t h ( X _ C e n t e r Y _ C e n t e r ) a s t h e
c e n t e r . Y o u c a n c h o o s e t h e c o l o r , t h e w i d t h o f t h e l i n e , a n d w h e t h e r t o f i l l t h e i n s i d e o f
t h e c i r c l e .
void Paint_DrawCircle(UWORD X_Center, UWORD Y_Center, UWORD Radius, UWORD
Color, DOT_PIXEL Line_width,
Parameters:
X_Center: the x-coordinate of the center of a circle
Y_Center: Y coordinate of the center of a circle
Radius: indicates the Radius of a circle
Color: fill Color
Line_width: The width of the arc, with a default of 8 widths
typedef enum {
DOT_PIXEL_1X1
DOT_PIXEL_2X2
DOT_PIXEL_3X3
DOT_PIXEL_4X4
DOT_PIXEL_5X5
DOT_PIXEL_6X6
DOT_PIXEL_7X7
DOT_PIXEL_8X8
} DOT_PIXEL;
Draw_Fill: fill, whether to fill the inside of the circle
typedef enum {
DRAW_FILL_EMPTY = 0,
DRAW_FILL_FULL,
} DRAW_FILL;
W r i t e A s c i i c h a r a c t e r : I n t h e i m a g e b u f f e r , a t ( X s t a r t Y s t a r t ) a s t h e l e f t v e r t e x , w r i t e a n
A s c i i c h a r a c t e r , y o u c a n s e l e c t A s c i i v i s u a l c h a r a c t e r l i b r a r y , f o n t f o r e g r o u n d c o l o r , f o n t
b a c k g r o u n d c o l o r .
void Paint_DrawChar(UWORD Xstart, UWORD Ystart, const char Ascii_Char, sFO
NT* Font, UWORD Color_Foreground,
Parameters:
Xstart: the x-coordinate of the left vertex of a character
Ystart: the Y coordinate of the font's left vertex
Ascii_Char: indicates the Ascii character
Font: Ascii visual character library, in the Fonts folder provides the
following Fonts:
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: indicates the background color
W r i t e E n g l i s h s t r i n g : I n t h e i m a g e b u f f e r , u s e ( X s t a r t Y s t a r t ) a s t h e l e f t v e r t e x , w r i t e a
s t r i n g o f E n g l i s h c h a r a c t e r s , c a n c h o o s e A s c i i v i s u a l c h a r a c t e r l i b r a r y , f o n t f o r e g r o u n d
c o l o r , f o n t b a c k g r o u n d c o l o r .
void Paint_DrawString_EN(UWORD Xstart, UWORD Ystart, const char * pString,
sFONT* Font, UWORD Color_Foreground,
Parameters:
Xstart: the x-coordinate of the left vertex of a character
Ystart: the Y coordinate of the font's left vertex
PString: string, string is a pointer
Font: Ascii visual character library, in the Fonts folder provides the
following Fonts:
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: indicates the background color
W r i t e C h i n e s e s t r i n g : i n t h e i m a g e b u f f e r , u s e ( X s t a r t Y s t a r t ) a s t h e l e f t v e r t e x , w r i t e a
s t r i n g o f C h i n e s e c h a r a c t e r s , y o u c a n c h o o s e G B 2 3 1 2 e n c o d i n g c h a r a c t e r f o n t , f o n t
f o r e g r o u n d c o l o r , f o n t b a c k g r o u n d c o l o r .
void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char * pString,
cFONT* font, UWORD Color_Foreground,
Parameters:
Xstart: the x-coordinate of the left vertex of a character
Ystart: the Y coordinate of the font's left vertex
PString: string, string is a pointer
Font: GB2312 encoding character Font library, in the Fonts folder prov
ides the following Fonts:
Font12CN: ASCII font 11*21, Chinese font 16*21
Font24CN: ASCII font24 *41, Chinese font 32*41
Color_Foreground: Font color
Color_Background: indicates the background color
W r i t e n u m b e r s : I n t h e i m a g e b u f f e r , u s e ( X s t a r t Y s t a r t ) a s t h e l e f t v e r t e x , w r i t e a s t r i n g
o f n u m b e r s , y o u c a n c h o o s e A s c i i v i s u a l c h a r a c t e r l i b r a r y , f o n t f o r e g r o u n d c o l o r , f o n t
b a c k g r o u n d c o l o r .
void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, double Nummber, sFONT* Fon
t, UWORD Digit, UWORD Color_Foreground,
Parameters:
Xpoint: the x-coordinate of the left vertex of a character
Ypoint: the Y coordinate of the left vertex of the font
Nummber: indicates the number displayed, which can be a decimal
Digit: It's a decimal number
Font: Ascii visual character library, in the Fonts folder provides the
following Fonts:
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: indicates the background color
D i s p l a y t i m e : i n t h e i m a g e b u f f e r , u s e ( X s t a r t Y s t a r t ) a s t h e l e f t v e r t e x , d i s p l a y t i m e , y o u
c a n c h o o s e A s c i i v i s u a l c h a r a c t e r f o n t , f o n t f o r e g r o u n d c o l o r , f o n t b a c k g r o u n d c o l o r .
void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME *pTime, sFONT*
Font, UWORD Color_Background,
Parameters:
Xstart: the x-coordinate of the left vertex of a character
Ystart: the Y coordinate of the font's left vertex
PTime: display time, here defined a good time structure, as long as th
e hour, minute and second bits of data to the parameter;
Font: Ascii visual character library, in the Fonts folder provides the
following Fonts:
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: indicates the background color
A r d u i n o S o f t w a r e D e s c r i p t i o n
N o t e : T h e d e m o s a r e a l l t e s t e d o n A r d u i n o u n o . I f y o u n e e d o t h e r t y p e s o f A r d u i n o , y o u
n e e d t o d e t e r m i n e w h e t h e r t h e c o n n e c t e d p i n s a r e c o r r e c t .
T e m p l a t e : A r d u i n o I D E I n s t a l l a t i o n S t e p s
R u n p r o g r a m
I n t h e p r o d u c t e n c y c l o p e d i a i n t e r f a c e d o w n l o a d
A r d u i n o p r o g r a m i s l o c a t e d a t ~ / A r d u i n o / ...
P l e a s e s e l e c t t h e c o r r e s p o n d i n g p r o g r a m a c c o r d i n g t o t h e L C D s c r e e n m o d e l t o o p e n
Y o u c a n v i e w t e s t p r o g r a m s f o r a l l s c r e e n s i z e s , s o r t e d b y s i z e :
F o r e x a m p l e , 1 . 5 4 i n c h L C D M o d u l e . O p e n t h e L C D _ 1 i n c h 5 4 f o l d e r a n d r u n t h e
L C D _ 1 i n c h 5 4 . i n o f i l e .
O p e n t h e p r o g r a m , s e l e c t t h e d e v e l o p m e n t b o a r d m o d e l A r d u i n o U N O
S e l e c t t h e c o r r e s p o n d i n g C O M p o r t
T h e n c l i c k t o c o m p i l e a n d d o w n l o a d
P r o g r a m D e s c r i p t i o n
D o c u m e n t I n t r o d u c t i o n
T a k e A r d u i n o U N O c o n t r o l l i n g a 1 . 5 4 - i n c h L C D a s a n e x a m p l e , o p e n t h e
A r d u i n o \ L C D _ 1 i n c h 5 4 d i r e c t o r y :
O f w h i c h :
L C D _ 1 i n c h 5 4 . i n o : o p e n w i t h A r d u i n o I D E ;
L C D _ D r i v e r . c p p ( . h ) : i s t h e d r i v e r o f t h e L C D s c r e e n ;
D E V _ C o n f i g . c p p ( . h ) : I t i s t h e h a r d w a r e i n t e r f a c e d e f i n i t i o n , w h i c h e n c a p s u l a t e s t h e r e a d
a n d w r i t e p i n l e v e l s , S P I t r a n s m i s s i o n d a t a , a n d p i n i n i t i a l i z a t i o n ;
f o n t 8 . c p p , f o n t 1 2 . c p p , f o n t 1 6 . c p p , f o n t 2 0 . c p p , f o n t 2 4 . c p p , f o n t 2 4 C N . c p p , f o n t s . h : f o n t s f o r
c h a r a c t e r s o f d i f f e r e n t s i z e s ;
i m a g e . c p p ( . h ) : i s t h e i m a g e d a t a , w h i c h c a n c o n v e r t a n y B M P i m a g e i n t o a 1 6 - b i t t r u e c o l o r
i m a g e a r r a y t h r o u g h I m g 2 L c d ( d o w n l o a d a b l e i n t h e d e v e l o p m e n t d a t a ) .
T h e p r o g r a m i s d i v i d e d i n t o b o t t o m - l a y e r h a r d w a r e i n t e r f a c e , m i d d l e - l a y e r L C D s c r e e n
d r i v e r , a n d u p p e r - l a y e r a p p l i c a t i o n ;
U n d e r l y i n g h a r d w a r e i n t e r f a c e
T h e h a r d w a r e i n t e r f a c e i s d e f i n e d i n t h e t w o f i l e s D E V _ C o n f i g . c p p ( . h ) , a n d f u n c t i o n s s u c h
a s r e a d a n d w r i t e p i n l e v e l , d e l a y , a n d S P I t r a n s m i s s i o n a r e e n c a p s u l a t e d .
w r i t e p i n l e v e l
void DEV_Digital_Write(int pin, int value)
T h e f i r s t p a r a m e t e r i s t h e p i n , a n d t h e s e c o n d i s t h e h i g h a n d l o w l e v e l .
R e a d p i n l e v e l
int DEV_Digital_Read(int pin)
T h e p a r a m e t e r i s t h e p i n , a n d t h e r e t u r n v a l u e i s t h e l e v e l o f t h e r e a d p i n .
D e l a y
DEV_Delay_ms(unsigned int delaytime)
m i l l i s e c o n d l e v e l d e l a y .
S P I o u t p u t d a t a
DEV_SPI_WRITE(unsigned char data)
T h e p a r a m e t e r i s c h a r t y p e , o c c u p y i n g 8 b i t s .
T h e u p p e r a p p l i c a t i o n
F o r t h e s c r e e n , i f y o u n e e d t o d r a w p i c t u r e s , d i s p l a y C h i n e s e a n d E n g l i s h c h a r a c t e r s ,
d i s p l a y p i c t u r e s , e t c . , y o u c a n u s e t h e u p p e r a p p l i c a t i o n t o d o , a n d w e p r o v i d e s o m e b a s i c
f u n c t i o n s h e r e a b o u t s o m e g r a p h i c s p r o c e s s i n g i n t h e d i r e c t o r y G U I _ P a i n t . c ( . h )
N o t e : B e c a u s e o f t h e s i z e o f t h e i n t e r n a l R A M o f S T M 3 2 a n d a r d u i n o , t h e G U I i s d i r e c t l y
w r i t t e n t o t h e R A M o f t h e L C D .
T h e f o n t s u s e d b y t h e G U I a l l d e p e n d o n t h e f o n t * . c p p ( h ) f i l e s u n d e r t h e s a m e f i l e
N e w I m a g e P r o p e r t i e s : C r e a t e a n e w i m a g e p r o p e r t y , t h i s p r o p e r t y i n c l u d e s t h e i m a g e
b u f f e r n a m e , w i d t h , h e i g h t , f l i p A n g l e , c o l o r .
void Paint_NewImage(UWORD Width, UWORD Height, UWORD Rotate, UWORD Color)
Parameters:
Width: image buffer Width;
Height: the Height of the image buffer;
Rotate: Indicates the rotation Angle of an image
Color: the initial Color of the image;
S e t t h e c l e a r s c r e e n f u n c t i o n , u s u a l l y c a l l t h e c l e a r f u n c t i o n o f L C D d i r e c t l y .
void Paint_SetClearFuntion(void (*Clear)(UWORD));
parameter:
Clear : Pointer to the clear screen function, used to quickly clear th
e screen to a certain color;
S e t t h e d r a w i n g p i x e l f u n c t i o n .
void Paint_SetDisplayFuntion(void (*Display)(UWORD,UWORD,UWORD));
parameter:
Display: Pointer to the pixel drawing function, which is used to write
data to the specified location in the internal RAM of the LCD;
S e l e c t i m a g e b u f f e r : t h e p u r p o s e o f t h e s e l e c t i o n i s t h a t y o u c a n c r e a t e m u l t i p l e i m a g e
a t t r i b u t e s , i m a g e b u f f e r c a n e x i s t m u l t i p l e , y o u c a n s e l e c t e a c h i m a g e y o u c r e a t e .
void Paint_SelectImage(UBYTE *image)
Parameters:
Image: the name of the image cache, which is actually a pointer to the
first address of the image buffer
I m a g e R o t a t i o n : S e t t h e s e l e c t e d i m a g e r o t a t i o n A n g l e , p r e f e r a b l y a f t e r
P a i n t _ S e l e c t I m a g e ( ) , y o u c a n c h o o s e t o r o t a t e 0 , 9 0 , 1 8 0 , 2 7 0 .
void Paint_SetRotate(UWORD Rotate)
Parameters:
Rotate: ROTATE_0, ROTATE_90, ROTATE_180, and ROTATE_270 correspond to
0, 90, 180, and 270 degrees respectively;
I m a g e m i r r o r f l i p : S e t t h e m i r r o r f l i p o f t h e s e l e c t e d i m a g e . Y o u c a n c h o o s e n o m i r r o r ,
h o r i z o n t a l m i r r o r , v e r t i c a l m i r r o r , o r i m a g e c e n t e r m i r r o r .
void Paint_SetMirroring(UBYTE mirror)
Parameters:
Mirror: indicates the image mirroring mode. MIRROR_NONE, MIRROR_HORIZO
NTAL, MIRROR_VERTICAL, MIRROR_ORIGIN correspond to no mirror, horizontal m
irror, vertical mirror, and about image center mirror respectively.
S e t p o i n t s o f d i s p l a y p o s i t i o n a n d c o l o r i n t h e b u f f e r : h e r e i s t h e c o r e G U I f u n c t i o n ,
p r o c e s s i n g p o i n t s d i s p l a y p o s i t i o n a n d c o l o r i n t h e b u f f e r .
void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
Parameters:
Xpoint: the X position of a point in the image buffer
Ypoint: Y position of a point in the image buffer
Color: indicates the Color of the dot
I m a g e b u f f e r f i l l c o l o r : F i l l s t h e i m a g e b u f f e r w i t h a c o l o r , u s u a l l y u s e d t o f l a s h t h e
s c r e e n i n t o b l a n k .
void Paint_ClearWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yen
d, UWORD Color)
Parameters:
Xstart: the x-starting coordinate of the window
Ystart: indicates the Y starting point of the window
Xend: the x-end coordinate of the window
Yend: indicates the y-end coordinate of the window
Color: fill Color
D r a w p o i n t s : I n t h e i m a g e b u f f e r , d r a w p o i n t s o n ( X p o i n t , Y p o i n t ) , y o u c a n c h o o s e t h e
c o l o r , t h e s i z e o f t h e p o i n t , t h e s t y l e o f t h e p o i n t .
void Paint_DrawPoint(UWORD Xpoint, UWORD Ypoint, UWORD Color, DOT_PIXEL Do
t_Pixel, DOT_STYLE Dot_Style)
Parameters:
Xpoint: indicates the X coordinate of a point
Ypoint: indicates the Y coordinate of a point
Color: fill Color
Dot_Pixel: The size of the dot, providing a default of eight size poin
ts
typedef enum {
} DOT_PIXEL;
Dot_Style: the size of a point that expands from the center of the poi
nt or from the bottom left corner of the point to the right and up
typedef enum {
} DOT_STYLE;
L i n e d r a w i n g : I n t h e i m a g e b u f f e r , l i n e f r o m ( X s t a r t , Y s t a r t ) t o ( X e n d , Y e n d ) , y o u c a n
c h o o s e t h e c o l o r , l i n e w i d t h , l i n e s t y l e .
void Paint_DrawLine(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UW
ORD Color, LINE_STYLE Line_Style ,
Parameters:
Xstart: the x-starting coordinate of a line
Ystart: indicates the Y starting point of a line
Xend: x-terminus of a line
Yend: the y-end coordinate of a line
Color: fill Color
Line_width: The width of the line, which provides a default of eig
ht widths
Line_Style: line style. Select whether the lines are joined in a s
traight or dashed way
D r a w r e c t a n g l e : I n t h e i m a g e b u f f e r , d r a w a r e c t a n g l e f r o m ( X s t a r t , Y s t a r t ) t o ( X e n d ,
Y e n d ) , y o u c a n c h o o s e t h e c o l o r , t h e w i d t h o f t h e l i n e , w h e t h e r t o f i l l t h e i n s i d e o f t h e
r e c t a n g l e .
void Paint_DrawRectangle(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yen
d, UWORD Color, DOT_PIXEL Line_width,
Parameters:
Xstart: the starting X coordinate of the rectangle
Ystart: indicates the Y starting point of the rectangle
Xend: X terminus of the rectangle
Yend: specifies the y-end coordinate of the rectangle
Color: fill Color
Line_width: The width of the four sides of a rectangle. Default ei
ght widths are provided
typedef enum {
} DOT_PIXEL;
Draw_Fill: Fill, whether to fill the inside of the rectangle
typedef enum {
} DRAW_FILL;
D r a w c i r c l e : I n t h e i m a g e b u f f e r , d r a w a c i r c l e o f R a d i u s w i t h ( X _ C e n t e r Y _ C e n t e r ) a s t h e
c e n t e r . Y o u c a n c h o o s e t h e c o l o r , t h e w i d t h o f t h e l i n e , a n d w h e t h e r t o f i l l t h e i n s i d e o f
t h e c i r c l e .
void Paint_DrawCircle(UWORD X_Center, UWORD Y_Center, UWORD Radius, UWORD
Color, DOT_PIXEL Line_width,
Parameters:
X_Center: the x-coordinate of the center of a circle
Y_Center: Y coordinate of the center of a circle
Radius: indicates the Radius of a circle
Color: fill Color
Line_width: The width of the arc, with a default of 8 widths
typedef enum {
} DOT_PIXEL;
Draw_Fill: fill, whether to fill the inside of the circle
typedef enum {
} DRAW_FILL;
W r i t e A s c i i c h a r a c t e r : I n t h e i m a g e b u f f e r , a t ( X s t a r t Y s t a r t ) a s t h e l e f t v e r t e x , w r i t e a n
A s c i i c h a r a c t e r , y o u c a n s e l e c t A s c i i v i s u a l c h a r a c t e r l i b r a r y , f o n t f o r e g r o u n d c o l o r , f o n t
b a c k g r o u n d c o l o r .
void Paint_DrawChar(UWORD Xstart, UWORD Ystart, const char Ascii_Char, sFO
NT* Font, UWORD Color_Foreground,
Parameters:
Xstart: the x-coordinate of the left vertex of a character
Ystart: the Y coordinate of the font's left vertex
Ascii_Char: indicates the Ascii character
Font: Ascii visual character library, in the Fonts folder provides
the following Fonts:
Color_Foreground: Font color
Color_Background: indicates the background color
W r i t e E n g l i s h s t r i n g : I n t h e i m a g e b u f f e r , u s e ( X s t a r t Y s t a r t ) a s t h e l e f t v e r t e x , w r i t e a
s t r i n g o f E n g l i s h c h a r a c t e r s , c a n c h o o s e A s c i i v i s u a l c h a r a c t e r l i b r a r y , f o n t f o r e g r o u n d
c o l o r , f o n t b a c k g r o u n d c o l o r .
void Paint_DrawString_EN(UWORD Xstart, UWORD Ystart, const char * pString,
sFONT* Font, UWORD Color_Foreground,
Parameters:
Xstart: the x-coordinate of the left vertex of a character
Ystart: the Y coordinate of the font's left vertex
PString: string, string is a pointer
Font: Ascii visual character library, in the Fonts folder provides
the following Fonts:
Color_Foreground: Font color
Color_Background: indicates the background color
W r i t e C h i n e s e s t r i n g : i n t h e i m a g e b u f f e r , u s e ( X s t a r t Y s t a r t ) a s t h e l e f t v e r t e x , w r i t e a
s t r i n g o f C h i n e s e c h a r a c t e r s , y o u c a n c h o o s e G B 2 3 1 2 e n c o d i n g c h a r a c t e r f o n t , f o n t
f o r e g r o u n d c o l o r , f o n t b a c k g r o u n d c o l o r .
void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char * pString,
cFONT* font, UWORD Color_Foreground,
Parameters:
Xstart: the x-coordinate of the left vertex of a character
Ystart: the Y coordinate of the font's left vertex
PString: string, string is a pointer
Font: GB2312 encoding character Font library, in the Fonts folder
provides the following Fonts:
W r i t e n u m b e r s : I n t h e i m a g e b u f f e r , u s e ( X s t a r t Y s t a r t ) a s t h e l e f t v e r t e x , w r i t e a s t r i n g
o f n u m b e r s , y o u c a n c h o o s e A s c i i v i s u a l c h a r a c t e r l i b r a r y , f o n t f o r e g r o u n d c o l o r , f o n t
b a c k g r o u n d c o l o r .
void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, double Nummber, sFONT* Fon
t, UWORD Digit, UWORD Color_Foreground,
Parameters:
Xpoint: the x-coordinate of the left vertex of a character
Ypoint: the Y coordinate of the left vertex of the font
Nummber: indicates the number displayed, which can be a decimal
Digit: It's a decimal number
Font: Ascii visual character library, in the Fonts folder provides
the following Fonts:
Color_Foreground: Font color
Color_Background: indicates the background color
W r i t e n u m b e r s w i t h d e c i m a l s : a t ( X s t a r t Y s t a r t ) a s t h e l e f t v e r t e x , w r i t e a s t r i n g o f
n u m b e r s w i t h d e c i m a l s , y o u c a n c h o o s e A s c i i c o d e v i s u a l c h a r a c t e r f o n t , f o n t f o r e g r o u n d
c o l o r , f o n t b a c k g r o u n d c o l o r
void Paint_DrawFloatNum(UWORD Xpoint, UWORD Ypoint, double Nummber, UBYTE
Decimal_Point, sFONT* Font, UWORD Color_Foreground, UWORD Color_Backgroun
d);
parameter:
Xstart: the X coordinate of the left vertex of the character
Ystart: Y coordinate of the left vertex of the font
Nummber: the displayed number, which is saved in double type here
Decimal_Point: Displays the number of digits after the decimal po
int
Font: Ascii code visual character font library, the following fon
ts are provided in the Fonts folder:
Color_Foreground: font color
Color_Background: background color
D i s p l a y t i m e : i n t h e i m a g e b u f f e r , u s e ( X s t a r t Y s t a r t ) a s t h e l e f t v e r t e x , d i s p l a y t i m e , y o u
c a n c h o o s e A s c i i v i s u a l c h a r a c t e r f o n t , f o n t f o r e g r o u n d c o l o r , f o n t b a c k g r o u n d c o l o r .
void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME *pTime, sFONT*
Font, UWORD Color_Background,
Parameters:
Xstart: the x-coordinate of the left vertex of a character
Ystart: the Y coordinate of the font's left vertex
PTime: display time, here defined a good time structure, as long a
s the hour, minute and second bits of data to the parameter;
Font: Ascii visual character library, in the Fonts folder provides
the following Fonts:
Color_Foreground: Font color
Color_Background: indicates the background color
D i s p l a y i m a g e : a t ( X s t a r t Y s t a r t ) a s t h e l e f t v e r t e x , d i s p l a y a n i m a g e w h o s e w i d t h i s
W _ I m a g e a n d h e i g h t i s H _ I m a g e ;
void Paint_DrawImage(const unsigned char *image, UWORD xStart, UWORD yStar
t, UWORD W_Image, UWORD H_Image)
parameter:
image: image address, pointing to the image information you want to
display
Xstart: the 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
V i s i o n F i v e 2
A d a p t i v e M o d e l
0 . 9 6 i n c h L C D M o d u l e
1 . 1 4 i n c h L C D M o d u l e
1 . 2 8 i n c h L C D M o d u l e
1 . 3 i n c h L C D M o d u l e
1 . 5 4 i n c h L C D M o d u l e
1 . 8 i n c h L C D M o d u l e
2 i n c h L C D M o d u l e
2 . 4 i n c h L C D M o d u l e
H a r d w a r e C o n n e c t i o n
V i s i o n F i v e 2 P i n C o n n e c t i o n
L C D
V C C
G N D
D I N
C L K
C S
D C
R S T
B L
I n s t a l l C o r r e s p o n d i n g L i b r a r i e s
apt-get install pip
pip install VisionFive.gpio
apt-get install python3-numpy
apt-get install python3-pil
D e m o D o w n l o a d
apt-get install p7zip-full
wget https://www.waveshare.com/w/upload/e/e9/LCD_Module_code.7z
7z x LCD_Module_code.7z -o./LCD_Module_code
cd LCD_Module_code/VisionFive/python/example/
R u n t h e C o r r e s p o n d i n g D e m o A c c o r d i n g t o t h e S c r e e n Y o u
P u r c h a s e d
python3 0inch96_LCD_test.py
python3 1inch14_LCD_test.py
python3 1inch28_LCD_test.py
python3 1inch3_LCD_test.py
python3 1inch54_LCD_test.py
python3 1inch8_LCD_test.py
python3 2inch_LCD_test.py
python3 2inch4_LCD_test.py
R e s o u r c e s
D o c u m e n t s
S c h e m a t i c
G C 9 A 0 1 A m a n u a l
S o f t w a r e
l c d
I m a g e 2 L c d
D e m o C o d e s
S a m p l e P r o g r a m
3 D D r a w i n g
1 . 2 8 i n c h L C D M o d u l e 3 D D r a w i n g
F A Q
Q u e s t i o n :
W h a t i s t h e m a x i m u m p o w e r c o n s u m p t i o n o f t h e 1 . 2 8 i n c h L C D
M o d u l e ?
A n s w e r :
3 . 3 V 3 1 . 2 m A
S u p p o r t
I f y o u r e q u i r e t e c h n i c a l s u p p o r t , p l e a s e g o t o t h e p a g e a n d o p e n a t i c k e t .
3 2 . 4 m m
H
x 0 . 1 3 5
V
Φ
3 7 . 5 ( m m )
( P l e a s e c o n n e c t a c c o r d i n g t o t h e p i n d e f i n i t i o n t a b l e . T h e
L C D
V C C
G N D
D I N
C L K
C S
D C
R S T
B L
L C D
V C C
G N D
D I N
C L K
C S
D C
R S T
B L
to enabl
uint8_t
uint16_t
uint32_t
= 1,
,
,
,
,
,
,
,
= 1,
= 1,
,
,
,
,
,
,
,
DOT_PIXEL_1X1
DOT_PIXEL_2X2
DOT_PIXEL_3X3
DOT_PIXEL_4X4
DOT_PIXEL_5X5
DOT_PIXEL_6X6
DOT_PIXEL_7X7
DOT_PIXEL_8X8
DRAW_FILL_EMPTY = 0,
DRAW_FILL_FULL,
DRAW_FILL Draw_Fill)
= 1,
,
,
,
,
,
,
,
DOT_PIXEL_1X1
DOT_PIXEL_2X2
DOT_PIXEL_3X3
DOT_PIXEL_4X4
DOT_PIXEL_5X5
DOT_PIXEL_6X6
DOT_PIXEL_7X7
DOT_PIXEL_8X8
DOT_FILL_AROUND
DOT_FILL_RIGHTUP,
typedef enum {
DOT_PIXEL_1X1
DOT_PIXEL_2X2
DOT_PIXEL_3X3
DOT_PIXEL_4X4
DOT_PIXEL_5X5
DOT_PIXEL_6X6
DOT_PIXEL_7X7
DOT_PIXEL_8X8
} DOT_PIXEL;
typedef enum {
LINE_STYLE_SOLID = 0,
LINE_STYLE_DOTTED,
} LINE_STYLE;
DOT_PIXEL_1X1
DOT_PIXEL_2X2
DOT_PIXEL_3X3
DOT_PIXEL_4X4
DOT_PIXEL_5X5
DOT_PIXEL_6X6
DOT_PIXEL_7X7
DOT_PIXEL_8X8
DRAW_FILL_EMPTY = 0,
DRAW_FILL_FULL,
DRAW_FILL Draw_Fill)
DOT_PIXEL_1X1
DOT_PIXEL_2X2
DOT_PIXEL_3X3
DOT_PIXEL_4X4
DOT_PIXEL_5X5
DOT_PIXEL_6X6
DOT_PIXEL_7X7
DOT_PIXEL_8X8
DRAW_FILL_EMPTY = 0,
DRAW_FILL_FULL,
Font8: 5*8 font
Font12: 7*12 font
Font16: 11*16 font
Font20: 14*20 font
Font24: 17*24 font
Font8: 5*8 font
Font12: 7*12 font
Font16: 11*16 font
Font20: 14*20 font
Font24: 17*24 font
Font12CN: ASCII font 11*21, Chinese font 16*21
Font24CN: ASCII font24 *41, Chinese font 32*41
Color_Foreground: Font color
Color_Background: indicates the background color
Font8: 5*8 font
Font12: 7*12 font
Font16: 11*16 font
Font20: 14*20 font
Font24: 17*24 font
Font8: 5*8 font
Font12: 7*12 font
Font16: 11*16 font
Font20: 14*20 font
Font24: 17*24 font
Font8: 5*8 font
Font12: 7*12 font
Font16: 11*16 font
Font20: 14*20 font
Font24: 17*24 font
m m
R a s p b e r r y P i
B C M 2 8 3 5
3 . 3 V
G N D
M O S I
S C L K
C E 0
2 5
2 7
1 8
d e v e l o p e d b y o u r c o m p a n y a s a n
// 1 x 1
// 2 X 2
// 3 X 3
// 4 X 4
// 5 X 5
// 6 X 6
// 7 X 7
// 8 X 8
LINE_STYLE Line_Style)
// 1 x 1
// 2 X 2
// 3 X 3
// 4 X 4
// 5 X 5
// 6 X 6
// 7 X 7
// 8 X 8
DRAW_FILL Draw_Fill)
= 1,
// 1 x 1
,
,
,
,
,
,
,
// 1 x 1
// 2 X 2
// 3 X 3
// 4 X 4
// 5 X 5
// 6 X 6
// 7 X 7
// 8 X 8
UWORD Color_Background)
UWORD Color_Background)
UWORD Color_Background)
UWORD Color_Background)
UWORD Color_Foreground)
t h e p r o g r a m
= 1,
,
,
,
,
,
,
,
= 1,
LINE_STYLE Line_Style)
= 1,
,
,
,
,
,
,
,
DRAW_FILL Draw_Fill)
= 1,
,
,
,
,
,
,
,
= 1,
,
,
,
,
,
,
,
UWORD Color_Background)
UWORD Color_Background)
UWORD Color_Background)
UWORD Color_Background)
UWORD Color_Foreground)
V i s i o n F i v e 2 B o a r d P i n N o .
3 . 3 V
G N D
1 9
2 3
2 4
2 2
1 3
1 2
1 . 2 8 i n c h L C D M o d u l e
1 . 2 8 i n c h L C D , S P I i n t e r f a c e s
S T M 3 2
3 . 3 V
G N D
P A 7
P A 5
P B 6
P A 8
P A 9
P C 7
U N O
5 V
G N D
D 1 1
D 1 3
D 1 0
D 7
D 8
D 9
// 2 X 2
// 3 X 3
// 4 X 4
// 5 X 5
// 6 X 6
// 7 X 7
// 8 X 8
, a n d t h e n u n z i p i t . T h e
// 1 x 1
// 2 X 2
// 3 X 3
// 4 X 4
// 5 X 5
// 6 X 6
// 7 X 7
// 8 X 8
// 1 x 1
// 2 X 2
// 3 X 3
// 4 X 4
// 5 X 5
// 6 X 6
// 7 X 7
// 8 X 8
// 1 x 1
// 2 X 2
// 3 X 3
// 4 X 4
// 5 X 5
// 6 X 6
// 7 X 7
// 8 X 8
// 1 x 1
// 2 X 2
// 3 X 3
// 4 X 4
// 5 X 5
// 6 X 6
// 7 X 7
// 8 X 8
B o a r d
3 . 3 V
G N D
1 9
2 3
2 4
2 2
1 3
1 2

Advertisement

loading
Need help?

Need help?

Do you have a question about the B08V5538C6 and is the answer not in the manual?

Questions and answers