Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate

Advertising

Something
Wednesday, August 16th, 2006 at 10:43:28am UTC 

  1. /***************************************************************************
  2.  *             __________               __   ___.
  3.  *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
  4.  *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
  5.  *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
  6.  *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
  7.  *                     \/            \/     \/    \/            \/
  8.  *
  9.  * Copyright (C) Barry Wardell 2006
  10.  *
  11.  * All files in this archive are subject to the GNU General Public License.
  12.  * See the file COPYING in the source tree root for full license agreement.
  13.  *
  14.  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  15.  * KIND, either express or implied.
  16.  *
  17.  ****************************************************************************/
  18.  
  19. /* Button Code Definitions for iriver H10 target */
  20.  
  21. #include "config.h"
  22. #include "action.h"
  23. #include "button.h"
  24. #include "settings.h"
  25.  
  26. /* {Action Code,    Button code,    Prereq button code } */
  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. const struct button_mapping button_context_standard[]  = {
  35.     { ACTION_STD_PREV,        BUTTON_SCROLL_UP,                  BUTTON_NONE },
  36.     { ACTION_STD_PREVREPEAT,  BUTTON_SCROLL_UP|BUTTON_REPEAT,    BUTTON_NONE },
  37.     { ACTION_STD_NEXT,        BUTTON_SCROLL_DOWN,                BUTTON_NONE },
  38.     { ACTION_STD_NEXTREPEAT,  BUTTON_SCROLL_DOWN|BUTTON_REPEAT,  BUTTON_NONE },
  39.    
  40.     { ACTION_STD_CONTEXT,     BUTTON_FF,                         BUTTON_NONE },   
  41.     { ACTION_STD_CANCEL,      BUTTON_LEFT,                       BUTTON_NONE },
  42.     { ACTION_STD_OK,          BUTTON_RIGHT,                      BUTTON_NONE },
  43.     { ACTION_STD_MENU,        BUTTON_REW|BUTTON_REL,             BUTTON_REW },
  44.     { ACTION_STD_QUICKSCREEN, BUTTON_REW|BUTTON_REPEAT,          BUTTON_REW },
  45.     { ACTION_STD_CANCEL,      BUTTON_POWER,                      BUTTON_NONE },
  46.  
  47.     LAST_ITEM_IN_LIST
  48. }; /* button_context_standard */
  49.  
  50. const struct button_mapping button_context_wps[]  = {
  51.     { ACTION_WPS_PLAY,     BUTTON_PLAY|BUTTON_REL,   BUTTON_PLAY },
  52.     { ACTION_WPS_STOP,     BUTTON_PLAY|BUTTON_REPEAT,BUTTON_PLAY },
  53.     { ACTION_WPS_SKIPPREV, BUTTON_REW|BUTTON_REL,    BUTTON_REW},
  54.     { ACTION_WPS_SEEKBACK, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
  55.     { ACTION_WPS_STOPSEEK, BUTTON_REW|BUTTON_REL,    BUTTON_REW|BUTTON_REPEAT },
  56.     { ACTION_WPS_SKIPNEXT, BUTTON_FF|BUTTON_REL,     BUTTON_FF },
  57.     { ACTION_WPS_SEEKFWD,  BUTTON_FF|BUTTON_REPEAT,  BUTTON_NONE },
  58.     { ACTION_WPS_STOPSEEK, BUTTON_FF|BUTTON_REL,     BUTTON_FF|BUTTON_REPEAT },
  59.    
  60.     { ACTION_WPS_VOLDOWN, BUTTON_SCROLL_DOWN,              BUTTON_NONE },
  61.     { ACTION_WPS_VOLDOWN, BUTTON_SCROLL_DOWN|BUTTON_REPEAT,BUTTON_NONE },
  62.     { ACTION_WPS_VOLUP,   BUTTON_SCROLL_UP,                BUTTON_NONE },
  63.     { ACTION_WPS_VOLUP,   BUTTON_SCROLL_UP|BUTTON_REPEAT,  BUTTON_NONE },
  64.    
  65.     { ACTION_WPS_BROWSE,        BUTTON_LEFT|BUTTON_REL,       BUTTON_LEFT },
  66.     { ACTION_WPS_QUICKSCREEN,   BUTTON_LEFT|BUTTON_REPEAT,    BUTTON_LEFT },
  67.     { ACTION_WPS_CONTEXT,       BUTTON_RIGHT|BUTTON_REL,      BUTTON_RIGHT },
  68.     { ACTION_WPS_MENU,          BUTTON_RIGHT|BUTTON_REPEAT,   BUTTON_RIGHT },
  69.    
  70.     LAST_ITEM_IN_LIST
  71. }; /* button_context_wps */
  72.  
  73.  
  74. const struct button_mapping button_context_settings[] = {
  75.     { ACTION_SETTINGS_INC,      BUTTON_SCROLL_UP,                 BUTTON_NONE },
  76.     { ACTION_SETTINGS_INCREPEAT,BUTTON_SCROLL_UP|BUTTON_REPEAT,   BUTTON_NONE },
  77.     { ACTION_SETTINGS_DEC,      BUTTON_SCROLL_DOWN,               BUTTON_NONE },
  78.     { ACTION_SETTINGS_DECREPEAT,BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
  79.     { ACTION_STD_PREV,          BUTTON_LEFT,                      BUTTON_NONE },
  80.     { ACTION_STD_CANCEL,        BUTTON_POWER,                     BUTTON_NONE },
  81.  
  82.     LAST_ITEM_IN_LIST
  83. }; /* button_context_settings */
  84.  
  85. const struct button_mapping button_context_tree[]  = {
  86.     { ACTION_NONE,        BUTTON_PLAY,                BUTTON_NONE },
  87.     { ACTION_TREE_WPS,    BUTTON_PLAY|BUTTON_REL,     BUTTON_PLAY },
  88.     { ACTION_TREE_STOP,   BUTTON_PLAY|BUTTON_REPEAT,  BUTTON_PLAY },
  89.    
  90.     LAST_ITEM_IN_LIST
  91. }; /* button_context_tree */
  92.  
  93. const struct button_mapping button_context_tree_scroll_lr[]  = {
  94.     { ACTION_NONE,              BUTTON_LEFT,                BUTTON_NONE },
  95.     { ACTION_STD_CANCEL,        BUTTON_LEFT|BUTTON_REL,     BUTTON_LEFT },
  96.     { ACTION_TREE_PGLEFT,       BUTTON_LEFT|BUTTON_REPEAT,  BUTTON_LEFT },
  97.     { ACTION_TREE_PGLEFT,       BUTTON_LEFT|BUTTON_REL,     BUTTON_LEFT|BUTTON_REPEAT },
  98.     { ACTION_NONE,              BUTTON_RIGHT,               BUTTON_NONE },
  99.     { ACTION_STD_OK,            BUTTON_RIGHT|BUTTON_REL,    BUTTON_RIGHT },
  100.     { ACTION_TREE_PGRIGHT,      BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
  101.     { ACTION_TREE_PGRIGHT,      BUTTON_RIGHT|BUTTON_REL,    BUTTON_RIGHT|BUTTON_REPEAT },   
  102.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|1),
  103. }; /* button_context_tree_scroll_lr */
  104.  
  105. const struct button_mapping button_context_yesno[]  = {
  106.     { ACTION_YESNO_ACCEPT,          BUTTON_RIGHT,              BUTTON_NONE },
  107.     LAST_ITEM_IN_LIST
  108. }; /* button_context_settings_yesno */
  109.  
  110. const struct button_mapping button_context_quickscreen[]  = {
  111.     { ACTION_QS_DOWNINV, BUTTON_SCROLL_UP,                 BUTTON_NONE },
  112.     { ACTION_QS_DOWNINV, BUTTON_SCROLL_UP|BUTTON_REPEAT,   BUTTON_NONE },
  113.     { ACTION_QS_DOWN,    BUTTON_SCROLL_DOWN,               BUTTON_NONE },
  114.     { ACTION_QS_DOWN,    BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
  115.     { ACTION_QS_LEFT,    BUTTON_LEFT,                      BUTTON_NONE },
  116.     { ACTION_QS_LEFT,    BUTTON_LEFT|BUTTON_REPEAT,        BUTTON_NONE },
  117.     { ACTION_QS_RIGHT,   BUTTON_RIGHT,                     BUTTON_NONE },
  118.     { ACTION_QS_RIGHT,   BUTTON_RIGHT|BUTTON_REPEAT,       BUTTON_NONE },
  119.     { ACTION_STD_CANCEL, BUTTON_POWER,                     BUTTON_NONE },
  120.    
  121.     LAST_ITEM_IN_LIST
  122. }; /* button_context_quickscreen */
  123.  
  124. /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
  125. const struct button_mapping* get_context_mapping(int context)
  126. {
  127.     switch (context)
  128.     {
  129.         case CONTEXT_STD:
  130.             return button_context_standard;
  131.            
  132.         case CONTEXT_WPS:
  133.             return button_context_wps;
  134.  
  135.         case CONTEXT_SETTINGS:
  136.             return button_context_settings;
  137.  
  138.         case CONTEXT_YESNOSCREEN:
  139.             return button_context_yesno;
  140.            
  141.         case CONTEXT_TREE:
  142.             if (global_settings.hold_lr_for_scroll_in_list)
  143.                 return button_context_tree_scroll_lr;
  144.             /* else fall through to CUSTOM|1 */
  145.         case CONTEXT_CUSTOM|1:
  146.             return button_context_tree;
  147.         case CONTEXT_QUICKSCREEN:
  148.             return button_context_quickscreen;
  149.         case CONTEXT_LIST:
  150.         case CONTEXT_MAINMENU:
  151.         default:
  152.             return button_context_standard;
  153.     }
  154.     return button_context_standard;
  155. }

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will not expire by default. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right
worth-right