[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] calling function pointers via pointers ?
From: |
Vincent Trouilliez |
Subject: |
Re: [avr-gcc-list] calling function pointers via pointers ? |
Date: |
Thu, 29 Sep 2005 17:12:24 +0200 |
On Thu, 2005-09-29 at 16:20 +0200, David Brown wrote:
> You're getting very close now - don't give up!
>
> David
Thanks again David for the detailed review, and thanks everyone else :-)
The "forward declaration" did the trick indeed, magic ! :o)
So now the definition of my menus look like this. I added another one to
simulate a sub menu, and now I just need to find the correct syntax to
initialise a pointer in the main menu, with the address of the sub
menu.
const menu __ATTR_PROGMEM__ ui_menu_sub = {
"___SUB MENU TEST____",
6, //there are 6 entries in this menu
{{"Sub A", ui_menu_test_fn, NULL },
{"Sub B", ui_menu_test_fn, NULL },
{"Sub C", ui_menu_test_fn, NULL },
{"Sub D", ui_menu_test_fn, NULL },
{"Sub E", ui_menu_test_fn, NULL },
{"Sub F", ui_menu_test_fn, NULL }}
};
const menu __ATTR_PROGMEM__ ui_menu_main = {
"______ALPHABET______",
6, //there are 6 entries in this menu
{{"Letter A", ui_menu_test_fn, NULL },
{"Letter B", ui_menu_test_fn, NULL },
{"Letter C", ui_menu_test_fn, NULL },
{"Letter D", ui_menu_test_fn, NULL },
{"Letter E", ui_menu_test_fn, NULL },
{"Letter F", NULL , &ui_menu_sub }}
};
I tried the '&' sign, but I get this error:
ui.c:63: warning: initialization discards qualifiers from pointer target
type
I am really lost as to how to specify the address of menu_sub in
ui_menu_main....
About my naming "style", well yours certainly look a lot more
"professional" than mine, I quite like it, I think I will adopt it ! I
will work on it, as it's important to make the code readable, plus, it
just looks better anyway...
Indentation: yes sure I do indent... no idea why it got lost in the
mail :-/
Well, once I manage to initialise the main menu with the address of the
sub menu, I will be ready for the final big test.... try to actually run
the sub menu, that is, is my ui_menu_run() function (the one that's in
charge of displaying a menu), re-entrant or not ! No-idea ! I think
either it will work first time, or it will screw up big time, but I
don't think there is much space for nuances in between !! :-P
--
Vince
- Re: [avr-gcc-list] calling function pointers via pointers ?, (continued)
- Re: [avr-gcc-list] calling function pointers via pointers ?, David Brown, 2005/09/29
- Re: [avr-gcc-list] calling function pointers via pointers ?, Dave Hansen, 2005/09/28
- Re: [avr-gcc-list] calling function pointers via pointers ?, David Brown, 2005/09/29
- Re: [avr-gcc-list] calling function pointers via pointers ?, Vincent Trouilliez, 2005/09/29
- Re: [avr-gcc-list] calling function pointers via pointers ?, David Brown, 2005/09/29
- Re: [avr-gcc-list] calling function pointers via pointers ?, Vincent Trouilliez, 2005/09/29
- Re: [avr-gcc-list] calling function pointers via pointers ?, David Brown, 2005/09/29
- Re: [avr-gcc-list] calling function pointers via pointers ?,
Vincent Trouilliez <=
- Re: [avr-gcc-list] calling function pointers via pointers ?, Vincent Trouilliez, 2005/09/29
- Re: [avr-gcc-list] calling function pointers via pointers ?, Andy Warner, 2005/09/29
- Re: [avr-gcc-list] calling function pointers via pointers ?, Vincent Trouilliez, 2005/09/29
- Re: [avr-gcc-list] calling function pointers via pointers ?, Anton Erasmus, 2005/09/30
- Re: [avr-gcc-list] calling function pointers via pointers ?, Dave Hansen, 2005/09/29
Re: [avr-gcc-list] calling function pointers via pointers ?, Joerg Wunsch, 2005/09/28
RE: [avr-gcc-list] calling function pointers via pointers ?, Dave Hansen, 2005/09/28
[avr-gcc-list] Re: calling function pointers via pointers ?, Oleksandr Redchuk, 2005/09/29