Skip to content

Instantly share code, notes, and snippets.

@akrennmair
Created August 6, 2011 23:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akrennmair/1129883 to your computer and use it in GitHub Desktop.
Save akrennmair/1129883 to your computer and use it in GitHub Desktop.
#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;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment