diff options
author | makefu <github@syntax-fehler.de> | 2011-08-12 19:22:32 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2011-08-12 19:22:32 +0200 |
commit | 6a7f6e29951871c4ae90dde88c1235966716355e (patch) | |
tree | 25668331f262b367264f7ecf985bf94a934a4f5b /cholerab/bling/nick_krebs.c | |
parent | 3a08fa41ba27cd2502ee316bde3923d0e5f46969 (diff) | |
parent | f77dec5c758e381c2a07246432245312fe480221 (diff) |
Merge branch 'master' of github.com:krebscode/painload
Diffstat (limited to 'cholerab/bling/nick_krebs.c')
-rw-r--r-- | cholerab/bling/nick_krebs.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/cholerab/bling/nick_krebs.c b/cholerab/bling/nick_krebs.c new file mode 100644 index 00000000..039b7ed3 --- /dev/null +++ b/cholerab/bling/nick_krebs.c @@ -0,0 +1,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(); +} |