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!

Changes

RevisionDateWhoCommit message
28:fbcd3bac0cd7 2014-10-10 vtraveller Reduced write delay - faster LCD response default tip
27:b6c3dd9a1d8c 2014-10-09 vtraveller Updated key detection for uneditable modules.
26:0cfd95d8f270 2014-10-09 vtraveller Updated with correct cursor positions
25:24654d08a99a 2014-10-09 vtraveller Updated with new LCD and Key abstraction (to support different LCDs and Keyboard input).
24:e67c825ec6d8 2014-10-08 vtraveller Fix for date updating.
23:94d2f0d62247 2014-09-03 vtraveller Changed RTclock constructor
22:dd8197db4478 2014-09-03 vtraveller Updated with RTC address
21:c44cfd3259c0 2014-09-02 vtraveller Changed to using a shared I2C object
20:93c70a1869ee 2014-08-30 vtraveller Updated with temp sensor support.
19:72c02acb601d 2014-08-14 vtraveller Removed dual clock tests
18:fae7e61ea160 2014-08-14 vtraveller Fix for midday format issue.
17:731a47339cb8 2014-08-14 vtraveller 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.
16:9e1edf28393f 2014-08-12 vtraveller Make date and time checks more efficient.
15:d1eaddb363be 2014-08-12 vtraveller Added refresh parameter to show().; Updated time and date to only refresh if there's a change.
14:8b359e1e68f3 2014-08-11 vtraveller Minor fix for unit conversion.
13:9641bc42db92 2014-08-11 vtraveller 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.
12:0fea8ebe6c1a 2014-08-10 vtraveller Added Date Changing.
11:96146db429de 2014-08-10 vtraveller Added support for changing time.
10:3fcab08717fc 2014-08-10 vtraveller Added module system.
9:1501fb01ded6 2014-08-04 vtraveller Updated with new logic
8:d182b98b975f 2014-08-03 vtraveller Updated for publish
7:d087e901b74b 2014-08-03 vtraveller Updated app
6:a6be2aede8f2 2014-08-02 vtraveller Updated with some clean ups
5:6c9ee7e3a20c 2014-08-02 vtraveller Improved pull-up resisitor code
4:d70e37f6c6bd 2014-08-02 vtraveller Keyboard working version
3:ed09f95739df 2014-08-02 vtraveller snapshot
2:ac3b92ebf17a 2014-08-02 vtraveller Faster LED tick
1:45e2e7c0754d 2014-08-02 vtraveller Working flash test
0:88d87b1c1f8b 2010-12-18 wim Initial version