diff options
Diffstat (limited to 'apps/keymaps/keymap-hm60x.c')
-rw-r--r-- | apps/keymaps/keymap-hm60x.c | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/apps/keymaps/keymap-hm60x.c b/apps/keymaps/keymap-hm60x.c new file mode 100644 index 0000000000..3f75ac82d4 --- /dev/null +++ b/apps/keymaps/keymap-hm60x.c | |||
@@ -0,0 +1,88 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2011 Andrew Ryabinin | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | /* Button Code Definitions for HiFiMAN HM-601 reference design target */ | ||
23 | |||
24 | #include "config.h" | ||
25 | #include "action.h" | ||
26 | #include "button.h" | ||
27 | |||
28 | /* | ||
29 | * The format of the list is as follows | ||
30 | * { Action Code, Button code, Prereq button code } | ||
31 | * if there's no need to check the previous button's value, use BUTTON_NONE | ||
32 | * Insert LAST_ITEM_IN_LIST at the end of each mapping | ||
33 | */ | ||
34 | static const struct button_mapping button_context_standard[] = { | ||
35 | { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE }, | ||
36 | { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
37 | { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE }, | ||
38 | { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
39 | |||
40 | { ACTION_STD_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, | ||
41 | { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE }, | ||
42 | { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, | ||
43 | { ACTION_STD_MENU, BUTTON_RIGHT, BUTTON_NONE }, | ||
44 | |||
45 | LAST_ITEM_IN_LIST | ||
46 | }; /* button_context_standard */ | ||
47 | |||
48 | static const struct button_mapping button_context_wps[] = { | ||
49 | { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, | ||
50 | { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, | ||
51 | { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, | ||
52 | { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
53 | { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT }, | ||
54 | { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT}, | ||
55 | { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
56 | { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT }, | ||
57 | |||
58 | { ACTION_WPS_BROWSE, BUTTON_UP|BUTTON_REL, BUTTON_UP }, | ||
59 | { ACTION_WPS_CONTEXT, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP }, | ||
60 | { ACTION_WPS_MENU, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN }, | ||
61 | { ACTION_WPS_QUICKSCREEN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN }, | ||
62 | |||
63 | LAST_ITEM_IN_LIST | ||
64 | }; /* button_context_wps */ | ||
65 | |||
66 | |||
67 | |||
68 | /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */ | ||
69 | const struct button_mapping* get_context_mapping(int context) | ||
70 | { | ||
71 | switch (context) | ||
72 | { | ||
73 | case CONTEXT_STD: | ||
74 | return button_context_standard; | ||
75 | case CONTEXT_WPS: | ||
76 | return button_context_wps; | ||
77 | |||
78 | case CONTEXT_TREE: | ||
79 | case CONTEXT_LIST: | ||
80 | case CONTEXT_MAINMENU: | ||
81 | |||
82 | case CONTEXT_SETTINGS: | ||
83 | case CONTEXT_SETTINGS|CONTEXT_REMOTE: | ||
84 | default: | ||
85 | return button_context_standard; | ||
86 | } | ||
87 | return button_context_standard; | ||
88 | } | ||