
Untitled
By: a guest on
May 8th, 2012 | syntax:
None | size: 0.69 KB | hits: 16 | expires: Never
#include <sysinit.h>
#include "basic/basic.h"
#include "lcd/render.h"
#include "lcd/backlight.h"
#define BTN_NONE 0
#define BTN_UP (1<<0)
#define BTN_DOWN (1<<1)
#define BTN_LEFT (1<<2)
#define BTN_RIGHT (1<<3)
#define BTN_ENTER (1<<4)
static const char * keyname[] = { [BTN_UP] = "up", [BTN_DOWN] = "down", [BTN_LEFT] = "left", [BTN_RIGHT] = "right", [BTN_ENTER] = "enter" };
void main_ak(void) {
int y = 0;
backlightInit();
while (1) {
lcdDisplay();
delayms(10);
int key = getInput();
if (key != BTN_NONE) {
if (y >= 70) {
lcdFill(0);
y = 0;
}
gpioSetValue(RB_LED0, !(y % 20));
gpioSetValue(RB_LED3, (y % 20));
DoString(0, y, keyname[key]);
y+=10;
}
}
}