Skip to content
An Arduino library for creating menu based user interfaces on the ST7565 LCD.
C++ Java C
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


ST7565 Menu - Alex Hiam
Created: 11/2011
Author: Alexander Hiam - -

 Copyright (c) 2011,2012 - Alexander Hiam

 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <>.

This library uses Adafruit's ST7565 to provide a simple API for creating 
a menu based user interface. See example sketches and API description
below for more details.

Included is a version of the Adafruit ST7565 library modified to include
an #ifndef wrapper in the ST7565.h file. This library won't work without
the modification. 

To install library place the whole ST7565_Menu/ folder in your Arduino 
libraries directory, then drag the ST7565/ folder up into the libraries
directory as well, replacing your current Adafruit library if it exists.

ST7565_Menu should contain:

 -Menu(uint8_t up_pin, uint8_t down_pin, uint8_t select_pin, ST7565 *lcd)
   Creates and returns an instance of the Menu object. up_, down_ and 
   select_pins are the IO pins where the control buttons are connected.
   The buttons must be configured active-low with external pullups.
   lcd should be the address of an instance of the Adafruit ST7565 object
   (e.g. &ST7565_instance).

 -Menu.set_title(char *title)
   Sets the title string that is displayed on the first line of the LCD.
   The title will remain on the first line during scrolling of the menu.
   Will be blank if not set.

 -Menu.add_item(char *label)
   Adds a functionless item to the menu.

 -Menu.add_item(char *label, void (*function)(void))
   Adds an item to the menu. When selected the given function will be 

 -Menu.add_item(char *label, int value, void (*function)(int))
   Adds an item to the menu. When selected the given function will be 
   passed the given integer value.

 -Menu.add_draw_function(void (*function)(void))
   Adds a function that will be just before the menu is drawn. This is
   where other graphics should be drawn to the LCD. Menu can only have
   one draw function.

 -Menu.add_timeout_function(int timeout, void (*function)(void))
   Adds a function that will be called after Menu.update() has been 
   called the given number of times without any of the menu controls 
   being pressed. In order to have other controls or events restart the
   timeout count, one should set Menu.timeout_counter to 0.

   Redraws the whole menu; does not update read controls or increment 
   timeout counter. Shouldn't normally need to be called.

   This function should be called each time through the main loop to
   use the menu.  

   Completely resets the menu. This should be called before creating 
   new menus.

You can’t perform that action at this time.