LCD
Source code can be downloaded from source:/Examples/LCD
Description
This demo example shows the operating of LCD Extension board.
From the main.c source file:
Initialization
1 SystemInit();
2 CGU_Init();
Init SysTick to 1ms
1 SysTick_Config(CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE) / 1000);
Configure external flash
1 MemoryPinInit();
2 EMCFlashInit();
Init LCD
1 LTV350QV_Init(intro);
Enable backligth
1 scu_pinmux(0x9, 5, MD_PLN, FUNC4); // P9_5 = GPIO5[18]
2 GPIO_SetDir(5, (1 << 18), 1);
3 GPIO_SetValue(5, (1 << 18));
Init touch controller
1 TSC2007_Init();
Execution
1 while (1)
2 {
3 static uint8_t state;
4 static uint32_t debounce;
5 uint16_t adcx, adcy;
6 int pressure = TSC2007_CheckPressure(&adcx, &adcy);
7
8 if (pressure > 0)
9 {
10 if (debounce < DEBOUNCE)
11 {
12 debounce++;
13 if (debounce >= DEBOUNCE)
14 {
15 uint32_t x = adcx * 319 / 4095;
16 uint32_t y = adcy * 239 / 4095;
17
18 switch (state)
19 {
20 // startup screen
21 case 0:
22 if (x > SHOW_DIOLAN_X1 && x < SHOW_DIOLAN_X2 && y > SHOW_DIOLAN_Y1 && y < SHOW_DIOLAN_Y2)
23 {
24 state = 1;
25 LTV350QV_SetFrameBuffer((void *)diolanInfo);
26 }
27 else if (x > SHOW_ARROW_X1 && x < SHOW_ARROW_X2 && y > SHOW_ARROW_Y1 && y < SHOW_ARROW_Y2)
28 {
29 state = 2;
30 LTV350QV_SetFrameBuffer((void *)arrowInfo);
31 }
32 break;
33 // info 1 screen
34 // info 2 screen
35 case 1:
36 case 2:
37 if (x > SHOW_INTRO_X1 && x < SHOW_INTRO_X2 && y > SHOW_INTRO_Y1 && y < SHOW_INTRO_Y2)
38 {
39 state = 0;
40 LTV350QV_SetFrameBuffer((void *)intro);
41 }
42 break;
43 }
44 }
45 }
46 }
47 else
48 {
49 debounce = 0;
50 }
51 }