![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Example of how to use an Ada Fruit RGB LCD with the Ada Fruit RGB LCD Shield Library
Dependencies: AdaFruit_RGBLCDShield MCP23017 mbed RTclock
Fork of MCP_test by
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!
History
Reduced write delay - faster LCD response
2014-10-10, by vtraveller [Fri, 10 Oct 2014 11:10:56 +0000] rev 28
Reduced write delay - faster LCD response
Updated key detection for uneditable modules.
2014-10-09, by vtraveller [Thu, 09 Oct 2014 10:21:03 +0000] rev 27
Updated key detection for uneditable modules.
Updated with correct cursor positions
2014-10-09, by vtraveller [Thu, 09 Oct 2014 10:03:04 +0000] rev 26
Updated with correct cursor positions
Updated with new LCD and Key abstraction (to support different LCDs and Keyboard input).
2014-10-09, by vtraveller [Thu, 09 Oct 2014 08:03:20 +0000] rev 25
Updated with new LCD and Key abstraction (to support different LCDs and Keyboard input).
Fix for date updating.
2014-10-08, by vtraveller [Wed, 08 Oct 2014 16:42:17 +0000] rev 24
Fix for date updating.
Changed RTclock constructor
2014-09-03, by vtraveller [Wed, 03 Sep 2014 06:23:04 +0000] rev 23
Changed RTclock constructor
Updated with RTC address
2014-09-03, by vtraveller [Wed, 03 Sep 2014 06:01:27 +0000] rev 22
Updated with RTC address
Changed to using a shared I2C object
2014-09-02, by vtraveller [Tue, 02 Sep 2014 07:12:23 +0000] rev 21
Changed to using a shared I2C object
Updated with temp sensor support.
2014-08-30, by vtraveller [Sat, 30 Aug 2014 16:30:27 +0000] rev 20
Updated with temp sensor support.
Removed dual clock tests
2014-08-14, by vtraveller [Thu, 14 Aug 2014 12:06:47 +0000] rev 19
Removed dual clock tests