image/svg+xml
Brteve's API for EveApps
Version 0.0.1
The reference document for common folder of EveApps project.
 
Loading...
Searching...
No Matches
Common.c
Go to the documentation of this file.
1
32#include "Common.h"
33#include <math.h>
34
35char textbuffer[1000]; // for Draw_Text_Format
36static uint32_t a;
37static uint32_t b;
38static uint32_t c;
39static uint32_t d;
40static uint32_t e;
41static uint32_t f;
42
45
52 VertextFormat = format;
53
54 switch (VertextFormat) {
55 case 0:
57 break;
58 case 1:
60 break;
61 case 2:
63 break;
64 case 3:
66 break;
67 case 4:
69 break;
70 default:
72 break;
73 }
74}
75
82bool cbCmdWait(struct EVE_HalContext* phost) {
83 (void) (phost); // suspress warning on unused
84 return true;
85}
86
93#if defined(EVE_SUPPORT_CAPACITIVE)
94 char touch_capcs_815[] = { 0xD7, 0x02, 0xD8, 0x02, 0x00, 0x80, 0x8C, 0x66,
95 0x01, 0x80, 0x8F, 0x62, 0x27, 0x61, 0x10, 0x61, 0x1D, 0x6B, 0x9C,
96 0x61, 0x00, 0x80, 0x8F, 0x67, 0x10, 0x61, 0x9D, 0x61, 0x11, 0x61,
97 0x9D, 0x61, 0x27, 0x61, 0x8C, 0x60, 0x27, 0x61, 0x11, 0x61, 0x1D,
98 0x6B, 0x9C, 0x61, 0x27, 0x61, 0x27, 0x61, 0x11, 0x61, 0x11, 0x61,
99 0x1D, 0x6B, 0x1D, 0x6B, 0x27, 0x61, 0x10, 0x61, 0x27, 0x61, 0x10,
100 0x61, 0x1D, 0x6B, 0x1D, 0x6B, 0x10, 0x61, 0x27, 0x61, 0x10, 0x61,
101 0x1D, 0x6B, 0x8C, 0x60, 0x03, 0x67, 0x8C, 0x66, 0x0A, 0x40, 0x8C,
102 0x66, 0x00, 0x80, 0x8F, 0x68, 0x10, 0x61, 0x8F, 0x68, 0x03, 0x68,
103 0x8C, 0x66, 0x10, 0x61, 0x8F, 0x6F, 0x00, 0x6A, 0x8C, 0x66, 0x33,
104 0x40, 0x8F, 0x62, 0x0E, 0x40, 0x03, 0x68, 0x3C, 0x20, 0x03, 0x61,
105 0x3D, 0x00, 0x8F, 0x60, 0x8C, 0x60, 0x0E, 0x40, 0x2D, 0x40, 0x39,
106 0x00, 0x11, 0x60, 0x8F, 0x62, 0x01, 0x80, 0x8F, 0x69, 0x00, 0x6A,
107 0x00, 0x80, 0x8C, 0x67, 0x27, 0x80, 0x01, 0x80, 0x10, 0x61, 0x33,
108 0x60, 0x8F, 0x61, 0x00, 0x80, 0x4A, 0x00, 0x11, 0x6C, 0x10, 0x61,
109 0x04, 0x40, 0x8C, 0x6C, 0x06, 0x40, 0x0B, 0x80, 0x4B, 0x40, 0x4B,
110 0x00, 0x4F, 0x40, 0x10, 0x61, 0x27, 0x61, 0x03, 0x62, 0x10, 0x61,
111 0x11, 0x6B, 0x03, 0x62, 0x10, 0x61, 0x11, 0x61, 0x1D, 0x6B, 0x03,
112 0x6F, 0x35, 0x00, 0x4F, 0x40, 0x06, 0x40, 0x27, 0x61, 0x00, 0x80,
113 0x00, 0x80, 0x1D, 0x6B, 0x11, 0x60, 0x78, 0x20, 0x24, 0x60, 0x01,
114 0x80, 0x03, 0x63, 0x71, 0x20, 0x16, 0x40, 0x58, 0x40, 0x1C, 0x40,
115 0x0E, 0x40, 0x58, 0x40, 0x1C, 0x40, 0x1D, 0x6B, 0x43, 0x40, 0x69,
116 0x00, 0x03, 0x61, 0x1C, 0x40, 0x03, 0x61, 0x8F, 0x61, 0x0E, 0x40,
117 0x14, 0x80, 0x63, 0x40, 0x27, 0x61, 0x27, 0x61, 0x12, 0x80, 0x63,
118 0x40, 0x1D, 0x6B, 0x1D, 0x6B, 0x58, 0x40, 0x16, 0x80, 0x57, 0x40,
119 0x03, 0x60, 0x22, 0x40, 0x1A, 0x80, 0x63, 0x40, 0x27, 0x61, 0x27,
120 0x61, 0x18, 0x80, 0x63, 0x40, 0x1D, 0x6B, 0x1D, 0x6B, 0x58, 0x40,
121 0x1C, 0x80, 0x57, 0x40, 0x8F, 0x60, 0x01, 0x80, 0x10, 0x61, 0x09,
122 0x80, 0x00, 0x6C, 0x10, 0x61, 0x03, 0x69, 0x8F, 0x63, 0x0C, 0x80,
123 0x00, 0x6C, 0x8F, 0x67, 0x00, 0x80, 0x9D, 0x40, 0x00, 0x66, 0xA0,
124 0x20, 0x8C, 0x60, 0x00, 0x80, 0x0A, 0x80, 0x11, 0x6C, 0xA7, 0x20,
125 0x33, 0x60, 0x8F, 0x61, 0x11, 0x60, 0xB4, 0x20, 0x40, 0x86, 0xA5,
126 0x40, 0x45, 0x40, 0xAE, 0x20, 0x03, 0x61, 0x00, 0x6A, 0xAB, 0x00,
127 0x8F, 0x61, 0xA5, 0x40, 0xA5, 0x00, 0x2C, 0x80, 0x49, 0x00, 0x2B,
128 0x80, 0x4D, 0x40, 0x01, 0x80, 0x2A, 0x80, 0x33, 0x60, 0x03, 0x61,
129 0x2A, 0x80, 0x11, 0x6C, 0x0A, 0x40, 0xC5, 0x20, 0xA5, 0x40, 0xC0,
130 0x00, 0x8F, 0x61, 0x01, 0x80, 0x2B, 0x80, 0x33, 0x60, 0x8F, 0x61,
131 0x2B, 0x80, 0x49, 0x40, 0xBB, 0x00, 0x2B, 0x80, 0x4D, 0x40, 0x00,
132 0x80, 0x2A, 0x80, 0x33, 0x60, 0x8F, 0x61, 0x2B, 0x80, 0x49, 0x40,
133 0xCF, 0x00, 0xCF, 0x40, 0xA5, 0x00, 0xCA, 0x40, 0xB5, 0x40, 0xB9,
134 0x40, 0xB5, 0x40, 0xCD, 0x00, 0xD3, 0x40, 0xB5, 0x40, 0xCD, 0x40,
135 0xB5, 0x40, 0xB9, 0x40, 0xB5, 0x40, 0xCA, 0x00, 0xC6, 0x40, 0xA5,
136 0x40, 0xBB, 0x40, 0x2A, 0x80, 0x11, 0x6C, 0xE8, 0x20, 0x03, 0x61,
137 0x2B, 0x80, 0xB5, 0x40, 0x00, 0x6C, 0xD6, 0x00, 0xCF, 0x40, 0x2B,
138 0x80, 0x33, 0x60, 0x03, 0x61, 0xA5, 0x40, 0xBB, 0x40, 0xB5, 0x40,
139 0xD6, 0x00, 0x7F, 0x80, 0x04, 0x80, 0x98, 0x00, 0x00, 0x80, 0xF7,
140 0x40, 0x41, 0x40, 0x03, 0x64, 0xD8, 0x40, 0xCF, 0x40, 0xB5, 0x40,
141 0x11, 0x60, 0x07, 0x80, 0x03, 0x69, 0xEF, 0x40, 0x11, 0x60, 0x06,
142 0x80, 0x03, 0x69, 0xEF, 0x40, 0x11, 0x60, 0x05, 0x80, 0x03, 0x69,
143 0xEF, 0x40, 0x11, 0x60, 0x04, 0x80, 0x03, 0x69, 0xEF, 0x40, 0x11,
144 0x60, 0x03, 0x80, 0x03, 0x69, 0xEF, 0x40, 0x11, 0x60, 0x02, 0x80,
145 0x03, 0x69, 0xEF, 0x40, 0x11, 0x60, 0x01, 0x80, 0x03, 0x69, 0xEF,
146 0x40, 0xEF, 0x40, 0xE4, 0x40, 0x21, 0x21, 0x00, 0x00, 0x8C, 0x60,
147 0x41, 0x40, 0xE4, 0x40, 0x8F, 0x62, 0xE4, 0x40, 0x22, 0x41, 0x22,
148 0x41, 0x22, 0x41, 0x22, 0x41, 0x22, 0x41, 0x22, 0x41, 0x22, 0x01,
149 0x01, 0x80, 0xFB, 0x40, 0x25, 0x41, 0x00, 0x80, 0xEF, 0x00, 0x02,
150 0x40, 0xEF, 0x00, 0x25, 0x41, 0x30, 0x01, 0x34, 0x41, 0x22, 0x41,
151 0x22, 0x41, 0x22, 0x41, 0x22, 0x41, 0x22, 0x41, 0x22, 0x41, 0x22,
152 0x41, 0x22, 0x41, 0x30, 0x01, 0x25, 0x41, 0x32, 0x41, 0x03, 0x61,
153 0xDD, 0x00, 0x22, 0x80, 0x53, 0x00, 0x20, 0x80, 0x53, 0x00, 0x24,
154 0x80, 0x53, 0x00, 0x21, 0x80, 0x4B, 0x40, 0x44, 0x41, 0x0E, 0x40,
155 0x46, 0x41, 0x23, 0x80, 0x53, 0x00, 0x1D, 0x6B, 0x03, 0x62, 0x27,
156 0x61, 0x8C, 0x60, 0xFF, 0xFF, 0x00, 0x66, 0x9D, 0x60, 0x55, 0x41,
157 0x06, 0x40, 0x04, 0x80, 0x37, 0x40, 0x51, 0x41, 0x44, 0x01, 0x46,
158 0x01, 0x4F, 0x01, 0x48, 0x01, 0x21, 0x80, 0x4B, 0x40, 0x25, 0x80,
159 0x4B, 0x00, 0x05, 0x80, 0x11, 0x60, 0x00, 0x6A, 0x58, 0x41, 0x45,
160 0x40, 0x66, 0x21, 0x8C, 0x60, 0x11, 0x60, 0x05, 0x80, 0x03, 0x6F,
161 0x75, 0x21, 0x01, 0x80, 0x10, 0x61, 0x03, 0x71, 0x03, 0x64, 0x76,
162 0x01, 0x8F, 0x61, 0x8C, 0x60, 0x27, 0x61, 0x00, 0x80, 0x10, 0x61,
163 0x11, 0x60, 0x82, 0x21, 0x10, 0x61, 0x11, 0x6B, 0x10, 0x40, 0x10,
164 0x61, 0x00, 0x6A, 0x7A, 0x01, 0xB5, 0x40, 0x40, 0x41, 0x03, 0x61,
165 0x0C, 0x60, 0x11, 0x60, 0x00, 0x80, 0x11, 0x60, 0x05, 0x80, 0x03,
166 0x68, 0x98, 0x21, 0x27, 0x61, 0x11, 0x60, 0x01, 0x80, 0x03, 0x63,
167 0x0A, 0x40, 0x94, 0x21, 0x11, 0x6B, 0x58, 0x41, 0x43, 0x40, 0x1D,
168 0x6B, 0x04, 0x40, 0x88, 0x01, 0x7A, 0x00, 0x03, 0x80, 0x96, 0x40,
169 0x0A, 0x00, 0xF7, 0x40, 0x5D, 0x80, 0x8F, 0x67, 0x4E, 0x81, 0xFA,
170 0x40, 0x9C, 0x41, 0xA8, 0x21, 0x08, 0x80, 0x00, 0x69, 0x80, 0x80,
171 0x03, 0x64, 0x01, 0x41, 0x01, 0x01, 0x00, 0x80, 0x0E, 0x80, 0x9E,
172 0x00, 0xA9, 0x41, 0x8C, 0x66, 0xB5, 0x40, 0x11, 0x61, 0x10, 0x40,
173 0x00, 0x80, 0x9D, 0x40, 0x03, 0x64, 0xB6, 0x21, 0x01, 0x00, 0x2D,
174 0x80, 0x00, 0x6C, 0x00, 0x67, 0xAF, 0x21, 0x7A, 0x00, 0xAC, 0x81,
175 0x9C, 0x41, 0xC4, 0x21, 0x4D, 0x80, 0xA0, 0x41, 0xDD, 0x40, 0x2D,
176 0x41, 0x40, 0x41, 0xC5, 0x01, 0x99, 0x41, 0x01, 0x80, 0x03, 0x63,
177 0x0E, 0x40, 0xAE, 0x41, 0x01, 0x80, 0x03, 0x65, 0xAE, 0x01, 0xA9,
178 0x81, 0xBC, 0x01, 0x36, 0x41, 0xFF, 0x8F, 0x8F, 0x63, 0xCE, 0x41,
179 0x36, 0x41, 0x0C, 0x80, 0x00, 0x69, 0x27, 0x61, 0xCF, 0x41, 0x36,
180 0x41, 0x03, 0x61, 0x7C, 0x40, 0x11, 0x6B, 0x5A, 0x41, 0x1D, 0x6B,
181 0x6C, 0x01, 0xFA, 0x40, 0x02, 0x80, 0x01, 0x41, 0xDD, 0x40, 0x2D,
182 0x01, 0xDE, 0x41, 0xD1, 0x81, 0x77, 0x41, 0x8F, 0x61, 0x02, 0x40,
183 0x02, 0x40, 0x55, 0x41, 0xFF, 0xFF, 0x8C, 0x60, 0xDE, 0x41, 0xCE,
184 0x41, 0xCE, 0x41, 0x06, 0x40, 0xF5, 0x21, 0x0E, 0x40, 0x7C, 0x40,
185 0xC8, 0x80, 0xF7, 0x01, 0x7A, 0x40, 0xE7, 0x41, 0xB5, 0x40, 0x40,
186 0x41, 0x4A, 0x01, 0xBB, 0x41, 0xE3, 0x41, 0x48, 0x40, 0xFA, 0x01,
187 0xCC, 0x41, 0xEC, 0x41, 0x48, 0x40, 0xFE, 0x01, 0x34, 0x41, 0x34,
188 0x41, 0x08, 0x80, 0x03, 0x71, 0x8F, 0x62, 0x9F, 0x41, 0xDD, 0x40,
189 0x2D, 0x41, 0x0F, 0x80, 0x8F, 0x63, 0x07, 0x42, 0x34, 0x41, 0x03,
190 0x61, 0x02, 0x42, 0x02, 0x42, 0xEF, 0x41, 0x9F, 0x41, 0x00, 0x80,
191 0x01, 0x41, 0xDD, 0x00, 0xCC, 0x41, 0x0C, 0x42, 0x48, 0x40, 0x16,
192 0x02, 0x34, 0x41, 0x27, 0x61, 0x02, 0x42, 0x02, 0x42, 0x34, 0x41,
193 0x03, 0x61, 0xD7, 0x01, 0x07, 0x42, 0x1A, 0x82, 0x77, 0x41, 0x12,
194 0x02, 0x00, 0x80, 0xBB, 0x41, 0x21, 0x42, 0x0C, 0x40, 0x03, 0x64,
195 0x2C, 0x22, 0x48, 0x40, 0x26, 0x02, 0x27, 0x61, 0x11, 0x6B, 0x00,
196 0x6C, 0x11, 0x67, 0x34, 0x22, 0x03, 0x61, 0x2E, 0x02, 0x0C, 0x60,
197 0x8F, 0x60, 0x11, 0x64, 0x2B, 0x00, 0x01, 0x80, 0x11, 0x61, 0x8F,
198 0x71, 0x00, 0x80, 0x11, 0x60, 0x05, 0x80, 0x03, 0x68, 0x4C, 0x22,
199 0x27, 0x61, 0x11, 0x60, 0x01, 0x80, 0x03, 0x63, 0x0A, 0x40, 0x48,
200 0x22, 0x11, 0x6B, 0x58, 0x41, 0x43, 0x40, 0x1D, 0x6B, 0x04, 0x40,
201 0x3C, 0x02, 0x7A, 0x00, 0xAC, 0x41, 0x52, 0x22, 0xE7, 0x41, 0x4A,
202 0x41, 0x53, 0x02, 0x65, 0x41, 0x29, 0x80, 0x49, 0x40, 0x0F, 0x80,
203 0x10, 0x80, 0x00, 0x6C, 0x11, 0x67, 0x5C, 0x22, 0x03, 0x61, 0x56,
204 0x02, 0x0F, 0x80, 0x00, 0x65, 0x68, 0x22, 0x0D, 0x80, 0x00, 0x6C,
205 0x11, 0x80, 0x00, 0x6C, 0x27, 0x61, 0x27, 0x61, 0x29, 0x80, 0x4D,
206 0x40, 0x56, 0x02, 0x03, 0x61, 0xAC, 0x41, 0x76, 0x22, 0x1D, 0x6B,
207 0x1D, 0x6B, 0x36, 0x42, 0x71, 0x22, 0xE7, 0x41, 0x74, 0x02, 0x0E,
208 0x40, 0x7C, 0x40, 0xC8, 0x80, 0x4A, 0x41, 0x8D, 0x02, 0x00, 0x80,
209 0x10, 0x61, 0x0F, 0x80, 0x00, 0x65, 0x8B, 0x22, 0x38, 0x42, 0x06,
210 0x40, 0x03, 0x64, 0x10, 0x61, 0x1D, 0x6B, 0x1D, 0x6B, 0x36, 0x42,
211 0x86, 0x22, 0x7A, 0x40, 0x55, 0x41, 0x87, 0x02, 0x7C, 0x40, 0x06,
212 0x40, 0x5A, 0x41, 0x10, 0x61, 0x78, 0x02, 0x03, 0x61, 0x3B, 0x42,
213 0x48, 0x40, 0x53, 0x02, 0x8C, 0x60, 0x0B, 0x80, 0x96, 0x40, 0xA0,
214 0x20, 0xFA, 0x40, 0x99, 0x41, 0x98, 0x22, 0x03, 0x80, 0xA5, 0x80,
215 0x01, 0x41, 0x01, 0x41, 0xDD, 0x40, 0xA0, 0x40, 0x00, 0x00, 0x2C,
216 0x80, 0x4D, 0x40, 0xAB, 0x40, 0xB7, 0x40, 0xAB, 0x00, 0x0E, 0x80,
217 0x96, 0x40, 0xA6, 0x22, 0x4D, 0x42, 0xB7, 0x40, 0xAC, 0x41, 0x11,
218 0x60, 0xAD, 0x22, 0xE7, 0x41, 0x4A, 0x41, 0xAE, 0x02, 0x65, 0x41,
219 0x48, 0x40, 0x02, 0x80, 0x9A, 0x41, 0xC2, 0x22, 0x9C, 0x41, 0xBF,
220 0x22, 0x01, 0x80, 0x04, 0x80, 0x4B, 0x40, 0x37, 0x80, 0x01, 0x80,
221 0x9D, 0x42, 0x04, 0x80, 0x4D, 0x40, 0x50, 0x80, 0xAB, 0x40, 0xC2,
222 0x02, 0x2C, 0x81, 0x06, 0x80, 0x9D, 0x42, 0xAC, 0x41, 0x27, 0x40,
223 0x1F, 0x41, 0x01, 0x80, 0xAB, 0x00, 0x00, 0x80, 0x9D, 0x40, 0xCB,
224 0x22, 0x90, 0x42, 0x9C, 0x41, 0xD0, 0x22, 0xAC, 0x41, 0x25, 0x22,
225 0x16, 0x42, 0xAC, 0x41, 0xFA, 0x21, 0xFE, 0x41, 0xFA, 0x40, 0xA1,
226 0x41, 0x01, 0x41, 0xDD, 0x00, 0xA2, 0x42, 0xC7, 0x02 };
227 EVE_sleep(1000);
228
229 EVE_Hal_wr8(phost, REG_CPURESET, 2);
230 EVE_Hal_wrMem(phost, RAM_JTBOOT, touch_capcs_815, sizeof(touch_capcs_815));
231 EVE_Hal_wr8(phost, REG_CPURESET, 0);
232#endif
233}
234
241 EVE_CHIPID_T chipId;
242 size_t deviceIdx;
243
244 EVE_HalParameters params;
245
246#if defined(BT8XXEMU_PLATFORM)
247 printf(BT8XXEMU_version());
248 BT8XXEMU_EmulatorParameters emulatorParams;
249#if defined(EVE_FLASH_AVAILABLE)
250 BT8XXEMU_FlashParameters flashParams;
251#endif
252#endif
253
255
256#ifdef EVE_MULTI_TARGET
257 EVE_Util_selectDeviceInteractive(&chipId, &deviceIdx);
258#else
259 chipId = EVE_SUPPORT_CHIPID;
260 deviceIdx = -1;
261#endif
262
263 EVE_Hal_defaultsEx(&params, deviceIdx);
264 params.CbCmdWait = cbCmdWait;
265
266#ifdef BT8XXEMU_PLATFORM
267 EVE_Util_emulatorDefaults(&params, &emulatorParams, chipId);
268#if defined(EVE_FLASH_AVAILABLE)
269 EVE_Util_emulatorFlashDefaults(&params, &emulatorParams, &flashParams, L"__Flash.bin");
270#endif
271#endif
272
273 EVE_Hal_open(phost, &params);
274
275#ifdef EVE_MULTI_TARGET
277#else
279#endif
280
281#ifdef DISPLAY_RESOLUTION_WXGA
283 EVE_Hal_wr8(phost, REG_CPURESET, 2);
284 EVE_Hal_wr16(phost, REG_TOUCH_CONFIG, 0x05D0); //for Goodix touch panel
285 EVE_Hal_wr8(phost, REG_CPURESET, 0);
286 EVE_sleep(300);
287#endif
288
289#if defined(BT817_ENABLE) || defined(BT818_ENABLE)
292
294 EVE_CoCmd_apiLevel(phost, 2);
295 EVE_Cmd_waitFlush(phost);
296 printf("Set APILEVEL to BT817/8 (2)\n");
297#else
298 printf("Set APILEVEL to default (1)\n");
299#endif
300
301#if defined(FT900_PLATFORM) || defined(FT93X_PLATFORM) || defined(RP2040_PLATFORM)
302 EVE_Util_loadSdCard(phost);
303#endif
304
305 // Precision control
306 Setup_Precision(4); // Default vertext format = 4
307}
308
310 EVE_Hal_close(phost);
312}
313
321 EVE_Hal_rd32(phost, REG_CLOCK); // warm up
322
323 uint32_t c0 = EVE_Hal_rd32(phost, REG_CLOCK);
324 uint32_t c1 = EVE_Hal_rd32(phost, REG_CLOCK);
325
326 uint32_t overhead = c1 - c0;
327
328 c0 = EVE_Hal_rd32(phost, REG_CLOCK);
329 EVE_sleep(1000);
330 c1 = EVE_Hal_rd32(phost, REG_CLOCK);
331
332 uint32_t freq = (uint32_t) round((c1 - c0) - overhead);
333
334 return freq;
335}
336
347 EVE_Cmd_wr32(phost, POINT_SIZE(VP(R)));
348 EVE_Cmd_wr32(phost, BEGIN(POINTS));
349 EVE_Cmd_wr32(phost, VERTEX2F(VP(Rx), VP(Ry)));
350 return 1;
351}
352
353uint32_t Draw_Image(EVE_HalContext* phost, const char* filePath,
354 uint32_t format) {
355#if defined(BT817_ENABLE) || defined(BT818_ENABLE)
356 Gpu_Hal_LoadImageToMemory(phost, filePath, RAM_G, LOADIMAGE);
357 uint32_t ptr = 0;
358 uint32_t w;
359 uint32_t h;
360 EVE_CoCmd_getProps(phost, &ptr, &w, &h);
361 Display_End(phost);
362
363 EVE_CoCmd_dlStart(phost);
364 EVE_Cmd_wr32(phost, CLEAR(1, 1, 1));
365 EVE_Cmd_wr32(phost, COLOR_RGB(255, 255, 255));
366
367 EVE_Cmd_waitFlush(phost);
368 EVE_CoCmd_setBitmap(phost, RAM_G, (uint16_t) format, (uint16_t) w,
369 (uint16_t) h);
370
371 //Start drawing bitmap
372 EVE_Cmd_wr32(phost, BEGIN(BITMAPS));
373 EVE_Cmd_wr32(phost, VERTEX2II(0, 0, 0, 0));
374 EVE_Cmd_wr32(phost, END());
376 EVE_Cmd_wr32(phost, DISPLAY());
377 EVE_CoCmd_swap(phost);
378 EVE_Cmd_waitFlush(phost);
379#endif
380 return 1;
381}
382
391
400
401void Display_StartColor(EVE_HalContext* phost, uint8_t *bgColor, uint8_t *textColor) {
402 EVE_CoCmd_dlStart(phost);
403 EVE_Cmd_wr32(phost, CLEAR_COLOR_RGB(bgColor[0], bgColor[1], bgColor[2]));
404 EVE_Cmd_wr32(phost, CLEAR(1, 1, 1));
405 EVE_Cmd_wr32(phost, COLOR_RGB(textColor[0], textColor[1], textColor[2]));
407}
408
410 Display_StartColor(phost, (uint8_t[]) { 255, 255, 255 }, (uint8_t[]) { 255, 255, 255 });
411}
412
414 EVE_Cmd_wr32(phost, DISPLAY());
415 EVE_CoCmd_swap(phost);
416 EVE_Cmd_waitFlush(phost);
417}
418
419static void Gpu_Text(EVE_HalContext* phost, const char8_t* str, uint8_t *bgColor, uint8_t *textColor) {
420 uint16_t font = 0;
421
422 if (DispWidth == 480) {
423 font = 28;
424 } else if (DispWidth == 800) {
425 font = 30;
426 } else {
427 font = 27;
428 }
429
430 Display_StartColor(phost, bgColor, textColor);
432 EVE_CoCmd_text(phost, (uint16_t) (DispWidth / 2),
433 (uint16_t) (DispHeight / 2), font, OPT_CENTERX | OPT_FILL, str);
434 Display_End(phost);
435}
436
437void Draw_TextColor(EVE_HalContext* phost, const char8_t* str, uint8_t *bgColor, uint8_t *textColor) {
438 Gpu_Text(phost, str, bgColor, textColor);
439 EVE_sleep(2000);
440}
441
442void Draw_Text(EVE_HalContext* phost, const char8_t* str) {
443 Gpu_Text(phost, str, (uint8_t[]) { 0xff, 0xff, 0xff }, (uint8_t[]) { 0, 0, 0});
444 EVE_sleep(2000);
445}
446
447void Draw_Text2(EVE_HalContext* phost, const char8_t* str, int ms) {
448 Gpu_Text(phost, str, (uint8_t[]) { 0xff, 0xff, 0xff }, (uint8_t[]) { 0, 0, 0 });
449 EVE_sleep(ms);
450}
451
453 EVE_Hal_wr16(phost, REG_SOUND, 0x0060);
454 EVE_Hal_wr8(phost, REG_PLAY, 0x01);
455}
456
457void Get_VC1Dump(EVE_HalContext* phost, const char* filename) {
458#if defined(MSVC_PLATFORM) || defined(BT8XXEMU_PLATFORM)
459#pragma warning(push)
460#pragma warning(disable : 4996)
461 FILE* vc1dump = fopen(filename, "wb");
462#pragma warning(pop)
463
464 if (!vc1dump) {
465 APP_ERR("Cannot open file %s", filename);
466 return;
467 }
468
469 const uint32_t version = 110;
470 const uint32_t w = DispWidth;
471 const uint32_t h = DispHeight;
472 const uint32_t macro0 = 0;
473 const uint32_t macro1 = 0;
474 const uint32_t CRC_IMAGE = 0;
475
476 fwrite(&version, 4, 1, vc1dump);
477 fwrite(&w, 4, 1, vc1dump);
478 fwrite(&h, 4, 1, vc1dump);
479 fwrite(&macro0, 4, 1, vc1dump);
480 fwrite(&macro1, 4, 1, vc1dump);
481 fwrite(&CRC_IMAGE, 4, 1, vc1dump);
482
483 uint8_t* buffer = malloc(RAM_G_SIZE);
484 if (!buffer) {
485 APP_ERR("Malloc failed");
486 fclose(vc1dump);
487 return;
488 }
489
490 memset(buffer, 0, RAM_G_SIZE);
492 fwrite(buffer, 1, RAM_G_SIZE, vc1dump);
493
494 memset(buffer, 0, RAM_G_SIZE);
496 fwrite(buffer, 1, EVE_DL_SIZE, vc1dump);
497
498 fclose(vc1dump);
499 free(buffer);
500#endif
501}
502
503void Play_Sound(EVE_HalContext* phost, uint8_t sound, uint8_t vol, uint8_t midi) {
504 uint16_t val = (uint16_t) ((midi << 8) | sound);
505 EVE_Hal_wr8(phost, REG_VOL_SOUND, vol);
506 EVE_Hal_wr16(phost, REG_SOUND, val);
507 EVE_Hal_wr8(phost, REG_PLAY, 1);
508}
509
511#if defined(MSVC_PLATFORM) || defined(BT8XXEMU_PLATFORM)
512 return true;
513#elif defined(FT9XX_PLATFORM)
514 return sdhost_card_detect() == SDHOST_CARD_INSERTED;
515#else
516 return true;
517#endif
518}
519
520void hintScreen(EVE_HalContext* phost, const uint8_t* msg) {
521 Draw_Text(phost, msg);
522}
523
524void Flash_Init(EVE_HalContext* phost, const uint8_t *filePath,
525 const uint8_t *fileName) {
526#if defined(_WIN32)
527#define _WHERE "PC"
528#elif defined(EMBEDDED_PLATFORM)
529#define _WHERE "SDcard"
530#endif
531
532 EVE_Util_loadSdCard(phost);
533#if !defined(BT8XXEMU_PLATFORM) && defined(EVE_FLASH_AVAILABLE)
535 if (!isSDcardDetected()) {
536 hintScreen(phost,
537 "Program the correct flash image to ensure EvChargePoint boots up successfully");
538 return;
539 } else {
541 if (!Show_Diaglog_YesNo(phost, "Flash programming",
542 "Program the flash with the file in " _WHERE "?")) {
544 return;
545 }
546
548 int sent = Ftf_Write_File_To_Flash_With_Progressbar(phost, filePath,
549 fileName, 0);
550
552 if (0 >= sent) {
553 uint8_t count = 5;
554 uint8_t msg[1000];
555 while (count) {
556#if defined(FT9XX_PLATFORM) || defined(EVE_PLATFORM_RP2040)
557 snprintf(msg, 1000, "Error: Cannot open file: %s, reset in %us",
558 filePath, count);
559#else
560 snprintf(msg, 1000, "Error: Cannot open file: %s, exit in %u s",
561 fileName, count);
562#endif
563 Show_Diaglog_Info(phost, msg);
564 EVE_sleep(1000);
565 count--;
566 }
567 exit(0);
568 }
569 }
570#endif
571}
572
573void Show_Diaglog_Info(EVE_HalContext* phost, const uint8_t* msg) {
574 uint8_t ret = INPUT_NO;
575 const uint32_t tag_y = 1;
576 const uint32_t tag_n = 2;
577
578 const uint16_t border = 2; // pixel
579 const uint16_t base_w = 800;
580 const uint16_t base_h = 600;
581 uint16_t w = 400;
582 uint16_t h = 200;
583 uint16_t x = (base_w - w) / 2;
584 uint16_t y = (base_h - h) / 2;
585 uint8_t htop = 50;
586 uint8_t hbottom = 50;
587 uint8_t font = 20;
588
589 uint16_t btn_h = 40;
590 uint16_t btn_w = 100;
591
592 uint32_t ratio = base_w * 100 / DispWidth;
593
594 if (ratio != 100) {
595 w = w * 100 / ratio;
596 h = h * 100 / ratio;
597 btn_w = btn_w * 100 / ratio;
598 btn_h = btn_h * 100 / ratio;
599 x = (DispWidth - w) / 2;
600 y = (DispHeight - h) / 2;
601 htop = htop * 100 / ratio;
602 hbottom = hbottom * 100 / ratio;
603
604 ratio += (100 - ratio) / 2;
605 font = font * 100 / ratio;
606 if (font > 31)
607 font = 31;
608 if (font < 16)
609 font = 16;
610 if (font == 17 || font == 19)
611 font = 18;
612 }
613
614 Display_Start(phost);
615
617 EVE_Cmd_wr32(phost, COLOR_RGB(0x3F, 0x3F, 0x3F));
618 EVE_Cmd_wr32(phost, BEGIN(RECTS));
619 EVE_Cmd_wr32(phost, VERTEX2F(0, 0));
621
623 EVE_Cmd_wr32(phost, COLOR_RGB(0xE1, 0xE1, 0xE1));
624 EVE_Cmd_wr32(phost, BEGIN(RECTS));
625 EVE_Cmd_wr32(phost, VERTEX2F(VP(x), VP(y)));
626 EVE_Cmd_wr32(phost, VERTEX2F(VP(x + w), VP(y + h)));
627
629 EVE_Cmd_wr32(phost, COLOR_RGB(0xFF, 0xFF, 0xFF));
630 EVE_Cmd_wr32(phost, BEGIN(RECTS));
631 EVE_Cmd_wr32(phost, VERTEX2F(VP(x + border), VP(y + border)));
632 EVE_Cmd_wr32(phost, VERTEX2F(VP(x + w - border), VP(y + h - border)));
633
635 EVE_Cmd_wr32(phost, COLOR_RGB(0xF3, 0xF3, 0xF3));
636 EVE_Cmd_wr32(phost, BEGIN(RECTS));
637 EVE_Cmd_wr32(phost, VERTEX2F(VP(x + border), VP(y + border)));
638 EVE_Cmd_wr32(phost, VERTEX2F(VP(x + w - border), VP(y + htop)));
639
641 EVE_Cmd_wr32(phost, COLOR_RGB(0xF3, 0xF3, 0xF3));
642 EVE_Cmd_wr32(phost, BEGIN(RECTS));
643 EVE_Cmd_wr32(phost, VERTEX2F(VP(x + border), VP(y + h - hbottom + border)));
644 EVE_Cmd_wr32(phost, VERTEX2F(VP(x + w - border), VP(y + h - border)));
645
646 font = font * 8 / 10;
647 if (font < 16)
648 font = 16;
649 if (font == 17 || font == 19)
650 font = 18;
651 EVE_Cmd_wr32(phost, COLOR_RGB(0x78, 0x78, 0x78));
652 EVE_CoCmd_text(phost, x + border + 30, y + h / 2 - 20, font, 0, msg);
653
654 Display_End(phost);
655
656}
657
659 const uint8_t* msg) {
660 uint8_t ret = INPUT_NO;
661 const uint32_t tag_y = 1;
662 const uint32_t tag_n = 2;
663
664 const uint16_t border = 2; // pixel
665 const uint16_t base_w = 800;
666 const uint16_t base_h = 600;
667 uint16_t w = 400;
668 uint16_t h = 200;
669 uint16_t x = (base_w - w) / 2;
670 uint16_t y = (base_h - h) / 2;
671 uint8_t htop = 50;
672 uint8_t hbottom = 50;
673 uint8_t font = 20;
674
675 uint16_t btn_h = 30;
676 uint16_t btn_w = 80;
677
678 uint32_t ratio = base_w * 100 / DispWidth;
679
680 if (ratio != 100) {
681 w = w * 100 / ratio;
682 h = h * 100 / ratio;
683 btn_w = btn_w * 100 / ratio;
684 btn_h = btn_h * 100 / ratio;
685 x = (DispWidth - w) / 2;
686 y = (DispHeight - h) / 2;
687 htop = htop * 100 / ratio;
688 hbottom = hbottom * 100 / ratio;
689
690 ratio += (100 - ratio) / 2;
691 font = font * 100 / ratio;
692 if (font > 31)
693 font = 31;
694 if (font < 16)
695 font = 16;
696 if (font == 17 || font == 19)
697 font = 18;
698 }
699
700 do {
701 Display_Start(phost);
702
704 EVE_Cmd_wr32(phost, COLOR_RGB(0x3F, 0x3F, 0x3F));
705 EVE_Cmd_wr32(phost, BEGIN(RECTS));
706 EVE_Cmd_wr32(phost, VERTEX2F(0, 0));
708
710 EVE_Cmd_wr32(phost, COLOR_RGB(0xE1, 0xE1, 0xE1));
711 EVE_Cmd_wr32(phost, BEGIN(RECTS));
712 EVE_Cmd_wr32(phost, VERTEX2F(VP(x), VP(y)));
713 EVE_Cmd_wr32(phost, VERTEX2F(VP(x + w), VP(y + h)));
714
716 EVE_Cmd_wr32(phost, COLOR_RGB(0xFF, 0xFF, 0xFF));
717 EVE_Cmd_wr32(phost, BEGIN(RECTS));
718 EVE_Cmd_wr32(phost, VERTEX2F(VP(x + border), VP(y + border)));
719 EVE_Cmd_wr32(phost, VERTEX2F(VP(x + w - border), VP(y + h - border)));
720
722 EVE_Cmd_wr32(phost, COLOR_RGB(0x46, 0x50, 0x52));
723 EVE_Cmd_wr32(phost, BEGIN(RECTS));
724 EVE_Cmd_wr32(phost, VERTEX2F(VP(x + border), VP(y + border)));
725 EVE_Cmd_wr32(phost, VERTEX2F(VP(x + w - border), VP(y + htop)));
726
728 EVE_Cmd_wr32(phost, COLOR_RGB(0xF3, 0xF3, 0xF3));
729 EVE_Cmd_wr32(phost, BEGIN(RECTS));
730 EVE_Cmd_wr32(phost,
731 VERTEX2F(VP(x + border), VP(y + h - hbottom + border)));
732 EVE_Cmd_wr32(phost, VERTEX2F(VP(x + w - border), VP(y + h - border)));
733
735 EVE_Cmd_wr32(phost, COLOR_RGB(0xFF, 0xFF, 0xFF));
736 EVE_CoCmd_text(phost, x + border + 10, y + border + 10, font, 0, title);
737
738 uint32_t font2 = font * 8 / 10;
739 if (font2 < 16)
740 font2 = 16;
741 if (font2 == 17 || font2 == 19)
742 font2 = 18;
743 EVE_Cmd_wr32(phost, COLOR_RGB(0x78, 0x78, 0x78));
744 EVE_CoCmd_fillWidth(phost, w);
745 EVE_CoCmd_text(phost, x + border + 30, y + h / 2 - 20, font2, OPT_FILL, msg);
746
748 EVE_Cmd_wr32(phost, COLOR_RGB(0xFF, 0xFF, 0xFF));
749 const uint16_t btn_margin = 25;
750 EVE_Cmd_wr32(phost, TAG(tag_y));
751 EVE_CoCmd_button(phost, x + w / 2 - btn_w - btn_margin,
752 y + h - hbottom + border + (hbottom - btn_h) / 2, btn_w, btn_h,
753 font, 0, "Yes");
754
755 EVE_Cmd_wr32(phost, TAG(tag_n));
756 EVE_CoCmd_button(phost, x + w / 2 + btn_margin,
757 y + h - hbottom + border + (hbottom - btn_h) / 2, btn_w, btn_h,
758 font, 0, "No");
759
760 Display_End(phost);
761
762 Gesture_Renew(phost);
763 if (Gesture_Get()->tagReleased == tag_y) {
764 return true;
765 } else if (Gesture_Get()->tagReleased == tag_n) {
766 return false;
767 }
768 } while (true);
769
770 return false;
771}
772
773/* This image contains cells: 32x32
774Cell 0: Home
775Cell 1: Star
776Cell 2: Down triangle
777Cell 3: Up triangle
778Cell 4: Right triangle (Play button icon)
779Size: 460 bytes */
780PROGMEM prog_uchar8_t home_start_icon[] = {0x78,0x9C,0xE5,0x94,0xBF,0x4E,0xC2,0x40,0x1C,0xC7,0x7F,0x2D,0x04,0x8B,0x20,0x45,0x76,0x14,0x67,0xA3,0xF1,0x0D,0x64,0x75,0xD2,0xD5,0x09,0x27,0x17,0x13,0xE1,0x0D,0xE4,0x0D,0x78,0x04,0x98,0x5D,0x30,0x26,0x0E,0x4A,0xA2,0x3E,0x82,0x0E,0x8E,0x82,0xC1,0x38,0x62,0x51,0x0C,0x0A,0x42,0x7F,0xDE,0xB5,0x77,0xB4,0x77,0x17,0x28,0x21,0x26,0x46,0xFD,0x26,0xCD,0xE5,0xD3,0x7C,0xFB,0xBB,0xFB,0xFD,0xB9,0x02,0xCC,0xA4,0xE8,0x99,0x80,0x61,0xC4,0x8A,0x9F,0xCB,0x6F,0x31,0x3B,0xE3,0x61,0x7A,0x98,0x84,0x7C,0x37,0xF6,0xFC,0xC8,0xDD,0x45,0x00,0xDD,0xBA,0xC4,0x77,0xE6,0xEE,0x40,0xEC,0x0E,0xE6,0x91,0xF1,0xD2,0x00,0x42,0x34,0x5E,0xCE,0xE5,0x08,0x16,0xA0,0x84,0x68,0x67,0xB4,0x86,0xC3,0xD5,0x26,0x2C,0x20,0x51,0x17,0xA2,0xB8,0x03,0xB0,0xFE,0x49,0xDD,0x54,0x15,0xD8,0xEE,0x73,0x37,0x95,0x9D,0xD4,0x1A,0xB7,0xA5,0x26,0xC4,0x91,0xA9,0x0B,0x06,0xEE,0x72,0xB7,0xFB,0xC5,0x16,0x80,0xE9,0xF1,0x07,0x8D,0x3F,0x15,0x5F,0x1C,0x0B,0xFC,0x0A,0x90,0xF0,0xF3,0x09,0xA9,0x90,0xC4,0xC6,0x37,0xB0,0x93,0xBF,0xE1,0x71,0xDB,0xA9,0xD7,0x41,0xAD,0x46,0xEA,0x19,0xA9,0xD5,0xCE,0x93,0xB3,0x35,0x73,0x0A,0x69,0x59,0x91,0xC3,0x0F,0x22,0x1B,0x1D,0x91,0x13,0x3D,0x91,0x73,0x43,0xF1,0x6C,0x55,0xDA,0x3A,0x4F,0xBA,0x25,0xCE,0x4F,0x04,0xF1,0xC5,0xCF,0x71,0xDA,0x3C,0xD7,0xB9,0xB2,0x48,0xB4,0x89,0x38,0x20,0x4B,0x2A,0x95,0x0C,0xD5,0xEF,0x5B,0xAD,0x96,0x45,0x8A,0x41,0x96,0x7A,0x1F,0x60,0x0D,0x7D,0x22,0x75,0x82,0x2B,0x0F,0xFB,0xCE,0x51,0x3D,0x2E,0x3A,0x21,0xF3,0x1C,0xD9,0x38,0x86,0x2C,0xC6,0x05,0xB6,0x7B,0x9A,0x8F,0x0F,0x97,0x1B,0x72,0x6F,0x1C,0xEB,0xAE,0xFF,0xDA,0x97,0x0D,0xBA,0x43,0x32,0xCA,0x66,0x34,0x3D,0x54,0xCB,0x24,0x9B,0x43,0xF2,0x70,0x3E,0x42,0xBB,0xA0,0x95,0x11,0x37,0x46,0xE1,0x4F,0x49,0xC5,0x1B,0xFC,0x3C,0x3A,0x3E,0xD1,0x65,0x0E,0x6F,0x58,0xF8,0x9E,0x5B,0xDB,0x55,0xB6,0x41,0x34,0xCB,0xBE,0xDB,0x87,0x5F,0xA9,0xD1,0x85,0x6B,0xB3,0x17,0x9C,0x61,0x0C,0x9B,0xA2,0x5D,0x61,0x10,0xED,0x2A,0x9B,0xA2,0x5D,0x61,0x10,0xED,0x2A,0x9B,0xA2,0x5D,0x61,0x10,0xED,0x2A,0x9B,0xED,0xC9,0xFC,0xDF,0x14,0x54,0x8F,0x80,0x7A,0x06,0xF5,0x23,0xA0,0x9F,0x41,0xF3,0x10,0x30,0x4F,0x41,0xF3,0x18,0x30,0xCF,0xCA,0xFC,0xFF,0x35,0xC9,0x79,0xC9,0x89,0xFA,0x33,0xD7,0x1D,0xF6,0x5E,0x84,0x5C,0x56,0x6E,0xA7,0xDA,0x1E,0xF9,0xFA,0xAB,0xF5,0x97,0xFF,0x2F,0xED,0x89,0x7E,0x29,0x9E,0xB4,0x9F,0x74,0x1E,0x69,0xDA,0xA4,0x9F,0x81,0x94,0xEF,0x4F,0xF6,0xF9,0x0B,0xF4,0x65,0x51,0x08};
781
782void WelcomeScreen(Gpu_Hal_Context_t *phost, char* info[])
783{
785 Gpu_Hal_WrCmd32(phost, 0);
786#if defined(MSVC_PLATFORM) || defined(MSVC_FT800EMU)
787 EVE_Cmd_wrMem(phost,home_start_icon,sizeof(home_start_icon)); //Load from RAM
788#else
789 EVE_Cmd_wrProgMem(phost,home_start_icon,sizeof(home_start_icon)); //Load from Flash
790#endif
791 EVE_Cmd_waitFlush(phost);
792
793 Display_Start(phost);
794 EVE_Cmd_wr32(phost, BITMAP_HANDLE(0)); // handle for background stars
795 EVE_Cmd_wr32(phost, BITMAP_SOURCE(0)); // Starting address in gram
796 EVE_Cmd_wr32(phost, BITMAP_LAYOUT(L4, 16, 32)); // format
797 EVE_Cmd_wr32(phost, BITMAP_SIZE(NEAREST, BORDER, BORDER, 32, 32 ));
798 Display_End(phost);
799
800 do
801 {
802 Display_StartColor(phost, (uint8_t[]) { 255, 255, 255 }, (uint8_t[]) { 219, 180, 150 });
803 EVE_Cmd_wr32(phost, SAVE_CONTEXT());
804 EVE_Cmd_wr32(phost, COLOR_A(220));
806 EVE_Cmd_wr32(phost, VERTEX2F(0, VP(DispHeight)));
808 EVE_Cmd_wr32(phost, COLOR_A(255));
809 EVE_Cmd_wr32(phost, RESTORE_CONTEXT());
810 EVE_Cmd_wr32(phost, COLOR_RGB(0, 0, 0));
811
812 // information
813 EVE_CoCmd_text(phost, DispWidth/2, 20, 28, OPT_CENTER , info[0]);
814 EVE_CoCmd_text(phost, DispWidth/2, 60, 26, OPT_CENTERX , info[1]);
815 EVE_CoCmd_text(phost, DispWidth/2, 80, 26, OPT_CENTERX , info[2]);
816 EVE_CoCmd_text(phost, DispWidth/2, 100, 26, OPT_CENTERX, info[3]);
817 EVE_CoCmd_text(phost, DispWidth/2, DispHeight/2 - 32, 26, OPT_CENTER, "Click to play");
818
819 // play button circle boundary
820 EVE_Cmd_wr32(phost, COLOR_RGB(100, 100, 100));
821 EVE_Cmd_wr32(phost, BEGIN(FTPOINTS));
822 EVE_Cmd_wr32(phost, POINT_SIZE(20*16));
823 EVE_Cmd_wr32(phost, TAG('P'));
825 EVE_Cmd_wr32(phost, COLOR_RGB(180, 35, 35));
826
827 // play button
828 EVE_Cmd_wr32(phost, BEGIN(BITMAPS));
829 EVE_Cmd_wr32(phost, CELL(4));
830 EVE_Cmd_wr32(phost, VERTEX2F(VP(DispWidth/2 -14), VP(DispHeight/2 - 15)));
831 EVE_Cmd_wr32(phost, END());
832 Display_End(phost);
833
834 }while(Gpu_Hal_Rd8(phost, REG_TOUCH_TAG)!='P');
835 Play_Sound(phost, 0x50, 255, 0xc0);
836}
PROGMEM prog_uchar8_t home_start_icon[]
Definition Common.c:780
static uint32_t a
Definition Common.c:36
void Draw_TextColor(EVE_HalContext *phost, const char8_t *str, uint8_t *bgColor, uint8_t *textColor)
Definition Common.c:437
void Calibration_Save(EVE_HalContext *phost)
Definition Common.c:392
void Get_VC1Dump(EVE_HalContext *phost, const char *filename)
Definition Common.c:457
void hintScreen(EVE_HalContext *phost, const uint8_t *msg)
Definition Common.c:520
static uint32_t b
Definition Common.c:37
void Display_StartColor(EVE_HalContext *phost, uint8_t *bgColor, uint8_t *textColor)
Definition Common.c:401
bool cbCmdWait(struct EVE_HalContext *phost)
Callback function.
Definition Common.c:82
void Display_Start(EVE_HalContext *phost)
Definition Common.c:409
void Calibration_Restore(EVE_HalContext *phost)
Definition Common.c:383
static uint32_t d
Definition Common.c:39
void Setup_Precision(uint32_t format)
Setup vertex format and precision.
Definition Common.c:51
void Show_Diaglog_Info(EVE_HalContext *phost, const uint8_t *msg)
Definition Common.c:573
void Play_Sound(EVE_HalContext *phost, uint8_t sound, uint8_t vol, uint8_t midi)
Definition Common.c:503
uint32_t VertextPrecision
Definition Common.c:44
static void Gpu_Text(EVE_HalContext *phost, const char8_t *str, uint8_t *bgColor, uint8_t *textColor)
Definition Common.c:419
uint32_t Draw_Image(EVE_HalContext *phost, const char *filePath, uint32_t format)
Definition Common.c:353
char textbuffer[1000]
Definition Common.c:35
static uint32_t e
Definition Common.c:40
void Gpu_Release(EVE_HalContext *phost)
Definition Common.c:309
void Gpu_Init(EVE_HalContext *phost)
EVE initialzation.
Definition Common.c:240
void Display_End(EVE_HalContext *phost)
Definition Common.c:413
uint32_t VertextFormat
Definition Common.c:43
uint8_t Show_Diaglog_YesNo(EVE_HalContext *phost, const uint8_t *title, const uint8_t *msg)
Definition Common.c:658
void Play_MuteSound(EVE_HalContext *phost)
Definition Common.c:452
uint32_t Draw_Point(EVE_HalContext *phost, uint32_t Rx, uint32_t Ry, uint32_t R)
Helper function to draw a point.
Definition Common.c:346
uint8_t isSDcardDetected()
Definition Common.c:510
static uint32_t c
Definition Common.c:38
void Draw_Text(EVE_HalContext *phost, const char8_t *str)
Definition Common.c:442
void Init_CapacitiveTouch(EVE_HalContext *phost)
Capacitive Touch initialzation.
Definition Common.c:92
uint32_t Get_SystemClock(EVE_HalContext *phost)
Get system frequency in Hz.
Definition Common.c:320
void Draw_Text2(EVE_HalContext *phost, const char8_t *str, int ms)
Definition Common.c:447
void Flash_Init(EVE_HalContext *phost, const uint8_t *filePath, const uint8_t *fileName)
Definition Common.c:524
static uint32_t f
Definition Common.c:41
void WelcomeScreen(Gpu_Hal_Context_t *phost, char *info[])
Definition Common.c:782
Common functions.
#define APP_ERR
Definition Common.h:92
#define VP(x)
Definition Common.h:66
#define INPUT_NO
Definition Common.h:108
EVE_HAL_EXPORT bool EVE_Cmd_wrMem(EVE_HalContext *phost, const uint8_t *buffer, uint32_t size)
Write buffer to Coprocessor's comand fifo.
Definition EVE_Cmd.c:291
EVE_HAL_EXPORT bool EVE_Cmd_wr32(EVE_HalContext *phost, uint32_t value)
Write 4 bytes to Coprocessor's command fifo.
Definition EVE_Cmd.c:394
EVE_HAL_EXPORT bool EVE_Cmd_wrProgMem(EVE_HalContext *phost, eve_progmem_const uint8_t *buffer, uint32_t size)
Write buffer in ProgMem to Coprocessor's comand fifo.
Definition EVE_Cmd.c:307
static void EVE_CoCmd_setBitmap(EVE_HalContext *phost, uint32_t source, uint16_t fmt, uint16_t w, uint16_t h)
Send CMD_SETBITMAP.
Definition EVE_CoCmd.h:1184
EVE_HAL_EXPORT bool EVE_CoCmd_getProps(EVE_HalContext *phost, uint32_t *ptr, uint32_t *w, uint32_t *h)
Get the image properties decompressed by CMD_LOADIMAGE.
static void EVE_CoCmd_swap(EVE_HalContext *phost)
Send CMD_SWAP.
Definition EVE_CoCmd.h:170
EVE_HAL_EXPORT void EVE_CoCmd_button(EVE_HalContext *phost, int16_t x, int16_t y, int16_t w, int16_t h, int16_t font, uint16_t options, const char *s,...)
Send CMD_BUTTON.
EVE_HAL_EXPORT void EVE_CoCmd_text(EVE_HalContext *phost, int16_t x, int16_t y, int16_t font, uint16_t options, const char *s,...)
Send CMD_TEXT.
static void EVE_CoCmd_fillWidth(EVE_HalContext *phost, uint32_t s)
Send CMD_FILLWIDTH.
Definition EVE_CoCmd.h:1238
#define EVE_CoCmd_apiLevel(phost, level)
Definition EVE_CoCmd.h:352
static void EVE_CoCmd_dlStart(EVE_HalContext *phost)
Send CMD_DLSTART.
Definition EVE_CoCmd.h:159
#define EVE_SUPPORT_CHIPID
#define REG_TOUCH_CONFIG
#define VERTEX2F(x, y)
#define OPT_FILL
#define REG_TOUCH_TAG
#define POINT_SIZE(size)
#define SAVE_CONTEXT()
#define NEAREST
#define REG_VOL_SOUND
#define CLEAR(c, s, t)
#define REG_TOUCH_TRANSFORM_D
#define BITMAP_LAYOUT(format, linestride, height)
#define VERTEX_FORMAT(frac)
#define BEGIN(prim)
#define BITMAPS
#define BITMAP_HANDLE(handle)
#define L4
#define FTPOINTS
#define DISPLAY()
#define REG_ADAPTIVE_FRAMERATE
#define RESTORE_CONTEXT()
#define END()
#define RECTS
#define COLOR_RGB(red, green, blue)
#define CMD_INFLATE
#define TAG(s)
#define BITMAP_SOURCE(addr)
#define OPT_CENTERX
#define BORDER
#define REG_TOUCH_TRANSFORM_F
#define RAM_DL
Definition EVE_GpuDefs.h:95
#define RAM_JTBOOT
#define REG_CPURESET
#define OPT_CENTER
#define REG_SOUND
#define REG_TOUCH_TRANSFORM_B
#define REG_TOUCH_TRANSFORM_C
#define EDGE_STRIP_A
#define RAM_G_SIZE
Definition EVE_GpuDefs.h:98
#define BITMAP_SIZE(filter, wrapx, wrapy, width, height)
#define REG_TOUCH_TRANSFORM_E
#define REG_CLOCK
#define REG_PLAY
#define COLOR_A(alpha)
#define CELL(cell)
#define REG_TOUCH_TRANSFORM_A
#define RAM_G
Definition EVE_GpuDefs.h:77
#define CLEAR_COLOR_RGB(red, green, blue)
#define POINTS
#define VERTEX2II(x, y, handle, cell)
#define EVE_DL_SIZE
Definition EVE_GpuDefs.h:56
EVE_HAL_EXPORT uint32_t EVE_Hal_rd32(EVE_HalContext *phost, uint32_t addr)
Read 4 bytes from Coprocessor's memory.
Definition EVE_Hal.c:189
EVE_HAL_EXPORT void EVE_Hal_rdMem(EVE_HalContext *phost, uint8_t *result, uint32_t addr, uint32_t size)
Read a block data from Coprocessor's memory.
Definition EVE_Hal.c:206
EVE_HAL_EXPORT void EVE_Hal_defaultsEx(EVE_HalParameters *parameters, size_t deviceIdx)
Setup default parameters for Eve_Hal framework.
Definition EVE_Hal.c:89
EVE_HAL_EXPORT bool EVE_Hal_open(EVE_HalContext *phost, const EVE_HalParameters *parameters)
Open the Eve_Hal framework.
Definition EVE_Hal.c:103
EVE_HAL_EXPORT void EVE_Hal_wr8(EVE_HalContext *phost, uint32_t addr, uint8_t v)
Write 8 bits to Coprocessor's memory.
Definition EVE_Hal.c:220
EVE_HAL_EXPORT void EVE_Hal_close(EVE_HalContext *phost)
Close the Eve_Hal framework.
Definition EVE_Hal.c:116
EVE_HAL_EXPORT void EVE_Hal_wr16(EVE_HalContext *phost, uint32_t addr, uint16_t v)
Write 2 bytes to Coprocessor's memory.
Definition EVE_Hal.c:234
EVE_HAL_EXPORT void EVE_Hal_wr32(EVE_HalContext *phost, uint32_t addr, uint32_t v)
Write 4 bytes to Coprocessor's memory.
Definition EVE_Hal.c:248
EVE_HAL_EXPORT void EVE_Hal_wrMem(EVE_HalContext *phost, uint32_t addr, const uint8_t *buffer, uint32_t size)
Write a buffer to Coprocessor's memory.
Definition EVE_Hal.c:263
EVE_HAL_EXPORT EVE_HalPlatform * EVE_Hal_initialize()
Eve_Hal framework initialization.
Definition EVE_Hal.c:52
EVE_HAL_EXPORT void EVE_Hal_release()
Close Eve_Hal framework.
Definition EVE_Hal.c:64
EVE_HAL_EXPORT void EVE_sleep(uint32_t ms)
Sleep in milisecond.
EVE_CHIPID_T
Definition EVE_HalDefs.h:72
unsigned short uint16_t
unsigned int uint32_t
unsigned char uint8_t
EVE_HAL_EXPORT bool EVE_Util_loadSdCard(EVE_HalContext *phost)
Mount the SDcard.
EVE_HAL_EXPORT bool EVE_Util_bootupConfigInteractive(EVE_HalContext *phost, EVE_DISPLAY_T display)
Calls EVE_Util_bootup and EVE_Util_config using the default parameters. Falls back to no interactivit...
Definition EVE_Util.c:2582
EVE_HAL_EXPORT bool EVE_Util_bootupConfig(EVE_HalContext *phost)
Bootup Coprocessor.
Definition EVE_Util.c:1898
static void EVE_Util_selectDeviceInteractive(EVE_CHIPID_T *chipId, size_t *deviceIdx)
Definition EVE_Util.h:178
@ EVE_DISPLAY_DEFAULT
Definition EVE_Util.h:102
static ft_uint32_t ft_uint8_t * buffer
Definition FT_Gpu_Hal.h:139
Gesture_Touch_t * Gesture_Get()
Get gesture data.
Definition Gesture.c:198
Gesture_Touch_t * Gesture_Renew(Gpu_Hal_Context_t *phost)
Refresh gesture data.
Definition Gesture.c:173
void EVE_Cmd_waitFlush(EVE_HalContext *host)
Definition Gpu_Hal.cpp:775
void Gpu_Hal_LoadImageToMemory(EVE_HalContext *host, char8_t *fileName, uint32_t destination, uint8_t type)
Definition Gpu_Hal.cpp:1361
#define DispHeight
Definition Gpu_Hal.h:106
#define DispWidth
Definition Gpu_Hal.h:105
#define PROGMEM
Definition Gpu_Hal.h:72
#define Gpu_Hal_WrCmd32
Definition Gpu_Hal.h:225
#define Gpu_Hal_Context_t
Definition Gpu_Hal.h:134
#define Gpu_Hal_Rd8
Definition Gpu_Hal.h:204
#define LOADIMAGE
Definition Platform.h:182
PROGMEM const unsigned char prog_uchar8_t
Definition Platform.h:204
BT8XXEMU_API const char * BT8XXEMU_version()
EVE_Callback CbCmdWait