summaryrefslogtreecommitdiffstats
path: root/cholerab
diff options
context:
space:
mode:
authorLassulus <Lassulus@googlemail.com>2011-08-12 19:17:29 +0200
committerLassulus <Lassulus@googlemail.com>2011-08-12 19:17:29 +0200
commitf77dec5c758e381c2a07246432245312fe480221 (patch)
tree0f4f685f3eed30e62862b19a80d0ea91005fae3a /cholerab
parentdb66373e6bb5fae804031e11b5cbdfc5e6d206bc (diff)
added nick_krebs for r0ket
Diffstat (limited to 'cholerab')
-rw-r--r--cholerab/bling/nick_krebs.c60
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();
+}