Rename FreetronicsLCD to just LCD
@ -1,12 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
This example demonstrates how to use the Form and Field classes from the
|
This example demonstrates how to use the Form and Field classes from the
|
||||||
FreetronicsLCD library to provide a simple UI on the 16x2 LCD display.
|
LCD library to provide a simple UI on the 16x2 LCD display.
|
||||||
|
|
||||||
This example is placed into the public domain.
|
This example is placed into the public domain.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// include the library code:
|
// include the library code:
|
||||||
#include <FreetronicsLCD.h>
|
#include <LCD.h>
|
||||||
#include <Form.h>
|
#include <Form.h>
|
||||||
#include <TextField.h>
|
#include <TextField.h>
|
||||||
#include <TimeField.h>
|
#include <TimeField.h>
|
||||||
@ -14,11 +14,11 @@ This example is placed into the public domain.
|
|||||||
#include <BoolField.h>
|
#include <BoolField.h>
|
||||||
|
|
||||||
// Initialize the LCD
|
// Initialize the LCD
|
||||||
FreetronicsLCD lcd;
|
LCD lcd;
|
||||||
|
|
||||||
// Note: if you are using the USBDroid and have reassigned pin D9 on the LCD shield to some
|
// Note: if you are using the USBDroid and have reassigned pin D9 on the LCD shield to some
|
||||||
// other pin (e.g. A1), then you will need to initialize the shield with something like:
|
// other pin (e.g. A1), then you will need to initialize the shield with something like:
|
||||||
// FreetronicsLCD lcd(A1);
|
// LCD lcd(A1);
|
||||||
// See also: http://www.freetronics.com/pages/combining-the-lcd-keypad-shield-and-the-usbdroid
|
// See also: http://www.freetronics.com/pages/combining-the-lcd-keypad-shield-and-the-usbdroid
|
||||||
|
|
||||||
// Create the main form and its fields.
|
// Create the main form and its fields.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
This example demonstrates how to use the FreetronicsLCD library, which extends the
|
This example demonstrates how to use the LCD library, which extends the
|
||||||
standard LiquidCrystal library to provide support for the Freetronics back light
|
standard LiquidCrystal library to provide support for the Freetronics back light
|
||||||
and Up/Down/Left/Right/Select buttons. More information on the shield here:
|
and Up/Down/Left/Right/Select buttons. More information on the shield here:
|
||||||
|
|
||||||
@ -9,14 +9,14 @@ This example is placed into the public domain.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// include the library code:
|
// include the library code:
|
||||||
#include <FreetronicsLCD.h>
|
#include <LCD.h>
|
||||||
|
|
||||||
// initialize the library
|
// initialize the library
|
||||||
FreetronicsLCD lcd;
|
LCD lcd;
|
||||||
|
|
||||||
// Note: if you are using the USBDroid and have reassigned pin D9 on the LCD shield to some
|
// Note: if you are using the USBDroid and have reassigned pin D9 on the LCD shield to some
|
||||||
// other pin (e.g. A1), then you will need to initialize the shield with something like:
|
// other pin (e.g. A1), then you will need to initialize the shield with something like:
|
||||||
// FreetronicsLCD lcd(A1);
|
// LCD lcd(A1);
|
||||||
// See also: http://www.freetronics.com/pages/combining-the-lcd-keypad-shield-and-the-usbdroid
|
// See also: http://www.freetronics.com/pages/combining-the-lcd-keypad-shield-and-the-usbdroid
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
@ -610,7 +610,7 @@ WARN_LOGFILE =
|
|||||||
# directories like "/usr/src/myproject". Separate the files or directories
|
# directories like "/usr/src/myproject". Separate the files or directories
|
||||||
# with spaces.
|
# with spaces.
|
||||||
|
|
||||||
INPUT = ../libraries/FreetronicsLCD ../libraries/BlinkLED ../libraries/I2C ../libraries/RTC ../libraries/Melody ../libraries/PowerSave .
|
INPUT = ../libraries/LCD ../libraries/BlinkLED ../libraries/I2C ../libraries/RTC ../libraries/Melody ../libraries/PowerSave .
|
||||||
|
|
||||||
# This tag can be used to specify the character encoding of the source files
|
# This tag can be used to specify the character encoding of the source files
|
||||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
|
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
|
||||||
@ -688,7 +688,7 @@ EXAMPLE_RECURSIVE = NO
|
|||||||
# directories that contain image that are included in the documentation (see
|
# directories that contain image that are included in the documentation (see
|
||||||
# the \image command).
|
# the \image command).
|
||||||
|
|
||||||
IMAGE_PATH = ../libraries/BlinkLED/examples/Cylon ../libraries/BlinkLED/examples/Cylon4 ../libraries/BlinkLED/examples/StarTrek ../libraries/FreetronicsLCD/examples/HelloWorld ../libraries/FreetronicsLCD/examples/Form ../libraries/RTC/examples/AlarmClock
|
IMAGE_PATH = ../libraries/BlinkLED/examples/Cylon ../libraries/BlinkLED/examples/Cylon4 ../libraries/BlinkLED/examples/StarTrek ../libraries/LCD/examples/HelloWorld ../libraries/LCD/examples/Form ../libraries/RTC/examples/AlarmClock
|
||||||
|
|
||||||
# The INPUT_FILTER tag can be used to specify a program that doxygen should
|
# The INPUT_FILTER tag can be used to specify a program that doxygen should
|
||||||
# invoke to filter for each input file. Doxygen will invoke the filter program
|
# invoke to filter for each input file. Doxygen will invoke the filter program
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
\section clock_features Features
|
\section clock_features Features
|
||||||
|
|
||||||
The alarm clock described on this page is a large example application that
|
The alarm clock described on this page is a large example application that
|
||||||
uses many of the classes in the provided libraries: FreetronicsLCD, Form,
|
uses many of the classes in the provided libraries: LCD, Form,
|
||||||
Field, SoftI2C, DS1307RTC, Melody and \ref power_save "PowerSave".
|
Field, SoftI2C, DS1307RTC, Melody and \ref power_save "PowerSave".
|
||||||
The clock has the following features:
|
The clock has the following features:
|
||||||
|
|
||||||
|
@ -37,14 +37,14 @@ buttons are used to modify the value of the currently-displayed field.
|
|||||||
|
|
||||||
We start by including the classes from the library that we will need:
|
We start by including the classes from the library that we will need:
|
||||||
|
|
||||||
\dontinclude FreetronicsLCD/examples/Form/Form.pde
|
\dontinclude LCD/examples/Form/Form.pde
|
||||||
\skip FreetronicsLCD.h
|
\skip LCD.h
|
||||||
\until BoolField.h
|
\until BoolField.h
|
||||||
|
|
||||||
Next, we initialize the LCD display, create the main form, and populate
|
Next, we initialize the LCD display, create the main form, and populate
|
||||||
it with fields:
|
it with fields:
|
||||||
|
|
||||||
\dontinclude FreetronicsLCD/examples/Form/Form.pde
|
\dontinclude LCD/examples/Form/Form.pde
|
||||||
\skip lcd;
|
\skip lcd;
|
||||||
\until lcd;
|
\until lcd;
|
||||||
\skip mainForm
|
\skip mainForm
|
||||||
@ -77,7 +77,7 @@ duration between 0 and 24 hours.
|
|||||||
Now that we have defined our form, we need to initialize the program and
|
Now that we have defined our form, we need to initialize the program and
|
||||||
show it for the first time:
|
show it for the first time:
|
||||||
|
|
||||||
\dontinclude FreetronicsLCD/examples/Form/Form.pde
|
\dontinclude LCD/examples/Form/Form.pde
|
||||||
\skip STATUS_LED
|
\skip STATUS_LED
|
||||||
\until }
|
\until }
|
||||||
|
|
||||||
@ -86,10 +86,10 @@ given time. To switch to another form, call Form::hide() on the old
|
|||||||
form and Form::show() on the new form.
|
form and Form::show() on the new form.
|
||||||
|
|
||||||
All that remains is to define our application's \c loop function which
|
All that remains is to define our application's \c loop function which
|
||||||
retrieves button events from FreetronicsLCD::getButton() and dispatches them
|
retrieves button events from LCD::getButton() and dispatches them
|
||||||
to the form:
|
to the form:
|
||||||
|
|
||||||
\dontinclude FreetronicsLCD/examples/Form/Form.pde
|
\dontinclude LCD/examples/Form/Form.pde
|
||||||
\skip loop()
|
\skip loop()
|
||||||
\until }
|
\until }
|
||||||
\until }
|
\until }
|
||||||
@ -97,5 +97,5 @@ to the form:
|
|||||||
|
|
||||||
The full source code for the example follows:
|
The full source code for the example follows:
|
||||||
|
|
||||||
\include FreetronicsLCD/examples/Form/Form.pde
|
\include LCD/examples/Form/Form.pde
|
||||||
*/
|
*/
|
||||||
|
@ -24,20 +24,20 @@
|
|||||||
\file lcd-helloworld.dox
|
\file lcd-helloworld.dox
|
||||||
\page lcd_hello_world Hello World for Freetronics LCD
|
\page lcd_hello_world Hello World for Freetronics LCD
|
||||||
|
|
||||||
The FreetronicsLCD class provides an enhanced version of the standard
|
The LCD class provides an enhanced version of the standard
|
||||||
Arduino <a href="http://arduino.cc/en/Reference/LiquidCrystal">LiquidCrystal</a>
|
Arduino <a href="http://arduino.cc/en/Reference/LiquidCrystal">LiquidCrystal</a>
|
||||||
library that supports the additional features of the
|
library that supports the additional features of the
|
||||||
<a href="http://www.freetronics.com/pages/16x2-lcd-shield-quickstart-guide">Freetronics LCD</a> shield;
|
<a href="http://www.freetronics.com/pages/16x2-lcd-shield-quickstart-guide">Freetronics LCD</a> shield;
|
||||||
namely the back light and the Up, Down, Left, Right, and Select buttons.
|
namely the back light and the Up, Down, Left, Right, and Select buttons.
|
||||||
This tutorial explains how to use the FreetronicsLCD class to perform
|
This tutorial explains how to use the LCD class to perform
|
||||||
basic text output and to use the enhanced shield features.
|
basic text output and to use the enhanced shield features.
|
||||||
|
|
||||||
\image html HelloWorld.png
|
\image html HelloWorld.png
|
||||||
|
|
||||||
We start by including the library and initializing it:
|
We start by including the library and initializing it:
|
||||||
|
|
||||||
\dontinclude FreetronicsLCD/examples/HelloWorld/HelloWorld.pde
|
\dontinclude LCD/examples/HelloWorld/HelloWorld.pde
|
||||||
\skip FreetronicsLCD.h
|
\skip LCD.h
|
||||||
\until lcd
|
\until lcd
|
||||||
|
|
||||||
Unlike the LiquidCrystal library we don't normally need to specify the pin
|
Unlike the LiquidCrystal library we don't normally need to specify the pin
|
||||||
@ -47,39 +47,39 @@ with the USBDroid and the D9 pin is reassigned as described on
|
|||||||
would look something like this instead:
|
would look something like this instead:
|
||||||
|
|
||||||
\code
|
\code
|
||||||
FreetronicsLCD lcd(A1);
|
LCD lcd(A1);
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
The next step is to enable the screen saver and print some text
|
The next step is to enable the screen saver and print some text
|
||||||
in the \c setup function:
|
in the \c setup function:
|
||||||
|
|
||||||
\dontinclude FreetronicsLCD/examples/HelloWorld/HelloWorld.pde
|
\dontinclude LCD/examples/HelloWorld/HelloWorld.pde
|
||||||
\skip setup()
|
\skip setup()
|
||||||
\until }
|
\until }
|
||||||
|
|
||||||
The screen saver is a built-in feature of the FreetronicsLCD class that
|
The screen saver is a built-in feature of the LCD class that
|
||||||
turns off the display and the back light after a specific timeout
|
turns off the display and the back light after a specific timeout
|
||||||
(the default is 10 seconds). Pressing any of the keys on the shield
|
(the default is 10 seconds). Pressing any of the keys on the shield
|
||||||
or calling FreetronicsLCD::display() will wake up the screen again.
|
or calling LCD::display() will wake up the screen again.
|
||||||
|
|
||||||
In the program's \c loop function we print the number of seconds
|
In the program's \c loop function we print the number of seconds
|
||||||
since startup to the second line of the LCD display:
|
since startup to the second line of the LCD display:
|
||||||
|
|
||||||
\dontinclude FreetronicsLCD/examples/HelloWorld/HelloWorld.pde
|
\dontinclude LCD/examples/HelloWorld/HelloWorld.pde
|
||||||
\skip loop()
|
\skip loop()
|
||||||
\until millis()
|
\until millis()
|
||||||
|
|
||||||
We then print the name of the button that is currently pressed:
|
We then print the name of the button that is currently pressed:
|
||||||
|
|
||||||
\dontinclude FreetronicsLCD/examples/HelloWorld/HelloWorld.pde
|
\dontinclude LCD/examples/HelloWorld/HelloWorld.pde
|
||||||
\skip setCursor(8, 1)
|
\skip setCursor(8, 1)
|
||||||
\until }
|
\until }
|
||||||
|
|
||||||
The FreetronicsLCD::getButton() function returns the key that has
|
The LCD::getButton() function returns the key that has
|
||||||
been pressed or released, or LCD_BUTTON_NONE if no key has been
|
been pressed or released, or LCD_BUTTON_NONE if no key has been
|
||||||
pressed or released this time through the loop.
|
pressed or released this time through the loop.
|
||||||
|
|
||||||
The full source code for the example follows:
|
The full source code for the example follows:
|
||||||
|
|
||||||
\include FreetronicsLCD/examples/HelloWorld/HelloWorld.pde
|
\include LCD/examples/HelloWorld/HelloWorld.pde
|
||||||
*/
|
*/
|
||||||
|
@ -27,9 +27,9 @@
|
|||||||
Utility libraries for enhanced use of standard Arduino main boards
|
Utility libraries for enhanced use of standard Arduino main boards
|
||||||
and shields.
|
and shields.
|
||||||
|
|
||||||
\section main_FreeTronics Freetronics LCD Shield
|
\section main_LCD Freetronics LCD Shield
|
||||||
|
|
||||||
\li FreetronicsLCD class to manage the extended features of the Freetronics
|
\li LCD class to manage the extended features of the Freetronics
|
||||||
LCD shield.
|
LCD shield.
|
||||||
\li Form and Field classes to build simple property sheet UI's on LCD displays.
|
\li Form and Field classes to build simple property sheet UI's on LCD displays.
|
||||||
\li \ref lcd_hello_world "Hello World" example for the Freetronics LCD shield.
|
\li \ref lcd_hello_world "Hello World" example for the Freetronics LCD shield.
|
||||||
@ -67,7 +67,7 @@ The default implementation simulates the time and date based on the value of
|
|||||||
<tt>millis()</tt>.
|
<tt>millis()</tt>.
|
||||||
\li DS1307RTC class that talks to the DS1307 realtime clock chip via I2C.
|
\li DS1307RTC class that talks to the DS1307 realtime clock chip via I2C.
|
||||||
\li \ref alarm_clock "Alarm Clock" example that uses the DS1307
|
\li \ref alarm_clock "Alarm Clock" example that uses the DS1307
|
||||||
realtime clock and the FreetronicsLCD library to implement an alarm clock.
|
realtime clock and the LCD library to implement an alarm clock.
|
||||||
|
|
||||||
\section main_other Other
|
\section main_other Other
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Utility for generating the button mapping table in FreetronicsLCD.cpp.
|
// Utility for generating the button mapping table in LCD.cpp.
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ Field::~Field()
|
|||||||
/**
|
/**
|
||||||
* \brief Dispatches \a event via this field.
|
* \brief Dispatches \a event via this field.
|
||||||
*
|
*
|
||||||
* The \a event is usually obtained from FreetronicsLCD::getButton().
|
* The \a event is usually obtained from LCD::getButton().
|
||||||
*
|
*
|
||||||
* Returns zero if the \a event has been handled and no further action
|
* Returns zero if the \a event has been handled and no further action
|
||||||
* is required.
|
* is required.
|
||||||
@ -91,7 +91,7 @@ Field::~Field()
|
|||||||
* be handled by the Form itself (particularly for Left and Right buttons).
|
* be handled by the Form itself (particularly for Left and Right buttons).
|
||||||
* The default implementation returns -1 for all events.
|
* The default implementation returns -1 for all events.
|
||||||
*
|
*
|
||||||
* \sa Form::dispatch(), FreetronicsLCD::getButton()
|
* \sa Form::dispatch(), LCD::getButton()
|
||||||
*/
|
*/
|
||||||
int Field::dispatch(int event)
|
int Field::dispatch(int event)
|
||||||
{
|
{
|
@ -72,7 +72,7 @@ Form::~Form()
|
|||||||
* \brief Dispatches \a event to the currently active field using
|
* \brief Dispatches \a event to the currently active field using
|
||||||
* Field::dispatch().
|
* Field::dispatch().
|
||||||
*
|
*
|
||||||
* The \a event is usually obtained from FreetronicsLCD::getButton().
|
* The \a event is usually obtained from LCD::getButton().
|
||||||
*
|
*
|
||||||
* Returns zero if the \a event has been handled and no further action
|
* Returns zero if the \a event has been handled and no further action
|
||||||
* is required.
|
* is required.
|
||||||
@ -94,7 +94,7 @@ Form::~Form()
|
|||||||
*
|
*
|
||||||
* This function handles the Left and Right buttons to navigate between fields.
|
* This function handles the Left and Right buttons to navigate between fields.
|
||||||
*
|
*
|
||||||
* \sa Field::dispatch(), FreetronicsLCD::getButton(), currentField(), isCurrent()
|
* \sa Field::dispatch(), LCD::getButton(), currentField(), isCurrent()
|
||||||
*/
|
*/
|
||||||
int Form::dispatch(int event)
|
int Form::dispatch(int event)
|
||||||
{
|
{
|
@ -23,7 +23,7 @@
|
|||||||
#ifndef Form_h
|
#ifndef Form_h
|
||||||
#define Form_h
|
#define Form_h
|
||||||
|
|
||||||
#include "FreetronicsLCD.h"
|
#include "LCD.h"
|
||||||
|
|
||||||
class Field;
|
class Field;
|
||||||
|
|
@ -20,7 +20,7 @@
|
|||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "FreetronicsLCD.h"
|
#include "LCD.h"
|
||||||
#include <avr/pgmspace.h>
|
#include <avr/pgmspace.h>
|
||||||
#include <WProgram.h>
|
#include <WProgram.h>
|
||||||
|
|
||||||
@ -30,7 +30,7 @@
|
|||||||
#define DEBOUNCE_DELAY 10 // Delay in ms to debounce buttons
|
#define DEBOUNCE_DELAY 10 // Delay in ms to debounce buttons
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class FreetronicsLCD FreetronicsLCD.h <FreetronicsLCD.h>
|
* \class LCD LCD.h <LCD.h>
|
||||||
* \brief Enhanced library for Freetronics 16x2 LCD shields
|
* \brief Enhanced library for Freetronics 16x2 LCD shields
|
||||||
*
|
*
|
||||||
* This class extends the standard Arduino LiquidCrystal library with
|
* This class extends the standard Arduino LiquidCrystal library with
|
||||||
@ -70,13 +70,13 @@
|
|||||||
* generic button has been released with <tt>button < 0</tt>.
|
* generic button has been released with <tt>button < 0</tt>.
|
||||||
*
|
*
|
||||||
* See the \ref lcd_hello_world "Hello World" example for more
|
* See the \ref lcd_hello_world "Hello World" example for more
|
||||||
* information on using the FreetronicsLCD class.
|
* information on using the LCD class.
|
||||||
*
|
*
|
||||||
* \sa Form
|
* \sa Form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn FreetronicsLCD::FreetronicsLCD()
|
* \fn LCD::LCD()
|
||||||
* \brief Initialize the Freetronics LCD display with the default
|
* \brief Initialize the Freetronics LCD display with the default
|
||||||
* pin assignment.
|
* pin assignment.
|
||||||
*
|
*
|
||||||
@ -84,12 +84,12 @@
|
|||||||
* LCD shield:
|
* LCD shield:
|
||||||
*
|
*
|
||||||
* \code
|
* \code
|
||||||
* FreetronicsLCD lcd;
|
* LCD lcd;
|
||||||
* \endcode
|
* \endcode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn FreetronicsLCD::FreetronicsLCD(uint8_t pin9)
|
* \fn LCD::LCD(uint8_t pin9)
|
||||||
* \brief Initialize the Freetronics LCD display for USBDroid.
|
* \brief Initialize the Freetronics LCD display for USBDroid.
|
||||||
*
|
*
|
||||||
* On the USBDroid, the D9 pin is used for USB Host functionality.
|
* On the USBDroid, the D9 pin is used for USB Host functionality.
|
||||||
@ -104,11 +104,11 @@
|
|||||||
* Web page of A1, you would initialize the LCD as follows:
|
* Web page of A1, you would initialize the LCD as follows:
|
||||||
*
|
*
|
||||||
* \code
|
* \code
|
||||||
* FreetronicsLCD lcd(A1);
|
* LCD lcd(A1);
|
||||||
* \endcode
|
* \endcode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void FreetronicsLCD::init()
|
void LCD::init()
|
||||||
{
|
{
|
||||||
// The Freetronics display is 16x2.
|
// The Freetronics display is 16x2.
|
||||||
begin(16, 2);
|
begin(16, 2);
|
||||||
@ -141,7 +141,7 @@ void FreetronicsLCD::init()
|
|||||||
*
|
*
|
||||||
* \sa noDisplay(), enableScreenSaver(), setScreenSaverMode()
|
* \sa noDisplay(), enableScreenSaver(), setScreenSaverMode()
|
||||||
*/
|
*/
|
||||||
void FreetronicsLCD::display()
|
void LCD::display()
|
||||||
{
|
{
|
||||||
LiquidCrystal::display();
|
LiquidCrystal::display();
|
||||||
digitalWrite(LCD_BACK_LIGHT, HIGH);
|
digitalWrite(LCD_BACK_LIGHT, HIGH);
|
||||||
@ -156,7 +156,7 @@ void FreetronicsLCD::display()
|
|||||||
*
|
*
|
||||||
* \sa display(), enableScreenSaver(), setScreenSaverMode()
|
* \sa display(), enableScreenSaver(), setScreenSaverMode()
|
||||||
*/
|
*/
|
||||||
void FreetronicsLCD::noDisplay()
|
void LCD::noDisplay()
|
||||||
{
|
{
|
||||||
if (mode == DisplayOff)
|
if (mode == DisplayOff)
|
||||||
LiquidCrystal::noDisplay();
|
LiquidCrystal::noDisplay();
|
||||||
@ -165,30 +165,30 @@ void FreetronicsLCD::noDisplay()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \enum FreetronicsLCD::ScreenSaverMode
|
* \enum LCD::ScreenSaverMode
|
||||||
* \brief Screen saver mode that controls the display and back light.
|
* \brief Screen saver mode that controls the display and back light.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \var FreetronicsLCD::DisplayOff
|
* \var LCD::DisplayOff
|
||||||
* \brief Turn off both the display and the backlight when the screen saver
|
* \brief Turn off both the display and the backlight when the screen saver
|
||||||
* is activated.
|
* is activated.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \var FreetronicsLCD::BacklightOff
|
* \var LCD::BacklightOff
|
||||||
* \brief Turn off the back light but leave the display on when the screen
|
* \brief Turn off the back light but leave the display on when the screen
|
||||||
* saver is activated.
|
* saver is activated.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \var FreetronicsLCD::BacklightOnSelect
|
* \var LCD::BacklightOnSelect
|
||||||
* \brief Same as BacklightOff but the screen saver is only deactivated when
|
* \brief Same as BacklightOff but the screen saver is only deactivated when
|
||||||
* Select is pressed; other buttons have no effect.
|
* Select is pressed; other buttons have no effect.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn ScreenSaverMode FreetronicsLCD::screenSaverMode() const
|
* \fn ScreenSaverMode LCD::screenSaverMode() const
|
||||||
* \brief Returns the current screen saver mode; default is DisplayOff.
|
* \brief Returns the current screen saver mode; default is DisplayOff.
|
||||||
*
|
*
|
||||||
* \sa setScreenSaverMode(), enableScreenSaver()
|
* \sa setScreenSaverMode(), enableScreenSaver()
|
||||||
@ -199,7 +199,7 @@ void FreetronicsLCD::noDisplay()
|
|||||||
*
|
*
|
||||||
* \sa screenSaverMode(), enableScreenSaver()
|
* \sa screenSaverMode(), enableScreenSaver()
|
||||||
*/
|
*/
|
||||||
void FreetronicsLCD::setScreenSaverMode(ScreenSaverMode mode)
|
void LCD::setScreenSaverMode(ScreenSaverMode mode)
|
||||||
{
|
{
|
||||||
if (this->mode != mode) {
|
if (this->mode != mode) {
|
||||||
this->mode = mode;
|
this->mode = mode;
|
||||||
@ -225,7 +225,7 @@ void FreetronicsLCD::setScreenSaverMode(ScreenSaverMode mode)
|
|||||||
*
|
*
|
||||||
* \sa disableScreenSaver(), display(), getButton(), isScreenSaved()
|
* \sa disableScreenSaver(), display(), getButton(), isScreenSaved()
|
||||||
*/
|
*/
|
||||||
void FreetronicsLCD::enableScreenSaver(int timeoutSecs)
|
void LCD::enableScreenSaver(int timeoutSecs)
|
||||||
{
|
{
|
||||||
if (timeoutSecs < 0)
|
if (timeoutSecs < 0)
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
@ -239,14 +239,14 @@ void FreetronicsLCD::enableScreenSaver(int timeoutSecs)
|
|||||||
*
|
*
|
||||||
* \sa enableScreenSaver(), display(), isScreenSaved()
|
* \sa enableScreenSaver(), display(), isScreenSaved()
|
||||||
*/
|
*/
|
||||||
void FreetronicsLCD::disableScreenSaver()
|
void LCD::disableScreenSaver()
|
||||||
{
|
{
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
display();
|
display();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn bool FreetronicsLCD::isScreenSaved() const
|
* \fn bool LCD::isScreenSaved() const
|
||||||
* \brief Returns true if the screen has been saved; false otherwise.
|
* \brief Returns true if the screen has been saved; false otherwise.
|
||||||
*
|
*
|
||||||
* \sa enableScreenSaver()
|
* \sa enableScreenSaver()
|
||||||
@ -284,7 +284,7 @@ static prog_uint8_t const buttonMappings[] PROGMEM = {
|
|||||||
*
|
*
|
||||||
* \sa enableScreenSaver(), display(), Form::dispatch()
|
* \sa enableScreenSaver(), display(), Form::dispatch()
|
||||||
*/
|
*/
|
||||||
int FreetronicsLCD::getButton()
|
int LCD::getButton()
|
||||||
{
|
{
|
||||||
// Read the currently pressed button.
|
// Read the currently pressed button.
|
||||||
int button = mapButton(analogRead(LCD_BUTTON_PIN));
|
int button = mapButton(analogRead(LCD_BUTTON_PIN));
|
@ -20,8 +20,8 @@
|
|||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FreetronicsLCD_h
|
#ifndef LCD_h
|
||||||
#define FreetronicsLCD_h
|
#define LCD_h
|
||||||
|
|
||||||
// Extended version of the LiquidCrystal library that works specifically
|
// Extended version of the LiquidCrystal library that works specifically
|
||||||
// with Freetronics' 16x2 LCD display, including support for the back
|
// with Freetronics' 16x2 LCD display, including support for the back
|
||||||
@ -45,10 +45,10 @@
|
|||||||
#define LCD_BUTTON_DOWN_RELEASED -4
|
#define LCD_BUTTON_DOWN_RELEASED -4
|
||||||
#define LCD_BUTTON_SELECT_RELEASED -5
|
#define LCD_BUTTON_SELECT_RELEASED -5
|
||||||
|
|
||||||
class FreetronicsLCD : public LiquidCrystal {
|
class LCD : public LiquidCrystal {
|
||||||
public:
|
public:
|
||||||
FreetronicsLCD() : LiquidCrystal(8, 9, 4, 5, 6, 7) { init(); }
|
LCD() : LiquidCrystal(8, 9, 4, 5, 6, 7) { init(); }
|
||||||
FreetronicsLCD(uint8_t pin9) : LiquidCrystal(8, pin9, 4, 5, 6, 7) { init(); }
|
LCD(uint8_t pin9) : LiquidCrystal(8, pin9, 4, 5, 6, 7) { init(); }
|
||||||
|
|
||||||
void display();
|
void display();
|
||||||
void noDisplay();
|
void noDisplay();
|
@ -1,12 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
This example demonstrates how to use the Form and Field classes from the
|
This example demonstrates how to use the Form and Field classes from the
|
||||||
FreetronicsLCD library to provide a simple UI on the 16x2 LCD display.
|
LCD library to provide a simple UI on the 16x2 LCD display.
|
||||||
|
|
||||||
This example is placed into the public domain.
|
This example is placed into the public domain.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// include the library code:
|
// include the library code:
|
||||||
#include <FreetronicsLCD.h>
|
#include <LCD.h>
|
||||||
#include <Form.h>
|
#include <Form.h>
|
||||||
#include <TextField.h>
|
#include <TextField.h>
|
||||||
#include <TimeField.h>
|
#include <TimeField.h>
|
||||||
@ -14,11 +14,11 @@ This example is placed into the public domain.
|
|||||||
#include <BoolField.h>
|
#include <BoolField.h>
|
||||||
|
|
||||||
// Initialize the LCD
|
// Initialize the LCD
|
||||||
FreetronicsLCD lcd;
|
LCD lcd;
|
||||||
|
|
||||||
// Note: if you are using the USBDroid and have reassigned pin D9 on the LCD shield to some
|
// Note: if you are using the USBDroid and have reassigned pin D9 on the LCD shield to some
|
||||||
// other pin (e.g. A1), then you will need to initialize the shield with something like:
|
// other pin (e.g. A1), then you will need to initialize the shield with something like:
|
||||||
// FreetronicsLCD lcd(A1);
|
// LCD lcd(A1);
|
||||||
// See also: http://www.freetronics.com/pages/combining-the-lcd-keypad-shield-and-the-usbdroid
|
// See also: http://www.freetronics.com/pages/combining-the-lcd-keypad-shield-and-the-usbdroid
|
||||||
|
|
||||||
// Create the main form and its fields.
|
// Create the main form and its fields.
|
Before Width: | Height: | Size: 502 KiB After Width: | Height: | Size: 502 KiB |
Before Width: | Height: | Size: 400 KiB After Width: | Height: | Size: 400 KiB |
Before Width: | Height: | Size: 475 KiB After Width: | Height: | Size: 475 KiB |
Before Width: | Height: | Size: 485 KiB After Width: | Height: | Size: 485 KiB |
Before Width: | Height: | Size: 453 KiB After Width: | Height: | Size: 453 KiB |
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
This example demonstrates how to use the FreetronicsLCD library, which extends the
|
This example demonstrates how to use the LCD library, which extends the
|
||||||
standard LiquidCrystal library to provide support for the Freetronics back light
|
standard LiquidCrystal library to provide support for the Freetronics back light
|
||||||
and Up/Down/Left/Right/Select buttons. More information on the shield here:
|
and Up/Down/Left/Right/Select buttons. More information on the shield here:
|
||||||
|
|
||||||
@ -8,12 +8,12 @@ http://www.freetronics.com/pages/16x2-lcd-shield-quickstart-guide
|
|||||||
This example is placed into the public domain.
|
This example is placed into the public domain.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <FreetronicsLCD.h>
|
#include <LCD.h>
|
||||||
FreetronicsLCD lcd;
|
LCD lcd;
|
||||||
|
|
||||||
// Note: if you are using the USBDroid and have reassigned pin D9 on the LCD shield to some
|
// Note: if you are using the USBDroid and have reassigned pin D9 on the LCD shield to some
|
||||||
// other pin (e.g. A1), then you will need to initialize the shield with something like:
|
// other pin (e.g. A1), then you will need to initialize the shield with something like:
|
||||||
// FreetronicsLCD lcd(A1);
|
// LCD lcd(A1);
|
||||||
// See also: http://www.freetronics.com/pages/combining-the-lcd-keypad-shield-and-the-usbdroid
|
// See also: http://www.freetronics.com/pages/combining-the-lcd-keypad-shield-and-the-usbdroid
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
Before Width: | Height: | Size: 518 KiB After Width: | Height: | Size: 518 KiB |
@ -1,4 +1,4 @@
|
|||||||
FreetronicsLCD KEYWORD1
|
LCD KEYWORD1
|
||||||
Form KEYWORD1
|
Form KEYWORD1
|
||||||
Field KEYWORD1
|
Field KEYWORD1
|
||||||
BoolField KEYWORD1
|
BoolField KEYWORD1
|
@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// include the library code:
|
// include the library code:
|
||||||
#include <FreetronicsLCD.h>
|
#include <LCD.h>
|
||||||
#include <Form.h>
|
#include <Form.h>
|
||||||
#include <Field.h>
|
#include <Field.h>
|
||||||
#include <BoolField.h>
|
#include <BoolField.h>
|
||||||
@ -55,7 +55,7 @@
|
|||||||
#define SETTING_MELODY 3 // Melody to play for the alarm
|
#define SETTING_MELODY 3 // Melody to play for the alarm
|
||||||
|
|
||||||
// Initialize the LCD
|
// Initialize the LCD
|
||||||
FreetronicsLCD lcd;
|
LCD lcd;
|
||||||
|
|
||||||
// Activate the realtime clock chip.
|
// Activate the realtime clock chip.
|
||||||
SoftI2C bus(RTC_DATA, RTC_CLOCK);
|
SoftI2C bus(RTC_DATA, RTC_CLOCK);
|
||||||
@ -104,7 +104,7 @@ void setup() {
|
|||||||
power_timer1_disable();
|
power_timer1_disable();
|
||||||
|
|
||||||
// Enable the screen saver.
|
// Enable the screen saver.
|
||||||
lcd.setScreenSaverMode(FreetronicsLCD::BacklightOnSelect);
|
lcd.setScreenSaverMode(LCD::BacklightOnSelect);
|
||||||
lcd.enableScreenSaver(3);
|
lcd.enableScreenSaver(3);
|
||||||
|
|
||||||
// Initialize the alarm melody.
|
// Initialize the alarm melody.
|
||||||
|