1
0
mirror of https://github.com/taigrr/arduinolibs synced 2025-01-18 04:33:12 -08:00

Move non-cryptography code to a separate repository

This commit is contained in:
Rhys Weatherley
2018-04-07 10:22:35 +10:00
parent ca49329fbd
commit 22ee5721d6
172 changed files with 29 additions and 24005 deletions

View File

@@ -26,7 +26,7 @@ DOXYFILE_ENCODING = UTF-8
# identify the project. Note that if you do not use Doxywizard you need
# to put quotes around the project name if it contains spaces.
PROJECT_NAME = ArduinoLibs
PROJECT_NAME = "Arduino Cryptography Library"
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
@@ -655,19 +655,10 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = ../libraries/LCD \
../libraries/BlinkLED \
../libraries/I2C \
../libraries/RTC \
../libraries/Melody \
../libraries/PowerSave \
../libraries/DMD \
../libraries/IR \
../libraries/Crypto \
INPUT = ../libraries/Crypto \
../libraries/NewHope \
../libraries/RingOscillatorNoiseSource \
../libraries/TransistorNoiseSource \
../libraries/Shell \
.
# This tag can be used to specify the character encoding of the source files
@@ -750,19 +741,8 @@ EXAMPLE_RECURSIVE = NO
# directories that contain image that are included in the documentation (see
# the \image command).
IMAGE_PATH = ../libraries/BlinkLED/examples/Cylon \
../libraries/BlinkLED/examples/Cylon4 \
../libraries/BlinkLED/examples/StarTrek \
../libraries/BlinkLED/examples/Charlieplex \
../libraries/LCD/examples/HelloWorld \
../libraries/LCD/examples/Form \
../libraries/RTC/examples/AlarmClock \
../libraries/Crypto \
../libraries/RingOscillatorNoiseSource \
../libraries/TransistorNoiseSource \
../libraries/DMD \
../libraries/IR \
../libraries/I2C
IMAGE_PATH = ../libraries/RingOscillatorNoiseSource \
../libraries/TransistorNoiseSource
# 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

View File

@@ -1,141 +0,0 @@
/*
* Copyright (C) 2012 Southern Storm Software, Pty Ltd.
*
* 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:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* 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.
*/
/**
\file alarm-clock.dox
\page alarm_clock Alarm Clock
\section clock_features Features
The alarm clock described on this page is a large example application that
uses many of the classes in the provided libraries: LCD, Form,
Field, SoftI2C, DS1307RTC (or DS3232RTC), Melody and
\ref power_save "PowerSave". The clock has the following features:
\li Displays both the time and date.
\li 12 hour and 24 hour time display modes.
\li Up to 4 configurable alarm times, plus a snooze alarm.
\li Three alarm sounds to choose from, plus an option to use a radio alarm.
\li Configurable alarm timeout between 2 and 10 seconds.
\li Alarms can be configured to only sound on Monday to Friday
or on Saturday and Sunday.
\li Single button to activate the back light and/or stop the alarm.
\li Up, down, left, and right buttons to change clock settings.
\li MOSFET that controls the power to a separate radio circuit.
\section clock_main_circuit Main circuit
The main clock circuit consists of an Arduino Uno compatible board, a 16x2
LCD module, a realtime clock chip, a piezo buzzer for the alarm, and a
MOSFET for controlling the radio:
\image html alarm_circuit.png
Some of the components can be purchased ready-made as the
<a href="http://www.freetronics.com/pages/16x2-lcd-shield-quickstart-guide">Freetronics
16x2 LCD Shield</a> and the <a href="http://www.sparkfun.com/products/99">SparkFun
Realtime Clock Module</a>. I used the ready-made realtime clock module,
but made my own equivalent to the LCD shield from parts to aid in spacing
out the LCD and pushbuttons on the exterior of the box. The value of the 33R
resistor may need to be adjusted for different types of back light LED's.
See \ref clock_ds3232 "below" for information on using a DS3232-based
clock module instead of a DS1307-based module.
The whole circuit is built on a prototyping shield, with ribbon cables
connecting to the LCD. The Stop Alarm button, piezo buzzer, and radio
controller are not shown in this picture and some of the components are
soldered to the bottom of the shield:
\image html clock_shield.jpg
The clock module is based on the DS1307 chip and has an on-board coin battery
to keep the time and date ticking over even if the main circuit loses power.
The chip is I2C-based and has an auxillary SQW output that can be configured
to provide a 1 Hz squarewave signal. This signal is used by the software
running on the Arduino to detect when a new time or date is available for
display on the LCD. The DS1307RTC class takes care of the details of
talking to the chip via I2C.
\section clock_arduino_board Arduino board
To keep power consumption low, say for being powered by batteries, we don't
need a full Arduino Uno or similar board. The USB interface is unnecessary,
as is the on-board power supply if there is an external source of 5 volt power.
We also don't want the power and D13 status LED's to be draining power.
Therefore, a cut-down version of the Arduino is recommended. We used the
<a href="http://www.freetronics.com/collections/arduino/products/kitten">KitTen</a>
kit from <a href="http://www.freetronics.com/">Freetronics</a>, and didn't
solder up anything that wasn't strictly necessary. A
<a href="http://www.freetronics.com/ftdi-cable">5v FTDI USB-to-Serial cable</a>
is necessary for programming. Similar minimalistic built-it-yourself
Arduino designs should also work.
\image html kitten_minimal.jpg
\section clock_radio Controlling a radio
The MOSFET connected to D11 can be used to control the power supply to a
separate radio circuit so that the radio can be used as an alarm. In the
following circuit, RadioV+ is the radio's power supply voltage (which may
be the Arduino's 5V supply if the radio can run off 5V):
\image html radio_controller.png
The output of the MOSFET can be used to control almost any kind of
circuit; for example an extremely loud mechanical alarm bell. It doesn't
have to be a radio. A 2N7000 or equivalent MOSFET is suitable for light
loads up to 200mA. For larger currents, a higher-rated MOSFET should be
used instead.
Double-tapping the Stop Alarm button will turn the radio on. Single-tapping
the Stop Alarm button will turn the radio off. A settings field can also
be used to turn the radio on and off.
\section clock_ds3232 Using DS3232 instead of DS1307
For clock modules based on the DS3232 chip, such as the
<a href="http://www.freetronics.com/products/real-time-clock-rtc-module">Freetronics Real Time Clock Module</a>, change the \c Clock typedef
in <tt>Clock.h</tt> to the following:
\code
typedef DS3232RTC Clock;
\endcode
The pads on the Freetronics module should be connected to the Arduino
as follows:
\li VCC and GND connected to 5V and GND on the Arduino.
\li SQI connected to A3.
\li SDA connected to A4.
\li SCL connected to A5.
\li BAT, 32K, and RST left unconnected.
\section clock_completed Completed Clock
The following picture shows the completed clock prototype, built into a
UB1 jiffy box with the radio. Being the prototype, it is a little rough
and ready, but rugged enough to take a pounding each morning as a bedside
alarm clock:
\image html alarm_clock.jpg
*/

View File

@@ -1,80 +0,0 @@
/*
* Copyright (C) 2012 Southern Storm Software, Pty Ltd.
*
* 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:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* 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.
*/
/**
\file blink-blink.dox
\page blink_blink Blinking LED Example
The BlinkLED class provides support logic for blinking a LED connected
to an output pin. The traditional way to blink a LED uses a delay loop:
\code
void loop() {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
\endcode
The problem with this code is that the entire application is blocked
during the <tt>delay()</tt>. No other activities can be serviced.
BlinkLED provides a re-entrant timer-based implementation that is
simple to use in any application and which won't block other activities.
We start this example by including the BlinkLED class and instantiating an
object instance:
\dontinclude BlinkLED/examples/Blink/Blink.ino
\skip #include
\until statusBlink
In this example we have specified that the LED is on pin D13, the LED
should be on for 70 milliseconds, and off for 930 milliseconds. This
will cause the status LED to "strobe" once per second. The LED will
be initially off for 930 milliseconds after device reset. To start
with the LED on, use the following initialization code instead:
\code
BlinkLED statusBlink(13, 70, 930, true);
\endcode
The remaining code we need is a call to BlinkLED::loop() every time around
the main application loop:
\dontinclude BlinkLED/examples/Blink/Blink.ino
\skip loop()
\until }
As can be seen, BlinkLED simplifies the process of blinking a LED quite
considerably. It is also possible to \ref BlinkLED::pause() "pause()"
and \ref BlinkLED::resume() "resume()" the blinking. This is useful in
applications where a blinking LED indicates a certain state such as
an error condition or a long-running operation that is in progress;
with the LED off at other times. The on/off blink rate can be modified at
runtime using BlinkLED::setBlinkRate(), and the LED can be set to a
specific value using BlinkLED::setState().
The full source code for the example follows:
\include BlinkLED/examples/Blink/Blink.ino
*/

View File

@@ -1,77 +0,0 @@
/*
* Copyright (C) 2012 Southern Storm Software, Pty Ltd.
*
* 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:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* 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.
*/
/**
\file blink-charlieplex.dox
\page blink_charlieplex Charlieplexing Example
<a href="http://en.wikipedia.org/wiki/Charlieplexing">Charlieplexing</a>
is a technique for multiplexing large numbers of LED's on a small
number of microcontroller output pins. LED's are arranged in
complementary pairs and managed by the Charlieplex class. For this
example we are going to use 3 output pins to drive 6 LED's:
\image html charlieplexeg.png
The technique can be expanded to even larger numbers of LED's.
See the documentation for the Charlieplex class for a description of
how to connect up larger numbers of pins in a Charlieplexed arrangement.
The first step is to initialize a Charlieplex object with the output
pins it needs to drive:
\dontinclude BlinkLED/examples/Charlieplex/Charlieplex.ino
\skip #include
\until charlie
Then in <tt>setup()</tt> we use Charlieplex::setLed() and
Charlieplex::setPwmLed() to set three of the six LED's to
the desired output values:
\dontinclude BlinkLED/examples/Charlieplex/Charlieplex.ino
\skip setup
\until }
Charlieplexing can only light a single LED at a time. It is therefore
necessary to constantly scan the entire LED array, alternatively turning
LED's on and off. The user's peristence of vision fills in the gaps.
To do this, we call Charlieplex::loop():
\dontinclude BlinkLED/examples/Charlieplex/Charlieplex.ino
\skip loop
\until }
The downside of Charlieplexing is that when multiple LED's are lit, each LED
will appear to be dimmer than if only a single LED was lit. This can be
counteracted by using brighter LED's or smaller resistors. The danger with
smaller resistors is that if the program crashes or locks up for some reason,
a large amount of continuous current could be fed through a single LED and
cause it to exceed its maximum rating and burn out.
The full source code for the example follows:
\include BlinkLED/examples/Charlieplex/Charlieplex.ino
A more complex example that performs a LED chase over the 6 LED's follows:
\include BlinkLED/examples/CharlieplexChase/CharlieplexChase.ino
*/

View File

@@ -1,101 +0,0 @@
/*
* Copyright (C) 2012 Southern Storm Software, Pty Ltd.
*
* 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:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* 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.
*/
/**
\file blink-cylon.dox
\page blink_cylon Cylon Eyes Example
This example shows how to use the ChaseLEDs class to simulate the Cylon
eye effect from Battlestar Galactica. Digital outputs are used to drive
six LED's in a back and forth motion, using the following schematic:
\image html Cylon.png
We start by including the ChaseLEDs class:
\dontinclude BlinkLED/examples/Cylon/Cylon.ino
\skip ChaseLEDs.h
\until ChaseLEDs.h
The next step is to define the pins that the chase will run over:
\dontinclude BlinkLED/examples/Cylon/Cylon.ino
\skip byte pins
\until cylonEyes
The chase runs from the first pin to the sixth pin and back again,
with each LED lit for 100 milliseconds before moving onto the next one.
To complete the example, we need to call ChaseLEDs::loop() each time
around our main loop to cause the chase to run:
\dontinclude BlinkLED/examples/Cylon/Cylon.ino
\skip loop()
\until }
While this example uses only six pins, it can be easily extended to any
number of pins by modifying the \c pins array and altering the schematic
accordingly.
So far we are chasing only a single LED. We could change this to chase
two adjacent LED's instead by defining a new \c CylonChase class that
inherits from ChaseLEDs:
\dontinclude BlinkLED/examples/Cylon2/Cylon2.ino
\skip class CylonChase
\until };
The important part is the implementation of the <tt>advance()</tt> method,
which overrides ChaseLEDs::advance() to provide our own scheme for lighting
the LED's each time the chase advances. We use ChaseLEDs::previousPin() to
get the pin that is 2 steps back in the sequence, set it to LOW, and then
set the previous pin (1 step back) and the next pin to HIGH. All that
remains is to change our chase initialization to use the new class:
\dontinclude BlinkLED/examples/Cylon2/Cylon2.ino
\skip byte pins
\until cylonEyes
We can do even better than this. Instead of fully lighting both LED's,
we could instead use the PWM outputs to dim the previous pin, creating a
kind of "trailing flame" effect:
\dontinclude BlinkLED/examples/Cylon3/Cylon3.ino
\skip advance(
\until }
The current chase is fixed at 100 milliseconds per LED, which takes a full
second to run the sequence. An alternative to hard-wiring the chase
rate is to hook up a 10K potentiometer to the A0 analog input:
\image html Cylon4.png
We then modify the <tt>advance()</tt> method to read the new chase rate
from the potentiometer each time the LED advances:
\dontinclude BlinkLED/examples/Cylon4/Cylon4.ino
\skip advance(
\until }
The full source code for the final version of the example follows:
\include BlinkLED/examples/Cylon4/Cylon4.ino
*/

View File

@@ -1,165 +0,0 @@
/*
* Copyright (C) 2012 Southern Storm Software, Pty Ltd.
*
* 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:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* 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.
*/
/**
\file blink-startrek.dox
\page blink_startrek Star Trek Example
This example shows how to use the BlinkLED and ChaseLEDs classes to
simulate the running lights on the starship Enterprise from Star Trek.
This can be used as the basis for lighting a model kit. It is
recommended that you read the \ref blink_blink "Blink" and
\ref blink_cylon "Cylon" tutorials first.
There are four categories of lights on the Enterprise:
\li Static lights in windows, engines, and the deflector dish.
We don't handle those in this example as we assume that they are
connected directly to the power supply with no computer control.
\li Red and green navigation lights on the left and right of the saucer,
and on the left and right warp nacelles, typically with a 1 second period.
The red light is on the left as viewed from the back of the model.
\li White strobe light behind the bridge and on the warp nacelles
that comes on briefly every second.
\li Nacelle lights that perform a circular LED chase in the front of the
nacelles to create the warp engine twirl effect.
Different models of the Enterprise have the lights in different places,
and the period of flashing can vary from TV show to show, and sometimes
from episode to episode. There isn't a definitive set of blink timings
or number of LED's in the nacelle chase. The sketch has a number of
configurable parameters that gives the user the freedom to choose which
show and/or episode they wish to treat as "canonical" for their model.
We start by building a test circuit with a small number of LED's for
each of the three categories (navigation, strobe, and nacelles):
\image html StarTrek.png
This won't be the final circuit for the model, but building it on a
breadboard will help with the initial prototyping stages and choosing
the appropriate blink timings:
\image html StarTrekBreadboard.png
Alternatively, the test circuit can be built on a prototyping shield
with the chase LED's in a circular arrangement to simulate how they will
look when placed in the front of the model's warp nacelles:
\image html StarTrekShield.png
Now that we have a circuit, let's configure the red navigation LED on AOUT2
using the BlinkLED class, to blink with a period of 1000 milliseconds on,
1000 milliseconds off:
\dontinclude BlinkLED/examples/StarTrek/StarTrek.ino
\skip <BlinkLED.h>
\until <BlinkLED.h>
\skip NAV_LIGHTS
\until NAV_LIGHTS
\skip NAV_LIGHTS_ON
\until NAV_LIGHTS_OFF
\skip navLights
\until navLights
We repeat the process for the strobe LED on AOUT3, with a period of
70 milliseconds on, and 830 milliseconds off:
\dontinclude BlinkLED/examples/StarTrek/StarTrek.ino
\skip STROBE_LIGHT
\until STROBE_LIGHT
\skip STROBE_LIGHT_ON
\until STROBE_LIGHT_OFF
\skip strobeLight
\until strobeLight
We also need to arrange for BlinkLED::loop() to be called from the
application's main <tt>loop()</tt> function:
\code
void loop() {
navLights.loop();
strobeLight.loop();
}
\endcode
If you run the sketch at this point, you should see the navigation and
strobe LED's blink with the selected rates.
Next is the twirl effect in the warp nacelles, using the ChaseLEDs
class. We are actually going to inherit from ChaseLEDs to create a
custom LED chaser that reads the chase rate from AIN0 and uses PWM
outputs to create a trailing flame effect. See the
\ref blink_cylon "Cylon" example for more information on creating
custom effects with ChaseLEDs.
\dontinclude BlinkLED/examples/StarTrek/StarTrek.ino
\skip NACELLE_CHASE_LEN
\until NacelleChaseLEDs nacelleChase
We also need to add a call to ChaseLEDs::loop() to the application's
main loop:
\dontinclude BlinkLED/examples/StarTrek/StarTrek.ino
\skip loop()
\until }
Running the sketch now should cause the six LED's in the nacelle
sequence to chase, in addition to the navigation and strobe LED's.
The 10K potentiometer can be used to select the desired chase rate.
This completes the test circuit, and will allow you to fiddle with
the blink timings and chase rate until you are happy with the result.
We've made provision in this sketch for six outputs in the chase,
but some models may only use three or five. The <tt>NACELLE_CHASE_LEN</tt>
parameter controls the length of the chase.
With three outputs, the LED's can be arranged in opposite pairs,
lighting two LED's at a time. The following circuit demonstrates
how three outputs can be used to drive six LED's:
\image html ThreeChase.png
You will need two of these circuits, for the left and right warp nacelles.
The transistor drivers reduce the current load on the Arduino CPU and
provide the option to drive the LED's from 12V instead of 5V.
It is recommended that you use transistor drivers for the navigation and
strobe lights as well as there will be multiple LED's on each output in a
real model. For example, there will be at least three each of the red
and green navigation lights: the top of the saucer section, the bottom of
the saucer section, and the top of the warp nacelle. Using a 12V supply
will make it easier to string lots of LED's together in series.
Other nacelle effects are possible by modifying the <tt>advance()</tt> method
in the sketch. For example, the "opposite pairs" effect with 3 outputs
can also be done with 6 outputs and the following modification to the sketch:
\dontinclude BlinkLED/examples/StarTrek2/StarTrek2.ino
\skip advance(byte
\until }
The full source code for the example, including the "opposite pairs"
effect, follows:
\include BlinkLED/examples/StarTrek2/StarTrek2.ino
*/

View File

@@ -22,7 +22,7 @@
/**
\file crypto.dox
\page crypto Cryptographic Library
\page crypto Arduino Cryptography Library
\section crypto_algorithms Supported Algorithms

View File

@@ -1,42 +0,0 @@
/*
* Copyright (C) 2012 Southern Storm Software, Pty Ltd.
*
* 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:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* 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.
*/
/**
\file dmd-demo.dox
\page dmd_demo Dot Matrix Display Demo
This demo shows off various features of drawing with the Bitmap class
to a DMD display:
\li Drawing circles, lines, and rectangles.
\li Filling the screen with a bitmap-based brick pattern.
\li Drawing bitmaps directly from program memory.
\li Drawing text in various fonts.
\li Scrolling text in a "marquee".
\ref dmd_running_figure "RunningFigure" provides another example of
drawing and animating bitmaps.
The full source code for the demo follows:
\include DMD/examples/Demo/Demo.ino
*/

View File

@@ -1,87 +0,0 @@
/*
* Copyright (C) 2012 Southern Storm Software, Pty Ltd.
*
* 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:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* 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.
*/
/**
\file dmd-running-figure.dox
\page dmd_running_figure Running figure example
This example demonstrates how to draw animated bitmaps to
<a href="http://www.freetronics.com/dmd">Freetronics Large Dot
Matrix Displays</a>. These displays have 512 LED's arranged in a
32x16 matrix and controlled by an SPI interface. The displays are
available in red, blue, green, yellow, and white variations.
The first step is to initialize the display:
\dontinclude DMD/examples/RunningFigure/RunningFigure.ino
\skip #include
\until DMD display;
We will also need some bitmaps to animate the running figure. We will use
static bitmaps stored in program memory. The first frame of the 10-frame
animation is:
\dontinclude DMD/examples/RunningFigure/RunningFigure.ino
\skip run1
\until };
As can be seen, the bitmap is made up of 0's and 1's; a 1 bit indicates that
the corresponding LED will be lit when it is drawn to the dot matrix display.
The first two bytes are the width and height of the bitmap in pixels.
In this case, the first frame is 16x16 pixels. Other frames in the animation
are 18x16 and 13x16.
We store pointers to all of the frames in a common array:
\dontinclude DMD/examples/RunningFigure/RunningFigure.ino
\skip frames[]
\until frame = 0
All that remains is to run the animation loop:
\dontinclude DMD/examples/RunningFigure/RunningFigure.ino
\skip ADVANCE_MS
\until display.loop()
\until }
Each time \c ADVANCE_MS milliseconds expires, we clear the display and
draw a bitmap centered on the screen. To help with the centering, we read
the width value from the bitmap for the current frame (the height is
always 16). We must also call DMD::loop() repeatedly from the application's
main <tt>loop()</tt> function to ensure that the display is kept refreshed.
Sometimes it can be inconvenient to arrange for DMD::loop() to be called
regularly. An alternative is to use Timer1 or Timer2 and
\ref dmd_interrupts "interrupt-driven display refresh":
\dontinclude DMD/examples/RunningFigureISR/RunningFigureISR.ino
\skip ADVANCE_MS
\until loop()
\until }
In the case of Timer2, \c TIMER2_OVF_vect and \ref DMD::enableTimer2() "enableTimer2()"
would be used in place of \c TIMER1_OVF_vect and \ref DMD::enableTimer1() "enableTimer1()".
The full source code for the example follows:
\include DMD/examples/RunningFigure/RunningFigure.ino
*/

View File

@@ -1,38 +0,0 @@
/*
* Copyright (C) 2012 Southern Storm Software, Pty Ltd.
*
* 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:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* 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.
*/
/**
\file ir-dumpir.dox
\page ir_dumpir Dumping Infrared Remote Control Codes
This example uses the IRreceiver class to dump commands that are received
from an infrared remote control that is compatible with the
<a href="http://en.wikipedia.org/wiki/RC-5">Philips RC-5 protocol</a>.
Commands are dumped to the serial port. The example needs a 3-pin
infrared receiver connected to D2, GND, and 5V:
\image html irchip.jpg
The full source code for the example follows:
\include IR/examples/DumpIR/DumpIR.ino
*/

View File

@@ -1,31 +0,0 @@
/*
* Copyright (C) 2012 Southern Storm Software, Pty Ltd.
*
* 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:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* 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.
*/
/**
\file ir-snake.dox
\page ir_snake Snake Video Game Using an Infrared Remote Control
This example demonstrates the use of the DMD and IRreceiver classes.
The full source code follows:
\include IR/examples/Snake/Snake.ino
*/

View File

@@ -1,101 +0,0 @@
/*
* Copyright (C) 2012 Southern Storm Software, Pty Ltd.
*
* 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:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* 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.
*/
/**
\file lcd-form.dox
\page lcd_form Form example for LCD displays
The Form and Field classes simplify the process of building user interfaces
for Arduino projects that use a <a href="http://www.freetronics.com/pages/16x2-lcd-shield-quickstart-guide">Freetronics LCD</a> shield. That shield has a
16x2 LCD display and five buttons for Up, Down, Left, Right, and Select.
The user interface is organised as a "form" which consists of one or more
"fields" that display or modify a single program parameter. The Left and
Right buttons are used to navigate between fields, and the Up and Down
buttons are used to modify the value of the currently-displayed field.
\image html FormText.png
We start by including the classes from the library that we will need:
\dontinclude LCD/examples/Form/Form.ino
\skip LCD.h
\until BoolField.h
Next, we initialize the LCD display, create the main form, and populate
it with fields:
\dontinclude LCD/examples/Form/Form.ino
\skip lcd;
\until lcd;
\skip mainForm
\until durationField
Each field has a specific type, which may be one of the following classes:
\li BoolField displays a boolean on/off value with the Up and Down
buttons used to toggle its state.
\li IntField displays an integer value within a specified range, with the
Up and Down buttons used to modify the value.
\li TextField displays a read-only value, which is typically used for
status messages and program results.
\li TimeField displays a time in hours, minutes, and seconds. The field may
be either read-only or writable. Writable time fields can be modified with
the Up, Down, Left, and Right buttons to select a specific duration.
Returning to our example, the above code creates the following fields:
\li \c welcomeField to display the program's name and version.
\li \c timeField to display the number of seconds since reset, wrapping around
after 24 hours. This field is read-only.
\li \c volumeField which displays a volume between 0 and 100, with an Up/Down
step of 5, and a suffix of "%".
\li \c ledField which displays the current boolean state of the status LED on
D13; the LED will change state when the user toggles the field's value.
\li \c durationField which displays a read-write time field for selecting a
duration between 0 and 24 hours.
Now that we have defined our form, we need to initialize the program and
show the form for the first time:
\dontinclude LCD/examples/Form/Form.ino
\skip STATUS_LED
\until }
An application can have multiple forms, but only one can be shown at any
given time. To switch to another form, call Form::hide() on the old
form and Form::show() on the new form.
All that remains is to define our application's \c loop function which
retrieves button events from LCD::getButton() and dispatches them
to the form:
\dontinclude LCD/examples/Form/Form.ino
\skip loop()
\until }
\until }
\until }
The full source code for the example follows:
\include LCD/examples/Form/Form.ino
*/

View File

@@ -1,85 +0,0 @@
/*
* Copyright (C) 2012 Southern Storm Software, Pty Ltd.
*
* 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:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* 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.
*/
/**
\file lcd-helloworld.dox
\page lcd_hello_world Hello World for Freetronics LCD
The LCD class provides an enhanced version of the standard
Arduino <a href="http://arduino.cc/en/Reference/LiquidCrystal">LiquidCrystal</a>
library that supports the additional features of the
<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.
This tutorial explains how to use the LCD class to perform
basic text output and to use the enhanced shield features.
\image html HelloWorld.png
We start by including the library and initializing it:
\dontinclude LCD/examples/HelloWorld/HelloWorld.ino
\skip LCD.h
\until lcd
Unlike the LiquidCrystal library we don't normally need to specify the pin
assignments for this shield. The one exception is when the shield is used
with the USBDroid and the D9 pin is reassigned as described on
<a href="http://www.freetronics.com/pages/combining-the-lcd-keypad-shield-and-the-usbdroid">this page</a>. In that case, the initialization sequence
would look something like this instead:
\code
LCD lcd(A1);
\endcode
The next step is to enable the screen saver and print some text
in the \c setup function:
\dontinclude LCD/examples/HelloWorld/HelloWorld.ino
\skip setup()
\until }
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
(the default is 10 seconds). Pressing any of the keys on the shield
or calling LCD::display() will wake up the screen again.
In the program's \c loop function we print the number of seconds
since startup to the second line of the LCD display:
\dontinclude LCD/examples/HelloWorld/HelloWorld.ino
\skip loop()
\until millis()
We then print the name of the button that is currently pressed:
\dontinclude LCD/examples/HelloWorld/HelloWorld.ino
\skip setCursor(8, 1)
\until }
The LCD::getButton() function returns the key that has
been pressed or released, or LCD_BUTTON_NONE if no key has been
pressed or released this time through the loop.
The full source code for the example follows:
\include LCD/examples/HelloWorld/HelloWorld.ino
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2012 Southern Storm Software, Pty Ltd.
* Copyright (C) 2018 Southern Storm Software, Pty Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -24,111 +24,21 @@
\file mainpage.dox
\mainpage
This distribution contains a bunch of libraries and example applications
that I have made for Arduino, covering a variety of tasks from blinking LED's
to LCD's and RTC-based alarm clocks. They are distributed under the
terms of the MIT license, with the source code available from
<a href="https://github.com/rweather/arduinolibs">github</a>.
This distribution contains a libraries and example applications to perform
cryptography operations on Arduino devices. They are distributed under the
terms of the MIT license.
See the main \ref crypto "documentation page" for more information on
the libraries and examples.
This repository used to contain a number of other examples and libraries
for other areas of Arduino functionality but most users are only interested
in the cryptography code. The other projects have been moved to a
separate <a href="https://github.com/rweather/arduino-projects">repository</a>
and only the cryptography code remains in this repository.
For more information on these libraries, to report bugs, or to suggest
improvements, please contact the author Rhys Weatherley via
<a href="mailto:rhys.weatherley@gmail.com">email</a>.
\section main_LCD LCD Shield
\li LCD class to manage the extended features of the Freetronics
and DFRobot LCD shields.
\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_form "Form" example for LCD displays.
\section main_DMD Freetronics Large Dot Matrix Display (DMD)
\li DMD class to manage the initialize of the display.
\li Bitmap class to manage drawing to in-memory bitmaps and the DMD display.
\li \ref dmd_demo "Demo" that shows off various bitmap drawing features.
\li \ref dmd_running_figure "RunningFigure" example that demonstrates how
to draw and animate bitmaps.
\li \ref ir_snake "Snake" game that combines the dot matrix display with
IRreceiver to make a simple video game.
\section main_BlinkLED BlinkLED Utility Library
\li BlinkLED class that simplifies the process of blinking a LED connected
to a output pin.
\li ChaseLEDs class that simplifies the process of performing a LED chase
over several output pins.
\li Charlieplex class that manages a matrix of LED's arranged in a
<a href="http://en.wikipedia.org/wiki/Charlieplexing">Charlieplexing</a>
arrangement.
\li \ref blink_blink "Blink" example of using BlinkLED.
\li \ref blink_cylon "Cylon" example of using ChaseLEDs to simulate
the Cylon eye effect from Battlestar Galactica.
\li \ref blink_startrek "StarTrek" example for lighting a starship
Enterprise model kit.
\li \ref blink_charlieplex "Charlieplex" example.
\section main_I2C I2C Utility Library
\li I2CMaster abstract class that provides an improved API for implementing an
I2C master.
\li SoftI2C class that implements the master side of the I2C protocol
in software on any arbitrary pair of pins for DATA and CLOCK.
This class supports both 7-bit and 10-bit I2C addresses.
\li EEPROM24 class for reading and writing 24LCXX family EEPROM's.
\section main_RTC Realtime Clock Library
\li RTC class that acts as a base for all realtime clock implementations,
including support for configuring alarms and storing clock settings.
The default implementation simulates the time and date based on the value of
<tt>millis()</tt>.
\li DS1307RTC class that talks to the DS1307 realtime clock chip via I2C.
\li DS3231RTC class that talks to the DS3231 realtime clock chip via I2C.
\li DS3232RTC class that talks to the DS3232 realtime clock chip via I2C.
\li \ref alarm_clock "Alarm Clock" example that uses the DS1307 or DS3232
realtime clock and the LCD library to implement an alarm clock.
\section main_Crypto Cryptographic Library
\li Block ciphers: AES128, AES192, AES256, Speck
\li Block cipher modes: CTR, CFB, CBC, OFB, EAX, GCM, XTS
\li Stream ciphers: ChaCha
\li Authenticated encryption with associated data (AEAD): ChaChaPoly, EAX, GCM
\li Hash algorithms: SHA256, SHA512, SHA3_256, SHA3_512, BLAKE2s, BLAKE2b (regular and HMAC modes)
\li Extendable output functions (XOF's): SHAKE128, SHAKE256
\li Message authenticators: Poly1305, GHASH, OMAC
\li Public key algorithms: Curve25519, Ed25519, P521
\li Post-quantum algorithms: NewHope
\li Random number generation: \link RNGClass RNG\endlink, TransistorNoiseSource, RingOscillatorNoiseSource
More information can be found on the \ref crypto "Cryptographic Library" page.
\section main_Shell Shell Library
\li Terminal class that extends Stream with functions suitable for
interfacing to a VT100-compatible terminal program like PuTTY.
\li Shell class that manages a Unix-like command-line shell for executing
commands via a serial port or telnet session. Shell is built on top of
the functionality of Terminal.
\li LoginShell class that extends Shell to provide a simple username and
password login mechanism.
\li \ref shell_serial "SerialShell" example that shows how to use Shell to
provide command-line access via a serial port.
\li \ref shell_telnet "TelnetServer" example that shows how to use
LoginShell to provide command-line access via the telnet protocol.
\section main_IR Infrared Control Library
\li IRreceiver class that receives incoming RC-5 commands from an
infrared remote control.
\li \ref ir_dumpir "DumpIR" example that dumps all incoming RC-5 commands.
\li \ref ir_snake "Snake" game that combines DMD with an infrared remote
control to make a simple video game.
\section main_other Other
\li Melody plays a melody on a digital output pin using <tt>tone()</tt>.
\li \ref power_save "Power saving utility functions"
*/

View File

@@ -1,80 +0,0 @@
/*
* Copyright (C) 2016 Southern Storm Software, Pty Ltd.
*
* 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:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* 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.
*/
/**
\file shell-serial.dox
\page shell_serial Serial port Shell example
The Shell class provides a Unix-like shell for issuing commands to
the Arduino. This example shows how to use Shell to provide command-line
access via a serial port. The example has one command "led" for turning
the status LED on D13 on and off.
We start by including the shell library definitions and declaring a
variable of type Shell:
\dontinclude Shell/examples/SerialShell/SerialShell.ino
\skip #include
\until Shell shell;
Next we need to initialize the serial port and tell the shell object
to use it for communications:
\dontinclude Shell/examples/SerialShell/SerialShell.ino
\skip void setup()
\until }
The call to \link Shell::setPrompt() shell.setPrompt()\endlink specifies
the prompt to display whenever a new line of input is required. The
default value is "$ " but we have changed it to "Command: " in this example.
The string can be anything and can be changed later if necessary.
The call to \link Shell::begin() shell.begin()\endlink starts the actual
shell. The first argument is the underlying stream to use for
communications, the Serial port in our case. The second argument sets the
size of the history stack so that Shell can remember previous commands
and let the user navigate back to them with the up/down arrow keys.
The shell needs to regularly process input from the serial port and
handle commands. We accomplish this by calling
\link Shell::loop() shell.loop()\endlink from the application's main
loop() function:
\dontinclude Shell/examples/SerialShell/SerialShell.ino
\skip void loop()
\until }
At this point the application will have two builtin commands, "help" and
"exit". But we also want a command of our own. We do this by declaring a
command handler:
\dontinclude Shell/examples/SerialShell/SerialShell.ino
\skip int ledPin
\until ShellCommand
The ShellCommand() macro informs the shell of a new command with its name,
help string, and the name of the handler function.
The full source code for the example follows:
\include Shell/examples/SerialShell/SerialShell.ino
*/

View File

@@ -1,39 +0,0 @@
/*
* Copyright (C) 2016 Southern Storm Software, Pty Ltd.
*
* 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:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* 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.
*/
/**
\file shell-telnet.dox
\page shell_telnet Telnet server example
The Shell class provides a Unix-like shell for issuing commands to
the Arduino. The LoginShell class extends Shell to also include login
functionality. The user is prompted for username and password before
access is granted to shell commands.
This example shows how to use LoginShell to provide command-line access
over the Internet via the telnet protocol. The example has one command
"led" for turning the status LED on D13 on and off.
The full source code for the example follows:
\include Shell/examples/TelnetServer/TelnetServer.ino
*/