Skip to content

Commit e60566e

Browse files
committed
Update
Add a initialized define for RePhone Create Kit with Xadow 1.54" Touchscreen.
1 parent a45b3a0 commit e60566e

File tree

2 files changed

+165
-89
lines changed

2 files changed

+165
-89
lines changed

hardware/arduino/mtk/libraries/LDisplay/utility/lcd_sitronix_st7789s.c

Lines changed: 163 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,17 @@ void LCD_ClearAll_ST7789S(VMUINT16 data)
148148
void lcd_init_st7789s(VMUINT32 bkground, void **buf_addr)
149149
{
150150
// Do HW Reset
151-
152-
vm_dcl_control(lcd_reset_handle, VM_DCL_GPIO_COMMAND_WRITE_HIGH, NULL);
153-
vm_drv_lcd_delay_ms(1);
154-
vm_dcl_control(lcd_reset_handle, VM_DCL_GPIO_COMMAND_WRITE_LOW, NULL);
155-
vm_drv_lcd_delay_ms(10);
156-
vm_dcl_control(lcd_reset_handle, VM_DCL_GPIO_COMMAND_WRITE_HIGH, NULL);
157-
vm_drv_lcd_delay_ms(120);
158-
151+
vm_dcl_control(lcd_reset_handle, VM_DCL_GPIO_COMMAND_WRITE_HIGH, NULL);
152+
vm_drv_lcd_delay_ms(1);
153+
vm_dcl_control(lcd_reset_handle, VM_DCL_GPIO_COMMAND_WRITE_LOW, NULL);
154+
vm_drv_lcd_delay_ms(10);
155+
vm_dcl_control(lcd_reset_handle, VM_DCL_GPIO_COMMAND_WRITE_HIGH, NULL);
156+
vm_drv_lcd_delay_ms(120);
157+
159158
LCD_CtrlWrite_ST7789S(0x11);
160159
vm_drv_lcd_delay_ms(120);
161160

161+
#ifdef _TOUCH_SCREEN_V1_0_
162162
LCD_CtrlWrite_ST7789S(0x36);
163163
LCD_DataWrite_ST7789S(0x00);// C0 40 60
164164

@@ -182,90 +182,164 @@ void lcd_init_st7789s(VMUINT32 bkground, void **buf_addr)
182182

183183
LCD_CtrlWrite_ST7789S(0xB2);
184184
LCD_DataWrite_ST7789S(0x1C);
185-
LCD_DataWrite_ST7789S(0x1C);
186-
LCD_DataWrite_ST7789S(0x01);
187-
LCD_DataWrite_ST7789S(0xFF);
188-
LCD_DataWrite_ST7789S(0x33);
189-
190-
191-
LCD_CtrlWrite_ST7789S(0xB3);
192-
LCD_DataWrite_ST7789S(0x10);
193-
LCD_DataWrite_ST7789S(0xFF); // 0x05
194-
LCD_DataWrite_ST7789S(0x0F);
195-
196-
LCD_CtrlWrite_ST7789S(0xB4);
197-
LCD_DataWrite_ST7789S(0x0B);
198-
199-
LCD_CtrlWrite_ST7789S(0xB5);
200-
LCD_DataWrite_ST7789S(0x9F);
201-
202-
LCD_CtrlWrite_ST7789S(0xB7);
203-
LCD_DataWrite_ST7789S(0x35);
204-
205-
LCD_CtrlWrite_ST7789S(0xBB);
206-
LCD_DataWrite_ST7789S(0x28);
207-
208-
LCD_CtrlWrite_ST7789S(0xBC);
209-
LCD_DataWrite_ST7789S(0xEC);
210-
211-
LCD_CtrlWrite_ST7789S(0xBD);
212-
LCD_DataWrite_ST7789S(0xFE);
213-
214-
LCD_CtrlWrite_ST7789S(0xC0);
215-
LCD_DataWrite_ST7789S(0x2C);
216-
217-
LCD_CtrlWrite_ST7789S(0xC2);
218-
LCD_DataWrite_ST7789S(0x01);
219-
220-
LCD_CtrlWrite_ST7789S(0xC3);
221-
LCD_DataWrite_ST7789S(0x1E);
222-
223-
LCD_CtrlWrite_ST7789S(0xC4);
224-
LCD_DataWrite_ST7789S(0x20);
225-
226-
LCD_CtrlWrite_ST7789S(0xC6); // Normal mode frame rate
227-
LCD_DataWrite_ST7789S(0x1E); // 0x0f 60Hz while FPA and BPA = 0x0C
228-
229-
LCD_CtrlWrite_ST7789S(0xD0);
230-
LCD_DataWrite_ST7789S(0xA4);
231-
LCD_DataWrite_ST7789S(0xA1);
232-
233-
LCD_CtrlWrite_ST7789S(0xE0);
234-
LCD_DataWrite_ST7789S(0xD0);
235-
LCD_DataWrite_ST7789S(0x00);
236-
LCD_DataWrite_ST7789S(0x00);
237-
LCD_DataWrite_ST7789S(0x08);
238-
LCD_DataWrite_ST7789S(0x07);
239-
LCD_DataWrite_ST7789S(0x05);
240-
LCD_DataWrite_ST7789S(0x29);
241-
LCD_DataWrite_ST7789S(0x54);
242-
LCD_DataWrite_ST7789S(0x41);
243-
LCD_DataWrite_ST7789S(0x3C);
244-
LCD_DataWrite_ST7789S(0x17);
245-
LCD_DataWrite_ST7789S(0x15);
246-
LCD_DataWrite_ST7789S(0x1A);
247-
LCD_DataWrite_ST7789S(0x20);
248-
249-
LCD_CtrlWrite_ST7789S(0xE1);
250-
LCD_DataWrite_ST7789S(0xD0);
251-
LCD_DataWrite_ST7789S(0x00);
252-
LCD_DataWrite_ST7789S(0x00);
253-
LCD_DataWrite_ST7789S(0x08);
254-
LCD_DataWrite_ST7789S(0x07);
255-
LCD_DataWrite_ST7789S(0x04);
256-
LCD_DataWrite_ST7789S(0x29);
257-
LCD_DataWrite_ST7789S(0x44);
258-
LCD_DataWrite_ST7789S(0x42);
259-
LCD_DataWrite_ST7789S(0x3B);
260-
LCD_DataWrite_ST7789S(0x16);
261-
LCD_DataWrite_ST7789S(0x15);
262-
LCD_DataWrite_ST7789S(0x1B);
263-
LCD_DataWrite_ST7789S(0x1F);
264-
185+
LCD_DataWrite_ST7789S(0x1C);
186+
LCD_DataWrite_ST7789S(0x01);
187+
LCD_DataWrite_ST7789S(0xFF);
188+
LCD_DataWrite_ST7789S(0x33);
189+
190+
LCD_CtrlWrite_ST7789S(0xB3);
191+
LCD_DataWrite_ST7789S(0x10);
192+
LCD_DataWrite_ST7789S(0xFF); // 0x05
193+
LCD_DataWrite_ST7789S(0x0F);
194+
195+
LCD_CtrlWrite_ST7789S(0xB4);
196+
LCD_DataWrite_ST7789S(0x0B);
197+
198+
LCD_CtrlWrite_ST7789S(0xB5);
199+
LCD_DataWrite_ST7789S(0x9F);
200+
201+
LCD_CtrlWrite_ST7789S(0xB7);
202+
LCD_DataWrite_ST7789S(0x35);
203+
204+
LCD_CtrlWrite_ST7789S(0xBB);
205+
LCD_DataWrite_ST7789S(0x28);
206+
207+
LCD_CtrlWrite_ST7789S(0xBC);
208+
LCD_DataWrite_ST7789S(0xEC);
209+
210+
LCD_CtrlWrite_ST7789S(0xBD);
211+
LCD_DataWrite_ST7789S(0xFE);
212+
213+
LCD_CtrlWrite_ST7789S(0xC0);
214+
LCD_DataWrite_ST7789S(0x2C);
215+
216+
LCD_CtrlWrite_ST7789S(0xC2);
217+
LCD_DataWrite_ST7789S(0x01);
218+
219+
LCD_CtrlWrite_ST7789S(0xC3);
220+
LCD_DataWrite_ST7789S(0x1E);
221+
222+
LCD_CtrlWrite_ST7789S(0xC4);
223+
LCD_DataWrite_ST7789S(0x20);
224+
225+
LCD_CtrlWrite_ST7789S(0xC6); // Normal mode frame rate
226+
LCD_DataWrite_ST7789S(0x1E); // 0x0f 60Hz while FPA and BPA = 0x0C
227+
228+
LCD_CtrlWrite_ST7789S(0xD0);
229+
LCD_DataWrite_ST7789S(0xA4);
230+
LCD_DataWrite_ST7789S(0xA1);
231+
232+
LCD_CtrlWrite_ST7789S(0xE0);
233+
LCD_DataWrite_ST7789S(0xD0);
234+
LCD_DataWrite_ST7789S(0x00);
235+
LCD_DataWrite_ST7789S(0x00);
236+
LCD_DataWrite_ST7789S(0x08);
237+
LCD_DataWrite_ST7789S(0x07);
238+
LCD_DataWrite_ST7789S(0x05);
239+
LCD_DataWrite_ST7789S(0x29);
240+
LCD_DataWrite_ST7789S(0x54);
241+
LCD_DataWrite_ST7789S(0x41);
242+
LCD_DataWrite_ST7789S(0x3C);
243+
LCD_DataWrite_ST7789S(0x17);
244+
LCD_DataWrite_ST7789S(0x15);
245+
LCD_DataWrite_ST7789S(0x1A);
246+
LCD_DataWrite_ST7789S(0x20);
247+
248+
LCD_CtrlWrite_ST7789S(0xE1);
249+
LCD_DataWrite_ST7789S(0xD0);
250+
LCD_DataWrite_ST7789S(0x00);
251+
LCD_DataWrite_ST7789S(0x00);
252+
LCD_DataWrite_ST7789S(0x08);
253+
LCD_DataWrite_ST7789S(0x07);
254+
LCD_DataWrite_ST7789S(0x04);
255+
LCD_DataWrite_ST7789S(0x29);
256+
LCD_DataWrite_ST7789S(0x44);
257+
LCD_DataWrite_ST7789S(0x42);
258+
LCD_DataWrite_ST7789S(0x3B);
259+
LCD_DataWrite_ST7789S(0x16);
260+
LCD_DataWrite_ST7789S(0x15);
261+
LCD_DataWrite_ST7789S(0x1B);
262+
LCD_DataWrite_ST7789S(0x1F);
263+
#endif
264+
265+
#ifdef _TOUCH_SCREEN_V1_1_
266+
LCD_CtrlWrite_ST7789S (0x36);
267+
LCD_DataWrite_ST7789S(0x00);
268+
LCD_CtrlWrite_ST7789S (0x3a);
269+
LCD_DataWrite_ST7789S(0x05);
270+
LCD_CtrlWrite_ST7789S (0x21);
271+
LCD_CtrlWrite_ST7789S (0x2a);
272+
LCD_DataWrite_ST7789S(0x00);
273+
LCD_DataWrite_ST7789S(0x00);
274+
LCD_DataWrite_ST7789S(0x00);
275+
LCD_DataWrite_ST7789S(0xef);
276+
LCD_CtrlWrite_ST7789S (0x2b);
277+
LCD_DataWrite_ST7789S(0x00);
278+
LCD_DataWrite_ST7789S(0x00);
279+
LCD_DataWrite_ST7789S(0x00);
280+
LCD_DataWrite_ST7789S(0xef);
281+
//--------------------------------ST7789V Frame rate setting----------------------------------//
282+
LCD_CtrlWrite_ST7789S (0xb2);
283+
LCD_DataWrite_ST7789S(0x0c);
284+
LCD_DataWrite_ST7789S(0x0c);
285+
LCD_DataWrite_ST7789S(0x00);
286+
LCD_DataWrite_ST7789S(0x33);
287+
LCD_DataWrite_ST7789S(0x33);
288+
LCD_CtrlWrite_ST7789S (0xb7);
289+
LCD_DataWrite_ST7789S(0x35);
290+
//---------------------------------ST7789V Power setting--------------------------------------//
291+
LCD_CtrlWrite_ST7789S (0xbb);
292+
LCD_DataWrite_ST7789S(0x1f);
293+
LCD_CtrlWrite_ST7789S (0xc0);
294+
LCD_DataWrite_ST7789S(0x2c);
295+
LCD_CtrlWrite_ST7789S (0xc2);
296+
LCD_DataWrite_ST7789S(0x01);
297+
LCD_CtrlWrite_ST7789S (0xc3);
298+
LCD_DataWrite_ST7789S(0x12);
299+
LCD_CtrlWrite_ST7789S (0xc4);
300+
LCD_DataWrite_ST7789S(0x20);
301+
LCD_CtrlWrite_ST7789S (0xc6);
302+
LCD_DataWrite_ST7789S(0x0f);
303+
LCD_CtrlWrite_ST7789S (0xd0);
304+
LCD_DataWrite_ST7789S(0xa4);
305+
LCD_DataWrite_ST7789S(0xa1);
306+
//--------------------------------ST7789V gamma setting--------------------------------------//
307+
LCD_CtrlWrite_ST7789S (0xe0);
308+
LCD_DataWrite_ST7789S(0xd0);
309+
LCD_DataWrite_ST7789S(0x08);
310+
LCD_DataWrite_ST7789S(0x11);
311+
LCD_DataWrite_ST7789S(0x08);
312+
LCD_DataWrite_ST7789S(0x0c);
313+
LCD_DataWrite_ST7789S(0x15);
314+
LCD_DataWrite_ST7789S(0x39);
315+
LCD_DataWrite_ST7789S(0x33);
316+
LCD_DataWrite_ST7789S(0x50);
317+
LCD_DataWrite_ST7789S(0x36);
318+
LCD_DataWrite_ST7789S(0x13);
319+
LCD_DataWrite_ST7789S(0x14);
320+
LCD_DataWrite_ST7789S(0x29);
321+
LCD_DataWrite_ST7789S(0x2d);
322+
LCD_CtrlWrite_ST7789S (0xe1);
323+
LCD_DataWrite_ST7789S(0xd0);
324+
LCD_DataWrite_ST7789S(0x08);
325+
LCD_DataWrite_ST7789S(0x10);
326+
LCD_DataWrite_ST7789S(0x08);
327+
LCD_DataWrite_ST7789S(0x06);
328+
LCD_DataWrite_ST7789S(0x06);
329+
LCD_DataWrite_ST7789S(0x39);
330+
LCD_DataWrite_ST7789S(0x44);
331+
LCD_DataWrite_ST7789S(0x51);
332+
LCD_DataWrite_ST7789S(0x0b);
333+
LCD_DataWrite_ST7789S(0x16);
334+
LCD_DataWrite_ST7789S(0x14);
335+
LCD_DataWrite_ST7789S(0x2f);
336+
LCD_DataWrite_ST7789S(0x31);
337+
LCD_CtrlWrite_ST7789S (0x29);
338+
#endif
265339
// clear the screen with black color
266340
LCD_CtrlWrite_ST7789S(0x2C);
267341
LCD_ClearAll_ST7789S(0x00);
268-
342+
269343
vm_drv_lcd_operation(VM_DRV_LCD_ENABLE_SERIAL0_2PIN);
270344
vm_drv_lcd_operation2(VM_DRV_LCD_SET_SERIAL0_IF_2PIN_SIZE, LCD_SCNF_IF_2PIN_WIDTH_16);
271345

hardware/arduino/mtk/libraries/LDisplay/utility/lcd_sitronix_st7789s.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
extern "C" {
88
#endif
99

10+
#define _TOUCH_SCREEN_V1_0_
11+
//#define _TOUCH_SCREEN_V1_1_
1012

1113
#define LCD_BASE (0xA0450000)
1214
#define LCD_INT_ENABLE_REG (LCD_BASE+0x0004)

0 commit comments

Comments
 (0)