STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
st7735.h
Go to the documentation of this file.
1 
39 /* Define to prevent recursive inclusion -------------------------------------*/
40 #ifndef __ST7735_H
41 #define __ST7735_H
42 
43 #ifdef __cplusplus
44  extern "C" {
45 #endif
46 
47 /* Includes ------------------------------------------------------------------*/
48 #include "../Common/lcd.h"
49 
77 #define ST7735_LCD_PIXEL_WIDTH ((uint16_t)128)
78 #define ST7735_LCD_PIXEL_HEIGHT ((uint16_t)160)
79 
83 #define LCD_REG_0 0x00 /* No Operation: NOP */
84 #define LCD_REG_1 0x01 /* Software reset: SWRESET */
85 #define LCD_REG_4 0x04 /* Read Display ID: RDDID */
86 #define LCD_REG_9 0x09 /* Read Display Statu: RDDST */
87 #define LCD_REG_10 0x0A /* Read Display Power: RDDPM */
88 #define LCD_REG_11 0x0B /* Read Display: RDDMADCTL */
89 #define LCD_REG_12 0x0C /* Read Display Pixel: RDDCOLMOD */
90 #define LCD_REG_13 0x0D /* Read Display Image: RDDIM */
91 #define LCD_REG_14 0x0E /* Read Display Signal: RDDSM */
92 #define LCD_REG_16 0x10 /* Sleep in & booster off: SLPIN */
93 #define LCD_REG_17 0x11 /* Sleep out & booster on: SLPOUT */
94 #define LCD_REG_18 0x12 /* Partial mode on: PTLON */
95 #define LCD_REG_19 0x13 /* Partial off (Normal): NORON */
96 #define LCD_REG_32 0x20 /* Display inversion off: INVOFF */
97 #define LCD_REG_33 0x21 /* Display inversion on: INVON */
98 #define LCD_REG_38 0x26 /* Gamma curve select: GAMSET */
99 #define LCD_REG_40 0x28 /* Display off: DISPOFF */
100 #define LCD_REG_41 0x29 /* Display on: DISPON */
101 #define LCD_REG_42 0x2A /* Column address set: CASET */
102 #define LCD_REG_43 0x2B /* Row address set: RASET */
103 #define LCD_REG_44 0x2C /* Memory write: RAMWR */
104 #define LCD_REG_45 0x2D /* LUT for 4k,65k,262k color: RGBSET */
105 #define LCD_REG_46 0x2E /* Memory read: RAMRD*/
106 #define LCD_REG_48 0x30 /* Partial start/end address set: PTLAR */
107 #define LCD_REG_52 0x34 /* Tearing effect line off: TEOFF */
108 #define LCD_REG_53 0x35 /* Tearing effect mode set & on: TEON */
109 #define LCD_REG_54 0x36 /* Memory data access control: MADCTL */
110 #define LCD_REG_56 0x38 /* Idle mode off: IDMOFF */
111 #define LCD_REG_57 0x39 /* Idle mode on: IDMON */
112 #define LCD_REG_58 0x3A /* Interface pixel format: COLMOD */
113 #define LCD_REG_177 0xB1 /* In normal mode (Full colors): FRMCTR1 */
114 #define LCD_REG_178 0xB2 /* In Idle mode (8-colors): FRMCTR2 */
115 #define LCD_REG_179 0xB3 /* In partial mode + Full colors: FRMCTR3 */
116 #define LCD_REG_180 0xB4 /* Display inversion control: INVCTR */
117 #define LCD_REG_192 0xC0 /* Power control setting: PWCTR1 */
118 #define LCD_REG_193 0xC1 /* Power control setting: PWCTR2 */
119 #define LCD_REG_194 0xC2 /* In normal mode (Full colors): PWCTR3 */
120 #define LCD_REG_195 0xC3 /* In Idle mode (8-colors): PWCTR4 */
121 #define LCD_REG_196 0xC4 /* In partial mode + Full colors: PWCTR5 */
122 #define LCD_REG_197 0xC5 /* VCOM control 1: VMCTR1 */
123 #define LCD_REG_199 0xC7 /* Set VCOM offset control: VMOFCTR */
124 #define LCD_REG_209 0xD1 /* Set LCM version code: WRID2 */
125 #define LCD_REG_210 0xD2 /* Customer Project code: WRID3 */
126 #define LCD_REG_217 0xD9 /* NVM control status: NVCTR1 */
127 #define LCD_REG_218 0xDA /* Read ID1: RDID1 */
128 #define LCD_REG_219 0xDB /* Read ID2: RDID2 */
129 #define LCD_REG_220 0xDC /* Read ID3: RDID3 */
130 #define LCD_REG_222 0xDE /* NVM Read Command: NVCTR2 */
131 #define LCD_REG_223 0xDF /* NVM Write Command: NVCTR3 */
132 #define LCD_REG_224 0xE0 /* Set Gamma adjustment (+ polarity): GAMCTRP1 */
133 #define LCD_REG_225 0xE1 /* Set Gamma adjustment (- polarity): GAMCTRN1 */
134 
138 #define LCD_LINE_0 LINE(0)
139 #define LCD_LINE_1 LINE(1)
140 #define LCD_LINE_2 LINE(2)
141 #define LCD_LINE_3 LINE(3)
142 #define LCD_LINE_4 LINE(4)
143 #define LCD_LINE_5 LINE(5)
144 #define LCD_LINE_6 LINE(6)
145 #define LCD_LINE_7 LINE(7)
146 #define LCD_LINE_8 LINE(8)
147 #define LCD_LINE_9 LINE(9)
148 #define LCD_LINE_10 LINE(10)
149 #define LCD_LINE_11 LINE(11)
150 #define LCD_LINE_12 LINE(12)
151 #define LCD_LINE_13 LINE(13)
152 #define LCD_LINE_14 LINE(14)
153 #define LCD_LINE_15 LINE(15)
154 #define LCD_LINE_16 LINE(16)
155 #define LCD_LINE_17 LINE(17)
156 #define LCD_LINE_18 LINE(18)
157 #define LCD_LINE_19 LINE(19)
158 
166 void st7735_Init(void);
167 uint16_t st7735_ReadID(void);
168 
169 void st7735_DisplayOn(void);
170 void st7735_DisplayOff(void);
171 void st7735_SetCursor(uint16_t Xpos, uint16_t Ypos);
172 void st7735_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode);
173 void st7735_WriteReg(uint8_t LCDReg, uint8_t LCDRegValue);
174 uint8_t st7735_ReadReg(uint8_t LCDReg);
175 
176 void st7735_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
177 void st7735_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length);
178 void st7735_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length);
179 
180 uint16_t st7735_GetLcdPixelWidth(void);
181 uint16_t st7735_GetLcdPixelHeight(void);
182 void st7735_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp);
183 
184 /* LCD driver structure */
186 
187 /* LCD IO functions */
188 void LCD_IO_Init(void);
189 void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size);
190 void LCD_IO_WriteReg(uint8_t Reg);
191 void LCD_Delay(uint32_t delay);
196 #ifdef __cplusplus
197 }
198 #endif
199 
200 #endif /* __ST7735_H */
201 
214 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
void st7735_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode)
Writes pixel.
Definition: st7735.c:296
void st7735_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
Sets a display window.
Definition: st7735.c:334
void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size)
void st7735_SetCursor(uint16_t Xpos, uint16_t Ypos)
Sets Cursor position.
Definition: st7735.c:273
void LCD_Delay(uint32_t delay)
void st7735_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length)
Draws vertical line.
Definition: st7735.c:391
void st7735_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp)
Displays a bitmap picture loaded in the internal Flash.
Definition: st7735.c:427
void st7735_WriteReg(uint8_t LCDReg, uint8_t LCDRegValue)
Writes to the selected LCD register.
Definition: st7735.c:320
void LCD_IO_WriteReg(uint8_t Reg)
void st7735_DisplayOn(void)
Enables the Display.
Definition: st7735.c:238
uint8_t st7735_ReadReg(uint8_t LCDReg)
uint16_t st7735_GetLcdPixelHeight(void)
Gets the LCD pixel Height.
Definition: st7735.c:417
LCD_DrvTypeDef st7735_drv
Definition: st7735.c:85
uint16_t st7735_ReadID(void)
uint16_t st7735_GetLcdPixelWidth(void)
Gets the LCD pixel Width.
Definition: st7735.c:407
void LCD_IO_Init(void)
void st7735_DisplayOff(void)
Disables the Display.
Definition: st7735.c:255
void st7735_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length)
Draws horizontal line.
Definition: st7735.c:367
void st7735_Init(void)
Initialize the ST7735 LCD Component.
Definition: st7735.c:125