Example of how to use an Ada Fruit RGB LCD with the Ada Fruit RGB LCD Shield Library

Dependencies:   AdaFruit_RGBLCDShield MCP23017 mbed RTclock

Dependents:   SX1276_GPS

Fork of MCP_test by Wim Huiskamp

Updated the Adafruit RGB LCD Shield test app with a module system.

It pulls in RTclock which is another library I did for controlling the DS1307 RTC in a sane way (marries stdlib time and the RTC together cleanly). You don't need an RTC to run the example, it'll just use stdlib time instead. This class also maps RTC to system time, so if you loose the RTC the mbed will free run.

Four modules are defined in the modules folder plus the module base class. These examples provide:

  • title menu item
  • time menu item (updates automatically)
  • date menu item
  • fake temp menu item

Press select to switch modes: menu->cursor->change

Menu switches menu items going up/down. Cursor allows you to move around editable fields using the cursor keys / marker. Change allows you to move left/right on a particular line and change values by using up/down on an item with the blink box.

Custom fonts are defined for UI arrows and degree character.

If you want a menu item to update over time then you need to implement the canRefresh() member function in any child module you derive from class Module. Make it return true to receive update requests in your show() member function. Date and time both check when refreshing to see if anything has changed, then update.

main() registers a table of modules with the MenuManager. Others can be added easily by creating children derived from the Module base class..

Depending on what you want to do you may need to adjust the loop wait time in MenuManager::loop(). If you don't balance this based on work you need to do then the key presses may get a little lively. I may adjust the key checking to be fixed to 200ms regardless of loop wait time, however the catch there is that you'll consume more power the more loops you do so the wait is still important.

Happy coding!

Revisions of main.cpp

Revision Date Message Actions
22:dd8197db4478 2014-09-03 Updated with RTC address File  Diff  Annotate
21:c44cfd3259c0 2014-09-02 Changed to using a shared I2C object File  Diff  Annotate
20:93c70a1869ee 2014-08-30 Updated with temp sensor support. File  Diff  Annotate
19:72c02acb601d 2014-08-14 Removed dual clock tests File  Diff  Annotate
17:731a47339cb8 2014-08-14 Added mode indication to modules (allows them to change behavior based on mode changes. Means you can have a module change state but not commit the change until you leave that state. File  Diff  Annotate
13:9641bc42db92 2014-08-11 Created a scrollable menu system based on modules to work against the Adafruit RGB LCD library.; Modules can be created and installed as menu items with display, cursor and edit capabilities. File  Diff  Annotate
11:96146db429de 2014-08-10 Added support for changing time. File  Diff  Annotate
10:3fcab08717fc 2014-08-10 Added module system. File  Diff  Annotate
9:1501fb01ded6 2014-08-04 Updated with new logic File  Diff  Annotate
7:d087e901b74b 2014-08-03 Updated app File  Diff  Annotate
6:a6be2aede8f2 2014-08-02 Updated with some clean ups File  Diff  Annotate
5:6c9ee7e3a20c 2014-08-02 Improved pull-up resisitor code File  Diff  Annotate
4:d70e37f6c6bd 2014-08-02 Keyboard working version File  Diff  Annotate
3:ed09f95739df 2014-08-02 snapshot File  Diff  Annotate
2:ac3b92ebf17a 2014-08-02 Faster LED tick File  Diff  Annotate
1:45e2e7c0754d 2014-08-02 Working flash test File  Diff  Annotate
0:88d87b1c1f8b 2010-12-18 Initial version File  Diff  Annotate