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

@ -1,15 +1,20 @@
Arduino Libraries Arduino Cryptography Library
================= ============================
This distribution contains a bunch of libraries and example applications This distribution contains a libraries and example applications to perform
that I have made for Arduino, covering a variety of tasks from blinking LED's cryptography operations on Arduino devices. They are distributed under the
to LCD's and RTC-based alarm clocks. They are distributed under the
terms of the MIT license. terms of the MIT license.
The [documentation](http://rweather.github.com/arduinolibs/index.html) The [documentation](http://rweather.github.com/arduinolibs/crypto.html)
contains more information on the libraries and examples. contains 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 [repository](https://github.com/rweather/arduino-projects) and
only the cryptography code remains in this repository.
For more information on these libraries, to report bugs, or to suggest For more information on these libraries, to report bugs, or to suggest
improvements, please contact the author Rhys Weatherley via improvements, please contact the author Rhys Weatherley via
[email](mailto:rhys.weatherley@gmail.com). [email](mailto:rhys.weatherley@gmail.com).

View File

@ -26,7 +26,7 @@ DOXYFILE_ENCODING = UTF-8
# identify the project. Note that if you do not use Doxywizard you need # identify the project. Note that if you do not use Doxywizard you need
# to put quotes around the project name if it contains spaces. # 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. # The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or # 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 # directories like "/usr/src/myproject". Separate the files or directories
# with spaces. # with spaces.
INPUT = ../libraries/LCD \ INPUT = ../libraries/Crypto \
../libraries/BlinkLED \
../libraries/I2C \
../libraries/RTC \
../libraries/Melody \
../libraries/PowerSave \
../libraries/DMD \
../libraries/IR \
../libraries/Crypto \
../libraries/NewHope \ ../libraries/NewHope \
../libraries/RingOscillatorNoiseSource \ ../libraries/RingOscillatorNoiseSource \
../libraries/TransistorNoiseSource \ ../libraries/TransistorNoiseSource \
../libraries/Shell \
. .
# 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
@ -750,19 +741,8 @@ 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 \ IMAGE_PATH = ../libraries/RingOscillatorNoiseSource \
../libraries/BlinkLED/examples/Cylon4 \ ../libraries/TransistorNoiseSource
../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
# 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

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 \file crypto.dox
\page crypto Cryptographic Library \page crypto Arduino Cryptography Library
\section crypto_algorithms Supported Algorithms \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 * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@ -24,111 +24,21 @@
\file mainpage.dox \file mainpage.dox
\mainpage \mainpage
This distribution contains a bunch of libraries and example applications This distribution contains a libraries and example applications to perform
that I have made for Arduino, covering a variety of tasks from blinking LED's cryptography operations on Arduino devices. They are distributed under the
to LCD's and RTC-based alarm clocks. They are distributed under the terms of the MIT license.
terms of the MIT license, with the source code available from
<a href="https://github.com/rweather/arduinolibs">github</a>. 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 For more information on these libraries, to report bugs, or to suggest
improvements, please contact the author Rhys Weatherley via improvements, please contact the author Rhys Weatherley via
<a href="mailto:rhys.weatherley@gmail.com">email</a>. <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
*/

View File

@ -1,48 +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.
*/
#include <stdio.h>
int main(int argc, char *argv[])
{
int value;
printf("static const uint8_t flipBits[256] PROGMEM = {\n");
for (value = 0; value < 256; ++value) {
int flipped =
((value & 0x01) << 7) | ((value & 0x02) << 5) |
((value & 0x04) << 3) | ((value & 0x08) << 1) |
((value & 0x10) >> 1) | ((value & 0x20) >> 3) |
((value & 0x40) >> 5) | ((value & 0x80) >> 7);
if ((value % 12) == 0)
printf(" ");
else
printf(" ");
if (value != 255)
printf("0x%02X,", flipped);
else
printf("0x%02X", flipped);
if ((value % 12) == 11)
printf("\n");
}
printf("\n};\n");
return 0;
}

View File

@ -1,304 +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.
*/
// Generates the keymap state machine table for the Terminal class.
#include <stdio.h>
#include <stdint.h>
#include <vector>
#include "../libraries/Terminal/USBKeysExtra.h"
typedef struct {
const char *sequence;
int code;
} EscKey;
static EscKey const escKeys[] = {
// Based on the key sequence tables from:
// http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-PC-Style-Function-Keys
// http://aperiodic.net/phil/archives/Geekery/term-function-keys.html
// Also some miscellaneous codes from other sources like the Linux console.
// Cursor control keys.
{"[A", KEY_UP_ARROW},
{"OA", KEY_UP_ARROW},
{"A", KEY_UP_ARROW},
{"[B", KEY_DOWN_ARROW},
{"OB", KEY_DOWN_ARROW},
{"B", KEY_DOWN_ARROW},
{"[C", KEY_RIGHT_ARROW},
{"OC", KEY_RIGHT_ARROW},
{"C", KEY_RIGHT_ARROW},
{"[D", KEY_LEFT_ARROW},
{"OD", KEY_LEFT_ARROW},
{"D", KEY_LEFT_ARROW},
{"[H", KEY_HOME},
{"OH", KEY_HOME},
{"[1~", KEY_HOME},
{"[F", KEY_END},
{"OF", KEY_END},
{"[4~", KEY_END},
{"[2~", KEY_INSERT},
{"[3~", KEY_DELETE},
{"[5~", KEY_PAGE_UP},
{"[6~", KEY_PAGE_DOWN},
// Numeric keypad. Mostly mapped back to ASCII.
{"O ", ' '},
{"? ", ' '},
{"OI", KEY_TAB},
{"?I", KEY_TAB},
{"OM", KEY_RETURN},
{"?M", KEY_RETURN},
{"Oj", '*'},
{"?j", '*'},
{"Ok", '+'},
{"?k", '+'},
{"Ol", ','},
{"?l", ','},
{"Om", '-'},
{"?m", '-'},
{"On", '.'},
{"?n", '.'},
{"Oo", '/'},
{"?o", '/'},
{"Op", '0'},
{"?p", '0'},
{"Oq", '1'},
{"?q", '1'},
{"Or", '2'},
{"?r", '2'},
{"Os", '3'},
{"?s", '3'},
{"Ot", '4'},
{"?t", '4'},
{"Ou", '5'},
{"?u", '5'},
{"Ov", '6'},
{"?v", '6'},
{"Ow", '7'},
{"?w", '7'},
{"Ox", '8'},
{"?x", '8'},
{"Oy", '9'},
{"?y", '9'},
{"OX", '='},
{"?X", '='},
// Function keys.
{"[11~", KEY_F1},
{"P", KEY_F1},
{"OP", KEY_F1},
{"[[A", KEY_F1},
{"[12~", KEY_F2},
{"Q", KEY_F2},
{"OQ", KEY_F2},
{"[[B", KEY_F2},
{"[13~", KEY_F3},
{"R", KEY_F3},
{"OR", KEY_F3},
{"[[C", KEY_F3},
{"[14~", KEY_F4},
{"S", KEY_F4},
{"OS", KEY_F4},
{"[[D", KEY_F4},
{"[15~", KEY_F5},
{"[[E", KEY_F5},
{"[17~", KEY_F6},
{"[18~", KEY_F7},
{"[19~", KEY_F8},
{"[20~", KEY_F9},
{"[21~", KEY_F10},
{"[23~", KEY_F11},
{"[24~", KEY_F12},
{"[25~", KEY_F13},
{"[11;2~", KEY_F13},
{"O2P", KEY_F13},
{"[26~", KEY_F14},
{"[12;2~", KEY_F14},
{"O2Q", KEY_F14},
{"[28~", KEY_F15},
{"[13;2~", KEY_F15},
{"O2R", KEY_F15},
{"[29~", KEY_F16},
{"[14;2~", KEY_F16},
{"O2S", KEY_F16},
{"[31~", KEY_F17},
{"[15;2~", KEY_F17},
{"[32~", KEY_F18},
{"[17;2~", KEY_F18},
{"[33~", KEY_F19},
{"[18;2~", KEY_F19},
{"[34~", KEY_F20},
{"[19;2~", KEY_F20},
{"[20;2~", KEY_F21},
{"[23$", KEY_F21},
{"[21;2~", KEY_F22},
{"[24$", KEY_F22},
{"[23;2~", KEY_F23},
{"[11^", KEY_F23},
{"[24;2~", KEY_F24},
{"[12^", KEY_F24},
// Other keys.
{"[Z", KEY_BACK_TAB},
{"OZ", KEY_BACK_TAB},
{"[P", KEY_PAUSE},
{"[G", KEY_NUMPAD_5},
};
#define numEscKeys (sizeof(escKeys) / sizeof(escKeys[0]))
class Node
{
public:
explicit Node(Node *parent = 0);
~Node();
void add(const char *str, int code);
void dumpRules(std::vector<uint8_t> *vec);
int ch;
int code;
int offset;
Node *firstChild;
Node *lastChild;
Node *nextChild;
};
Node::Node(Node *parent)
: ch(0)
, code(-1)
, offset(0)
, firstChild(0)
, lastChild(0)
, nextChild(0)
{
if (parent) {
if (parent->lastChild)
parent->lastChild->nextChild = this;
else
parent->firstChild = this;
parent->lastChild = this;
}
}
Node::~Node()
{
Node *child = firstChild;
Node *next;
while (child != 0) {
next = child->nextChild;
delete child;
child = next;
}
}
void Node::add(const char *str, int code)
{
int ch = str[0] & 0xFF;
Node *child = firstChild;
while (child != 0) {
if (child->ch == ch)
break;
child = child->nextChild;
}
if (!child) {
child = new Node(this);
child->ch = ch;
}
if (str[1] == '\0') {
// Leaf node at the end of a string.
child->code = code;
} else {
// Interior node with more children.
child->add(str + 1, code);
}
}
void Node::dumpRules(std::vector<uint8_t> *vec)
{
Node *child;
// First pass: Output the recognizers for this level.
offset = vec->size();
child = firstChild;
while (child != 0) {
if (child->firstChild) {
// Interior nodes need 3 bytes for the character and offset.
vec->push_back((uint8_t)(child->ch | 0x80));
vec->push_back(0);
vec->push_back(0);
} else {
// Leaf nodes need 2 bytes for the character and code.
vec->push_back((uint8_t)(child->ch));
vec->push_back((uint8_t)(child->code));
if (child->code > 255)
printf("Code 0x%X exceeds 255 - need to change table format\n", child->code);
}
child = child->nextChild;
}
vec->push_back(0); // Terminate this level.
// Second pass: Output the recognizers for the child levels.
child = firstChild;
while (child != 0) {
if (child->firstChild)
child->dumpRules(vec);
child = child->nextChild;
}
// Third pass: Back-patch the links to the child recognizers.
int posn = offset;
child = firstChild;
while (child != 0) {
if (child->firstChild) {
int value = child->offset;
(*vec)[posn + 1] = (uint8_t)value;
(*vec)[posn + 2] = (uint8_t)(value >> 8);
posn += 3;
} else {
posn += 2;
}
child = child->nextChild;
}
}
int main(int argc, char *argv[])
{
Node *root = new Node();
for (unsigned index = 0; index < numEscKeys; ++index)
root->add(escKeys[index].sequence, escKeys[index].code);
std::vector<uint8_t> vec;
root->dumpRules(&vec);
printf("static uint8_t const keymap[%d] PROGMEM = {\n", (int)vec.size());
for (unsigned index = 0; index < vec.size(); ++index) {
if ((index % 12) == 0)
printf(" ");
printf("0x%02X", (int)(vec[index]));
if ((index % 12) == 11)
printf(",\n");
else
printf(", ");
}
printf("};\n");
delete root;
return 0;
}

View File

@ -1,107 +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.
*/
// Utility for generating the button mapping table in LCD.cpp.
#include <stdio.h>
#define LCD_BUTTON_NONE 0
#define LCD_BUTTON_LEFT 1
#define LCD_BUTTON_RIGHT 2
#define LCD_BUTTON_UP 3
#define LCD_BUTTON_DOWN 4
#define LCD_BUTTON_SELECT 5
#define LCD_BUTTON_VALUE_GAP 10
#define LCD_BUTTON_RIGHT_VALUE 0
#define LCD_BUTTON_UP_VALUE 145
#define LCD_BUTTON_DOWN_VALUE 329
#define LCD_BUTTON_LEFT_VALUE 505
#define LCD_BUTTON_SELECT_VALUE 741
int main(int argc, char *argv[])
{
char rawTest[1024];
int value, value2, value3, bits;
char button;
// Determine the actual values for each of the 1024 inputs.
for (value = 0; value < 1024; ++value) {
if (value < (LCD_BUTTON_RIGHT_VALUE + LCD_BUTTON_VALUE_GAP))
button = LCD_BUTTON_RIGHT;
else if (value >= (LCD_BUTTON_UP_VALUE - LCD_BUTTON_VALUE_GAP) &&
value <= (LCD_BUTTON_UP_VALUE + LCD_BUTTON_VALUE_GAP))
button = LCD_BUTTON_UP;
else if (value >= (LCD_BUTTON_DOWN_VALUE - LCD_BUTTON_VALUE_GAP) &&
value <= (LCD_BUTTON_DOWN_VALUE + LCD_BUTTON_VALUE_GAP))
button = LCD_BUTTON_DOWN;
else if (value >= (LCD_BUTTON_LEFT_VALUE - LCD_BUTTON_VALUE_GAP) &&
value <= (LCD_BUTTON_LEFT_VALUE + LCD_BUTTON_VALUE_GAP))
button = LCD_BUTTON_LEFT;
else if (value >= (LCD_BUTTON_SELECT_VALUE - LCD_BUTTON_VALUE_GAP) &&
value <= (LCD_BUTTON_SELECT_VALUE + LCD_BUTTON_VALUE_GAP))
button = LCD_BUTTON_SELECT;
else
button = LCD_BUTTON_NONE;
rawTest[value] = button;
}
// Dump the accuracy of different bit truncations.
for (bits = 4; bits < 10; ++bits) {
int count = 0;
for (value = 0; value < 1024; ++value) {
value2 = value & (((1 << bits) - 1) << (10 - bits));
if (rawTest[value] == rawTest[value2])
++count;
}
printf("bits = %d, accuracy = %g%%\n", bits, 100.0 * count / 1024.0);
}
printf("\n");
// Dump the button mapping table for the selected bit count.
bits = 5;
printf("static uint8_t const buttonMappings[] PROGMEM = {\n");
for (value2 = 0; value2 < (1 << bits); ++value2) {
value = value2 << (10 - bits);
value3 = value + (1 << (10 - bits)) - 1;
button = 0;
while (!button && value <= value3) {
button = rawTest[value];
++value;
}
if ((value2 & 0x0F) != 0)
printf(", ");
else
printf(" ");
printf("%d", button);
if ((value2 & 0x0F) == 0x0F) {
if (value2 < ((1 << bits - 1)))
printf(",\n");
else
printf("\n");
}
}
printf("};\n");
printf("#define mapButton(value) (pgm_read_byte(&(buttonMappings[(value) >> %d])))\n", 10 - bits);
return 0;
}

View File

@ -1,235 +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.
*/
// Generates the Terminal::isWideCharacter() function from the data at:
// http://www.unicode.org/Public/UCD/latest/ucd/EastAsianWidth.txt
// http://www.unicode.org/reports/tr11/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_UNICODE 0x10FFFF
#define NUM_UNICODE (MAX_UNICODE + 1)
static unsigned char *masks;
static void mark_range(long code1, long code2)
{
while (code1 <= code2) {
if (code1 > MAX_UNICODE)
break;
masks[code1 / 8] |= (1 << (code1 % 8));
++code1;
}
}
static void unmark_range(long code1, long code2)
{
while (code1 <= code2) {
if (code1 > MAX_UNICODE)
break;
masks[code1 / 8] &= ~(1 << (code1 % 8));
++code1;
}
}
static void dump_ranges(void)
{
long code;
int index, sum;
unsigned char *prevptr = 0;
unsigned char *ptr;
int dotdot = 0;
for (code = 0; code <= MAX_UNICODE; code += 0x100) {
ptr = masks + (code / 8);
sum = 0;
for (index = 0; index < 32; ++index)
sum += ptr[index];
if (sum == 0 || sum == (0xFF * 32)) {
if (prevptr && !memcmp(ptr, prevptr, 32)) {
if (!dotdot) {
dotdot = 1;
printf("..\n");
}
continue;
}
}
dotdot = 0;
printf("%06lX: ", code);
for (index = 0; index < 32; ++index)
printf("%02X", ptr[index]);
printf("\n");
prevptr = ptr;
}
printf("\n");
}
static void print_lookup_table(const char *name, long first, long last)
{
long index, size;
unsigned char *ptr = masks + first / 8;
size = (last - first + 1) / 8;
printf(" static unsigned char const %s[%ld] PROGMEM = {\n", name, size);
for (index = 0; index < size; ++index) {
if ((index % 8) == 0)
printf(" ");
printf("0x%02X", ptr[index]);
if (index < (size - 1)) {
if ((index % 8) == 7)
printf(",\n");
else
printf(", ");
} else {
printf("\n");
}
}
printf(" };\n");
}
static void recognizer(void)
{
long code;
int first = 1;
printf("bool Terminal::isWideCharacter(long code)\n{\n");
printf(" // This function was automatically generated by genwcwidth.c\n");
print_lookup_table("range3000", 0x3000, 0x30FF);
print_lookup_table("rangeFE00", 0xFE00, 0xFFFF);
printf(" unsigned c;\n");
// Bail out early for Latin character sets.
printf(" if (code < 0x2300) {\n");
printf(" return false;\n");
// Densely populated ranges.
printf(" } else if (code >= 0x3000 && code <= 0x30FF) {\n");
printf(" c = (unsigned)(code - 0x3000);\n");
printf(" return (pgm_read_byte(range3000 + (c / 8)) & (1 << (c %% 8))) != 0;\n");
printf(" } else if (code >= 0xFE00 && code <= 0xFFFF) {\n");
printf(" c = (unsigned)(code - 0xFE00);\n");
printf(" return (pgm_read_byte(rangeFE00 + (c / 8)) & (1 << (c %% 8))) != 0;\n");
// Deal with the main wide character ranges.
printf(" } else if (code >= 0x3400 && code <= 0x4DBF) {\n");
printf(" return true;\n");
printf(" } else if (code >= 0x4E00 && code <= 0x9FFF) {\n");
printf(" return true;\n");
printf(" } else if (code >= 0xF900 && code <= 0xFAFF) {\n");
printf(" return true;\n");
printf(" } else if (code >= 0x20000 && code <= 0x2FFFD) {\n");
printf(" return true;\n");
printf(" } else if (code >= 0x30000 && code <= 0x3FFFD) {\n");
printf(" return true;\n");
printf(" } else if (");
// Deal with the left-overs.
unmark_range(0x3000, 0x30FF);
unmark_range(0xFE00, 0xFFFF);
for (code = 0; code <= MAX_UNICODE; ++code) {
if (masks[code / 8] & (1 << (code % 8))) {
if (!first)
printf(" ||\n ");
else
first = 0;
printf("code == 0x%04lX", code);
}
}
printf(") {\n");
printf(" return true;\n");
printf(" }\n");
printf(" return false;\n");
printf("}\n");
}
int main(int argc, char *argv[])
{
FILE *file;
char buffer[BUFSIZ];
// Allocate memory for the "is this a wide character?" mask array.
masks = calloc(NUM_UNICODE / 8, sizeof(unsigned char));
if (!masks) {
fprintf(stderr, "out of memory\n");
return 1;
}
// Load the contents of "EastAsianWidth.txt".
if (argc < 2) {
fprintf(stderr, "Usage: %s EastAsianWidth.txt\n", argv[0]);
return 1;
}
if ((file = fopen(argv[1], "r")) == NULL) {
perror(argv[1]);
return 1;
}
while (fgets(buffer, sizeof(buffer), file)) {
if ((buffer[0] >= '0' && buffer[0] <= '9') ||
(buffer[0] >= 'A' && buffer[0] <= 'F')) {
long code1 = 0;
long code2 = 0;
char *endptr = NULL;
code1 = strtol(buffer, &endptr, 16);
if (endptr[0] == '.' && endptr[1] == '.') {
endptr += 2;
code2 = strtol(buffer, &endptr, 16);
} else {
code2 = code1;
}
if (endptr[0] == ';') {
// Recognise 'W' and 'F' as wide characters. It is possible
// that 'A' (ambiguous) characters may also be wide but only
// in East Asian contexts, which we assume we're not for now.
if (endptr[1] == 'W' || endptr[1] == 'F') {
mark_range(code1, code2);
}
}
}
}
fclose(file);
// Some special ranges that are implicitly all-wide even if the
// code points aren't currently allocated by the Unicode standard.
mark_range(0x3400, 0x4DBF);
mark_range(0x4E00, 0x9FFF);
mark_range(0xF900, 0xFAFF);
mark_range(0x20000, 0x2FFFD);
mark_range(0x30000, 0x3FFFD);
// Dump the ranges.
dump_ranges();
// Unmark the special ranges to make it easier to find the left-overs.
unmark_range(0x3400, 0x4DBF);
unmark_range(0x4E00, 0x9FFF);
unmark_range(0xF900, 0xFAFF);
unmark_range(0x20000, 0x2FFFD);
unmark_range(0x30000, 0x3FFFD);
// Create the recognition tree.
recognizer();
// Clean up and exit.
free(masks);
return 0;
}

View File

@ -1,196 +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.
*/
#include "BlinkLED.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include <Arduino.h>
#else
#include <WProgram.h>
#endif
/**
* \class BlinkLED BlinkLED.h <BlinkLED.h>
* \brief Blink a LED on a digital output pin.
*
* BlinkLED simplies the process of blinking a LED by encapsulating the
* control logic into a single class. The following example strobes the
* status LED on D13 with a period of 70 milliseconds on, 930 milliseconds off
* (the LED is initially off):
*
* \code
* #include <BlinkLED.h>
*
* BlinkLED statusBlink(13, 70, 930);
*
* void setup() {}
*
* void loop() {
* statusBlink.loop();
* }
* \endcode
*
* The current state() of the LED can be changed immediately by calling
* setState(). The blink rate can be modified with setBlinkRate().
* And the blink cycle can be suspended and restarted with pause()
* and resume().
*/
/**
* \brief Initialize a blinking LED on the specified \a pin.
*
* The LED will blink with a rate defined by \a onTime and \a offTime
* (in milliseconds). Initially the LED's state is given by \a initialState,
* where true means initially on and false means initially off.
*/
BlinkLED::BlinkLED(uint8_t pin, unsigned long onTime, unsigned long offTime, bool initialState)
: _pin(pin)
, _state(initialState)
, _paused(false)
, _onTime(onTime)
, _offTime(offTime)
{
pinMode(pin, OUTPUT);
digitalWrite(pin, initialState ? HIGH : LOW);
_lastChange = millis();
}
/**
* Perform a single iteration of the blink loop for this LED.
*/
void BlinkLED::loop()
{
if (_paused)
return;
unsigned long currentTime = millis();
if (_state) {
if ((currentTime - _lastChange) >= _onTime) {
digitalWrite(_pin, LOW);
_lastChange += _onTime;
_state = false;
}
} else {
if ((currentTime - _lastChange) >= _offTime) {
digitalWrite(_pin, HIGH);
_lastChange += _offTime;
_state = true;
}
}
}
/**
* \fn unsigned long BlinkLED::onTime() const
* \brief Returns the number of milliseconds the LED will be on.
*
* \sa offTime(), setBlinkRate()
*/
/**
* \fn unsigned long BlinkLED::offTime() const
* \brief Returns the number of milliseconds the LED will be off.
*
* \sa onTime(), setBlinkRate()
*/
/**
* \brief Sets the \a onTime and \a offTime (in milliseconds).
*
* The change takes effect immediately. If the current onTime() or
* offTime() has now expired, then the LED will immediately switch to
* the opposite state().
*
* \sa onTime(), offTime()
*/
void BlinkLED::setBlinkRate(unsigned long onTime, unsigned long offTime)
{
_onTime = onTime;
_offTime = offTime;
}
/**
* \fn bool BlinkLED::state() const
* \brief Returns the current state of the LED; true is on, false is off.
*
* \sa setState()
*/
/**
* \brief Sets the current \a state of the LED, where true is on, false is off.
*
* If the LED is already set to \a state, then it will complete its current
* cycle of onTime() or offTime(). Otherwise the LED is immediately set to
* \a state and a new cycle begins.
*
* \sa state()
*/
void BlinkLED::setState(bool state)
{
if (_state != state) {
digitalWrite(_pin, state ? HIGH : LOW);
_state = state;
_lastChange = millis();
}
}
/**
* \fn void BlinkLED::pause()
* \brief Pauses the LED blink cycle in its current state().
*
* \sa resume(), isPaused()
*/
/**
* \brief Resumes the LED blink cycle after a pause().
*
* The LED will complete its current onTime() or offTime() and then
* will switch to the opposite state(). If onTime() or offTime() has
* already expired, then the LED will immediately switch state.
*
* \sa pause(), isPaused()
*/
void BlinkLED::resume()
{
if (_paused) {
_paused = false;
unsigned long currentTime = millis();
if (_state) {
if ((currentTime - _lastChange) >= _onTime) {
digitalWrite(_pin, LOW);
_lastChange = currentTime;
_state = false;
}
} else {
if ((currentTime - _lastChange) >= _offTime) {
digitalWrite(_pin, HIGH);
_lastChange = currentTime;
_state = true;
}
}
}
}
/**
* \fn bool BlinkLED::isPaused()
* \brief Returns true if the LED blink cycle is paused; false otherwise.
*
* \sa pause(), resume()
*/

View File

@ -1,55 +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.
*/
#ifndef BlinkLED_h
#define BlinkLED_h
#include <inttypes.h>
class BlinkLED
{
public:
BlinkLED(uint8_t pin, unsigned long onTime, unsigned long offTime, bool initialState = false);
void loop();
unsigned long onTime() const { return _onTime; }
unsigned long offTime() const { return _offTime; }
void setBlinkRate(unsigned long onTime, unsigned long offTime);
bool state() const { return _state; }
void setState(bool state);
void pause() { _paused = true; }
void resume();
bool isPaused() const { return _paused; }
private:
uint8_t _pin;
bool _state;
bool _paused;
unsigned long _onTime;
unsigned long _offTime;
unsigned long _lastChange;
};
#endif

View File

@ -1,350 +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.
*/
#include "Charlieplex.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include <Arduino.h>
#else
#include <WProgram.h>
#endif
#include <stdlib.h>
#include <string.h>
/**
* \class Charlieplex Charlieplex.h <Charlieplex.h>
* \brief Manage an array of LED's in a charlieplexed arrangement.
*
* <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; the simplest being for two output pins:
*
* \image html charlieplex2pin.png
*
* When Pin1 is 1 and Pin2 is 0, LED1 will be lit. When Pin1 is 0 and
* Pin2 is 1, then LED2 will be lit. The technique extends to 3 pins
* as follows:
*
* \image html charlieplex3pin.png
*
* In this case, LED5 is lit when Pin1 is 1, Pin3 is 0, and Pin2 is set
* to a high-impedance input to "disconnect" it.
*
* Charlieplex presents a simple array of led() values that indicate whether
* each LED is on, off, or in an intermediate PWM state (if setPwmLed()
* is used). The application must call loop() or refresh() on a regular
* basis to ensure that the multiplexed display is kept up to date.
* The following example drives 6 LED's connected to the output pins
* D9, D10, and D11:
*
* \dontinclude BlinkLED/examples/Charlieplex/Charlieplex.ino
* \skip #include
* \until charlie.loop
* \until }
*
* The following diagram extends the circuit for 4 output pins and 12 LED's:
*
* \image html charlieplex4pin.png
*
* The following diagram extends the circuit for 5 output pins and 20 LED's:
*
* \image html charlieplex5pin.png
*
* Circuits for higher numbers of LED's get increasingly complex. For those
* cases it can be easier to use traditional multiplexing matrix arrangements
* and shift registers. The DMD class does this for a specific kind of
* large dot matrix display. Otherwise, use the following pseudocode to
* determine how to connect the LED's for higher numbers of pins:
*
* \code
* n = 1
* for Pass = 1 to NumPins-1:
* for Pin = 1 to NumPins-Pass:
* LED[n] is connected between Pin (anode) and Pin+Pass (cathode)
* LED[n+1] is connected between Pin+Pass (anode) and Pin (cathode)
* n = n + 2
* \endcode
*
* Note: while the above circuit diagrams and psuedocode use 1-based
* numbering for LED's, Charlieplex uses 0-based numbering in the led(),
* setLed(), pwmLed(), and setPwmLed() functions.
*
* It isn't necessary to wire up all LED's. If you only need 10 LED's,
* then use the 4-output circuit and omit LED11 and LED12. Charlieplex
* only drives LED's that are lit; LED's that are unlit or unused will
* be skipped during the refresh scan. The maximum number of LED's that
* that can be driven by a specific number of pins is given by the
* following table:
*
* <table>
* <tr><td>Number of Pins</td><td>Number of LED's</td></tr>
* <tr><td>2</td><td>2</td></tr>
* <tr><td>3</td><td>6</td></tr>
* <tr><td>4</td><td>12</td></tr>
* <tr><td>5</td><td>20</td></tr>
* <tr><td>6</td><td>30</td></tr>
* <tr><td>7</td><td>42</td></tr>
* <tr><td>8</td><td>56</td></tr>
* <tr><td>9</td><td>72</td></tr>
* <tr><td>10</td><td>90</td></tr>
* <tr><td>n</td><td>n * (n - 1)</td></tr>
* </table>
*/
/**
* \brief Constructs a new charliexplexing array where the output pins
* are specified by the \a numPins entries in \a pins.
*
* Note: \a numPins must be 2 or greater for correct operation.
*
* \sa count(), setLed()
*/
Charlieplex::Charlieplex(const uint8_t *pins, uint8_t numPins)
: _count(((int)numPins) * (numPins - 1))
, _lastTime(micros())
, _currentIndex(-1)
, _pwmPhase(0xC0)
{
// Determine the best hold time for 50 Hz refresh when all LED's
// are lit. Divide it again by 4 (to get 200 Hz) to manage the
// simulated PWM in refresh().
_holdTime = 20000 / _count / 4;
// Allocate the pin arrays and populate them. Doing this now makes
// refresh() more efficient later, at the expense of some memory.
_pins1 = (uint8_t *)malloc(_count);
_pins2 = (uint8_t *)malloc(_count);
int n = 0;
for (uint8_t pass = 1; pass < numPins; ++pass) {
for (uint8_t pin = 0; pin < (numPins - pass); ++pin) {
_pins1[n] = _pins2[n + 1] = pins[pin];
_pins2[n] = _pins1[n + 1] = pins[pin + pass];
n += 2;
}
}
// Allocate space for the LED value array and zero it.
_values = (uint8_t *)malloc(_count);
memset(_values, 0, _count);
// Start with all pins configured as floating inputs (all LED's off).
for (uint8_t pin = 0; pin < numPins; ++pin) {
digitalWrite(pins[pin], LOW);
pinMode(pins[pin], INPUT);
}
}
/**
* \brief Destroys this charlieplexed array.
*/
Charlieplex::~Charlieplex()
{
free(_pins1);
free(_pins2);
free(_values);
}
/**
* \fn int Charlieplex::count() const
* \brief Returns the number of LED's in this charlieplexed array based
* on the number of pins.
*
* <table>
* <tr><td>Number of Pins</td><td>Number of LED's</td></tr>
* <tr><td>2</td><td>2</td></tr>
* <tr><td>3</td><td>6</td></tr>
* <tr><td>4</td><td>12</td></tr>
* <tr><td>5</td><td>20</td></tr>
* <tr><td>6</td><td>30</td></tr>
* <tr><td>7</td><td>42</td></tr>
* <tr><td>8</td><td>56</td></tr>
* <tr><td>9</td><td>72</td></tr>
* <tr><td>10</td><td>90</td></tr>
* <tr><td>n</td><td>n * (n - 1)</td></tr>
* </table>
*
* \sa led()
*/
/**
* \fn bool Charlieplex::led(int index) const
* \brief Returns the value of the LED at \a index in the charplexed array;
* true if lit; false if not lit.
*
* If the LED is displaying a PWM value, then this function will return
* true for any non-zero PWM value.
*
* \sa setLed(), pwmLed()
*/
/**
* \fn void Charlieplex::setLed(int index, bool value)
* \brief Sets the \a value of the LED at \a index in the charliplexed array.
*
* The brightness of the LED will be proportional to the number of LED's
* that are currently lit, as the holdTime() refresh rate will cause the
* LED to appear to dim; the more LED's that are lit the less overall time
* each individual LED is held on. For best results, only a single LED should
* be lit at once or higher-brightness LED's should be used.
*
* \sa led(), setPwmLed()
*/
/**
* \fn uint8_t Charlieplex::pwmLed(int index) const
* \brief Returns the PWM value of the LED at \a index in the charplexed array;
* between 0 and 255.
*
* \sa setPwmLed(), led()
*/
/**
* \fn void Charlieplex::setPwmLed(int index, uint8_t value)
* \brief Sets the PWM \a value of the LED at \a index in the charliplexed
* array; between 0 and 255.
*
* If this function is used, then it is assumed that the output pins are
* capable of PWM output.
*
* The PWM-specified brightness of the LED will also be affected to the
* number of LED's that are currently lit, as the holdTime() refresh rate
* will cause the LED to appear to dim; the more LED's that are lit the
* less overall time each individual LED is held on. For best results,
* only a single LED should be lit at once or higher-brightness LED's
* should be used.
*
* \sa pwmLed(), setLed()
*/
/**
* \fn unsigned long Charlieplex::holdTime() const
* \brief Returns the number of microseconds that each LED should be
* held on for before moving onto the next in loop().
*
* The default value is calculated so that all LED's can be refreshed
* with a rate of at least 200 Hz, which is necessary for handling PWM
* output on multiple LED's. The less LED's that are lit at once,
* the faster the display will refresh.
*
* \sa setHoldTime(), loop()
*/
/**
* \fn void Charlieplex::setHoldTime(unsigned long us)
* \brief Sets the number of microseconds that each LED should be
* held on for before moving onto the next in loop() to \a us.
*
* \sa holdTime(), loop()
*/
/**
* \brief Runs the multiplexing loop, to display the LED states on
* the charlieplexed array.
*
* If holdTime() microseconds have elapsed since the last call to loop(),
* then the current LED is turned off and the next LED that needs to be
* lit is turned on.
*
* LED's that do not need to be lit are skipped. The total time for a
* single pass through all lit LED's may be very short if only a few
* LED's are lit at once. If all LED's are lit, then the total time for
* a single pass will be count() * holdTime() microseconds.
*
* If the application is using timer interrupts to drive the multiplexing
* process, then use refresh() instead of loop().
*
* \sa led(), pwmLed(), holdTime(), refresh()
*/
void Charlieplex::loop()
{
unsigned long us = micros();
if ((us - _lastTime) >= _holdTime) {
_lastTime = us;
refresh();
}
}
/**
* \brief Refreshes the charlieplexed array by advancing to the next LED
* that needs to be lit.
*
* This function is intended to be called from a timer interrupt service
* routine to advance the multiplexing state without the main application
* having to explicitly call loop().
*
* \sa loop()
*/
void Charlieplex::refresh()
{
// Find the next LED to be lit.
int prevIndex = _currentIndex;
int limit = _count;
while (limit >= 0) {
_currentIndex = (_currentIndex + 1) % _count;
if (_values[_currentIndex] != 0)
break;
--limit;
}
if (limit < 0) {
// No LED's are lit. Turn off the previous LED and exit.
if (prevIndex != -1) {
digitalWrite(_pins1[prevIndex], LOW);
digitalWrite(_pins2[prevIndex], LOW);
pinMode(_pins1[prevIndex], INPUT);
pinMode(_pins2[prevIndex], INPUT);
}
_currentIndex = -1;
return;
}
// Light the current LED.
uint8_t value = _values[_currentIndex];
uint8_t pin1 = _pins1[_currentIndex];
uint8_t pin2 = _pins2[_currentIndex];
_pwmPhase += 0x40;
if (prevIndex != _currentIndex) {
// Turn off the previous LED.
if (prevIndex != -1) {
digitalWrite(_pins1[prevIndex], LOW);
digitalWrite(_pins2[prevIndex], LOW);
pinMode(_pins1[prevIndex], INPUT);
pinMode(_pins2[prevIndex], INPUT);
}
// We simulate PWM using a phase counter because analogWrite()
// combined with holdTime() causes too much flickering if more
// than one LED is lit. This reduces the PWM resolution to 1 in 4.
pinMode(pin1, OUTPUT);
pinMode(pin2, OUTPUT);
if (value > _pwmPhase)
digitalWrite(pin1, HIGH);
else
digitalWrite(pin1, LOW);
} else {
// Same LED as previous. Since there is only a single LED
// that is lit, we can use analogWrite() to set the PWM state.
if (value == 255)
digitalWrite(pin1, HIGH);
else
analogWrite(pin1, value);
}
}

View File

@ -1,59 +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.
*/
#ifndef Charlieplex_h
#define Charlieplex_h
#include <inttypes.h>
class Charlieplex
{
public:
Charlieplex(const uint8_t *pins, uint8_t numPins);
~Charlieplex();
int count() const { return _count; }
bool led(int index) const { return _values[index] != 0; }
void setLed(int index, bool value) { _values[index] = (value ? 255 : 0); }
uint8_t pwmLed(int index) const { return _values[index]; }
void setPwmLed(int index, uint8_t value) { _values[index] = value; }
unsigned long holdTime() const { return _holdTime; }
void setHoldTime(unsigned long us) { _holdTime = us; }
void loop();
void refresh();
private:
int _count;
uint8_t *_pins1;
uint8_t *_pins2;
uint8_t *_values;
unsigned long _holdTime;
unsigned long _lastTime;
int _currentIndex;
uint8_t _pwmPhase;
};
#endif

View File

@ -1,182 +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.
*/
#include "ChaseLEDs.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include <Arduino.h>
#else
#include <WProgram.h>
#endif
/**
* \class ChaseLEDs ChaseLEDs.h <ChaseLEDs.h>
* \brief Chase LED's on output pins in a defined sequence.
*
* The following example performs a LED chase over the 6 PWM outputs
* on the Arduino Uno, with a 150 millisecond delay between each LED:
*
* \code
* uint8_t pins[] = {3, 5, 6, 9, 10, 11};
* ChaseLEDs chaser(pins, sizeof(pins), 150);
*
* void loop() {
* chaser.loop();
* }
* \endcode
*
* After pin 11 is lit, the pattern will repeat at pin 3. To cause the
* chase to oscillate back and forth instead, extend the sequence as follows:
*
* \code
* uint8_t pins[] = {3, 5, 6, 9, 10, 11, 10, 9, 6, 5};
* ChaseLEDs chaser(pins, sizeof(pins), 150);
* \endcode
*
* See the \ref blink_cylon "Cylon" example for more information on
* how to use the ChaseLEDs class in a practical application.
*/
/**
* \brief Initializes the LED chaser.
*
* The chase sequence consists of \a num pins, whose names are given by
* the \a pins array. Each LED is lit for \a advanceTime milliseconds
* before advancing to the next LED.
*
* This constructor configures all of the pins for output and sets their
* state to be LOW. The first LED will be lit when the program first
* calls loop().
*
* \sa loop()
*/
ChaseLEDs::ChaseLEDs(const uint8_t *pins, int num, unsigned long advanceTime)
: _pins(pins)
, _numPins(num)
, _currentIndex(-1)
, _advanceTime(advanceTime)
, _lastChange(millis())
{
for (uint8_t index = 0; index < _numPins; ++index) {
pinMode(_pins[index], OUTPUT);
digitalWrite(_pins[index], LOW);
}
}
/**
* Perform a single iteration of the control loop for this LED chaser.
*/
void ChaseLEDs::loop()
{
if (_currentIndex >= 0) {
if ((millis() - _lastChange) >= _advanceTime) {
// Advance to the next LED in sequence.
_currentIndex = (_currentIndex + 1) % _numPins;
_lastChange += _advanceTime;
advance(previousPin(1), _pins[_currentIndex]);
}
} else {
// First time - light the first LED.
_currentIndex = 0;
_lastChange = millis();
advance(previousPin(1), _pins[_currentIndex]);
}
}
/**
* \fn unsigned long ChaseLEDs::advanceTime() const
* \brief Returns the number of milliseconds that each LED will be
* lit in the chase sequence.
*
* \sa setAdvanceTime(), advance()
*/
/**
* \fn void ChaseLEDs::setAdvanceTime(unsigned long advanceTime)
* \brief Sets the number of milliseconds to advance between LED's to
* \a advanceTime.
*
* \sa advanceTime(), advance()
*/
/**
* \brief Advances to the next LED in sequence, turning off \a prevPin,
* and turning on \a nextPin.
*
* The default implementation is equivalent to the following code:
*
* \code
* digitalWrite(prevPin, LOW);
* digitalWrite(nextPin, HIGH);
* \endcode
*
* This method may be overridden in subclasses to provide special effects.
* See the documentation for previousPin() for some example effects.
*
* \sa previousPin()
*/
void ChaseLEDs::advance(uint8_t prevPin, uint8_t nextPin)
{
digitalWrite(prevPin, LOW);
digitalWrite(nextPin, HIGH);
}
/**
* \fn uint8_t ChaseLEDs::previousPin(int n) const
* \brief Returns the pin that is \a n steps back in the sequence.
*
* If \a n is zero, then the current pin is returned; if \a n is 1,
* then the previous pin is returned; and so on.
*
* This function may be called by subclasses in their advance() method
* to manipulate pins that are further back in the chase sequence than
* the immediately previous pin.
*
* For example, the following code implements a LED chaser that lights
* two pins at a time:
*
* \code
* void DoubleChaser::advance(uint8_t prevPin, uint8_t nextPin)
* {
* digitalWrite(previousPin(2), LOW);
* digitalWrite(prevPin, HIGH);
* digitalWrite(nextPin, HIGH);
* }
* \endcode
*
* As another exmaple, the following code uses PWM outputs to fade out
* the previous pin rather than turn it off immediately:
*
* \code
* void FadingChaser::advance(uint8_t prevPin, uint8_t nextPin)
* {
* digitalWrite(previousPin(2), LOW);
* analogWrite(prevPin, 32);
* digitalWrite(nextPin, HIGH);
* }
* \endcode
*
* Note: it is possible to retrieve the \em following pin in sequence using
* previousPin(-1). This could be used to fade in the LED that follows
* \a nextPin.
*
* \sa advance()
*/

View File

@ -1,51 +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.
*/
#ifndef ChaseLEDs_h
#define ChaseLEDs_h
#include <inttypes.h>
class ChaseLEDs
{
public:
ChaseLEDs(const uint8_t *pins, int num, unsigned long advanceTime);
void loop();
unsigned long advanceTime() const { return _advanceTime; }
void setAdvanceTime(unsigned long advanceTime) { _advanceTime = advanceTime; }
protected:
virtual void advance(uint8_t prevPin, uint8_t nextPin);
uint8_t previousPin(int n) const
{ return _pins[(_currentIndex + _numPins - n) % _numPins]; }
private:
const uint8_t *_pins;
int _numPins;
int _currentIndex;
unsigned long _advanceTime;
unsigned long _lastChange;
};
#endif

View File

@ -1,16 +0,0 @@
/*
Blink the status LED using the BlinkLED utility class.
This example is placed into the public domain.
*/
#include <BlinkLED.h>
BlinkLED statusBlink(13, 70, 930);
void setup() {}
void loop() {
statusBlink.loop();
}

View File

@ -1,16 +0,0 @@
/* This example is placed into the public domain */
#include <Charlieplex.h>
byte pins[3] = {9, 10, 11};
Charlieplex charlie(pins, sizeof(pins));
void setup() {
charlie.setLed(0, true); // Turn on LED1
charlie.setLed(3, true); // Turn on LED4
charlie.setPwmLed(5, 64); // Set LED6 to one-quarter on
}
void loop() {
charlie.loop();
}

View File

@ -1,87 +0,0 @@
#FIG 3.2 Produced by xfig version 3.2.5b
Landscape
Center
Metric
A4
100.00
Single
-2
1200 2
6 3825 3105 4275 3195
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3920 3150 3825 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
4185 3150 4158 3110 4104 3190 4050 3110 3996 3190 3942 3110
3915 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4275 3150 4180 3150
-6
6 4410 3375 4635 3735
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
4500 3600 4545 3510 4455 3510 4500 3600
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4500 3600 4500 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4445 3600 4555 3600
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4635 3555 4590 3600
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
4635 3600 4635 3555 4590 3555
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
4635 3510 4635 3465 4590 3465
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4635 3465 4590 3510
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4500 3375 4500 3510
-6
6 3825 4005 4275 4095
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3920 4050 3825 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
4185 4050 4158 4010 4104 4090 4050 4010 3996 4090 3942 4010
3915 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4275 4050 4180 4050
-6
6 4455 3105 4545 3195
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 4500 3150 30 30 4500 3150 4500 3180
-6
6 4455 4005 4545 4095
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 4500 4050 30 30 4500 4050 4500 4080
-6
6 5310 3375 5535 3735
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
5400 3510 5445 3600 5355 3600 5400 3510
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5400 3510 5400 3375
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5345 3510 5455 3510
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5535 3555 5490 3510
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
5535 3510 5535 3555 5490 3555
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
5535 3600 5535 3645 5490 3645
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5535 3645 5490 3600
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5400 3735 5400 3600
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
4230 3150 5400 3150 5400 3420
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
4500 3420 4500 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
4275 4050 5400 4050 5400 3690
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
4500 3735 4500 4050
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
8 1 1.00 60.00 120.00
3870 3150 3600 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
8 1 1.00 60.00 120.00
3825 4050 3600 4050
4 0 0 50 -1 0 12 0.0000 4 135 480 5625 3645 LED2\001
4 0 0 50 -1 0 12 0.0000 4 135 480 4725 3645 LED1\001
4 0 0 50 -1 0 12 0.0000 4 135 375 3105 3195 Pin1\001
4 0 0 50 -1 0 12 0.0000 4 135 375 3105 4095 Pin2\001

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -1,210 +0,0 @@
#FIG 3.2 Produced by xfig version 3.2.5b
Landscape
Center
Metric
A4
100.00
Single
-2
1200 2
6 3825 3105 4275 3195
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3920 3150 3825 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
4185 3150 4158 3110 4104 3190 4050 3110 3996 3190 3942 3110
3915 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4275 3150 4180 3150
-6
6 4410 3375 4635 3735
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
4500 3600 4545 3510 4455 3510 4500 3600
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4500 3600 4500 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4445 3600 4555 3600
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4635 3555 4590 3600
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
4635 3600 4635 3555 4590 3555
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
4635 3510 4635 3465 4590 3465
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4635 3465 4590 3510
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4500 3375 4500 3510
-6
6 3825 4005 4275 4095
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3920 4050 3825 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
4185 4050 4158 4010 4104 4090 4050 4010 3996 4090 3942 4010
3915 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4275 4050 4180 4050
-6
6 4455 3105 4545 3195
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 4500 3150 30 30 4500 3150 4500 3180
-6
6 4455 4005 4545 4095
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 4500 4050 30 30 4500 4050 4500 4080
-6
6 3825 4905 4275 4995
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3920 4950 3825 4950
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
4185 4950 4158 4910 4104 4990 4050 4910 3996 4990 3942 4910
3915 4950
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4275 4950 4180 4950
-6
6 4410 4275 4635 4635
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
4500 4500 4545 4410 4455 4410 4500 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4500 4500 4500 4635
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4445 4500 4555 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4635 4455 4590 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
4635 4500 4635 4455 4590 4455
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
4635 4410 4635 4365 4590 4365
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4635 4365 4590 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4500 4275 4500 4410
-6
6 6210 3915 6435 4275
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6300 4140 6345 4050 6255 4050 6300 4140
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6300 4140 6300 4275
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6245 4140 6355 4140
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 4095 6390 4140
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6435 4140 6435 4095 6390 4095
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6435 4050 6435 4005 6390 4005
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 4005 6390 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6300 3915 6300 4050
-6
6 5310 3375 5535 3735
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
5400 3510 5445 3600 5355 3600 5400 3510
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5400 3510 5400 3375
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5345 3510 5455 3510
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5535 3555 5490 3510
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
5535 3510 5535 3555 5490 3555
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
5535 3600 5535 3645 5490 3645
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5535 3645 5490 3600
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5400 3735 5400 3600
-6
6 5310 4275 5535 4635
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
5400 4410 5445 4500 5355 4500 5400 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5400 4410 5400 4275
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5345 4410 5455 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5535 4455 5490 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
5535 4410 5535 4455 5490 4455
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
5535 4500 5535 4545 5490 4545
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5535 4545 5490 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5400 4635 5400 4500
-6
6 7110 3915 7335 4275
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
7200 4050 7245 4140 7155 4140 7200 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7200 4050 7200 3915
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7145 4050 7255 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7335 4095 7290 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7335 4050 7335 4095 7290 4095
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7335 4140 7335 4185 7290 4185
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7335 4185 7290 4140
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7200 4275 7200 4140
-6
6 5355 3105 5445 3195
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 5400 3150 30 30 5400 3150 5400 3180
-6
6 6255 3105 6345 3195
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 6300 3150 30 30 6300 3150 6300 3180
-6
6 6255 4905 6345 4995
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 6300 4950 30 30 6300 4950 6300 4980
-6
6 5355 4905 5445 4995
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 5400 4950 30 30 5400 4950 5400 4980
-6
6 4455 4905 4545 4995
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 4500 4950 30 30 4500 4950 4500 4980
-6
6 5355 4005 5445 4095
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 5400 4050 30 30 5400 4050 5400 4080
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
4230 3150 5400 3150 5400 3420
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
4500 3420 4500 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
4275 4050 5400 4050 5400 3690
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
4500 3735 4500 4050
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
8 1 1.00 60.00 120.00
3870 3150 3600 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
8 1 1.00 60.00 120.00
3825 4050 3600 4050
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
8 1 1.00 60.00 120.00
3825 4950 3600 4950
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
4500 4050 4500 4320
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
4500 4590 4500 4950
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5400 4365 5400 4005
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
4275 4950 5400 4950 5400 4590
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
5400 3150 6300 3150 6300 3960
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6255 3150 7200 3150 7200 3960
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
5355 4950 6300 4950 6300 4230
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6300 4950 7200 4950 7200 4185
4 0 0 50 -1 0 12 0.0000 4 135 480 5625 3645 LED2\001
4 0 0 50 -1 0 12 0.0000 4 135 480 4725 3645 LED1\001
4 0 0 50 -1 0 12 0.0000 4 135 375 3105 3195 Pin1\001
4 0 0 50 -1 0 12 0.0000 4 135 375 3105 4095 Pin2\001
4 0 0 50 -1 0 12 0.0000 4 135 375 3105 4995 Pin3\001
4 0 0 50 -1 0 12 0.0000 4 135 480 4725 4545 LED3\001
4 0 0 50 -1 0 12 0.0000 4 135 480 5625 4545 LED4\001
4 0 0 50 -1 0 12 0.0000 4 135 480 7425 4140 LED6\001
4 0 0 50 -1 0 12 0.0000 4 135 480 6525 4140 LED5\001

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -1,394 +0,0 @@
#FIG 3.2 Produced by xfig version 3.2.5b
Landscape
Center
Metric
A4
100.00
Single
-2
1200 2
5 1 0 1 0 7 50 -1 -1 0.000 0 0 0 0 6300.000 4950.000 6300 4905 6345 4950 6300 4995
6 3825 3105 4275 3195
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3920 3150 3825 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
4185 3150 4158 3110 4104 3190 4050 3110 3996 3190 3942 3110
3915 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4275 3150 4180 3150
-6
6 4410 3375 4635 3735
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
4500 3600 4545 3510 4455 3510 4500 3600
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4500 3600 4500 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4445 3600 4555 3600
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4635 3555 4590 3600
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
4635 3600 4635 3555 4590 3555
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
4635 3510 4635 3465 4590 3465
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4635 3465 4590 3510
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4500 3375 4500 3510
-6
6 3825 4005 4275 4095
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3920 4050 3825 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
4185 4050 4158 4010 4104 4090 4050 4010 3996 4090 3942 4010
3915 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4275 4050 4180 4050
-6
6 4455 3105 4545 3195
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 4500 3150 30 30 4500 3150 4500 3180
-6
6 4455 4005 4545 4095
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 4500 4050 30 30 4500 4050 4500 4080
-6
6 3825 4905 4275 4995
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3920 4950 3825 4950
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
4185 4950 4158 4910 4104 4990 4050 4910 3996 4990 3942 4910
3915 4950
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4275 4950 4180 4950
-6
6 4410 4275 4635 4635
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
4500 4500 4545 4410 4455 4410 4500 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4500 4500 4500 4635
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4445 4500 4555 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4635 4455 4590 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
4635 4500 4635 4455 4590 4455
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
4635 4410 4635 4365 4590 4365
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4635 4365 4590 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4500 4275 4500 4410
-6
6 5310 3375 5535 3735
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
5400 3510 5445 3600 5355 3600 5400 3510
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5400 3510 5400 3375
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5345 3510 5455 3510
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5535 3555 5490 3510
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
5535 3510 5535 3555 5490 3555
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
5535 3600 5535 3645 5490 3645
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5535 3645 5490 3600
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5400 3735 5400 3600
-6
6 5310 4275 5535 4635
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
5400 4410 5445 4500 5355 4500 5400 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5400 4410 5400 4275
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5345 4410 5455 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5535 4455 5490 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
5535 4410 5535 4455 5490 4455
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
5535 4500 5535 4545 5490 4545
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5535 4545 5490 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5400 4635 5400 4500
-6
6 5355 3105 5445 3195
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 5400 3150 30 30 5400 3150 5400 3180
-6
6 5355 4905 5445 4995
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 5400 4950 30 30 5400 4950 5400 4980
-6
6 4455 4905 4545 4995
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 4500 4950 30 30 4500 4950 4500 4980
-6
6 5355 4005 5445 4095
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 5400 4050 30 30 5400 4050 5400 4080
-6
6 6660 3915 6885 4275
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6750 4140 6795 4050 6705 4050 6750 4140
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6750 4140 6750 4275
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6695 4140 6805 4140
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6885 4095 6840 4140
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6885 4140 6885 4095 6840 4095
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6885 4050 6885 4005 6840 4005
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6885 4005 6840 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6750 3915 6750 4050
-6
6 7560 3915 7785 4275
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
7650 4050 7695 4140 7605 4140 7650 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7650 4050 7650 3915
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7595 4050 7705 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7785 4095 7740 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7785 4050 7785 4095 7740 4095
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7785 4140 7785 4185 7740 4185
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7785 4185 7740 4140
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7650 4275 7650 4140
-6
6 6705 3105 6795 3195
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 6750 3150 30 30 6750 3150 6750 3180
-6
6 6705 4905 6795 4995
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 6750 4950 30 30 6750 4950 6750 4980
-6
6 4410 5175 4635 5535
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
4500 5400 4545 5310 4455 5310 4500 5400
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4500 5400 4500 5535
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4445 5400 4555 5400
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4635 5355 4590 5400
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
4635 5400 4635 5355 4590 5355
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
4635 5310 4635 5265 4590 5265
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4635 5265 4590 5310
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4500 5175 4500 5310
-6
6 3825 5805 4275 5895
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3920 5850 3825 5850
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
4185 5850 4158 5810 4104 5890 4050 5810 3996 5890 3942 5810
3915 5850
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4275 5850 4180 5850
-6
6 4455 5805 4545 5895
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 4500 5850 30 30 4500 5850 4500 5880
-6
6 5310 5175 5535 5535
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
5400 5310 5445 5400 5355 5400 5400 5310
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5400 5310 5400 5175
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5345 5310 5455 5310
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5535 5355 5490 5310
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
5535 5310 5535 5355 5490 5355
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
5535 5400 5535 5445 5490 5445
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5535 5445 5490 5400
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5400 5535 5400 5400
-6
6 5355 5805 5445 5895
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 5400 5850 30 30 5400 5850 5400 5880
-6
6 6255 5040 6345 5130
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 6300 5085 30 30 6300 5085 6300 5115
-6
6 6210 5175 6435 5535
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6300 5400 6345 5310 6255 5310 6300 5400
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6300 5400 6300 5535
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6245 5400 6355 5400
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 5355 6390 5400
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6435 5400 6435 5355 6390 5355
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6435 5310 6435 5265 6390 5265
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 5265 6390 5310
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6300 5175 6300 5310
-6
6 6255 5805 6345 5895
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 6300 5850 30 30 6300 5850 6300 5880
-6
6 7110 5175 7335 5535
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
7200 5310 7245 5400 7155 5400 7200 5310
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7200 5310 7200 5175
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7145 5310 7255 5310
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7335 5355 7290 5310
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7335 5310 7335 5355 7290 5355
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7335 5400 7335 5445 7290 5445
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7335 5445 7290 5400
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7200 5535 7200 5400
-6
6 8460 4275 8685 4635
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
8550 4500 8595 4410 8505 4410 8550 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
8550 4500 8550 4635
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
8495 4500 8605 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
8685 4455 8640 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
8685 4500 8685 4455 8640 4455
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
8685 4410 8685 4365 8640 4365
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
8685 4365 8640 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
8550 4275 8550 4410
-6
6 9360 4275 9585 4635
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
9450 4410 9495 4500 9405 4500 9450 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9450 4410 9450 4275
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9395 4410 9505 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9585 4455 9540 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
9585 4410 9585 4455 9540 4455
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
9585 4500 9585 4545 9540 4545
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9585 4545 9540 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9450 4635 9450 4500
-6
6 8505 3105 8595 3195
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 8550 3150 30 30 8550 3150 8550 3180
-6
6 7605 3105 7695 3195
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 7650 3150 30 30 7650 3150 7650 3180
-6
6 7155 5805 7245 5895
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 7200 5850 30 30 7200 5850 7200 5880
-6
6 8505 5805 8595 5895
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 8550 5850 30 30 8550 5850 8550 5880
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
4230 3150 5400 3150 5400 3420
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
4500 3420 4500 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
4275 4050 5400 4050 5400 3690
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
4500 3735 4500 4050
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
8 1 1.00 60.00 120.00
3870 3150 3600 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
8 1 1.00 60.00 120.00
3825 4050 3600 4050
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
8 1 1.00 60.00 120.00
3825 4950 3600 4950
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
4500 4050 4500 4320
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
4500 4590 4500 4950
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5400 4365 5400 4005
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
4275 4950 5400 4950 5400 4590
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
4500 4950 4500 5220
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5400 5490 5400 5850
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5400 5220 5400 4950
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5400 3150 6795 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
6750 3150 6750 3960
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5400 4950 6750 4950
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
6750 4230 6750 4950
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
5400 4050 6300 4050 6300 4905
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6705 3150 7650 3150 7650 3960
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6750 4950 7650 4950 7650 4185
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
4230 5850 4500 5850 4500 5490
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
8 1 1.00 60.00 120.00
3825 5850 3600 5850
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
4500 5850 5400 5850
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6300 5085 7200 5085 7200 5220
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
6300 4995 6300 5220
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
6300 5490 6300 5850
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
5400 5850 7200 5850 7200 5490
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
7605 3150 8550 3150 8550 4275
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
7200 5850 8550 5850 8550 4590
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
8505 3150 9450 3150 9450 4275
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
8550 5850 9450 5850 9450 4590
4 0 0 50 -1 0 12 0.0000 4 135 480 5625 3645 LED2\001
4 0 0 50 -1 0 12 0.0000 4 135 480 4725 3645 LED1\001
4 0 0 50 -1 0 12 0.0000 4 135 375 3105 3195 Pin1\001
4 0 0 50 -1 0 12 0.0000 4 135 375 3105 4095 Pin2\001
4 0 0 50 -1 0 12 0.0000 4 135 375 3105 4995 Pin3\001
4 0 0 50 -1 0 12 0.0000 4 135 480 4725 4545 LED3\001
4 0 0 50 -1 0 12 0.0000 4 135 480 5625 4545 LED4\001
4 0 0 50 -1 0 12 0.0000 4 135 480 7875 4140 LED8\001
4 0 0 50 -1 0 12 0.0000 4 135 480 6975 4140 LED7\001
4 0 0 50 -1 0 12 0.0000 4 135 375 3105 5895 Pin4\001
4 0 0 50 -1 0 12 0.0000 4 135 480 5625 5445 LED6\001
4 0 0 50 -1 0 12 0.0000 4 135 480 4725 5445 LED5\001
4 0 0 50 -1 0 12 0.0000 4 135 480 6525 5445 LED9\001
4 0 0 50 -1 0 12 0.0000 4 135 585 7425 5445 LED10\001
4 0 0 50 -1 0 12 0.0000 4 135 585 8730 4500 LED11\001
4 0 0 50 -1 0 12 0.0000 4 135 585 9630 4500 LED12\001

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

View File

@ -1,649 +0,0 @@
#FIG 3.2 Produced by xfig version 3.2.5b
Landscape
Center
Metric
A4
100.00
Single
-2
1200 2
5 1 0 1 0 7 50 -1 -1 0.000 0 0 0 0 4500.000 4950.000 4500 4905 4545 4950 4500 4995
5 1 0 1 0 7 50 -1 -1 0.000 0 0 0 0 4950.000 4500.000 4905 4500 4950 4455 4995 4500
5 1 0 1 0 7 50 -1 -1 0.000 0 0 0 0 5850.000 4500.000 5805 4500 5850 4455 5895 4500
5 1 0 1 0 7 50 -1 -1 0.000 0 0 0 0 6750.000 4500.000 6750 4455 6795 4500 6750 4545
5 1 0 1 0 7 50 -1 -1 0.000 0 0 0 0 6750.000 4950.000 6750 4905 6795 4950 6750 4995
5 1 0 1 0 7 50 -1 -1 0.000 0 0 0 0 6300.000 5625.000 6255 5625 6300 5580 6345 5625
6 2025 3105 2475 3195
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2120 3150 2025 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
2385 3150 2358 3110 2304 3190 2250 3110 2196 3190 2142 3110
2115 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2475 3150 2380 3150
-6
6 2610 3375 2835 3735
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
2700 3600 2745 3510 2655 3510 2700 3600
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2700 3600 2700 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2645 3600 2755 3600
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2835 3555 2790 3600
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
2835 3600 2835 3555 2790 3555
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
2835 3510 2835 3465 2790 3465
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2835 3465 2790 3510
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2700 3375 2700 3510
-6
6 2025 4005 2475 4095
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2120 4050 2025 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
2385 4050 2358 4010 2304 4090 2250 4010 2196 4090 2142 4010
2115 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2475 4050 2380 4050
-6
6 2655 3105 2745 3195
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 2700 3150 30 30 2700 3150 2700 3180
-6
6 2655 4005 2745 4095
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 2700 4050 30 30 2700 4050 2700 4080
-6
6 2025 4905 2475 4995
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2120 4950 2025 4950
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
2385 4950 2358 4910 2304 4990 2250 4910 2196 4990 2142 4910
2115 4950
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2475 4950 2380 4950
-6
6 2610 4275 2835 4635
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
2700 4500 2745 4410 2655 4410 2700 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2700 4500 2700 4635
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2645 4500 2755 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2835 4455 2790 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
2835 4500 2835 4455 2790 4455
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
2835 4410 2835 4365 2790 4365
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2835 4365 2790 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2700 4275 2700 4410
-6
6 3510 3375 3735 3735
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
3600 3510 3645 3600 3555 3600 3600 3510
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3600 3510 3600 3375
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3545 3510 3655 3510
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3735 3555 3690 3510
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
3735 3510 3735 3555 3690 3555
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
3735 3600 3735 3645 3690 3645
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3735 3645 3690 3600
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3600 3735 3600 3600
-6
6 3510 4275 3735 4635
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
3600 4410 3645 4500 3555 4500 3600 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3600 4410 3600 4275
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3545 4410 3655 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3735 4455 3690 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
3735 4410 3735 4455 3690 4455
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
3735 4500 3735 4545 3690 4545
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3735 4545 3690 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3600 4635 3600 4500
-6
6 3555 3105 3645 3195
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 3600 3150 30 30 3600 3150 3600 3180
-6
6 3555 4905 3645 4995
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 3600 4950 30 30 3600 4950 3600 4980
-6
6 2655 4905 2745 4995
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 2700 4950 30 30 2700 4950 2700 4980
-6
6 3555 4005 3645 4095
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 3600 4050 30 30 3600 4050 3600 4080
-6
6 4860 3915 5085 4275
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
4950 4140 4995 4050 4905 4050 4950 4140
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4950 4140 4950 4275
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4895 4140 5005 4140
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5085 4095 5040 4140
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
5085 4140 5085 4095 5040 4095
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
5085 4050 5085 4005 5040 4005
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5085 4005 5040 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4950 3915 4950 4050
-6
6 5760 3915 5985 4275
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
5850 4050 5895 4140 5805 4140 5850 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5850 4050 5850 3915
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5795 4050 5905 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5985 4095 5940 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
5985 4050 5985 4095 5940 4095
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
5985 4140 5985 4185 5940 4185
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5985 4185 5940 4140
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5850 4275 5850 4140
-6
6 4905 3105 4995 3195
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 4950 3150 30 30 4950 3150 4950 3180
-6
6 4905 4905 4995 4995
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 4950 4950 30 30 4950 4950 4950 4980
-6
6 2610 5175 2835 5535
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
2700 5400 2745 5310 2655 5310 2700 5400
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2700 5400 2700 5535
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2645 5400 2755 5400
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2835 5355 2790 5400
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
2835 5400 2835 5355 2790 5355
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
2835 5310 2835 5265 2790 5265
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2835 5265 2790 5310
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2700 5175 2700 5310
-6
6 2025 5805 2475 5895
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2120 5850 2025 5850
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
2385 5850 2358 5810 2304 5890 2250 5810 2196 5890 2142 5810
2115 5850
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2475 5850 2380 5850
-6
6 2655 5805 2745 5895
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 2700 5850 30 30 2700 5850 2700 5880
-6
6 3510 5175 3735 5535
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
3600 5310 3645 5400 3555 5400 3600 5310
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3600 5310 3600 5175
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3545 5310 3655 5310
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3735 5355 3690 5310
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
3735 5310 3735 5355 3690 5355
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
3735 5400 3735 5445 3690 5445
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3735 5445 3690 5400
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3600 5535 3600 5400
-6
6 3555 5805 3645 5895
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 3600 5850 30 30 3600 5850 3600 5880
-6
6 4455 5040 4545 5130
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 4500 5085 30 30 4500 5085 4500 5115
-6
6 4410 5175 4635 5535
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
4500 5400 4545 5310 4455 5310 4500 5400
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4500 5400 4500 5535
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4445 5400 4555 5400
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4635 5355 4590 5400
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
4635 5400 4635 5355 4590 5355
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
4635 5310 4635 5265 4590 5265
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4635 5265 4590 5310
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4500 5175 4500 5310
-6
6 4455 5805 4545 5895
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 4500 5850 30 30 4500 5850 4500 5880
-6
6 5310 5175 5535 5535
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
5400 5310 5445 5400 5355 5400 5400 5310
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5400 5310 5400 5175
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5345 5310 5455 5310
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5535 5355 5490 5310
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
5535 5310 5535 5355 5490 5355
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
5535 5400 5535 5445 5490 5445
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5535 5445 5490 5400
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5400 5535 5400 5400
-6
6 2025 6705 2475 6795
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2120 6750 2025 6750
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
2385 6750 2358 6710 2304 6790 2250 6710 2196 6790 2142 6710
2115 6750
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2475 6750 2380 6750
-6
6 2655 6705 2745 6795
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 2700 6750 30 30 2700 6750 2700 6780
-6
6 2610 6075 2835 6435
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
2700 6300 2745 6210 2655 6210 2700 6300
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2700 6300 2700 6435
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2645 6300 2755 6300
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2835 6255 2790 6300
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
2835 6300 2835 6255 2790 6255
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
2835 6210 2835 6165 2790 6165
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2835 6165 2790 6210
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2700 6075 2700 6210
-6
6 3510 6075 3735 6435
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
3600 6210 3645 6300 3555 6300 3600 6210
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3600 6210 3600 6075
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3545 6210 3655 6210
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3735 6255 3690 6210
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
3735 6210 3735 6255 3690 6255
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
3735 6300 3735 6345 3690 6345
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3735 6345 3690 6300
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3600 6435 3600 6300
-6
6 7110 5715 7335 6075
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
7200 5850 7245 5940 7155 5940 7200 5850
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7200 5850 7200 5715
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7145 5850 7255 5850
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7335 5895 7290 5850
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7335 5850 7335 5895 7290 5895
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7335 5940 7335 5985 7290 5985
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7335 5985 7290 5940
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7200 6075 7200 5940
-6
6 6210 5715 6435 6075
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6300 5940 6345 5850 6255 5850 6300 5940
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6300 5940 6300 6075
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6245 5940 6355 5940
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 5895 6390 5940
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6435 5940 6435 5895 6390 5895
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6435 5850 6435 5805 6390 5805
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 5805 6390 5850
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6300 5715 6300 5850
-6
6 5805 4905 5895 4995
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 5850 4950 30 30 5850 4950 5850 4980
-6
6 6255 4905 6345 4995
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 6300 4950 30 30 6300 4950 6300 4980
-6
6 6255 6705 6345 6795
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 6300 6750 30 30 6300 6750 6300 6780
-6
6 3555 6705 3645 6795
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 3600 6750 30 30 3600 6750 3600 6780
-6
6 8010 5715 8235 6075
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
8100 5940 8145 5850 8055 5850 8100 5940
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
8100 5940 8100 6075
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
8045 5940 8155 5940
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
8235 5895 8190 5940
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
8235 5940 8235 5895 8190 5895
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
8235 5850 8235 5805 8190 5805
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
8235 5805 8190 5850
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
8100 5715 8100 5850
-6
6 8910 5715 9135 6075
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
9000 5850 9045 5940 8955 5940 9000 5850
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9000 5850 9000 5715
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
8945 5850 9055 5850
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9135 5895 9090 5850
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
9135 5850 9135 5895 9090 5895
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
9135 5940 9135 5985 9090 5985
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9135 5985 9090 5940
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9000 6075 9000 5940
-6
6 4455 4455 4545 4545
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 4500 4500 30 30 4500 4500 4500 4530
-6
6 8055 4455 8145 4545
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 8100 4500 30 30 8100 4500 8100 4530
-6
6 7155 6705 7245 6795
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 7200 6750 30 30 7200 6750 7200 6780
-6
6 8055 6705 8145 6795
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 8100 6750 30 30 8100 6750 8100 6780
-6
6 6660 3915 6885 4275
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6750 4140 6795 4050 6705 4050 6750 4140
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6750 4140 6750 4275
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6695 4140 6805 4140
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6885 4095 6840 4140
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6885 4140 6885 4095 6840 4095
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6885 4050 6885 4005 6840 4005
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6885 4005 6840 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6750 3915 6750 4050
-6
6 7560 3915 7785 4275
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
7650 4050 7695 4140 7605 4140 7650 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7650 4050 7650 3915
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7595 4050 7705 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7785 4095 7740 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7785 4050 7785 4095 7740 4095
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7785 4140 7785 4185 7740 4185
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7785 4185 7740 4140
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7650 4275 7650 4140
-6
6 5355 5805 5445 5895
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 5400 5850 30 30 5400 5850 5400 5880
-6
6 6705 4320 6795 4410
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 6750 4365 30 30 6750 4365 6750 4395
-6
6 6705 3105 6795 3195
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 6750 3150 30 30 6750 3150 6750 3180
-6
6 5805 3105 5895 3195
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 5850 3150 30 30 5850 3150 5850 3180
-6
6 9810 4725 10035 5085
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
9900 4950 9945 4860 9855 4860 9900 4950
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9900 4950 9900 5085
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9845 4950 9955 4950
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10035 4905 9990 4950
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
10035 4950 10035 4905 9990 4905
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
10035 4860 10035 4815 9990 4815
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10035 4815 9990 4860
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9900 4725 9900 4860
-6
6 10710 4725 10935 5085
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
10800 4860 10845 4950 10755 4950 10800 4860
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10800 4860 10800 4725
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10745 4860 10855 4860
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10935 4905 10890 4860
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
10935 4860 10935 4905 10890 4905
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
10935 4950 10935 4995 10890 4995
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10935 4995 10890 4950
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10800 5085 10800 4950
-6
6 9855 3105 9945 3195
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 9900 3150 30 30 9900 3150 9900 3180
-6
6 8955 6705 9045 6795
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 9000 6750 30 30 9000 6750 9000 6780
-6
6 9855 6705 9945 6795
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 9900 6750 30 30 9900 6750 9900 6780
-6
6 7605 3105 7695 3195
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 7650 3150 30 30 7650 3150 7650 3180
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
2430 3150 3600 3150 3600 3420
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
2700 3420 2700 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
2475 4050 3600 4050 3600 3690
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
2700 3735 2700 4050
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
8 1 1.00 60.00 120.00
2070 3150 1800 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
8 1 1.00 60.00 120.00
2025 4050 1800 4050
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
8 1 1.00 60.00 120.00
2025 4950 1800 4950
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
2700 4050 2700 4320
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
2700 4590 2700 4950
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
3600 4365 3600 4005
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
2475 4950 3600 4950 3600 4590
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
2700 4950 2700 5220
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
3600 5490 3600 5850
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
3600 5220 3600 4950
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
3600 3150 4995 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
4950 3150 4950 3960
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
3600 4950 4950 4950
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
4950 4230 4950 4950
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
3600 4050 4500 4050 4500 4905
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
4905 3150 5850 3150 5850 3960
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
4950 4950 5850 4950 5850 4185
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
2430 5850 2700 5850 2700 5490
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
8 1 1.00 60.00 120.00
2025 5850 1800 5850
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
2700 5850 3600 5850
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
4500 5085 5400 5085 5400 5220
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
4500 4995 4500 5220
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
4500 5490 4500 5850
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
3600 5850 5400 5850 5400 5490
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
8 1 1.00 60.00 120.00
2025 6750 1800 6750
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
2430 6750 2700 6750 2700 6390
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
2700 6750 3600 6750
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
3600 6390 3600 6750
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
2700 5850 2700 6120
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
3600 5850 3600 6120
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
5760 4950 7200 4950 7200 5715
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
6300 5715 6300 4950
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
3600 6750 7200 6750 7200 6030
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
6300 6030 6300 6750
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
4500 4500 4905 4500
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
4995 4500 5805 4500
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
5895 4500 8100 4500 8100 5760
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
8055 4500 9000 4500 9000 5760
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
8100 6075 8100 6750 7155 6750
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
8010 6750 9000 6750 9000 6030
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4
5400 5850 6075 5850 6075 5625 6255 5625
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6345 5625 6750 5625 6750 4995
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
6750 4905 6750 4545
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
6750 4455 6750 4230
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6750 4365 7650 4365 7650 4230
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
5850 3150 6750 3150 6750 3915
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
6750 3150 7650 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
7650 3150 7650 3960
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
7605 3150 10800 3150 10800 4770
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
9900 4770 9900 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
8955 6750 10800 6750 10800 5085
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
9900 5040 9900 6750
4 0 0 50 -1 0 12 0.0000 4 135 480 3825 3645 LED2\001
4 0 0 50 -1 0 12 0.0000 4 135 480 2925 3645 LED1\001
4 0 0 50 -1 0 12 0.0000 4 135 375 1305 3195 Pin1\001
4 0 0 50 -1 0 12 0.0000 4 135 375 1305 4095 Pin2\001
4 0 0 50 -1 0 12 0.0000 4 135 375 1305 4995 Pin3\001
4 0 0 50 -1 0 12 0.0000 4 135 480 2925 4545 LED3\001
4 0 0 50 -1 0 12 0.0000 4 135 480 3825 4545 LED4\001
4 0 0 50 -1 0 12 0.0000 4 135 585 6075 4140 LED10\001
4 0 0 50 -1 0 12 0.0000 4 135 480 5175 4140 LED9\001
4 0 0 50 -1 0 12 0.0000 4 135 375 1305 5895 Pin4\001
4 0 0 50 -1 0 12 0.0000 4 135 480 3825 5445 LED6\001
4 0 0 50 -1 0 12 0.0000 4 135 480 2925 5445 LED5\001
4 0 0 50 -1 0 12 0.0000 4 135 585 4725 5445 LED11\001
4 0 0 50 -1 0 12 0.0000 4 135 585 5625 5445 LED12\001
4 0 0 50 -1 0 12 0.0000 4 135 375 1305 6795 Pin5\001
4 0 0 50 -1 0 12 0.0000 4 135 480 2925 6345 LED7\001
4 0 0 50 -1 0 12 0.0000 4 135 480 3825 6345 LED8\001
4 0 0 50 -1 0 12 0.0000 4 135 585 6480 5940 LED13\001
4 0 0 50 -1 0 12 0.0000 4 135 585 7380 5940 LED14\001
4 0 0 50 -1 0 12 0.0000 4 135 585 8280 5940 LED17\001
4 0 0 50 -1 0 12 0.0000 4 135 585 9180 5940 LED18\001
4 0 0 50 -1 0 12 0.0000 4 135 585 6930 4140 LED15\001
4 0 0 50 -1 0 12 0.0000 4 135 585 7830 4140 LED16\001
4 0 0 50 -1 0 12 0.0000 4 135 585 10080 4995 LED19\001
4 0 0 50 -1 0 12 0.0000 4 135 585 10980 4995 LED20\001

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View File

@ -1,215 +0,0 @@
#FIG 3.2 Produced by xfig version 3.2.5b
Landscape
Center
Metric
A4
100.00
Single
-2
1200 2
6 3825 3105 4275 3195
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3920 3150 3825 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
4185 3150 4158 3110 4104 3190 4050 3110 3996 3190 3942 3110
3915 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4275 3150 4180 3150
-6
6 4410 3375 4635 3735
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
4500 3600 4545 3510 4455 3510 4500 3600
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4500 3600 4500 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4445 3600 4555 3600
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4635 3555 4590 3600
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
4635 3600 4635 3555 4590 3555
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
4635 3510 4635 3465 4590 3465
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4635 3465 4590 3510
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4500 3375 4500 3510
-6
6 3825 4005 4275 4095
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3920 4050 3825 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
4185 4050 4158 4010 4104 4090 4050 4010 3996 4090 3942 4010
3915 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4275 4050 4180 4050
-6
6 4455 3105 4545 3195
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 4500 3150 30 30 4500 3150 4500 3180
-6
6 4455 4005 4545 4095
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 4500 4050 30 30 4500 4050 4500 4080
-6
6 3825 4905 4275 4995
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3920 4950 3825 4950
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
4185 4950 4158 4910 4104 4990 4050 4910 3996 4990 3942 4910
3915 4950
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4275 4950 4180 4950
-6
6 4410 4275 4635 4635
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
4500 4500 4545 4410 4455 4410 4500 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4500 4500 4500 4635
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4445 4500 4555 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4635 4455 4590 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
4635 4500 4635 4455 4590 4455
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
4635 4410 4635 4365 4590 4365
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4635 4365 4590 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
4500 4275 4500 4410
-6
6 6210 3915 6435 4275
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6300 4140 6345 4050 6255 4050 6300 4140
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6300 4140 6300 4275
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6245 4140 6355 4140
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 4095 6390 4140
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6435 4140 6435 4095 6390 4095
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6435 4050 6435 4005 6390 4005
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 4005 6390 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6300 3915 6300 4050
-6
6 5310 3375 5535 3735
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
5400 3510 5445 3600 5355 3600 5400 3510
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5400 3510 5400 3375
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5345 3510 5455 3510
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5535 3555 5490 3510
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
5535 3510 5535 3555 5490 3555
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
5535 3600 5535 3645 5490 3645
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5535 3645 5490 3600
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5400 3735 5400 3600
-6
6 5310 4275 5535 4635
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
5400 4410 5445 4500 5355 4500 5400 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5400 4410 5400 4275
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5345 4410 5455 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5535 4455 5490 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
5535 4410 5535 4455 5490 4455
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
5535 4500 5535 4545 5490 4545
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5535 4545 5490 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5400 4635 5400 4500
-6
6 7110 3915 7335 4275
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
7200 4050 7245 4140 7155 4140 7200 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7200 4050 7200 3915
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7145 4050 7255 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7335 4095 7290 4050
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7335 4050 7335 4095 7290 4095
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7335 4140 7335 4185 7290 4185
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7335 4185 7290 4140
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7200 4275 7200 4140
-6
6 5355 3105 5445 3195
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 5400 3150 30 30 5400 3150 5400 3180
-6
6 6255 3105 6345 3195
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 6300 3150 30 30 6300 3150 6300 3180
-6
6 6255 4905 6345 4995
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 6300 4950 30 30 6300 4950 6300 4980
-6
6 5355 4905 5445 4995
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 5400 4950 30 30 5400 4950 5400 4980
-6
6 4455 4905 4545 4995
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 4500 4950 30 30 4500 4950 4500 4980
-6
6 5355 4005 5445 4095
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 5400 4050 30 30 5400 4050 5400 4080
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
4230 3150 5400 3150 5400 3420
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
4500 3420 4500 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
4275 4050 5400 4050 5400 3690
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
4500 3735 4500 4050
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
3870 3150 3600 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
3825 4050 3600 4050
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
3825 4950 3600 4950
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
4500 4050 4500 4320
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
4500 4590 4500 4950
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5400 4365 5400 4005
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
4275 4950 5400 4950 5400 4590
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
5400 3150 6300 3150 6300 3960
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6255 3150 7200 3150 7200 3960
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
5355 4950 6300 4950 6300 4230
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6300 4950 7200 4950 7200 4185
2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
1575 2475 3600 2475 3600 5625 1575 5625 1575 2475
4 0 0 50 -1 0 12 0.0000 4 135 480 5625 3645 LED2\001
4 0 0 50 -1 0 12 0.0000 4 135 480 4725 3645 LED1\001
4 0 0 50 -1 0 12 0.0000 4 135 480 4725 4545 LED3\001
4 0 0 50 -1 0 12 0.0000 4 135 480 5625 4545 LED4\001
4 0 0 50 -1 0 12 0.0000 4 135 480 7425 4140 LED6\001
4 0 0 50 -1 0 12 0.0000 4 135 480 6525 4140 LED5\001
4 0 0 50 -1 0 12 0.0000 4 135 450 3825 3915 120R\001
4 0 0 50 -1 0 12 0.0000 4 135 450 3825 4815 120R\001
4 0 0 50 -1 0 12 0.0000 4 135 450 3825 3015 120R\001
4 0 0 50 -1 0 12 0.0000 4 135 240 3240 3195 D9\001
4 0 0 50 -1 0 12 0.0000 4 135 345 3195 4095 D10\001
4 0 0 50 -1 0 12 0.0000 4 135 345 3195 4995 D11\001
4 0 0 50 -1 0 12 0.0000 4 135 345 2205 4185 Uno\001
4 0 0 50 -1 0 12 0.0000 4 135 675 2070 3915 Arduino\001
4 0 0 50 -1 0 12 0.0000 4 135 1605 4590 5355 6 x 3mm Red LED's\001

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

View File

@ -1,36 +0,0 @@
/* This example is placed into the public domain */
#include <Charlieplex.h>
byte pins[3] = {9, 10, 11};
Charlieplex charlie(pins, sizeof(pins));
int previous = 1;
int current = 0;
int step = 1;
unsigned long lastTime;
void setup() {
lastTime = millis();
charlie.setLed(current, true);
charlie.setPwmLed(previous, 64);
}
void loop() {
if ((millis() - lastTime) >= 100) {
charlie.setLed(previous, false);
charlie.setPwmLed(current, 64);
previous = current;
current += step;
if (current < 0) {
current = 1;
step = 1;
} else if (current >= charlie.count()) {
current = charlie.count() - 2;
step = -1;
}
charlie.setLed(current, true);
lastTime += 100;
}
charlie.loop();
}

View File

@ -1,238 +0,0 @@
#FIG 3.2 Produced by xfig version 3.2.5b
Landscape
Center
Metric
A4
100.00
Single
-2
1200 2
6 5175 1530 7200 2475
6 5535 1755 5985 1845
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5630 1800 5535 1800
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
5895 1800 5868 1760 5814 1840 5760 1760 5706 1840 5652 1760
5625 1800
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5985 1800 5890 1800
-6
6 6345 1665 6705 1890
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6570 1800 6480 1755 6480 1845 6570 1800
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 1800 6705 1800
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 1855 6570 1745
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6525 1665 6570 1710
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6570 1665 6525 1665 6525 1710
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6480 1665 6435 1665 6435 1710
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 1665 6480 1710
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6345 1800 6480 1800
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5535 1800 5175 1800
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5985 1800 6390 1800
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6660 1800 7200 1800 7200 2475
4 0 0 50 -1 0 12 0.0000 4 135 450 5535 1665 220R\001
-6
6 5175 2205 7200 3150
6 5535 2430 5985 2520
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5630 2475 5535 2475
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
5895 2475 5868 2435 5814 2515 5760 2435 5706 2515 5652 2435
5625 2475
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5985 2475 5890 2475
-6
6 6345 2340 6705 2565
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6570 2475 6480 2430 6480 2520 6570 2475
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 2475 6705 2475
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 2530 6570 2420
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6525 2340 6570 2385
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6570 2340 6525 2340 6525 2385
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6480 2340 6435 2340 6435 2385
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 2340 6480 2385
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6345 2475 6480 2475
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5535 2475 5175 2475
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5985 2475 6390 2475
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6660 2475 7200 2475 7200 3150
4 0 0 50 -1 0 12 0.0000 4 135 450 5535 2340 220R\001
-6
6 5175 2880 7200 3825
6 5535 3105 5985 3195
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5630 3150 5535 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
5895 3150 5868 3110 5814 3190 5760 3110 5706 3190 5652 3110
5625 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5985 3150 5890 3150
-6
6 6345 3015 6705 3240
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6570 3150 6480 3105 6480 3195 6570 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 3150 6705 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 3205 6570 3095
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6525 3015 6570 3060
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6570 3015 6525 3015 6525 3060
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6480 3015 6435 3015 6435 3060
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 3015 6480 3060
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6345 3150 6480 3150
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5535 3150 5175 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5985 3150 6390 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6660 3150 7200 3150 7200 3825
4 0 0 50 -1 0 12 0.0000 4 135 450 5535 3015 220R\001
-6
6 5175 3555 7200 4500
6 5535 3780 5985 3870
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5630 3825 5535 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
5895 3825 5868 3785 5814 3865 5760 3785 5706 3865 5652 3785
5625 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5985 3825 5890 3825
-6
6 6345 3690 6705 3915
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6570 3825 6480 3780 6480 3870 6570 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 3825 6705 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 3880 6570 3770
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6525 3690 6570 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6570 3690 6525 3690 6525 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6480 3690 6435 3690 6435 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 3690 6480 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6345 3825 6480 3825
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5535 3825 5175 3825
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5985 3825 6390 3825
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6660 3825 7200 3825 7200 4500
4 0 0 50 -1 0 12 0.0000 4 135 450 5535 3690 220R\001
-6
6 5175 4230 7200 5175
6 5535 4455 5985 4545
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5630 4500 5535 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
5895 4500 5868 4460 5814 4540 5760 4460 5706 4540 5652 4460
5625 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5985 4500 5890 4500
-6
6 6345 4365 6705 4590
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6570 4500 6480 4455 6480 4545 6570 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 4500 6705 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 4555 6570 4445
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6525 4365 6570 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6570 4365 6525 4365 6525 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6480 4365 6435 4365 6435 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 4365 6480 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6345 4500 6480 4500
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5535 4500 5175 4500
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5985 4500 6390 4500
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6660 4500 7200 4500 7200 5175
4 0 0 50 -1 0 12 0.0000 4 135 450 5535 4365 220R\001
-6
6 5175 4905 7200 5850
6 5535 5130 5985 5220
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5630 5175 5535 5175
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
5895 5175 5868 5135 5814 5215 5760 5135 5706 5215 5652 5135
5625 5175
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5985 5175 5890 5175
-6
6 6345 5040 6705 5265
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6570 5175 6480 5130 6480 5220 6570 5175
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 5175 6705 5175
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 5230 6570 5120
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6525 5040 6570 5085
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6570 5040 6525 5040 6525 5085
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6480 5040 6435 5040 6435 5085
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 5040 6480 5085
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6345 5175 6480 5175
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5535 5175 5175 5175
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5985 5175 6390 5175
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6660 5175 7200 5175 7200 5850
4 0 0 50 -1 0 12 0.0000 4 135 450 5535 5040 220R\001
-6
2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
2700 1350 5175 1350 5175 6300 2700 6300 2700 1350
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
7200 5850 5175 5850
4 0 0 50 -1 0 12 0.0000 4 135 630 4275 2565 DOUT5\001
4 0 0 50 -1 0 12 0.0000 4 135 1065 2880 3870 Arduino Uno\001
4 0 0 50 -1 0 12 0.0000 4 135 630 4275 1845 DOUT3\001
4 0 0 50 -1 0 12 0.0000 4 135 630 4275 3195 DOUT6\001
4 0 0 50 -1 0 12 0.0000 4 135 630 4275 3870 DOUT9\001
4 0 0 50 -1 0 12 0.0000 4 135 735 4275 4545 DOUT10\001
4 0 0 50 -1 0 12 0.0000 4 135 735 4275 5220 DOUT11\001
4 0 0 50 -1 0 12 0.0000 4 135 405 4500 5895 GND\001
4 0 0 50 -1 0 12 0.0000 4 135 1560 7470 3510 6 x 3mm RED LED\001

View File

@ -1,18 +0,0 @@
/*
Sketch that manipulates Arduino outputs to create the "Cylon Eyes" effect from
Battlestar Galactica. It uses the ChaseLEDs utility class.
This example is placed into the public domain.
*/
#include <ChaseLEDs.h>
byte pins[] = {3, 5, 6, 9, 10, 11, 10, 9, 6, 5};
ChaseLEDs cylonEyes(pins, sizeof(pins), 100);
void setup() {}
void loop() {
cylonEyes.loop();
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

View File

@ -1,32 +0,0 @@
/*
Sketch that manipulates Arduino outputs to create the "Cylon Eyes" effect from
Battlestar Galactica. It uses the ChaseLEDs utility class.
This example is placed into the public domain.
*/
#include <ChaseLEDs.h>
class CylonChase : public ChaseLEDs
{
public:
CylonChase(const byte *pins, int num, unsigned long advanceTime)
: ChaseLEDs(pins, num, advanceTime) {}
protected:
void advance(byte prevPin, byte nextPin) {
digitalWrite(previousPin(2), LOW);
digitalWrite(prevPin, HIGH);
digitalWrite(nextPin, HIGH);
}
};
byte pins[] = {3, 5, 6, 9, 10, 11, 10, 9, 6, 5};
CylonChase cylonEyes(pins, sizeof(pins), 100);
void setup() {}
void loop() {
cylonEyes.loop();
}

View File

@ -1,32 +0,0 @@
/*
Sketch that manipulates Arduino outputs to create the "Cylon Eyes" effect from
Battlestar Galactica. It uses the ChaseLEDs utility class.
This example is placed into the public domain.
*/
#include <ChaseLEDs.h>
class CylonChase : public ChaseLEDs
{
public:
CylonChase(const byte *pins, int num, unsigned long advanceTime)
: ChaseLEDs(pins, num, advanceTime) {}
protected:
void advance(byte prevPin, byte nextPin) {
digitalWrite(previousPin(2), LOW);
analogWrite(prevPin, 32);
digitalWrite(nextPin, HIGH);
}
};
byte pins[] = {3, 5, 6, 9, 10, 11, 10, 9, 6, 5};
CylonChase cylonEyes(pins, sizeof(pins), 100);
void setup() {}
void loop() {
cylonEyes.loop();
}

View File

@ -1,261 +0,0 @@
#FIG 3.2 Produced by xfig version 3.2.5b
Landscape
Center
Metric
A4
100.00
Single
-2
1200 2
6 5175 1530 7200 2475
6 5535 1755 5985 1845
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5630 1800 5535 1800
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
5895 1800 5868 1760 5814 1840 5760 1760 5706 1840 5652 1760
5625 1800
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5985 1800 5890 1800
-6
6 6345 1665 6705 1890
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6570 1800 6480 1755 6480 1845 6570 1800
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 1800 6705 1800
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 1855 6570 1745
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6525 1665 6570 1710
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6570 1665 6525 1665 6525 1710
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6480 1665 6435 1665 6435 1710
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 1665 6480 1710
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6345 1800 6480 1800
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5535 1800 5175 1800
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5985 1800 6390 1800
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6660 1800 7200 1800 7200 2475
4 0 0 50 -1 0 12 0.0000 4 135 450 5535 1665 220R\001
-6
6 5175 2205 7200 3150
6 5535 2430 5985 2520
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5630 2475 5535 2475
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
5895 2475 5868 2435 5814 2515 5760 2435 5706 2515 5652 2435
5625 2475
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5985 2475 5890 2475
-6
6 6345 2340 6705 2565
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6570 2475 6480 2430 6480 2520 6570 2475
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 2475 6705 2475
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 2530 6570 2420
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6525 2340 6570 2385
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6570 2340 6525 2340 6525 2385
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6480 2340 6435 2340 6435 2385
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 2340 6480 2385
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6345 2475 6480 2475
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5535 2475 5175 2475
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5985 2475 6390 2475
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6660 2475 7200 2475 7200 3150
4 0 0 50 -1 0 12 0.0000 4 135 450 5535 2340 220R\001
-6
6 5175 2880 7200 3825
6 5535 3105 5985 3195
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5630 3150 5535 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
5895 3150 5868 3110 5814 3190 5760 3110 5706 3190 5652 3110
5625 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5985 3150 5890 3150
-6
6 6345 3015 6705 3240
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6570 3150 6480 3105 6480 3195 6570 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 3150 6705 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 3205 6570 3095
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6525 3015 6570 3060
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6570 3015 6525 3015 6525 3060
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6480 3015 6435 3015 6435 3060
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 3015 6480 3060
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6345 3150 6480 3150
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5535 3150 5175 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5985 3150 6390 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6660 3150 7200 3150 7200 3825
4 0 0 50 -1 0 12 0.0000 4 135 450 5535 3015 220R\001
-6
6 5175 3555 7200 4500
6 5535 3780 5985 3870
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5630 3825 5535 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
5895 3825 5868 3785 5814 3865 5760 3785 5706 3865 5652 3785
5625 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5985 3825 5890 3825
-6
6 6345 3690 6705 3915
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6570 3825 6480 3780 6480 3870 6570 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 3825 6705 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 3880 6570 3770
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6525 3690 6570 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6570 3690 6525 3690 6525 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6480 3690 6435 3690 6435 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 3690 6480 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6345 3825 6480 3825
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5535 3825 5175 3825
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5985 3825 6390 3825
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6660 3825 7200 3825 7200 4500
4 0 0 50 -1 0 12 0.0000 4 135 450 5535 3690 220R\001
-6
6 5175 4230 7200 5175
6 5535 4455 5985 4545
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5630 4500 5535 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
5895 4500 5868 4460 5814 4540 5760 4460 5706 4540 5652 4460
5625 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5985 4500 5890 4500
-6
6 6345 4365 6705 4590
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6570 4500 6480 4455 6480 4545 6570 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 4500 6705 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 4555 6570 4445
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6525 4365 6570 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6570 4365 6525 4365 6525 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6480 4365 6435 4365 6435 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 4365 6480 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6345 4500 6480 4500
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5535 4500 5175 4500
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5985 4500 6390 4500
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6660 4500 7200 4500 7200 5175
4 0 0 50 -1 0 12 0.0000 4 135 450 5535 4365 220R\001
-6
6 5175 4905 7200 5850
6 5535 5130 5985 5220
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5630 5175 5535 5175
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
5895 5175 5868 5135 5814 5215 5760 5135 5706 5215 5652 5135
5625 5175
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5985 5175 5890 5175
-6
6 6345 5040 6705 5265
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6570 5175 6480 5130 6480 5220 6570 5175
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 5175 6705 5175
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 5230 6570 5120
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6525 5040 6570 5085
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6570 5040 6525 5040 6525 5085
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6480 5040 6435 5040 6435 5085
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 5040 6480 5085
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6345 5175 6480 5175
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5535 5175 5175 5175
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5985 5175 6390 5175
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6660 5175 7200 5175 7200 5850
4 0 0 50 -1 0 12 0.0000 4 135 450 5535 5040 220R\001
-6
6 1305 3375 1530 3825
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
1395 3600 1465 3565 1465 3635 1395 3600
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
1350 3730 1350 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
1350 3465 1390 3492 1310 3546 1390 3600 1310 3654 1390 3708
1350 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
1350 3375 1350 3470
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
1530 3600 1440 3600
-6
2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
2700 1350 5175 1350 5175 6300 2700 6300 2700 1350
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
7200 5850 5175 5850
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
1485 3600 2700 3600
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
1350 3375 1350 1800 2700 1800
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
1350 3780 1350 5850 2700 5850
4 0 0 50 -1 0 12 0.0000 4 135 630 4275 2565 DOUT5\001
4 0 0 50 -1 0 12 0.0000 4 135 630 4275 1845 DOUT3\001
4 0 0 50 -1 0 12 0.0000 4 135 630 4275 3195 DOUT6\001
4 0 0 50 -1 0 12 0.0000 4 135 630 4275 3870 DOUT9\001
4 0 0 50 -1 0 12 0.0000 4 135 735 4275 4545 DOUT10\001
4 0 0 50 -1 0 12 0.0000 4 135 735 4275 5220 DOUT11\001
4 0 0 50 -1 0 12 0.0000 4 135 405 4500 5895 GND\001
4 0 0 50 -1 0 12 0.0000 4 135 1560 7470 3510 6 x 3mm RED LED\001
4 0 0 50 -1 0 12 0.0000 4 135 1065 3285 2880 Arduino Uno\001
4 0 0 50 -1 0 12 0.0000 4 135 435 2835 3645 AIN0\001
4 0 0 50 -1 0 12 0.0000 4 135 240 2835 1845 5V\001
4 0 0 50 -1 0 12 0.0000 4 135 405 2790 5895 GND\001
4 0 0 50 -1 0 12 0.0000 4 135 345 810 3645 10K\001

View File

@ -1,238 +0,0 @@
#FIG 3.2 Produced by xfig version 3.2.5b
Landscape
Center
Metric
A4
100.00
Single
-2
1200 2
6 5175 1530 7200 2475
6 5535 1755 5985 1845
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5630 1800 5535 1800
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
5895 1800 5868 1760 5814 1840 5760 1760 5706 1840 5652 1760
5625 1800
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5985 1800 5890 1800
-6
6 6345 1665 6705 1890
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6570 1800 6480 1755 6480 1845 6570 1800
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 1800 6705 1800
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 1855 6570 1745
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6525 1665 6570 1710
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6570 1665 6525 1665 6525 1710
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6480 1665 6435 1665 6435 1710
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 1665 6480 1710
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6345 1800 6480 1800
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5535 1800 5175 1800
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5985 1800 6390 1800
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6660 1800 7200 1800 7200 2475
4 0 0 50 -1 0 12 0.0000 4 135 450 5535 1665 220R\001
-6
6 5175 2205 7200 3150
6 5535 2430 5985 2520
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5630 2475 5535 2475
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
5895 2475 5868 2435 5814 2515 5760 2435 5706 2515 5652 2435
5625 2475
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5985 2475 5890 2475
-6
6 6345 2340 6705 2565
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6570 2475 6480 2430 6480 2520 6570 2475
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 2475 6705 2475
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 2530 6570 2420
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6525 2340 6570 2385
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6570 2340 6525 2340 6525 2385
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6480 2340 6435 2340 6435 2385
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 2340 6480 2385
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6345 2475 6480 2475
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5535 2475 5175 2475
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5985 2475 6390 2475
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6660 2475 7200 2475 7200 3150
4 0 0 50 -1 0 12 0.0000 4 135 450 5535 2340 220R\001
-6
6 5175 2880 7200 3825
6 5535 3105 5985 3195
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5630 3150 5535 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
5895 3150 5868 3110 5814 3190 5760 3110 5706 3190 5652 3110
5625 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5985 3150 5890 3150
-6
6 6345 3015 6705 3240
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6570 3150 6480 3105 6480 3195 6570 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 3150 6705 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 3205 6570 3095
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6525 3015 6570 3060
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6570 3015 6525 3015 6525 3060
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6480 3015 6435 3015 6435 3060
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 3015 6480 3060
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6345 3150 6480 3150
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5535 3150 5175 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5985 3150 6390 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6660 3150 7200 3150 7200 3825
4 0 0 50 -1 0 12 0.0000 4 135 450 5535 3015 220R\001
-6
6 5175 3555 7200 4500
6 5535 3780 5985 3870
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5630 3825 5535 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
5895 3825 5868 3785 5814 3865 5760 3785 5706 3865 5652 3785
5625 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5985 3825 5890 3825
-6
6 6345 3690 6705 3915
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6570 3825 6480 3780 6480 3870 6570 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 3825 6705 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 3880 6570 3770
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6525 3690 6570 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6570 3690 6525 3690 6525 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6480 3690 6435 3690 6435 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 3690 6480 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6345 3825 6480 3825
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5535 3825 5175 3825
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5985 3825 6390 3825
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6660 3825 7200 3825 7200 4500
4 0 0 50 -1 0 12 0.0000 4 135 450 5535 3690 220R\001
-6
6 5175 4230 7200 5175
6 5535 4455 5985 4545
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5630 4500 5535 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
5895 4500 5868 4460 5814 4540 5760 4460 5706 4540 5652 4460
5625 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5985 4500 5890 4500
-6
6 6345 4365 6705 4590
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6570 4500 6480 4455 6480 4545 6570 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 4500 6705 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 4555 6570 4445
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6525 4365 6570 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6570 4365 6525 4365 6525 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6480 4365 6435 4365 6435 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 4365 6480 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6345 4500 6480 4500
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5535 4500 5175 4500
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5985 4500 6390 4500
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6660 4500 7200 4500 7200 5175
4 0 0 50 -1 0 12 0.0000 4 135 450 5535 4365 220R\001
-6
6 5175 4905 7200 5850
6 5535 5130 5985 5220
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5630 5175 5535 5175
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
5895 5175 5868 5135 5814 5215 5760 5135 5706 5215 5652 5135
5625 5175
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5985 5175 5890 5175
-6
6 6345 5040 6705 5265
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
6570 5175 6480 5130 6480 5220 6570 5175
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 5175 6705 5175
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6570 5230 6570 5120
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6525 5040 6570 5085
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6570 5040 6525 5040 6525 5085
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
6480 5040 6435 5040 6435 5085
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6435 5040 6480 5085
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6345 5175 6480 5175
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5535 5175 5175 5175
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5985 5175 6390 5175
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
6660 5175 7200 5175 7200 5850
4 0 0 50 -1 0 12 0.0000 4 135 450 5535 5040 220R\001
-6
2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
2700 1350 5175 1350 5175 6300 2700 6300 2700 1350
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
7200 5850 5175 5850
4 0 0 50 -1 0 12 0.0000 4 135 630 4275 2565 DOUT5\001
4 0 0 50 -1 0 12 0.0000 4 135 1065 2880 3870 Arduino Uno\001
4 0 0 50 -1 0 12 0.0000 4 135 630 4275 1845 DOUT3\001
4 0 0 50 -1 0 12 0.0000 4 135 630 4275 3195 DOUT6\001
4 0 0 50 -1 0 12 0.0000 4 135 630 4275 3870 DOUT9\001
4 0 0 50 -1 0 12 0.0000 4 135 735 4275 4545 DOUT10\001
4 0 0 50 -1 0 12 0.0000 4 135 735 4275 5220 DOUT11\001
4 0 0 50 -1 0 12 0.0000 4 135 405 4500 5895 GND\001
4 0 0 50 -1 0 12 0.0000 4 135 1560 7470 3510 6 x 3mm RED LED\001

View File

@ -1,33 +0,0 @@
/*
Sketch that manipulates Arduino outputs to create the "Cylon Eyes" effect from
Battlestar Galactica. It uses the ChaseLEDs utility class.
This example is placed into the public domain.
*/
#include <ChaseLEDs.h>
class CylonChase : public ChaseLEDs
{
public:
CylonChase(const byte *pins, int num, unsigned long advanceTime)
: ChaseLEDs(pins, num, advanceTime) {}
protected:
void advance(byte prevPin, byte nextPin) {
digitalWrite(previousPin(2), LOW);
analogWrite(prevPin, 32);
digitalWrite(nextPin, HIGH);
setAdvanceTime(map(analogRead(A0), 0, 1023, 25, 250));
}
};
byte pins[] = {3, 5, 6, 9, 10, 11, 10, 9, 6, 5};
CylonChase cylonEyes(pins, sizeof(pins), 100);
void setup() {}
void loop() {
cylonEyes.loop();
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

View File

@ -1,338 +0,0 @@
#FIG 3.2 Produced by xfig version 3.2.5b
Landscape
Center
Metric
A4
100.00
Single
-2
1200 2
6 6075 1530 8100 2475
6 6435 1755 6885 1845
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6530 1800 6435 1800
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
6795 1800 6768 1760 6714 1840 6660 1760 6606 1840 6552 1760
6525 1800
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6885 1800 6790 1800
-6
6 7245 1665 7605 1890
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
7470 1800 7380 1755 7380 1845 7470 1800
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7470 1800 7605 1800
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7470 1855 7470 1745
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7425 1665 7470 1710
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7470 1665 7425 1665 7425 1710
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7380 1665 7335 1665 7335 1710
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7335 1665 7380 1710
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7245 1800 7380 1800
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
6435 1800 6075 1800
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
6885 1800 7290 1800
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
7560 1800 8100 1800 8100 2475
4 0 0 50 -1 0 12 0.0000 4 135 450 6435 1665 220R\001
-6
6 6075 2205 8100 3150
6 6435 2430 6885 2520
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6530 2475 6435 2475
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
6795 2475 6768 2435 6714 2515 6660 2435 6606 2515 6552 2435
6525 2475
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6885 2475 6790 2475
-6
6 7245 2340 7605 2565
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
7470 2475 7380 2430 7380 2520 7470 2475
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7470 2475 7605 2475
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7470 2530 7470 2420
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7425 2340 7470 2385
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7470 2340 7425 2340 7425 2385
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7380 2340 7335 2340 7335 2385
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7335 2340 7380 2385
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7245 2475 7380 2475
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
6435 2475 6075 2475
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
6885 2475 7290 2475
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
7560 2475 8100 2475 8100 3150
4 0 0 50 -1 0 12 0.0000 4 135 450 6435 2340 220R\001
-6
6 6075 2880 8100 3825
6 6435 3105 6885 3195
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6530 3150 6435 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
6795 3150 6768 3110 6714 3190 6660 3110 6606 3190 6552 3110
6525 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6885 3150 6790 3150
-6
6 7245 3015 7605 3240
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
7470 3150 7380 3105 7380 3195 7470 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7470 3150 7605 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7470 3205 7470 3095
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7425 3015 7470 3060
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7470 3015 7425 3015 7425 3060
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7380 3015 7335 3015 7335 3060
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7335 3015 7380 3060
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7245 3150 7380 3150
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
6435 3150 6075 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
6885 3150 7290 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
7560 3150 8100 3150 8100 3825
4 0 0 50 -1 0 12 0.0000 4 135 450 6435 3015 220R\001
-6
6 6075 3555 8100 4500
6 6435 3780 6885 3870
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6530 3825 6435 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
6795 3825 6768 3785 6714 3865 6660 3785 6606 3865 6552 3785
6525 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6885 3825 6790 3825
-6
6 7245 3690 7605 3915
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
7470 3825 7380 3780 7380 3870 7470 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7470 3825 7605 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7470 3880 7470 3770
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7425 3690 7470 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7470 3690 7425 3690 7425 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7380 3690 7335 3690 7335 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7335 3690 7380 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7245 3825 7380 3825
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
6435 3825 6075 3825
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
6885 3825 7290 3825
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
7560 3825 8100 3825 8100 4500
4 0 0 50 -1 0 12 0.0000 4 135 450 6435 3690 220R\001
-6
6 6075 4230 8100 5175
6 6435 4455 6885 4545
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6530 4500 6435 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
6795 4500 6768 4460 6714 4540 6660 4460 6606 4540 6552 4460
6525 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6885 4500 6790 4500
-6
6 7245 4365 7605 4590
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
7470 4500 7380 4455 7380 4545 7470 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7470 4500 7605 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7470 4555 7470 4445
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7425 4365 7470 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7470 4365 7425 4365 7425 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7380 4365 7335 4365 7335 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7335 4365 7380 4410
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7245 4500 7380 4500
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
6435 4500 6075 4500
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
6885 4500 7290 4500
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
7560 4500 8100 4500 8100 5175
4 0 0 50 -1 0 12 0.0000 4 135 450 6435 4365 220R\001
-6
6 6075 4905 8100 5850
6 6435 5130 6885 5220
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6530 5175 6435 5175
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
6795 5175 6768 5135 6714 5215 6660 5135 6606 5215 6552 5135
6525 5175
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
6885 5175 6790 5175
-6
6 7245 5040 7605 5265
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
7470 5175 7380 5130 7380 5220 7470 5175
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7470 5175 7605 5175
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7470 5230 7470 5120
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7425 5040 7470 5085
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7470 5040 7425 5040 7425 5085
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
7380 5040 7335 5040 7335 5085
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7335 5040 7380 5085
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
7245 5175 7380 5175
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
6435 5175 6075 5175
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
6885 5175 7290 5175
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
7560 5175 8100 5175 8100 5850
4 0 0 50 -1 0 12 0.0000 4 135 450 6435 5040 220R\001
-6
6 1530 2700 1755 3150
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
1620 2925 1690 2890 1690 2960 1620 2925
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
1575 3055 1575 3150
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
1575 2790 1615 2817 1535 2871 1615 2925 1535 2979 1615 3033
1575 3060
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
1575 2700 1575 2795
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
1755 2925 1665 2925
-6
6 1575 3465 3600 3915
6 2565 3780 3015 3870
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2660 3825 2565 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
2925 3825 2898 3785 2844 3865 2790 3785 2736 3865 2682 3785
2655 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3015 3825 2920 3825
-6
6 1890 3690 2250 3915
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
2025 3825 2115 3780 2115 3870 2025 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2025 3825 1890 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2025 3880 2025 3770
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2070 3690 2025 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
2025 3690 2070 3690 2070 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
2115 3690 2160 3690 2160 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2160 3690 2115 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2250 3825 2115 3825
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
2970 3825 3600 3825
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
2160 3825 2610 3825
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
1935 3825 1575 3825
4 0 0 50 -1 0 12 0.0000 4 135 450 2610 3600 220R\001
4 0 0 50 -1 0 12 0.0000 4 135 390 1935 3600 RED\001
-6
6 2565 4680 3015 4770
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2660 4725 2565 4725
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
2925 4725 2898 4685 2844 4765 2790 4685 2736 4765 2682 4685
2655 4725
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3015 4725 2920 4725
-6
6 1890 4590 2250 4815
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
2025 4725 2115 4680 2115 4770 2025 4725
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2025 4725 1890 4725
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2025 4780 2025 4670
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2070 4590 2025 4635
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
2025 4590 2070 4590 2070 4635
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
2115 4590 2160 4590 2160 4635
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2160 4590 2115 4635
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
2250 4725 2115 4725
-6
2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
3600 1350 6075 1350 6075 6300 3600 6300 3600 1350
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
8100 5850 6075 5850
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
1575 2700 1575 1800 3600 1800
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
1575 3150 1575 5850 3600 5850
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
1755 2925 3600 2925
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
2970 4725 3600 4725
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
2160 4725 2610 4725
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
1935 4725 1575 4725
4 0 0 50 -1 0 12 0.0000 4 135 630 5175 2565 DOUT5\001
4 0 0 50 -1 0 12 0.0000 4 135 630 5175 1845 DOUT3\001
4 0 0 50 -1 0 12 0.0000 4 135 630 5175 3195 DOUT6\001
4 0 0 50 -1 0 12 0.0000 4 135 630 5175 3870 DOUT9\001
4 0 0 50 -1 0 12 0.0000 4 135 735 5175 4545 DOUT10\001
4 0 0 50 -1 0 12 0.0000 4 135 735 5175 5220 DOUT11\001
4 0 0 50 -1 0 12 0.0000 4 135 405 5400 5895 GND\001
4 0 0 50 -1 0 12 0.0000 4 135 240 3735 1845 5V\001
4 0 0 50 -1 0 12 0.0000 4 135 405 3690 5895 GND\001
4 0 0 50 -1 0 12 0.0000 4 135 1065 4230 1215 Arduino Uno\001
4 0 0 50 -1 0 12 0.0000 4 135 435 3735 3015 AIN0\001
4 0 0 50 -1 0 12 0.0000 4 135 345 1080 3015 10K\001
4 0 0 50 -1 0 12 0.0000 4 135 450 2610 4500 100R\001
4 0 0 50 -1 0 12 0.0000 4 135 615 1800 4500 WHITE\001
4 0 0 50 -1 0 12 0.0000 4 135 630 3690 4770 AOUT3\001
4 0 0 50 -1 0 12 0.0000 4 135 630 3690 3870 AOUT2\001
4 0 0 50 -1 0 12 0.0000 4 135 1110 8370 3510 6 x RED LED\001
4 0 0 50 -1 0 12 0.0000 4 135 690 8505 4050 Nacelles\001
4 0 0 50 -1 0 12 0.0000 4 180 915 495 3870 Navigation\001
4 0 0 50 -1 0 12 0.0000 4 135 525 675 4770 Strobe\001

View File

@ -1,59 +0,0 @@
/*
Sketch that manipulates Arduino outputs to create Star Trek Enterprise style
running lights and LED chasers.
This example is placed into the public domain.
*/
#include <BlinkLED.h>
#include <ChaseLEDs.h>
#define NACELLE_RATE A0 // Analog input for reading the nacelle chase rate
#define NAV_LIGHTS A2 // Output pin for controlling the navigation lights
#define STROBE_LIGHT A3 // Output pin for controlling the strobe
// Configurable parameters.
#define NAV_LIGHTS_ON 1000 // Time the navigation lights are on (milliseconds)
#define NAV_LIGHTS_OFF 1000 // Time the navigation lights are off (milliseconds)
#define STROBE_LIGHT_ON 70 // Time the strobe light is on (milliseconds)
#define STROBE_LIGHT_OFF 830 // Time the strobe light is off (milliseconds)
#define NACELLE_CHASE_LEN 6 // Length of nacelle chase, 1..6
#define NACELLE_MIN_PERIOD 25 // Minimum time to advance the nacelle chase (milliseconds)
#define NACELLE_MAX_PERIOD 250 // Maximum time to advance the nacelle chase (milliseconds)
#define NACELLE_DIM_VALUE 32 // Value for dimming previous LED in chase, 0..255
// Output pins to use for the nacelle chase
byte nacelleChasePins[6] = {3, 5, 6, 9, 10, 11};
class NacelleChaseLEDs : public ChaseLEDs
{
public:
NacelleChaseLEDs(const byte *pins, int num)
: ChaseLEDs(pins, num, 0) {}
protected:
void advance(byte prevPin, byte nextPin) {
digitalWrite(previousPin(2), LOW);
analogWrite(prevPin, NACELLE_DIM_VALUE);
digitalWrite(nextPin, HIGH);
setAdvanceTime(map(analogRead(NACELLE_RATE), 0, 1023, NACELLE_MIN_PERIOD, NACELLE_MAX_PERIOD));
}
};
NacelleChaseLEDs nacelleChase(nacelleChasePins, NACELLE_CHASE_LEN);
BlinkLED navLights(NAV_LIGHTS, NAV_LIGHTS_ON, NAV_LIGHTS_OFF);
BlinkLED strobeLight(STROBE_LIGHT, STROBE_LIGHT_ON, STROBE_LIGHT_OFF);
void setup() {
// Turn off the status LED on the Arduino board (we don't need it).
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
}
void loop() {
navLights.loop();
strobeLight.loop();
nacelleChase.loop();
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1019 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 474 KiB

View File

@ -1,292 +0,0 @@
#FIG 3.2 Produced by xfig version 3.2.5b
Landscape
Center
Metric
A4
100.00
Single
-2
1200 2
6 10260 2025 10485 2385
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
10350 2250 10395 2160 10305 2160 10350 2250
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10350 2250 10350 2385
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10295 2250 10405 2250
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10485 2205 10440 2250
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
10485 2250 10485 2205 10440 2205
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
10485 2160 10485 2115 10440 2115
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10485 2115 10440 2160
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10350 2025 10350 2160
-6
6 10260 3600 10485 3960
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
10350 3825 10395 3735 10305 3735 10350 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10350 3825 10350 3960
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10295 3825 10405 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10485 3780 10440 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
10485 3825 10485 3780 10440 3780
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
10485 3735 10485 3690 10440 3690
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10485 3690 10440 3735
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10350 3600 10350 3735
-6
6 9585 2475 9810 2835
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
9675 2700 9720 2610 9630 2610 9675 2700
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9675 2700 9675 2835
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9620 2700 9730 2700
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9810 2655 9765 2700
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
9810 2700 9810 2655 9765 2655
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
9810 2610 9810 2565 9765 2565
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9810 2565 9765 2610
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9675 2475 9675 2610
-6
6 10935 2475 11160 2835
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
11025 2700 11070 2610 10980 2610 11025 2700
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
11025 2700 11025 2835
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10970 2700 11080 2700
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
11160 2655 11115 2700
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
11160 2700 11160 2655 11115 2655
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
11160 2610 11160 2565 11115 2565
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
11160 2565 11115 2610
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
11025 2475 11025 2610
-6
6 10935 3150 11160 3510
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
11025 3375 11070 3285 10980 3285 11025 3375
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
11025 3375 11025 3510
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10970 3375 11080 3375
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
11160 3330 11115 3375
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
11160 3375 11160 3330 11115 3330
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
11160 3285 11160 3240 11115 3240
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
11160 3240 11115 3285
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
11025 3150 11025 3285
-6
6 9585 3150 9810 3510
2 1 0 1 0 -1 0 0 20 0.000 0 0 -1 0 0 4
9675 3375 9720 3285 9630 3285 9675 3375
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9675 3375 9675 3510
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9620 3375 9730 3375
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9810 3330 9765 3375
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
9810 3375 9810 3330 9765 3330
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3
9810 3285 9810 3240 9765 3240
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9810 3240 9765 3285
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9675 3150 9675 3285
-6
6 10305 3915 10395 4365
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10350 4270 10350 4365
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
10350 4005 10310 4032 10390 4086 10310 4140 10390 4194 10310 4248
10350 4275
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10350 3915 10350 4010
-6
6 9630 3915 9720 4365
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9675 4270 9675 4365
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
9675 4005 9635 4032 9715 4086 9635 4140 9715 4194 9635 4248
9675 4275
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9675 3915 9675 4010
-6
6 10980 3915 11070 4365
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
11025 4270 11025 4365
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
11025 4005 10985 4032 11065 4086 10985 4140 11065 4194 10985 4248
11025 4275
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
11025 3915 11025 4010
-6
6 9450 4365 9675 4635
2 3 0 1 0 -1 0 0 20 0.000 0 0 0 0 0 4
9627 4584 9597 4519 9562 4554 9627 4584
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9540 4500 9675 4635
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9540 4500 9675 4365
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9540 4410 9540 4590
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9540 4500 9450 4500
-6
6 10305 1710 10620 2025
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 1 0 2
1 1 1.00 45.00 90.00
10350 2025 10350 1710
4 0 0 0 0 16 6 0.0000 4 75 225 10395 1845 VCC\001
-6
6 9585 4635 9765 4905
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9660 4905 9690 4905
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9625 4860 9725 4860
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9585 4815 9765 4815
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9675 4635 9675 4815
-6
6 10125 5175 10350 5445
2 3 0 1 0 -1 0 0 20 0.000 0 0 0 0 0 4
10302 5394 10272 5329 10237 5364 10302 5394
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10215 5310 10350 5445
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10215 5310 10350 5175
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10215 5220 10215 5400
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10215 5310 10125 5310
-6
6 10260 5445 10440 5715
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10335 5715 10365 5715
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10300 5670 10400 5670
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10260 5625 10440 5625
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10350 5445 10350 5625
-6
6 8550 5265 9000 5355
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
8645 5310 8550 5310
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
8910 5310 8883 5270 8829 5350 8775 5270 8721 5350 8667 5270
8640 5310
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9000 5310 8905 5310
-6
6 8550 4455 9000 4545
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
8645 4500 8550 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
8910 4500 8883 4460 8829 4540 8775 4460 8721 4540 8667 4460
8640 4500
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9000 4500 8905 4500
-6
6 10800 5985 11025 6255
2 3 0 1 0 -1 0 0 20 0.000 0 0 0 0 0 4
10977 6204 10947 6139 10912 6174 10977 6204
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10890 6120 11025 6255
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10890 6120 11025 5985
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10890 6030 10890 6210
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10890 6120 10800 6120
-6
6 8550 6075 9000 6165
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
8645 6120 8550 6120
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7
8910 6120 8883 6080 8829 6160 8775 6080 8721 6160 8667 6080
8640 6120
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
9000 6120 8905 6120
-6
6 10935 6255 11115 6525
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
11010 6525 11040 6525
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10975 6480 11075 6480
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
10935 6435 11115 6435
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
11025 6255 11025 6435
-6
1 4 1 1 0 7 50 -1 -1 4.000 1 0.0000 10350 2970 945 945 9405 2970 11295 2970
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
10350 2340 10350 3690
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
9675 2835 10215 2835 10215 3150 10260 3150 10305 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
10395 3150 11025 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
11025 2835 10665 2835 10665 3105
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
10665 3195 10665 3375 10395 3375
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4
10305 3375 9990 3375 9990 3150 9675 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
9675 3915 9675 3465
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
11025 3465 11025 3960
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
10350 4365 10350 5220
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
11025 4320 11025 5985
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4
9675 2520 9675 2025 11025 2025 11025 2565
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
9495 4500 8955 4500
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
10125 5310 9000 5310
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
8550 4500 7875 4500
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
8550 5310 7875 5310
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
10845 6120 8955 6120 9000 6120
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
8595 6120 7875 6120
4 0 0 50 -1 0 12 0.0000 4 135 345 8595 4365 10K\001
4 0 0 50 -1 0 12 0.0000 4 135 345 8595 5130 10K\001
4 0 0 50 -1 0 12 0.0000 4 135 345 8595 5940 10K\001
4 0 0 50 -1 0 12 0.0000 4 135 630 7110 4590 DOUT3\001
4 0 0 50 -1 0 12 0.0000 4 135 630 7110 5355 DOUT5\001
4 0 0 50 -1 0 12 0.0000 4 135 630 7110 6165 DOUT6\001
4 0 0 50 -1 0 12 0.0000 4 135 135 9810 4230 R\001
4 0 0 50 -1 0 12 0.0000 4 135 135 10485 4230 R\001
4 0 0 50 -1 0 12 0.0000 4 135 135 11160 4230 R\001
4 0 0 50 -1 0 12 0.0000 4 135 2190 6930 3510 R = 120 ohms for Vcc = 5V\001
4 0 0 50 -1 0 12 0.0000 4 135 2220 6930 3780 R = 1K ohms for Vcc = 12V\001
4 0 0 50 -1 0 12 0.0000 4 135 585 9720 4590 BC548\001
4 0 0 50 -1 0 12 0.0000 4 135 585 10395 5400 BC548\001
4 0 0 50 -1 0 12 0.0000 4 135 585 11070 6210 BC548\001

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View File

@ -1,62 +0,0 @@
/*
Sketch that manipulates Arduino outputs to create Star Trek Enterprise style
running lights and LED chasers.
This example is placed into the public domain.
*/
#include <BlinkLED.h>
#include <ChaseLEDs.h>
#define NACELLE_RATE A0 // Analog input for reading the nacelle chase rate
#define NAV_LIGHTS A2 // Output pin for controlling the navigation lights
#define STROBE_LIGHT A3 // Output pin for controlling the strobe
// Configurable parameters.
#define NAV_LIGHTS_ON 1000 // Time the navigation lights are on (milliseconds)
#define NAV_LIGHTS_OFF 1000 // Time the navigation lights are off (milliseconds)
#define STROBE_LIGHT_ON 70 // Time the strobe light is on (milliseconds)
#define STROBE_LIGHT_OFF 830 // Time the strobe light is off (milliseconds)
#define NACELLE_CHASE_LEN 6 // Length of nacelle chase, 1..6
#define NACELLE_MIN_PERIOD 25 // Minimum time to advance the nacelle chase (milliseconds)
#define NACELLE_MAX_PERIOD 250 // Maximum time to advance the nacelle chase (milliseconds)
#define NACELLE_DIM_VALUE 32 // Value for dimming previous LED in chase, 0..255
// Output pins to use for the nacelle chase
byte nacelleChasePins[6] = {3, 5, 6, 9, 10, 11};
class NacelleChaseLEDs : public ChaseLEDs
{
public:
NacelleChaseLEDs(const byte *pins, int num)
: ChaseLEDs(pins, num, 0) {}
protected:
void advance(byte prevPin, byte nextPin) {
digitalWrite(previousPin(5), LOW);
analogWrite(previousPin(4), NACELLE_DIM_VALUE);
digitalWrite(previousPin(3), HIGH);
digitalWrite(previousPin(2), LOW);
analogWrite(prevPin, NACELLE_DIM_VALUE);
digitalWrite(nextPin, HIGH);
setAdvanceTime(map(analogRead(NACELLE_RATE), 0, 1023, NACELLE_MIN_PERIOD, NACELLE_MAX_PERIOD));
}
};
NacelleChaseLEDs nacelleChase(nacelleChasePins, NACELLE_CHASE_LEN);
BlinkLED navLights(NAV_LIGHTS, NAV_LIGHTS_ON, NAV_LIGHTS_OFF);
BlinkLED strobeLight(STROBE_LIGHT, STROBE_LIGHT_ON, STROBE_LIGHT_OFF);
void setup() {
// Turn off the status LED on the Arduino board (we don't need it).
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
}
void loop() {
navLights.loop();
strobeLight.loop();
nacelleChase.loop();
}

View File

@ -1,27 +0,0 @@
BlinkLED KEYWORD1
Charlieplex KEYWORD1
ChaseLEDs KEYWORD1
onTime KEYWORD2
offTime KEYWORD2
setBlinkRate KEYWORD2
state KEYWORD2
setState KEYWORD2
pause KEYWORD2
resume KEYWORD2
isPaused KEYWORD2
advanceTime KEYWORD2
setAdvanceTime KEYWORD2
previousPin KEYWORD2
count KEYWORD2
led KEYWORD2
setLed KEYWORD2
pwmLed KEYWORD2
setPwmLed KEYWORD2
holdTime KEYWORD2
setHoldTime KEYWORD2
refresh KEYWORD2

View File

@ -1,966 +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.
*/
#include "Bitmap.h"
#include <WString.h>
#include <string.h>
#include <stdlib.h>
/**
* \class Bitmap Bitmap.h <Bitmap.h>
* \brief Represents a monochrome bitmap within main memory.
*
* Bitmaps are a rectangular arrangement of width() x height() pixels,
* with each pixel set to either \ref Black or \ref White. The co-ordinate
* system has origin (0, 0) at the top-left of the bitmap.
*
* Functions within this class can be used to draw various shapes into
* the bitmap's data() buffer; e.g. drawLine(), drawRect(), drawBitmap(),
* drawText(), clear(), fill(), etc.
*
* \sa DMD
*/
/**
* \typedef Bitmap::Color
* \brief Type that represents the color of a pixel in a bitmap.
*
* \sa Black, White
*/
/**
* \typedef Bitmap::ProgMem
* \brief Type that represents a bitmap within program memory.
*/
/**
* \typedef Bitmap::Font
* \brief Type that represents a font within program memory.
*/
/**
* \var Bitmap::Black
* \brief Color value corresponding to "black".
*/
/**
* \var Bitmap::White
* \brief Color value corresponding to "white". If the bitmap is
* displayed on a LED array, then it may have a different physical color.
*
* Note: while the value of this constant is 1, the bitmap itself stores
* white pixels as 0 and black as 1 because the DMD display uses 1 to
* indicate a pixel being off.
*/
/**
* \var Bitmap::NoFill
* \brief Special color value that is used with drawRect() and drawCircle()
* to indicate that the interior of the shape should not be filled.
* For all other uses, \ref NoFill is equivalent to \ref White.
*/
/**
* \brief Constructs a new in-memory bitmap that is \a width x \a height
* pixels in size.
*
* \sa width(), height(), isValid()
*/
Bitmap::Bitmap(int width, int height)
: _width(width)
, _height(height)
, _stride((width + 7) / 8)
, fb(0)
, _font(0)
, _textColor(White)
{
// Allocate memory for the framebuffer and clear it (1 = pixel off).
unsigned int size = _stride * _height;
fb = (uint8_t *)malloc(size);
if (fb)
memset(fb, 0xFF, size);
}
/**
* \brief Destroys this bitmap.
*/
Bitmap::~Bitmap()
{
if (fb)
free(fb);
}
/**
* \fn bool Bitmap::isValid() const
* \brief Returns true if the memory for this bitmap is valid; false otherwise.
*
* This function can be called just after the constructor to determine if
* the memory for the bitmap was allocated successfully.
*/
/**
* \fn int Bitmap::width() const
* \brief Returns the width of the bitmap in pixels.
*
* \sa height(), stride(), bitsPerPixel()
*/
/**
* \fn int Bitmap::height() const
* \brief Returns the height of the bitmap in pixels.
*
* \sa width(), bitsPerPixel()
*/
/**
* \fn int Bitmap::stride() const
* \brief Returns the number of bytes in each line of the bitmap's data() buffer.
*
* \sa width(), bitsPerPixel(), data()
*/
/**
* \fn int Bitmap::bitsPerPixel() const
* \brief Returns the number of bits per pixel for the bitmap; always 1.
*
* \sa width(), height()
*/
/**
* \fn uint8_t *Bitmap::data()
* \brief Returns a pointer to the start of the bitmap's data buffer.
*
* The data is organized as height() lines of stride() bytes, laid out
* horizontally across the extent of width() pixels. The most significant
* bit in each byte has the lowest x value.
*
* Note: bits within the data are 1 for \ref Black and 0 for \ref White,
* which is the reverse of the constant values. This differs from pixel()
* which returns the correct constant.
*
* \sa pixel(), stride()
*/
/**
* \fn const uint8_t *Bitmap::data() const
* \brief Returns a constant pointer to the start of the bitmap's data buffer.
* \overload
*/
/**
* \brief Clears the entire bitmap to the specified \a color.
*
* \sa fill()
*/
void Bitmap::clear(Color color)
{
unsigned int size = _stride * _height;
if (color == Black)
memset(fb, 0xFF, size);
else
memset(fb, 0x00, size);
}
/**
* \brief Returns the color of the pixel at (\a x, \a y); either \ref Black
* or \ref White.
*
* Returns \a Black if \a x or \a y is out of range.
*
* \sa setPixel(), data()
*/
Bitmap::Color Bitmap::pixel(int x, int y) const
{
if (((unsigned int)x) >= ((unsigned int)_width) ||
((unsigned int)y) >= ((unsigned int)_height))
return Black;
uint8_t *ptr = fb + y * _stride + (x >> 3);
if (*ptr & ((uint8_t)0x80) >> (x & 0x07))
return Black;
else
return White;
}
/**
* \brief Sets the pixel at (\a x, \a y) to \a color.
*
* \sa pixel()
*/
void Bitmap::setPixel(int x, int y, Color color)
{
if (((unsigned int)x) >= ((unsigned int)_width) ||
((unsigned int)y) >= ((unsigned int)_height))
return; // Pixel is off-screen.
uint8_t *ptr = fb + y * _stride + (x >> 3);
if (color)
*ptr &= ~(((uint8_t)0x80) >> (x & 0x07));
else
*ptr |= (((uint8_t)0x80) >> (x & 0x07));
}
/**
* \brief Draws a line from (\a x1, \a y1) to (\a x2, \a y2) in \a color.
*
* \sa drawRect(), drawCircle()
*/
void Bitmap::drawLine(int x1, int y1, int x2, int y2, Color color)
{
// Midpoint line scan-conversion algorithm from "Computer Graphics:
// Principles and Practice", Second Edition, Foley, van Dam, et al.
int dx = x2 - x1;
int dy = y2 - y1;
int xstep, ystep;
int d, incrE, incrNE;
if (dx < 0) {
xstep = -1;
dx = -dx;
} else {
xstep = 1;
}
if (dy < 0) {
ystep = -1;
dy = -dy;
} else {
ystep = 1;
}
if (dx >= dy) {
d = 2 * dy - dx;
incrE = 2 * dy;
incrNE = 2 * (dy - dx);
setPixel(x1, y1, color);
while (x1 != x2) {
if (d <= 0) {
d += incrE;
} else {
d += incrNE;
y1 += ystep;
}
x1 += xstep;
setPixel(x1, y1, color);
}
} else {
d = 2 * dx - dy;
incrE = 2 * dx;
incrNE = 2 * (dx - dy);
setPixel(x1, y1, color);
while (y1 != y2) {
if (d <= 0) {
d += incrE;
} else {
d += incrNE;
x1 += xstep;
}
y1 += ystep;
setPixel(x1, y1, color);
}
}
}
/**
* \brief Draws a rectangle from (\a x1, \a y1) to (\a x2, \a y2), with the
* outline in \a borderColor and the interior filled with \a fillColor.
*
* If \a fillColor is \ref NoFill, then the interior is not filled.
*
* \sa drawFilledRect(), drawLine(), drawCircle(), fill()
*/
void Bitmap::drawRect(int x1, int y1, int x2, int y2, Color borderColor, Color fillColor)
{
int temp;
if (x1 > x2) {
temp = x1;
x1 = x2;
x2 = temp;
}
if (y1 > y2) {
temp = y1;
y1 = y2;
y2 = temp;
}
if (fillColor == borderColor) {
fill(x1, y1, x2 - x1 + 1, y2 - y1 + 1, fillColor);
} else {
drawLine(x1, y1, x2, y1, borderColor);
if (y1 < y2)
drawLine(x2, y1 + 1, x2, y2, borderColor);
if (x1 < x2)
drawLine(x2 - 1, y2, x1, y2, borderColor);
if (y1 < (y2 - 1))
drawLine(x1, y2 - 1, x1, y1 + 1, borderColor);
if (fillColor != NoFill)
fill(x1 + 1, y1 + 1, x2 - x1 - 1, y2 - y1 - 1, fillColor);
}
}
/**
* \fn void Bitmap::drawFilledRect(int x1, int y1, int x2, int y2, Color color)
* \brief Draws a filled rectangle from (\a x1, \a y1) to (\a x2, \a y2)
* in \a color.
*
* This is a convenience function that is equivalent to
* drawRect(\a x1, \a y1, \a x2, \a y2, \a color, \a color).
*
* \sa drawRect(), drawFilledCircle()
*/
/**
* \brief Draws a circle with a specific center (\a centerX, \a centerY)
* and \a radius, with the outline in \a borderColor and the interior
* filled with \a fillColor.
*
* If \a fillColor is \ref NoFill, then the interior is not filled.
*
* \sa drawFilledCircle(), drawLine(), drawRect()
*/
void Bitmap::drawCircle(int centerX, int centerY, int radius, Color borderColor, Color fillColor)
{
// Midpoint circle scan-conversion algorithm using second-order
// differences from "Computer Graphics: Principles and Practice",
// Second Edition, Foley, van Dam, et al.
if (radius < 0)
radius = -radius;
int x = 0;
int y = radius;
int d = 1 - radius;
int deltaE = 3;
int deltaSE = 5 - 2 * radius;
drawCirclePoints(centerX, centerY, radius, x, y, borderColor, fillColor);
while (y > x) {
if (d < 0) {
d += deltaE;
deltaE += 2;
deltaSE += 2;
} else {
d += deltaSE;
deltaE += 2;
deltaSE += 4;
--y;
}
++x;
drawCirclePoints(centerX, centerY, radius, x, y, borderColor, fillColor);
}
}
/**
* \fn void Bitmap::drawFilledCircle(int centerX, int centerY, int radius, Color color)
* \brief Draws a filled circle with a specific center (\a centerX, \a centerY)
* and \a radius in \a color.
*
* This is a convenience function that is equivalent to
* drawCircle(\a centerX, \a centerY, \a radius, \a color, \a color).
*
* \sa drawCircle(), drawFilledRect()
*/
/**
* \brief Draws \a bitmap at (\a x, \a y) in \a color.
*
* Bits that are set to \ref White in the \a bitmap are drawn with \a color.
* Bits that are set to \ref Black in the \a bitmap are drawn with the
* inverse of \a color. The pixel at (\a x, \a y) will be the top-left
* corner of the drawn image.
*
* Note: \a bitmap must not be the same as this object or the behaviour will
* be undefined. To copy a region of a bitmap to elsewhere within the
* same bitmap, use copy() instead.
*
* \sa drawInvertedBitmap(), copy()
*/
void Bitmap::drawBitmap(int x, int y, const Bitmap &bitmap, Color color)
{
int w = bitmap.width();
int s = bitmap.stride();
int h = bitmap.height();
Color invColor = !color;
for (uint8_t by = 0; by < h; ++by) {
const uint8_t *line = bitmap.data() + by * s;
uint8_t mask = 0x80;
uint8_t value = *line++;
for (uint8_t bx = 0; bx < w; ++bx) {
if (value & mask)
setPixel(x + bx, y + by, invColor);
else
setPixel(x + bx, y + by, color);
mask >>= 1;
if (!mask) {
mask = 0x80;
value = *line++;
}
}
}
}
/**
* \brief Draws \a bitmap at (\a x, \a y) in \a color.
*
* The \a bitmap must point to program memory. The first two bytes are the
* width and height of the bitmap in pixels. The rest of the data contains
* the pixels for the bitmap, with lines byte-aligned.
*
* Bits that are 1 in the \a bitmap are drawn with \a color. Bits that are
* 0 in the \a bitmap are drawn with the inverse of \a color. The pixel at
* (\a x, \a y) will be the top-left corner of the drawn image.
*
* \sa drawInvertedBitmap(), fill()
*/
void Bitmap::drawBitmap(int x, int y, Bitmap::ProgMem bitmap, Color color)
{
uint8_t w = pgm_read_byte(bitmap);
uint8_t s = (w + 7) >> 3;
uint8_t h = pgm_read_byte(bitmap + 1);
Color invColor = !color;
for (uint8_t by = 0; by < h; ++by) {
const uint8_t *line = ((const uint8_t *)bitmap) + 2 + by * s;
uint8_t mask = 0x80;
uint8_t value = pgm_read_byte(line);
for (uint8_t bx = 0; bx < w; ++bx) {
if (value & mask)
setPixel(x + bx, y + by, color);
else
setPixel(x + bx, y + by, invColor);
mask >>= 1;
if (!mask) {
mask = 0x80;
++line;
value = pgm_read_byte(line);
}
}
}
}
/**
* \fn void Bitmap::drawInvertedBitmap(int x, int y, const Bitmap &bitmap)
* \brief Draws \a bitmap at (\a x, \a y) in inverted colors.
*
* This is a convenience function that is equivalent to
* drawBitmap(\a x, \a y, \a bitmap, \ref Black).
*
* \sa drawBitmap()
*/
/**
* \fn void Bitmap::drawInvertedBitmap(int x, int y, Bitmap::ProgMem bitmap)
* \brief Draws \a bitmap at (\a x, \a y) in inverted colors.
*
* This is a convenience function that is equivalent to
* drawBitmap(\a x, \a y, \a bitmap, \ref Black).
*
* \sa drawBitmap()
*/
/**
* \fn Font Bitmap::font() const
* \brief Returns the currently selected font, or null if none selected.
*
* \sa setFont(), drawText(), drawChar(), charWidth()
*/
/**
* \fn void Bitmap::setFont(Font font)
* \brief Sets the \a font for use with drawText() and drawChar().
*
* \code
* #include <DejaVuSans9.h>
*
* display.setFont(DejaVuSans9);
* display.drawText(0, 0, "Hello");
* \endcode
*
* New fonts can be generated with <a href="https://code.google.com/p/glcd-arduino/downloads/detail?name=GLCDFontCreator2.zip&can=2&q=">GLCDFontCreator2</a>.
*
* \sa font(), drawText(), drawChar()
*/
/**
* \fn Color Bitmap::textColor() const
* \brief Returns the color that will be used for drawing text with
* drawText() and drawChar(). The default is \ref White.
*
* \sa setTextColor(), drawText(), drawChar()
*/
/**
* \fn void Bitmap::setTextColor(Color textColor)
* \brief Sets the \a color that will be used for drawing text with
* drawText() and drawChar().
*
* \sa textColor(), drawText(), drawChar()
*/
#define fontIsFixed(font) (pgm_read_byte((font)) == 0 && \
pgm_read_byte((font) + 1) == 0)
#define fontWidth(font) (pgm_read_byte((font) + 2))
#define fontHeight(font) (pgm_read_byte((font) + 3))
#define fontFirstChar(font) (pgm_read_byte((font) + 4))
#define fontCharCount(font) (pgm_read_byte((font) + 5))
/**
* \brief Draws the \a len characters of \a str at (\a x, \a y).
*
* If \a len is less than zero, then the actual length of \a str will be used.
*
* The position (\a x, \a y) will be the upper-left pixel of the first
* character that is drawn.
*
* \sa drawChar(), textColor(), font()
*/
void Bitmap::drawText(int x, int y, const char *str, int len)
{
if (!_font)
return;
uint8_t height = fontHeight(_font);
if (len < 0)
len = strlen(str);
while (len-- > 0) {
x += drawChar(x, y, *str++);
if (len > 0) {
fill(x, y, 1, height, !_textColor);
++x;
}
if (x >= _width)
break;
}
}
/**
* \brief Draws \a len characters starting at \a start from \a str to the
* screen at (\a x, \a y).
*
* If \a len is less than zero, then the actual length of \a str will be used.
*
* The position (\a x, \a y) will be the upper-left pixel of the first
* character that is drawn.
*
* \sa drawChar(), textColor(), font()
*/
void Bitmap::drawText(int x, int y, const String &str, int start, int len)
{
if (!_font)
return;
uint8_t height = fontHeight(_font);
if (len < 0)
len = str.length() - start;
while (len-- > 0) {
x += drawChar(x, y, str[start++]);
if (len > 0) {
fill(x, y, 1, height, !_textColor);
++x;
}
if (x >= _width)
break;
}
}
/**
* \brief Draws a single character \a ch at (\a x, \a y).
*
* Returns the width of the character in pixels so that higher-order functions
* like drawText() can advance \a x to the location of the next character
* to be drawn. The width does not include inter-character spacing.
*
* The position (\a x, \a y) will be the upper-left pixel of the drawn
* character.
*
* \sa drawText(), textColor(), font(), charWidth()
*/
int Bitmap::drawChar(int x, int y, char ch)
{
uint8_t height = fontHeight(_font);
if (ch == ' ') {
// Font may not have space, or it is zero-width. Calculate
// the real size and fill the space.
int spaceWidth = charWidth('n');
fill(x, y, spaceWidth, height, !_textColor);
return spaceWidth;
}
uint8_t first = fontFirstChar(_font);
uint8_t count = fontCharCount(_font);
uint8_t index = (uint8_t)ch;
if (index < first || index >= (first + count))
return 0;
index -= first;
uint8_t heightBytes = (height + 7) >> 3;;
uint8_t width;
const uint8_t *image;
if (fontIsFixed(_font)) {
// Fixed-width font.
width = fontWidth(_font);
image = ((const uint8_t *)_font) + 6 + index * heightBytes * width;
} else {
// Variable-width font.
width = pgm_read_byte(_font + 6 + index);
image = ((const uint8_t *)_font) + 6 + count;
for (uint8_t temp = 0; temp < index; ++temp) {
// Scan through all previous characters to find the starting
// location for this one.
image += pgm_read_byte(_font + 6 + temp) * heightBytes;
}
}
if ((x + width) <= 0 || (y + height) <= 0)
return width; // Character is off the top or left of the screen.
Color invColor = !_textColor;
for (uint8_t cx = 0; cx < width; ++cx) {
for (uint8_t cy = 0; cy < heightBytes; ++cy) {
uint8_t value = pgm_read_byte(image + cy * width + cx);
int posn;
if (heightBytes > 1 && cy == (heightBytes - 1))
posn = height - 8;
else
posn = cy * 8;
for (uint8_t bit = 0; bit < 8; ++bit) {
if ((posn + bit) >= (cy * 8) && (posn + bit) <= height) {
if (value & 0x01)
setPixel(x + cx, y + posn + bit, _textColor);
else
setPixel(x + cx, y + posn + bit, invColor);
}
value >>= 1;
}
}
}
return width;
}
/**
* \brief Returns the width in pixels of \a ch in the current font().
*
* Returns zero if font() is not set, or \a ch is not present in font().
*
* \sa drawChar(), font(), textWidth(), textHeight()
*/
int Bitmap::charWidth(char ch) const
{
uint8_t index = (uint8_t)ch;
if (!_font)
return 0;
uint8_t first = fontFirstChar(_font);
uint8_t count = fontCharCount(_font);
if (index == ' ')
index = 'n'; // In case the font does not contain space.
if (index < first || index >= (first + count))
return 0;
if (fontIsFixed(_font))
return fontWidth(_font);
else
return pgm_read_byte(_font + 6 + (index - first));
}
/**
* \brief Returns the width in pixels of the \a len characters of \a str
* in the current font(), including inter-character spacing.
*
* If \a len is less than zero, then the actual length of \a str will be used.
*
* \sa drawText(), charWidth(), textHeight()
*/
int Bitmap::textWidth(const char *str, int len) const
{
int width = 0;
if (len < 0)
len = strlen(str);
while (len-- > 0) {
width += charWidth(*str++);
if (len > 0)
++width;
}
return width;
}
/**
* \brief Returns the width in pixels of the \a len characters of \a str
* in the current font(), starting at \a start, including inter-character
* spacing.
*
* If \a len is less than zero, then the actual length of \a str will be used.
*
* \sa drawText(), charWidth(), textHeight()
*/
int Bitmap::textWidth(const String &str, int start, int len) const
{
int width = 0;
if (len < 0)
len = str.length() - start;
while (len-- > 0) {
width += charWidth(str[start++]);
if (len > 0)
++width;
}
return width;
}
/**
* \brief Returns the height in pixels of the current text drawing font();
* or zero if font() is not set.
*
* \sa font(), charWidth(), textWidth()
*/
int Bitmap::textHeight() const
{
if (_font)
return fontHeight(_font);
else
return 0;
}
/**
* \brief Copies the \a width x \a height pixels starting at top-left
* corner (\a x, \a y) to (\a destX, \a destY) in the bitmap \a dest.
*
* The \a dest bitmap can be the same as this object, in which case the copy
* will be performed in a manner that correctly handles overlapping regions.
*
* If some part of the source region is outside the bounds of this object,
* then the value \ref Black will be copied to \a dest for those pixels.
* This can be used to produce a behaviour similar to scroll() when
* \a bitmap is the same as this object.
*
* \sa drawBitmap(), fill(), scroll()
*/
void Bitmap::copy(int x, int y, int width, int height, Bitmap *dest, int destX, int destY)
{
if (dest == this) {
// Copying to within the same bitmap, so copy in a direction
// that will prevent problems with overlap.
blit(x, y, x + width - 1, y + height - 1, destX, destY);
} else {
// Copying to a different bitmap.
while (height > 0) {
for (int tempx = 0; tempx < width; ++tempx)
dest->setPixel(destX + tempx, destY, pixel(x + tempx, y));
++y;
++destY;
--height;
}
}
}
/**
* \brief Fills the \a width x \a height pixels starting at top-left
* corner (\a x, \a y) with \a color.
*
* \sa copy(), clear(), invert(), drawRect()
*/
void Bitmap::fill(int x, int y, int width, int height, Color color)
{
while (height > 0) {
for (int temp = 0; temp < width; ++temp)
setPixel(x + temp, y, color);
++y;
--height;
}
}
/**
* \brief Fills the \a width x \a height pixels starting at top-left
* corner (\a x, \a y) with the contents of \a pattern.
*
* The \a pattern must point to program memory. The first two bytes are the
* width and height of the pattern in pixels. The rest of the data contains
* the pixels for the pattern, with lines byte-aligned.
*
* Bits that are 1 in the \a pattern are drawn with \a color. Bits that are
* 0 in the \a pattern are drawn with the inverse of \a color.
*
* \sa drawBitmap(), clear(), invert()
*/
void Bitmap::fill(int x, int y, int width, int height, Bitmap::ProgMem pattern, Color color)
{
uint8_t w = pgm_read_byte(pattern);
uint8_t s = (w + 7) >> 3;
uint8_t h = pgm_read_byte(pattern + 1);
if (!w || !h)
return;
Color invColor = !color;
for (int tempy = 0; tempy < height; ++tempy) {
const uint8_t *startLine = ((const uint8_t *)pattern) + 2 + (tempy % h) * s;
const uint8_t *line = startLine;
uint8_t mask = 0x80;
uint8_t value = pgm_read_byte(line++);
int bit = 0;
for (int tempx = 0; tempx < width; ++tempx) {
if (value & mask)
setPixel(x + tempx, y + tempy, color);
else
setPixel(x + tempx, y + tempy, invColor);
if (++bit >= w) {
mask = 0x80;
line = startLine;
value = pgm_read_byte(line++);
bit = 0;
} else {
mask >>= 1;
if (!mask) {
mask = 0x80;
value = pgm_read_byte(line++);
}
}
}
}
}
/**
* \fn void Bitmap::scroll(int dx, int dy, Color fillColor)
* \brief Scrolls the entire contents of the bitmap by \a dx and \a dy.
*
* If \a dx is 2 and \a dy is -1, then the region will be scrolled two
* pixels to the right and one pixel up. Pixels that are uncovered
* by the scroll are filled with \a fillColor.
*
* \sa copy(), fill()
*/
/**
* \brief Scrolls the \a width x \a height pixels starting at top-left
* corner (\a x, \a y) by \a dx and \a dy.
*
* If \a dx is 2 and \a dy is -1, then the region will be scrolled two
* pixels to the right and one pixel up. Pixels that are uncovered
* by the scroll are filled with \a fillColor.
*
* \sa copy(), fill()
*/
void Bitmap::scroll(int x, int y, int width, int height, int dx, int dy, Color fillColor)
{
// Bail out if no scrolling at all.
if (!dx && !dy)
return;
// Clamp the scroll region to the extents of the bitmap.
if (x < 0) {
width += x;
x = 0;
}
if (y < 0) {
height += y;
y = 0;
}
if ((x + width) > _width)
width = _width - x;
if ((y + height) > _height)
height = _height - y;
if (width <= 0 || height <= 0)
return;
// Scroll the region in the specified direction.
if (dy < 0) {
if (dx < 0)
blit(x - dx, y - dy, x + width - 1 + dx, y + height - 1 + dy, x, y);
else
blit(x, y - dy, x + width - 1 - dx, y + height - 1 + dy, x + dx, y);
} else {
if (dx < 0)
blit(x - dx, y, x + width - 1 + dx, y + height - 1 - dy, x, y + dy);
else
blit(x, y, x + width - 1 - dx, y + height - 1 - dy, x + dx, y + dy);
}
// Fill the pixels that were uncovered by the scroll.
if (dy < 0) {
fill(x, y + height + dy, width, -dy, fillColor);
if (dx < 0)
fill(x + width + dx, y, -dx, height + dy, fillColor);
else if (dx > 0)
fill(x, y, dx, height + dy, fillColor);
} else if (dy > 0) {
fill(x, y, width, -dy, fillColor);
if (dx < 0)
fill(x + width + dx, y + dy, -dx, height - dy, fillColor);
else if (dx > 0)
fill(x, y + dy, dx, height - dy, fillColor);
} else if (dx < 0) {
fill(x + width + dx, y, -dx, height, fillColor);
} else if (dx > 0) {
fill(x, y, dx, height, fillColor);
}
}
/**
* \brief Inverts the \a width x \a height pixels starting at top-left
* corner (\a x, \a y).
*
* \sa fill()
*/
void Bitmap::invert(int x, int y, int width, int height)
{
while (height > 0) {
for (int tempx = x + width - 1; tempx >= x; --tempx)
setPixel(tempx, y, !pixel(tempx, y));
--height;
++y;
}
}
void Bitmap::blit(int x1, int y1, int x2, int y2, int x3, int y3)
{
if (y3 < y1 || (y1 == y3 && x3 <= x1)) {
for (int tempy = y1; tempy <= y2; ++tempy) {
int y = y1 - tempy + y3;
int x = x3 - x1;
for (int tempx = x1; tempx <= x2; ++tempx)
setPixel(x + tempx, y, pixel(tempx, tempy));
}
} else {
for (int tempy = y2; tempy >= y1; --tempy) {
int y = y1 - tempy + y3;
int x = x3 - x1;
for (int tempx = x2; tempx >= x1; --tempx)
setPixel(x + tempx, y, pixel(tempx, tempy));
}
}
}
void Bitmap::drawCirclePoints(int centerX, int centerY, int radius, int x, int y, Color borderColor, Color fillColor)
{
if (x != y) {
setPixel(centerX + x, centerY + y, borderColor);
setPixel(centerX + y, centerY + x, borderColor);
setPixel(centerX + y, centerY - x, borderColor);
setPixel(centerX + x, centerY - y, borderColor);
setPixel(centerX - x, centerY - y, borderColor);
setPixel(centerX - y, centerY - x, borderColor);
setPixel(centerX - y, centerY + x, borderColor);
setPixel(centerX - x, centerY + y, borderColor);
if (fillColor != NoFill) {
if (radius > 1) {
drawLine(centerX - x + 1, centerY + y, centerX + x - 1, centerY + y, fillColor);
drawLine(centerX - y + 1, centerY + x, centerX + y - 1, centerY + x, fillColor);
drawLine(centerX - x + 1, centerY - y, centerX + x - 1, centerY - y, fillColor);
drawLine(centerX - y + 1, centerY - x, centerX + y - 1, centerY - x, fillColor);
} else if (radius == 1) {
setPixel(centerX, centerY, fillColor);
}
}
} else {
setPixel(centerX + x, centerY + y, borderColor);
setPixel(centerX + y, centerY - x, borderColor);
setPixel(centerX - x, centerY - y, borderColor);
setPixel(centerX - y, centerY + x, borderColor);
if (fillColor != NoFill) {
if (radius > 1) {
drawLine(centerX - x + 1, centerY + y, centerX + x - 1, centerY + y, fillColor);
drawLine(centerX - x + 1, centerY - y, centerX + x - 1, centerY - y, fillColor);
} else if (radius == 1) {
setPixel(centerX, centerY, fillColor);
}
}
}
}

View File

@ -1,140 +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.
*/
#ifndef Bitmap_h
#define Bitmap_h
#include <inttypes.h>
#include <avr/pgmspace.h>
class DMD;
class String;
class Bitmap
{
public:
Bitmap(int width, int height);
~Bitmap();
bool isValid() const { return fb != 0; }
typedef uint8_t Color;
typedef PGM_VOID_P ProgMem;
typedef PGM_VOID_P Font;
static const Color Black = 0;
static const Color White = 1;
static const Color NoFill = 2;
int width() const { return _width; }
int height() const { return _height; }
int stride() const { return _stride; }
int bitsPerPixel() const { return 1; }
uint8_t *data() { return fb; }
const uint8_t *data() const { return fb; }
void clear(Color color = Black);
Color pixel(int x, int y) const;
void setPixel(int x, int y, Color color);
void drawLine(int x1, int y1, int x2, int y2, Color color = White);
void drawRect(int x1, int y1, int x2, int y2, Color borderColor = White, Color fillColor = NoFill);
void drawFilledRect(int x1, int y1, int x2, int y2, Color color = White);
void drawCircle(int centerX, int centerY, int radius, Color borderColor = White, Color fillColor = NoFill);
void drawFilledCircle(int centerX, int centerY, int radius, Color color = White);
void drawBitmap(int x, int y, const Bitmap &bitmap, Color color = White);
void drawBitmap(int x, int y, Bitmap::ProgMem bitmap, Color color = White);
void drawInvertedBitmap(int x, int y, const Bitmap &bitmap);
void drawInvertedBitmap(int x, int y, Bitmap::ProgMem bitmap);
Font font() const { return _font; }
void setFont(Font font) { _font = font; }
Color textColor() const { return _textColor; }
void setTextColor(Color color) { _textColor = color; }
void drawText(int x, int y, const char *str, int len = -1);
void drawText(int x, int y, const String &str, int start = 0, int len = -1);
int drawChar(int x, int y, char ch);
int charWidth(char ch) const;
int textWidth(const char *str, int len = -1) const;
int textWidth(const String &str, int start = 0, int len = -1) const;
int textHeight() const;
void copy(int x, int y, int width, int height, Bitmap *dest, int destX, int destY);
void fill(int x, int y, int width, int height, Color color);
void fill(int x, int y, int width, int height, Bitmap::ProgMem pattern, Color color = White);
void scroll(int dx, int dy, Color fillColor = Black);
void scroll(int x, int y, int width, int height, int dx, int dy, Color fillColor = Black);
void invert(int x, int y, int width, int height);
private:
// Disable copy constructor and operator=().
Bitmap(const Bitmap &) {}
Bitmap &operator=(const Bitmap &) { return *this; }
int _width;
int _height;
int _stride;
uint8_t *fb;
Font _font;
Color _textColor;
friend class DMD;
void blit(int x1, int y1, int x2, int y2, int x3, int y3);
void drawCirclePoints(int centerX, int centerY, int radius, int x, int y, Color borderColor, Color fillColor);
};
inline void Bitmap::drawFilledRect(int x1, int y1, int x2, int y2, Color color)
{
drawRect(x1, y1, x2, y2, color, color);
}
inline void Bitmap::drawFilledCircle(int centerX, int centerY, int radius, Color color)
{
drawCircle(centerX, centerY, radius, color, color);
}
inline void Bitmap::drawInvertedBitmap(int x, int y, const Bitmap &bitmap)
{
drawBitmap(x, y, bitmap, Black);
}
inline void Bitmap::drawInvertedBitmap(int x, int y, Bitmap::ProgMem bitmap)
{
drawBitmap(x, y, bitmap, Black);
}
inline void Bitmap::scroll(int dx, int dy, Color fillColor)
{
scroll(0, 0, _width, _height, dx, dy, fillColor);
}
#endif

View File

@ -1,696 +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.
*/
#include "DMD.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include <Arduino.h>
#else
#include <WProgram.h>
#endif
#include <pins_arduino.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <string.h>
#include <stdlib.h>
/**
* \class DMD DMD.h <DMD.h>
* \brief Handle large dot matrix displays composed of LED's.
*
* This class is designed for use with
* <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 (for which this class
* always uses the constant \ref White regardless of the physical color).
*
* \section dmd_drawing Drawing
*
* DMD inherits from Bitmap so that any of the drawing functions in that
* class can be used to draw directly to dot matrix displays. The following
* example initializes a single display panel and draws a rectangle and a
* circle into it at setup time:
*
* \code
* #include <DMD.h>
*
* DMD display;
*
* void setup() {
* display.drawRect(5, 2, 27, 13);
* display.drawCircle(16, 8, 4);
* }
* \endcode
*
* The display must be updated frequently from the application's main loop:
*
* \code
* void loop() {
* display.loop();
* }
* \endcode
*
* \section dmd_interrupts Interrupt-driven display refresh
*
* The loop() method simplifies updating the display from the application's
* main loop but it can sometimes be inconvenient to arrange for it to be
* called regularly, especially if the application wishes to use
* <tt>delay()</tt> or <tt>delayMicroseconds()</tt>.
*
* DMD provides an asynchronous display update mechanism using Timer1
* interrupts. The application turns on interrupts using enableTimer1()
* and then calls refresh() from the interrupt service routine:
*
* \code
* #include <DMD.h>
*
* DMD display;
*
* ISR(TIMER1_OVF_vect)
* {
* display.refresh();
* }
*
* void setup() {
* display.enableTimer1();
* }
* \endcode
*
* If Timer1 is already in use by some other part of your application,
* then Timer2 can be used as an alternative interrupt source:
*
* \code
* #include <DMD.h>
*
* DMD display;
*
* ISR(TIMER2_OVF_vect)
* {
* display.refresh();
* }
*
* void setup() {
* display.enableTimer2();
* }
* \endcode
*
* DMD can also be used with third-party timer libraries such as
* <a href="http://code.google.com/p/arduino-timerone/downloads/list">TimerOne</a>:
*
* \code
* #include <DMD.h>
* #include <TimerOne.h>
*
* DMD display;
*
* void refreshDisplay()
* {
* display.refresh();
* }
*
* void setup() {
* Timer1.initialize(5000);
* Timer1.attachInterrupt(refreshDisplay);
* }
* \endcode
*
* \section dmd_double_buffer Double buffering
*
* When using interrupts, the system can sometimes exhibit "tearing" artifacts
* where half-finished images are displayed because an interrupt fired in
* the middle of a screen update.
*
* This problem can be alleviated using double buffering: all rendering is done
* to an off-screen buffer that is swapped onto the screen once it is ready
* for display. Rendering then switches to the other buffer that is now
* off-screen. The following example demonstrates this:
*
* \code
* #include <DMD.h>
*
* DMD display;
*
* ISR(TIMER1_OVF_vect)
* {
* display.refresh();
* }
*
* void setup() {
* display.setDoubleBuffer(true);
* display.enableTimer1();
* }
*
* void loop() {
* updateDisplay();
* display.swapBuffers();
* delay(50); // Delay between frames.
* }
*
* void updateDisplay() {
* // Draw the new display contents into the off-screen buffer.
* display.clear();
* ...
* }
* \endcode
*
* The downside of double buffering is that it uses twice as much main memory
* to manage the contents of the screen.
*
* \section dmd_multi Multiple panels
*
* Multiple panels can be daisy-chained together using ribbon cables.
* If there is a single row of panels, then they must be connected
* to the Arduino board as follows:
*
* \image html dmd-4x1.png
*
* If there are multiple rows of panels, then alternating rows are
* flipped upside-down so that the short ribbon cables provided by
* Freetronics reach (this technique is thanks to Chris Debenham; see
* http://www.adebenham.com/category/arduino/dmd/ for more details):
*
* \image html dmd-4x2.png
*
* This technique can be repeated for as many rows as required, with the
* bottom row always right-way-up:
*
* \image html dmd-4x3.png
*
* DMD automatically takes care of flipping the data for panels in the
* alternating rows. No special action is required by the user except
* to physically connect the panels as shown and to initialize the DMD
* class appropriately:
*
* \code
* #include <DMD.h>
*
* DMD display(4, 2); // 4 panels wide, 2 panels high
* \endcode
*/
// Pins on the DMD connector board.
#define DMD_PIN_PHASE_LSB 6 // A
#define DMD_PIN_PHASE_MSB 7 // B
#define DMD_PIN_LATCH 8 // SCLK
#define DMD_PIN_OUTPUT_ENABLE 9 // nOE
#define DMD_PIN_SPI_SS SS // SPI Slave Select
#define DMD_PIN_SPI_MOSI MOSI // SPI Master Out, Slave In (R)
#define DMD_PIN_SPI_MISO MISO // SPI Master In, Slave Out
#define DMD_PIN_SPI_SCK SCK // SPI Serial Clock (CLK)
// Dimension information for the display.
#define DMD_NUM_COLUMNS 32 // Number of columns in a panel.
#define DMD_NUM_ROWS 16 // Number of rows in a panel.
// Refresh times.
#define DMD_REFRESH_MS 5
#define DMD_REFRESH_US 5000
/**
* \brief Constructs a new dot matrix display handler for a display that
* is \a widthPanels x \a heightPanels in size.
*
* Note: the parameters to this constructor are specified in panels,
* whereas width() and height() are specified in pixels.
*
* \sa width(), height()
*/
DMD::DMD(int widthPanels, int heightPanels)
: Bitmap(widthPanels * DMD_NUM_COLUMNS, heightPanels * DMD_NUM_ROWS)
, _doubleBuffer(false)
, phase(0)
, fb0(0)
, fb1(0)
, displayfb(0)
, lastRefresh(millis())
{
// Both rendering and display are to fb0 initially.
fb0 = displayfb = fb;
// Initialize SPI to MSB-first, mode 0, clock divider = 2.
pinMode(DMD_PIN_SPI_SCK, OUTPUT);
pinMode(DMD_PIN_SPI_MOSI, OUTPUT);
pinMode(DMD_PIN_SPI_SS, OUTPUT);
digitalWrite(DMD_PIN_SPI_SCK, LOW);
digitalWrite(DMD_PIN_SPI_MOSI, LOW);
digitalWrite(DMD_PIN_SPI_SS, HIGH);
SPCR |= _BV(MSTR);
SPCR |= _BV(SPE);
SPCR &= ~(_BV(DORD)); // MSB-first
SPCR &= ~0x0C; // Mode 0
SPCR &= ~0x03; // Clock divider rate 2
SPSR |= 0x01; // MSB of clock divider rate
// Initialize the DMD-specific pins.
pinMode(DMD_PIN_PHASE_LSB, OUTPUT);
pinMode(DMD_PIN_PHASE_MSB, OUTPUT);
pinMode(DMD_PIN_LATCH, OUTPUT);
pinMode(DMD_PIN_OUTPUT_ENABLE, OUTPUT);
digitalWrite(DMD_PIN_PHASE_LSB, LOW);
digitalWrite(DMD_PIN_PHASE_MSB, LOW);
digitalWrite(DMD_PIN_LATCH, LOW);
digitalWrite(DMD_PIN_OUTPUT_ENABLE, LOW);
digitalWrite(DMD_PIN_SPI_MOSI, HIGH);
}
/**
* \brief Destroys this dot matrix display handler.
*/
DMD::~DMD()
{
if (fb0)
free(fb0);
if (fb1)
free(fb1);
fb = 0; // Don't free the buffer again in the base class.
}
/**
* \fn bool DMD::doubleBuffer() const
* \brief Returns true if the display is double-buffered; false if
* single-buffered. The default is false.
*
* \sa setDoubleBuffer(), swapBuffers(), refresh()
*/
/**
* \brief Enables or disables double-buffering according to \a doubleBuffer.
*
* When double-buffering is enabled, rendering operations are sent to a
* memory buffer that isn't currently displayed on-screen. Once the
* application has completed the screen update, it calls swapBuffers()
* to display the current buffer and switch rendering to the other
* now invisible buffer.
*
* Double-buffering is recommended if refresh() is being called from an
* interrupt service routine, to prevent "tearing" artifacts that result
* from simultaneous update of a single shared buffer.
*
* This function will allocate memory for the extra buffer when
* \a doubleBuffer is true. If there is insufficient memory for the
* second screen buffer, then this class will revert to single-buffered mode.
*
* \sa doubleBuffer(), swapBuffers(), refresh()
*/
void DMD::setDoubleBuffer(bool doubleBuffer)
{
if (doubleBuffer != _doubleBuffer) {
_doubleBuffer = doubleBuffer;
if (doubleBuffer) {
// Allocate a new back buffer.
unsigned int size = _stride * _height;
fb1 = (uint8_t *)malloc(size);
// Clear the new back buffer and then switch to it, leaving
// the current contents of fb0 on the screen.
if (fb1) {
memset(fb1, 0xFF, size);
cli();
fb = fb1;
displayfb = fb0;
sei();
} else {
// Failed to allocate the memory, so revert to single-buffered.
_doubleBuffer = false;
}
} else if (fb1) {
// Disabling double-buffering, so forcibly switch to fb0.
cli();
fb = fb0;
displayfb = fb0;
sei();
// Free the unnecessary buffer.
free(fb1);
fb1 = 0;
}
}
}
/**
* \brief Swaps the buffers that are used for rendering to the display.
*
* When doubleBuffer() is false, this function does nothing.
* Otherwise the front and back rendering buffers are swapped.
* See the description of setDoubleBuffer() for more information.
*
* The new rendering back buffer will have undefined contents and will
* probably need to be re-inialized with clear() or fill() before
* drawing to it. The swapBuffersAndCopy() function can be used instead
* to preserve the screen contents from one frame to the next.
*
* \sa swapBuffersAndCopy(), setDoubleBuffer()
*/
void DMD::swapBuffers()
{
if (_doubleBuffer) {
// Turn off interrupts while swapping buffers so that we don't
// accidentally try to refresh() in the middle of this code.
cli();
if (fb == fb0) {
fb = fb1;
displayfb = fb0;
} else {
fb = fb0;
displayfb = fb1;
}
sei();
}
}
/**
* \brief Swaps the buffers that are used for rendering to the display
* and copies the former back buffer contents to the new back buffer.
*
* Normally when swapBuffers() is called, the new rendering back buffer
* will have undefined contents from two frames prior and must be cleared
* with clear() or fill() before writing new contents to it.
* This function instead copies the previous frame into the new
* rendering buffer so that it can be updated in-place.
*
* This function is useful if the screen does not change much from one
* frame to the next. If the screen changes a lot between frames, then it
* is usually better to explicitly clear() or fill() the new back buffer.
*
* \sa swapBuffers(), setDoubleBuffer()
*/
void DMD::swapBuffersAndCopy()
{
swapBuffers();
if (_doubleBuffer)
memcpy(fb, displayfb, _stride * _height);
}
/**
* \brief Performs regular display refresh activities from the
* application's main loop.
*
* \code
* DMD display;
*
* void loop() {
* display.loop();
* }
* \endcode
*
* If you are using a timer interrupt service routine, then call
* refresh() in response to the interrupt instead of calling loop().
*
* \sa refresh()
*/
void DMD::loop()
{
unsigned long currentTime = millis();
if ((currentTime - lastRefresh) >= DMD_REFRESH_MS) {
lastRefresh = currentTime;
refresh();
}
}
// Send a single byte via SPI.
static inline void spiSend(byte value)
{
SPDR = value;
while (!(SPSR & _BV(SPIF)))
; // Wait for the transfer to complete.
}
// Flip the bits in a byte. Table generated by genflip.c
static const uint8_t flipBits[256] PROGMEM = {
0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x10, 0x90, 0x50, 0xD0,
0x30, 0xB0, 0x70, 0xF0, 0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8,
0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8, 0x04, 0x84, 0x44, 0xC4,
0x24, 0xA4, 0x64, 0xE4, 0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4,
0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC, 0x1C, 0x9C, 0x5C, 0xDC,
0x3C, 0xBC, 0x7C, 0xFC, 0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2,
0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2, 0x0A, 0x8A, 0x4A, 0xCA,
0x2A, 0xAA, 0x6A, 0xEA, 0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA,
0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6, 0x16, 0x96, 0x56, 0xD6,
0x36, 0xB6, 0x76, 0xF6, 0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE,
0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE, 0x01, 0x81, 0x41, 0xC1,
0x21, 0xA1, 0x61, 0xE1, 0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, 0xF1,
0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9, 0x19, 0x99, 0x59, 0xD9,
0x39, 0xB9, 0x79, 0xF9, 0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5,
0x15, 0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5, 0x0D, 0x8D, 0x4D, 0xCD,
0x2D, 0xAD, 0x6D, 0xED, 0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD,
0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3, 0x13, 0x93, 0x53, 0xD3,
0x33, 0xB3, 0x73, 0xF3, 0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB,
0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB, 0x07, 0x87, 0x47, 0xC7,
0x27, 0xA7, 0x67, 0xE7, 0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7,
0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, 0x1F, 0x9F, 0x5F, 0xDF,
0x3F, 0xBF, 0x7F, 0xFF
};
/**
* \brief Refresh the display.
*
* This function must be called at least once every 5 milliseconds
* for smooth non-flickering update of the display. It is usually
* called by loop(), but can also be called in response to a
* timer interrupt.
*
* If this function is called from an interrupt service routine,
* then it is recommended that double-buffering be enabled with
* setDoubleBuffer() to prevent "tearing" artifacts that result
* from simultaneous update of a single shared buffer.
*
* \sa loop(), setDoubleBuffer(), enableTimer1()
*/
void DMD::refresh()
{
// Bail out if there is a conflict on the SPI bus.
if (!digitalRead(DMD_PIN_SPI_SS))
return;
// Transfer the data for the next group of interleaved rows.
int stride4 = _stride * 4;
uint8_t *data0;
uint8_t *data1;
uint8_t *data2;
uint8_t *data3;
bool flipRow = ((_height & 0x10) == 0);
for (int y = 0; y < _height; y += 16) {
if (!flipRow) {
// The panels in this row are the right way up.
data0 = displayfb + _stride * (y + phase);
data1 = data0 + stride4;
data2 = data1 + stride4;
data3 = data2 + stride4;
for (int x = _stride; x > 0; --x) {
spiSend(*data3++);
spiSend(*data2++);
spiSend(*data1++);
spiSend(*data0++);
}
flipRow = true;
} else {
// The panels in this row are upside-down and reversed.
data0 = displayfb + _stride * (y + 16 - phase) - 1;
data1 = data0 - stride4;
data2 = data1 - stride4;
data3 = data2 - stride4;
for (int x = _stride; x > 0; --x) {
spiSend(pgm_read_byte(&(flipBits[*data3--])));
spiSend(pgm_read_byte(&(flipBits[*data2--])));
spiSend(pgm_read_byte(&(flipBits[*data1--])));
spiSend(pgm_read_byte(&(flipBits[*data0--])));
}
flipRow = false;
}
}
// Latch the data from the shift registers onto the actual display.
digitalWrite(DMD_PIN_OUTPUT_ENABLE, LOW);
digitalWrite(DMD_PIN_LATCH, HIGH);
digitalWrite(DMD_PIN_LATCH, LOW);
if (phase & 0x02)
digitalWrite(DMD_PIN_PHASE_MSB, HIGH);
else
digitalWrite(DMD_PIN_PHASE_MSB, LOW);
if (phase & 0x01)
digitalWrite(DMD_PIN_PHASE_LSB, HIGH);
else
digitalWrite(DMD_PIN_PHASE_LSB, LOW);
digitalWrite(DMD_PIN_OUTPUT_ENABLE, HIGH);
phase = (phase + 1) & 0x03;
}
/**
* \brief Enables Timer1 overflow interrupts for updating this display.
*
* The application must also provide an interrupt service routine for
* Timer1 that calls refresh():
*
* \code
* #include <DMD.h>
*
* DMD display;
*
* ISR(TIMER1_OVF_vect)
* {
* display.refresh();
* }
*
* void setup() {
* display.enableTimer1();
* }
* \endcode
*
* If timer interrupts are being used to update the display, then it is
* unnecessary to call loop().
*
* \sa refresh(), disableTimer1(), enableTimer2(), setDoubleBuffer()
*/
void DMD::enableTimer1()
{
// Number of CPU cycles in the display's refresh period.
unsigned long numCycles = (F_CPU / 2000000) * DMD_REFRESH_US;
// Determine the prescaler to be used.
#define TIMER1_RESOLUTION 65536UL
uint8_t prescaler;
if (numCycles < TIMER1_RESOLUTION) {
// No prescaling required.
prescaler = _BV(CS10);
} else if (numCycles < TIMER1_RESOLUTION * 8) {
// Prescaler = 8.
prescaler = _BV(CS11);
numCycles >>= 3;
} else if (numCycles < TIMER1_RESOLUTION * 64) {
// Prescaler = 64.
prescaler = _BV(CS11) | _BV(CS10);
numCycles >>= 6;
} else if (numCycles < TIMER1_RESOLUTION * 256) {
// Prescaler = 256.
prescaler = _BV(CS12);
numCycles >>= 8;
} else if (numCycles < TIMER1_RESOLUTION * 1024) {
// Prescaler = 1024.
prescaler = _BV(CS12) | _BV(CS10);
numCycles >>= 10;
} else {
// Too long, so set the maximum timeout.
prescaler = _BV(CS12) | _BV(CS10);
numCycles = TIMER1_RESOLUTION - 1;
}
// Configure Timer1 for the period we want.
TCCR1A = 0;
TCCR1B = _BV(WGM13);
uint8_t saveSREG = SREG;
cli();
ICR1 = numCycles;
SREG = saveSREG; // Implicit sei() if interrupts were on previously.
TCCR1B = (TCCR1B & ~(_BV(CS12) | _BV(CS11) | _BV(CS10))) | prescaler;
// Turn on the Timer1 overflow interrupt.
TIMSK1 |= _BV(TOIE1);
}
/**
* \brief Disables Timer1 overflow interrupts.
*
* \sa enableTimer1()
*/
void DMD::disableTimer1()
{
// Turn off the Timer1 overflow interrupt.
TIMSK1 &= ~_BV(TOIE1);
}
/**
* \brief Enables Timer2 overflow interrupts for updating this display.
*
* The application must also provide an interrupt service routine for
* Timer2 that calls refresh():
*
* \code
* #include <DMD.h>
*
* DMD display;
*
* ISR(TIMER2_OVF_vect)
* {
* display.refresh();
* }
*
* void setup() {
* display.enableTimer2();
* }
* \endcode
*
* If timer interrupts are being used to update the display, then it is
* unnecessary to call loop().
*
* \sa refresh(), disableTimer2(), enableTimer1(), setDoubleBuffer()
*/
void DMD::enableTimer2()
{
// Configure Timer2 for the period we want. With the prescaler set
// to 128, then 256 increments of Timer2 gives roughly 4 ms between
// overflows on a system with a 16 MHz clock. We adjust the prescaler
// accordingly for other clock frequencies.
TCCR2A = 0;
if (F_CPU >= 32000000)
TCCR2B = _BV(CS22) | _BV(CS21); // Prescaler = 256
else if (F_CPU >= 16000000)
TCCR2B = _BV(CS22) | _BV(CS20); // Prescaler = 128
else if (F_CPU >= 8000000)
TCCR2B = _BV(CS22); // Prescaler = 64
else
TCCR2B = _BV(CS21) | _BV(CS20); // Prescaler = 32
// Reset Timer2 to kick off the process.
TCNT2 = 0;
// Turn on the Timer2 overflow interrupt (also turn off OCIE2A and OCIE2B).
TIMSK2 = _BV(TOIE2);
}
/**
* \brief Disables Timer2 overflow interrupts.
*
* \sa enableTimer2()
*/
void DMD::disableTimer2()
{
// Turn off the Timer2 overflow interrupt.
TIMSK2 &= ~_BV(TOIE2);
}
/**
* \brief Converts an RGB value into a pixel color value.
*
* Returns \ref White if any of \a r, \a g, or \a b are non-zero;
* otherwise returns \ref Black.
*
* This function is provided for upwards compatibility with future
* displays that support full color. Monochrome applications should
* use the \ref Black and \ref White constants directly.
*/
DMD::Color DMD::fromRGB(uint8_t r, uint8_t g, uint8_t b)
{
if (r || g || b)
return White;
else
return Black;
}

View File

@ -1,63 +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.
*/
#ifndef DMD_h
#define DMD_h
#include "Bitmap.h"
class DMD : public Bitmap
{
public:
explicit DMD(int widthPanels = 1, int heightPanels = 1);
~DMD();
bool doubleBuffer() const { return _doubleBuffer; }
void setDoubleBuffer(bool doubleBuffer);
void swapBuffers();
void swapBuffersAndCopy();
void loop();
void refresh();
void enableTimer1();
void disableTimer1();
void enableTimer2();
void disableTimer2();
static Color fromRGB(uint8_t r, uint8_t g, uint8_t b);
private:
// Disable copy constructor and operator=().
DMD(const DMD &other) : Bitmap(other) {}
DMD &operator=(const DMD &) { return *this; }
bool _doubleBuffer;
uint8_t phase;
uint8_t *fb0;
uint8_t *fb1;
uint8_t *displayfb;
unsigned long lastRefresh;
};
#endif

View File

@ -1,166 +0,0 @@
/*
*
* DejaVuSans9
*
* created with FontCreator
* written by F. Maximilian Thiele
*
* http://www.apetech.de/fontCreator
* me@apetech.de
*
* File Name : DejaVuSans9.h
* Date : 28.05.2012
* Font size in bytes : 3962
* Font width : 10
* Font height : 10
* Font first char : 32
* Font last char : 128
* Font used chars : 96
*
* The font data are defined as
*
* struct _FONT_ {
* uint16_t font_Size_in_Bytes_over_all_included_Size_it_self;
* uint8_t font_Width_in_Pixel_for_fixed_drawing;
* uint8_t font_Height_in_Pixel_for_all_characters;
* unit8_t font_First_Char;
* uint8_t font_Char_Count;
*
* uint8_t font_Char_Widths[font_Last_Char - font_First_Char +1];
* // for each character the separate width in pixels,
* // characters < 128 have an implicit virtual right empty row
*
* uint8_t font_data[];
* // bit field of all characters
*/
#include <inttypes.h>
#include <avr/pgmspace.h>
#ifndef DEJAVUSANS9_H
#define DEJAVUSANS9_H
#define DEJAVUSANS9_WIDTH 10
#define DEJAVUSANS9_HEIGHT 10
static uint8_t const DejaVuSans9[] PROGMEM = {
0x0F, 0x7A, // size
0x0A, // width
0x0A, // height
0x20, // first char
0x60, // char count
// char widths
0x00, 0x01, 0x03, 0x06, 0x05, 0x08, 0x06, 0x01, 0x02, 0x02,
0x05, 0x05, 0x01, 0x02, 0x01, 0x03, 0x04, 0x03, 0x04, 0x04,
0x05, 0x04, 0x04, 0x04, 0x04, 0x04, 0x01, 0x01, 0x06, 0x06,
0x06, 0x04, 0x08, 0x06, 0x05, 0x05, 0x05, 0x04, 0x04, 0x05,
0x05, 0x01, 0x02, 0x05, 0x04, 0x06, 0x05, 0x05, 0x04, 0x05,
0x05, 0x05, 0x05, 0x05, 0x06, 0x07, 0x06, 0x05, 0x05, 0x02,
0x03, 0x02, 0x04, 0x05, 0x02, 0x04, 0x04, 0x04, 0x04, 0x04,
0x03, 0x04, 0x04, 0x01, 0x02, 0x04, 0x01, 0x07, 0x04, 0x04,
0x04, 0x04, 0x03, 0x03, 0x04, 0x04, 0x05, 0x07, 0x05, 0x05,
0x04, 0x03, 0x01, 0x03, 0x06, 0x05,
// font data
0xBE, 0x00, // 33
0x06, 0x00, 0x06, 0x00, 0x00, 0x00, // 34
0x28, 0xE8, 0x3E, 0xE8, 0x3E, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 35
0x98, 0x94, 0xFE, 0xA4, 0x64, 0x00, 0x00, 0x40, 0x00, 0x00, // 36
0x1E, 0x12, 0xDE, 0x30, 0x18, 0xF6, 0x90, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 37
0x60, 0x9C, 0x92, 0x62, 0xC4, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 38
0x06, 0x00, // 39
0x7E, 0x81, 0x00, 0x00, // 40
0xC3, 0x3C, 0x00, 0x00, // 41
0x12, 0x0C, 0x1E, 0x0C, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, // 42
0x20, 0x20, 0xF8, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // 43
0x80, 0x40, // 44
0x20, 0x20, 0x00, 0x00, // 45
0x80, 0x00, // 46
0xC0, 0x38, 0x06, 0x00, 0x00, 0x00, // 47
0x7C, 0x82, 0x82, 0x7C, 0x00, 0x00, 0x00, 0x00, // 48
0x82, 0xFE, 0x80, 0x00, 0x00, 0x00, // 49
0xC4, 0xA2, 0x92, 0x8C, 0x00, 0x00, 0x00, 0x00, // 50
0x84, 0x92, 0x92, 0x6C, 0x00, 0x00, 0x00, 0x00, // 51
0x60, 0x58, 0x44, 0xFE, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, // 52
0x9E, 0x92, 0x92, 0x62, 0x00, 0x00, 0x00, 0x00, // 53
0x7C, 0x96, 0x92, 0x62, 0x00, 0x00, 0x00, 0x00, // 54
0x02, 0xC2, 0x3A, 0x06, 0x00, 0x00, 0x00, 0x00, // 55
0x6C, 0x92, 0x92, 0x6C, 0x00, 0x00, 0x00, 0x00, // 56
0x9C, 0x92, 0xD2, 0x7C, 0x00, 0x00, 0x00, 0x00, // 57
0x88, 0x00, // 58
0x88, 0x40, // 59
0x20, 0x20, 0x50, 0x50, 0x50, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 60
0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 61
0x88, 0x50, 0x50, 0x50, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 62
0x02, 0xB2, 0x0A, 0x06, 0x00, 0x00, 0x00, 0x00, // 63
0x78, 0x84, 0x32, 0x4A, 0x4A, 0xFA, 0x44, 0x38, 0x00, 0x00, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, // 64
0xC0, 0x38, 0x26, 0x26, 0x38, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 65
0xFE, 0x92, 0x92, 0x92, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, // 66
0x7C, 0xC6, 0x82, 0x82, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, // 67
0xFE, 0x82, 0x82, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, // 68
0xFE, 0x92, 0x92, 0x92, 0x00, 0x00, 0x00, 0x00, // 69
0xFE, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, // 70
0x7C, 0xC6, 0x82, 0x92, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, // 71
0xFE, 0x10, 0x10, 0x10, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, // 72
0xFE, 0x00, // 73
0x00, 0xFE, 0x80, 0x40, // 74
0xFE, 0x10, 0x28, 0x44, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, // 75
0xFE, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, // 76
0xFE, 0x0C, 0x30, 0x30, 0x0C, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 77
0xFE, 0x0C, 0x10, 0x60, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, // 78
0x7C, 0xC6, 0x82, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, // 79
0xFE, 0x12, 0x12, 0x0C, 0x00, 0x00, 0x00, 0x00, // 80
0x7C, 0xC6, 0x82, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x40, 0x00, // 81
0xFE, 0x12, 0x32, 0x4E, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, // 82
0x4C, 0x92, 0x92, 0x92, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, // 83
0x02, 0x02, 0xFE, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, // 84
0x7E, 0x80, 0x80, 0x80, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, // 85
0x06, 0x38, 0xC0, 0xC0, 0x38, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 86
0x06, 0x38, 0xE0, 0x1E, 0xE0, 0x38, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 87
0x82, 0x46, 0x38, 0x38, 0xC6, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 88
0x02, 0x0C, 0xF0, 0x0C, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, // 89
0xC2, 0xA2, 0x92, 0x8A, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, // 90
0xFE, 0x02, 0x40, 0x40, // 91
0x06, 0x38, 0xC0, 0x00, 0x00, 0x00, // 92
0x02, 0xFE, 0x40, 0x40, // 93
0x04, 0x02, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, // 94
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, // 95
0x01, 0x02, 0x00, 0x00, // 96
0xE0, 0xA8, 0xA8, 0xF8, 0x00, 0x00, 0x00, 0x00, // 97
0xFF, 0x88, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00, // 98
0x70, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00, // 99
0x70, 0x88, 0x88, 0xFF, 0x00, 0x00, 0x00, 0x00, // 100
0x70, 0xA8, 0xA8, 0xB0, 0x00, 0x00, 0x00, 0x00, // 101
0x08, 0xFF, 0x09, 0x00, 0x00, 0x00, // 102
0x70, 0x88, 0x88, 0xF8, 0x00, 0x80, 0x80, 0x40, // 103
0xFF, 0x08, 0x08, 0xF8, 0x00, 0x00, 0x00, 0x00, // 104
0xFA, 0x00, // 105
0x00, 0xFA, 0x80, 0xC0, // 106
0xFF, 0x20, 0x50, 0x88, 0x00, 0x00, 0x00, 0x00, // 107
0xFF, 0x00, // 108
0xF8, 0x08, 0x08, 0xF8, 0x08, 0x08, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 109
0xF8, 0x08, 0x08, 0xF8, 0x00, 0x00, 0x00, 0x00, // 110
0x70, 0x88, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00, // 111
0xF8, 0x88, 0x88, 0x70, 0xC0, 0x00, 0x00, 0x00, // 112
0x70, 0x88, 0x88, 0xF8, 0x00, 0x00, 0x00, 0xC0, // 113
0xF8, 0x08, 0x08, 0x00, 0x00, 0x00, // 114
0x98, 0xA8, 0xE8, 0x00, 0x00, 0x00, // 115
0x08, 0xFC, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00, // 116
0xF8, 0x80, 0x80, 0xF8, 0x00, 0x00, 0x00, 0x00, // 117
0x18, 0x60, 0x80, 0x60, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, // 118
0x38, 0xC0, 0x30, 0x08, 0x30, 0xC0, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 119
0x88, 0x50, 0x20, 0x50, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, // 120
0x18, 0x60, 0x80, 0x60, 0x18, 0x80, 0x80, 0x40, 0x00, 0x00, // 121
0x88, 0xC8, 0xA8, 0x98, 0x00, 0x00, 0x00, 0x00, // 122
0x10, 0xEE, 0x02, 0x00, 0x40, 0x40, // 123
0xFE, 0xC0, // 124
0x02, 0xEE, 0x10, 0x40, 0x40, 0x00, // 125
0x20, 0x10, 0x10, 0x20, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 126
0xFC, 0x04, 0x04, 0x04, 0xFC, 0xC0, 0x80, 0x80, 0x80, 0xC0 // 127
};
#endif

View File

@ -1,166 +0,0 @@
/*
*
* DejaVuSansBold9
*
* created with FontCreator
* written by F. Maximilian Thiele
*
* http://www.apetech.de/fontCreator
* me@apetech.de
*
* File Name : DejaVuSansBold9.h
* Date : 28.05.2012
* Font size in bytes : 4662
* Font width : 10
* Font height : 10
* Font first char : 32
* Font last char : 128
* Font used chars : 96
*
* The font data are defined as
*
* struct _FONT_ {
* uint16_t font_Size_in_Bytes_over_all_included_Size_it_self;
* uint8_t font_Width_in_Pixel_for_fixed_drawing;
* uint8_t font_Height_in_Pixel_for_all_characters;
* unit8_t font_First_Char;
* uint8_t font_Char_Count;
*
* uint8_t font_Char_Widths[font_Last_Char - font_First_Char +1];
* // for each character the separate width in pixels,
* // characters < 128 have an implicit virtual right empty row
*
* uint8_t font_data[];
* // bit field of all characters
*/
#include <inttypes.h>
#include <avr/pgmspace.h>
#ifndef DEJAVUSANSBOLD9_H
#define DEJAVUSANSBOLD9_H
#define DEJAVUSANSBOLD9_WIDTH 10
#define DEJAVUSANSBOLD9_HEIGHT 10
static uint8_t const DejaVuSansBold9[] PROGMEM = {
0x12, 0x36, // size
0x0A, // width
0x0A, // height
0x20, // first char
0x60, // char count
// char widths
0x00, 0x02, 0x03, 0x06, 0x05, 0x08, 0x07, 0x01, 0x03, 0x03,
0x05, 0x05, 0x02, 0x03, 0x02, 0x03, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x02, 0x02, 0x06, 0x06,
0x06, 0x04, 0x08, 0x07, 0x05, 0x06, 0x06, 0x05, 0x05, 0x06,
0x07, 0x02, 0x03, 0x06, 0x05, 0x07, 0x06, 0x06, 0x05, 0x06,
0x06, 0x05, 0x06, 0x06, 0x07, 0x09, 0x07, 0x06, 0x06, 0x03,
0x03, 0x03, 0x04, 0x05, 0x02, 0x05, 0x05, 0x04, 0x05, 0x05,
0x04, 0x05, 0x05, 0x02, 0x03, 0x05, 0x02, 0x08, 0x05, 0x05,
0x05, 0x05, 0x03, 0x04, 0x03, 0x05, 0x06, 0x08, 0x06, 0x06,
0x04, 0x04, 0x01, 0x04, 0x06, 0x05,
// font data
0xDE, 0xDE, 0x00, 0x00, // 33
0x06, 0x00, 0x06, 0x00, 0x00, 0x00, // 34
0x28, 0xF8, 0x2E, 0xF8, 0x2E, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 35
0x98, 0xB4, 0xFE, 0xB4, 0x64, 0x00, 0x00, 0x40, 0x00, 0x00, // 36
0x0C, 0x12, 0xD2, 0x7C, 0x78, 0x96, 0x90, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 37
0x60, 0xFC, 0x9E, 0xB2, 0x62, 0xE0, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 38
0x06, 0x00, // 39
0x3C, 0xFF, 0x81, 0x00, 0x00, 0x00, // 40
0x81, 0xFF, 0x3C, 0x00, 0x00, 0x00, // 41
0x14, 0x18, 0x3E, 0x18, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, // 42
0x20, 0x20, 0xF8, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // 43
0xC0, 0xC0, 0x40, 0x00, // 44
0x20, 0x20, 0x20, 0x00, 0x00, 0x00, // 45
0xC0, 0xC0, 0x00, 0x00, // 46
0xC0, 0x38, 0x06, 0x00, 0x00, 0x00, // 47
0x7C, 0xFE, 0x82, 0xFE, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, // 48
0x82, 0x82, 0xFE, 0xFE, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, // 49
0xC2, 0xE2, 0xB2, 0x9E, 0x8C, 0x00, 0x00, 0x00, 0x00, 0x00, // 50
0x82, 0x92, 0x92, 0xFE, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, // 51
0x60, 0x58, 0x44, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, // 52
0x9E, 0x9E, 0x92, 0xF2, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, // 53
0x7C, 0xFE, 0x96, 0xF2, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, // 54
0x82, 0xE2, 0x7A, 0x1E, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, // 55
0x6C, 0xEE, 0x92, 0xEE, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, // 56
0x8C, 0x9E, 0xD2, 0xFE, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, // 57
0xD8, 0xD8, 0x00, 0x00, // 58
0xD8, 0xD8, 0x40, 0x00, // 59
0x20, 0x50, 0x50, 0x50, 0xD8, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 60
0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 61
0x88, 0xD8, 0x50, 0x50, 0x50, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 62
0x02, 0xDA, 0xDE, 0x0E, 0x00, 0x00, 0x00, 0x00, // 63
0x78, 0x84, 0x32, 0x4A, 0x4A, 0xFA, 0x44, 0x38, 0x00, 0x00, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, // 64
0x80, 0xF0, 0x7E, 0x4E, 0x7E, 0xF0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 65
0xFE, 0xFE, 0x92, 0xFE, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, // 66
0x38, 0x7C, 0xC6, 0x82, 0x82, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 67
0xFE, 0xFE, 0x82, 0x82, 0xFE, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 68
0xFE, 0xFE, 0x92, 0x92, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, // 69
0xFE, 0xFE, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, // 70
0x78, 0xFC, 0x86, 0x92, 0xF2, 0xF6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 71
0xFE, 0xFE, 0x10, 0x10, 0x10, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 72
0xFE, 0xFE, 0x00, 0x00, // 73
0x00, 0xFE, 0xFE, 0x80, 0xC0, 0x40, // 74
0xFE, 0xFE, 0x38, 0x6C, 0xC6, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 75
0xFE, 0xFE, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, // 76
0xFE, 0xFE, 0x0C, 0x30, 0x0C, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 77
0xFE, 0xFE, 0x0C, 0x30, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 78
0x7C, 0xFE, 0x82, 0x82, 0xFE, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 79
0xFE, 0xFE, 0x12, 0x1E, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, // 80
0x7C, 0xFE, 0x82, 0x82, 0xFE, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, // 81
0xFE, 0xFE, 0x12, 0x7E, 0xEC, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 82
0xCC, 0x9E, 0x92, 0xF2, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, // 83
0x02, 0x02, 0xFE, 0xFE, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 84
0x7E, 0xFE, 0x80, 0x80, 0xFE, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 85
0x02, 0x1E, 0xF8, 0xC0, 0xF8, 0x1E, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 86
0x0E, 0xFE, 0xE0, 0x3C, 0x06, 0x3C, 0xE0, 0xFE, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 87
0x82, 0xC6, 0x7C, 0x10, 0x7C, 0xC6, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 88
0x06, 0x0E, 0xF8, 0xF8, 0x0E, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 89
0xC2, 0xE2, 0xB2, 0x9A, 0x8E, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 90
0xFF, 0xFF, 0x81, 0x00, 0x00, 0x00, // 91
0x06, 0x38, 0xC0, 0x00, 0x00, 0x00, // 92
0x81, 0xFF, 0xFF, 0x00, 0x00, 0x00, // 93
0x04, 0x02, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, // 94
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, // 95
0x01, 0x02, 0x00, 0x00, // 96
0xE8, 0xE8, 0xA8, 0xF8, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, // 97
0xFF, 0xFF, 0x88, 0xF8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, // 98
0x70, 0xF8, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00, // 99
0x70, 0xF8, 0x88, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, // 100
0x70, 0xF8, 0xA8, 0xB8, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x00, // 101
0x08, 0xFE, 0xFF, 0x09, 0x00, 0x00, 0x00, 0x00, // 102
0x70, 0xF8, 0x88, 0xF8, 0xF8, 0x00, 0x80, 0x80, 0xC0, 0x40, // 103
0xFF, 0xFF, 0x08, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, // 104
0xFB, 0xFB, 0x00, 0x00, // 105
0x00, 0xFB, 0xFB, 0x80, 0xC0, 0x40, // 106
0xFF, 0xFF, 0x70, 0xD8, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, // 107
0xFF, 0xFF, 0x00, 0x00, // 108
0xF8, 0xF8, 0x08, 0xF8, 0xF8, 0x08, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 109
0xF8, 0xF8, 0x08, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, // 110
0x70, 0xF8, 0x88, 0xF8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, // 111
0xF8, 0xF8, 0x88, 0xF8, 0x70, 0xC0, 0xC0, 0x00, 0x00, 0x00, // 112
0x70, 0xF8, 0x88, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0xC0, 0xC0, // 113
0xF8, 0xF8, 0x08, 0x00, 0x00, 0x00, // 114
0xB0, 0xB8, 0xE8, 0x68, 0x00, 0x00, 0x00, 0x00, // 115
0xFC, 0xFC, 0x88, 0x00, 0x00, 0x00, // 116
0xF8, 0xF8, 0x80, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, // 117
0x18, 0x78, 0xC0, 0xC0, 0x78, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 118
0x18, 0xF8, 0xE0, 0x38, 0x38, 0xE0, 0xF8, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 119
0x88, 0xD8, 0x70, 0x70, 0xD8, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 120
0x08, 0x38, 0xE0, 0xE0, 0x38, 0x08, 0x00, 0x80, 0xC0, 0x00, 0x00, 0x00, // 121
0xC8, 0xE8, 0xB8, 0x98, 0x00, 0x00, 0x00, 0x00, // 122
0x08, 0xFF, 0xF7, 0x81, 0x00, 0x00, 0x00, 0x00, // 123
0xFE, 0xC0, // 124
0x81, 0xF7, 0xFF, 0x08, 0x00, 0x00, 0x00, 0x00, // 125
0x20, 0x10, 0x10, 0x20, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 126
0xFC, 0x04, 0x04, 0x04, 0xFC, 0xC0, 0x80, 0x80, 0x80, 0xC0 // 127
};
#endif

View File

@ -1,166 +0,0 @@
/*
*
* DejaVuSansItalic9
*
* created with FontCreator
* written by F. Maximilian Thiele
*
* http://www.apetech.de/fontCreator
* me@apetech.de
*
* File Name : DejaVuSansItalic9.h
* Date : 28.05.2012
* Font size in bytes : 4572
* Font width : 10
* Font height : 10
* Font first char : 32
* Font last char : 128
* Font used chars : 96
*
* The font data are defined as
*
* struct _FONT_ {
* uint16_t font_Size_in_Bytes_over_all_included_Size_it_self;
* uint8_t font_Width_in_Pixel_for_fixed_drawing;
* uint8_t font_Height_in_Pixel_for_all_characters;
* unit8_t font_First_Char;
* uint8_t font_Char_Count;
*
* uint8_t font_Char_Widths[font_Last_Char - font_First_Char +1];
* // for each character the separate width in pixels,
* // characters < 128 have an implicit virtual right empty row
*
* uint8_t font_data[];
* // bit field of all characters
*/
#include <inttypes.h>
#include <avr/pgmspace.h>
#ifndef DEJAVUSANSITALIC9_H
#define DEJAVUSANSITALIC9_H
#define DEJAVUSANSITALIC9_WIDTH 10
#define DEJAVUSANSITALIC9_HEIGHT 10
static uint8_t const DejaVuSansItalic9[] PROGMEM = {
0x11, 0xDC, // size
0x0A, // width
0x0A, // height
0x20, // first char
0x60, // char count
// char widths
0x00, 0x03, 0x03, 0x06, 0x04, 0x07, 0x06, 0x01, 0x03, 0x03,
0x05, 0x05, 0x01, 0x03, 0x01, 0x03, 0x05, 0x04, 0x05, 0x05,
0x05, 0x05, 0x04, 0x05, 0x05, 0x05, 0x02, 0x02, 0x06, 0x06,
0x06, 0x04, 0x08, 0x06, 0x05, 0x06, 0x06, 0x05, 0x05, 0x06,
0x07, 0x03, 0x03, 0x06, 0x04, 0x08, 0x07, 0x06, 0x05, 0x06,
0x05, 0x06, 0x05, 0x06, 0x05, 0x08, 0x06, 0x05, 0x06, 0x04,
0x02, 0x04, 0x04, 0x05, 0x02, 0x05, 0x05, 0x04, 0x06, 0x05,
0x03, 0x05, 0x05, 0x03, 0x03, 0x05, 0x03, 0x08, 0x05, 0x05,
0x05, 0x05, 0x04, 0x04, 0x03, 0x05, 0x05, 0x07, 0x05, 0x05,
0x05, 0x04, 0x01, 0x05, 0x06, 0x05,
// font data
0x80, 0x38, 0x06, 0x00, 0x00, 0x00, // 33
0x06, 0x00, 0x06, 0x00, 0x00, 0x00, // 34
0x20, 0xF8, 0x2E, 0xF8, 0x2E, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 35
0x98, 0xDC, 0xA6, 0x64, 0x00, 0x40, 0x00, 0x00, // 36
0x1C, 0xD2, 0x2E, 0x10, 0xEC, 0x92, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 37
0x60, 0x9C, 0x92, 0xA2, 0x64, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 38
0x06, 0x00, // 39
0xF8, 0x06, 0x01, 0x00, 0x00, 0x00, // 40
0x80, 0x61, 0x1E, 0x00, 0x00, 0x00, // 41
0x12, 0x0C, 0x1E, 0x0C, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, // 42
0x20, 0x20, 0xF8, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, // 43
0x80, 0x00, // 44
0x20, 0x20, 0x20, 0x00, 0x00, 0x00, // 45
0x80, 0x00, // 46
0x60, 0x30, 0x0C, 0x00, 0x00, 0x00, // 47
0x78, 0x84, 0x82, 0x42, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, // 48
0x80, 0x82, 0xF2, 0x8E, 0x00, 0x00, 0x00, 0x00, // 49
0x80, 0xC4, 0xA2, 0x92, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, // 50
0x40, 0x84, 0x92, 0x92, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, // 51
0x40, 0x70, 0xC8, 0x7C, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, // 52
0x80, 0x9C, 0x92, 0x92, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, // 53
0x78, 0x94, 0x92, 0x72, 0x00, 0x00, 0x00, 0x00, // 54
0x82, 0x42, 0x32, 0x0E, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, // 55
0x60, 0xAC, 0x92, 0x92, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, // 56
0x80, 0x9C, 0x92, 0x72, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, // 57
0x80, 0x08, 0x00, 0x00, // 58
0x80, 0x08, 0x00, 0x00, // 59
0x20, 0x20, 0x50, 0x50, 0x50, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 60
0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 61
0x88, 0x50, 0x50, 0x50, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 62
0x82, 0x32, 0x0A, 0x06, 0x00, 0x00, 0x00, 0x00, // 63
0xE0, 0x18, 0xE8, 0x94, 0x94, 0xF4, 0xCC, 0x78, 0x40, 0xC0, 0x80, 0x80, 0x80, 0x40, 0x00, 0x00, // 64
0x80, 0x60, 0x38, 0x24, 0x3E, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 65
0xC0, 0xB8, 0x96, 0x92, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, // 66
0x78, 0x84, 0x82, 0x82, 0x82, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 67
0xC0, 0xB8, 0x86, 0x82, 0x42, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 68
0xC0, 0xB8, 0x96, 0x92, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, // 69
0xC0, 0x38, 0x16, 0x12, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, // 70
0x78, 0x84, 0x82, 0x82, 0x92, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 71
0xC0, 0x38, 0x16, 0x10, 0xD0, 0x38, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 72
0xC0, 0x38, 0x06, 0x00, 0x00, 0x00, // 73
0x00, 0xF0, 0x0E, 0xC0, 0x00, 0x00, // 74
0xC0, 0x38, 0x16, 0x68, 0x84, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 75
0xC0, 0xB8, 0x86, 0x80, 0x00, 0x00, 0x00, 0x00, // 76
0xC0, 0x38, 0x06, 0x38, 0x10, 0xC8, 0x3C, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 77
0xC0, 0x38, 0x06, 0x38, 0xC0, 0x38, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 78
0x78, 0x84, 0x82, 0x82, 0x42, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 79
0xC0, 0x38, 0x16, 0x12, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, // 80
0x78, 0x84, 0x82, 0x82, 0x42, 0x3C, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, // 81
0xC0, 0x38, 0x16, 0x72, 0x8E, 0x00, 0x00, 0x00, 0x00, 0x00, // 82
0x40, 0x8C, 0x92, 0x92, 0x62, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 83
0x02, 0xC2, 0x3A, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, // 84
0x78, 0x86, 0x80, 0x80, 0x78, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 85
0x0E, 0xF0, 0x40, 0x30, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, // 86
0xFE, 0x60, 0x1C, 0x02, 0xFE, 0x60, 0x1C, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 87
0x80, 0x42, 0x2C, 0x10, 0x6C, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 88
0x02, 0xCC, 0x30, 0x0C, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, // 89
0x80, 0xC2, 0xA2, 0x92, 0x8A, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 90
0xC0, 0xBC, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, // 91
0x1E, 0xE0, 0x00, 0x00, // 92
0x80, 0xC0, 0x3D, 0x03, 0x00, 0x00, 0x00, 0x00, // 93
0x04, 0x02, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, // 94
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, // 95
0x01, 0x02, 0x00, 0x00, // 96
0xC0, 0xA8, 0xA8, 0xE8, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, // 97
0xC0, 0x7C, 0x93, 0x88, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, // 98
0xF0, 0x98, 0x88, 0x08, 0x00, 0x00, 0x00, 0x00, // 99
0xF0, 0x98, 0x88, 0xC8, 0x3C, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 100
0x70, 0xB8, 0xA8, 0xA8, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, // 101
0xC8, 0x3E, 0x09, 0x00, 0x00, 0x00, // 102
0xF0, 0x98, 0x88, 0xC8, 0x38, 0x80, 0x80, 0x80, 0x40, 0x00, // 103
0xC0, 0x3C, 0x13, 0xC8, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, // 104
0xE0, 0x38, 0x01, 0x00, 0x00, 0x00, // 105
0xC0, 0x38, 0x01, 0xC0, 0x00, 0x00, // 106
0xC0, 0x3C, 0x23, 0xD0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, // 107
0xC0, 0x3C, 0x03, 0x00, 0x00, 0x00, // 108
0xE0, 0x18, 0x08, 0xC8, 0x78, 0x10, 0xC8, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 109
0xE0, 0x38, 0x08, 0xC8, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, // 110
0x70, 0x98, 0x88, 0xC8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, // 111
0xE0, 0x98, 0x88, 0xC8, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, // 112
0xF0, 0x88, 0x88, 0xF0, 0x18, 0x00, 0x00, 0xC0, 0x00, 0x00, // 113
0xE0, 0x38, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, // 114
0x80, 0xB8, 0xA8, 0xE8, 0x00, 0x00, 0x00, 0x00, // 115
0xF8, 0x8C, 0x08, 0x00, 0x00, 0x00, // 116
0xE0, 0x98, 0x80, 0xE0, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, // 117
0x38, 0xC0, 0x60, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, // 118
0xF8, 0x60, 0x10, 0xF8, 0x40, 0x30, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 119
0x80, 0x48, 0x30, 0x50, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, // 120
0x00, 0xF8, 0x60, 0x10, 0x08, 0x80, 0x40, 0x00, 0x00, 0x00, // 121
0x80, 0xC8, 0xA8, 0x98, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, // 122
0x08, 0xF8, 0x87, 0x01, 0x00, 0x00, 0x00, 0x00, // 123
0xFE, 0xC0, // 124
0x80, 0x80, 0x71, 0x0F, 0x08, 0x00, 0x00, 0x40, 0x00, 0x00, // 125
0x20, 0x10, 0x10, 0x20, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 126
0xFC, 0x04, 0x04, 0x04, 0xFC, 0xC0, 0x80, 0x80, 0x80, 0xC0 // 127
};
#endif

View File

@ -1,155 +0,0 @@
/*
*
* Mono5x7
*
* created with FontCreator
* written by F. Maximilian Thiele
*
* http://www.apetech.de/fontCreator
* me@apetech.de
*
* File Name : Mono5x7.h
* Date : 29.05.2012
* Font size in bytes : 3462
* Font width : 5
* Font height : 7
* Font first char : 32
* Font last char : 128
* Font used chars : 96
*
* The font data are defined as
*
* struct _FONT_ {
* uint16_t font_Size_in_Bytes_over_all_included_Size_it_self;
* uint8_t font_Width_in_Pixel_for_fixed_drawing;
* uint8_t font_Height_in_Pixel_for_all_characters;
* unit8_t font_First_Char;
* uint8_t font_Char_Count;
*
* uint8_t font_Char_Widths[font_Last_Char - font_First_Char +1];
* // for each character the separate width in pixels,
* // characters < 128 have an implicit virtual right empty row
*
* uint8_t font_data[];
* // bit field of all characters
*/
#include <inttypes.h>
#include <avr/pgmspace.h>
#ifndef MONO5X7_H
#define MONO5X7_H
#define MONO5X7_WIDTH 5
#define MONO5X7_HEIGHT 7
static uint8_t const Mono5x7[] PROGMEM = {
0x00, 0x00, // size
0x05, // width
0x07, // height
0x20, // first char
0x60, // char count
// font data
0x00, 0x00, 0x00, 0x00, 0x00, // 32
0x00, 0x00, 0x5F, 0x00, 0x00, // 33
0x00, 0x07, 0x00, 0x07, 0x00, // 34
0x14, 0x7F, 0x14, 0x7F, 0x14, // 35
0x24, 0x2A, 0x7F, 0x2A, 0x12, // 36
0x23, 0x13, 0x08, 0x64, 0x62, // 37
0x36, 0x49, 0x55, 0x22, 0x50, // 38
0x00, 0x05, 0x03, 0x00, 0x00, // 39
0x00, 0x1C, 0x22, 0x41, 0x00, // 40
0x00, 0x41, 0x22, 0x1C, 0x00, // 41
0x14, 0x08, 0x3E, 0x08, 0x14, // 42
0x08, 0x08, 0x3E, 0x08, 0x08, // 43
0x00, 0x50, 0x30, 0x00, 0x00, // 44
0x08, 0x08, 0x08, 0x08, 0x08, // 45
0x00, 0x60, 0x60, 0x00, 0x00, // 46
0x20, 0x10, 0x08, 0x04, 0x02, // 47
0x3E, 0x51, 0x49, 0x45, 0x3E, // 48
0x00, 0x42, 0x7F, 0x40, 0x00, // 49
0x42, 0x61, 0x51, 0x49, 0x46, // 50
0x21, 0x41, 0x45, 0x4B, 0x31, // 51
0x18, 0x14, 0x12, 0x7F, 0x10, // 52
0x27, 0x45, 0x45, 0x45, 0x39, // 53
0x3C, 0x4A, 0x49, 0x49, 0x30, // 54
0x01, 0x71, 0x09, 0x05, 0x03, // 55
0x36, 0x49, 0x49, 0x49, 0x36, // 56
0x06, 0x49, 0x49, 0x29, 0x1E, // 57
0x00, 0x36, 0x36, 0x00, 0x00, // 58
0x00, 0x56, 0x36, 0x00, 0x00, // 59
0x08, 0x14, 0x22, 0x41, 0x00, // 60
0x14, 0x14, 0x14, 0x14, 0x14, // 61
0x00, 0x41, 0x22, 0x14, 0x08, // 62
0x02, 0x01, 0x51, 0x09, 0x06, // 63
0x32, 0x49, 0x79, 0x41, 0x3E, // 64
0x7E, 0x11, 0x11, 0x11, 0x7E, // 65
0x7F, 0x49, 0x49, 0x49, 0x36, // 66
0x3E, 0x41, 0x41, 0x41, 0x22, // 67
0x7F, 0x41, 0x41, 0x22, 0x1C, // 68
0x7F, 0x49, 0x49, 0x49, 0x41, // 69
0x7F, 0x09, 0x09, 0x09, 0x01, // 70
0x3E, 0x41, 0x49, 0x49, 0x78, // 71
0x7F, 0x08, 0x08, 0x08, 0x7F, // 72
0x00, 0x41, 0x7F, 0x41, 0x00, // 73
0x20, 0x40, 0x41, 0x3F, 0x01, // 74
0x7F, 0x08, 0x14, 0x22, 0x41, // 75
0x7F, 0x40, 0x40, 0x40, 0x40, // 76
0x7F, 0x02, 0x0C, 0x02, 0x7F, // 77
0x7F, 0x04, 0x08, 0x10, 0x7F, // 78
0x3E, 0x41, 0x41, 0x41, 0x3E, // 79
0x7F, 0x09, 0x09, 0x09, 0x06, // 80
0x3E, 0x41, 0x51, 0x21, 0x5E, // 81
0x7F, 0x09, 0x19, 0x29, 0x46, // 82
0x46, 0x49, 0x49, 0x49, 0x31, // 83
0x01, 0x01, 0x7F, 0x01, 0x01, // 84
0x3F, 0x40, 0x40, 0x40, 0x3F, // 85
0x1F, 0x20, 0x40, 0x20, 0x1F, // 86
0x3F, 0x40, 0x38, 0x40, 0x3F, // 87
0x63, 0x14, 0x08, 0x14, 0x63, // 88
0x07, 0x08, 0x70, 0x08, 0x07, // 89
0x61, 0x51, 0x49, 0x45, 0x43, // 90
0x00, 0x7F, 0x41, 0x41, 0x00, // 91
0x02, 0x04, 0x08, 0x10, 0x20, // 92
0x00, 0x41, 0x41, 0x7F, 0x00, // 93
0x04, 0x02, 0x01, 0x02, 0x04, // 94
0x40, 0x40, 0x40, 0x40, 0x40, // 95
0x00, 0x02, 0x04, 0x08, 0x00, // 96
0x20, 0x54, 0x54, 0x54, 0x78, // 97
0x7F, 0x48, 0x44, 0x44, 0x38, // 98
0x38, 0x44, 0x44, 0x44, 0x20, // 99
0x38, 0x44, 0x44, 0x48, 0x7F, // 100
0x38, 0x54, 0x54, 0x54, 0x18, // 101
0x08, 0x7E, 0x09, 0x01, 0x02, // 102
0x0C, 0x52, 0x52, 0x52, 0x3E, // 103
0x7F, 0x08, 0x04, 0x04, 0x78, // 104
0x00, 0x44, 0x7D, 0x40, 0x00, // 105
0x20, 0x40, 0x44, 0x3D, 0x00, // 106
0x7F, 0x10, 0x28, 0x44, 0x00, // 107
0x00, 0x41, 0x7F, 0x40, 0x00, // 108
0x7C, 0x04, 0x18, 0x04, 0x78, // 109
0x7C, 0x08, 0x04, 0x04, 0x78, // 110
0x38, 0x44, 0x44, 0x44, 0x38, // 111
0x7C, 0x14, 0x14, 0x14, 0x08, // 112
0x08, 0x14, 0x14, 0x18, 0x7C, // 113
0x7C, 0x08, 0x04, 0x04, 0x08, // 114
0x48, 0x54, 0x54, 0x54, 0x20, // 115
0x04, 0x3F, 0x44, 0x40, 0x00, // 116
0x3C, 0x40, 0x40, 0x20, 0x7C, // 117
0x1C, 0x20, 0x40, 0x20, 0x1C, // 118
0x3C, 0x40, 0x30, 0x40, 0x3C, // 119
0x44, 0x28, 0x10, 0x28, 0x44, // 120
0x0C, 0x50, 0x50, 0x50, 0x3C, // 121
0x44, 0x64, 0x54, 0x4C, 0x44, // 122
0x00, 0x08, 0x36, 0x41, 0x00, // 123
0x00, 0x00, 0x7F, 0x00, 0x00, // 124
0x00, 0x41, 0x36, 0x08, 0x00, // 125
0x08, 0x04, 0x08, 0x10, 0x08, // 126
0x00, 0x00, 0x00, 0x00, 0x00 // 127
};
#endif

View File

@ -1,36 +0,0 @@
#FIG 3.2 Produced by xfig version 3.2.5b
Landscape
Center
Metric
A4
100.00
Single
-2
1200 2
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
3375 2700 4500 2700 4500 3375 3375 3375 3375 2700
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
4950 2700 6075 2700 6075 3375 4950 3375 4950 2700
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
6525 2700 7650 2700 7650 3375 6525 3375 6525 2700
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
8100 2700 9225 2700 9225 3375 8100 3375 8100 2700
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 60.00 120.00
4950 3060 4500 3060
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 60.00 120.00
6525 3060 6075 3060
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 60.00 120.00
8100 3060 7650 3060
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 60.00 120.00
9900 3060 9225 3060
2 2 0 1 0 26 50 -1 -1 0.000 1 0 -1 0 0 5
9900 2835 10800 2835 10800 3285 9900 3285 9900 2835
4 0 0 50 -1 0 12 0.0000 4 135 675 10035 3105 Arduino\001
4 0 0 50 -1 0 12 0.0000 4 135 600 8370 3105 Panel 4\001
4 0 0 50 -1 0 12 0.0000 4 135 600 6795 3105 Panel 3\001
4 0 0 50 -1 0 12 0.0000 4 135 600 5220 3105 Panel 2\001
4 0 0 50 -1 0 12 0.0000 4 135 600 3645 3105 Panel 1\001

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -1,60 +0,0 @@
#FIG 3.2 Produced by xfig version 3.2.5b
Landscape
Center
Metric
A4
100.00
Single
-2
1200 2
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 60.00 120.00
9900 3060 9225 3060
2 2 0 1 0 26 50 -1 -1 0.000 1 0 -1 0 0 5
9900 2835 10800 2835 10800 3285 9900 3285 9900 2835
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
3375 1575 4500 1575 4500 2250 3375 2250 3375 1575
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
4950 1575 6075 1575 6075 2250 4950 2250 4950 1575
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
8100 1575 9225 1575 9225 2250 8100 2250 8100 1575
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 60.00 120.00
7650 1935 8100 1935
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
6525 1575 7650 1575 7650 2250 6525 2250 6525 1575
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 60.00 120.00
6075 1935 6525 1935
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 60.00 120.00
4500 1935 4950 1935
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 4
1 1 3.00 60.00 120.00
3375 3015 2925 3015 2925 1890 3375 1890
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
3375 2700 4500 2700 4500 3375 3375 3375 3375 2700
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
4950 2700 6075 2700 6075 3375 4950 3375 4950 2700
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
6525 2700 7650 2700 7650 3375 6525 3375 6525 2700
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
8100 2700 9225 2700 9225 3375 8100 3375 8100 2700
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 60.00 120.00
4950 3060 4500 3060
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 60.00 120.00
6525 3060 6075 3060
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 60.00 120.00
8100 3060 7650 3060
4 0 0 50 -1 0 12 0.0000 4 135 675 10035 3105 Arduino\001
4 0 0 50 -1 0 12 0.0000 4 135 600 8370 3105 Panel 8\001
4 0 0 50 -1 0 12 0.0000 4 135 600 6795 3105 Panel 7\001
4 0 0 50 -1 0 12 0.0000 4 135 600 5220 3105 Panel 6\001
4 0 0 50 -1 0 12 0.0000 4 135 600 3645 3105 Panel 5\001
4 0 0 50 -1 0 12 3.1416 4 135 600 4230 1845 Panel 4\001
4 0 0 50 -1 0 12 3.1416 4 135 600 5805 1845 Panel 3\001
4 0 0 50 -1 0 12 3.1416 4 135 600 7380 1845 Panel 2\001
4 0 0 50 -1 0 12 3.1416 4 135 600 8955 1845 Panel 1\001

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -1,84 +0,0 @@
#FIG 3.2 Produced by xfig version 3.2.5b
Landscape
Center
Metric
A4
100.00
Single
-2
1200 2
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 60.00 120.00
9900 3060 9225 3060
2 2 0 1 0 26 50 -1 -1 0.000 1 0 -1 0 0 5
9900 2835 10800 2835 10800 3285 9900 3285 9900 2835
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
3375 1575 4500 1575 4500 2250 3375 2250 3375 1575
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
4950 1575 6075 1575 6075 2250 4950 2250 4950 1575
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
8100 1575 9225 1575 9225 2250 8100 2250 8100 1575
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 60.00 120.00
7650 1935 8100 1935
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
6525 1575 7650 1575 7650 2250 6525 2250 6525 1575
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 60.00 120.00
6075 1935 6525 1935
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 60.00 120.00
4500 1935 4950 1935
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 4
1 1 3.00 60.00 120.00
3375 3015 2925 3015 2925 1890 3375 1890
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 4
1 1 3.00 60.00 120.00
9225 1890 9675 1890 9675 765 9225 765
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
3375 450 4500 450 4500 1125 3375 1125 3375 450
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
4950 450 6075 450 6075 1125 4950 1125 4950 450
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
6525 450 7650 450 7650 1125 6525 1125 6525 450
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
8100 450 9225 450 9225 1125 8100 1125 8100 450
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 60.00 120.00
4950 810 4500 810
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 60.00 120.00
6525 810 6075 810
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 60.00 120.00
8100 810 7650 810
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
3375 2700 4500 2700 4500 3375 3375 3375 3375 2700
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
4950 2700 6075 2700 6075 3375 4950 3375 4950 2700
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
6525 2700 7650 2700 7650 3375 6525 3375 6525 2700
2 2 0 1 0 7 50 -1 -1 0.000 1 0 -1 0 0 5
8100 2700 9225 2700 9225 3375 8100 3375 8100 2700
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 60.00 120.00
4950 3060 4500 3060
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 60.00 120.00
6525 3060 6075 3060
2 1 0 4 11 7 50 -1 -1 0.000 0 0 -1 1 0 2
1 1 3.00 60.00 120.00
8100 3060 7650 3060
4 0 0 50 -1 0 12 0.0000 4 135 675 10035 3105 Arduino\001
4 0 0 50 -1 0 12 0.0000 4 135 600 3645 3105 Panel 9\001
4 0 0 50 -1 0 12 0.0000 4 135 705 5175 3105 Panel 10\001
4 0 0 50 -1 0 12 0.0000 4 135 705 6750 3105 Panel 11\001
4 0 0 50 -1 0 12 0.0000 4 135 705 8325 3105 Panel 12\001
4 0 0 50 -1 0 12 3.1416 4 135 600 8955 1845 Panel 5\001
4 0 0 50 -1 0 12 3.1416 4 135 600 7380 1845 Panel 6\001
4 0 0 50 -1 0 12 3.1416 4 135 600 5805 1845 Panel 7\001
4 0 0 50 -1 0 12 3.1416 4 135 600 4230 1845 Panel 8\001
4 0 0 50 -1 0 12 0.0000 4 135 600 3645 855 Panel 1\001
4 0 0 50 -1 0 12 0.0000 4 135 600 5220 855 Panel 2\001
4 0 0 50 -1 0 12 0.0000 4 135 600 6795 855 Panel 3\001
4 0 0 50 -1 0 12 0.0000 4 135 600 8370 855 Panel 4\001

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -1,53 +0,0 @@
Description of the interface to the Freetronics Dot Matrix Display (DMD)
========================================================================
Pins:
D6: A - interleave phase select LSB
D7: B - interleave phase select MSB (set the MSB first)
D8: SCLK - this is the "latch" pin that copies all previously transferred
data from the shift register to the actual display. Normally low,
then flip to high and then low again to latch the data.
D9: nOE - Output enable (when low).
D10: Conflict detect (if it goes low, something else is using SPI)
This is the standard SPI SS - Slave select - pin.
D11: R - this is the standard SPI MOSI - Master out, slave in - pin.
D12: MISO - master in, slave out - unused
D13: CLK - standard Serial Clock pin for SPI
Initialisation:
SPI: bit order = MSB-first, data mode = 0, clock divider = 128
(use a smaller clock divider, such as 2, for better performance
when driving multiple displays)
Set A, B, CLK, SCLK, and nOE to LOW outputs
Set R to HIGH output
phase = 0
Every 5ms, do the following to refresh the display:
Send the bytes for 4 interleaved rows based on phase, via SPI:
phase == 0: 0, 4, 8, 12 (actually sent in the order 12, 8, 4, 0)
phase == 1: 1, 5, 9, 13
phase == 2: 2, 6, 10, 14
phase == 3: 3, 7, 11, 15
Then latch the data for the rows as follows:
Set nOE to LOW
Set SCLK to HIGH and then back to LOW
Set A and B to indicate the current phase
Set nOE to HIGH
Finally, increment the phase, wrapping around from 3 to 0
The above code assumes the following memory organisation:
The display is W panels wide and H panels high.
Each panel is 32 pixels wide (4 bytes) and 16 pixels high.
Memory is organised as W * H * 4 bytes for each row, and 16 rows.
That is, the 2D arrangement of panels is flattened into 1D for
clocking the data out.
In addition, a 1 bit in memory is a LED that is *off*.
Other things:
Multiple panels need to be daisy-chained in the order N, ..., 1 with N
plugged into the connector board on the Arduino and 1 at the end of
the daisy-chain. Because the shipped cables are short, multiple rows
can be oriented in alternating order with odd-numbered rows
(counting from 1) upside-down and reversed. More details here:
http://www.adebenham.com/category/arduino/dmd/

View File

@ -1,144 +0,0 @@
/*
This example demonstrates how to use the DMD and related classes to
draw things on a Freetronics Large Dot Matrix Display.
This example is placed into the public domain.
*/
#include <DMD.h>
#include <DejaVuSans9.h>
#include <DejaVuSansBold9.h>
#include <DejaVuSansItalic9.h>
#include <Mono5x7.h>
DMD display;
ISR(TIMER1_OVF_vect)
{
display.refresh();
}
void setup() {
display.enableTimer1();
}
void loop() {
drawShapes();
delay(1000);
drawBricks();
delay(1000);
drawStickFigures();
delay(1000);
drawText();
delay(1000);
drawBoldText();
delay(1000);
drawItalicText();
delay(1000);
drawMonoText();
delay(1000);
drawMarquee();
delay(500);
}
void drawShapes()
{
display.clear();
display.drawCircle(6, 8, 3);
display.drawFilledCircle(16, 8, 3);
display.drawLine(22, 5, 28, 11);
display.drawLine(28, 5, 22, 11);
display.drawRect(0, 0, display.width() - 1, display.height() - 1);
}
void drawBricks()
{
static const uint8_t bricks[] PROGMEM = {
16, 6,
B11111111, B11111111,
B10000000, B10000000,
B10000000, B10000000,
B11111111, B11111111,
B00001000, B00001000,
B00001000, B00001000
};
display.fill(0, 0, display.width(), display.height(), bricks);
}
void drawStickFigures()
{
static const uint8_t stickFigure[] PROGMEM = {
9, 13,
B00111110, B00000000,
B01000001, B00000000,
B01000001, B00000000,
B00111110, B00000000,
B00001000, B00000000,
B00001000, B00000000,
B11111111, B10000000,
B00001000, B00000000,
B00001000, B00000000,
B00010100, B00000000,
B00100010, B00000000,
B01000001, B00000000,
B10000000, B10000000
};
display.clear();
display.drawBitmap(2, 1, stickFigure);
display.drawInvertedBitmap(12, 1, stickFigure);
display.drawBitmap(22, 1, stickFigure);
}
void drawText()
{
display.clear();
display.setFont(DejaVuSans9);
display.drawText(0, 0, "Hello");
display.drawText(9, 8, "World");
}
void drawBoldText()
{
display.clear();
display.setFont(DejaVuSansBold9);
display.drawText(0, 0, "Hello");
display.drawText(4, 8, "World");
}
void drawItalicText()
{
display.clear();
display.setFont(DejaVuSansItalic9);
display.drawText(0, 0, "Hello");
display.drawText(2, 8, "World");
}
void drawMonoText()
{
display.clear();
display.setFont(Mono5x7);
display.drawText(0, 0, "Hello");
display.drawText(3, 8, "World");
}
static const char message[] = "Eat at Joes!";
void drawMarquee()
{
int width = display.width();
display.setFont(DejaVuSans9);
int msgWidth = display.textWidth(message);
int fullScroll = msgWidth + width + 1;
for (int x = 0; x < fullScroll; ++x) {
display.clear();
display.drawText(width - x, 3, message);
delay(50);
}
}

View File

@ -1,261 +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.
*/
#include <DMD.h>
DMD display;
// Running stick figure pictures are loosely based on those from this tutorial:
// http://www.fluidanims.com/FAelite/phpBB3/viewtopic.php?f=10&t=102
byte const run1[] PROGMEM = {
16, 16,
B00000000, B00001100,
B00000000, B00011110,
B00000111, B11111110,
B00001111, B11111110,
B00011100, B11111100,
B00000001, B11111100,
B00000001, B11110000,
B00000011, B11111000,
B00000111, B00011000,
B00001110, B01110000,
B00011100, B01100000,
B00111000, B00000000,
B01110000, B00000000,
B01100000, B00000000,
B01000000, B00000000,
B00000000, B00000000
};
byte const run2[] PROGMEM = {
18, 16,
B00000000, B01110011, B10000000,
B00000000, B11111111, B10000000,
B00000000, B00011111, B10000000,
B00000000, B00111111, B11000000,
B00000000, B01111011, B11000000,
B00000000, B11110011, B10000000,
B00000001, B11100000, B00000000,
B00000011, B11100000, B00000000,
B00000111, B01110000, B00000000,
B01111110, B00111000, B00000000,
B11111100, B00011100, B00000000,
B00000000, B00001110, B00000000,
B00000000, B00000111, B00000000,
B00000000, B00000011, B10000000,
B00000000, B00000001, B00000000,
B00000000, B00000000, B00000000
};
byte const run3[] PROGMEM = {
18, 16,
B00000000, B00110000, B00000000,
B00000000, B01111000, B00000000,
B00000000, B00011111, B00000000,
B00000000, B00011111, B00000000,
B00000000, B00111111, B10000000,
B00000000, B01111111, B11000000,
B00000000, B11100011, B10000000,
B00000001, B11000000, B00000000,
B00000011, B11100000, B00000000,
B11111111, B01110000, B00000000,
B11111110, B00111000, B00000000,
B00000000, B00011000, B00000000,
B00000000, B00011100, B00000000,
B00000000, B00001110, B00000000,
B00000000, B00000100, B00000000,
B00000000, B00000000, B00000000
};
byte const run4[] PROGMEM = {
16, 16,
B00000001, B11100000,
B00000011, B11111100,
B00000000, B00111110,
B00000000, B01111110,
B00000000, B11111100,
B00000001, B10011111,
B00000011, B00001110,
B00000011, B00000000,
B00000011, B10000000,
B11111111, B10000000,
B11111000, B11000000,
B00000001, B11000000,
B00000011, B10000000,
B00000111, B00000000,
B00000110, B00000000,
B00000100, B00000000
};
byte const run5[] PROGMEM = {
13, 16,
B00000000, B00000000,
B00000000, B00110000,
B00000111, B11111000,
B00000111, B11111000,
B00000111, B11110000,
B00001111, B11100000,
B00000111, B00000000,
B00001111, B00000000,
B00001111, B00000000,
B00001111, B10000000,
B00011100, B00000000,
B00111000, B00000000,
B01110000, B00000000,
B11100000, B00000000,
B11000000, B00000000,
B10000000, B00000000
};
byte const run6[] PROGMEM = {
16, 16,
B00000000, B00000000,
B00000000, B00011100,
B00000000, B00111110,
B00000001, B11111110,
B00000000, B11100000,
B00000001, B11100000,
B00000001, B11111000,
B00000011, B00011100,
B00000110, B00111000,
B00000110, B01110000,
B00001100, B00100000,
B00111000, B00000000,
B01100000, B00000000,
B11000000, B00000000,
B10000000, B00000000,
B10000000, B00000000
};
byte const run7[] PROGMEM = {
18, 16,
B00000000, B00000011, B10000000,
B00000000, B01111011, B10000000,
B00000000, B01111111, B10000000,
B00000000, B00001111, B00100000,
B00000000, B00011001, B11000000,
B00000000, B00110000, B11000000,
B00000000, B01110000, B00000000,
B00000001, B11110000, B00000000,
B11111111, B10111000, B00000000,
B11111111, B00011100, B00000000,
B00000000, B00001110, B00000000,
B00000000, B00000111, B00000000,
B00000000, B00000011, B10000000,
B00000000, B00000001, B11000000,
B00000000, B00000000, B01000000,
B00000000, B00000000, B00000000
};
byte const run8[] PROGMEM = {
18, 16,
B00000000, B00000110, B00000000,
B00000001, B11101111, B00000000,
B00000001, B11111111, B00000000,
B00000000, B00111110, B00000000,
B00000000, B01111111, B11000000,
B00000000, B11100011, B10000000,
B00000001, B11000000, B00000000,
B00000011, B11100000, B00000000,
B11111111, B01110000, B00000000,
B11111110, B00111000, B00000000,
B00000000, B00011100, B00000000,
B00000000, B00000110, B00000000,
B00000000, B00000110, B00000000,
B00000000, B00000111, B00000000,
B00000000, B00000011, B00000000,
B00000000, B00000001, B00000000
};
byte const run9[] PROGMEM = {
16, 16,
B00000000, B00000000,
B00000000, B01001110,
B00000001, B11101110,
B00000011, B11111110,
B00000011, B11111110,
B00000001, B10111100,
B00000011, B00000000,
B00000111, B00000000,
B11111111, B10000000,
B11111100, B11000000,
B00000000, B11000000,
B00000000, B11000000,
B00000000, B11000000,
B00000000, B11000000,
B00000000, B11000000,
B00000000, B11000000
};
byte const run10[] PROGMEM = {
13, 16,
B00000000, B00000000,
B00000000, B00110000,
B00000000, B01111000,
B00000111, B11111000,
B00001111, B11111000,
B00000111, B11000000,
B00001110, B00000000,
B00001100, B00000000,
B00001100, B00000000,
B01111100, B00000000,
B11111100, B00000000,
B00011000, B00000000,
B00110000, B00000000,
B01110000, B00000000,
B01100000, B00000000,
B01000000, B00000000
};
Bitmap::ProgMem frames[] = {
run1,
run2,
run3,
run4,
run5,
run6,
run7,
run8,
run9,
run10
};
#define NUM_FRAMES (sizeof(frames) / sizeof(frames[0]))
unsigned int frame = 0;
#define ADVANCE_MS (1000 / NUM_FRAMES)
unsigned long lastFrame;
void setup() {
lastFrame = millis() - ADVANCE_MS;
}
void loop() {
if ((millis() - lastFrame) >= ADVANCE_MS) {
display.clear();
int x = (32 - pgm_read_byte(frames[frame])) / 2;
display.drawBitmap(x, 0, frames[frame]);
lastFrame += ADVANCE_MS;
frame = (frame + 1) % NUM_FRAMES;
}
display.loop();
}

View File

@ -1,263 +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.
*/
#include <DMD.h>
DMD display;
// Running stick figure pictures are loosely based on those from this tutorial:
// http://www.fluidanims.com/FAelite/phpBB3/viewtopic.php?f=10&t=102
byte const run1[] PROGMEM = {
16, 16,
B00000000, B00001100,
B00000000, B00011110,
B00000111, B11111110,
B00001111, B11111110,
B00011100, B11111100,
B00000001, B11111100,
B00000001, B11110000,
B00000011, B11111000,
B00000111, B00011000,
B00001110, B01110000,
B00011100, B01100000,
B00111000, B00000000,
B01110000, B00000000,
B01100000, B00000000,
B01000000, B00000000,
B00000000, B00000000
};
byte const run2[] PROGMEM = {
18, 16,
B00000000, B01110011, B10000000,
B00000000, B11111111, B10000000,
B00000000, B00011111, B10000000,
B00000000, B00111111, B11000000,
B00000000, B01111011, B11000000,
B00000000, B11110011, B10000000,
B00000001, B11100000, B00000000,
B00000011, B11100000, B00000000,
B00000111, B01110000, B00000000,
B01111110, B00111000, B00000000,
B11111100, B00011100, B00000000,
B00000000, B00001110, B00000000,
B00000000, B00000111, B00000000,
B00000000, B00000011, B10000000,
B00000000, B00000001, B00000000,
B00000000, B00000000, B00000000
};
byte const run3[] PROGMEM = {
18, 16,
B00000000, B00110000, B00000000,
B00000000, B01111000, B00000000,
B00000000, B00011111, B00000000,
B00000000, B00011111, B00000000,
B00000000, B00111111, B10000000,
B00000000, B01111111, B11000000,
B00000000, B11100011, B10000000,
B00000001, B11000000, B00000000,
B00000011, B11100000, B00000000,
B11111111, B01110000, B00000000,
B11111110, B00111000, B00000000,
B00000000, B00011000, B00000000,
B00000000, B00011100, B00000000,
B00000000, B00001110, B00000000,
B00000000, B00000100, B00000000,
B00000000, B00000000, B00000000
};
byte const run4[] PROGMEM = {
16, 16,
B00000001, B11100000,
B00000011, B11111100,
B00000000, B00111110,
B00000000, B01111110,
B00000000, B11111100,
B00000001, B10011111,
B00000011, B00001110,
B00000011, B00000000,
B00000011, B10000000,
B11111111, B10000000,
B11111000, B11000000,
B00000001, B11000000,
B00000011, B10000000,
B00000111, B00000000,
B00000110, B00000000,
B00000100, B00000000
};
byte const run5[] PROGMEM = {
13, 16,
B00000000, B00000000,
B00000000, B00110000,
B00000111, B11111000,
B00000111, B11111000,
B00000111, B11110000,
B00001111, B11100000,
B00000111, B00000000,
B00001111, B00000000,
B00001111, B00000000,
B00001111, B10000000,
B00011100, B00000000,
B00111000, B00000000,
B01110000, B00000000,
B11100000, B00000000,
B11000000, B00000000,
B10000000, B00000000
};
byte const run6[] PROGMEM = {
16, 16,
B00000000, B00000000,
B00000000, B00011100,
B00000000, B00111110,
B00000001, B11111110,
B00000000, B11100000,
B00000001, B11100000,
B00000001, B11111000,
B00000011, B00011100,
B00000110, B00111000,
B00000110, B01110000,
B00001100, B00100000,
B00111000, B00000000,
B01100000, B00000000,
B11000000, B00000000,
B10000000, B00000000,
B10000000, B00000000
};
byte const run7[] PROGMEM = {
18, 16,
B00000000, B00000011, B10000000,
B00000000, B01111011, B10000000,
B00000000, B01111111, B10000000,
B00000000, B00001111, B00100000,
B00000000, B00011001, B11000000,
B00000000, B00110000, B11000000,
B00000000, B01110000, B00000000,
B00000001, B11110000, B00000000,
B11111111, B10111000, B00000000,
B11111111, B00011100, B00000000,
B00000000, B00001110, B00000000,
B00000000, B00000111, B00000000,
B00000000, B00000011, B10000000,
B00000000, B00000001, B11000000,
B00000000, B00000000, B01000000,
B00000000, B00000000, B00000000
};
byte const run8[] PROGMEM = {
18, 16,
B00000000, B00000110, B00000000,
B00000001, B11101111, B00000000,
B00000001, B11111111, B00000000,
B00000000, B00111110, B00000000,
B00000000, B01111111, B11000000,
B00000000, B11100011, B10000000,
B00000001, B11000000, B00000000,
B00000011, B11100000, B00000000,
B11111111, B01110000, B00000000,
B11111110, B00111000, B00000000,
B00000000, B00011100, B00000000,
B00000000, B00000110, B00000000,
B00000000, B00000110, B00000000,
B00000000, B00000111, B00000000,
B00000000, B00000011, B00000000,
B00000000, B00000001, B00000000
};
byte const run9[] PROGMEM = {
16, 16,
B00000000, B00000000,
B00000000, B01001110,
B00000001, B11101110,
B00000011, B11111110,
B00000011, B11111110,
B00000001, B10111100,
B00000011, B00000000,
B00000111, B00000000,
B11111111, B10000000,
B11111100, B11000000,
B00000000, B11000000,
B00000000, B11000000,
B00000000, B11000000,
B00000000, B11000000,
B00000000, B11000000,
B00000000, B11000000
};
byte const run10[] PROGMEM = {
13, 16,
B00000000, B00000000,
B00000000, B00110000,
B00000000, B01111000,
B00000111, B11111000,
B00001111, B11111000,
B00000111, B11000000,
B00001110, B00000000,
B00001100, B00000000,
B00001100, B00000000,
B01111100, B00000000,
B11111100, B00000000,
B00011000, B00000000,
B00110000, B00000000,
B01110000, B00000000,
B01100000, B00000000,
B01000000, B00000000
};
Bitmap::ProgMem frames[] = {
run1,
run2,
run3,
run4,
run5,
run6,
run7,
run8,
run9,
run10
};
#define NUM_FRAMES (sizeof(frames) / sizeof(frames[0]))
unsigned int frame = 0;
#define ADVANCE_MS (1000 / NUM_FRAMES)
ISR(TIMER1_OVF_vect)
{
display.refresh();
}
void setup() {
display.enableTimer1();
}
void loop() {
display.clear();
int x = (32 - pgm_read_byte(frames[frame])) / 2;
display.drawBitmap(x, 0, frames[frame]);
frame = (frame + 1) % NUM_FRAMES;
delay(ADVANCE_MS);
}

View File

@ -1,43 +0,0 @@
DMD KEYWORD1
Bitmap KEYWORD1
doubleBuffer KEYWORD2
setDoubleBuffer KEYWORD2
swapBuffers KEYWORD2
swapBuffersAndCopy KEYWORD2
refresh KEYWORD2
enableTimer1 KEYWORD2
disableTimer1 KEYWORD2
isValid KEYWORD2
width KEYWORD2
height KEYWORD2
stride KEYWORD2
bitsPerPixel KEYWORD2
clear KEYWORD2
pixel KEYWORD2
setPixel KEYWORD2
drawLine KEYWORD2
drawRect KEYWORD2
drawFilledRect KEYWORD2
drawCircle KEYWORD2
drawFilledCircle KEYWORD2
drawBitmap KEYWORD2
drawInvertedBitmap KEYWORD2
font KEYWORD2
setFont KEYWORD2
textColor KEYWORD2
setTextColor KEYWORD2
drawText KEYWORD2
drawChar KEYWORD2
charWidth KEYWORD2
textWidth KEYWORD2
textHeight KEYWORD2
copy KEYWORD2
fill KEYWORD2
scroll KEYWORD2
invert KEYWORD2
Black LITERAL1
White LITERAL1
NoFill LITERAL1

View File

@ -1,310 +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.
*/
#include "EEPROM24.h"
#include "I2CMaster.h"
/**
* \class EEPROM24 EEPROM24.h <EEPROM24.h>
* \brief Reading and writing EEPROM's from the 24LCXX family.
*
* The 24LCXX family of EEPROM's provide a variety of memory sizes from
* 16 bytes up to 128 kBytes that can be accessed via the I2C protocol.
* These chips can be used to augment the 1 kByte or so of builtin EEPROM
* memory that is typical on Arduino boards. The EEPROM should be wired
* to an Arduino Uno as follows:
*
* \image html eeprom_circuit.png
*
* Access to a 24LCXX chip is initialized as follows:
*
* \code
* SoftI2C i2c(A4, A5);
* EEPROM24 eeprom(i2c, EEPROM_24LC256);
* \endcode
*
* Once initialized, read() and write() can be used to manipulate the
* contents of the EEPROM's memory.
*
* The following EEPROM types are supported by this class:
*
* <table>
* <tr><td>Chip</td><td>Type</td><td>Size</td></tr>
* <tr><td>24lc00</td><td>\c EEPROM_24LC00</td><td>16 bytes</td></tr>
* <tr><td>24lc01</td><td>\c EEPROM_24LC01</td><td>128 bytes</td></tr>
* <tr><td>24lc014</td><td>\c EEPROM_24LC014</td><td>128 bytes</td></tr>
* <tr><td>24lc02</td><td>\c EEPROM_24LC02</td><td>256 bytes</td></tr>
* <tr><td>24lc024</td><td>\c EEPROM_24LC024</td><td>256 bytes</td></tr>
* <tr><td>24lc025</td><td>\c EEPROM_24LC025</td><td>256 bytes</td></tr>
* <tr><td>24lc04</td><td>\c EEPROM_24LC04</td><td>512 bytes</td></tr>
* <tr><td>24lc08</td><td>\c EEPROM_24LC08</td><td>1 kByte</td></tr>
* <tr><td>24lc16</td><td>\c EEPROM_24LC16</td><td>2 kBytes</td></tr>
* <tr><td>24lc32</td><td>\c EEPROM_24LC32</td><td>4 kBytes</td></tr>
* <tr><td>24lc64</td><td>\c EEPROM_24LC64</td><td>8 kBytes</td></tr>
* <tr><td>24lc128</td><td>\c EEPROM_24LC128</td><td>16 kBytes</td></tr>
* <tr><td>24lc256</td><td>\c EEPROM_24LC256</td><td>32 kBytes</td></tr>
* <tr><td>24lc512</td><td>\c EEPROM_24LC512</td><td>64 kBytes</td></tr>
* <tr><td>24lc1025</td><td>\c EEPROM_24LC1025</td><td>128 kBytes</td></tr>
* <tr><td>24lc1026</td><td>\c EEPROM_24LC1026</td><td>128 kBytes</td></tr>
* </table>
*
* There can be multiple 24LCXX chips on the same I2C bus, as long as their
* A0, A1, and A2 address pins are set to different values. For example,
* two 24LC256 chips can be used to provide the same memory capacity as a
* single 24LC512 chip. The optional <i>bank</i> parameter to the constructor
* is used to assign different bank addresses to each chip:
*
* \code
* SoftI2C i2c(A4, A5);
* EEPROM24 eeprom0(i2c, EEPROM_24LC256, 0);
* EEPROM24 eeprom1(i2c, EEPROM_24LC256, 1);
* \endcode
*
* \sa I2CMaster
*/
/**
* \brief Constructs a new EEPROM access object on \a bus for an EEPROM
* of the specified \a type.
*
* The \a bank can be used to choose between multiple EEPROM's on
* \a bus of the specified \a type. The \a bank corresponds to the value
* that is set on the EEPROM's A0, A1, and A2 address pins. Note that
* some EEPROM's have less than 3 address pins; consult the datasheet
* for more information.
*/
EEPROM24::EEPROM24(I2CMaster &bus, unsigned long type, uint8_t bank)
: _bus(&bus)
, _size((type & 0xFFFF) * ((type >> 16) & 0x0FFF))
, _pageSize((type >> 16) & 0x0FFF)
, _mode((uint8_t)((type >> 28) & 0x0F))
, i2cAddress(0x50)
{
// Adjust the I2C address for the memory bank of the chip.
switch (_mode) {
case EE_BSEL_NONE:
i2cAddress += (bank & 0x07);
break;
case EE_BSEL_8BIT_ADDR: {
uint8_t addrBits = 8;
unsigned long size = 0x0100;
while (size < _size) {
++addrBits;
size <<= 1;
}
if (addrBits < 11)
i2cAddress += ((bank << (addrBits - 8)) & 0x07);
break; }
case EE_BSEL_17BIT_ADDR:
i2cAddress += ((bank << 1) & 0x06);
break;
case EE_BSEL_17BIT_ADDR_ALT:
i2cAddress += bank & 0x03;
break;
}
}
/**
* \fn unsigned long EEPROM24::size() const
* \brief Returns the size of the EEPROM in bytes.
*
* \sa pageSize()
*/
/**
* \fn unsigned long EEPROM24::pageSize() const
* \brief Returns the size of a single EEPROM page in bytes.
*
* Writes that are a multiple of the page size and aligned on a page
* boundary will typically be more efficient than non-aligned writes.
*
* \sa size()
*/
/**
* \brief Returns true if the EEPROM is available on the I2C bus;
* false otherwise.
*
* This function can be used to probe the I2C bus to determine if the
* EEPROM is present or not.
*
* \sa read(), write()
*/
bool EEPROM24::available()
{
// Perform a "Current Address Read" on the EEPROM. We don't care about
// the returned byte. We only care if the read request was ACK'ed or not.
if (!_bus->startRead(i2cAddress, 1))
return false;
_bus->read();
return true;
}
/**
* \brief Reads a single byte from the EEPROM at \a address.
*
* \sa write()
*/
uint8_t EEPROM24::read(unsigned long address)
{
if (address >= _size)
return 0;
writeAddress(address);
if (!_bus->startRead(i2cAddress, 1))
return 0;
return _bus->read();
}
/**
* \brief Reads a block of \a length bytes from the EEPROM at \a address
* into the specified \a data buffer.
*
* Returns the number of bytes that were read, which may be short if
* \a address + \a length is greater than size() or the EEPROM is
* not available on the I2C bus.
*
* \sa write(), available()
*/
size_t EEPROM24::read(unsigned long address, void *data, size_t length)
{
if (address >= _size || !length)
return 0;
if ((address + length) > _size)
length = (size_t)(_size - address);
writeAddress(address);
if (!_bus->startRead(i2cAddress, length))
return 0;
uint8_t *d = (uint8_t *)data;
unsigned int count = 0;
while (_bus->available()) {
*d++ = _bus->read();
++count;
}
return count;
}
/**
* \brief Writes a byte \a value to \a address in the EEPROM.
*
* Returns true if the byte was written successfully, or false if
* \a address is out of range or the EEPROM is not available on the I2C bus.
*
* \sa read(), available()
*/
bool EEPROM24::write(unsigned long address, uint8_t value)
{
if (address >= _size)
return false;
writeAddress(address);
_bus->write(value);
return waitForWrite();
}
/**
* \brief Writes \a length bytes from a \a data buffer to \a address
* in the EEPROM.
*
* Returns the number of bytes that were written, which may be short if
* \a address + \a length is greater than size() or the EEPROM is not
* available on the I2C bus.
*
* Best performance will be achieved if \a address and \a length are a
* multiple of pageSize().
*
* \sa read(), available(), pageSize()
*/
size_t EEPROM24::write(unsigned long address, const void *data, size_t length)
{
if (address >= _size)
return 0;
if ((address + length) > _size)
length = (size_t)(_size - address);
bool needAddress = true;
size_t result = 0;
size_t page = 0;
const uint8_t *d = (const uint8_t *)data;
while (length > 0) {
if (needAddress) {
writeAddress(address);
needAddress = false;
}
_bus->write(*d++);
++address;
++page;
if ((address & (_pageSize - 1)) == 0) {
// At the end of a page, so perform a flush.
if (!waitForWrite())
return result; // Could not write this page.
needAddress = true;
result += page;
page = 0;
}
--length;
}
if (!needAddress) {
if (!waitForWrite())
return result; // Could not write the final page.
}
return result + page;
}
void EEPROM24::writeAddress(unsigned long address)
{
switch (_mode) {
case EE_BSEL_NONE:
_bus->startWrite(i2cAddress);
_bus->write((uint8_t)(address >> 8));
_bus->write((uint8_t)address);
break;
case EE_BSEL_8BIT_ADDR:
_bus->startWrite(i2cAddress | (((uint8_t)(address >> 8)) & 0x07));
_bus->write((uint8_t)address);
break;
case EE_BSEL_17BIT_ADDR:
_bus->startWrite(i2cAddress | (((uint8_t)(address >> 16)) & 0x01));
_bus->write((uint8_t)(address >> 8));
_bus->write((uint8_t)address);
break;
case EE_BSEL_17BIT_ADDR_ALT:
_bus->startWrite(i2cAddress | (((uint8_t)(address >> 14)) & 0x04));
_bus->write((uint8_t)(address >> 8));
_bus->write((uint8_t)address);
break;
}
}
bool EEPROM24::waitForWrite()
{
// 1000 iterations is going to be approximately 100ms when the I2C
// clock is 100 kHz. If there has been no response in that time
// then we assume that the write has failed and timeout.
if (!_bus->endWrite())
return false;
unsigned count = 1000;
while (count > 0) {
_bus->startWrite(i2cAddress);
if (_bus->endWrite())
return true;
--count;
}
return false;
}

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.
*/
#ifndef EEPROM24_h
#define EEPROM24_h
#include <inttypes.h>
#include <stddef.h>
class I2CMaster;
// Block select modes.
#define EE_BSEL_NONE 0
#define EE_BSEL_8BIT_ADDR 1
#define EE_BSEL_17BIT_ADDR 2
#define EE_BSEL_17BIT_ADDR_ALT 3
// Create an EEPROM descriptor from byte size, page size, and block select mode.
#define _EE24(byteSize, pageSize, mode) \
(((byteSize) / (pageSize)) | (((unsigned long)(pageSize)) << 16) | \
(((unsigned long)(mode)) << 28))
// Type descriptors for the 24LCXX range of EEPROM's.
#define EEPROM_24LC00 _EE24(16UL, 1, EE_BSEL_8BIT_ADDR)
#define EEPROM_24LC01 _EE24(128UL, 8, EE_BSEL_8BIT_ADDR)
#define EEPROM_24LC014 _EE24(128UL, 16, EE_BSEL_8BIT_ADDR)
#define EEPROM_24LC02 _EE24(256UL, 8, EE_BSEL_8BIT_ADDR)
#define EEPROM_24LC024 _EE24(256UL, 16, EE_BSEL_8BIT_ADDR)
#define EEPROM_24LC025 _EE24(256UL, 16, EE_BSEL_8BIT_ADDR)
#define EEPROM_24LC04 _EE24(512UL, 16, EE_BSEL_8BIT_ADDR)
#define EEPROM_24LC08 _EE24(1024UL, 16, EE_BSEL_8BIT_ADDR)
#define EEPROM_24LC16 _EE24(2048UL, 16, EE_BSEL_8BIT_ADDR)
#define EEPROM_24LC32 _EE24(4096UL, 32, EE_BSEL_NONE)
#define EEPROM_24LC64 _EE24(8192UL, 32, EE_BSEL_NONE)
#define EEPROM_24LC128 _EE24(16384UL, 32, EE_BSEL_NONE)
#define EEPROM_24LC256 _EE24(32768UL, 64, EE_BSEL_NONE)
#define EEPROM_24LC512 _EE24(65536UL, 128, EE_BSEL_NONE)
#define EEPROM_24LC1025 _EE24(131072UL, 128, EE_BSEL_17BIT_ADDR_ALT)
#define EEPROM_24LC1026 _EE24(131072UL, 128, EE_BSEL_17BIT_ADDR)
class EEPROM24
{
public:
EEPROM24(I2CMaster &bus, unsigned long type, uint8_t bank = 0);
unsigned long size() const { return _size; }
unsigned long pageSize() const { return _pageSize; }
bool available();
uint8_t read(unsigned long address);
size_t read(unsigned long address, void *data, size_t length);
bool write(unsigned long address, uint8_t value);
size_t write(unsigned long address, const void *data, size_t length);
private:
I2CMaster *_bus;
unsigned long _size;
unsigned long _pageSize;
uint8_t _mode;
uint8_t i2cAddress;
void writeAddress(unsigned long address);
bool waitForWrite();
};
#endif

View File

@ -1,89 +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.
*/
#include "I2CMaster.h"
/**
* \class I2CMaster I2CMaster.h <I2CMaster.h>
* \brief Abstract base class for I2C master implementations.
*
* \sa SoftI2C
*/
/**
* \fn unsigned int I2CMaster::maxTransferSize() const
* \brief Returns the maximum number of bytes that can be read or written in a single request by this bus master.
*/
/**
* \fn void I2CMaster::startWrite(unsigned int address)
* \brief Starts a write operation by sending a start condition and the I2C control byte.
*
* The \a address must be the 7-bit or 10-bit address of the I2C slave
* on the bus.
*
* \sa write(), endWrite(), startRead()
*/
/**
* \fn void I2CMaster::write(uint8_t value)
* \brief Writes a single byte \a value on the I2C bus.
*
* \sa startWrite(), endWrite()
*/
/**
* \fn bool I2CMaster::endWrite()
* \brief Ends the current write operation.
*
* Returns true if the write operation was acknowledged; false otherwise.
*
* \sa startWrite(), write()
*/
/**
* \fn bool I2CMaster::startRead(unsigned int address, unsigned int count)
* \brief Starts a read operation for \a count bytes by sending the start condition and the I2C control byte.
*
* The \a address must be the 7-bit or 10-bit address of the I2C slave
* on the bus.
*
* Returns true if the read request was acknowledged by the I2C slave
* or false otherwise. If true, this function should be followed by
* \a count calls to read() to fetch the bytes.
*
* \sa available(), read(), startWrite()
*/
/**
* \fn unsigned int I2CMaster::available()
* \brief Returns the number of bytes that are still available for reading.
*
* \sa startRead(), read()
*/
/**
* \fn uint8_t I2CMaster::read()
* \brief Reads a single byte from the I2C bus.
*
* \sa startRead(), available()
*/

View File

@ -1,41 +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.
*/
#ifndef I2CMaster_h
#define I2CMaster_h
#include <inttypes.h>
class I2CMaster {
public:
virtual unsigned int maxTransferSize() const = 0;
virtual void startWrite(unsigned int address);
virtual void write(uint8_t value) = 0;
virtual bool endWrite() = 0;
virtual bool startRead(unsigned int address, unsigned int count) = 0;
virtual unsigned int available() = 0;
virtual uint8_t read() = 0;
};
#endif

View File

@ -1,202 +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.
*/
#include "SoftI2C.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include <Arduino.h>
#else
#include <WProgram.h>
#endif
/**
* \class SoftI2C SoftI2C.h <SoftI2C.h>
* \brief Bit-banged implementation of an I2C master.
*
* This class implements the I2C master protocol on any arbitrary pair
* of data and clock pins. It is not restricted to pre-defined pins as
* is the case for the standard Arduino two-wire interface.
*
* This implementation only implements the master side of the protocol.
* It assumes that there is a single bus master, no arbitration, and
* no clock stretching.
*
* \sa I2CMaster
*/
#define i2cDelay() delayMicroseconds(5)
/**
* \brief Constructs a new software I2C master on \a dataPin and \a clockPin.
*/
SoftI2C::SoftI2C(uint8_t dataPin, uint8_t clockPin)
: _dataPin(dataPin)
, _clockPin(clockPin)
, started(false)
, acked(true)
, inWrite(false)
, readCount(0)
{
// Initially set the CLOCK and DATA lines to be outputs in the high state.
pinMode(_clockPin, OUTPUT);
pinMode(_dataPin, OUTPUT);
digitalWrite(_clockPin, HIGH);
digitalWrite(_dataPin, HIGH);
}
unsigned int SoftI2C::maxTransferSize() const
{
return 0xFFFF;
}
void SoftI2C::start()
{
pinMode(_dataPin, OUTPUT);
if (started) {
// Already started, so send a restart condition.
digitalWrite(_dataPin, HIGH);
digitalWrite(_clockPin, HIGH);
i2cDelay();
}
digitalWrite(_dataPin, LOW);
i2cDelay();
digitalWrite(_clockPin, LOW);
i2cDelay();
started = true;
acked = true;
}
void SoftI2C::stop()
{
pinMode(_dataPin, OUTPUT);
digitalWrite(_dataPin, LOW);
digitalWrite(_clockPin, HIGH);
i2cDelay();
digitalWrite(_dataPin, HIGH);
i2cDelay();
started = false;
inWrite = false;
}
#define I2C_WRITE 0x00
#define I2C_WRITE10 0xF0
#define I2C_READ 0x01
#define I2C_READ10 0xF1
void SoftI2C::startWrite(unsigned int address)
{
start();
inWrite = true;
if (address < 0x80) {
// 7-bit address.
write((uint8_t)((address << 1) | I2C_WRITE));
} else {
// 10-bit address.
write((uint8_t)(((address >> 7) & 0x06)) | I2C_WRITE10);
write((uint8_t)address);
}
}
void SoftI2C::write(uint8_t value)
{
uint8_t mask = 0x80;
while (mask != 0) {
writeBit((value & mask) != 0);
mask >>= 1;
}
if (readBit()) // 0: ACK, 1: NACK
acked = false;
}
bool SoftI2C::endWrite()
{
stop();
return acked;
}
bool SoftI2C::startRead(unsigned int address, unsigned int count)
{
start();
inWrite = false;
if (address < 0x80) {
// 7-bit address.
write((uint8_t)((address << 1) | I2C_READ));
} else {
// 10-bit address.
write((uint8_t)(((address >> 7) & 0x06)) | I2C_READ10);
write((uint8_t)address);
}
if (!acked) {
readCount = 0;
return false;
}
readCount = count;
return true;
}
unsigned int SoftI2C::available()
{
return readCount;
}
uint8_t SoftI2C::read()
{
uint8_t value = 0;
for (uint8_t bit = 0; bit < 8; ++bit)
value = (value << 1) | readBit();
if (readCount > 1) {
// More bytes left to read - send an ACK.
writeBit(false);
--readCount;
} else {
// Last byte - send the NACK and a stop condition.
writeBit(true);
stop();
readCount = 0;
}
return value;
}
void SoftI2C::writeBit(bool bit)
{
pinMode(_dataPin, OUTPUT);
if (bit)
digitalWrite(_dataPin, HIGH);
else
digitalWrite(_dataPin, LOW);
i2cDelay();
digitalWrite(_clockPin, HIGH);
i2cDelay();
digitalWrite(_clockPin, LOW);
i2cDelay();
}
bool SoftI2C::readBit()
{
pinMode(_dataPin, INPUT);
digitalWrite(_dataPin, HIGH);
digitalWrite(_clockPin, HIGH);
bool bit = digitalRead(_dataPin);
i2cDelay();
digitalWrite(_clockPin, LOW);
i2cDelay();
return bit;
}

View File

@ -1,56 +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.
*/
#ifndef SoftI2C_h
#define SoftI2C_h
#include "I2CMaster.h"
class SoftI2C : public I2CMaster {
public:
SoftI2C(uint8_t dataPin, uint8_t clockPin);
unsigned int maxTransferSize() const;
void startWrite(unsigned int address);
void write(uint8_t value);
bool endWrite();
bool startRead(unsigned int address, unsigned int count);
unsigned int available();
uint8_t read();
private:
uint8_t _dataPin;
uint8_t _clockPin;
bool started;
bool acked;
bool inWrite;
unsigned int readCount;
void start();
void stop();
void writeBit(bool bit);
bool readBit();
};
#endif

View File

@ -1,100 +0,0 @@
#FIG 3.2 Produced by xfig version 3.2.5b
Landscape
Center
Metric
A4
100.00
Single
-2
1200 2
6 3105 3555 3195 3645
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 3150 3600 30 30 3150 3600 3150 3630
-6
6 3105 3780 3195 3870
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 3150 3825 30 30 3150 3825 3150 3855
-6
6 3105 4005 3195 4095
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 3150 4050 30 30 3150 4050 3150 4080
-6
6 3060 4095 3240 4365
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3135 4365 3165 4365
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3100 4320 3200 4320
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3060 4275 3240 4275
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
3150 4095 3150 4275
-6
6 5400 3285 5715 3465
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5580 3375 5715 3375
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5535 3375 5400 3375
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5580 3285 5580 3465
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5535 3285 5535 3465
-6
6 5760 3600 5940 3870
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5835 3870 5865 3870
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5800 3825 5900 3825
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5760 3780 5940 3780
2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2
5850 3600 5850 3780
-6
6 5130 3330 5220 3420
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 5175 3375 30 30 5175 3375 5175 3405
-6
6 5805 3555 5895 3645
1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 5850 3600 30 30 5850 3600 5850 3630
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
3150 3600 3825 3600
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
3150 3825 3825 3825
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
3150 4050 3825 4050
2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
3825 3150 4725 3150 4725 4275 3825 4275 3825 3150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
3825 3375 3150 3375 3150 4140
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 3
1 1 1.00 60.00 120.00
4725 3375 5175 3375 5175 2700
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5400 3375 5085 3375
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
5850 3375 5670 3375
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
4725 3600 5850 3600 5850 3375
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 3
1 1 1.00 60.00 120.00
4725 4050 5175 4050 5175 4500
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 3
1 1 1.00 60.00 120.00
4725 3825 5625 3825 5625 4500
4 0 0 50 -1 0 12 0.0000 4 135 105 3690 4005 4\001
4 0 0 50 -1 0 12 0.0000 4 135 105 4770 4005 5\001
4 0 0 50 -1 0 12 0.0000 4 135 105 4770 3780 6\001
4 0 0 50 -1 0 12 0.0000 4 135 105 4770 3555 7\001
4 0 0 50 -1 0 12 0.0000 4 135 105 4770 3330 8\001
4 0 0 50 -1 0 12 0.0000 4 135 105 3690 3780 3\001
4 0 0 50 -1 0 12 0.0000 4 135 105 3690 3555 2\001
4 0 0 50 -1 0 12 0.0000 4 135 105 3690 3330 1\001
4 0 0 50 -1 0 8 0.0000 4 90 180 3870 3420 A0\001
4 0 0 50 -1 0 8 0.0000 4 90 180 3870 3645 A1\001
4 0 0 50 -1 0 8 0.0000 4 90 180 3870 3870 A2\001
4 0 0 50 -1 0 8 0.0000 4 90 315 3870 4095 GND\001
4 0 0 50 -1 0 8 0.0000 4 90 210 4500 3645 WP\001
4 0 0 50 -1 0 8 0.0000 4 90 285 4410 3420 VCC\001
4 0 0 50 -1 0 8 0.0000 4 90 255 4455 3870 SCL\001
4 0 0 50 -1 0 8 0.0000 4 90 285 4455 4095 SDA\001
4 0 0 50 -1 0 12 0.0000 4 135 735 3915 3060 24LCXX\001
4 0 0 50 -1 0 12 0.0000 4 135 240 5040 2610 5V\001
4 0 0 50 -1 0 12 0.0000 4 135 525 5310 3195 100nF\001
4 0 0 50 -1 0 12 0.0000 4 135 240 5040 4680 A4\001
4 0 0 50 -1 0 12 0.0000 4 135 240 5490 4680 A5\001

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -1,10 +0,0 @@
I2CMaster KEYWORD1
SoftI2C KEYWORD1
maxTransferSize KEYWORD2
startWrite KEYWORD2
write KEYWORD2
endWrite KEYWORD2
startRead KEYWORD2
available KEYWORD2
read KEYWORD2

View File

@ -1,373 +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.
*/
#include "IRreceiver.h"
#if defined(ARDUINO) && ARDUINO >= 100
#include <Arduino.h>
#else
#include <WProgram.h>
#endif
/**
* \class IRreceiver IRreceiver.h <IRreceiver.h>
* \brief Manages the reception of RC-5 commands from an infrared remote control.
*
* IRreceiver recognizes commands in the <a href="http://en.wikipedia.org/wiki/RC-5">Philips RC-5 protocol</a>.
* This is a fairly common infrared protocol, supported by most universal
* remote controls. Program the universal remote to simulate a Philips
* TV, VCR, CD player, etc.
*
* This class uses interrupts to process incoming bits from a standard 3-pin
* infrared receiver:
*
* \image html irchip.jpg
*
* Typically, pin 1 of the receiver should be connected to the Arduino
* interrupt pin (e.g. D2), pin 2 should be connected to GND, and pin 3
* should be connected to 5V. Consult the datasheet for your receiver to
* be sure though; some receivers may have different pin assignments.
*
* The receiver is initialized by constructing an instance of the
* IRreceiver class:
*
* \code
* IRreceiver ir;
* \endcode
*
* By default, interrupt 0 on pin D2 is used. To change to another interrupt,
* pass its number to the constructor:
*
* \code
* IRreceiver ir(1); // Interrupt 1 on pin D3
* \endcode
*
* Currently this class can only handle a single instance of IRreceiver being
* active in the application. It isn't possible to have separate IRreceiver
* instances on different pins. Usually this won't be a problem because
* the same receiver can process inputs from multiple remotes.
*
* The application retrieves incoming infrared commands by calling the
* command() function. The return value indicates the type of command:
*
* \code
* void loop() {
* switch (ir.command()) {
* case RC5_0: case RC5_1: case RC5_2: case RC5_3: case RC5_4:
* case RC5_5: case RC5_6: case RC5_7: case RC5_8: case RC5_9:
* // Process a digit
* ...
* break;
*
* case RC5_ERASE:
* // Backspace/erase last digit.
* ...
* break;
*
* case RC5_STANDBY:
* // Power on/off button.
* ...
* break;
* }
* }
* \endcode
*
* If the command is an auto-repeat of a previous button press, then the
* \ref AUTO_REPEAT flag will be set in the value returned from command().
* The application can choose to ignore all auto-repeats, process all
* auto-repeats, or choose which button to auto-repeat based on its code:
*
* \code
* void loop() {
* switch (ir.command()) {
* case RC5_INC_VOLUME:
* case IRreceiver::AUTO_REPEAT | RC5_INC_VOLUME:
* // Volume increase button pressed or held.
* ...
* break;
*
* case RC5_DEC_VOLUME:
* case IRreceiver::AUTO_REPEAT | RC5_DEC_VOLUME:
* // Volume decrease button pressed or held.
* ...
* break;
*
* case RC5_MUTE:
* // Mute button (ignore auto-repeat).
* ...
* break;
* }
* }
* \endcode
*
* By default, command codes will be generated for every type of RC-5 remote
* control, be it a TV, VCR, CD player, or something else. The application
* can distinguish between the remote controls using system(); noting that
* command() must be called before system() for the system value to be valid.
* For example, the following code could be used in a two-player video game
* where the first player's remote is configured as a TV and the second
* player's remote is configured as a VCR:
*
* \code
* void loop() {
* int cmd = ir.command();
* int sys = ir.system();
* if (sys == RC5_SYS_TV)
* player1(cmd);
* else if (sys == RC5_SYS_VCR)
* player2(cmd);
*
* ...
* }
* \endcode
*
* If the application only cares about a single system and wishes to ignore
* all other systems, it can configure a system filter at startup:
*
* \code
* IRreceiver ir;
*
* void setup() {
* ir.setSystemFilter(RC5_SYS_VCR);
* }
* \endcode
*
* The complete list of RC-5 system numbers and command codes is given in
* the RC5.h header file.
*
* \sa \ref ir_dumpir "DumpIR Example"
*/
static IRreceiver *receiver = 0;
void _IR_receive_interrupt(void)
{
receiver->handleInterrupt();
}
/**
* \var IRreceiver::AUTO_REPEAT
* \brief Flag that is added to the output of command() when the command
* is an auto-repeated button press rather than the original button press.
*/
/**
* \brief Constructs a new infrared remote control receiver that is attached
* to \a interruptNumber.
*/
IRreceiver::IRreceiver(int interruptNumber)
: _system(0)
, _systemFilter(-1)
, started(false)
, halfChange(false)
, lastChange(0)
, bits(0)
, bitCount(0)
, buffer(0)
, lastBuffer(0)
{
switch (interruptNumber) {
case 0: default: pin = 2; break;
case 1: pin = 3; break;
case 2: pin = 21; break; // Arduino Mega only
case 3: pin = 20; break; // Arduino Mega only
case 4: pin = 19; break; // Arduino Mega only
case 5: pin = 18; break; // Arduino Mega only
}
receiver = this;
attachInterrupt(interruptNumber, _IR_receive_interrupt, CHANGE);
}
/**
* \brief Returns the next command from the remote control.
*
* Returns -1 if there is no new command, or the number between 0 and 127
* corresponding to the command. If the command is an auto-repeat button
* press rather than an original button press, then the \ref AUTO_REPEAT
* flag will be set.
*
* The companion function system() will return the system number for the
* command indicating whether the command is for a TV, VCR, CD player, etc.
* By default, all systems are reported; use setSystemFilter() to filter
* out commands from all but a specific system.
*
* The next call to command() will return -1 or the code for the next
* button press.
*
* The header file <tt>RC5.h</tt> contains a list of command codes for
* common remote controls.
*
* \sa system(), setSystemFilter()
*/
int IRreceiver::command()
{
unsigned buf;
// Read the last-delivered sequence from the buffer and clear it.
cli();
buf = buffer;
buffer = 0;
sei();
// Bail out if no sequence or it is not for us.
if (!buf) {
_system = -1;
return -1;
}
if (_systemFilter != -1) {
if (((buf >> 6) & 0x1F) != _systemFilter) {
_system = -1;
return -1;
}
}
// Extract the command.
int cmd = buf & 0x3F;
if ((buf & 0x1000) == 0)
cmd += 64;
// Is this a new command or an auto-repeat of the previous command?
// Bit 11 will toggle whenever a new button press is started.
if (lastBuffer == buf)
cmd += AUTO_REPEAT;
else
lastBuffer = buf;
_system = (buf >> 6) & 0x1F;
return cmd;
}
/**
* \fn int IRreceiver::system() const
* \brief Returns the system number of the previous command(), indicating
* whether the command was for a TV, VCR, CD player, etc.
*
* The return value from this function is valid only after a call to
* command(). The next call to command() will clear the system value,
* possibly to -1 if there is no new command.
*
* The header file <tt>RC5.h</tt> contains a list of system numbers for
* common remote controls.
*
* \sa command(), setSystemFilter()
*/
/**
* \fn int IRreceiver::systemFilter() const
* \brief Returns the system to filter commands against, or -1 if no
* filter is set.
*
* If this value is -1, then all received systems are returned via command()
* and system() irrespective of whether they are for a TV, VCR, CD player,
* or some other type of system. If this value is set to anything other
* than -1, then only commands for that system are returned via command().
*
* \sa setSystemFilter(), system(), command()
*/
/**
* \fn void IRreceiver::setSystemFilter(int system)
* \brief Sets the \a system to filter commands against, or -1 to turn
* off the system filter.
*
* If \a system is -1, then all received systems are returned via command()
* and system() irrespective of whether they are for a TV, VCR, CD player,
* or some other type of system. If \a system is set to anything other
* than -1, then only commands for that system are returned via command().
* For example:
*
* \code
* IRreceiver ir;
* ir.setSystemFilter(RC5_SYS_VCR);
* \endcode
*
* \sa systemFilter(), system(), command()
*/
// Number of microseconds that the signal is HIGH or LOW for
// indicating a bit. A 1 bit is transmitted as LOW for 889us
// followed by HIGH for 889us. A 0 bit is HIGH, then LOW.
#define IR_BIT_TIME 889
// Number of microseconds to detect a long gap in the coding
// corresponding to 2 time units HIGH or LOW. We actually check
// for at least 1.5 time units to allow for slight variations
// in timing on different remote controls.
#define IR_LONG_BIT_TIME (889 * 6 / 4)
// Maximum timeout for a single bit. If we don't see a rising edge
// within this time, then we have lost sync and need to restart.
#define IR_MAX_TIME (IR_BIT_TIME * 4)
// Protocol details from http://en.wikipedia.org/wiki/RC-5
void IRreceiver::handleInterrupt()
{
bool value = digitalRead(pin);
unsigned long currentTime = micros();
if (!value) {
// Rising edge (input is active-LOW)
if (started && (currentTime - lastChange) > IR_MAX_TIME) {
// Too long since the last received bit, so restart the process.
started = false;
}
if (started) {
// We recognize bits on the falling edges, so merely
// adjust the "changed at last half-cycle" flag.
if ((currentTime - lastChange) > IR_LONG_BIT_TIME) {
// Long time since last falling edge indicates that the
// next bit will definitely be a 1.
halfChange = true;
} else {
halfChange = !halfChange;
}
lastChange = currentTime;
} else {
// Encountered the start bit - start receiving up to 14 bits.
lastChange = currentTime;
started = true;
halfChange = true;
bits = 0;
bitCount = 14;
}
} else if (started) {
// Falling edge
if ((currentTime - lastChange) > IR_LONG_BIT_TIME) {
// Long time since last rise indicates 1 followed by 0.
bits = (bits << 2) | 0x02;
--bitCount;
halfChange = true;
} else if (halfChange) {
// Rise was halfway through, so falling edge indicates a 1.
bits = (bits << 1) | 0x01;
halfChange = false;
} else {
// Rise was at the start, so falling edge indicates a 0.
bits <<= 1;
halfChange = true;
}
lastChange = currentTime;
--bitCount;
if (bitCount <= 0) {
// All 14 bits have been received, so deliver the value.
started = false;
buffer = bits;
}
}
}

View File

@ -1,59 +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.
*/
#ifndef IRreceiver_h
#define IRreceiver_h
#include <inttypes.h>
#include "RC5.h"
class IRreceiver
{
public:
explicit IRreceiver(int interruptNumber = 0);
static const int AUTO_REPEAT = 128;
int command();
int system() const { return _system; }
int systemFilter() const { return _systemFilter; }
void setSystemFilter(int system) { _systemFilter = system; }
private:
int _system;
int _systemFilter;
uint8_t pin;
bool started;
bool halfChange; // Value last changed half-way through bit cycle time.
unsigned long lastChange;
unsigned bits;
int8_t bitCount;
volatile unsigned buffer;
unsigned lastBuffer;
void handleInterrupt();
friend void _IR_receive_interrupt(void);
};
#endif

View File

@ -1,344 +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.
*/
#ifndef RC5_h
#define RC5_h
// http://en.wikipedia.org/wiki/RC-5#System_Number_Allocations
#define RC5_SYS_TV 0 // TV receiver 1
#define RC5_SYS_TV2 1 // TV receiver 2
#define RC5_SYS_TXT 2 // Teletext
#define RC5_SYS_TV_EXT 3 // Extension to TV 1 & 2
#define RC5_SYS_LV 4 // Laservision player
#define RC5_SYS_VCR 5 // VCR 1
#define RC5_SYS_VCR2 6 // VCR 2
#define RC5_SYS_SAT 8 // Satellite receiver 1
#define RC5_SYS_VCR_EXT 9 // Extension to VCR 1 & 2
#define RC5_SYS_SAT2 10 // Satellite receiver 2
#define RC5_SYS_CD_VIDEO 12 // CD video player
#define RC5_SYS_CD_PHOTO 14 // CD photo player
#define RC5_SYS_PREAMP 16 // Audio preamplifier 1
#define RC5_SYS_RADIO 17 // Radio tuner
#define RC5_SYS_REC 18 // Casette recorder 1
#define RC5_SYS_PREAMP2 19 // Audio preamplifier 2
#define RC5_SYS_CD 20 // CD player
#define RC5_SYS_COMBI 21 // Audio stack or record player
#define RC5_SYS_AUDIO_SAT 22 // Audio satellite
#define RC5_SYS_REC2 23 // Casette recorder 2
#define RC5_SYS_CD_R 26 // CD recorder
// http://en.wikipedia.org/wiki/RC-5#Command_Tables
// Table 2, Common commands:
#define RC5_0 0 // Digit 0
#define RC5_1 1 // Digit 1
#define RC5_2 2 // Digit 2
#define RC5_3 3 // Digit 3
#define RC5_4 4 // Digit 4
#define RC5_5 5 // Digit 5
#define RC5_6 6 // Digit 6
#define RC5_7 7 // Digit 7
#define RC5_8 8 // Digit 8
#define RC5_9 9 // Digit 9
#define RC5_INC_VOLUME 16 // Increase sound volume
#define RC5_DEC_VOLUME 17 // Decrease sound volume
#define RC5_INC_BRIGHTNESS 18 // Increase display brightness
#define RC5_DEC_BRIGHTNESS 19 // Decrease display brightness
#define RC5_INC_BASS 22 // Increase bass response
#define RC5_DEC_BASS 23 // Decrease bass response
#define RC5_INC_TREBLE 24 // Increase treble response
#define RC5_DEC_TREBLE 25 // Decrease treble response
#define RC5_BALANCE_LEFT 26 // Shift sound balance to left
#define RC5_BALANCE_RIGHT 27 // Shift sound balance to right
#define RC5_TRANSMIT_MODE 63 // Select remote transmit mode
#define RC5_DIM 71 // Dim local display
#define RC5_INC_LINEAR 77 // Increase linear control
#define RC5_DEC_LINEAR 78 // Decrease linear control
#define RC5_UP 80 // Move cursor up
#define RC5_DOWN 81 // Move cursor down
#define RC5_MENU_ON 82 // Switch display/screen menu on
#define RC5_MENU_OFF 83 // Switch display/screen menu off
#define RC5_AV_STATUS 84 // Display A/V system status
#define RC5_LEFT 85 // Move cursor left
#define RC5_RIGHT 86 // Move cursor right
#define RC5_OK 87 // Acknowledge function at cursor
#define RC5_SUBMODE 118 // Select sub-mode
#define RC5_OPTIONS 119 // Select options sub-mode
#define RC5_CONNECT_EURO 123 // Connect items via Euroconnector
#define RC5_DISCONNECT_EURO 124 // Disconnect items via Euroconnector
// http://en.wikipedia.org/wiki/RC-5#Command_Tables
// Table 3, Common video system commands:
#define RC5_INC_SATURATION 20 // Increase color saturation
#define RC5_DEC_SATURATION 21 // Decrease color saturation
#define RC5_PIP 88 // Picture-in-picture on/off
#define RC5_PIP_SHIFT 89 // Picture-in-picture shift
#define RC5_PIP_SWAP 90 // Picture-in-picture swap
#define RC5_PIP_STROBE 91 // Strobe main picture on/off
#define RC5_PIP_MULTI_STROBE 92 // Multi-strobe
#define RC5_PIP_FREEZE_MAIN 93 // Main picture frame frozen
#define RC5_PIP_MULTI_SCAN 94 // 3/9 multi-scan
#define RC5_PIP_SOURCE 95 // Select picture-in-picture source
#define RC5_PIP_MOSAIC 96 // Mosaic/multi-PIP
#define RC5_PIP_NOISE 97 // Digital noise reduction of picture
#define RC5_PIP_STORE 98 // Store main picture
#define RC5_PIP_PHOTO_FINISH 99 // PIP strobe; display photo-finish
#define RC5_PIP_RECALL 100 // Recall main stored picture
#define RC5_PIP_FREEZE 101 // Freeze PIP
#define RC5_PIP_UP 102 // Step up PIP options/source
#define RC5_PIP_DOWN 103 // Step down PIP options/source
// http://en.wikipedia.org/wiki/RC-5#Command_Tables
// Table 4a, TV and VCR commands:
#define RC5_123 10 // 1/2/3 digit entry
#define RC5_11 11 // Channel/program/frequency 11
#define RC5_STANDBY 12 // Standby
#define RC5_MUTE 13 // Master mute/de-mute
#define RC5_PREFERENCES 14 // Personal preference settings
#define RC5_DISPLAY_INFO 15 // Display user info on screen
#define RC5_INC_CONTRAST 28 // Increase picture contrast
#define RC5_DEC_CONTRAST 29 // Decrease picture contrast
#define RC5_SEARCH_UP 30 // Search up
#define RC5_DEC_TINT 31 // Decrease tint/hue
#define RC5_CHANNEL_UP 32 // Channel/program up
#define RC5_CHANNEL_DOWN 33 // Channel/program down
#define RC5_CHANNEL_LAST 34 // Last viewed channel/program
#define RC5_STEREO_SELECT 35 // Select stereo channel/language
#define RC5_STEREO_SPATIAL 36 // Spatial stereo
#define RC5_STEREO_TOGGLE 37 // Toggle stereo/mono
#define RC5_SLEEP_TIMER 38 // Sleep timer
#define RC5_INC_TINT 39 // Increase tint/hue
#define RC5_SWITCH_RF 40 // Switch RF inputs
#define RC5_STORE 41 // Store/vote
#define RC5_TIME 42 // Display time
#define RC5_INC_SCAN 43 // Scan forward/increment
#define RC5_DEC_SCAN 44 // Scan backward/decrement
#define RC5_SECONDARY_MENU 46 // Secondary menu
#define RC5_CLOCK 47 // Show clock
#define RC5_PAUSE 48 // Pause
#define RC5_ERASE 49 // Erase/correct entry
#define RC5_REWIND 50 // Rewind
#define RC5_GOTO 51 // Go to
#define RC5_WIND 52 // Wind (fast forward)
#define RC5_PLAY 53 // Play
#define RC5_STOP 54 // Stop
#define RC5_RECORD 55 // Record
#define RC5_EXTERNAL1 56 // External 1
#define RC5_EXTERNAL2 57 // External 2
#define RC5_VIEW_DATA 59 // View data, advance
#define RC5_12 60 // Channel 12 (or TXT/TV toggle)
#define RC5_SYSTEM_STANDBY 61 // System standby
#define RC5_CRISP 62 // Picture crispener (coutour boost)
#define RC5_AUDIO_RESPONSE 70 // Audio response for speech/music
#define RC5_SOUND_FUNCTIONS 79 // Select sound functions in sequence
#define RC5_PIP_SIZE 104 // Alter PIP size step-by-step
#define RC5_VISION_FUNCTIONS 105 // Select vision functions in sequence
#define RC5_COLOR_KEY 106 // Colored or other special key
#define RC5_RED 107 // Red button
#define RC5_GREEN 108 // Green button
#define RC5_YELLOW 109 // Yellow button
#define RC5_CYAN 110 // Cyan button
#define RC5_INDEX 111 // Index page/white function
#define RC5_NEXT_OPTION 112 // Next option
#define RC5_PREVIOUS_OPTION 113 // Previous option
#define RC5_STORE_OPEN_CLOSE 122 // Store open/close
#define RC5_PARENTAL_ACCESS 123 // Parental access via PIN code
// http://en.wikipedia.org/wiki/RC-5#Command_Tables
// Table 4b, TV1 and TV2 extension
#define RC5_DEFAULT_VIDEO 10 // Default video settings (TV1)
#define RC5_DEFAULT_AUDIO 11 // Default audio settings (TV1)
#define RC5_PAYTV_CHANNEL_UP 28 // Pay TV channel up (TV1)
#define RC5_PAYTV_CHANNEL_DOWN 29 // Pay TV channel down (TV1)
#define RC5_RADIO_CHANNEL_UP 30 // Radio channel up (TV1)
#define RC5_RADIO_CHANNEL_DOWN 31 // Radio channel down (TV1)
#define RC5_TILT_FORWARD 32 // Tilt cabinet forward (TV1)
#define RC5_TILT_BACKWARD 33 // Tilt cabinet backward (TV1)
#define RC5_EXTERNAL3 56 // External 3 (TV1)
#define RC5_EXTERNAL4 56 // External 4 (TV1)
#define RC5_PICTURE_FORMAT 62 // 4:3 vs 16:9 (TV1)
#define RC5_CHANNEL_10 67 // Channel 10
#define RC5_CHANNEL_11 68 // Channel 11
#define RC5_CHANNEL_12 69 // Channel 12
#define RC5_DEFAULT_VIDEO2 72 // Default video settings (TV2)
#define RC5_DEFAULT_AUDIO2 73 // Default audio settings (TV2)
#define RC5_PAYTV_CHANNEL_UP2 88 // Pay TV channel up (TV2)
#define RC5_PAYTV_CHANNEL_DOWN2 89 // Pay TV channel down (TV2)
#define RC5_RADIO_CHANNEL_UP2 90 // Radio channel up (TV2)
#define RC5_RADIO_CHANNEL_DOWN2 91 // Radio channel down (TV2)
#define RC5_TILT_FORWARD2 104 // Tilt cabinet forward (TV2)
#define RC5_TILT_BACKWARD2 105 // Tilt cabinet backward (TV2)
#define RC5_EXTERNAL3_2 120 // External 3 (TV2)
#define RC5_EXTERNAL4_2 121 // External 4 (TV2)
#define RC5_CHANNEL_MENU 122 // Channel setting menu
#define RC5_PICTURE_FORMAT2 126 // 4:3 vs 16:9 (TV2)
// http://en.wikipedia.org/wiki/RC-5#Command_Tables
// Table 5, Teletext commands
#define RC5_NEXT_PAGE 10 // Next page
#define RC5_PREVIOUS_PAGE 11 // Previous page
// RC5_STANDBY 12 // Standby
#define RC5_ENTER_PAGE_NUMBER 28 // Enter page number in memory
#define RC5_SEQ_DISPLAY 29 // Sequential display of pages
#define RC5_SEQ_DELETE 30 // Sequential display/deletion of pages
#define RC5_EXCHANGE 32 // Exchange (Antiope function)
#define RC5_MAIN_INDEX 33 // Main index
#define RC5_ROW_ZERO 34 // Row zero (Antiope function)
#define RC5_PRINT 38 // Print displayed page
#define RC5_MIX 39 // Mix Antiope/TV pictures
#define RC5_HOLD_PAGE 41 // Page hold
// RC5_TIME 42 // Display time
#define RC5_LARGE 43 // Large top/bottom/normal
#define RC5_REVEAL 44 // Reveal/conceal
#define RC5_TV_TXT 45 // TV/TXT
#define RC5_TV_TXT_SUBTITLE 46 // TV + TXT/subtitle
// RC5_ERASE 49 // Erase/correct entry
#define RC5_NEWS_FLASH 62 // News flash (Antiope function)
// http://en.wikipedia.org/wiki/RC-5#Command_Tables
// Table 6, LaserVision commands
#define RC5_PICTURE_NUMBER 10 // Display picture number/time
#define RC5_CHAPTER_NUMBER 11 // Display chapter number
// RC5_STANDBY 12 // Standby
// RC5_MUTE 13 // Master mute/de-mute
// RC5_DISPLAY_INFO 15 // Display user info on screen
#define RC5_SHUFFLE 28 // Total shuffle play/repeat once
#define RC5_REPEAT 29 // Repeat continuously
#define RC5_SELECT_NEXT 30 // Select next option
#define RC5_FAST_REVERSE 31 // Fast run reverse
#define RC5_ENTRY 32 // Entry (prepare to program)
#define RC5_AUTO_STOP 33 // Auto-stop at pre-programmed point
#define RC5_SLOW_REVERSE 34 // Slow run reverse
#define RC5_STEREO_CHANNEL1 35 // Select stereo sound channel 1/language 1
#define RC5_STEREO_CHANNEL2 36 // Select stereo sound channel 2/language 2
#define RC5_DEC_STILL 37 // Still increment reverse
#define RC5_INC_SPEED 38 // Increase speed
#define RC5_DEC_SPEED 39 // Decrease speed
#define RC5_SLOW_FORWARD 40 // Slow run forward
#define RC5_INC_STILL 41 // Still increment forward
#define RC5_FAST_FORWARD 42 // Fast run forward
#define RC5_SEARCH_USER_CHOICE 43 // Automatic search for user choice
#define RC5_SEARCH_REVERSE 44 // Search in reverse
#define RC5_TRAY 45 // Open/close tray
#define RC5_SEARCH_FORWARD 46 // Search forward
#define RC5_PLAY_REVERSE 47 // Play reverse/play opposite sound track
// RC5_PAUSE 48 // Pause
// RC5_ERASE 49 // Erase/correct entry
// RC5_PLAY 53 // Play
// RC5_STOP 54 // Stop
#define RC5_CLEAR_MEMORY 58 // Clear memory all
#define RC5_FREEZE_SEGMENT 59 // Freeze segment(s) indicated by picture numbers.
#define RC5_TV_TXT_ALT 60 // TV/TXT toggle; RF switch (USA only)
#define RC5_CX 62 // CX 1, 2, 3; toggle for CX noise reduction
// http://en.wikipedia.org/wiki/RC-5#Command_Tables
// Table 11, Preamplifier commands
#define RC5_GEQ_L 10 // Graphic equalizer left
#define RC5_GEQ_R 11 // Graphic equalizer right
// RC5_STANDBY 12 // Standby
// RC5_MUTE 13 // Master mute/de-mute
// RC5_PREFERENCES 14 // Personal preference settings
// RC5_DISPLAY_INFO 15 // Display user info on screen
#define RC5_GEQ_L_AND_R 28 // Graphic equalizer left and right
#define RC5_SPEAKER_SELECT 29 // Speaker select
#define RC5_SCRATCH_FILTER 30 // Scratch filter on/off
#define RC5_RUMBLE_FILTER 31 // Rumble filter on/off
#define RC5_INC_STEP 32 // Step function +
#define RC5_DEC_STEP 33 // Step function -
#define RC5_SIGNAL_PATH 34 // Signal path options
#define RC5_SPEAKER_A 35 // Speaker A on/off
#define RC5_SURROUND_OPTIONS 37 // Surround sound options
// RC5_SLEEP_TIMER 38 // Sleep timer
#define RC5_SPEAKER_B 39 // Speaker B on/off
#define RC5_SPEAKER_C 40 // Speaker C on/off
#define RC5_TIMER_PROGRAM 41 // Timer program mode
// RC5_TIME 42 // Display time
#define RC5_INC_TIMER 43 // Timer +
#define RC5_DEC_TIMER 44 // Timer -
#define RC5_TIMER_MEMORY 45 // Open timer memory
#define RC5_ACOUSTIC_CONTROL 46 // Open acoustic control setting memory
#define RC5_ACOUSTIC_SELECT 47 // Select acoustic settings in memory
// RC5_ERASE 49 // Erase/correct entry
// RC5_CLEAR_MEMORY 58 // Clear memory all
#define RC5_DYNAMIC_EXPAND 60 // Dynamic range expand
#define RC5_DYNAMIC_COMPRESS 62 // Dynamic range compress
#define RC5_SURROUND_SOUND 64 // Surround sound on/off
#define RC5_BALANCE_FRONT 65 // Balance front
#define RC5_BALANCE_REAR 66 // Balance rear
#define RC5_LINEAR_SOUND 79 // Scroll linear sound functions
#define RC5_RANDOM_NOISE 88 // Random noise generator on/off
#define RC5_TIMER 89 // Timer on/off
#define RC5_NEWS_TIMER 90 // News timer on/off
#define RC5_INC_CENTER_VOLUME 102 // Increase center channel volume
#define RC5_DEC_CENTER_VOLUME 103 // Decrease center channel volume
#define RC5_INC_DELAY_SURROUND 104 // Increase delay front to surround
#define RC5_DEC_DELAY_SURROUND 105 // Decrease delay front to surround
#define RC5_LINEAR_PHASE 106 // Linear phase
#define RC5_TAPE_MONITOR 122 // Tape monitor
// http://en.wikipedia.org/wiki/RC-5#Command_Tables
// Table 14, Compact disc player commands
#define RC5_LOCAL_CURSOR 10 // Scroll local display cursor
#define RC5_LOCAL_FUNCTION 11 // Scroll local display function
// RC5_STANDBY 12 // Standby
// RC5_MUTE 13 // Master mute/de-mute
// RC5_DISPLAY_INFO 15 // Display user info on screen
// RC5_SHUFFLE 28 // Total shuffle play/repeat once
// RC5_REPEAT 29 // Repeat continuously
#define RC5_INC_SELECT 30 // Select increment
#define RC5_DEC_SELECT 31 // Select decrement
#define RC5_NEXT 32 // Next
#define RC5_PREVIOUS 33 // Previous
#define RC5_INDEX_NEXT 34 // Index next
#define RC5_INDEX_PREVIOUS 35 // Index previous
#define RC5_PLAY_PROGRAM 36 // Play/program
#define RC5_NOMINAL_SPEED 37 // Speed nominal
// RC5_INC_SPEED 38 // Increase speed
// RC5_DEC_SPEED 39 // Decrease speed
// RC5_STORE 41 // Store/vote
// RC5_INC_SCAN 43 // Scan forward/increment
// RC5_TRAY 45 // Open/close tray
#define RC5_CARTRIDGE 47 // Fast/select disc from catridge
// RC5_PAUSE 48 // Pause
// RC5_ERASE 49 // Erase/correct entry
// RC5_REWIND 50 // Rewind
// RC5_GOTO 51 // Go to
// RC5_WIND 52 // Wind (fast forward)
// RC5_PLAY 53 // Play
// RC5_STOP 54 // Stop
// RC5_CLEAR_MEMORY 58 // Clear memory all
#define RC5_REPEAT_AB 59 // Repeat program marked A/B
// RC5_DYNAMIC_EXPAND 60 // Dynamic range expand
// RC5_DYNAMIC_COMPRESS 62 // Dynamic range compress
#define RC5_DSP 91 // Digital signal processing on/off
#define RC5_DSP_MUSIC 92 // Music mode (DSP)
#define RC5_DSP_ACOUSTICS 93 // Select room acoustics (DSP)
#define RC5_DSP_JAZZ 94 // Jazz/s-hall effect (DSP)
#define RC5_DSP_POP 95 // Pop/s-hall effect (DSP)
#define RC5_DSP_CLASSIC 96 // Classic/church music for music/room mode (DSP)
#define RC5_DSP_EASY 97 // Easy/club music for music/room mode (DSP)
#define RC5_DSP_DISCO 98 // Disco/stadium music for music/room mode (DSP)
#define RC5_SECOND_FAVORITE 107 // Second favorite track selection
#define RC5_FAVORITE 108 // Favorite track selection
#define RC5_TITLE_INTO_MEMORY 109 // Title into memory
#define RC5_FADE 120 // Fade in/out audio
#endif

View File

@ -1,196 +0,0 @@
/* This example is placed into the public domain */
#include <IRreceiver.h>
IRreceiver ir;
static const char *systems[32] = {
"TV",
"TV2",
"TXT",
"TV_EXT",
"LV",
"VCR",
"VCR2",
"Sys7",
"SAT",
"VCR_EXT",
"SAT2",
"Sys11",
"CD_VIDEO",
"Sys13",
"CD_PHOTO",
"Sys15",
"PREAMP",
"RADIO",
"REC",
"PREAMP2",
"CD",
"COMBI",
"AUDIO_SAT",
"REC2",
"Sys24",
"Sys25",
"CD_R",
"Sys27",
"Sys28",
"Sys29",
"Sys30",
"Sys31"
};
// Selection of TV, VCR, and CD commands to assist with command identification.
// May not be correct for all system types.
static const char *commands[128] = {
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"123",
"11",
"STANDBY",
"MUTE",
"PREFERENCES",
"DISPLAY_INFO",
"INC_VOLUME",
"DEC_VOLUME",
"INC_BRIGHTNESS",
"DEC_BRIGHTNESS",
"INC_SATURATION",
"DEC_SATURATION",
"INC_BASS",
"DEC_BASS",
"INC_TREBLE",
"DEC_TREBLE",
"BALANCE_LEFT",
"BALANCE_RIGHT",
"INC_CONTRAST",
"DEC_CONTRAST",
"SEARCH_UP",
"DEC_TINT",
"CHANNEL_UP",
"CHANNEL_DOWN",
"CHANNEL_LAST",
"STEREO_SELECT",
"STEREO_SPATIAL",
"STEREO_TOGGLE",
"SLEEP_TIMER",
"INC_TINT",
"SWITCH_RF",
"STORE",
"TIME",
"INC_SCAN",
"DEC_SCAN",
"TRAY",
"SECONDARY_MENU",
"CLOCK",
"PAUSE",
"ERASE",
"REWIND",
"GOTO",
"WIND",
"PLAY",
"STOP",
"RECORD",
"EXTERNAL_1",
"EXTERNAL_2",
"CLEAR_MEMORY",
"VIEW_DATA",
"12",
"SYSTEM_STANDBY",
"CRISP",
"TRANSMIT_MODE",
"Cmd64",
"Cmd65",
"Cmd66",
"Cmd67",
"Cmd68",
"Cmd69",
"AUDIO_RESPONSE",
"DIM",
"Cmd72",
"Cmd73",
"Cmd74",
"Cmd75",
"Cmd76",
"INC_LINEAR",
"DEC_LINEAR",
"SOUND_FUNCTIONS",
"UP",
"DOWN",
"MENU_ON",
"MENU_OFF",
"AV_STATUS",
"LEFT",
"RIGHT",
"OK",
"PIP",
"PIP_SHIFT",
"PIP_SWAP",
"PIP_STROBE",
"PIP_MULTI_STROBE",
"PIP_FREEZE_MAIN",
"PIP_MULTI_SCAN",
"PIP_SOURCE",
"PIP_MOSAIC",
"PIP_NOISE",
"PIP_STORE",
"PIP_PHOTO_FINISH",
"PIP_RECALL",
"PIP_FREEZE",
"PIP_UP",
"PIP_DOWN",
"PIP_SIZE",
"VERSION_FUNCTIONS",
"COLOR_KEY",
"RED",
"GREEN",
"YELLOW",
"CYAN",
"INDEX",
"NEXT_OPTION",
"PREVIOUS_OPTION",
"Cmd114",
"Cmd115",
"Cmd116",
"Cmd117",
"SUBMODE",
"OPTIONS",
"FADE",
"Cmd121",
"STORE_OPEN_CLOSE",
"CONNECT_EURO",
"DISCONNECT_EURO",
"Cmd125",
"Cmd126",
"Cmd127"
};
void setup() {
Serial.begin(9600);
}
void loop() {
int cmd = ir.command();
if (cmd >= 0) {
Serial.print("IR system=");
Serial.print(ir.system());
Serial.print(" (RC5_SYS_");
Serial.print(systems[ir.system()]);
Serial.print("), command=");
Serial.print(cmd & 0x7F);
Serial.print(" (RC5_");
Serial.print(commands[cmd & 0x7F]);
Serial.print(")");
if (cmd & IRreceiver::AUTO_REPEAT)
Serial.println(", auto-repeat");
else
Serial.println();
}
}

View File

@ -1,190 +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.
*/
#include <IRreceiver.h>
#include <DMD.h>
#include <Mono5x7.h>
#define SNAKE_ADVANCE_TIME 150
#define SNAKE_BLINK_TIME 500
#define SNAKE_INC_STEPS 5
#define SNAKE_MAX_LENGTH 50
#define SNAKE_START_LENGTH 10
struct Point
{
int x, y;
};
DMD display;
IRreceiver ir;
bool paused;
bool gameOver;
bool waitForStart;
bool snakeDrawn;
unsigned long lastChange;
Point direction;
Point snakeParts[SNAKE_MAX_LENGTH];
int snakeLength;
int incStep;
ISR(TIMER1_OVF_vect)
{
display.refresh();
}
void setup() {
display.enableTimer1();
display.setFont(Mono5x7);
startGame();
}
void drawSnake(Bitmap::Color color) {
for (int index = 0; index < snakeLength; ++index)
display.setPixel(snakeParts[index].x, snakeParts[index].y, color);
}
void loop() {
// Handle the "Game Over" state. Any key press starts a new game.
int cmd = ir.command();
if (gameOver) {
if (cmd != -1 && (cmd & IRreceiver::AUTO_REPEAT) == 0)
startGame();
return;
}
// Pause the game if waiting for the first start. While waiting,
// blink the location of the snake to help the player get their bearings.
if (waitForStart) {
if (cmd == -1) {
if ((millis() - lastChange) >= SNAKE_BLINK_TIME) {
snakeDrawn = !snakeDrawn;
drawSnake(snakeDrawn ? Bitmap::White : Bitmap::Black);
lastChange += SNAKE_BLINK_TIME;
}
return;
}
drawSnake(Bitmap::White);
waitForStart = false;
snakeDrawn = true;
lastChange = millis();
}
// Process commands from the player.
switch (cmd) {
// Both arrow keys and numbers can be used to control the direction,
// in case the remote control does not have arrow keys.
case RC5_LEFT: case RC5_4:
changeDirection(-1, 0);
break;
case RC5_RIGHT: case RC5_6:
changeDirection(1, 0);
break;
case RC5_UP: case RC5_2:
changeDirection(0, -1);
break;
case RC5_DOWN: case RC5_8:
changeDirection(0, 1);
break;
case RC5_PAUSE: case RC5_PLAY: case RC5_0:
// Pause or resume the game.
paused = !paused;
lastChange = millis();
break;
case RC5_STOP: case RC5_STANDBY:
// Stop the game and start a new one.
startGame();
break;
}
// Advance the snake position if not paused and the timeout has expired.
if (!paused && (millis() - lastChange) >= SNAKE_ADVANCE_TIME) {
++incStep;
advanceSnake(incStep >= SNAKE_INC_STEPS);
lastChange += SNAKE_ADVANCE_TIME;
}
}
void startGame() {
randomSeed(micros() + analogRead(A0)); // Analog read adds some noise.
display.clear();
display.drawRect(0, 0, display.width() - 1, display.height() - 1);
for (int count = 0; count < 10; ++count) {
int x, y;
if (random(0, 2) == 0) {
x = random(1, display.width() - 5);
y = random(1, display.height() - 1);
display.drawLine(x, y, x + 4, y);
} else {
x = random(1, display.width() - 1);
y = random(1, display.height() - 3);
display.drawLine(x, y, x, y + 2);
}
}
paused = false;
gameOver = false;
waitForStart = true;
snakeDrawn = true;
lastChange = millis();
direction.x = 1;
direction.y = 0;
incStep = 0;
snakeLength = SNAKE_START_LENGTH;
for (int index = 0; index < snakeLength; ++index) {
snakeParts[index].x = 3 + index;
snakeParts[index].y = 4;
display.setPixel
(snakeParts[index].x, snakeParts[index].y, Bitmap::White);
}
}
void changeDirection(int x, int y) {
direction.x = x;
direction.y = y;
}
void advanceSnake(bool increase) {
int x = snakeParts[snakeLength - 1].x + direction.x;
int y = snakeParts[snakeLength - 1].y + direction.y;
if (display.pixel(x, y) == Bitmap::White) {
gameOver = true;
display.clear();
display.drawText(5, 0, "Game");
display.drawText(3, 8, "Over!");
return;
}
if (!increase || snakeLength >= SNAKE_MAX_LENGTH) {
display.setPixel(snakeParts[0].x, snakeParts[0].y, Bitmap::Black);
for (int index = 0; index < snakeLength - 1; ++index)
snakeParts[index] = snakeParts[index + 1];
} else {
++snakeLength;
}
snakeParts[snakeLength - 1].x = x;
snakeParts[snakeLength - 1].y = y;
display.setPixel(x, y, Bitmap::White);
if (increase)
incStep = 0;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

View File

@ -1,8 +0,0 @@
IRreceiver KEYWORD1
command KEYWORD2
system KEYWORD2
systemFilter KEYWORD2
setSystemFilter KEYWORD2
AUTO_REPEAT LITERAL1

View File

@ -1,197 +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.
*/
#include "BoolField.h"
/**
* \class BoolField BoolField.h <BoolField.h>
* \brief Field that manages the input of a boolean value.
*
* BoolField is intended for field values that are modifiable by the user.
* Pressing one of Up or Down will toggle the field's current value.
*
* The following example creates a boolean field that shows the state
* of the status LED on D13. When the LED is on (the default), the string
* "On" will be displayed on the LCD screen. When the LED is off, the
* string "Off" will be displayed instead.
*
* \code
* Form mainForm(lcd);
* BoolField ledField(mainForm, "Status LED", "On", "Off", true);
* \endcode
*
* \image html FormBool.png
*
* To actually toggle the LED, the application's main loop() function
* should contain the following code:
*
* \code
* int event = lcd.getButton();
* if (mainForm.dispatch(event) == FORM_CHANGED) {
* if (mainForm.isCurrent(ledField)) {
* if (ledField.value())
* digitalWrite(STATUS_LED, HIGH);
* else
* digitalWrite(STATUS_LED, LOW);
* }
* }
* \endcode
*
* Use TextField for read-only fields that report boolean values but
* which are not modifiable by the user.
*
* ListField can be used to select between more than two items.
*
* \sa Field, ListField, TextField
*/
/**
* \brief Constructs a new boolean field with a specific \a label.
*
* The field is initially not associated with a Form. The field can be
* added to a form later using Form::addField().
*
* The initial value() will be false.
*
* \sa Form::addField()
*/
BoolField::BoolField(const String &label)
: Field(label)
, _printLen(0)
, _value(false)
{
}
/**
* \brief Constructs a new boolean field with a specific \a label and
* attaches it to a \a form.
*
* The initial value() of the field is set to the parameter \a value.
* When value() is true, \a trueLabel will be displayed on the screen.
* When value() is false, \a falseLabel will be displayed on the screen.
*
* \sa value()
*/
BoolField::BoolField(Form &form, const String &label, const String &trueLabel, const String &falseLabel, bool value)
: Field(form, label)
, _trueLabel(trueLabel)
, _falseLabel(falseLabel)
, _printLen(0)
, _value(value)
{
}
int BoolField::dispatch(int event)
{
if (event == LCD_BUTTON_UP || event == LCD_BUTTON_DOWN) {
setValue(!_value);
return FORM_CHANGED;
} else {
return -1;
}
}
void BoolField::enterField(bool reverse)
{
Field::enterField(reverse);
printValue();
}
/**
* \fn bool BoolField::value() const
* \brief Returns the current value of this field, true or false.
*
* \sa setValue()
*/
/**
* \brief Sets the current value of this field to \a value.
*
* \sa value()
*/
void BoolField::setValue(bool value)
{
if (value != _value) {
_value = value;
if (isCurrent())
printValue();
}
}
/**
* \fn const String &BoolField::trueLabel() const
* \brief Returns the string that is displayed when value() is true.
*
* \sa setTrueLabel(), falseLabel()
*/
/**
* \brief Sets the string that is displayed when value() is true to
* \a trueLabel.
*
* \sa trueLabel(), setFalseLabel()
*/
void BoolField::setTrueLabel(const String &trueLabel)
{
_trueLabel = trueLabel;
if (isCurrent())
printValue();
}
/**
* \fn const String &BoolField::falseLabel() const
* \brief Returns the string that is displayed when value() is false.
*
* \sa setFalseLabel(), trueLabel()
*/
/**
* \brief Sets the string that is displayed when value() is false to
* \a falseLabel.
*
* \sa falseLabel(), setTrueLabel()
*/
void BoolField::setFalseLabel(const String &falseLabel)
{
_falseLabel = falseLabel;
if (isCurrent())
printValue();
}
void BoolField::printValue()
{
unsigned int len;
lcd()->setCursor(0, 1);
if (_value) {
lcd()->print(_trueLabel);
len = _trueLabel.length();
while (len++ < _printLen)
lcd()->write(' ');
_printLen = _trueLabel.length();
} else {
lcd()->print(_falseLabel);
len = _falseLabel.length();
while (len++ < _printLen)
lcd()->write(' ');
_printLen = _falseLabel.length();
}
}

View File

@ -1,55 +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.
*/
#ifndef BoolField_h
#define BoolField_h
#include "Field.h"
class BoolField : public Field {
public:
explicit BoolField(const String &label);
BoolField(Form &form, const String &label, const String &trueLabel, const String &falseLabel, bool value);
int dispatch(int event);
void enterField(bool reverse);
bool value() const { return _value; }
void setValue(bool value);
const String &trueLabel() const { return _trueLabel; }
void setTrueLabel(const String &trueLabel);
const String &falseLabel() const { return _falseLabel; }
void setFalseLabel(const String &falseLabel);
private:
String _trueLabel;
String _falseLabel;
int _printLen;
bool _value;
void printValue();
};
#endif

View File

@ -1,194 +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.
*/
#include "Field.h"
/**
* \class Field Field.h <Field.h>
* \brief Manages a single data input/output field within a Form.
*
* \sa Form, BoolField, IntField, ListField, TextField, TimeField
*/
/**
* \brief Constructs a new field with a specific \a label.
*
* The field is initially not associated with a Form. The field can be
* added to a form later using Form::addField().
*
* \sa Form::addField()
*/
Field::Field(const String &label)
: _label(label)
, _form(0)
, next(0)
, prev(0)
{
}
/**
* \brief Constructs a new field with a specific \a label and attaches
* it to a \a form.
*/
Field::Field(Form &form, const String &label)
: _label(label)
, _form(0)
, next(0)
, prev(0)
{
form.addField(this);
}
/**
* \brief Destroys this field and removes it from its owning Form.
*
* \sa Form::removeField()
*/
Field::~Field()
{
if (_form)
_form->removeField(this);
}
/**
* \fn Form *Field::form() const
* \brief Returns the Form that owns this field; null if not associated
* with a Form.
*/
/**
* \brief Dispatches \a event via this field.
*
* The \a event is usually obtained from LCD::getButton().
*
* Returns zero if the \a event has been handled and no further action
* is required.
*
* Returns FORM_CHANGED if the \a event has changed the value of this
* field in a manner that may require the application to take further
* action based on the new field value.
*
* Returns -1 if the \a event is not handled by this field, and should
* be handled by the Form itself (particularly for Left and Right buttons).
* The default implementation returns -1 for all events.
*
* \sa Form::dispatch(), LCD::getButton()
*/
int Field::dispatch(int event)
{
// Nothing to do here.
return -1;
}
/**
* \brief Enters the field due to form navigation.
*
* This function is typically called when the user presses Left and Right
* buttons to navigate to the field. If \a reverse is true, then navigation
* was due to the Left button being pressed.
*
* This function can assume that the display has been cleared and the
* cursor is positioned at (0, 0).
*
* The default implementation prints the label().
*
* \sa exitField()
*/
void Field::enterField(bool reverse)
{
lcd()->print(_label);
}
/**
* \brief Exits the field due to form navigation.
*
* This function is typically called when the user presses Left and Right
* buttons to navigate from the field.
*
* \sa enterField()
*/
void Field::exitField()
{
// Nothing to do here.
}
/**
* \fn const String &Field::label() const
* \brief Returns the label to display in the first line of this field.
*
* \sa setLabel()
*/
/**
* \brief Sets the \a label to display in the first line of this field.
*
* \sa label()
*/
void Field::setLabel(const String &label)
{
if (isCurrent()) {
unsigned int prevLen = _label.length();
unsigned int newLen = label.length();
_label = label;
lcd()->setCursor(0, 0);
lcd()->print(label);
while (newLen++ < prevLen)
lcd()->write(' ');
updateCursor();
} else {
_label = label;
}
}
/**
* \brief Returns true if this field is the currently-displayed field in
* its owning form; false otherwise.
*
* This function should be called from property setters in subclasses to
* determine if the screen should be updated when a property is modified.
*/
bool Field::isCurrent() const
{
if (!_form->isVisible())
return false;
return _form->currentField() == this;
}
/**
* \fn LiquidCrystal *Field::lcd() const
* \brief Returns the LCD that this field is being drawn on.
*/
/**
* \brief Updates the cursor position after the label has been drawn
* by setLabel().
*
* The default implementation does nothing. Subclasses that use an LCD
* cursor may override this to ensure that the cursor position stays
* valid after the label is modified.
*
* \sa setLabel()
*/
void Field::updateCursor()
{
// Nothing to do here.
}

View File

@ -1,60 +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.
*/
#ifndef Field_h
#define Field_h
#include "Form.h"
class Field {
public:
explicit Field(const String &label);
Field(Form &form, const String &label);
~Field();
Form *form() const { return _form; }
virtual int dispatch(int event);
virtual void enterField(bool reverse);
virtual void exitField();
const String &label() const { return _label; }
void setLabel(const String &label);
bool isCurrent() const;
protected:
LiquidCrystal *lcd() const { return _form->_lcd; }
virtual void updateCursor();
private:
String _label;
Form *_form;
Field *next;
Field *prev;
friend class Form;
};
#endif

View File

@ -1,308 +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.
*/
#include "Form.h"
#include "Field.h"
/**
* \class Form Form.h <Form.h>
* \brief Manager for a form containing data input/output fields.
*
* See the \ref lcd_form "Form example" for more information on
* creating an application that uses forms and fields.
*/
/**
* \brief Constructs a new form and associates it with \a lcd.
*
* This constructor is typically followed by calls to construct Field
* values for each of the fields on the form. For example:
*
* \code
* Form mainForm(lcd);
* TextField welcomeField(mainForm, "Form example", "v1.0");
* \endcode
*
* \image html FormText.png
*/
Form::Form(LiquidCrystal &lcd)
: _lcd(&lcd)
, first(0)
, last(0)
, current(0)
{
}
/**
* \brief Detaches all remaining fields and destroys this form.
*/
Form::~Form()
{
Field *field = first;
Field *next;
while (field != 0) {
next = field->next;
field->_form = 0;
field->next = 0;
field->prev = 0;
field = next;
}
}
/**
* \brief Dispatches \a event to the currently active field using
* Field::dispatch().
*
* The \a event is usually obtained from LCD::getButton().
*
* Returns zero if the \a event has been handled and no further action
* is required.
*
* Returns FORM_CHANGED if one of the fields on the form has changed value
* due to the \a event, perhaps requiring the application to take further
* action based on the new field value. Use currentField() or isCurrent()
* to determine which field has changed.
*
* \code
* int event = lcd.getButton();
* if (mainForm.dispatch(event) == FORM_CHANGED) {
* if (mainForm.isCurrent(volumeField)) {
* // Adjust the volume to match the field.
* setVolume(volumeField.value());
* }
* }
* \endcode
*
* This function handles the Left and Right buttons to navigate between fields.
*
* \sa Field::dispatch(), LCD::getButton(), currentField(), isCurrent()
*/
int Form::dispatch(int event)
{
if (current) {
int exitval = current->dispatch(event);
if (exitval >= 0)
return exitval;
}
if (event == LCD_BUTTON_LEFT)
prevField();
else if (event == LCD_BUTTON_RIGHT)
nextField();
return 0;
}
/**
* \brief Changes to the next field in the "tab order".
*
* \sa prevField(), defaultField(), currentField()
*/
void Form::nextField()
{
Field *field = current;
if (!field)
field = first;
if (field && field->next)
field = field->next;
else
field = first;
setCurrentField(field);
}
/**
* \brief Changes to the previous field in the "tab order".
*
* \sa nextField(), defaultField(), currentField()
*/
void Form::prevField()
{
Field *field = current;
if (!field)
field = last;
if (field && field->prev)
field = field->prev;
else
field = last;
setCurrentField(field);
}
/**
* \brief Changes to default field (i.e., the first field).
*
* \sa nextField(), prevField(), currentField()
*/
void Form::defaultField()
{
setCurrentField(first);
}
/**
* \brief Adds \a field to this form.
*
* Usually this function is not required because the field's constructor
* will add the field to the form automatically.
*
* \sa removeField()
*/
void Form::addField(Field *field)
{
if (field->_form)
return; // Already added to a form.
field->_form = this;
field->next = 0;
field->prev = last;
if (last)
last->next = field;
else
first = field;
last = field;
}
/**
* \brief Removes \a field from this form.
*
* If \a field is the current field on-screen, then either the next or
* previous field will be made current.
*
* \sa addField()
*/
void Form::removeField(Field *field)
{
if (field->_form != this)
return; // Not a member of this form.
if (current == field) {
if (field->next)
setCurrentField(field->next);
else if (field->prev)
setCurrentField(field->prev);
else
setCurrentField(0);
}
if (field->next)
field->next->prev = field->prev;
else
last = field->prev;
if (field->prev)
field->prev->next = field->next;
else
first = field->next;
field->_form = 0;
field->next = 0;
field->prev = 0;
}
/**
* \fn Field *Form::currentField() const
* \brief Returns the current field that is displayed on-screen.
*
* Returns null if the form has no fields, or setCurrentField() explicitly
* set the current field to null.
*
* \sa setCurrentField(), isCurrent()
*/
/**
* \brief Sets the current \a field that is displayed on-screen.
*
* Use this function to programmatically force the form to display a
* specific field on-screen.
*
* \sa currentField(), isCurrent()
*/
void Form::setCurrentField(Field *field)
{
if (field && field->_form != this)
return; // Wrong form.
if (visible) {
bool reverse = false;
if (current) {
current->exitField();
if (field->next == current)
reverse = true;
else if (!field->next && current == first)
reverse = true;
}
current = field;
_lcd->clear();
if (current)
current->enterField(reverse);
} else {
current = field;
}
}
/**
* \fn bool Form::isCurrent(Field &field) const
* \brief Returns true if \a field is currently displayed on-screen, false otherwise.
*
* This function is typically called after dispatch() returns FORM_CHANGED
* to determine which field has changed.
*
* \sa currentField(), setCurrentField()
*/
/**
* \brief Shows the form, or does nothing if the form is already on-screen.
*
* When the form is shown, the screen will be cleared and the currentField()
* will be drawn.
*
* If the form was previously hidden, then the field that was previously
* current will be shown again. Call defaultField() before show() to reset
* the form to show the first field instead.
*
* \sa hide(), isVisible(), defaultField()
*/
void Form::show()
{
if (!visible) {
if (!current)
current = first;
visible = true;
_lcd->clear();
if (current)
current->enterField(false);
}
}
/**
* \brief Hides the form, or does nothing if the form is not on-screen.
*
* The screen will be cleared to remove the contents of the current field.
*
* \sa show(), isVisible()
*/
void Form::hide()
{
if (visible) {
if (current)
current->exitField();
visible = false;
_lcd->clear();
}
}
/**
* \fn bool Form::isVisible() const
* \brief Returns true if the form is shown; false if the form is hidden.
*
* \sa show(), hide()
*/

View File

@ -1,65 +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.
*/
#ifndef Form_h
#define Form_h
#include "LCD.h"
class Field;
#define FORM_CHANGED 1
class Form {
public:
explicit Form(LiquidCrystal &lcd);
~Form();
int dispatch(int event);
void nextField();
void prevField();
void defaultField();
void addField(Field *field);
void removeField(Field *field);
Field *currentField() const { return current; }
void setCurrentField(Field *field);
bool isCurrent(Field &field) const { return current == &field; }
void show();
void hide();
bool isVisible() const { return visible; }
private:
LiquidCrystal *_lcd;
Field *first;
Field *last;
Field *current;
bool visible;
friend class Field;
};
#endif

View File

@ -1,249 +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.
*/
#include "IntField.h"
/**
* \class IntField IntField.h <IntField.h>
* \brief Field that manages the input of an integer value.
*
* IntField is intended for field values that are modifiable by the user.
* Pressing Up adds stepValue() to the current value and pressing Down
* subtracts stepValue() from the current value. The value is clamped to
* the range minValue() to maxValue().
*
* The following example creates an integer field with the label "Iterations",
* that ranges between 1 and 5, with a stepValue() of 1, and an initial
* default value() of 2:
*
* \code
* Form mainForm(lcd);
* IntField iterField(mainForm, "Iterations", 1, 5, 1, 2);
* \endcode
*
* IntField can be configured to show a suffix() on the screen after the
* integer value(). This is intended for communicating the units in which
* the value is expressed. For example:
*
* \code
* IntField volumeField(mainForm, "Volume", 0, 100, 5, 85, "%");
* IntField speedField(mainForm, "Speed", 0, 2000, 15, 450, " rpm");
* \endcode
*
* \image html FormInt.png
*
* Use TextField for read-only fields that report integer values but
* which are not modifiable by the user.
*
* \sa Field, TextField
*/
/**
* \brief Constructs a new integer field with a specific \a label.
*
* The field is initially not associated with a Form. The field can be
* added to a form later using Form::addField().
*
* Initially, value() is 0, minValue() is 0, maxValue() is 100,
* stepValue() is 1, and suffix() is an empty string.
*
* \sa Form::addField()
*/
IntField::IntField(const String &label)
: Field(label)
, _minValue(0)
, _maxValue(100)
, _stepValue(1)
, _value(0)
, _printLen(0)
{
}
/**
* \brief Constructs a new integer field with a specific \a label,
* \a minValue, \a maxValue, \a stepValue, and \a value, and attaches
* it to a \a form.
*
* The suffix() is initially set to an empty string.
*/
IntField::IntField(Form &form, const String &label, int minValue, int maxValue, int stepValue, int value)
: Field(form, label)
, _minValue(minValue)
, _maxValue(maxValue)
, _stepValue(stepValue)
, _value(value)
, _printLen(0)
{
}
/**
* \brief Constructs a new integer field with a specific \a label,
* \a minValue, \a maxValue, \a stepValue, \a value, and \a suffix
* and attaches it to a \a form.
*/
IntField::IntField(Form &form, const String &label, int minValue, int maxValue, int stepValue, int value, const String &suffix)
: Field(form, label)
, _minValue(minValue)
, _maxValue(maxValue)
, _stepValue(stepValue)
, _value(value)
, _printLen(0)
, _suffix(suffix)
{
}
int IntField::dispatch(int event)
{
if (event == LCD_BUTTON_UP) {
setValue(_value + _stepValue);
return FORM_CHANGED;
} else if (event == LCD_BUTTON_DOWN) {
setValue(_value - _stepValue);
return FORM_CHANGED;
}
return -1;
}
void IntField::enterField(bool reverse)
{
Field::enterField(reverse);
printValue();
}
/**
* \fn int IntField::minValue() const
* \brief Returns the minimum value for the input field.
*
* \sa setMinValue(), maxValue(), stepValue(), value()
*/
/**
* \fn void IntField::setMinValue(int value)
* \brief Sets the minimum \a value for the input field.
*
* The new minimum \a value will be used to clamp the field's value the
* next time setValue() is called.
*
* \sa minValue(), setMaxValue(), setStepValue(), setValue()
*/
/**
* \fn int IntField::maxValue() const
* \brief Returns the maximum value for the input field.
*
* \sa setMaxValue(), minValue(), stepValue(), value()
*/
/**
* \fn void IntField::setMaxValue(int value)
* \brief Sets the maximum \a value for the input field.
*
* The new maximum \a value will be used to clamp the field's value the
* next time setValue() is called.
*
* \sa maxValue(), setMinValue(), setStepValue(), setValue()
*/
/**
* \fn int IntField::stepValue() const
* \brief Returns the step value to use when increasing or decreasing the
* value() due to Up and Down button presses.
*
* \sa setStepValue(), minValue(), maxValue(), value()
*/
/**
* \fn void IntField::setStepValue(int value)
* \brief Sets the step value \a value to use when increasing or decreasing
* the value() due to Up and Down button presses.
*
* \sa stepValue(), setMinValue(), setMaxValue(), setValue()
*/
/**
* \fn int IntField::value() const
* \brief Returns the current value of this field.
*
* \sa setValue(), minValue(), maxValue(), stepValue()
*/
/**
* \fn void IntField::setValue(int value)
* \brief Sets the current \a value of this field.
*
* The \a value will be clamped to the range defined by minValue()
* and maxValue().
*
* \sa value(), setMinValue(), setMaxValue(), setStepValue()
*/
void IntField::setValue(int value)
{
if (value < _minValue)
value = _minValue;
else if (value > _maxValue)
value = _maxValue;
if (value != _value) {
_value = value;
if (isCurrent())
printValue();
}
}
/**
* \fn const String &IntField::suffix() const
* \brief Returns the suffix string to be displayed after the field's value.
*
* \sa setSuffix()
*/
/**
* \brief Sets the \a suffix string to be displayed after the field's value.
*
* Suffixes are typically used to indicate the units that the value() is
* expressed in. For example:
*
* \code
* field.setSuffix("%");
* field.setSuffix(" rpm");
* \endcode
*
* \sa suffix()
*/
void IntField::setSuffix(const String &suffix)
{
_suffix = suffix;
if (isCurrent())
printValue();
}
void IntField::printValue()
{
String str(_value);
if (_suffix.length())
str += _suffix;
lcd()->setCursor(0, 1);
lcd()->print(str);
unsigned int len = str.length();
while (len++ < _printLen)
lcd()->write(' ');
_printLen = str.length();
}

Some files were not shown because too many files have changed in this diff Show More