Skip to content

KrisKasprzak/Adafruit_ILI9341_Menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Version 4.0 updated 8/21/2024

  1. fixed a nasty bug if the number of menu items = the .h setting for MAX_OPT, now if you have 22 items, set MAX_OPT = 22, (before fix set to 23)

Menu System for Adafruit_ILI9341 displays with touch or mechanical input

This library will simplify creating and implementing a menu system for TFT displays that use the Adafruit_ILI9341 displays with microcontrollers such as the ESP32. See my other repository for the ILI8341_t3 for Teensy-based projects.

This library does not support Arduino UNO, NANO, however should work with the MEGA.

This library includes two menu objects

  1. A simple selection menu (ItemMenu) where the user can scroll up/down and select an item and some programmer defined action can be performed such as drawing a screen or activating a sub menu
  2. A menu with in-line edit capability (EditMenu) where the user can scroll up/down the list and select an item however, the difference is that move/up down on a selected item will then scroll the values stored with that menu item, selecting a selected item will restore control to moving up/down the menu list

Watch this YouTube video to see the library with touch input: https://youtu.be/wfMcTC3_8bI
Watch this YouTube video to see the library with mechanical input: https://youtu.be/KUi9f4hcV6A


To activate touch usage specify true in the menu object creation step
  • EditMenu(Adafruit_ILI9341 *YourDisplayObject, true);
  • ItemMenu(Adafruit_ILI9341 *YourDisplayObject, true);

To activate mechanical input usage specify false (default) in the menu object creation step
  • EditMenu(Adafruit_ILI9341 *YourDisplayObject, false);
  • ItemMenu(Adafruit_ILI9341 *YourDisplayObject, false);


Library highlights
  • Support for menu selections using touch screens
  • Support for menu selections using mechanical input such as rotary encoders or buttons
  • Automatic wrapping for menu rows that exceed screen size
  • For EditMenu objects, edits can be within a defined range or from an array
  • Menus can include no icon, mono icon, or color icons
  • Programmer has full control over margins, colors, fonts, etc.
  • Menus can have up to 15 items, but expandable to more by editing the #define MAX_OPT 15
  • Menu items can be enabled or disabled through code
  • Automatic wrapping during editing for items within editable menus
  • Menu item text can be changed at any time through code
  • Initial data in EditMenu objects can be set based on stored or set values
  • Menu selector bars can have round or sharp corners and have a border to accentuate selection
  • Automatic up/down arrows on top and bottom screen rows to indicate to the user "there's more"


While this library was created for Adafruit_ILI9341 drivers, the library can be adapted to other display drivers. Note the driver must use the Adafruit_GFX libraries. To allow other display drivers, modify the lines in the .h and .cpp files to allow a different driver to be passed in. For example change call such as SliderH(ILI9341_t3 *disp,... to SliderH(Adafruit_RA8875 *disp,... and in the .cpp files you may have to change how fonts are passed in using either setFont(&SomeFont) or setFont(SomeFont)

header image header image header image header image header image header image header image header image



I have included an example that shows how to create multi-menu system with both a simple select menu that call editable menus

header image header image



Revision history


1.0 1/11/22 initial code
2.0 1/28/22 added touch support

About

Menu code for Adafruit_ILI9341-based displays

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages