View previous topic :: View next topic |
Author |
Message |
Calamar
Joined: 07 Sep 2003 Posts: 60 Location: Buenos Aires (Argentina)
|
menu, sub.menu structure with lcd |
Posted: Mon Jul 04, 2005 4:43 pm |
|
|
I would like a exmaple in C, how to create
a menu, sub-menu I'll display it in
standar LCD. _________________ Best Regards
Daniel H. Sagarra
La Plata (Argentina) |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
|
valemike Guest
|
|
Posted: Tue Jul 05, 2005 12:00 am |
|
|
I've implemented a menu using a switch-case state machine. Scrolling up and down will bring you to the next or previous state.
Then if you want a submenu, then you'll have to save your current state and initialize a new menu state machine. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Jul 05, 2005 6:42 am |
|
|
I create a const data struct that contains many things about a menu entry. What to do if you press a certain button (function pointers), menu text, ...., and the "parent menu" id. With this, there is no need to save the current state since you will know where to go when the user hits the back or up button. |
|
|
Guest
|
|
Posted: Thu Jul 07, 2005 12:01 pm |
|
|
I also I'm designing a user interface and would like to use function pointers. I'm a little confussed after reading the posts. Does the compiler fully support pointers to functions? What are the limitations? Can they be used inside of a structure?
Any input that you guys have would be great.
Thanks,
Joel |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu Jul 07, 2005 12:04 pm |
|
|
The compiler doesn't like const pointers to functions. The post I made was a work around for that. If you read the post, you will see that I did use them in a struct. |
|
|
Guest
|
|
Posted: Thu Jul 07, 2005 12:14 pm |
|
|
I wanted something more portable. Does CCS no about this limitation? I think that there offical statement is that they completely support pointers to functions. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu Jul 07, 2005 12:15 pm |
|
|
Then you will need to use a different compiler. |
|
|
Guest
|
|
Posted: Thu Jul 07, 2005 12:20 pm |
|
|
Thanks for you input Mark,
Hopefully in time they will fix some parts of the compiler...... |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu Jul 07, 2005 12:21 pm |
|
|
They will have to make the decision to allow pointers to consts. |
|
|
|