Author Topic: Framework / Pattern for building menus?  (Read 2018 times)

0 Members and 1 Guest are viewing this topic.

Offline miceuzTopic starter

  • Frequent Contributor
  • **
  • Posts: 387
  • Country: lt
    • chirp - a soil moisture meter / plant watering alarm
Framework / Pattern for building menus?
« on: December 29, 2014, 05:53:53 pm »
I have UP, DOWN, ENTER, CANCEL buttons, an 8*2 character LCD and a fairly big menu tree. Menu tree consists of three level deep branches with leaves of several kinds - choose a value from a list, enter integer value between some thresholds and a couple of specific ones. All menu does is basically setting a bunch of variables.

Does anyone have a suggestion for a pattern to use for such a system in an small micro embedded environment?

Offline tymm

  • Contributor
  • Posts: 17
Re: Framework / Pattern for building menus?
« Reply #1 on: December 29, 2014, 06:18:28 pm »
Hi,

You can get some ideas poking through the projects at avrfreaks.net -- years ago i uploaded "tinymenu" which is a framework for doing this kind of thing.  I believe Dean, the guy behind LUFA, also uploaded a (likely better) menuing system there too.

Wouldn't surprise me if there are Arduino menuing code bases out there too that - depending on your project - you may be either able to use directly or read through for reference.

my approach had an array of menus, each with an array of menu items.  Each menu item held text to display + a callback function to use when the item was selected.
 

Offline miceuzTopic starter

  • Frequent Contributor
  • **
  • Posts: 387
  • Country: lt
    • chirp - a soil moisture meter / plant watering alarm
Re: Framework / Pattern for building menus?
« Reply #2 on: December 29, 2014, 06:44:13 pm »
I had an idea about having structs in a linked list with callback functions for all buttons, there is only a polymorphism question for leaves, I don't particulary like doing polymorphism in C.

Offline miceuzTopic starter

  • Frequent Contributor
  • **
  • Posts: 387
  • Country: lt
    • chirp - a soil moisture meter / plant watering alarm
Re: Framework / Pattern for building menus?
« Reply #3 on: December 30, 2014, 11:51:19 am »
Ok, for reference for future generations:

MicroMenu by Dean
https://github.com/abcminiuser/micromenu-v2

TinyMenu
http://www.avrfreaks.net/projects/tinymenu

MicroMenu is almost what I need, I'll got from there.


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf