Advertisement
smoke_th

Untitled

Apr 9th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.71 KB | None | 0 0
  1. /***************************************************************************
  2.  *             __________               __   ___.
  3.  *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
  4.  *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
  5.  *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
  6.  *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
  7.  *                     \/            \/     \/    \/            \/
  8.  * $Id$
  9.  *
  10.  * Copyright (C) 2002 Björn Stenberg
  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. /* welcome to the example rockbox plugin */
  23.  
  24. /* mandatory include for all plugins */
  25. #include "plugin.h"
  26. #define AB_OFF           (BUTTON_MENU | BUTTON_SELECT)
  27. #define AB_ROTATE_CCW    BUTTON_SCROLL_BACK
  28. #define AB_UP   (BUTTON_MENU | BUTTON_REL)
  29. #define AB_ROTATE_CW     BUTTON_SCROLL_FWD
  30. #define AB_LEFT          BUTTON_LEFT
  31. #define AB_RIGHT         BUTTON_RIGHT
  32. #define AB_DOWN          BUTTON_PLAY
  33. #define AB_BUTTON        BUTTON_SELECT
  34. //#define AB_RESTART       (BUTTON_SELECT | BUTTON_PLAY)
  35. //#define AB_DROP          (BUTTON_SELECT | BUTTON_REL)
  36.  
  37. //static int SetChannels(void);
  38. static void callback(const void** start, size_t* size);
  39.  
  40. static void callback(const void** start, size_t* size)
  41. {
  42.     (void)start; /* unused parameter, avoid warning */
  43.     *size = 0; /* end of data */
  44.     //sound_active = false;
  45.     //rb->led(0);
  46. }
  47.  
  48. static short *cBArr[256];
  49. //static short *cBArr_R[256];
  50.  
  51. /* 
  52. static int SetChannels(void)
  53. {
  54.     q=0;
  55.    
  56.     newbuttonstate = rb->button_status();
  57.     released = ~newbuttonstate & oldbuttonstate;
  58.     pressed = newbuttonstate & ~oldbuttonstate;
  59.     oldbuttonstate = newbuttonstate;
  60.     //
  61.     //rb->lcd_putsxyf (0, 0, "%d", newbuttonstate);
  62.     //sprintf(buf, "%d", newbuttonstate);
  63.     //rb->splash(HZ*2, buf);
  64.     rb->lcd_putsxyf (0, 0, "%d", newbuttonstate);
  65.     rb->lcd_update();
  66.     for(q=0; q<256; q+=2)
  67.     {
  68.         cBArr[q]=
  69.     }
  70.    
  71.    
  72.     rb->pcm_play_data(NULL, NULL, tick_buf, sizeof(tick_buf));
  73.     if((pressed & (BUTTON_MENU)) && pressed & (BUTTON_SELECT))
  74.     {
  75.         return 0;
  76.     }
  77.    
  78.     return 1;
  79. }
  80.  
  81. */
  82. /* this is the plugin entry point */
  83. enum plugin_status plugin_start(const void* parameter)
  84. {
  85.     /* if you don't use the parameter, you can do like
  86.        this to avoid the compiler warning about it */
  87.     (void)parameter;
  88.    
  89.     bool quit = false;
  90.    
  91.     unsigned int newbuttonstate = 0;
  92. unsigned int released = 0;
  93. unsigned int pressed = 0;
  94. unsigned int oldbuttonstate = 0;
  95. unsigned int end=0;
  96. unsigned int cycletime=300;
  97.  
  98.    
  99.     int f_width, f_height;
  100. #if LCD_DEPTH > 1
  101.     rb->lcd_set_backdrop(NULL);
  102.     rb->lcd_set_background(LCD_BLACK);
  103.     rb->lcd_set_foreground(LCD_WHITE);
  104. #endif
  105.  
  106.     rb->lcd_setfont(FONT_SYSFIXED);
  107.    
  108.     rb->lcd_getstringsize("100000000", &f_width, &f_height);
  109.    
  110.     rb->lcd_clear_display();
  111.    
  112.     rb->lcd_set_drawmode(DRMODE_SOLID);
  113.     while(!quit)
  114.     {
  115.  
  116.         newbuttonstate = rb->button_status();
  117.         released = ~newbuttonstate & oldbuttonstate;
  118.         pressed = newbuttonstate & ~oldbuttonstate;
  119.         oldbuttonstate = newbuttonstate;
  120.         rb->lcd_clear_display();
  121.         rb->lcd_putsxyf (0, 0, "%d", newbuttonstate);
  122.         rb->lcd_update();
  123.        
  124.       if(pressed & BUTTON_MENU && pressed & BUTTON_SELECT)
  125.     {
  126.         quit=true;
  127.     }
  128.       rb->yield();
  129.        
  130.     }
  131.    
  132.     return PLUGIN_OK;
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement