Pinconfig für Endbadge.
[hackover2013-badge-firmware.git] / badge / ui / vanity.c
1 #include "vanity.h"
2
3 #include "display.h"
4 #include "event.h"
5 #include <drivers/fatfs/ff.h>
6
7 #define VANITY_IMAGE_FILE "/titleimg.dat"
8
9 void badge_vanity_read_from_fd(FIL *fd, badge_framebuffer *dest) {
10 UINT bytes;
11 f_read(fd, dest, sizeof(*dest), &bytes);
12 }
13
14 void badge_vanity_show(void) {
15 FIL fd;
16 badge_framebuffer fb;
17
18 unsigned min_ticks = 50;
19
20 if(FR_OK == f_open(&fd, VANITY_IMAGE_FILE, FA_OPEN_EXISTING | FA_READ)) {
21 badge_vanity_read_from_fd(&fd, &fb);
22 f_close(&fd);
23
24 badge_framebuffer_flush(&fb);
25
26 badge_event_t ev;
27
28 do {
29 ev = badge_event_wait();
30
31 if(badge_event_type(ev) == BADGE_EVENT_GAME_TICK) {
32 --min_ticks;
33 }
34 } while(min_ticks != 0);
35
36 do {
37 ev = badge_event_wait();
38 } while(badge_event_type(ev) != BADGE_EVENT_USER_INPUT);
39 }
40 }
This page took 0.048099 seconds and 5 git commands to generate.