You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
134 lines
15 KiB
134 lines
15 KiB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.14"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>LiquidMenu: Main Page</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td id="projectlogo"><img alt="Logo" src="logo_small.png"/></td>
|
|
<td id="projectalign" style="padding-left: 0.5em;">
|
|
<div id="projectname">LiquidMenu
|
|
 <span id="projectnumber">1.5.1</span>
|
|
</div>
|
|
<div id="projectbrief">Menu creation Arduino library for LCDs, wraps LiquidCrystal.</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.14 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
/* @license-end */
|
|
</script>
|
|
<script type="text/javascript" src="menudata.js"></script>
|
|
<script type="text/javascript" src="menu.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(function() {
|
|
initMenu('',true,false,'search.php','Search');
|
|
$(document).ready(function() { init_search(); });
|
|
});
|
|
/* @license-end */</script>
|
|
<div id="main-nav"></div>
|
|
</div><!-- top -->
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div class="header">
|
|
<div class="headertitle">
|
|
<div class="title">LiquidMenu Documentation</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<div class="textblock"><div class="image">
|
|
<img src="logo.png" alt="logo.png"/>
|
|
<div class="caption">
|
|
Logo</div></div>
|
|
<p> <em>Menu creation Arduino library for LCDs, wraps <a href="https://github.com/arduino-libraries/LiquidCrystal">LiquidCrystal</a>.</em></p>
|
|
<p><a href="https://github.com/VaSe7u/LiquidMenu/archive/v1.5.1.zip"></a> <a href="https://travis-ci.org/VaSe7u/LiquidMenu"></a> <a href="https://VaSe7u.github.io/LiquidMenu/doc/Doxygen/html/annotated.html"></a> <a href="https://opensource.org/licenses/mit-license.php"></a></p>
|
|
<p><b><a class="el" href="class_liquid_menu.html" title="Represents a collection of screens forming a menu. ">LiquidMenu</a></b> wraps the Arduino's <a href="https://github.com/arduino-libraries/LiquidCrystal">LiquidCrystal</a> library with the ability to create menus. It simplifies the menu creation process by abstracting the elements of a menu into hierarchically organized classes.</p>
|
|
<h1>Resources </h1>
|
|
<ul>
|
|
<li><a href="/examples">Examples</a></li>
|
|
<li><a href="https://VaSe7u.github.io/LiquidMenu/doc/Doxygen/html/annotated.html">API reference</a></li>
|
|
<li><a href="https://github.com/VaSe7u/LiquidMenu/releases/latest">Latest release</a></li>
|
|
</ul>
|
|
<h1>Features </h1>
|
|
<ul>
|
|
<li>Fast and easy menu creation.</li>
|
|
<li>Selectable menu items.</li>
|
|
<li>Callback functions.</li>
|
|
<li>I2C connection.</li>
|
|
</ul>
|
|
<h1>Requirements </h1>
|
|
<ul>
|
|
<li>The Arduino's <a href="https://github.com/arduino-libraries/LiquidCrystal">LiquidCrystal</a> or similar library.</li>
|
|
<li>LCD supported by <a href="https://github.com/arduino-libraries/LiquidCrystal">LiquidCrystal</a> (<em>with Hitachi HD44780 or a compatible chipset</em>).</li>
|
|
<li>Arduino board or a compatible microcontroller.</li>
|
|
<li>Input device is recommended (<em>buttons, rotary encoder, etc.</em>).</li>
|
|
</ul>
|
|
<h1>Quick start </h1>
|
|
<h3>Classes organization</h3>
|
|
<p>The library uses hierarchically structured classes to represent the different elements of a menu.</p>
|
|
<p><em>Basic class hierarchy diagram:</em></p>
|
|
<div class="image">
|
|
<img src="https://github.com/VaSe7u/LiquidMenu/blob/master/doc/Images/basic_diagram.png" alt="Basic class hierarchy diagram" title="Basic class hierarchy diagram"/>
|
|
</div>
|
|
<p><em>Click <a href="https://github.com/VaSe7u/LiquidMenu/blob/master/doc/Images/diagram.png?raw=true">here</a> for a complete hierarchy diagram.</em></p>
|
|
<p>The <b><a class="el" href="class_liquid_line.html" title="Represents the individual lines printed on the display. ">LiquidLine</a></b> class represents a <b>line</b> of text/numbers on the display. To create a new <b><a class="el" href="class_liquid_line.html" title="Represents the individual lines printed on the display. ">LiquidLine</a></b> object use its constructor.</p>
|
|
<p>The <b><a class="el" href="class_liquid_screen.html" title="Represents a screen shown on the display. ">LiquidScreen</a></b> class represents a collection of <b>lines</b> that are shown together at the same time on the display (<em>i.e. "the current screen"</em>).</p>
|
|
<p>The <b><a class="el" href="class_liquid_menu.html" title="Represents a collection of screens forming a menu. ">LiquidMenu</a></b> class combines the <b>screens</b> to form a <b>menu</b>. This class is used for controlling the <b>menu</b> (<em>switching <b>screens</b>, selecting <b>lines</b>, calling functions etc.</em>).</p>
|
|
<p>The <b><a class="el" href="class_liquid_system.html" title="Represents a collection of menus forming a menu system. ">LiquidSystem</a></b> is an optional class that combines <b>menus</b> to form a <b>menu system</b> (<em>e.g. Main menu, Settings, etc.</em>). It has the same public interface as <b><a class="el" href="class_liquid_menu.html" title="Represents a collection of screens forming a menu. ">LiquidMenu</a></b>.</p>
|
|
<h3>Creating a menu</h3>
|
|
<p>Menu creation is all about structure. First there are variables/constants that go into the <b><a class="el" href="class_liquid_line.html" title="Represents the individual lines printed on the display. ">LiquidLine</a></b> objects. Then the <b><a class="el" href="class_liquid_line.html" title="Represents the individual lines printed on the display. ">LiquidLine</a></b> objects go into the <b><a class="el" href="class_liquid_screen.html" title="Represents a screen shown on the display. ">LiquidScreen</a></b> objects. Then <b><a class="el" href="class_liquid_screen.html" title="Represents a screen shown on the display. ">LiquidScreen</a></b> objects go into the <b><a class="el" href="class_liquid_menu.html" title="Represents a collection of screens forming a menu. ">LiquidMenu</a></b> object/s. And optionally the <b><a class="el" href="class_liquid_menu.html" title="Represents a collection of screens forming a menu. ">LiquidMenu</a></b> objects go into the <b><a class="el" href="class_liquid_system.html" title="Represents a collection of menus forming a menu system. ">LiquidSystem</a></b> object. This structure can be established on object instantiation or later with the classes' public methods: </p><div class="fragment"><div class="line">{c++}</div><div class="line">// Takes column and row for the position and 1 to 4 variable references. These variable</div><div class="line">// references are what is going to be printed on the display. They can be integers used</div><div class="line">// in the program, string literals passed direrctly or a char* for changing text.</div><div class="line">LiquidLine(byte column, byte row, A &variableA...);</div><div class="line"></div><div class="line">// Takes 0 to 4 LiquidLine objects.</div><div class="line">LiquidScreen(LiquidLine &liquidLine1...);</div><div class="line"></div><div class="line">// Takes a reference to the LiquidCrystal object, 0 to 4 LiquidScreen objects and</div><div class="line">// the number of the screen that will be shown first.</div><div class="line">LiquidMenu(LiquidCrystal &liquidCrystal, LiquidScreen &liquidScreen1..., byte startingScreen = 1);</div><div class="line"></div><div class="line">// Takes 0 to 4 LiquidMenu objects and the number of the menu that will be shown first.</div><div class="line">LiquidSystem(LiquidMenu &liquidMenu1..., byte startingMenu = 1);</div></div><!-- fragment --><h3>Navigating the menu</h3>
|
|
<p>The menu is navigated from the <b><a class="el" href="class_liquid_menu.html" title="Represents a collection of screens forming a menu. ">LiquidMenu</a></b> object or if there are multiple menus - the <b><a class="el" href="class_liquid_system.html" title="Represents a collection of menus forming a menu system. ">LiquidSystem</a></b> object. The <b>screens</b> can by cycled forward and backward or a specific <b>screen</b> can be specified by its object or number.</p>
|
|
<div class="fragment"><div class="line">{c++}</div><div class="line">void LiquidMenu::next_screen();</div><div class="line">void LiquidMenu::previous_screen();</div><div class="line">bool LiquidMenu::change_screen(LiquidScreen &liquidScreen);</div></div><!-- fragment --><h3>Focus and callback functions</h3>
|
|
<p>The <b>lines</b> of text/numbers shown on the display can be interactive. Every line can have callback functions attached to it (<em>up to 8 by default</em>). They are attached with a number specified by the user. </p><div class="fragment"><div class="line">{c++}</div><div class="line">bool LiquidLine::attach_function(byte number, void (*function)(void));</div></div><!-- fragment --><p> To call a <b>line's</b> attached function, the <b>line</b> needs to be <b>focused</b> (<em>selected</em>). To cycle the <b>focus</b> through the <b>lines</b> shown on the <b>screen</b> use: </p><div class="fragment"><div class="line">{c++}</div><div class="line">void LiquidMenu::switch_focus(bool forward = true);</div></div><!-- fragment --><p> When the <b>line</b> is selected one of its attached functions can be called with: </p><div class="fragment"><div class="line">{c++}</div><div class="line">void LiquidMenu::call_function(byte number);</div></div><!-- fragment --><p> The <code>number</code> specifies which one of the attached functions should be called.</p>
|
|
<p><em>Similar functions can be attached under the same number to different <b>lines</b> and then called on a similar events. For example if we are printing on the display the state of four LEDs. The four LEDs are instantiated in four <b><a class="el" href="class_liquid_line.html" title="Represents the individual lines printed on the display. ">LiquidLine</a></b> objects with their name and their state. The functions used to turn them on can be attached under number 1 and the functions for turning them off - under number 2. Then if we have 3 buttons, one can be used to switch the focus, the second (say 'UP') button can be used to call function 1 and the third (say 'DOWN') button can be used to call function 2.</em></p>
|
|
<p>### Basic example </p><div class="fragment"><div class="line">{c++}</div><div class="line">...</div><div class="line">// First we need to instantiate the LiquidCrystal object.</div><div class="line">LiquidCrystal lcd(LCD_RS, LCD_E, LCD_D4, LCD_D5, LCD_D6, LCD_D7);</div><div class="line"></div><div class="line">// ----- WELCOME SCREEN -----</div><div class="line">/// Instantiating a line with one string literal.</div><div class="line">LiquidLine welcome_line1(1, 0, "Hello Menu");</div><div class="line"></div><div class="line">/// Instantiating a line with an integer variable.</div><div class="line">byte oneTwoThree = 123;</div><div class="line">LiquidLine welcome_line2(2, 1, oneTwoThree);</div><div class="line"></div><div class="line">/// Forming a screen from the above two lines.</div><div class="line">LiquidScreen welcome_screen(welcome_line1, welcome_line2);</div><div class="line">// --------------------------</div><div class="line"></div><div class="line">// ----- SCREEN 2 -----</div><div class="line">LiquidLine some_line(0, 0, "Some line");</div><div class="line">LiquidScreen some_screen(some_line);</div><div class="line">// --------------------</div><div class="line"></div><div class="line">// Now let's combine the screens into a menu.</div><div class="line">LiquidMenu my_menu(lcd, welcome_screen, some_screen);</div><div class="line"></div><div class="line">void setup() {</div><div class="line"> lcd.begin(16, 2);</div><div class="line"> ...</div><div class="line">}</div><div class="line"></div><div class="line">void loop() {</div><div class="line"> if (rightButton) {</div><div class="line"> my_menu.next_screen();</div><div class="line"> }</div><div class="line"> if (leftButton) {</div><div class="line"> my_menu.previous_screen();</div><div class="line"> }</div><div class="line"> if (somethingElse) {</div><div class="line"> oneTwoThree++;</div><div class="line"> my_menu.update;</div><div class="line"> }</div><div class="line"> ...</div><div class="line">}</div></div><!-- fragment --><h1>Contributors </h1>
|
|
<p><a href="https://github.com/circuitsforfun">Richard Wardlow</a> - Scrolling lines and configuring the number of digits shown after the decimal point.</p>
|
|
<p><a href="https://github.com/jmpmscorp">Jose Manuel</a> - Getter functions in "lines".</p>
|
|
<p>For more information, please refer to the /.github/CONTRIBUTING.md "CONTRIBUTING" guide.</p>
|
|
<h1>License </h1>
|
|
<p>The MIT License (MIT)</p>
|
|
<p>Copyright (c) 2016 Vasil Kalchev</p>
|
|
<p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p>
|
|
<p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p>
|
|
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. </p>
|
|
</div></div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.14
|
|
</small></address>
|
|
</body>
|
|
</html>
|
|
|