Thank You for your continued support and contributions!
/*************************************************************************** * __________ __ ___. * Open \______ \ ____ ____ | | _\_ |__ _______ ___ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ * $Id: helloworld.c 17847 2008-06-28 18:10:04Z bagder $ * * 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"#include "menu.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/* here is a global api struct pointer. while not strictly necessary, it's nice not to have to pass the api pointer in all function calls in the plugin */static const struct plugin_api* rb;/* this is the plugin entry point */enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter){ /* if you don't use the parameter, you can do like this to avoid the compiler warning about it */ (void)parameter; /* if you are using a global api pointer, don't forget to copy it! otherwise you will get lovely "I04: IllInstr" errors... :-) */ rb = api; /* now go ahead and have fun! */ MAKE_MENU(menu, "RockLock", NULL, "Input Password", "Set Password") switch (rb->do_menu(&menu, NULL)){ case 0: /* "Input Password" */ rb->splash(HZ*2, "Hello world!"); break; case 1: /* "Set Password" */ rb->splash(HZ*2, "Hello world!"); break; default: rb->splash(HZ*2, "Hello world!");} return 0;}
CC apps/plugins/helloworld.c/home/user/rockbox/apps/plugins/helloworld.c: In function 'plugin_start':/home/user/rockbox/apps/plugins/helloworld.c:47: warning: initialization from incompatible pointer type/home/user/rockbox/apps/plugins/helloworld.c:47: warning: initialization makes integer from pointer without a cast/home/user/rockbox/apps/plugins/helloworld.c:48: error: too few arguments to function 'rb->do_menu'make: *** [/home/user/rockbox/build_c200/apps/plugins/helloworld.o] Error 1
First you are using an old version of helloworld.c plugins should no longer be passed the api poiter as a parameter.
/*************************************************************************** * __________ __ ___. * 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;}
Thanks! This is what I have so far, but the compiler says there's something wrong with my Unlock function declaration.Code: [Select]/***************************************************************************static void Unlock(void) { (void)parameter; switch((rb->button_get(true)){
/***************************************************************************static void Unlock(void) { (void)parameter; switch((rb->button_get(true)){
#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
int how_old = 20;char name = "John Jameson";char final_string = "";final_string = name + " is " + how_old;
You just need to call rb->kbd_input() where the first argument is a char* to a buffer and the second is the length of the buffer.see apps/recorder/keyboard.c and apps/keyboard.h
text = rb->kbd_input(char, buffer_length);
char buf[100];rb->kbd_input(buf, sizeof (buf));
Page created in 0.104 seconds with 15 queries.