diff options
| author | root <root@filebitch> | 2011-08-16 19:10:17 +0200 |
|---|---|---|
| committer | root <root@filebitch> | 2011-08-16 19:10:17 +0200 |
| commit | 460982f036bdc4815ea5e9447392bdb049ff2a87 (patch) | |
| tree | b27e2e3cb28b8b4ecbb3e9ba2004966241262c85 /cholerab/bling/nick_krebs.c | |
| parent | 9a9ff1d97fa5072109a4381484f5daf5a4bfb0c1 (diff) | |
| parent | 84f25017f61d87c592bcc4519bee56e49fe66083 (diff) | |
Merge branch 'master' of https://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(); +} |
