1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#include <sysinit.h>
#include "basic/basic.h"
#include "basic/config.h"
#include "lcd/lcd.h"
#include "lcd/print.h"
#include "filesystem/ff.h"
#include "usetable.h"
#define IMAGEFILE "krebs.lcd"
void ram(void) {
FIL file;
int res;
UINT readbytes;
uint8_t state = 0;
int dx, dy, dwidth;
uint32_t framems = 100;
res = f_open(&file, IMAGEFILE, FA_OPEN_EXISTING|FA_READ);
if(res)
return;
/* calculate height */
setExtFont(GLOBAL(nickfont));
dwidth = DoString(0, 0, GLOBAL(nickname));
dy = (RESY - getFontHeight());
dx = (95 - dwidth)/2;
getInputWaitRelease();
while(!getInputRaw()) {
lcdFill(0x55);
res = f_read(&file, (char *)lcdBuffer, RESX*RESY_B, &readbytes);
if (res)
return;
if (readbytes < RESX*RESY_B) {
f_lseek(&file, 0);
continue;
}
setExtFont(GLOBAL(nickfont));
DoString(dx, dy, GLOBAL(nickname));
lcdDisplay();
if(framems < 100) {
state = delayms_queue_plus(framems, 0);
} else {
getInputWaitTimeout(framems);
}
}
if(state)
work_queue();
}
|