Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * |
| 9 | * Copyright (C) 200 |
| 10 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame^] | 11 | * This program is free software; you can redistribute it and/or |
| 12 | * modify it under the terms of the GNU General Public License |
| 13 | * as published by the Free Software Foundation; either version 2 |
| 14 | * of the License, or (at your option) any later version. |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 15 | * |
| 16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 17 | * KIND, either express or implied. |
| 18 | * |
| 19 | ****************************************************************************/ |
| 20 | |
| 21 | /* Button Code Definitions for <new> target */ |
| 22 | |
| 23 | #include "config.h" |
| 24 | #include "action.h" |
| 25 | #include "button.h" |
| 26 | |
| 27 | #define LAST_ITEM_IN_LIST { ACTION_NONE,BUTTON_NONE,BUTTON_NONE } |
| 28 | /* {Action Code, Button code, Prereq button code } */ |
| 29 | |
| 30 | /** |
| 31 | This file is where all button mappings are defined. |
| 32 | In ../action.h there is an enum with all the used ACTION_ codes. |
| 33 | Ideally All the ACTION_STD_* and ACTION_WPS_* codes should be defined somehwere in this file. |
| 34 | |
| 35 | Remeber to make a copy of this file and rename it to keymap-<targetname>.c and add it to apps/SOURCES |
| 36 | |
| 37 | Good luck and thanks for porting a new target! :D |
| 38 | |
| 39 | **/ |
| 40 | |
| 41 | /* |
| 42 | * The format of the list is as follows |
| 43 | * { Action Code, Button code, Prereq button code } |
| 44 | * if there's no need to check the previous button's value, use BUTTON_NONE |
| 45 | * Insert LAST_ITEM_IN_LIST at the end of each mapping |
| 46 | */ |
Jens Arnold | a0f3113 | 2006-12-12 07:55:17 +0000 | [diff] [blame] | 47 | static const struct button_mapping button_context_standard[] = { |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 48 | |
| 49 | LAST_ITEM_IN_LIST |
| 50 | }; /* button_context_standard */ |
| 51 | |
Jens Arnold | a0f3113 | 2006-12-12 07:55:17 +0000 | [diff] [blame] | 52 | static const struct button_mapping button_context_wps[] = { |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 53 | |
| 54 | LAST_ITEM_IN_LIST |
| 55 | }; /* button_context_wps */ |
| 56 | |
| 57 | |
| 58 | |
| 59 | /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */ |
Jens Arnold | 1fdb5bf | 2006-08-16 00:32:45 +0000 | [diff] [blame] | 60 | const struct button_mapping* get_context_mapping(int context) |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 61 | { |
| 62 | switch (context) |
| 63 | { |
| 64 | case CONTEXT_STD: |
| 65 | return button_context_standard; |
| 66 | case CONTEXT_WPS: |
| 67 | return button_context_wps; |
| 68 | |
| 69 | case CONTEXT_TREE: |
| 70 | case CONTEXT_LIST: |
| 71 | case CONTEXT_MAINMENU: |
| 72 | |
| 73 | case CONTEXT_SETTINGS: |
| 74 | case CONTEXT_SETTINGS|CONTEXT_REMOTE: |
| 75 | default: |
| 76 | return button_context_standard; |
| 77 | } |
| 78 | return button_context_standard; |
| 79 | } |