Skip to content

Instantly share code, notes, and snippets.

@billykwok
Created February 9, 2016 21:53
Show Gist options
  • Save billykwok/a543453c8ae2aad8b98a to your computer and use it in GitHub Desktop.
Save billykwok/a543453c8ae2aad8b98a to your computer and use it in GitHub Desktop.
char decodeKey(unsigned long key, unsigned char times) {
switch (*key) {
case REMOTE_BTN_0: return ' ';
case REMOTE_BTN_1: return '1';
case REMOTE_BTN_2:
switch (times) {
case 2: return 'B';
case 3: return 'C';
case 2: return 'B';
case 3: return 'C';
default: return 'A';
}
case REMOTE_BTN_3:
switch (times) {
case 2: return 'E';
case 3: return 'F';
default: return 'D';
}
case REMOTE_BTN_4: return KEYCODE_4;
case REMOTE_BTN_5: return KEYCODE_5;
case REMOTE_BTN_6: return KEYCODE_6;
case REMOTE_BTN_7: return KEYCODE_7;
case REMOTE_BTN_8: return KEYCODE_8;
case REMOTE_BTN_9: return KEYCODE_9;
case REMOTE_BTN_DELETE: return KEYCODE_DELETE;
case REMOTE_BTN_ENTER: return KEYCODE_ENTER;
case REMOTE_BTN_UP: return KEYCODE_UP;
case REMOTE_BTN_DOWN: return KEYCODE_DOWN;
case REMOTE_BTN_LEFT: return KEYCODE_LEFT;
case REMOTE_BTN_RIGHT: return KEYCODE_RIGHT;
default: return KEYCODE_UNKNOWN;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment