Rockbox Development > Starting Development and Compiling
Error making a menu?
AlexP:
Any other plugin?
motionman95:
Thanks! This is what I have so far, but the compiler says there's something wrong with my Unlock function declaration.
--- Code: ---/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id: helloworld.c 19776 2009-01-16 10:34:40Z unhelpful $
*
* Copyright (C) 2002 Björn Stenberg
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include "plugin.h"
/* welcome to the example rockbox plugin */
/* This macros must always be included. Should be placed at the top by
convention, although the actual position doesn't matter */
PLUGIN_HEADER
#if (CONFIG_KEYPAD == SANSA_C200_PAD)
# define KEY_LEFT BUTTON_LEFT
# define KEY_RIGHT BUTTON_RIGHT
#endif
/* this is the plugin entry point */
enum plugin_status plugin_start(const void* parameter)
{
/* if you don't use the parameter, you can do like
this to avoid the compiler warning about it */
(void)parameter;
/* now go ahead and have fun! */
MENUITEM_STRINGLIST(menu, "RockLock Menu", NULL, "Unlock", "Reset Password")
switch (rb->do_menu(&menu, NULL, NULL, false))
{
case 0:
Unlock()
return PLUGIN_OK;
break;
case 1:
return PLUGIN_OK;
break;
}
return PLUGIN_OK;
}
static void Unlock(void) {
(void)parameter;
switch((rb->button_get(true)){
case KEY_RIGHT:
return PLUGIN_OK;
break
case KEY_LEFT:
return PLUGIN_OK;
break
}
return PLUGIN_OK;
}
--- End code ---
nls:
--- Quote from: motionman95 on March 05, 2009, 11:27:18 AM ---Thanks! This is what I have so far, but the compiler says there's something wrong with my Unlock function declaration.
--- Code: ---/***************************************************************************
static void Unlock(void) {
(void)parameter;
switch((rb->button_get(true)){
--- End code ---
--- End quote ---
The function does not take any parameter nor do you have a var called "parameter" so the compiler will not know what to do with this, what is it you are trying to do?
Maybe it would be a good idea to read up on C?
cool_walking_:
Also, Unlock() is called before it's defined, so you should put a function prototype above plugin_start().
motionman95:
Thanks for all the awesome help! I've read up on C, and I've gotten much better! I have a really nice script going! The only help I need is a list of keys (for the c200). All I have currently is this, and I need to get the rest of the keys:
--- Quote ---#if (CONFIG_KEYPAD == SANSA_C200_PAD)
# define KEY_LEFT BUTTON_LEFT
# define KEY_RIGHT BUTTON_RIGHT
# define KEY_SELECT BUTTON_SELECT
# define KEY_UP BUTTON_UP
# define KEY_DOWN BUTTON_DOWN
#endif
--- End quote ---
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version