-
-
Save akrennmair/1129883 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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