1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
27
28
32
33
34
35
36
37
38
39
40
41
42
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
74
79
80
81
82
88
89
90
91
92
93
94
95
96
102
103
104
105
106
107
108
109
110
111
112
113
119
125
126
127
128
131
132
/* ... */
#include "k_bsp.h"
#include "k_calibration.h"
#include "GUI.h"
#include "DIALOG.h"
/* ... */
/* ... */
Includes
/* ... */
void k_BspInit(void)
{
BSP_LED_Init(LED1);
BSP_LED_Init(LED2);
BSP_LED_Init(LED3);
BSP_LED_Init(LED4);
BSP_SDRAM_Init();
BSP_TS_Init(640, 480);
__HAL_RCC_CRC_CLK_ENABLE();
__HAL_RCC_BKPSRAM_CLK_ENABLE();
}{ ... }
/* ... */
void k_BspAudioInit(void)
{
BSP_AUDIO_OUT_Init(OUTPUT_DEVICE_AUTO, AUDIO_DEFAULT_VOLUME, I2S_AUDIOFREQ_44K);
BSP_AUDIO_OUT_SetAudioFrameSlot(CODEC_AUDIOFRAME_SLOT_02);
}{ ... }
/* ... */
void k_TouchUpdate(void)
{
static GUI_PID_STATE TS_State = {0, 0, 0, 0};
__IO TS_StateTypeDef ts;
uint16_t xDiff, yDiff;
BSP_TS_GetState((TS_StateTypeDef *)&ts);
if((ts.x >= LCD_GetXSize()) ||(ts.y >= LCD_GetYSize()) )
{
ts.x = 0;
ts.y = 0;
ts.TouchDetected =0;
}if ((ts.x >= LCD_GetXSize()) ||(ts.y >= LCD_GetYSize())) { ... }
xDiff = (TS_State.x > ts.x) ? (TS_State.x - ts.x) : (ts.x - TS_State.x);
yDiff = (TS_State.y > ts.y) ? (TS_State.y - ts.y) : (ts.y - TS_State.y);
if((TS_State.Pressed != ts.TouchDetected ) ||
(xDiff > 30 )||
(yDiff > 30))
{
TS_State.Pressed = ts.TouchDetected;
TS_State.Layer = 0;
if(ts.TouchDetected)
{
TS_State.x = ts.x;
TS_State.y = ts.y;
GUI_TOUCH_StoreStateEx(&TS_State);
}if (ts.TouchDetected) { ... }
else
{
GUI_TOUCH_StoreStateEx(&TS_State);
TS_State.x = 0;
TS_State.y = 0;
}else { ... }
}if ((TS_State.Pressed != ts.TouchDetected ) || (xDiff > 30 )|| (yDiff > 30)) { ... }
}{ ... }
/* ... */
/* ... */