commit eead6a8a1f7a8388ffee68d6471ab665d0a21725 Author: Rhys Weatherley Date: Fri May 25 15:12:09 2012 +1000 Initial doc commit diff --git a/BlinkLED_8cpp_source.html b/BlinkLED_8cpp_source.html new file mode 100644 index 00000000..14518057 --- /dev/null +++ b/BlinkLED_8cpp_source.html @@ -0,0 +1,180 @@ + + + + +ArduinoLibs: BlinkLED.cpp Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
BlinkLED.cpp
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #include "BlinkLED.h"
+00024 #if defined(ARDUINO) && ARDUINO >= 100
+00025 #include <Arduino.h>
+00026 #else
+00027 #include <WProgram.h>
+00028 #endif
+00029 
+00064 BlinkLED::BlinkLED(uint8_t pin, unsigned long onTime, unsigned long offTime, bool initialState)
+00065     : _pin(pin)
+00066     , _state(initialState)
+00067     , _paused(false)
+00068     , _onTime(onTime)
+00069     , _offTime(offTime)
+00070 {
+00071     pinMode(pin, OUTPUT);
+00072     digitalWrite(pin, initialState ? HIGH : LOW);
+00073     _lastChange = millis();
+00074 }
+00075 
+00079 void BlinkLED::loop()
+00080 {
+00081     if (_paused)
+00082         return;
+00083     unsigned long currentTime = millis();
+00084     if (_state) {
+00085         if ((currentTime - _lastChange) >= _onTime) {
+00086             digitalWrite(_pin, LOW);
+00087             _lastChange += _onTime;
+00088             _state = false;
+00089         }
+00090     } else {
+00091         if ((currentTime - _lastChange) >= _offTime) {
+00092             digitalWrite(_pin, HIGH);
+00093             _lastChange += _offTime;
+00094             _state = true;
+00095         }
+00096     }
+00097 }
+00098 
+00122 void BlinkLED::setBlinkRate(unsigned long onTime, unsigned long offTime)
+00123 {
+00124     _onTime = onTime;
+00125     _offTime = offTime;
+00126 }
+00127 
+00145 void BlinkLED::setState(bool state)
+00146 {
+00147     if (_state != state) {
+00148         digitalWrite(_pin, state ? HIGH : LOW);
+00149         _state = state;
+00150         _lastChange = millis();
+00151     }
+00152 }
+00153 
+00170 void BlinkLED::resume()
+00171 {
+00172     if (_paused) {
+00173         _paused = false;
+00174         unsigned long currentTime = millis();
+00175         if (_state) {
+00176             if ((currentTime - _lastChange) >= _onTime) {
+00177                 digitalWrite(_pin, LOW);
+00178                 _lastChange = currentTime;
+00179                 _state = false;
+00180             }
+00181         } else {
+00182             if ((currentTime - _lastChange) >= _offTime) {
+00183                 digitalWrite(_pin, HIGH);
+00184                 _lastChange = currentTime;
+00185                 _state = true;
+00186             }
+00187         }
+00188     }
+00189 }
+00190 
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/BlinkLED_8h_source.html b/BlinkLED_8h_source.html new file mode 100644 index 00000000..e4481287 --- /dev/null +++ b/BlinkLED_8h_source.html @@ -0,0 +1,138 @@ + + + + +ArduinoLibs: BlinkLED.h Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
BlinkLED.h
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #ifndef BlinkLED_h
+00024 #define BlinkLED_h
+00025 
+00026 #include <inttypes.h>
+00027 
+00028 class BlinkLED
+00029 {
+00030 public:
+00031     BlinkLED(uint8_t pin, unsigned long onTime, unsigned long offTime, bool initialState = false);
+00032 
+00033     void loop();
+00034 
+00035     unsigned long onTime() const { return _onTime; }
+00036     unsigned long offTime() const { return _offTime; }
+00037     void setBlinkRate(unsigned long onTime, unsigned long offTime);
+00038 
+00039     bool state() const { return _state; }
+00040     void setState(bool state);
+00041 
+00042     void pause() { _paused = true; }
+00043     void resume();
+00044     bool isPaused() const { return _paused; }
+00045 
+00046 private:
+00047     uint8_t _pin;
+00048     bool _state;
+00049     bool _paused;
+00050     unsigned long _onTime;
+00051     unsigned long _offTime;
+00052     unsigned long _lastChange;
+00053 };
+00054 
+00055 #endif
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/BoolField_8cpp_source.html b/BoolField_8cpp_source.html new file mode 100644 index 00000000..d0b51091 --- /dev/null +++ b/BoolField_8cpp_source.html @@ -0,0 +1,180 @@ + + + + +ArduinoLibs: BoolField.cpp Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
BoolField.cpp
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #include "BoolField.h"
+00024 
+00077 BoolField::BoolField(const String &label)
+00078     : Field(label)
+00079     , _printLen(0)
+00080     , _value(false)
+00081 {
+00082 }
+00083 
+00094 BoolField::BoolField(Form &form, const String &label, const String &trueLabel, const String &falseLabel, bool value)
+00095     : Field(form, label)
+00096     , _trueLabel(trueLabel)
+00097     , _falseLabel(falseLabel)
+00098     , _printLen(0)
+00099     , _value(value)
+00100 {
+00101 }
+00102 
+00103 int BoolField::dispatch(int event)
+00104 {
+00105     if (event == LCD_BUTTON_UP || event == LCD_BUTTON_DOWN) {
+00106         setValue(!_value);
+00107         return FORM_CHANGED;
+00108     } else {
+00109         return -1;
+00110     }
+00111 }
+00112 
+00113 void BoolField::enterField(bool reverse)
+00114 {
+00115     Field::enterField(reverse);
+00116     printValue();
+00117 }
+00118 
+00131 void BoolField::setValue(bool value)
+00132 {
+00133     if (value != _value) {
+00134         _value = value;
+00135         if (isCurrent())
+00136             printValue();
+00137     }
+00138 }
+00139 
+00153 void BoolField::setTrueLabel(const String &trueLabel)
+00154 {
+00155     _trueLabel = trueLabel;
+00156     if (isCurrent())
+00157         printValue();
+00158 }
+00159 
+00173 void BoolField::setFalseLabel(const String &falseLabel)
+00174 {
+00175     _falseLabel = falseLabel;
+00176     if (isCurrent())
+00177         printValue();
+00178 }
+00179 
+00180 void BoolField::printValue()
+00181 {
+00182     unsigned int len;
+00183     lcd()->setCursor(0, 1);
+00184     if (_value) {
+00185         lcd()->print(_trueLabel);
+00186         len = _trueLabel.length();
+00187         while (len++ < _printLen)
+00188             lcd()->write(' ');
+00189         _printLen = _trueLabel.length();
+00190     } else {
+00191         lcd()->print(_falseLabel);
+00192         len = _falseLabel.length();
+00193         while (len++ < _printLen)
+00194             lcd()->write(' ');
+00195         _printLen = _falseLabel.length();
+00196     }
+00197 }
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/BoolField_8h_source.html b/BoolField_8h_source.html new file mode 100644 index 00000000..c9f65bef --- /dev/null +++ b/BoolField_8h_source.html @@ -0,0 +1,138 @@ + + + + +ArduinoLibs: BoolField.h Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
BoolField.h
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #ifndef BoolField_h
+00024 #define BoolField_h
+00025 
+00026 #include "Field.h"
+00027 
+00028 class BoolField : public Field {
+00029 public:
+00030     explicit BoolField(const String &label);
+00031     BoolField(Form &form, const String &label, const String &trueLabel, const String &falseLabel, bool value);
+00032 
+00033     int dispatch(int event);
+00034 
+00035     void enterField(bool reverse);
+00036 
+00037     bool value() const { return _value; }
+00038     void setValue(bool value);
+00039 
+00040     const String &trueLabel() const { return _trueLabel; }
+00041     void setTrueLabel(const String &trueLabel);
+00042 
+00043     const String &falseLabel() const { return _falseLabel; }
+00044     void setFalseLabel(const String &falseLabel);
+00045 
+00046 private:
+00047     String _trueLabel;
+00048     String _falseLabel;
+00049     int _printLen;
+00050     bool _value;
+00051 
+00052     void printValue();
+00053 };
+00054 
+00055 #endif
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/ChaseLEDs_8cpp_source.html b/ChaseLEDs_8cpp_source.html new file mode 100644 index 00000000..b96e9ca0 --- /dev/null +++ b/ChaseLEDs_8cpp_source.html @@ -0,0 +1,148 @@ + + + + +ArduinoLibs: ChaseLEDs.cpp Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
ChaseLEDs.cpp
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #include "ChaseLEDs.h"
+00024 #if defined(ARDUINO) && ARDUINO >= 100
+00025 #include <Arduino.h>
+00026 #else
+00027 #include <WProgram.h>
+00028 #endif
+00029 
+00071 ChaseLEDs::ChaseLEDs(const uint8_t *pins, int num, unsigned long advanceTime)
+00072     : _pins(pins)
+00073     , _numPins(num)
+00074     , _currentIndex(-1)
+00075     , _advanceTime(advanceTime)
+00076     , _lastChange(millis())
+00077 {
+00078     for (uint8_t index = 0; index < _numPins; ++index) {
+00079         pinMode(_pins[index], OUTPUT);
+00080         digitalWrite(_pins[index], LOW);
+00081     }
+00082 }
+00083 
+00087 void ChaseLEDs::loop()
+00088 {
+00089     if (_currentIndex >= 0) {
+00090         if ((millis() - _lastChange) >= _advanceTime) {
+00091             // Advance to the next LED in sequence.
+00092             _currentIndex = (_currentIndex + 1) % _numPins;
+00093             _lastChange += _advanceTime;
+00094             advance(previousPin(1), _pins[_currentIndex]);
+00095         }
+00096     } else {
+00097         // First time - light the first LED.
+00098         _currentIndex = 0;
+00099         _lastChange = millis();
+00100         advance(previousPin(1), _pins[_currentIndex]);
+00101     }
+00102 }
+00103 
+00136 void ChaseLEDs::advance(uint8_t prevPin, uint8_t nextPin)
+00137 {
+00138     digitalWrite(prevPin, LOW);
+00139     digitalWrite(nextPin, HIGH);
+00140 }
+00141 
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/ChaseLEDs_8h_source.html b/ChaseLEDs_8h_source.html new file mode 100644 index 00000000..d5b6b322 --- /dev/null +++ b/ChaseLEDs_8h_source.html @@ -0,0 +1,134 @@ + + + + +ArduinoLibs: ChaseLEDs.h Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
ChaseLEDs.h
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #ifndef ChaseLEDs_h
+00024 #define ChaseLEDs_h
+00025 
+00026 #include <inttypes.h>
+00027 
+00028 class ChaseLEDs
+00029 {
+00030 public:
+00031     ChaseLEDs(const uint8_t *pins, int num, unsigned long advanceTime);
+00032 
+00033     void loop();
+00034 
+00035     unsigned long advanceTime() const { return _advanceTime; }
+00036     void setAdvanceTime(unsigned long advanceTime) { _advanceTime = advanceTime; }
+00037 
+00038 protected:
+00039     virtual void advance(uint8_t prevPin, uint8_t nextPin);
+00040     uint8_t previousPin(int n) const
+00041         { return _pins[(_currentIndex + _numPins - n) % _numPins]; }
+00042 
+00043 private:
+00044     const uint8_t *_pins;
+00045     int _numPins;
+00046     int _currentIndex;
+00047     unsigned long _advanceTime;
+00048     unsigned long _lastChange;
+00049 };
+00050 
+00051 #endif
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/Cylon.png b/Cylon.png new file mode 100644 index 00000000..231ccb78 Binary files /dev/null and b/Cylon.png differ diff --git a/Cylon4.png b/Cylon4.png new file mode 100644 index 00000000..a4212868 Binary files /dev/null and b/Cylon4.png differ diff --git a/DS1307RTC_8cpp_source.html b/DS1307RTC_8cpp_source.html new file mode 100644 index 00000000..b83a3c19 --- /dev/null +++ b/DS1307RTC_8cpp_source.html @@ -0,0 +1,369 @@ + + + + +ArduinoLibs: DS1307RTC.cpp Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
DS1307RTC.cpp
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #include "DS1307RTC.h"
+00024 #include "../I2C/I2CMaster.h"
+00025 #if defined(ARDUINO) && ARDUINO >= 100
+00026 #include <Arduino.h>
+00027 #else
+00028 #include <WProgram.h>
+00029 #endif
+00030 
+00054 // I2C address of the RTC chip (7-bit).
+00055 #define DS1307_I2C_ADDRESS  0x68
+00056 
+00057 // Registers.
+00058 #define DS1307_SECOND       0x00
+00059 #define DS1307_MINUTE       0x01
+00060 #define DS1307_HOUR         0x02
+00061 #define DS1307_DAY_OF_WEEK  0x03
+00062 #define DS1307_DATE         0x04
+00063 #define DS1307_MONTH        0x05
+00064 #define DS1307_YEAR         0x06
+00065 #define DS1307_CONTROL      0x07
+00066 #define DS1307_NVRAM        0x08
+00067 
+00068 // Alarm storage at the end of the RTC's NVRAM.
+00069 #define DS1307_ALARM_SIZE   3
+00070 #define DS1307_ALARMS       (64 - RTC::ALARM_COUNT * DS1307_ALARM_SIZE - 1)
+00071 #define DS1307_ALARM_MAGIC  63
+00072 
+00083 DS1307RTC::DS1307RTC(I2CMaster &bus, uint8_t oneHzPin)
+00084     : _bus(&bus)
+00085     , _oneHzPin(oneHzPin)
+00086     , prevOneHz(false)
+00087     , _isRealTime(true)
+00088 {
+00089     // Make sure the CH bit in register 0 is off or the clock won't update.
+00090     _bus->startWrite(DS1307_I2C_ADDRESS);
+00091     _bus->write(DS1307_SECOND);
+00092     if (_bus->startRead(DS1307_I2C_ADDRESS, 1)) {
+00093         uint8_t value = _bus->read();
+00094         if ((value & 0x80) != 0)
+00095             writeRegister(DS1307_SECOND, value & 0x7F);
+00096     } else {
+00097         // Did not get an acknowledgement from the RTC chip.
+00098         _isRealTime = false;
+00099     }
+00100 
+00101     // Turn on the 1 Hz square wave signal if required.
+00102     if (oneHzPin != 255 && _isRealTime) {
+00103         pinMode(oneHzPin, INPUT);
+00104         digitalWrite(oneHzPin, HIGH);
+00105         writeRegister(DS1307_CONTROL, 0x10);
+00106     }
+00107 
+00108     // Initialize the alarms in the RTC chip's NVRAM.
+00109     if (_isRealTime)
+00110         initAlarms();
+00111 }
+00112 
+00118 bool DS1307RTC::hasUpdates()
+00119 {
+00120     // If not using a 1 Hz pin or there is no RTC chip available,
+00121     // then assume that there is an update available.
+00122     if (_oneHzPin == 255 || !_isRealTime)
+00123         return true;
+00124 
+00125     // The DS1307 updates the internal registers on the falling edge of the
+00126     // 1 Hz clock.  The values should be ready to read on the rising edge.
+00127     bool value = digitalRead(_oneHzPin);
+00128     if (value && !prevOneHz) {
+00129         prevOneHz = value;
+00130         return true;
+00131     } else {
+00132         prevOneHz = value;
+00133         return false;
+00134     }
+00135 }
+00136 
+00137 inline uint8_t fromBCD(uint8_t value)
+00138 {
+00139     return (value >> 4) * 10 + (value & 0x0F);
+00140 }
+00141 
+00142 inline uint8_t fromHourBCD(uint8_t value)
+00143 {
+00144     if ((value & 0x40) != 0) {
+00145         // 12-hour mode.
+00146         uint8_t result = ((value >> 4) & 0x01) * 10 + (value & 0x0F);
+00147         if ((value & 0x20) != 0)
+00148             return (result == 12) ? 12 : (result + 12);     // PM
+00149         else
+00150             return (result == 12) ? 0 : result;             // AM
+00151     } else {
+00152         // 24-hour mode.
+00153         return fromBCD(value);
+00154     }
+00155 }
+00156 
+00157 void DS1307RTC::readTime(RTCTime *value)
+00158 {
+00159     if (_isRealTime) {
+00160         _bus->startWrite(DS1307_I2C_ADDRESS);
+00161         _bus->write(DS1307_SECOND);
+00162         if (_bus->startRead(DS1307_I2C_ADDRESS, 3)) {
+00163             value->second = fromBCD(_bus->read() & 0x7F);
+00164             value->minute = fromBCD(_bus->read());
+00165             value->hour = fromHourBCD(_bus->read());
+00166         } else {
+00167             // RTC chip is not responding.
+00168             value->second = 0;
+00169             value->minute = 0;
+00170             value->hour = 0;
+00171         }
+00172     } else {
+00173         RTC::readTime(value);
+00174     }
+00175 }
+00176 
+00177 void DS1307RTC::readDate(RTCDate *value)
+00178 {
+00179     if (!_isRealTime) {
+00180         RTC::readDate(value);
+00181         return;
+00182     }
+00183     _bus->startWrite(DS1307_I2C_ADDRESS);
+00184     _bus->write(DS1307_DATE);
+00185     if (_bus->startRead(DS1307_I2C_ADDRESS, 3)) {
+00186         value->day = fromBCD(_bus->read());
+00187         value->month = fromBCD(_bus->read());
+00188         value->year = fromBCD(_bus->read()) + 2000;
+00189     } else {
+00190         // RTC chip is not responding.
+00191         value->day = 1;
+00192         value->month = 1;
+00193         value->year = 2000;
+00194     }
+00195 }
+00196 
+00197 inline uint8_t toBCD(uint8_t value)
+00198 {
+00199     return ((value / 10) << 4) + (value % 10);
+00200 }
+00201 
+00202 void DS1307RTC::writeTime(const RTCTime *value)
+00203 {
+00204     if (_isRealTime) {
+00205         _bus->startWrite(DS1307_I2C_ADDRESS);
+00206         _bus->write(DS1307_SECOND);
+00207         _bus->write(toBCD(value->second));
+00208         _bus->write(toBCD(value->minute));
+00209         _bus->write(toBCD(value->hour));    // Changes mode to 24-hour clock.
+00210         _bus->endWrite();
+00211     } else {
+00212         RTC::writeTime(value);
+00213     }
+00214 }
+00215 
+00216 void DS1307RTC::writeDate(const RTCDate *value)
+00217 {
+00218     if (_isRealTime) {
+00219         _bus->startWrite(DS1307_I2C_ADDRESS);
+00220         _bus->write(DS1307_DATE);
+00221         _bus->write(toBCD(value->day));
+00222         _bus->write(toBCD(value->month));
+00223         _bus->write(toBCD(value->year % 100));
+00224         _bus->endWrite();
+00225     } else {
+00226         RTC::writeDate(value);
+00227     }
+00228 }
+00229 
+00230 void DS1307RTC::readAlarm(uint8_t alarmNum, RTCAlarm *value)
+00231 {
+00232     if (_isRealTime) {
+00233         _bus->startWrite(DS1307_I2C_ADDRESS);
+00234         _bus->write(DS1307_ALARMS + alarmNum * DS1307_ALARM_SIZE);
+00235         if (_bus->startRead(DS1307_I2C_ADDRESS, 3)) {
+00236             value->hour = fromBCD(_bus->read());
+00237             value->minute = fromBCD(_bus->read());
+00238             value->flags = _bus->read();
+00239         } else {
+00240             // RTC chip is not responding.
+00241             value->hour = 0;
+00242             value->minute = 0;
+00243             value->flags = 0;
+00244         }
+00245     } else {
+00246         RTC::readAlarm(alarmNum, value);
+00247     }
+00248 }
+00249 
+00250 void DS1307RTC::writeAlarm(uint8_t alarmNum, const RTCAlarm *value)
+00251 {
+00252     if (_isRealTime) {
+00253         _bus->startWrite(DS1307_I2C_ADDRESS);
+00254         _bus->write(DS1307_ALARMS + alarmNum * DS1307_ALARM_SIZE);
+00255         _bus->write(toBCD(value->hour));
+00256         _bus->write(toBCD(value->minute));
+00257         _bus->write(value->flags);
+00258         _bus->endWrite();
+00259     } else {
+00260         RTC::writeAlarm(alarmNum, value);
+00261     }
+00262 }
+00263 
+00264 int DS1307RTC::byteCount() const
+00265 {
+00266     return DS1307_ALARMS - DS1307_NVRAM;
+00267 }
+00268 
+00269 uint8_t DS1307RTC::readByte(uint8_t offset)
+00270 {
+00271     if (_isRealTime)
+00272         return readRegister(DS1307_NVRAM + offset);
+00273     else
+00274         return RTC::readByte(offset);
+00275 }
+00276 
+00277 void DS1307RTC::writeByte(uint8_t offset, uint8_t value)
+00278 {
+00279     if (_isRealTime)
+00280         writeRegister(DS1307_NVRAM + offset, value);
+00281     else
+00282         RTC::writeByte(offset, value);
+00283 }
+00284 
+00285 void DS1307RTC::initAlarms()
+00286 {
+00287     uint8_t value = readRegister(DS1307_ALARM_MAGIC);
+00288     if (value != (0xB0 + ALARM_COUNT)) {
+00289         // This is the first time we have used this clock chip,
+00290         // so initialize all alarms to their default state.
+00291         RTCAlarm alarm;
+00292         alarm.hour = 6;         // Default to 6am for alarms.
+00293         alarm.minute = 0;
+00294         alarm.flags = 0;
+00295         for (uint8_t index = 0; index < ALARM_COUNT; ++index)
+00296             writeAlarm(index, &alarm);
+00297         writeRegister(DS1307_ALARM_MAGIC, 0xB0 + ALARM_COUNT);
+00298 
+00299         // Also clear the rest of NVRAM so that it is in a known state.
+00300         // Otherwise we'll have whatever garbage was present at power-on.
+00301         _bus->startWrite(DS1307_I2C_ADDRESS);
+00302         _bus->write(DS1307_NVRAM);
+00303         for (uint8_t index = DS1307_NVRAM; index < DS1307_ALARMS; ++index)
+00304             _bus->write(0);
+00305         _bus->endWrite();
+00306     }
+00307 }
+00308 
+00309 uint8_t DS1307RTC::readRegister(uint8_t reg)
+00310 {
+00311     _bus->startWrite(DS1307_I2C_ADDRESS);
+00312     _bus->write(reg);
+00313     if (!_bus->startRead(DS1307_I2C_ADDRESS, 1))
+00314         return 0;   // RTC chip is not responding.
+00315     return _bus->read();
+00316 }
+00317 
+00318 bool DS1307RTC::writeRegister(uint8_t reg, uint8_t value)
+00319 {
+00320     _bus->startWrite(DS1307_I2C_ADDRESS);
+00321     _bus->write(reg);
+00322     _bus->write(value);
+00323     return _bus->endWrite();
+00324 }
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/DS1307RTC_8h_source.html b/DS1307RTC_8h_source.html new file mode 100644 index 00000000..51d54f6b --- /dev/null +++ b/DS1307RTC_8h_source.html @@ -0,0 +1,146 @@ + + + + +ArduinoLibs: DS1307RTC.h Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
DS1307RTC.h
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #ifndef DS1307RTC_h
+00024 #define DS1307RTC_h
+00025 
+00026 #include "RTC.h"
+00027 
+00028 class I2CMaster;
+00029 
+00030 class DS1307RTC : public RTC {
+00031 public:
+00032     DS1307RTC(I2CMaster &bus, uint8_t oneHzPin = 255);
+00033 
+00034     bool isRealTime() const { return _isRealTime; }
+00035 
+00036     bool hasUpdates();
+00037 
+00038     void readTime(RTCTime *value);
+00039     void readDate(RTCDate *value);
+00040 
+00041     void writeTime(const RTCTime *value);
+00042     void writeDate(const RTCDate *value);
+00043 
+00044     void readAlarm(uint8_t alarmNum, RTCAlarm *value);
+00045     void writeAlarm(uint8_t alarmNum, const RTCAlarm *value);
+00046 
+00047     int byteCount() const;
+00048     uint8_t readByte(uint8_t offset);
+00049     void writeByte(uint8_t offset, uint8_t value);
+00050 
+00051 private:
+00052     I2CMaster *_bus;
+00053     uint8_t _oneHzPin;
+00054     bool prevOneHz;
+00055     bool _isRealTime;
+00056 
+00057     void initAlarms();
+00058 
+00059     uint8_t readRegister(uint8_t reg);
+00060     bool writeRegister(uint8_t reg, uint8_t value);
+00061 };
+00062 
+00063 #endif
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/DS3232RTC_8cpp_source.html b/DS3232RTC_8cpp_source.html new file mode 100644 index 00000000..fee7cadb --- /dev/null +++ b/DS3232RTC_8cpp_source.html @@ -0,0 +1,512 @@ + + + + +ArduinoLibs: DS3232RTC.cpp Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
DS3232RTC.cpp
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #include "DS3232RTC.h"
+00024 #include "../I2C/I2CMaster.h"
+00025 #if defined(ARDUINO) && ARDUINO >= 100
+00026 #include <Arduino.h>
+00027 #else
+00028 #include <WProgram.h>
+00029 #endif
+00030 
+00059 // I2C address of the RTC chip (7-bit).
+00060 #define DS3232_I2C_ADDRESS  0x68
+00061 
+00062 // Registers.
+00063 #define DS3232_SECOND       0x00
+00064 #define DS3232_MINUTE       0x01
+00065 #define DS3232_HOUR         0x02
+00066 #define DS3232_DAY_OF_WEEK  0x03
+00067 #define DS3232_DATE         0x04
+00068 #define DS3232_MONTH        0x05
+00069 #define DS3232_YEAR         0x06
+00070 #define DS3232_ALARM1_SEC   0x07
+00071 #define DS3232_ALARM1_MIN   0x08
+00072 #define DS3232_ALARM1_HOUR  0x09
+00073 #define DS3232_ALARM1_DAY   0x0A
+00074 #define DS3232_ALARM2_MIN   0x0B
+00075 #define DS3232_ALARM2_HOUR  0x0C
+00076 #define DS3232_ALARM2_DAY   0x0D
+00077 #define DS3232_CONTROL      0x0E
+00078 #define DS3232_STATUS       0x0F
+00079 #define DS3232_AGING_OFFSET 0x10
+00080 #define DS3232_TEMP_MSB     0x11
+00081 #define DS3232_TEMP_LSB     0x12
+00082 #define DS3232_RESERVED     0x13
+00083 #define DS3232_NVRAM        0x14
+00084 
+00085 // Bits in the DS3232_CONTROL register.
+00086 #define DS3232_EOSC         0x80
+00087 #define DS3232_BBSQW        0x40
+00088 #define DS3232_CONV         0x20
+00089 #define DS3232_RS_1HZ       0x00
+00090 #define DS3232_RS_1024HZ    0x08
+00091 #define DS3232_RS_4096HZ    0x10
+00092 #define DS3232_RS_8192HZ    0x18
+00093 #define DS3232_INTCN        0x04
+00094 #define DS3232_A2IE         0x02
+00095 #define DS3232_A1IE         0x01
+00096 
+00097 // Bits in the DS3232_STATUS register.
+00098 #define DS3232_OSF          0x80
+00099 #define DS3232_BB32KHZ      0x40
+00100 #define DS3232_CRATE_64     0x00
+00101 #define DS3232_CRATE_128    0x10
+00102 #define DS3232_CRATE_256    0x20
+00103 #define DS3232_CRATE_512    0x30
+00104 #define DS3232_EN32KHZ      0x08
+00105 #define DS3232_BSY          0x04
+00106 #define DS3232_A2F          0x02
+00107 #define DS3232_A1F          0x01
+00108 
+00109 // Alarm storage at the end of the RTC's NVRAM.
+00110 #define DS3232_ALARM_SIZE   3
+00111 #define DS3232_ALARMS       (256 - RTC::ALARM_COUNT * DS3232_ALARM_SIZE - 1)
+00112 #define DS3232_ALARM_MAGIC  255
+00113 
+00126 DS3232RTC::DS3232RTC(I2CMaster &bus, uint8_t oneHzPin)
+00127     : _bus(&bus)
+00128     , _oneHzPin(oneHzPin)
+00129     , prevOneHz(false)
+00130     , _isRealTime(true)
+00131     , alarmInterrupts(false)
+00132 {
+00133     // Probe the device and configure it for our use.
+00134     _bus->startWrite(DS3232_I2C_ADDRESS);
+00135     _bus->write(DS3232_CONTROL);
+00136     if (_bus->startRead(DS3232_I2C_ADDRESS, 1)) {
+00137         uint8_t value = _bus->read() & DS3232_CONV;
+00138         if (oneHzPin != 255)
+00139             value |= DS3232_BBSQW | DS3232_RS_1HZ;
+00140         _bus->startWrite(DS3232_I2C_ADDRESS);
+00141         _bus->write(DS3232_CONTROL);
+00142         _bus->write(value);
+00143         _bus->write(DS3232_CRATE_64);
+00144         _bus->endWrite();
+00145     } else {
+00146         // Did not get an acknowledgement from the RTC chip.
+00147         _isRealTime = false;
+00148     }
+00149 
+00150     // Configure the 1 Hz square wave pin if required.
+00151     if (oneHzPin != 255 && _isRealTime) {
+00152         pinMode(oneHzPin, INPUT);
+00153         digitalWrite(oneHzPin, HIGH);
+00154     }
+00155 
+00156     // Initialize the alarms in the RTC chip's NVRAM.
+00157     if (_isRealTime)
+00158         initAlarms();
+00159 }
+00160 
+00166 bool DS3232RTC::hasUpdates()
+00167 {
+00168     // If not using a 1 Hz pin or there is no RTC chip available,
+00169     // then assume that there is an update available.
+00170     if (_oneHzPin == 255 || !_isRealTime)
+00171         return true;
+00172 
+00173     // The DS3232 updates the internal registers on the falling edge of the
+00174     // 1 Hz clock.  The values should be ready to read on the rising edge.
+00175     bool value = digitalRead(_oneHzPin);
+00176     if (value && !prevOneHz) {
+00177         prevOneHz = value;
+00178         return true;
+00179     } else {
+00180         prevOneHz = value;
+00181         return false;
+00182     }
+00183 }
+00184 
+00185 inline uint8_t fromBCD(uint8_t value)
+00186 {
+00187     return (value >> 4) * 10 + (value & 0x0F);
+00188 }
+00189 
+00190 inline uint8_t fromHourBCD(uint8_t value)
+00191 {
+00192     if ((value & 0x40) != 0) {
+00193         // 12-hour mode.
+00194         uint8_t result = ((value >> 4) & 0x01) * 10 + (value & 0x0F);
+00195         if ((value & 0x20) != 0)
+00196             return (result == 12) ? 12 : (result + 12);     // PM
+00197         else
+00198             return (result == 12) ? 0 : result;             // AM
+00199     } else {
+00200         // 24-hour mode.
+00201         return fromBCD(value);
+00202     }
+00203 }
+00204 
+00205 void DS3232RTC::readTime(RTCTime *value)
+00206 {
+00207     if (_isRealTime) {
+00208         _bus->startWrite(DS3232_I2C_ADDRESS);
+00209         _bus->write(DS3232_SECOND);
+00210         if (_bus->startRead(DS3232_I2C_ADDRESS, 3)) {
+00211             value->second = fromBCD(_bus->read());
+00212             value->minute = fromBCD(_bus->read());
+00213             value->hour = fromHourBCD(_bus->read());
+00214         } else {
+00215             // RTC chip is not responding.
+00216             value->second = 0;
+00217             value->minute = 0;
+00218             value->hour = 0;
+00219         }
+00220     } else {
+00221         RTC::readTime(value);
+00222     }
+00223 }
+00224 
+00225 void DS3232RTC::readDate(RTCDate *value)
+00226 {
+00227     if (!_isRealTime) {
+00228         RTC::readDate(value);
+00229         return;
+00230     }
+00231     _bus->startWrite(DS3232_I2C_ADDRESS);
+00232     _bus->write(DS3232_DATE);
+00233     if (_bus->startRead(DS3232_I2C_ADDRESS, 3)) {
+00234         value->day = fromBCD(_bus->read());
+00235         value->month = fromBCD(_bus->read() & 0x7F); // Strip century bit.
+00236         value->year = fromBCD(_bus->read()) + 2000;
+00237     } else {
+00238         // RTC chip is not responding.
+00239         value->day = 1;
+00240         value->month = 1;
+00241         value->year = 2000;
+00242     }
+00243 }
+00244 
+00245 inline uint8_t toBCD(uint8_t value)
+00246 {
+00247     return ((value / 10) << 4) + (value % 10);
+00248 }
+00249 
+00250 void DS3232RTC::writeTime(const RTCTime *value)
+00251 {
+00252     if (_isRealTime) {
+00253         _bus->startWrite(DS3232_I2C_ADDRESS);
+00254         _bus->write(DS3232_SECOND);
+00255         _bus->write(toBCD(value->second));
+00256         _bus->write(toBCD(value->minute));
+00257         _bus->write(toBCD(value->hour));    // Changes mode to 24-hour clock.
+00258         _bus->endWrite();
+00259     } else {
+00260         RTC::writeTime(value);
+00261     }
+00262 }
+00263 
+00264 void DS3232RTC::writeDate(const RTCDate *value)
+00265 {
+00266     if (_isRealTime) {
+00267         _bus->startWrite(DS3232_I2C_ADDRESS);
+00268         _bus->write(DS3232_DATE);
+00269         _bus->write(toBCD(value->day));
+00270         _bus->write(toBCD(value->month));
+00271         _bus->write(toBCD(value->year % 100));
+00272         _bus->endWrite();
+00273     } else {
+00274         RTC::writeDate(value);
+00275     }
+00276 }
+00277 
+00278 void DS3232RTC::readAlarm(uint8_t alarmNum, RTCAlarm *value)
+00279 {
+00280     if (_isRealTime) {
+00281         _bus->startWrite(DS3232_I2C_ADDRESS);
+00282         _bus->write(DS3232_ALARMS + alarmNum * DS3232_ALARM_SIZE);
+00283         if (_bus->startRead(DS3232_I2C_ADDRESS, 3)) {
+00284             value->hour = fromBCD(_bus->read());
+00285             value->minute = fromBCD(_bus->read());
+00286             value->flags = _bus->read();
+00287         } else {
+00288             // RTC chip is not responding.
+00289             value->hour = 0;
+00290             value->minute = 0;
+00291             value->flags = 0;
+00292         }
+00293     } else {
+00294         RTC::readAlarm(alarmNum, value);
+00295     }
+00296 }
+00297 
+00298 void DS3232RTC::writeAlarm(uint8_t alarmNum, const RTCAlarm *value)
+00299 {
+00300     if (_isRealTime) {
+00301         // Write the alarm details to NVRAM.
+00302         _bus->startWrite(DS3232_I2C_ADDRESS);
+00303         _bus->write(DS3232_ALARMS + alarmNum * DS3232_ALARM_SIZE);
+00304         _bus->write(toBCD(value->hour));
+00305         _bus->write(toBCD(value->minute));
+00306         _bus->write(value->flags);
+00307         _bus->endWrite();
+00308 
+00309         // Keep the DS3232's built-in alarms in sync with the first two alarms.
+00310         if (alarmNum == 0) {
+00311             _bus->startWrite(DS3232_I2C_ADDRESS);
+00312             _bus->write(DS3232_ALARM1_SEC);
+00313             _bus->write(0);
+00314             _bus->write(toBCD(value->minute));
+00315             _bus->write(toBCD(value->hour));
+00316             _bus->write(0x81);  // Match hours, mins, secs; day = 1
+00317             _bus->endWrite();
+00318             if (alarmInterrupts)
+00319                 updateAlarmInterrupts();
+00320         } else if (alarmNum == 1) {
+00321             _bus->startWrite(DS3232_I2C_ADDRESS);
+00322             _bus->write(DS3232_ALARM2_MIN);
+00323             _bus->write(toBCD(value->minute));
+00324             _bus->write(toBCD(value->hour));
+00325             _bus->write(0x81);  // Match hours, mins; day = 1
+00326             _bus->endWrite();
+00327             if (alarmInterrupts)
+00328                 updateAlarmInterrupts();
+00329         }
+00330     } else {
+00331         RTC::writeAlarm(alarmNum, value);
+00332     }
+00333 }
+00334 
+00335 int DS3232RTC::byteCount() const
+00336 {
+00337     return DS3232_ALARMS - DS3232_NVRAM;
+00338 }
+00339 
+00340 uint8_t DS3232RTC::readByte(uint8_t offset)
+00341 {
+00342     if (_isRealTime)
+00343         return readRegister(DS3232_NVRAM + offset);
+00344     else
+00345         return RTC::readByte(offset);
+00346 }
+00347 
+00348 void DS3232RTC::writeByte(uint8_t offset, uint8_t value)
+00349 {
+00350     if (_isRealTime)
+00351         writeRegister(DS3232_NVRAM + offset, value);
+00352     else
+00353         RTC::writeByte(offset, value);
+00354 }
+00355 
+00370 void DS3232RTC::enableAlarmInterrupts()
+00371 {
+00372     if (_oneHzPin == 255 && _isRealTime) {
+00373         updateAlarmInterrupts();
+00374         alarmInterrupts = true;
+00375     }
+00376 }
+00377 
+00383 void DS3232RTC::disableAlarmInterrupts()
+00384 {
+00385     if (alarmInterrupts) {
+00386         uint8_t value = readRegister(DS3232_CONTROL);
+00387         value &= ~(DS3232_INTCN | DS3232_A2IE | DS3232_A1IE);
+00388         writeRegister(DS3232_CONTROL, value);
+00389         alarmInterrupts = false;
+00390     }
+00391 }
+00392 
+00406 int DS3232RTC::firedAlarm()
+00407 {
+00408     if (!_isRealTime)
+00409         return -1;
+00410     uint8_t value = readRegister(DS3232_STATUS);
+00411     int alarm;
+00412     if (value & DS3232_A1F) {
+00413         if (value & DS3232_A2F)
+00414             alarm = 2;
+00415         else
+00416             alarm = 0;
+00417     } else if (value & DS3232_A2F) {
+00418         alarm = 1;
+00419     } else {
+00420         alarm = -1;
+00421     }
+00422     if (alarm != -1) {
+00423         value &= ~(DS3232_A1F | DS3232_A2F);
+00424         writeRegister(DS3232_STATUS, value);
+00425     }
+00426     return alarm;
+00427 }
+00428 
+00434 void DS3232RTC::enable32kHzOutput()
+00435 {
+00436     if (_isRealTime) {
+00437         uint8_t value = readRegister(DS3232_STATUS);
+00438         value |= DS3232_BB32KHZ | DS3232_EN32KHZ;
+00439         writeRegister(DS3232_STATUS, value);
+00440     }
+00441 }
+00442 
+00448 void DS3232RTC::disable32kHzOutput()
+00449 {
+00450     if (_isRealTime) {
+00451         uint8_t value = readRegister(DS3232_STATUS);
+00452         value &= ~(DS3232_BB32KHZ | DS3232_EN32KHZ);
+00453         writeRegister(DS3232_STATUS, value);
+00454     }
+00455 }
+00456 
+00457 void DS3232RTC::initAlarms()
+00458 {
+00459     uint8_t value = readRegister(DS3232_ALARM_MAGIC);
+00460     if (value != (0xB0 + ALARM_COUNT)) {
+00461         // This is the first time we have used this clock chip,
+00462         // so initialize all alarms to their default state.
+00463         RTCAlarm alarm;
+00464         alarm.hour = 6;         // Default to 6am for alarms.
+00465         alarm.minute = 0;
+00466         alarm.flags = 0;
+00467         for (uint8_t index = 0; index < ALARM_COUNT; ++index)
+00468             writeAlarm(index, &alarm);
+00469         writeRegister(DS3232_ALARM_MAGIC, 0xB0 + ALARM_COUNT);
+00470 
+00471         // Also clear the rest of NVRAM so that it is in a known state.
+00472         // Otherwise we'll have whatever garbage was present at power-on.
+00473         _bus->startWrite(DS3232_I2C_ADDRESS);
+00474         _bus->write(DS3232_NVRAM);
+00475         for (uint8_t index = DS3232_NVRAM; index < DS3232_ALARMS; ++index)
+00476             _bus->write(0);
+00477         _bus->endWrite();
+00478     }
+00479 }
+00480 
+00481 uint8_t DS3232RTC::readRegister(uint8_t reg)
+00482 {
+00483     _bus->startWrite(DS3232_I2C_ADDRESS);
+00484     _bus->write(reg);
+00485     if (!_bus->startRead(DS3232_I2C_ADDRESS, 1))
+00486         return 0;   // RTC chip is not responding.
+00487     return _bus->read();
+00488 }
+00489 
+00490 bool DS3232RTC::writeRegister(uint8_t reg, uint8_t value)
+00491 {
+00492     _bus->startWrite(DS3232_I2C_ADDRESS);
+00493     _bus->write(reg);
+00494     _bus->write(value);
+00495     return _bus->endWrite();
+00496 }
+00497 
+00498 #define DS3232_ALARM1_FLAGS (DS3232_ALARMS + 2)
+00499 #define DS3232_ALARM2_FLAGS (DS3232_ALARMS + DS3232_ALARM_SIZE + 2)
+00500 
+00501 void DS3232RTC::updateAlarmInterrupts()
+00502 {
+00503     bool alarm1Enabled = ((readRegister(DS3232_ALARM1_FLAGS) & 0x01) != 0);
+00504     bool alarm2Enabled = ((readRegister(DS3232_ALARM2_FLAGS) & 0x01) != 0);
+00505     uint8_t value = readRegister(DS3232_CONTROL);
+00506     value |= DS3232_INTCN;
+00507     if (alarm1Enabled)
+00508         value |= DS3232_A1IE;
+00509     else
+00510         value &= ~DS3232_A1IE;
+00511     if (alarm2Enabled)
+00512         value |= DS3232_A2IE;
+00513     else
+00514         value &= ~DS3232_A2IE;
+00515     writeRegister(DS3232_CONTROL, value);
+00516 }
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/DS3232RTC_8h_source.html b/DS3232RTC_8h_source.html new file mode 100644 index 00000000..2e439869 --- /dev/null +++ b/DS3232RTC_8h_source.html @@ -0,0 +1,156 @@ + + + + +ArduinoLibs: DS3232RTC.h Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
DS3232RTC.h
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #ifndef DS3232RTC_h
+00024 #define DS3232RTC_h
+00025 
+00026 #include "RTC.h"
+00027 
+00028 class I2CMaster;
+00029 
+00030 class DS3232RTC : public RTC {
+00031 public:
+00032     DS3232RTC(I2CMaster &bus, uint8_t oneHzPin = 255);
+00033 
+00034     bool isRealTime() const { return _isRealTime; }
+00035 
+00036     bool hasUpdates();
+00037 
+00038     void readTime(RTCTime *value);
+00039     void readDate(RTCDate *value);
+00040 
+00041     void writeTime(const RTCTime *value);
+00042     void writeDate(const RTCDate *value);
+00043 
+00044     void readAlarm(uint8_t alarmNum, RTCAlarm *value);
+00045     void writeAlarm(uint8_t alarmNum, const RTCAlarm *value);
+00046 
+00047     int byteCount() const;
+00048     uint8_t readByte(uint8_t offset);
+00049     void writeByte(uint8_t offset, uint8_t value);
+00050 
+00051     void enableAlarmInterrupts();
+00052     void disableAlarmInterrupts();
+00053     int firedAlarm();
+00054 
+00055     void enable32kHzOutput();
+00056     void disable32kHzOutput();
+00057 
+00058 private:
+00059     I2CMaster *_bus;
+00060     uint8_t _oneHzPin;
+00061     bool prevOneHz;
+00062     bool _isRealTime;
+00063     bool alarmInterrupts;
+00064 
+00065     void initAlarms();
+00066 
+00067     uint8_t readRegister(uint8_t reg);
+00068     bool writeRegister(uint8_t reg, uint8_t value);
+00069 
+00070     void updateAlarmInterrupts();
+00071 };
+00072 
+00073 #endif
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/Field_8cpp_source.html b/Field_8cpp_source.html new file mode 100644 index 00000000..e2dcf6ee --- /dev/null +++ b/Field_8cpp_source.html @@ -0,0 +1,173 @@ + + + + +ArduinoLibs: Field.cpp Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
Field.cpp
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #include "Field.h"
+00024 
+00040 Field::Field(const String &label)
+00041     : _label(label)
+00042     , _form(0)
+00043     , next(0)
+00044     , prev(0)
+00045 {
+00046 }
+00047 
+00052 Field::Field(Form &form, const String &label)
+00053     : _label(label)
+00054     , _form(0)
+00055     , next(0)
+00056     , prev(0)
+00057 {
+00058     form.addField(this);
+00059 }
+00060 
+00066 Field::~Field()
+00067 {
+00068     if (_form)
+00069         _form->removeField(this);
+00070 }
+00071 
+00096 int Field::dispatch(int event)
+00097 {
+00098     // Nothing to do here.
+00099     return -1;
+00100 }
+00101 
+00116 void Field::enterField(bool reverse)
+00117 {
+00118     lcd()->print(_label);
+00119 }
+00120 
+00129 void Field::exitField()
+00130 {
+00131     // Nothing to do here.
+00132 }
+00133 
+00146 void Field::setLabel(const String &label)
+00147 {
+00148     if (isCurrent()) {
+00149         unsigned int prevLen = _label.length();
+00150         unsigned int newLen = label.length();
+00151         _label = label;
+00152         lcd()->setCursor(0, 0);
+00153         lcd()->print(label);
+00154         while (newLen++ < prevLen)
+00155             lcd()->write(' ');
+00156         updateCursor();
+00157     } else {
+00158         _label = label;
+00159     }
+00160 }
+00161 
+00169 bool Field::isCurrent() const
+00170 {
+00171     if (!_form->isVisible())
+00172         return false;
+00173     return _form->currentField() == this;
+00174 }
+00175 
+00191 void Field::updateCursor()
+00192 {
+00193     // Nothing to do here.
+00194 }
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/Field_8h_source.html b/Field_8h_source.html new file mode 100644 index 00000000..ff687d44 --- /dev/null +++ b/Field_8h_source.html @@ -0,0 +1,143 @@ + + + + +ArduinoLibs: Field.h Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
Field.h
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #ifndef Field_h
+00024 #define Field_h
+00025 
+00026 #include "Form.h"
+00027 
+00028 class Field {
+00029 public:
+00030     explicit Field(const String &label);
+00031     Field(Form &form, const String &label);
+00032     ~Field();
+00033 
+00034     Form *form() const { return _form; }
+00035 
+00036     virtual int dispatch(int event);
+00037 
+00038     virtual void enterField(bool reverse);
+00039     virtual void exitField();
+00040 
+00041     const String &label() const { return _label; }
+00042     void setLabel(const String &label);
+00043 
+00044     bool isCurrent() const;
+00045 
+00046 protected:
+00047     LiquidCrystal *lcd() const { return _form->_lcd; }
+00048 
+00049     virtual void updateCursor();
+00050 
+00051 private:
+00052     String _label;
+00053     Form *_form;
+00054     Field *next;
+00055     Field *prev;
+00056 
+00057     friend class Form;
+00058 };
+00059 
+00060 #endif
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/FormBool.png b/FormBool.png new file mode 100644 index 00000000..7449a3cb Binary files /dev/null and b/FormBool.png differ diff --git a/FormInt.png b/FormInt.png new file mode 100644 index 00000000..2fc9b6b1 Binary files /dev/null and b/FormInt.png differ diff --git a/FormText.png b/FormText.png new file mode 100644 index 00000000..cb018bcf Binary files /dev/null and b/FormText.png differ diff --git a/FormTimeRO.png b/FormTimeRO.png new file mode 100644 index 00000000..e99c7b9a Binary files /dev/null and b/FormTimeRO.png differ diff --git a/FormTimeRW.png b/FormTimeRW.png new file mode 100644 index 00000000..679c01ce Binary files /dev/null and b/FormTimeRW.png differ diff --git a/Form_8cpp_source.html b/Form_8cpp_source.html new file mode 100644 index 00000000..06b7112f --- /dev/null +++ b/Form_8cpp_source.html @@ -0,0 +1,255 @@ + + + + +ArduinoLibs: Form.cpp Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
Form.cpp
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #include "Form.h"
+00024 #include "Field.h"
+00025 
+00047 Form::Form(LiquidCrystal &lcd)
+00048     : _lcd(&lcd)
+00049     , first(0)
+00050     , last(0)
+00051     , current(0)
+00052 {
+00053 }
+00054 
+00058 Form::~Form()
+00059 {
+00060     Field *field = first;
+00061     Field *next;
+00062     while (field != 0) {
+00063         next = field->next;
+00064         field->_form = 0;
+00065         field->next = 0;
+00066         field->prev = 0;
+00067         field = next;
+00068     }
+00069 }
+00070 
+00099 int Form::dispatch(int event)
+00100 {
+00101     if (current) {
+00102         int exitval = current->dispatch(event);
+00103         if (exitval >= 0)
+00104             return exitval;
+00105     }
+00106     if (event == LCD_BUTTON_LEFT)
+00107         prevField();
+00108     else if (event == LCD_BUTTON_RIGHT)
+00109         nextField();
+00110     return 0;
+00111 }
+00112 
+00118 void Form::nextField()
+00119 {
+00120     Field *field = current;
+00121     if (!field)
+00122         field = first;
+00123     if (field && field->next)
+00124         field = field->next;
+00125     else
+00126         field = first;
+00127     setCurrentField(field);
+00128 }
+00129 
+00135 void Form::prevField()
+00136 {
+00137     Field *field = current;
+00138     if (!field)
+00139         field = last;
+00140     if (field && field->prev)
+00141         field = field->prev;
+00142     else
+00143         field = last;
+00144     setCurrentField(field);
+00145 }
+00146 
+00152 void Form::defaultField()
+00153 {
+00154     setCurrentField(first);
+00155 }
+00156 
+00165 void Form::addField(Field *field)
+00166 {
+00167     if (field->_form)
+00168         return; // Already added to a form.
+00169     field->_form = this;
+00170     field->next = 0;
+00171     field->prev = last;
+00172     if (last)
+00173         last->next = field;
+00174     else
+00175         first = field;
+00176     last = field;
+00177 }
+00178 
+00187 void Form::removeField(Field *field)
+00188 {
+00189     if (field->_form != this)
+00190         return; // Not a member of this form.
+00191     if (current == field) {
+00192         if (field->next)
+00193             setCurrentField(field->next);
+00194         else if (field->prev)
+00195             setCurrentField(field->prev);
+00196         else
+00197             setCurrentField(0);
+00198     }
+00199     if (field->next)
+00200         field->next->prev = field->prev;
+00201     else
+00202         last = field->prev;
+00203     if (field->prev)
+00204         field->prev->next = field->next;
+00205     else
+00206         first = field->next;
+00207     field->_form = 0;
+00208     field->next = 0;
+00209     field->prev = 0;
+00210 }
+00211 
+00230 void Form::setCurrentField(Field *field)
+00231 {
+00232     if (field && field->_form != this)
+00233         return;     // Wrong form.
+00234     if (visible) {
+00235         bool reverse = false;
+00236         if (current) {
+00237             current->exitField();
+00238             if (field->next == current)
+00239                 reverse = true;
+00240             else if (!field->next && current == first)
+00241                 reverse = true;
+00242         }
+00243         current = field;
+00244         _lcd->clear();
+00245         if (current)
+00246             current->enterField(reverse);
+00247     } else {
+00248         current = field;
+00249     }
+00250 }
+00251 
+00274 void Form::show()
+00275 {
+00276     if (!visible) {
+00277         if (!current)
+00278             current = first;
+00279         visible = true;
+00280         _lcd->clear();
+00281         if (current)
+00282             current->enterField(false);
+00283     }
+00284 }
+00285 
+00293 void Form::hide()
+00294 {
+00295     if (visible) {
+00296         if (current)
+00297             current->exitField();
+00298         visible = false;
+00299         _lcd->clear();
+00300     }
+00301 }
+00302 
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/Form_8h_source.html b/Form_8h_source.html new file mode 100644 index 00000000..e1d8873a --- /dev/null +++ b/Form_8h_source.html @@ -0,0 +1,148 @@ + + + + +ArduinoLibs: Form.h Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
Form.h
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #ifndef Form_h
+00024 #define Form_h
+00025 
+00026 #include "LCD.h"
+00027 
+00028 class Field;
+00029 
+00030 #define FORM_CHANGED    1
+00031 
+00032 class Form {
+00033 public:
+00034     explicit Form(LiquidCrystal &lcd);
+00035     ~Form();
+00036 
+00037     int dispatch(int event);
+00038 
+00039     void nextField();
+00040     void prevField();
+00041     void defaultField();
+00042 
+00043     void addField(Field *field);
+00044     void removeField(Field *field);
+00045 
+00046     Field *currentField() const { return current; }
+00047     void setCurrentField(Field *field);
+00048 
+00049     bool isCurrent(Field &field) const { return current == &field; }
+00050 
+00051     void show();
+00052     void hide();
+00053     bool isVisible() const { return visible; }
+00054 
+00055 private:
+00056     LiquidCrystal *_lcd;
+00057     Field *first;
+00058     Field *last;
+00059     Field *current;
+00060     bool visible;
+00061 
+00062     friend class Field;
+00063 };
+00064 
+00065 #endif
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/HelloWorld.png b/HelloWorld.png new file mode 100644 index 00000000..29ddaa52 Binary files /dev/null and b/HelloWorld.png differ diff --git a/I2CMaster_8cpp_source.html b/I2CMaster_8cpp_source.html new file mode 100644 index 00000000..c818eb0f --- /dev/null +++ b/I2CMaster_8cpp_source.html @@ -0,0 +1,107 @@ + + + + +ArduinoLibs: I2CMaster.cpp Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
I2CMaster.cpp
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #include "I2CMaster.h"
+00024 
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/I2CMaster_8h_source.html b/I2CMaster_8h_source.html new file mode 100644 index 00000000..51148691 --- /dev/null +++ b/I2CMaster_8h_source.html @@ -0,0 +1,124 @@ + + + + +ArduinoLibs: I2CMaster.h Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
I2CMaster.h
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #ifndef I2CMaster_h
+00024 #define I2CMaster_h
+00025 
+00026 #include <inttypes.h>
+00027 
+00028 class I2CMaster {
+00029 public:
+00030     virtual unsigned int maxTransferSize() const = 0;
+00031 
+00032     virtual void startWrite(unsigned int address);
+00033     virtual void write(uint8_t value) = 0;
+00034     virtual bool endWrite() = 0;
+00035 
+00036     virtual bool startRead(unsigned int address, unsigned int count) = 0;
+00037     virtual unsigned int available() = 0;
+00038     virtual uint8_t read() = 0;
+00039 };
+00040 
+00041 #endif
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/IntField_8cpp_source.html b/IntField_8cpp_source.html new file mode 100644 index 00000000..b625a0f8 --- /dev/null +++ b/IntField_8cpp_source.html @@ -0,0 +1,188 @@ + + + + +ArduinoLibs: IntField.cpp Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
IntField.cpp
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #include "IntField.h"
+00024 
+00071 IntField::IntField(const String &label)
+00072     : Field(label)
+00073     , _minValue(0)
+00074     , _maxValue(100)
+00075     , _stepValue(1)
+00076     , _value(0)
+00077     , _printLen(0)
+00078 {
+00079 }
+00080 
+00088 IntField::IntField(Form &form, const String &label, int minValue, int maxValue, int stepValue, int value)
+00089     : Field(form, label)
+00090     , _minValue(minValue)
+00091     , _maxValue(maxValue)
+00092     , _stepValue(stepValue)
+00093     , _value(value)
+00094     , _printLen(0)
+00095 {
+00096 }
+00097 
+00103 IntField::IntField(Form &form, const String &label, int minValue, int maxValue, int stepValue, int value, const String &suffix)
+00104     : Field(form, label)
+00105     , _minValue(minValue)
+00106     , _maxValue(maxValue)
+00107     , _stepValue(stepValue)
+00108     , _value(value)
+00109     , _printLen(0)
+00110     , _suffix(suffix)
+00111 {
+00112 }
+00113 
+00114 int IntField::dispatch(int event)
+00115 {
+00116     if (event == LCD_BUTTON_UP) {
+00117         setValue(_value + _stepValue);
+00118         return FORM_CHANGED;
+00119     } else if (event == LCD_BUTTON_DOWN) {
+00120         setValue(_value - _stepValue);
+00121         return FORM_CHANGED;
+00122     }
+00123     return -1;
+00124 }
+00125 
+00126 void IntField::enterField(bool reverse)
+00127 {
+00128     Field::enterField(reverse);
+00129     printValue();
+00130 }
+00131 
+00198 void IntField::setValue(int value)
+00199 {
+00200     if (value < _minValue)
+00201         value = _minValue;
+00202     else if (value > _maxValue)
+00203         value = _maxValue;
+00204     if (value != _value) {
+00205         _value = value;
+00206         if (isCurrent())
+00207             printValue();
+00208     }
+00209 }
+00210 
+00231 void IntField::setSuffix(const String &suffix)
+00232 {
+00233     _suffix = suffix;
+00234     if (isCurrent())
+00235         printValue();
+00236 }
+00237 
+00238 void IntField::printValue()
+00239 {
+00240     String str(_value);
+00241     if (_suffix.length())
+00242         str += _suffix;
+00243     lcd()->setCursor(0, 1);
+00244     lcd()->print(str);
+00245     unsigned int len = str.length();
+00246     while (len++ < _printLen)
+00247         lcd()->write(' ');
+00248     _printLen = str.length();
+00249 }
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/IntField_8h_source.html b/IntField_8h_source.html new file mode 100644 index 00000000..27bd9739 --- /dev/null +++ b/IntField_8h_source.html @@ -0,0 +1,147 @@ + + + + +ArduinoLibs: IntField.h Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
IntField.h
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #ifndef IntField_h
+00024 #define IntField_h
+00025 
+00026 #include "Field.h"
+00027 
+00028 class IntField : public Field {
+00029 public:
+00030     explicit IntField(const String &label);
+00031     IntField(Form &form, const String &label, int minValue, int maxValue, int stepValue, int value);
+00032     IntField(Form &form, const String &label, int minValue, int maxValue, int stepValue, int value, const String &suffix);
+00033 
+00034     int dispatch(int event);
+00035 
+00036     void enterField(bool reverse);
+00037 
+00038     int minValue() const { return _minValue; }
+00039     void setMinValue(int value) { _minValue = value; }
+00040 
+00041     int maxValue() const { return _maxValue; }
+00042     void setMaxValue(int value) { _maxValue = value; }
+00043 
+00044     int stepValue() const { return _stepValue; }
+00045     void setStepValue(int value) { _stepValue = value; }
+00046 
+00047     int value() const { return _value; }
+00048     void setValue(int value);
+00049 
+00050     const String &suffix() const { return _suffix; }
+00051     void setSuffix(const String &suffix);
+00052 
+00053 private:
+00054     int _minValue;
+00055     int _maxValue;
+00056     int _stepValue;
+00057     int _value;
+00058     int _printLen;
+00059     String _suffix;
+00060 
+00061     void printValue();
+00062 };
+00063 
+00064 #endif
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/LCD_8cpp_source.html b/LCD_8cpp_source.html new file mode 100644 index 00000000..88194be4 --- /dev/null +++ b/LCD_8cpp_source.html @@ -0,0 +1,245 @@ + + + + +ArduinoLibs: LCD.cpp Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
LCD.cpp
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #include "LCD.h"
+00024 #include <avr/pgmspace.h>
+00025 #if defined(ARDUINO) && ARDUINO >= 100
+00026 #include <Arduino.h>
+00027 #else
+00028 #include <WProgram.h>
+00029 #endif
+00030 
+00031 #define LCD_BACK_LIGHT          3        // LCD backlight is on D3
+00032 #define LCD_BUTTON_PIN          A0       // Button state is on A0
+00033 
+00034 #define DEBOUNCE_DELAY          10      // Delay in ms to debounce buttons
+00035 
+00115 void LCD::init()
+00116 {
+00117     // The Freetronics display is 16x2.
+00118     begin(16, 2);
+00119 
+00120     // Set the LCD back light to be initially on.
+00121     pinMode(LCD_BACK_LIGHT, OUTPUT);
+00122     digitalWrite(LCD_BACK_LIGHT, HIGH);
+00123 
+00124     // Initialise button input.
+00125     pinMode(LCD_BUTTON_PIN, INPUT);
+00126     digitalWrite(LCD_BUTTON_PIN, LOW);
+00127     prevButton = LCD_BUTTON_NONE;
+00128     debounceButton = LCD_BUTTON_NONE;
+00129     lastDebounce = 0;
+00130     eatRelease = false;
+00131 
+00132     // Initialize screen saver.
+00133     timeout = 0;
+00134     lastRestore = millis();
+00135     screenSaved = false;
+00136     mode = DisplayOff;
+00137 }
+00138 
+00148 void LCD::display()
+00149 {
+00150     LiquidCrystal::display();
+00151     digitalWrite(LCD_BACK_LIGHT, HIGH);
+00152     screenSaved = false;
+00153     lastRestore = millis();
+00154 }
+00155 
+00163 void LCD::noDisplay()
+00164 {
+00165     if (mode == DisplayOff)
+00166         LiquidCrystal::noDisplay();
+00167     digitalWrite(LCD_BACK_LIGHT, LOW);
+00168     screenSaved = true;
+00169 }
+00170 
+00206 void LCD::setScreenSaverMode(ScreenSaverMode mode)
+00207 {
+00208     if (this->mode != mode) {
+00209         this->mode = mode;
+00210         if (screenSaved)
+00211             noDisplay();
+00212         else
+00213             display();
+00214     }
+00215 }
+00216 
+00232 void LCD::enableScreenSaver(int timeoutSecs)
+00233 {
+00234     if (timeoutSecs < 0)
+00235         timeout = 0;
+00236     else
+00237         timeout = ((unsigned long)timeoutSecs) * 1000;
+00238     display();
+00239 }
+00240 
+00246 void LCD::disableScreenSaver()
+00247 {
+00248     timeout = 0;
+00249     display();
+00250 }
+00251 
+00259 // Button mapping table generated by genlookup.c
+00260 static prog_uint8_t const buttonMappings[] PROGMEM = {
+00261     2, 0, 0, 0, 3, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 1,
+00262     1, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0
+00263 };
+00264 #define mapButton(value) (pgm_read_byte(&(buttonMappings[(value) >> 5])))
+00265 
+00291 int LCD::getButton()
+00292 {
+00293     // Read the currently pressed button.
+00294     int button = mapButton(analogRead(LCD_BUTTON_PIN));
+00295 
+00296     // Debounce the button state.
+00297     unsigned long currentTime = millis();
+00298     if (button != debounceButton)
+00299         lastDebounce = currentTime;
+00300     debounceButton = button;
+00301     if ((currentTime - lastDebounce) < DEBOUNCE_DELAY)
+00302         button = prevButton;
+00303 
+00304     // Process the button event if the state has changed.
+00305     if (prevButton == LCD_BUTTON_NONE && button != LCD_BUTTON_NONE) {
+00306         prevButton = button;
+00307         if (screenSaved) {
+00308             // Button pressed when screen saver active.
+00309             if (mode == BacklightOnSelect) {
+00310                 // Turn on the back light only if Select was pressed.
+00311                 if (button == LCD_BUTTON_SELECT) {
+00312                     digitalWrite(LCD_BACK_LIGHT, HIGH);
+00313                     screenSaved = false;
+00314                 }
+00315             } else if (mode == DisplayOff) {
+00316                 display();
+00317                 eatRelease = true;
+00318                 return LCD_BUTTON_NONE;
+00319             } else {
+00320                 display();
+00321             }
+00322         } else if (mode == BacklightOnSelect && button != LCD_BUTTON_SELECT) {
+00323             eatRelease = false;
+00324             return button;
+00325         }
+00326         eatRelease = false;
+00327         lastRestore = currentTime;
+00328         return button;
+00329     } else if (prevButton != LCD_BUTTON_NONE && button == LCD_BUTTON_NONE) {
+00330         button = -prevButton;
+00331         prevButton = LCD_BUTTON_NONE;
+00332         lastRestore = currentTime;
+00333         if (eatRelease) {
+00334             eatRelease = false;
+00335             return LCD_BUTTON_NONE;
+00336         }
+00337         return button;
+00338     } else {
+00339         if (!screenSaved && prevButton == LCD_BUTTON_NONE &&
+00340                 timeout != 0 && (currentTime - lastRestore) >= timeout)
+00341             noDisplay();    // Activate screen saver.
+00342         return LCD_BUTTON_NONE;
+00343     }
+00344 }
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/LCD_8h_source.html b/LCD_8h_source.html new file mode 100644 index 00000000..c49d7e3b --- /dev/null +++ b/LCD_8h_source.html @@ -0,0 +1,168 @@ + + + + +ArduinoLibs: LCD.h Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
LCD.h
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #ifndef LCD_h
+00024 #define LCD_h
+00025 
+00026 // Extended version of the LiquidCrystal library that works specifically
+00027 // with Freetronics' 16x2 LCD display, including support for the back
+00028 // light and the Up/Down/Left/Right/Select buttons.  More info:
+00029 //
+00030 // http://www.freetronics.com/pages/16x2-lcd-shield-quickstart-guide
+00031 
+00032 // Include a copy of the standard LiquidCrystal library so we can extend it.
+00033 #include "utility/LiquidCrystal.h"
+00034 
+00035 // Button event codes.
+00036 #define LCD_BUTTON_NONE             0
+00037 #define LCD_BUTTON_LEFT             1
+00038 #define LCD_BUTTON_RIGHT            2
+00039 #define LCD_BUTTON_UP               3
+00040 #define LCD_BUTTON_DOWN             4
+00041 #define LCD_BUTTON_SELECT           5
+00042 #define LCD_BUTTON_LEFT_RELEASED    -1
+00043 #define LCD_BUTTON_RIGHT_RELEASED   -2
+00044 #define LCD_BUTTON_UP_RELEASED      -3
+00045 #define LCD_BUTTON_DOWN_RELEASED    -4
+00046 #define LCD_BUTTON_SELECT_RELEASED  -5
+00047 
+00048 class LCD : public LiquidCrystal {
+00049 public:
+00050     LCD() : LiquidCrystal(8, 9, 4, 5, 6, 7) { init(); }
+00051     LCD(uint8_t pin9) : LiquidCrystal(8, pin9, 4, 5, 6, 7) { init(); }
+00052 
+00053     void display();
+00054     void noDisplay();
+00055 
+00056     enum ScreenSaverMode
+00057     {
+00058         DisplayOff,
+00059         BacklightOff,
+00060         BacklightOnSelect
+00061     };
+00062 
+00063     ScreenSaverMode screenSaverMode() const { return mode; }
+00064     void setScreenSaverMode(ScreenSaverMode mode);
+00065 
+00066     void enableScreenSaver(int timeoutSecs = 10);
+00067     void disableScreenSaver();
+00068     bool isScreenSaved() const { return screenSaved; }
+00069 
+00070     int getButton();
+00071 
+00072 private:
+00073     int prevButton;
+00074     int debounceButton;
+00075     unsigned long timeout;
+00076     unsigned long lastRestore;
+00077     unsigned long lastDebounce;
+00078     bool screenSaved;
+00079     bool eatRelease;
+00080     ScreenSaverMode mode;
+00081 
+00082     void init();
+00083 };
+00084 
+00085 #endif
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/ListField_8cpp_source.html b/ListField_8cpp_source.html new file mode 100644 index 00000000..032d3e04 --- /dev/null +++ b/ListField_8cpp_source.html @@ -0,0 +1,201 @@ + + + + +ArduinoLibs: ListField.cpp Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
ListField.cpp
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #include "ListField.h"
+00024 #include <string.h>
+00025 
+00064 ListField::ListField(const String &label)
+00065     : Field(label)
+00066     , _items(0)
+00067     , _itemCount(0)
+00068     , _value(-1)
+00069     , _printLen(0)
+00070 {
+00071 }
+00072 
+00077 ListField::ListField(Form &form, const String &label, ListItems items, int value)
+00078     : Field(form, label)
+00079     , _items(0)
+00080     , _itemCount(0)
+00081     , _value(value)
+00082     , _printLen(0)
+00083 {
+00084     setItems(items);
+00085 }
+00086 
+00087 int ListField::dispatch(int event)
+00088 {
+00089     if (event == LCD_BUTTON_DOWN) {
+00090         if (_value >= (_itemCount - 1))
+00091             setValue(0);
+00092         else
+00093             setValue(_value + 1);
+00094         return FORM_CHANGED;
+00095     } else if (event == LCD_BUTTON_UP) {
+00096         if (_value <= 0)
+00097             setValue(_itemCount - 1);
+00098         else
+00099             setValue(_value - 1);
+00100         return FORM_CHANGED;
+00101     }
+00102     return -1;
+00103 }
+00104 
+00105 void ListField::enterField(bool reverse)
+00106 {
+00107     Field::enterField(reverse);
+00108     _printLen = 0;
+00109     printValue();
+00110 }
+00111 
+00141 void ListField::setItems(ListItems items)
+00142 {
+00143     _items = items;
+00144     _itemCount = 0;
+00145     if (items) {
+00146         for (;;) {
+00147             ListItem item = (ListItem)pgm_read_word(items);
+00148             if (!item)
+00149                 break;
+00150             ++items;
+00151             ++_itemCount;
+00152         }
+00153     }
+00154     if (_value >= _itemCount)
+00155         _value = _itemCount - 1;
+00156     if (isCurrent())
+00157         printValue();
+00158 }
+00159 
+00178 void ListField::setValue(int value)
+00179 {
+00180     if (_value != value) {
+00181         _value = value;
+00182         if (_value < 0)
+00183             _value = 0;
+00184         if (_value >= _itemCount)
+00185             _value = _itemCount - 1;
+00186         if (isCurrent())
+00187             printValue();
+00188     }
+00189 }
+00190 
+00191 void ListField::printValue()
+00192 {
+00193     lcd()->setCursor(0, 1);
+00194     int len = 0;
+00195     if (_value >= 0) {
+00196         ListItem str = (ListItem)pgm_read_word(&(_items[_value]));
+00197         char ch;
+00198         while ((ch = pgm_read_byte(str)) != 0) {
+00199             lcd()->write(ch);
+00200             ++len;
+00201             ++str;
+00202         }
+00203     }
+00204     while (_printLen-- > len)
+00205         lcd()->write(' ');
+00206     _printLen = len;
+00207 }
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/ListField_8h_source.html b/ListField_8h_source.html new file mode 100644 index 00000000..593f1a4f --- /dev/null +++ b/ListField_8h_source.html @@ -0,0 +1,139 @@ + + + + +ArduinoLibs: ListField.h Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
ListField.h
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #ifndef ListField_h
+00024 #define ListField_h
+00025 
+00026 #include "Field.h"
+00027 #include <avr/pgmspace.h>
+00028 
+00029 typedef const prog_char *ListItem;
+00030 typedef const PROGMEM ListItem *ListItems;
+00031 
+00032 class ListField : public Field {
+00033 public:
+00034     explicit ListField(const String &label);
+00035     ListField(Form &form, const String &label, ListItems items, int value = 0);
+00036 
+00037     int dispatch(int event);
+00038 
+00039     void enterField(bool reverse);
+00040 
+00041     ListItems items() const { return _items; }
+00042     void setItems(ListItems items);
+00043 
+00044     int value() const { return _value; }
+00045     void setValue(int value);
+00046 
+00047 private:
+00048     ListItems _items;
+00049     int _itemCount;
+00050     int _value;
+00051     int _printLen;
+00052 
+00053     void printValue();
+00054 };
+00055 
+00056 #endif
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/Melody_8cpp_source.html b/Melody_8cpp_source.html new file mode 100644 index 00000000..85cb86ac --- /dev/null +++ b/Melody_8cpp_source.html @@ -0,0 +1,200 @@ + + + + +ArduinoLibs: Melody.cpp Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
Melody.cpp
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #include "Melody.h"
+00024 #if defined(ARDUINO) && ARDUINO >= 100
+00025 #include <Arduino.h>
+00026 #else
+00027 #include <WProgram.h>
+00028 #endif
+00029 
+00085 Melody::Melody(uint8_t pin)
+00086     : _pin(pin)
+00087     , playing(false)
+00088     , _loopCount(0)
+00089     , loopsLeft(0)
+00090     , notes(0)
+00091     , lengths(0)
+00092     , size(0)
+00093     , posn(0)
+00094     , duration(0)
+00095     , startNote(0)
+00096 {
+00097 }
+00098 
+00131 void Melody::setLoopDuration(unsigned long ms)
+00132 {
+00133     unsigned long duration = 0;
+00134     for (unsigned int index = 0; index < size; ++index)
+00135         duration += (1000 / lengths[index]) * 13 / 10;
+00136     _loopCount = (int)(ms / duration);
+00137     if (!_loopCount)
+00138         _loopCount = 1;     // Play the melody at least once.
+00139 }
+00140 
+00146 void Melody::play()
+00147 {
+00148     stop();
+00149     if (size == 0)
+00150         return;         // No melody to play.
+00151     loopsLeft = _loopCount;
+00152     posn = 0;
+00153     playing = true;
+00154     nextNote();
+00155 }
+00156 
+00162 void Melody::playOnce()
+00163 {
+00164     stop();
+00165     if (size == 0)
+00166         return;         // No melody to play.
+00167     loopsLeft = 1;
+00168     posn = 0;
+00169     playing = true;
+00170     nextNote();
+00171 }
+00172 
+00178 void Melody::stop()
+00179 {
+00180     if (!playing)
+00181         return;
+00182     playing = false;
+00183     noTone(_pin);
+00184 }
+00185 
+00199 void Melody::setMelody(const int *notes, const uint8_t *lengths, unsigned int size)
+00200 {
+00201     stop();
+00202     this->notes = notes;
+00203     this->lengths = lengths;
+00204     this->size = size;
+00205 }
+00206 
+00214 void Melody::run()
+00215 {
+00216     if (!playing)
+00217         return;
+00218     if ((millis() - startNote) >= duration) {
+00219         noTone(_pin);
+00220         nextNote();
+00221     }
+00222 }
+00223 
+00224 void Melody::nextNote()
+00225 {
+00226     if (posn >= size) {
+00227         if (loopsLeft != 0 && --loopsLeft <= 0) {
+00228             stop();
+00229             return;
+00230         }
+00231         posn = 0;
+00232     }
+00233     duration = 1000 / lengths[posn];
+00234     if (notes[posn] != NOTE_REST)
+00235         tone(_pin, notes[posn], duration);
+00236     ++posn;
+00237     duration = duration * 13 / 10;      // i.e., duration * 1.3
+00238     startNote = millis();
+00239 }
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/Melody_8h_source.html b/Melody_8h_source.html new file mode 100644 index 00000000..4930dbe5 --- /dev/null +++ b/Melody_8h_source.html @@ -0,0 +1,239 @@ + + + + +ArduinoLibs: Melody.h Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
Melody.h
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #ifndef Melody_h
+00024 #define Melody_h
+00025 
+00026 #include <inttypes.h>
+00027 
+00028 // Note frequencies from http://arduino.cc/en/Tutorial/Tone
+00029 #define NOTE_B0  31
+00030 #define NOTE_C1  33
+00031 #define NOTE_CS1 35
+00032 #define NOTE_D1  37
+00033 #define NOTE_DS1 39
+00034 #define NOTE_E1  41
+00035 #define NOTE_F1  44
+00036 #define NOTE_FS1 46
+00037 #define NOTE_G1  49
+00038 #define NOTE_GS1 52
+00039 #define NOTE_A1  55
+00040 #define NOTE_AS1 58
+00041 #define NOTE_B1  62
+00042 #define NOTE_C2  65
+00043 #define NOTE_CS2 69
+00044 #define NOTE_D2  73
+00045 #define NOTE_DS2 78
+00046 #define NOTE_E2  82
+00047 #define NOTE_F2  87
+00048 #define NOTE_FS2 93
+00049 #define NOTE_G2  98
+00050 #define NOTE_GS2 104
+00051 #define NOTE_A2  110
+00052 #define NOTE_AS2 117
+00053 #define NOTE_B2  123
+00054 #define NOTE_C3  131
+00055 #define NOTE_CS3 139
+00056 #define NOTE_D3  147
+00057 #define NOTE_DS3 156
+00058 #define NOTE_E3  165
+00059 #define NOTE_F3  175
+00060 #define NOTE_FS3 185
+00061 #define NOTE_G3  196
+00062 #define NOTE_GS3 208
+00063 #define NOTE_A3  220
+00064 #define NOTE_AS3 233
+00065 #define NOTE_B3  247
+00066 #define NOTE_C4  262
+00067 #define NOTE_CS4 277
+00068 #define NOTE_D4  294
+00069 #define NOTE_DS4 311
+00070 #define NOTE_E4  330
+00071 #define NOTE_F4  349
+00072 #define NOTE_FS4 370
+00073 #define NOTE_G4  392
+00074 #define NOTE_GS4 415
+00075 #define NOTE_A4  440
+00076 #define NOTE_AS4 466
+00077 #define NOTE_B4  494
+00078 #define NOTE_C5  523
+00079 #define NOTE_CS5 554
+00080 #define NOTE_D5  587
+00081 #define NOTE_DS5 622
+00082 #define NOTE_E5  659
+00083 #define NOTE_F5  698
+00084 #define NOTE_FS5 740
+00085 #define NOTE_G5  784
+00086 #define NOTE_GS5 831
+00087 #define NOTE_A5  880
+00088 #define NOTE_AS5 932
+00089 #define NOTE_B5  988
+00090 #define NOTE_C6  1047
+00091 #define NOTE_CS6 1109
+00092 #define NOTE_D6  1175
+00093 #define NOTE_DS6 1245
+00094 #define NOTE_E6  1319
+00095 #define NOTE_F6  1397
+00096 #define NOTE_FS6 1480
+00097 #define NOTE_G6  1568
+00098 #define NOTE_GS6 1661
+00099 #define NOTE_A6  1760
+00100 #define NOTE_AS6 1865
+00101 #define NOTE_B6  1976
+00102 #define NOTE_C7  2093
+00103 #define NOTE_CS7 2217
+00104 #define NOTE_D7  2349
+00105 #define NOTE_DS7 2489
+00106 #define NOTE_E7  2637
+00107 #define NOTE_F7  2794
+00108 #define NOTE_FS7 2960
+00109 #define NOTE_G7  3136
+00110 #define NOTE_GS7 3322
+00111 #define NOTE_A7  3520
+00112 #define NOTE_AS7 3729
+00113 #define NOTE_B7  3951
+00114 #define NOTE_C8  4186
+00115 #define NOTE_CS8 4435
+00116 #define NOTE_D8  4699
+00117 #define NOTE_DS8 4978
+00118 
+00119 // Special note value that indicates a rest.
+00120 #define NOTE_REST 0
+00121 
+00122 class Melody {
+00123 public:
+00124     Melody(uint8_t pin);
+00125 
+00126     bool isPlaying() const { return playing; }
+00127 
+00128     int loopCount() const { return _loopCount; }
+00129     void setLoopCount(int count) { _loopCount = count; }
+00130 
+00131     void setLoopDuration(unsigned long ms);
+00132 
+00133     void play();
+00134     void playOnce();
+00135     void stop();
+00136 
+00137     void setMelody(const int *notes, const uint8_t *lengths, unsigned int size);
+00138 
+00139     void run();
+00140 
+00141 private:
+00142     uint8_t _pin;
+00143     bool playing;
+00144     int _loopCount;
+00145     int loopsLeft;
+00146     const int *notes;
+00147     const uint8_t *lengths;
+00148     unsigned int size;
+00149     unsigned int posn;
+00150     unsigned long duration;
+00151     unsigned long startNote;
+00152 
+00153     void nextNote();
+00154 };
+00155 
+00156 #endif
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/PowerSave_8cpp_source.html b/PowerSave_8cpp_source.html new file mode 100644 index 00000000..140185bd --- /dev/null +++ b/PowerSave_8cpp_source.html @@ -0,0 +1,145 @@ + + + + +ArduinoLibs: PowerSave.cpp Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
PowerSave.cpp
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #include "PowerSave.h"
+00024 #include <avr/wdt.h>
+00025 #include <avr/sleep.h>
+00026 #include <avr/power.h>
+00027 #include <avr/interrupt.h>
+00028 
+00036 /*\@{*/
+00037 
+00048 ISR(WDT_vect)
+00049 {
+00050     wdt_disable();
+00051 }
+00132 void sleepFor(SleepDuration duration, uint8_t mode)
+00133 {
+00134     // Turn off the analog to digital converter.
+00135     ADCSRA &= ~(1 << ADEN);
+00136     power_adc_disable();
+00137 
+00138     // Turn on the watchdog timer for the desired duration.
+00139     wdt_enable(duration);
+00140     WDTCSR |= (1 << WDIE);
+00141 
+00142     // Put the device to sleep, including turning off the Brown Out Detector.
+00143     set_sleep_mode(mode);
+00144     cli();
+00145     sleep_enable();
+00146 #if defined(sleep_bod_disable)
+00147     sleep_bod_disable();
+00148 #endif
+00149     sei();
+00150     sleep_cpu();
+00151     sleep_disable();
+00152     sei();
+00153 
+00154     // Turn the analog to digital converter back on.
+00155     power_adc_enable();
+00156     ADCSRA |= (1 << ADEN);
+00157 }
+00158 
+00159 /*\@}*/
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/PowerSave_8h_source.html b/PowerSave_8h_source.html new file mode 100644 index 00000000..308ffc07 --- /dev/null +++ b/PowerSave_8h_source.html @@ -0,0 +1,137 @@ + + + + +ArduinoLibs: PowerSave.h Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
PowerSave.h
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #ifndef PowerSave_h
+00024 #define PowerSave_h
+00025 
+00026 #if defined(ARDUINO) && ARDUINO >= 100
+00027 #include <Arduino.h>
+00028 #else
+00029 #include <WProgram.h>
+00030 #endif
+00031 
+00032 inline void unusedPin(uint8_t pin)
+00033 {
+00034     pinMode(pin, INPUT);
+00035     digitalWrite(pin, HIGH);
+00036 }
+00037 
+00038 enum SleepDuration
+00039 {
+00040     SLEEP_15_MS,
+00041     SLEEP_30_MS,
+00042     SLEEP_60_MS,
+00043     SLEEP_120_MS,
+00044     SLEEP_250_MS,
+00045     SLEEP_500_MS,
+00046     SLEEP_1_SEC,
+00047     SLEEP_2_SEC,
+00048     SLEEP_4_SEC,
+00049     SLEEP_8_SEC
+00050 };
+00051 
+00052 void sleepFor(SleepDuration duration, uint8_t mode = 0);
+00053 
+00054 #endif
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/RTC_8cpp_source.html b/RTC_8cpp_source.html new file mode 100644 index 00000000..266592bd --- /dev/null +++ b/RTC_8cpp_source.html @@ -0,0 +1,305 @@ + + + + +ArduinoLibs: RTC.cpp Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
RTC.cpp
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #include "RTC.h"
+00024 #if defined(ARDUINO) && ARDUINO >= 100
+00025 #include <Arduino.h>
+00026 #else
+00027 #include <WProgram.h>
+00028 #endif
+00029 #include <stdlib.h>
+00030 #include <string.h>
+00031 
+00058 #define DEFAULT_BYTE_COUNT  43  // Default simulates DS1307 NVRAM size.
+00059 
+00060 #define MILLIS_PER_DAY      86400000UL
+00061 #define MILLIS_PER_SECOND   1000UL
+00062 #define MILLIS_PER_MINUTE   60000UL
+00063 #define MILLIS_PER_HOUR     3600000UL
+00064 
+00065 static uint8_t monthLengths[] = {
+00066     31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
+00067 };
+00068 
+00069 inline bool isLeapYear(unsigned int year)
+00070 {
+00071     if ((year % 100) == 0)
+00072         return (year % 400) == 0;
+00073     else
+00074         return (year % 4) == 0;
+00075 }
+00076 
+00077 inline uint8_t monthLength(const RTCDate *date)
+00078 {
+00079     if (date->month != 2 || !isLeapYear(date->year))
+00080         return monthLengths[date->month - 1];
+00081     else
+00082         return 29;
+00083 }
+00084 
+00090 RTC::RTC()
+00091     : midnight(millis() - 9 * MILLIS_PER_HOUR) // Simulated clock starts at 9am
+00092     , nvram(0)
+00093 {
+00094     // Start the simulated date at 1 Jan, 2000.
+00095     date.day = 1;
+00096     date.month = 1;
+00097     date.year = 2000;
+00098 
+00099     // Set all simulated alarms to 6am by default.
+00100     for (uint8_t index = 0; index < ALARM_COUNT; ++index) {
+00101         alarms[index].hour = 6;
+00102         alarms[index].minute = 0;
+00103         alarms[index].flags = 0;
+00104     }
+00105 }
+00106 
+00107 RTC::~RTC()
+00108 {
+00109     if (nvram)
+00110         free(nvram);
+00111 }
+00112 
+00119 bool RTC::hasUpdates()
+00120 {
+00121     return true;
+00122 }
+00123 
+00129 void RTC::readTime(RTCTime *value)
+00130 {
+00131     // Determine the number of seconds since the last midnight event.
+00132     unsigned long sinceMidnight = millis() - midnight;
+00133     if (sinceMidnight >= MILLIS_PER_DAY) {
+00134         // We have overflowed into the next day.  Readjust midnight.
+00135         midnight += MILLIS_PER_DAY;
+00136         sinceMidnight -= MILLIS_PER_DAY;
+00137 
+00138         // Increment the simulated date.
+00139         adjustDays(&date, INCREMENT);
+00140     }
+00141     value->second = (uint8_t)(((sinceMidnight / MILLIS_PER_SECOND) % 60));
+00142     value->minute = (uint8_t)(((sinceMidnight / MILLIS_PER_MINUTE) % 60));
+00143     value->hour = (uint8_t)(sinceMidnight / MILLIS_PER_HOUR);
+00144 }
+00145 
+00154 void RTC::readDate(RTCDate *value)
+00155 {
+00156     *value = date;
+00157 }
+00158 
+00164 void RTC::writeTime(const RTCTime *value)
+00165 {
+00166     // Adjust the position of the last simulated midnight event.
+00167     unsigned long sinceMidnight =
+00168         value->second * MILLIS_PER_SECOND +
+00169         value->minute * MILLIS_PER_MINUTE +
+00170         value->hour   * MILLIS_PER_HOUR;
+00171     midnight = millis() - sinceMidnight;
+00172 }
+00173 
+00179 void RTC::writeDate(const RTCDate *value)
+00180 {
+00181     date = *value;
+00182 }
+00183 
+00194 void RTC::readAlarm(uint8_t alarmNum, RTCAlarm *value)
+00195 {
+00196     *value = alarms[alarmNum];
+00197 }
+00198 
+00209 void RTC::writeAlarm(uint8_t alarmNum, const RTCAlarm *value)
+00210 {
+00211     alarms[alarmNum] = *value;
+00212 }
+00213 
+00220 int RTC::byteCount() const
+00221 {
+00222     return DEFAULT_BYTE_COUNT;
+00223 }
+00224 
+00232 uint8_t RTC::readByte(uint8_t offset)
+00233 {
+00234     if (nvram)
+00235         return nvram[offset];
+00236     else
+00237         return 0;
+00238 }
+00239 
+00247 void RTC::writeByte(uint8_t offset, uint8_t value)
+00248 {
+00249     if (nvram) {
+00250         nvram[offset] = value;
+00251     } else {
+00252         nvram = (uint8_t *)malloc(DEFAULT_BYTE_COUNT);
+00253         if (nvram) {
+00254             memset(nvram, 0, DEFAULT_BYTE_COUNT);
+00255             nvram[offset] = value;
+00256         }
+00257     }
+00258 }
+00259 
+00280 void RTC::adjustDays(RTCDate *date, uint8_t flags)
+00281 {
+00282     if (flags & DECREMENT) {
+00283         --(date->day);
+00284         if (date->day == 0) {
+00285             if (!(flags & WRAP)) {
+00286                 --(date->month);
+00287                 if (date->month == 0)
+00288                     date->month = 12;
+00289             }
+00290             date->day = monthLength(date);
+00291         }
+00292     } else {
+00293         ++(date->day);
+00294         if (date->day > monthLength(date)) {
+00295             if (!(flags & WRAP)) {
+00296                 ++(date->month);
+00297                 if (date->month == 13)
+00298                     date->month = 1;
+00299             }
+00300             date->day = 1;
+00301         }
+00302     }
+00303 }
+00304 
+00310 void RTC::adjustMonths(RTCDate *date, uint8_t flags)
+00311 {
+00312     if (flags & DECREMENT) {
+00313         --(date->month);
+00314         if (date->month == 0) {
+00315             date->month = 12;
+00316             if (!(flags & WRAP) && date->year > 2000)
+00317                 --(date->year);
+00318         }
+00319     } else {
+00320         ++(date->month);
+00321         if (date->month == 13) {
+00322             date->month = 1;
+00323             if (!(flags & WRAP) && date->year < 2099)
+00324                 ++(date->year);
+00325         }
+00326     }
+00327     uint8_t len = monthLength(date);
+00328     if (date->day > len)
+00329         date->day = len;
+00330 }
+00331 
+00337 void RTC::adjustYears(RTCDate *date, uint8_t flags)
+00338 {
+00339     if (flags & DECREMENT) {
+00340         --(date->year);
+00341         if (date->year < 2000)
+00342             date->year = 2000;
+00343     } else {
+00344         ++(date->year);
+00345         if (date->year > 2099)
+00346             date->year = 2099;
+00347     }
+00348     uint8_t len = monthLength(date);
+00349     if (date->day > len)
+00350         date->day = len;
+00351 }
+00352 
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/RTC_8h_source.html b/RTC_8h_source.html new file mode 100644 index 00000000..ae619e97 --- /dev/null +++ b/RTC_8h_source.html @@ -0,0 +1,171 @@ + + + + +ArduinoLibs: RTC.h Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
RTC.h
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #ifndef RTC_h
+00024 #define RTC_h
+00025 
+00026 #include <inttypes.h>
+00027 
+00028 struct RTCTime
+00029 {
+00030     uint8_t hour;
+00031     uint8_t minute;
+00032     uint8_t second;
+00033 };
+00034 
+00035 struct RTCDate
+00036 {
+00037     unsigned int year;
+00038     uint8_t month;
+00039     uint8_t day;
+00040 };
+00041 
+00042 struct RTCAlarm
+00043 {
+00044     uint8_t hour;
+00045     uint8_t minute;
+00046     uint8_t flags;
+00047 };
+00048 
+00049 class RTC
+00050 {
+00051 public:
+00052     RTC();
+00053     ~RTC();
+00054 
+00055     virtual bool hasUpdates();
+00056 
+00057     virtual void readTime(RTCTime *value);
+00058     virtual void readDate(RTCDate *value);
+00059 
+00060     virtual void writeTime(const RTCTime *value);
+00061     virtual void writeDate(const RTCDate *value);
+00062 
+00063     static const uint8_t ALARM_COUNT = 4;
+00064 
+00065     virtual void readAlarm(uint8_t alarmNum, RTCAlarm *value);
+00066     virtual void writeAlarm(uint8_t alarmNum, const RTCAlarm *value);
+00067 
+00068     virtual int byteCount() const;
+00069     virtual uint8_t readByte(uint8_t offset);
+00070     virtual void writeByte(uint8_t offset, uint8_t value);
+00071 
+00072     // Flags for adjustDays(), adjustMonths(), and adjustYears().
+00073     static const uint8_t INCREMENT = 0x0000;
+00074     static const uint8_t DECREMENT = 0x0001;
+00075     static const uint8_t WRAP      = 0x0002;
+00076 
+00077     static void adjustDays(RTCDate *date, uint8_t flags);
+00078     static void adjustMonths(RTCDate *date, uint8_t flags);
+00079     static void adjustYears(RTCDate *date, uint8_t flags);
+00080 
+00081 private:
+00082     unsigned long midnight;
+00083     RTCDate date;
+00084     RTCAlarm alarms[ALARM_COUNT];
+00085     uint8_t *nvram;
+00086 };
+00087 
+00088 #endif
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/SoftI2C_8cpp_source.html b/SoftI2C_8cpp_source.html new file mode 100644 index 00000000..0bac5670 --- /dev/null +++ b/SoftI2C_8cpp_source.html @@ -0,0 +1,267 @@ + + + + +ArduinoLibs: SoftI2C.cpp Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
SoftI2C.cpp
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #include "SoftI2C.h"
+00024 #if defined(ARDUINO) && ARDUINO >= 100
+00025 #include <Arduino.h>
+00026 #else
+00027 #include <WProgram.h>
+00028 #endif
+00029 
+00045 #define i2cDelay()  delayMicroseconds(5)
+00046 
+00050 SoftI2C::SoftI2C(uint8_t dataPin, uint8_t clockPin)
+00051     : _dataPin(dataPin)
+00052     , _clockPin(clockPin)
+00053     , started(false)
+00054     , acked(true)
+00055     , inWrite(false)
+00056     , readCount(0)
+00057 {
+00058     // Initially set the CLOCK and DATA lines to be outputs in the high state.
+00059     pinMode(_clockPin, OUTPUT);
+00060     pinMode(_dataPin, OUTPUT);
+00061     digitalWrite(_clockPin, HIGH);
+00062     digitalWrite(_dataPin, HIGH);
+00063 }
+00064 
+00065 unsigned int SoftI2C::maxTransferSize() const
+00066 {
+00067     return 0xFFFF;
+00068 }
+00069 
+00070 void SoftI2C::start()
+00071 {
+00072     pinMode(_dataPin, OUTPUT);
+00073     if (started) {
+00074         // Already started, so send a restart condition.
+00075         digitalWrite(_dataPin, HIGH);
+00076         digitalWrite(_clockPin, HIGH);
+00077         i2cDelay();
+00078     }
+00079     digitalWrite(_dataPin, LOW);
+00080     i2cDelay();
+00081     digitalWrite(_clockPin, LOW);
+00082     i2cDelay();
+00083     started = true;
+00084     acked = true;
+00085 }
+00086 
+00087 void SoftI2C::stop()
+00088 {
+00089     pinMode(_dataPin, OUTPUT);
+00090     digitalWrite(_dataPin, LOW);
+00091     digitalWrite(_clockPin, HIGH);
+00092     i2cDelay();
+00093     digitalWrite(_dataPin, HIGH);
+00094     i2cDelay();
+00095     started = false;
+00096     inWrite = false;
+00097 }
+00098 
+00099 #define I2C_WRITE   0x00
+00100 #define I2C_WRITE10 0xF0
+00101 #define I2C_READ    0x01
+00102 #define I2C_READ10  0xF1
+00103 
+00104 void SoftI2C::startWrite(unsigned int address)
+00105 {
+00106     start();
+00107     inWrite = true;
+00108     if (address < 0x80) {
+00109         // 7-bit address.
+00110         write((uint8_t)((address << 1) | I2C_WRITE));
+00111     } else {
+00112         // 10-bit address.
+00113         write((uint8_t)(((address >> 7) & 0x06)) | I2C_WRITE10);
+00114         write((uint8_t)address);
+00115     }
+00116 }
+00117 
+00118 void SoftI2C::write(uint8_t value)
+00119 {
+00120     uint8_t mask = 0x80;
+00121     while (mask != 0) {
+00122         writeBit((value & mask) != 0);
+00123         mask >>= 1;
+00124     }
+00125     if (readBit())  // 0: ACK, 1: NACK
+00126         acked = false;
+00127 }
+00128 
+00129 bool SoftI2C::endWrite()
+00130 {
+00131     stop();
+00132     return acked;
+00133 }
+00134 
+00135 bool SoftI2C::startRead(unsigned int address, unsigned int count)
+00136 {
+00137     start();
+00138     inWrite = false;
+00139     if (address < 0x80) {
+00140         // 7-bit address.
+00141         write((uint8_t)((address << 1) | I2C_READ));
+00142     } else {
+00143         // 10-bit address.
+00144         write((uint8_t)(((address >> 7) & 0x06)) | I2C_READ10);
+00145         write((uint8_t)address);
+00146     }
+00147     if (!acked) {
+00148         readCount = 0;
+00149         return false;
+00150     }
+00151     readCount = count;
+00152     return true;
+00153 }
+00154 
+00155 unsigned int SoftI2C::available()
+00156 {
+00157     return readCount;
+00158 }
+00159 
+00160 uint8_t SoftI2C::read()
+00161 {
+00162     uint8_t value = 0;
+00163     for (uint8_t bit = 0; bit < 8; ++bit)
+00164         value = (value << 1) | readBit();
+00165     if (readCount > 1) {
+00166         // More bytes left to read - send an ACK.
+00167         writeBit(false);
+00168         --readCount;
+00169     } else {
+00170         // Last byte - send the NACK and a stop condition.
+00171         writeBit(true);
+00172         stop();
+00173         readCount = 0;
+00174     }
+00175     return value;
+00176 }
+00177 
+00178 void SoftI2C::writeBit(bool bit)
+00179 {
+00180     pinMode(_dataPin, OUTPUT);
+00181     if (bit)
+00182         digitalWrite(_dataPin, HIGH);
+00183     else
+00184         digitalWrite(_dataPin, LOW);
+00185     i2cDelay();
+00186     digitalWrite(_clockPin, HIGH);
+00187     i2cDelay();
+00188     digitalWrite(_clockPin, LOW);
+00189     i2cDelay();
+00190 }
+00191 
+00192 bool SoftI2C::readBit()
+00193 {
+00194     pinMode(_dataPin, INPUT);
+00195     digitalWrite(_dataPin, HIGH);
+00196     digitalWrite(_clockPin, HIGH);
+00197     bool bit = digitalRead(_dataPin);
+00198     i2cDelay();
+00199     digitalWrite(_clockPin, LOW);
+00200     i2cDelay();
+00201     return bit;
+00202 }
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/SoftI2C_8h_source.html b/SoftI2C_8h_source.html new file mode 100644 index 00000000..9514a1da --- /dev/null +++ b/SoftI2C_8h_source.html @@ -0,0 +1,139 @@ + + + + +ArduinoLibs: SoftI2C.h Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
SoftI2C.h
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #ifndef SoftI2C_h
+00024 #define SoftI2C_h
+00025 
+00026 #include "I2CMaster.h"
+00027 
+00028 class SoftI2C : public I2CMaster {
+00029 public:
+00030     SoftI2C(uint8_t dataPin, uint8_t clockPin);
+00031 
+00032     unsigned int maxTransferSize() const;
+00033 
+00034     void startWrite(unsigned int address);
+00035     void write(uint8_t value);
+00036     bool endWrite();
+00037 
+00038     bool startRead(unsigned int address, unsigned int count);
+00039     unsigned int available();
+00040     uint8_t read();
+00041 
+00042 private:
+00043     uint8_t _dataPin;
+00044     uint8_t _clockPin;
+00045     bool started;
+00046     bool acked;
+00047     bool inWrite;
+00048     unsigned int readCount;
+00049 
+00050     void start();
+00051     void stop();
+00052     void writeBit(bool bit);
+00053     bool readBit();
+00054 };
+00055 
+00056 #endif
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/StarTrek.png b/StarTrek.png new file mode 100644 index 00000000..9588a9b2 Binary files /dev/null and b/StarTrek.png differ diff --git a/StarTrekBreadboard.png b/StarTrekBreadboard.png new file mode 100644 index 00000000..8a14f8eb Binary files /dev/null and b/StarTrekBreadboard.png differ diff --git a/StarTrekShield.png b/StarTrekShield.png new file mode 100644 index 00000000..1ab21738 Binary files /dev/null and b/StarTrekShield.png differ diff --git a/TextField_8cpp_source.html b/TextField_8cpp_source.html new file mode 100644 index 00000000..29ef7bb4 --- /dev/null +++ b/TextField_8cpp_source.html @@ -0,0 +1,139 @@ + + + + +ArduinoLibs: TextField.cpp Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
TextField.cpp
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #include "TextField.h"
+00024 
+00066 TextField::TextField(const String &label)
+00067     : Field(label)
+00068 {
+00069 }
+00070 
+00077 TextField::TextField(Form &form, const String &label, const String &value)
+00078     : Field(form, label)
+00079     , _value(value)
+00080 {
+00081 }
+00082 
+00083 void TextField::enterField(bool reverse)
+00084 {
+00085     Field::enterField(reverse);
+00086     lcd()->setCursor(0, 1);
+00087     lcd()->print(_value);
+00088 }
+00089 
+00102 void TextField::setValue(const String &value)
+00103 {
+00104     if (isCurrent()) {
+00105         unsigned int prevLen = _value.length();
+00106         unsigned int newLen = value.length();
+00107         _value = value;
+00108         lcd()->setCursor(0, 1);
+00109         lcd()->print(value);
+00110         while (newLen++ < prevLen)
+00111             lcd()->write(' ');
+00112     } else {
+00113         _value = value;
+00114     }
+00115 }
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/TextField_8h_source.html b/TextField_8h_source.html new file mode 100644 index 00000000..f5febaa1 --- /dev/null +++ b/TextField_8h_source.html @@ -0,0 +1,125 @@ + + + + +ArduinoLibs: TextField.h Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
TextField.h
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #ifndef TextField_h
+00024 #define TextField_h
+00025 
+00026 #include "Field.h"
+00027 
+00028 class TextField : public Field {
+00029 public:
+00030     explicit TextField(const String &label);
+00031     TextField(Form &form, const String &label, const String &value);
+00032 
+00033     void enterField(bool reverse);
+00034 
+00035     const String &value() const { return _value; }
+00036     void setValue(const String &value);
+00037 
+00038 private:
+00039     String _value;
+00040 };
+00041 
+00042 #endif
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/ThreeChase.png b/ThreeChase.png new file mode 100644 index 00000000..c460598c Binary files /dev/null and b/ThreeChase.png differ diff --git a/TimeField_8cpp_source.html b/TimeField_8cpp_source.html new file mode 100644 index 00000000..14125261 --- /dev/null +++ b/TimeField_8cpp_source.html @@ -0,0 +1,304 @@ + + + + +ArduinoLibs: TimeField.cpp Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
TimeField.cpp
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #include "TimeField.h"
+00024 
+00065 #define EDIT_HOUR           0
+00066 #define EDIT_MINUTE_TENS    1
+00067 #define EDIT_MINUTE         2
+00068 #define EDIT_SECOND_TENS    3
+00069 #define EDIT_SECOND         4
+00070 
+00082 TimeField::TimeField(const String &label)
+00083     : Field(label)
+00084     , _value(0)
+00085     , _maxHours(24)
+00086     , _printLen(0)
+00087     , _readOnly(false)
+00088     , editField(EDIT_HOUR)
+00089 {
+00090 }
+00091 
+00105 TimeField::TimeField(Form &form, const String &label, int maxHours, bool readOnly)
+00106     : Field(form, label)
+00107     , _value(0)
+00108     , _maxHours(maxHours)
+00109     , _printLen(0)
+00110     , _readOnly(readOnly)
+00111     , editField(EDIT_HOUR)
+00112 {
+00113 }
+00114 
+00115 int TimeField::dispatch(int event)
+00116 {
+00117     unsigned long newValue;
+00118     if (_readOnly)
+00119         return -1;
+00120     if (event == LCD_BUTTON_UP) {
+00121         newValue = _value;
+00122         if (editField == EDIT_HOUR) {
+00123             newValue += 60 * 60;
+00124         } else if (editField == EDIT_MINUTE_TENS) {
+00125             if (((newValue / 60) % 60) >= 50)
+00126                 newValue -= 50 * 60;
+00127             else
+00128                 newValue += 10 * 60;
+00129         } else if (editField == EDIT_MINUTE) {
+00130             if (((newValue / 60) % 60) == 59)
+00131                 newValue -= 59 * 60;
+00132             else
+00133                 newValue += 60;
+00134         } else if (editField == EDIT_SECOND_TENS) {
+00135             if ((newValue % 60) >= 50)
+00136                 newValue -= 50;
+00137             else
+00138                 newValue += 10;
+00139         } else {
+00140             if ((newValue % 60) == 59)
+00141                 newValue -= 59;
+00142             else
+00143                 newValue += 1;
+00144         }
+00145         setValue(newValue);
+00146         return FORM_CHANGED;
+00147     } else if (event == LCD_BUTTON_DOWN) {
+00148         newValue = _value;
+00149         if (editField == EDIT_HOUR) {
+00150             if (newValue < 60 * 60)
+00151                 newValue += ((unsigned long)(_maxHours - 1)) * 60 * 60;
+00152             else
+00153                 newValue -= 60 * 60;
+00154         } else if (editField == EDIT_MINUTE_TENS) {
+00155             if (((newValue / 60) % 60) < 10)
+00156                 newValue += 50 * 60;
+00157             else
+00158                 newValue -= 10 * 60;
+00159         } else if (editField == EDIT_MINUTE) {
+00160             if (((newValue / 60) % 60) == 0)
+00161                 newValue += 59 * 60;
+00162             else
+00163                 newValue -= 60;
+00164         } else if (editField == EDIT_SECOND_TENS) {
+00165             if ((newValue % 60) < 10)
+00166                 newValue += 50;
+00167             else
+00168                 newValue -= 10;
+00169         } else {
+00170             if ((newValue % 60) == 0)
+00171                 newValue += 59;
+00172             else
+00173                 newValue -= 1;
+00174         }
+00175         setValue(newValue);
+00176         return FORM_CHANGED;
+00177     } else if (event == LCD_BUTTON_LEFT) {
+00178         if (editField != EDIT_HOUR) {
+00179             --editField;
+00180             printTime();
+00181             return 0;
+00182         }
+00183     } else if (event == LCD_BUTTON_RIGHT) {
+00184         if (editField != EDIT_SECOND) {
+00185             ++editField;
+00186             printTime();
+00187             return 0;
+00188         }
+00189     }
+00190     return -1;
+00191 }
+00192 
+00193 void TimeField::enterField(bool reverse)
+00194 {
+00195     Field::enterField(reverse);
+00196     if (reverse)
+00197         editField = EDIT_SECOND;
+00198     else
+00199         editField = EDIT_HOUR;
+00200     printTime();
+00201     if (!_readOnly)
+00202         lcd()->cursor();
+00203 }
+00204 
+00205 void TimeField::exitField()
+00206 {
+00207     if (!_readOnly)
+00208         lcd()->noCursor();
+00209     Field::exitField();
+00210 }
+00211 
+00227 void TimeField::setValue(unsigned long value)
+00228 {
+00229     unsigned long maxSecs = ((unsigned long)_maxHours) * 60 * 60;
+00230     value %= maxSecs;
+00231     if (value != _value) {
+00232         _value = value;
+00233         if (isCurrent())
+00234             printTime();
+00235     }
+00236 }
+00237 
+00268 void TimeField::setReadOnly(bool value)
+00269 {
+00270     if (_readOnly != value) {
+00271         _readOnly = value;
+00272         printTime();
+00273         if (isCurrent()) {
+00274             if (value)
+00275                 lcd()->cursor();
+00276             else
+00277                 lcd()->noCursor();
+00278         }
+00279     }
+00280 }
+00281 
+00282 void TimeField::printTime()
+00283 {
+00284     lcd()->setCursor(0, 1);
+00285     int col = printField(_value / (60 * 60));
+00286     int hourCol = col - 1;
+00287     lcd()->write(':');
+00288     ++col;
+00289     col += printField((_value / 60) % 60);
+00290     int minuteCol = col - 1;
+00291     lcd()->write(':');
+00292     ++col;
+00293     col += printField(_value % 60);
+00294     int secondCol = col - 1;
+00295     int tempCol = col;
+00296     while (tempCol++ < _printLen)
+00297         lcd()->write(' ');
+00298     _printLen = col;
+00299     if (!_readOnly) {
+00300         if (editField == EDIT_HOUR)
+00301             lcd()->setCursor(hourCol, 1);
+00302         else if (editField == EDIT_MINUTE_TENS)
+00303             lcd()->setCursor(minuteCol - 1, 1);
+00304         else if (editField == EDIT_MINUTE)
+00305             lcd()->setCursor(minuteCol, 1);
+00306         else if (editField == EDIT_SECOND_TENS)
+00307             lcd()->setCursor(secondCol - 1, 1);
+00308         else
+00309             lcd()->setCursor(secondCol, 1);
+00310     }
+00311 }
+00312 
+00313 int TimeField::printField(unsigned long value)
+00314 {
+00315     if (value < 100) {
+00316         lcd()->write('0' + (int)(value / 10));
+00317         lcd()->write('0' + (int)(value % 10));
+00318         return 2;
+00319     }
+00320     unsigned long divisor = 100;
+00321     while ((value / divisor) >= 10)
+00322         divisor *= 10;
+00323     int digits = 0;
+00324     while (divisor > 0) {
+00325         lcd()->write('0' + (int)((value / divisor) % 10));
+00326         divisor /= 10;
+00327         ++digits;
+00328     }
+00329     return digits;
+00330 }
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/TimeField_8h_source.html b/TimeField_8h_source.html new file mode 100644 index 00000000..29d9c861 --- /dev/null +++ b/TimeField_8h_source.html @@ -0,0 +1,144 @@ + + + + +ArduinoLibs: TimeField.h Source File + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
TimeField.h
+
+
+
00001 /*
+00002  * Copyright (C) 2012 Southern Storm Software, Pty Ltd.
+00003  *
+00004  * Permission is hereby granted, free of charge, to any person obtaining a
+00005  * copy of this software and associated documentation files (the "Software"),
+00006  * to deal in the Software without restriction, including without limitation
+00007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+00008  * and/or sell copies of the Software, and to permit persons to whom the
+00009  * Software is furnished to do so, subject to the following conditions:
+00010  *
+00011  * The above copyright notice and this permission notice shall be included
+00012  * in all copies or substantial portions of the Software.
+00013  *
+00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+00015  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+00019  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+00020  * DEALINGS IN THE SOFTWARE.
+00021  */
+00022 
+00023 #ifndef TimeField_h
+00024 #define TimeField_h
+00025 
+00026 #include "Field.h"
+00027 
+00028 #define TIMEFIELD_READ_ONLY     true
+00029 #define TIMEFIELD_READ_WRITE    false
+00030 
+00031 class TimeField : public Field {
+00032 public:
+00033     explicit TimeField(const String &label);
+00034     TimeField(Form &form, const String &label, int maxHours, bool readOnly);
+00035 
+00036     int dispatch(int event);
+00037 
+00038     void enterField(bool reverse);
+00039     void exitField();
+00040 
+00041     unsigned long value() const { return _value; }
+00042     void setValue(unsigned long value);
+00043 
+00044     int maxHours() const { return _maxHours; }
+00045     void setMaxHours(int maxHours) { _maxHours = maxHours; }
+00046 
+00047     bool readOnly() const { return _readOnly; }
+00048     void setReadOnly(bool value);
+00049 
+00050 private:
+00051     unsigned long _value;
+00052     int _maxHours;
+00053     int _printLen;
+00054     bool _readOnly;
+00055     uint8_t editField;
+00056 
+00057     void printTime();
+00058     int printField(unsigned long value);
+00059 };
+00060 
+00061 #endif
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/alarm-clock_8dox.html b/alarm-clock_8dox.html new file mode 100644 index 00000000..de8054a3 --- /dev/null +++ b/alarm-clock_8dox.html @@ -0,0 +1,88 @@ + + + + +ArduinoLibs: alarm-clock.dox File Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
alarm-clock.dox File Reference
+
+
+ +
+

Detailed Description

+
+

Definition in file alarm-clock.dox.

+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/alarm_circuit.png b/alarm_circuit.png new file mode 100644 index 00000000..2607c93d Binary files /dev/null and b/alarm_circuit.png differ diff --git a/alarm_clock.html b/alarm_clock.html new file mode 100644 index 00000000..2ac2f798 --- /dev/null +++ b/alarm_clock.html @@ -0,0 +1,120 @@ + + + + +ArduinoLibs: Alarm Clock + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ +
+
+
+
Alarm Clock
+
+
+

+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 PowerSave. The clock has the following features:

+
    +
  • Displays both the time and date.
  • +
  • 12 hour and 24 hour time display modes.
  • +
  • Up to 4 configurable alarm times, plus a snooze alarm.
  • +
  • Three alarm sounds to choose from.
  • +
  • Configurable alarm timeout between 2 and 10 seconds.
  • +
  • Single button to activate the back light and/or stop the alarm.
  • +
  • Up, down, left, and right buttons to change clock settings.
  • +
+

+Main circuit

+

The main clock circuit consists of an Arduino Uno compatible board, a 16x2 LCD module, a realtime clock chip, and a piezo buzzer for the alarm:

+
+alarm_circuit.png +
+

Some of the components can be purchased ready-made as the Freetronics 16x2 LCD Shield and the SparkFun Realtime Clock Module. 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 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 and piezo buzzer are not shown in this picture and some of the components are soldered to the bottom of the shield:

+
+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.

+

+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 KitTen kit from Freetronics, and didn't solder up anything that wasn't strictly necessary. A 5v FTDI USB-to-Serial cable is necessary for programming. Similar minimalistic built-it-yourself Arduino designs should also work.

+
+kitten_minimal.jpg +
+

+Using DS3232 instead of DS1307

+

For clock modules based on the DS3232 chip, such as the Freetronics Real Time Clock Module, change the Clock typedef in Clock.h to the following:

+
typedef DS3232RTC Clock;
+

The pads on the Freetronics module should be connected to the Arduino as follows:

+
    +
  • VCC and GND connected to 5V and GND on the Arduino.
  • +
  • SQI connected to A3.
  • +
  • SDA connected to A4.
  • +
  • SCL connected to A5.
  • +
  • BAT, 32K, and RST left unconnected.
  • +
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/annotated.html b/annotated.html new file mode 100644 index 00000000..b78cf821 --- /dev/null +++ b/annotated.html @@ -0,0 +1,107 @@ + + + + +ArduinoLibs: Class List + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
Class List
+
+
+
Here are the classes, structs, unions and interfaces with brief descriptions:
+ + + + + + + + + + + + + + + + + + + +
BlinkLEDBlink a LED on a digital output pin
BoolFieldField that manages the input of a boolean value
ChaseLEDsChase LED's on output pins in a defined sequence
DS1307RTCCommunicates with a DS1307 realtime clock chip via I2C
DS3232RTCCommunicates with a DS3232 realtime clock chip via I2C
FieldManages a single data input/output field within a Form
FormManager for a form containing data input/output fields
I2CMasterAbstract base class for I2C master implementations
IntFieldField that manages the input of an integer value
LCDEnhanced library for Freetronics 16x2 LCD shields
ListFieldField that manages selection from a static list of items
MelodyPlays a melody on a digital output pin using tone()
RTCBase class for realtime clock handlers
RTCAlarmStores alarm information from a realtime clock chip
RTCDateStores date information from a realtime clock chip
RTCTimeStores time information from a realtime clock chip
SoftI2CBit-banged implementation of an I2C master
TextFieldField that displays a read-only text value
TimeFieldField that manages the display and editing of a time value
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/bc_s.png b/bc_s.png new file mode 100644 index 00000000..e4018628 Binary files /dev/null and b/bc_s.png differ diff --git a/blink-blink_8dox.html b/blink-blink_8dox.html new file mode 100644 index 00000000..8bdfa71f --- /dev/null +++ b/blink-blink_8dox.html @@ -0,0 +1,88 @@ + + + + +ArduinoLibs: blink-blink.dox File Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
blink-blink.dox File Reference
+
+
+ +
+

Detailed Description

+
+

Definition in file blink-blink.dox.

+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/blink-cylon_8dox.html b/blink-cylon_8dox.html new file mode 100644 index 00000000..3f23e74a --- /dev/null +++ b/blink-cylon_8dox.html @@ -0,0 +1,88 @@ + + + + +ArduinoLibs: blink-cylon.dox File Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
blink-cylon.dox File Reference
+
+
+ +
+

Detailed Description

+
+

Definition in file blink-cylon.dox.

+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/blink-startrek_8dox.html b/blink-startrek_8dox.html new file mode 100644 index 00000000..5bc5dba2 --- /dev/null +++ b/blink-startrek_8dox.html @@ -0,0 +1,88 @@ + + + + +ArduinoLibs: blink-startrek.dox File Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
blink-startrek.dox File Reference
+
+
+ +
+

Detailed Description

+
+

Definition in file blink-startrek.dox.

+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/blink_blink.html b/blink_blink.html new file mode 100644 index 00000000..d0ec930a --- /dev/null +++ b/blink_blink.html @@ -0,0 +1,116 @@ + + + + +ArduinoLibs: Blinking LED Example + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ +
+
+
+
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:

+
void loop() {
+    digitalWrite(13, HIGH);
+    delay(1000);
+    digitalWrite(13, LOW);
+    delay(1000);
+}
+

The problem with this code is that the entire application is blocked during the delay(). 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:

+
#include <BlinkLED.h>
+
+BlinkLED statusBlink(13, 70, 930);
+

+

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:

+
BlinkLED statusBlink(13, 70, 930, true);
+

The remaining code we need is a call to BlinkLED::loop() every time around the main application loop:

+
void loop() {
+  statusBlink.loop();
+}
+

+

As can be seen, BlinkLED simplifies the process of blinking a LED quite considerably. It is also possible to pause() and 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:

+
/*
+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();
+}
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/blink_cylon.html b/blink_cylon.html new file mode 100644 index 00000000..41052eb2 --- /dev/null +++ b/blink_cylon.html @@ -0,0 +1,167 @@ + + + + +ArduinoLibs: Cylon Eyes Example + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ +
+
+
+
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:

+
+Cylon.png +
+

We start by including the ChaseLEDs class:

+
#include <ChaseLEDs.h>
+

+

The next step is to define the pins that the chase will run over:

+
byte pins[] = {3, 5, 6, 9, 10, 11, 10, 9, 6, 5};
+ChaseLEDs cylonEyes(pins, sizeof(pins), 100);
+

+

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:

+
void loop() {
+  cylonEyes.loop();
+}
+

+

While this example uses only six pins, it can be easily extended to any number of pins by modifying the 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 CylonChase class that inherits from ChaseLEDs:

+
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);
+  }
+};
+

+

The important part is the implementation of the advance() 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:

+
byte pins[] = {3, 5, 6, 9, 10, 11, 10, 9, 6, 5};
+CylonChase cylonEyes(pins, sizeof(pins), 100);
+

+

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:

+
  void advance(byte prevPin, byte nextPin) {
+    digitalWrite(previousPin(2), LOW);
+    analogWrite(prevPin, 32);
+    digitalWrite(nextPin, HIGH);
+  }
+

+

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:

+
+Cylon4.png +
+

We then modify the advance() method to read the new chase rate from the potentiometer each time the LED advances:

+
  void advance(byte prevPin, byte nextPin) {
+    digitalWrite(previousPin(2), LOW);
+    analogWrite(prevPin, 32);
+    digitalWrite(nextPin, HIGH);
+    setAdvanceTime(map(analogRead(A0), 0, 1023, 25, 250));
+  }
+

+

The full source code for the final version of the example follows:

+
/*
+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();
+}
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/blink_startrek.html b/blink_startrek.html new file mode 100644 index 00000000..8c53741b --- /dev/null +++ b/blink_startrek.html @@ -0,0 +1,233 @@ + + + + +ArduinoLibs: Star Trek Example + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ +
+
+
+
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 Blink and Cylon tutorials first.

+

There are four categories of lights on the Enterprise:

+
    +
  • 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.
  • +
  • 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.
  • +
  • White strobe light behind the bridge and on the warp nacelles that comes on briefly every second.
  • +
  • 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):

+
+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:

+
+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:

+
+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:

+
#include <BlinkLED.h>
+#define NAV_LIGHTS           A2    // Output pin for controlling the navigation lights
+#define NAV_LIGHTS_ON        1000  // Time the navigation lights are on (milliseconds)
+#define NAV_LIGHTS_OFF       1000  // Time the navigation lights are off (milliseconds)
+BlinkLED navLights(NAV_LIGHTS, NAV_LIGHTS_ON, NAV_LIGHTS_OFF);
+

+

We repeat the process for the strobe LED on AOUT3, with a period of 70 milliseconds on, and 830 milliseconds off:

+
#define STROBE_LIGHT         A3    // Output pin for controlling the strobe
+#define STROBE_LIGHT_ON      70    // Time the strobe light is on (milliseconds)
+#define STROBE_LIGHT_OFF     830   // Time the strobe light is off (milliseconds)
+BlinkLED strobeLight(STROBE_LIGHT, STROBE_LIGHT_ON, STROBE_LIGHT_OFF);
+

+

We also need to arrange for BlinkLED::loop() to be called from the application's main loop() function:

+
void loop() {
+  navLights.loop();
+  strobeLight.loop();
+}
+

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 Cylon example for more information on creating custom effects with ChaseLEDs.

+
#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);
+

+

We also need to add a call to ChaseLEDs::loop() to the application's main loop:

+
void loop() {
+  navLights.loop();
+  strobeLight.loop();
+  nacelleChase.loop();
+}
+

+

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 NACELLE_CHASE_LEN 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:

+
+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 advance() 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:

+
  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));
+  }
+

+

The full source code for the example, including the "opposite pairs" effect, follows:

+
/*
+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();
+}
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classBlinkLED-members.html b/classBlinkLED-members.html new file mode 100644 index 00000000..fb010160 --- /dev/null +++ b/classBlinkLED-members.html @@ -0,0 +1,97 @@ + + + + +ArduinoLibs: Member List + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
BlinkLED Member List
+
+
+This is the complete list of members for BlinkLED, including all inherited members. + + + + + + + + + + +
BlinkLED(uint8_t pin, unsigned long onTime, unsigned long offTime, bool initialState=false)BlinkLED
isPaused() const BlinkLED [inline]
loop()BlinkLED
offTime() const BlinkLED [inline]
onTime() const BlinkLED [inline]
pause()BlinkLED [inline]
resume()BlinkLED
setBlinkRate(unsigned long onTime, unsigned long offTime)BlinkLED
setState(bool state)BlinkLED
state() const BlinkLED [inline]
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classBlinkLED.html b/classBlinkLED.html new file mode 100644 index 00000000..c1dee35c --- /dev/null +++ b/classBlinkLED.html @@ -0,0 +1,385 @@ + + + + +ArduinoLibs: BlinkLED Class Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+ +
+
BlinkLED Class Reference
+
+
+ +

Blink a LED on a digital output pin. + More...

+ +

#include <BlinkLED.h>

+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 BlinkLED (uint8_t pin, unsigned long onTime, unsigned long offTime, bool initialState=false)
 Initialize a blinking LED on the specified pin.
void loop ()
unsigned long onTime () const
 Returns the number of milliseconds the LED will be on.
unsigned long offTime () const
 Returns the number of milliseconds the LED will be off.
void setBlinkRate (unsigned long onTime, unsigned long offTime)
 Sets the onTime and offTime (in milliseconds).
bool state () const
 Returns the current state of the LED; true is on, false is off.
void setState (bool state)
 Sets the current state of the LED, where true is on, false is off.
void pause ()
 Pauses the LED blink cycle in its current state().
void resume ()
 Resumes the LED blink cycle after a pause().
bool isPaused () const
 Returns true if the LED blink cycle is paused; false otherwise.
+

Detailed Description

+

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):

+
 #include <BlinkLED.h>
+
+ BlinkLED statusBlink(13, 70, 930);
+
+ void setup() {}
+
+ void loop() {
+     statusBlink.loop();
+ }
+

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().

+ +

Definition at line 28 of file BlinkLED.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
BlinkLED::BlinkLED (uint8_t pin,
unsigned long onTime,
unsigned long offTime,
bool initialState = false 
)
+
+
+ +

Initialize a blinking LED on the specified pin.

+

The LED will blink with a rate defined by onTime and offTime (in milliseconds). Initially the LED's state is given by initialState, where true means initially on and false means initially off.

+ +

Definition at line 64 of file BlinkLED.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
bool BlinkLED::isPaused () const [inline]
+
+
+ +

Returns true if the LED blink cycle is paused; false otherwise.

+
See also:
pause(), resume()
+ +

Definition at line 44 of file BlinkLED.h.

+ +
+
+ +
+
+ + + + + + + +
void BlinkLED::loop ()
+
+
+

Perform a single iteration of the blink loop for this LED.

+ +

Definition at line 79 of file BlinkLED.cpp.

+ +
+
+ +
+
+ + + + + + + +
unsigned long BlinkLED::offTime () const [inline]
+
+
+ +

Returns the number of milliseconds the LED will be off.

+
See also:
onTime(), setBlinkRate()
+ +

Definition at line 36 of file BlinkLED.h.

+ +
+
+ +
+
+ + + + + + + +
unsigned long BlinkLED::onTime () const [inline]
+
+
+ +

Returns the number of milliseconds the LED will be on.

+
See also:
offTime(), setBlinkRate()
+ +

Definition at line 35 of file BlinkLED.h.

+ +
+
+ +
+
+ + + + + + + +
void BlinkLED::pause () [inline]
+
+
+ +

Pauses the LED blink cycle in its current state().

+
See also:
resume(), isPaused()
+ +

Definition at line 42 of file BlinkLED.h.

+ +
+
+ +
+
+ + + + + + + +
void BlinkLED::resume ()
+
+
+ +

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.

+
See also:
pause(), isPaused()
+ +

Definition at line 170 of file BlinkLED.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void BlinkLED::setBlinkRate (unsigned long onTime,
unsigned long offTime 
)
+
+
+ +

Sets the onTime and 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().

+
See also:
onTime(), offTime()
+ +

Definition at line 122 of file BlinkLED.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void BlinkLED::setState (bool state)
+
+
+ +

Sets the current state of the LED, where true is on, false is off.

+

If the LED is already set to state, then it will complete its current cycle of onTime() or offTime(). Otherwise the LED is immediately set to state and a new cycle begins.

+
See also:
state()
+ +

Definition at line 145 of file BlinkLED.cpp.

+ +
+
+ +
+
+ + + + + + + +
bool BlinkLED::state () const [inline]
+
+
+ +

Returns the current state of the LED; true is on, false is off.

+
See also:
setState()
+ +

Definition at line 39 of file BlinkLED.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classBoolField-members.html b/classBoolField-members.html new file mode 100644 index 00000000..67bd58f3 --- /dev/null +++ b/classBoolField-members.html @@ -0,0 +1,107 @@ + + + + +ArduinoLibs: Member List + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
BoolField Member List
+
+
+This is the complete list of members for BoolField, including all inherited members. + + + + + + + + + + + + + + + + + + + + +
BoolField(const String &label)BoolField [explicit]
BoolField(Form &form, const String &label, const String &trueLabel, const String &falseLabel, bool value)BoolField
dispatch(int event)BoolField [virtual]
enterField(bool reverse)BoolField [virtual]
exitField()Field [virtual]
falseLabel() const BoolField [inline]
Field(const String &label)Field [explicit]
Field(Form &form, const String &label)Field
form() const Field [inline]
isCurrent() const Field
label() const Field [inline]
lcd() const Field [inline, protected]
setFalseLabel(const String &falseLabel)BoolField
setLabel(const String &label)Field
setTrueLabel(const String &trueLabel)BoolField
setValue(bool value)BoolField
trueLabel() const BoolField [inline]
updateCursor()Field [protected, virtual]
value() const BoolField [inline]
~Field()Field
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classBoolField.html b/classBoolField.html new file mode 100644 index 00000000..e8caedcd --- /dev/null +++ b/classBoolField.html @@ -0,0 +1,417 @@ + + + + +ArduinoLibs: BoolField Class Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+ +
+
BoolField Class Reference
+
+
+ +

Field that manages the input of a boolean value. + More...

+ +

#include <BoolField.h>

+
+Inheritance diagram for BoolField:
+
+
+ + +Field + +
+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 BoolField (const String &label)
 Constructs a new boolean field with a specific label.
 BoolField (Form &form, const String &label, const String &trueLabel, const String &falseLabel, bool value)
 Constructs a new boolean field with a specific label and attaches it to a form.
int dispatch (int event)
 Dispatches event via this field.
void enterField (bool reverse)
 Enters the field due to form navigation.
bool value () const
 Returns the current value of this field, true or false.
void setValue (bool value)
 Sets the current value of this field to value.
const String & trueLabel () const
 Returns the string that is displayed when value() is true.
void setTrueLabel (const String &trueLabel)
 Sets the string that is displayed when value() is true to trueLabel.
const String & falseLabel () const
 Returns the string that is displayed when value() is false.
void setFalseLabel (const String &falseLabel)
 Sets the string that is displayed when value() is false to falseLabel.
+

Detailed Description

+

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.

+
 Form mainForm(lcd);
+ BoolField ledField(mainForm, "Status LED", "On", "Off", true);
+
+FormBool.png +
+

To actually toggle the LED, the application's main loop() function should contain the following 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);
+     }
+ }
+

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.

+
See also:
Field, ListField, TextField
+ +

Definition at line 28 of file BoolField.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + +
BoolField::BoolField (const String & label) [explicit]
+
+
+ +

Constructs a new boolean field with a specific 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.

+
See also:
Form::addField()
+ +

Definition at line 77 of file BoolField.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
BoolField::BoolField (Formform,
const String & label,
const String & trueLabel,
const String & falseLabel,
bool value 
)
+
+
+ +

Constructs a new boolean field with a specific label and attaches it to a form.

+

The initial value() of the field is set to the parameter value. When value() is true, trueLabel will be displayed on the screen. When value() is false, falseLabel will be displayed on the screen.

+
See also:
value()
+ +

Definition at line 94 of file BoolField.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
int BoolField::dispatch (int event) [virtual]
+
+
+ +

Dispatches event via this field.

+

The event is usually obtained from LCD::getButton().

+

Returns zero if the event has been handled and no further action is required.

+

Returns FORM_CHANGED if the 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 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.

+
See also:
Form::dispatch(), LCD::getButton()
+ +

Reimplemented from Field.

+ +

Definition at line 103 of file BoolField.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void BoolField::enterField (bool reverse) [virtual]
+
+
+ +

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 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().

+
See also:
exitField()
+ +

Reimplemented from Field.

+ +

Definition at line 113 of file BoolField.cpp.

+ +
+
+ +
+
+ + + + + + + +
const String & BoolField::falseLabel () const [inline]
+
+
+ +

Returns the string that is displayed when value() is false.

+
See also:
setFalseLabel(), trueLabel()
+ +

Definition at line 43 of file BoolField.h.

+ +
+
+ +
+
+ + + + + + + + +
void BoolField::setFalseLabel (const String & falseLabel)
+
+
+ +

Sets the string that is displayed when value() is false to falseLabel.

+
See also:
falseLabel(), setTrueLabel()
+ +

Definition at line 173 of file BoolField.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void BoolField::setTrueLabel (const String & trueLabel)
+
+
+ +

Sets the string that is displayed when value() is true to trueLabel.

+
See also:
trueLabel(), setFalseLabel()
+ +

Definition at line 153 of file BoolField.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void BoolField::setValue (bool value)
+
+
+ +

Sets the current value of this field to value.

+
See also:
value()
+ +

Definition at line 131 of file BoolField.cpp.

+ +
+
+ +
+
+ + + + + + + +
const String & BoolField::trueLabel () const [inline]
+
+
+ +

Returns the string that is displayed when value() is true.

+
See also:
setTrueLabel(), falseLabel()
+ +

Definition at line 40 of file BoolField.h.

+ +
+
+ +
+
+ + + + + + + +
bool BoolField::value () const [inline]
+
+
+ +

Returns the current value of this field, true or false.

+
See also:
setValue()
+ +

Definition at line 37 of file BoolField.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classBoolField.png b/classBoolField.png new file mode 100644 index 00000000..cbe86e17 Binary files /dev/null and b/classBoolField.png differ diff --git a/classChaseLEDs-members.html b/classChaseLEDs-members.html new file mode 100644 index 00000000..3981a25e --- /dev/null +++ b/classChaseLEDs-members.html @@ -0,0 +1,93 @@ + + + + +ArduinoLibs: Member List + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
ChaseLEDs Member List
+
+
+This is the complete list of members for ChaseLEDs, including all inherited members. + + + + + + +
advance(uint8_t prevPin, uint8_t nextPin)ChaseLEDs [protected, virtual]
advanceTime() const ChaseLEDs [inline]
ChaseLEDs(const uint8_t *pins, int num, unsigned long advanceTime)ChaseLEDs
loop()ChaseLEDs
previousPin(int n) const ChaseLEDs [inline, protected]
setAdvanceTime(unsigned long advanceTime)ChaseLEDs [inline]
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classChaseLEDs.html b/classChaseLEDs.html new file mode 100644 index 00000000..4d06656f --- /dev/null +++ b/classChaseLEDs.html @@ -0,0 +1,311 @@ + + + + +ArduinoLibs: ChaseLEDs Class Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+ +
+
ChaseLEDs Class Reference
+
+
+ +

Chase LED's on output pins in a defined sequence. + More...

+ +

#include <ChaseLEDs.h>

+ +

List of all members.

+ + + + + + + + + + + + + + +

+Public Member Functions

 ChaseLEDs (const uint8_t *pins, int num, unsigned long advanceTime)
 Initializes the LED chaser.
void loop ()
unsigned long advanceTime () const
 Returns the number of milliseconds that each LED will be lit in the chase sequence.
void setAdvanceTime (unsigned long advanceTime)
 Sets the number of milliseconds to advance between LED's to advanceTime.

+Protected Member Functions

virtual void advance (uint8_t prevPin, uint8_t nextPin)
 Advances to the next LED in sequence, turning off prevPin, and turning on nextPin.
uint8_t previousPin (int n) const
 Returns the pin that is n steps back in the sequence.
+

Detailed Description

+

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:

+
 uint8_t pins[] = {3, 5, 6, 9, 10, 11};
+ ChaseLEDs chaser(pins, sizeof(pins), 150);
+
+ void loop() {
+     chaser.loop();
+ }
+

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:

+
 uint8_t pins[] = {3, 5, 6, 9, 10, 11, 10, 9, 6, 5};
+ ChaseLEDs chaser(pins, sizeof(pins), 150);
+

See the Cylon example for more information on how to use the ChaseLEDs class in a practical application.

+ +

Definition at line 28 of file ChaseLEDs.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
ChaseLEDs::ChaseLEDs (const uint8_t * pins,
int num,
unsigned long advanceTime 
)
+
+
+ +

Initializes the LED chaser.

+

The chase sequence consists of num pins, whose names are given by the pins array. Each LED is lit for 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().

+
See also:
loop()
+ +

Definition at line 71 of file ChaseLEDs.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
void ChaseLEDs::advance (uint8_t prevPin,
uint8_t nextPin 
) [protected, virtual]
+
+
+ +

Advances to the next LED in sequence, turning off prevPin, and turning on nextPin.

+

The default implementation is equivalent to the following code:

+
 digitalWrite(prevPin, LOW);
+ digitalWrite(nextPin, HIGH);
+

This method may be overridden in subclasses to provide special effects. See the documentation for previousPin() for some example effects.

+
See also:
previousPin()
+ +

Definition at line 136 of file ChaseLEDs.cpp.

+ +
+
+ +
+
+ + + + + + + +
unsigned long ChaseLEDs::advanceTime () const [inline]
+
+
+ +

Returns the number of milliseconds that each LED will be lit in the chase sequence.

+
See also:
setAdvanceTime(), advance()
+ +

Definition at line 35 of file ChaseLEDs.h.

+ +
+
+ +
+
+ + + + + + + +
void ChaseLEDs::loop ()
+
+
+

Perform a single iteration of the control loop for this LED chaser.

+ +

Definition at line 87 of file ChaseLEDs.cpp.

+ +
+
+ +
+
+ + + + + + + + +
uint8_t ChaseLEDs::previousPin (int n) const [inline, protected]
+
+
+ +

Returns the pin that is n steps back in the sequence.

+

If n is zero, then the current pin is returned; if 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:

+
 void DoubleChaser::advance(uint8_t prevPin, uint8_t nextPin)
+ {
+      digitalWrite(previousPin(2), LOW);
+      digitalWrite(prevPin, HIGH);
+      digitalWrite(nextPin, HIGH);
+ }
+

As another exmaple, the following code uses PWM outputs to fade out the previous pin rather than turn it off immediately:

+
 void FadingChaser::advance(uint8_t prevPin, uint8_t nextPin)
+ {
+      digitalWrite(previousPin(2), LOW);
+      analogWrite(prevPin, 32);
+      digitalWrite(nextPin, HIGH);
+ }
+

Note: it is possible to retrieve the following pin in sequence using previousPin(-1). This could be used to fade in the LED that follows nextPin.

+
See also:
advance()
+ +

Definition at line 40 of file ChaseLEDs.h.

+ +
+
+ +
+
+ + + + + + + + +
void ChaseLEDs::setAdvanceTime (unsigned long advanceTime) [inline]
+
+
+ +

Sets the number of milliseconds to advance between LED's to advanceTime.

+
See also:
advanceTime(), advance()
+ +

Definition at line 36 of file ChaseLEDs.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classDS1307RTC-members.html b/classDS1307RTC-members.html new file mode 100644 index 00000000..24611538 --- /dev/null +++ b/classDS1307RTC-members.html @@ -0,0 +1,108 @@ + + + + +ArduinoLibs: Member List + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
DS1307RTC Member List
+
+
+This is the complete list of members for DS1307RTC, including all inherited members. + + + + + + + + + + + + + + + + + + + + + +
adjustDays(RTCDate *date, uint8_t flags)RTC [static]
adjustMonths(RTCDate *date, uint8_t flags)RTC [static]
adjustYears(RTCDate *date, uint8_t flags)RTC [static]
ALARM_COUNTRTC [static]
byteCount() const DS1307RTC [virtual]
DECREMENTRTC [static]
DS1307RTC(I2CMaster &bus, uint8_t oneHzPin=255)DS1307RTC
hasUpdates()DS1307RTC [virtual]
INCREMENTRTC [static]
isRealTime() const DS1307RTC [inline]
readAlarm(uint8_t alarmNum, RTCAlarm *value)DS1307RTC [virtual]
readByte(uint8_t offset)DS1307RTC [virtual]
readDate(RTCDate *value)DS1307RTC [virtual]
readTime(RTCTime *value)DS1307RTC [virtual]
RTC()RTC
WRAPRTC [static]
writeAlarm(uint8_t alarmNum, const RTCAlarm *value)DS1307RTC [virtual]
writeByte(uint8_t offset, uint8_t value)DS1307RTC [virtual]
writeDate(const RTCDate *value)DS1307RTC [virtual]
writeTime(const RTCTime *value)DS1307RTC [virtual]
~RTC() (defined in RTC)RTC
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classDS1307RTC.html b/classDS1307RTC.html new file mode 100644 index 00000000..50ca62c3 --- /dev/null +++ b/classDS1307RTC.html @@ -0,0 +1,456 @@ + + + + +ArduinoLibs: DS1307RTC Class Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+ +
+
DS1307RTC Class Reference
+
+
+ +

Communicates with a DS1307 realtime clock chip via I2C. + More...

+ +

#include <DS1307RTC.h>

+
+Inheritance diagram for DS1307RTC:
+
+
+ + +RTC + +
+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 DS1307RTC (I2CMaster &bus, uint8_t oneHzPin=255)
 Attaches to a realtime clock slave device on bus.
+bool isRealTime () const
 Returns true if the realtime clock is on the I2C bus; false if the time and date are simulated.
bool hasUpdates ()
 Returns true if the realtime clock has updated since the last call to this function.
void readTime (RTCTime *value)
 Reads the current time from the realtime clock into value.
void readDate (RTCDate *value)
 Reads the current date from the realtime clock into value.
void writeTime (const RTCTime *value)
 Updates the time in the realtime clock to match value.
void writeDate (const RTCDate *value)
 Updates the date in the realtime clock to match value.
void readAlarm (uint8_t alarmNum, RTCAlarm *value)
 Reads the details of the alarm with index alarmNum into value.
void writeAlarm (uint8_t alarmNum, const RTCAlarm *value)
 Updates the details of the alarm with index alarmNum from value.
int byteCount () const
 Returns the number of bytes of non-volatile memory that can be used for storage of arbitrary settings, excluding storage used by alarms.
uint8_t readByte (uint8_t offset)
 Reads the byte at offset within the realtime clock's non-volatile memory.
void writeByte (uint8_t offset, uint8_t value)
 Writes value to offset within the realtime clock's non-volatile memory.
+

Detailed Description

+

Communicates with a DS1307 realtime clock chip via I2C.

+

This class simplifies the process of reading and writing the time and date information in a DS1307 realtime clock chip. The class also provides support for reading and writing information about alarms and other clock settings.

+

If there is no DS1307 chip on the I2C bus, this class will fall back to the RTC class to simulate the current time and date based on the value of millis().

+

The DS1307 uses a 2-digit year so this class is limited to dates between 2000 and 2099 inclusive.

+

Note: if this class has not been used with the DS1307 chip before, then the contents of NVRAM will be cleared. Any previous contents will be lost.

+
See also:
RTC, DS3232RTC
+ +

Definition at line 30 of file DS1307RTC.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
DS1307RTC::DS1307RTC (I2CMasterbus,
uint8_t oneHzPin = 255 
)
+
+
+ +

Attaches to a realtime clock slave device on bus.

+

If oneHzPin is not 255, then it indicates a digital input pin that is connected to the 1 Hz square wave output on the realtime clock. This input is used by hasUpdates() to determine if the time information has changed in a non-trivial manner.

+
See also:
hasUpdates()
+ +

Definition at line 83 of file DS1307RTC.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
int DS1307RTC::byteCount () const [virtual]
+
+
+ +

Returns the number of bytes of non-volatile memory that can be used for storage of arbitrary settings, excluding storage used by alarms.

+
See also:
readByte(), writeByte()
+ +

Reimplemented from RTC.

+ +

Definition at line 264 of file DS1307RTC.cpp.

+ +
+
+ +
+
+ + + + + + + +
bool DS1307RTC::hasUpdates () [virtual]
+
+
+ +

Returns true if the realtime clock has updated since the last call to this function.

+

The default implementation returns true, indicating that an update is always available to be read.

+ +

Reimplemented from RTC.

+ +

Definition at line 118 of file DS1307RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void DS1307RTC::readAlarm (uint8_t alarmNum,
RTCAlarmvalue 
) [virtual]
+
+
+ +

Reads the details of the alarm with index alarmNum into value.

+

The alarmNum parameter must be between 0 and ALARM_COUNT - 1.

+

Alarm details are stored at the end of the realtime clock's non-volatile memory.

+
See also:
writeAlarm(), alarmCount()
+ +

Reimplemented from RTC.

+ +

Definition at line 230 of file DS1307RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + +
uint8_t DS1307RTC::readByte (uint8_t offset) [virtual]
+
+
+ +

Reads the byte at offset within the realtime clock's non-volatile memory.

+

The offset parameter must be between 0 and byteCount() - 1.

+
See also:
writeByte(), byteCount()
+ +

Reimplemented from RTC.

+ +

Definition at line 269 of file DS1307RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void DS1307RTC::readDate (RTCDatevalue) [virtual]
+
+
+ +

Reads the current date from the realtime clock into value.

+

The time should be read first with readTime() as the default implementation only advances the date when the time is read and it crosses midnight.

+
See also:
writeDate(), readTime()
+ +

Reimplemented from RTC.

+ +

Definition at line 177 of file DS1307RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void DS1307RTC::readTime (RTCTimevalue) [virtual]
+
+
+ +

Reads the current time from the realtime clock into value.

+
See also:
writeTime(), readDate()
+ +

Reimplemented from RTC.

+ +

Definition at line 157 of file DS1307RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void DS1307RTC::writeAlarm (uint8_t alarmNum,
const RTCAlarmvalue 
) [virtual]
+
+
+ +

Updates the details of the alarm with index alarmNum from value.

+

The alarmNum parameter must be between 0 and ALARM_COUNT - 1.

+

Alarm details are stored at the end of the realtime clock's non-volatile memory.

+
See also:
readAlarm(), alarmCount()
+ +

Reimplemented from RTC.

+ +

Definition at line 250 of file DS1307RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void DS1307RTC::writeByte (uint8_t offset,
uint8_t value 
) [virtual]
+
+
+ +

Writes value to offset within the realtime clock's non-volatile memory.

+

The offset parameter must be between 0 and byteCount() - 1.

+
See also:
readByte(), byteCount()
+ +

Reimplemented from RTC.

+ +

Definition at line 277 of file DS1307RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void DS1307RTC::writeDate (const RTCDatevalue) [virtual]
+
+
+ +

Updates the date in the realtime clock to match value.

+
See also:
readDate(), writeTime()
+ +

Reimplemented from RTC.

+ +

Definition at line 216 of file DS1307RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void DS1307RTC::writeTime (const RTCTimevalue) [virtual]
+
+
+ +

Updates the time in the realtime clock to match value.

+
See also:
readTime(), writeDate()
+ +

Reimplemented from RTC.

+ +

Definition at line 202 of file DS1307RTC.cpp.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classDS1307RTC.png b/classDS1307RTC.png new file mode 100644 index 00000000..20719b8f Binary files /dev/null and b/classDS1307RTC.png differ diff --git a/classDS3232RTC-members.html b/classDS3232RTC-members.html new file mode 100644 index 00000000..9065527a --- /dev/null +++ b/classDS3232RTC-members.html @@ -0,0 +1,113 @@ + + + + +ArduinoLibs: Member List + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
DS3232RTC Member List
+
+
+This is the complete list of members for DS3232RTC, including all inherited members. + + + + + + + + + + + + + + + + + + + + + + + + + + +
adjustDays(RTCDate *date, uint8_t flags)RTC [static]
adjustMonths(RTCDate *date, uint8_t flags)RTC [static]
adjustYears(RTCDate *date, uint8_t flags)RTC [static]
ALARM_COUNTRTC [static]
byteCount() const DS3232RTC [virtual]
DECREMENTRTC [static]
disable32kHzOutput()DS3232RTC
disableAlarmInterrupts()DS3232RTC
DS3232RTC(I2CMaster &bus, uint8_t oneHzPin=255)DS3232RTC
enable32kHzOutput()DS3232RTC
enableAlarmInterrupts()DS3232RTC
firedAlarm()DS3232RTC
hasUpdates()DS3232RTC [virtual]
INCREMENTRTC [static]
isRealTime() const DS3232RTC [inline]
readAlarm(uint8_t alarmNum, RTCAlarm *value)DS3232RTC [virtual]
readByte(uint8_t offset)DS3232RTC [virtual]
readDate(RTCDate *value)DS3232RTC [virtual]
readTime(RTCTime *value)DS3232RTC [virtual]
RTC()RTC
WRAPRTC [static]
writeAlarm(uint8_t alarmNum, const RTCAlarm *value)DS3232RTC [virtual]
writeByte(uint8_t offset, uint8_t value)DS3232RTC [virtual]
writeDate(const RTCDate *value)DS3232RTC [virtual]
writeTime(const RTCTime *value)DS3232RTC [virtual]
~RTC() (defined in RTC)RTC
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classDS3232RTC.html b/classDS3232RTC.html new file mode 100644 index 00000000..5ba20b25 --- /dev/null +++ b/classDS3232RTC.html @@ -0,0 +1,578 @@ + + + + +ArduinoLibs: DS3232RTC Class Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+ +
+
DS3232RTC Class Reference
+
+
+ +

Communicates with a DS3232 realtime clock chip via I2C. + More...

+ +

#include <DS3232RTC.h>

+
+Inheritance diagram for DS3232RTC:
+
+
+ + +RTC + +
+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 DS3232RTC (I2CMaster &bus, uint8_t oneHzPin=255)
 Attaches to a realtime clock slave device on bus.
+bool isRealTime () const
 Returns true if the realtime clock is on the I2C bus; false if the time and date are simulated.
bool hasUpdates ()
 Returns true if the realtime clock has updated since the last call to this function.
void readTime (RTCTime *value)
 Reads the current time from the realtime clock into value.
void readDate (RTCDate *value)
 Reads the current date from the realtime clock into value.
void writeTime (const RTCTime *value)
 Updates the time in the realtime clock to match value.
void writeDate (const RTCDate *value)
 Updates the date in the realtime clock to match value.
void readAlarm (uint8_t alarmNum, RTCAlarm *value)
 Reads the details of the alarm with index alarmNum into value.
void writeAlarm (uint8_t alarmNum, const RTCAlarm *value)
 Updates the details of the alarm with index alarmNum from value.
int byteCount () const
 Returns the number of bytes of non-volatile memory that can be used for storage of arbitrary settings, excluding storage used by alarms.
uint8_t readByte (uint8_t offset)
 Reads the byte at offset within the realtime clock's non-volatile memory.
void writeByte (uint8_t offset, uint8_t value)
 Writes value to offset within the realtime clock's non-volatile memory.
void enableAlarmInterrupts ()
 Enables the generation of interrupts for alarms 0 and 1.
void disableAlarmInterrupts ()
 Disables the generation of interrupts for alarms 0 and 1.
int firedAlarm ()
 Determines which of alarms 0 or 1 have fired since the last call.
void enable32kHzOutput ()
 Enables the 32 kHz output on the DS3232 chip.
void disable32kHzOutput ()
 Disables the 32 kHz output on the DS3232 chip.
+

Detailed Description

+

Communicates with a DS3232 realtime clock chip via I2C.

+

This class simplifies the process of reading and writing the time and date information in a DS3232 realtime clock chip. The class also provides support for reading and writing information about alarms and other clock settings.

+

If there is no DS3232 chip on the I2C bus, this class will fall back to the RTC class to simulate the current time and date based on the value of millis().

+

Alarms 0 and 1 can be set to generate an interrupt when they fire using enableAlarmInterrupts(). The firedAlarm() function can be used to determine which alarm has fired. Alarms 2 and 3 cannot be monitored with interrupts.

+

The DS3232 uses a 2-digit year so this class is limited to dates between 2000 and 2099 inclusive.

+

Note: if this class has not been used with the DS3232 chip before, then the contents of NVRAM will be cleared. Any previous contents will be lost.

+
See also:
RTC, DS1307RTC
+ +

Definition at line 30 of file DS3232RTC.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
DS3232RTC::DS3232RTC (I2CMasterbus,
uint8_t oneHzPin = 255 
)
+
+
+ +

Attaches to a realtime clock slave device on bus.

+

If oneHzPin is not 255, then it indicates a digital input pin that is connected to the 1 Hz square wave output on the realtime clock. This input is used by hasUpdates() to determine if the time information has changed in a non-trivial manner.

+

If you wish to use enableAlarmInterrupts(), then oneHzPin must be 255.

+
See also:
hasUpdates(), enableAlarmInterrupts()
+ +

Definition at line 126 of file DS3232RTC.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
int DS3232RTC::byteCount () const [virtual]
+
+
+ +

Returns the number of bytes of non-volatile memory that can be used for storage of arbitrary settings, excluding storage used by alarms.

+
See also:
readByte(), writeByte()
+ +

Reimplemented from RTC.

+ +

Definition at line 335 of file DS3232RTC.cpp.

+ +
+
+ +
+
+ + + + + + + +
void DS3232RTC::disable32kHzOutput ()
+
+
+ +

Disables the 32 kHz output on the DS3232 chip.

+
See also:
enable32kHzOutput()
+ +

Definition at line 448 of file DS3232RTC.cpp.

+ +
+
+ +
+
+ + + + + + + +
void DS3232RTC::disableAlarmInterrupts ()
+
+
+ +

Disables the generation of interrupts for alarms 0 and 1.

+
See also:
enableAlarmInterrupts()
+ +

Definition at line 383 of file DS3232RTC.cpp.

+ +
+
+ +
+
+ + + + + + + +
void DS3232RTC::enable32kHzOutput ()
+
+
+ +

Enables the 32 kHz output on the DS3232 chip.

+
See also:
disable32kHzOutput()
+ +

Definition at line 434 of file DS3232RTC.cpp.

+ +
+
+ +
+
+ + + + + + + +
void DS3232RTC::enableAlarmInterrupts ()
+
+
+ +

Enables the generation of interrupts for alarms 0 and 1.

+

When the interrupt occurs, use firedAlarm() to determine which alarm has fired. The application is responsible for implementing the interrupt service routine to watch for the interrupt.

+

Note: this function does nothing if the 1 Hz pin was enabled in the constructor, but firedAlarm() can still be used to determine which alarm has fired when hasUpdates() reports that there is an update available.

+
See also:
disableAlarmInterrupts(), firedAlarm()
+ +

Definition at line 370 of file DS3232RTC.cpp.

+ +
+
+ +
+
+ + + + + + + +
int DS3232RTC::firedAlarm ()
+
+
+ +

Determines which of alarms 0 or 1 have fired since the last call.

+

Returns 0 if alarm 0 has fired, 1 if alarm 1 has fired, 2 if both alarms have fired, or -1 if neither alarm has fired.

+

The fired alarm state will be cleared, ready for the next call.

+

This function cannot be used to determine if alarms 2 or 3 have fired as they are stored in NVRAM and are not handled specially by the DS3232.

+
See also:
enableAlarmInterrupts()
+ +

Definition at line 406 of file DS3232RTC.cpp.

+ +
+
+ +
+
+ + + + + + + +
bool DS3232RTC::hasUpdates () [virtual]
+
+
+ +

Returns true if the realtime clock has updated since the last call to this function.

+

The default implementation returns true, indicating that an update is always available to be read.

+ +

Reimplemented from RTC.

+ +

Definition at line 166 of file DS3232RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void DS3232RTC::readAlarm (uint8_t alarmNum,
RTCAlarmvalue 
) [virtual]
+
+
+ +

Reads the details of the alarm with index alarmNum into value.

+

The alarmNum parameter must be between 0 and ALARM_COUNT - 1.

+

Alarm details are stored at the end of the realtime clock's non-volatile memory.

+
See also:
writeAlarm(), alarmCount()
+ +

Reimplemented from RTC.

+ +

Definition at line 278 of file DS3232RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + +
uint8_t DS3232RTC::readByte (uint8_t offset) [virtual]
+
+
+ +

Reads the byte at offset within the realtime clock's non-volatile memory.

+

The offset parameter must be between 0 and byteCount() - 1.

+
See also:
writeByte(), byteCount()
+ +

Reimplemented from RTC.

+ +

Definition at line 340 of file DS3232RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void DS3232RTC::readDate (RTCDatevalue) [virtual]
+
+
+ +

Reads the current date from the realtime clock into value.

+

The time should be read first with readTime() as the default implementation only advances the date when the time is read and it crosses midnight.

+
See also:
writeDate(), readTime()
+ +

Reimplemented from RTC.

+ +

Definition at line 225 of file DS3232RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void DS3232RTC::readTime (RTCTimevalue) [virtual]
+
+
+ +

Reads the current time from the realtime clock into value.

+
See also:
writeTime(), readDate()
+ +

Reimplemented from RTC.

+ +

Definition at line 205 of file DS3232RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void DS3232RTC::writeAlarm (uint8_t alarmNum,
const RTCAlarmvalue 
) [virtual]
+
+
+ +

Updates the details of the alarm with index alarmNum from value.

+

The alarmNum parameter must be between 0 and ALARM_COUNT - 1.

+

Alarm details are stored at the end of the realtime clock's non-volatile memory.

+
See also:
readAlarm(), alarmCount()
+ +

Reimplemented from RTC.

+ +

Definition at line 298 of file DS3232RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void DS3232RTC::writeByte (uint8_t offset,
uint8_t value 
) [virtual]
+
+
+ +

Writes value to offset within the realtime clock's non-volatile memory.

+

The offset parameter must be between 0 and byteCount() - 1.

+
See also:
readByte(), byteCount()
+ +

Reimplemented from RTC.

+ +

Definition at line 348 of file DS3232RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void DS3232RTC::writeDate (const RTCDatevalue) [virtual]
+
+
+ +

Updates the date in the realtime clock to match value.

+
See also:
readDate(), writeTime()
+ +

Reimplemented from RTC.

+ +

Definition at line 264 of file DS3232RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void DS3232RTC::writeTime (const RTCTimevalue) [virtual]
+
+
+ +

Updates the time in the realtime clock to match value.

+
See also:
readTime(), writeDate()
+ +

Reimplemented from RTC.

+ +

Definition at line 250 of file DS3232RTC.cpp.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classDS3232RTC.png b/classDS3232RTC.png new file mode 100644 index 00000000..b6676206 Binary files /dev/null and b/classDS3232RTC.png differ diff --git a/classField-members.html b/classField-members.html new file mode 100644 index 00000000..5d357160 --- /dev/null +++ b/classField-members.html @@ -0,0 +1,100 @@ + + + + +ArduinoLibs: Member List + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
Field Member List
+
+
+This is the complete list of members for Field, including all inherited members. + + + + + + + + + + + + + +
dispatch(int event)Field [virtual]
enterField(bool reverse)Field [virtual]
exitField()Field [virtual]
Field(const String &label)Field [explicit]
Field(Form &form, const String &label)Field
form() const Field [inline]
Form (defined in Field)Field [friend]
isCurrent() const Field
label() const Field [inline]
lcd() const Field [inline, protected]
setLabel(const String &label)Field
updateCursor()Field [protected, virtual]
~Field()Field
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classField.html b/classField.html new file mode 100644 index 00000000..1ac60659 --- /dev/null +++ b/classField.html @@ -0,0 +1,367 @@ + + + + +ArduinoLibs: Field Class Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+ +
+
Field Class Reference
+
+
+ +

Manages a single data input/output field within a Form. + More...

+ +

#include <Field.h>

+
+Inheritance diagram for Field:
+
+
+ + +BoolField +IntField +ListField +TextField +TimeField + +
+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Field (const String &label)
 Constructs a new field with a specific label.
Field (Form &form, const String &label)
 Constructs a new field with a specific label and attaches it to a form.
 ~Field ()
 Destroys this field and removes it from its owning Form.
+Formform () const
 Returns the Form that owns this field; null if not associated with a Form.
virtual int dispatch (int event)
 Dispatches event via this field.
virtual void enterField (bool reverse)
 Enters the field due to form navigation.
virtual void exitField ()
 Exits the field due to form navigation.
const String & label () const
 Returns the label to display in the first line of this field.
void setLabel (const String &label)
 Sets the label to display in the first line of this field.
bool isCurrent () const
 Returns true if this field is the currently-displayed field in its owning form; false otherwise.

+Protected Member Functions

+LiquidCrystal * lcd () const
 Returns the LCD that this field is being drawn on.
virtual void updateCursor ()
 Updates the cursor position after the label has been drawn by setLabel().

+Friends

+class Form
+

Detailed Description

+

Manages a single data input/output field within a Form.

+
See also:
Form, BoolField, IntField, ListField, TextField, TimeField
+ +

Definition at line 28 of file Field.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + +
Field::Field (const String & label) [explicit]
+
+
+ +

Constructs a new field with a specific label.

+

The field is initially not associated with a Form. The field can be added to a form later using Form::addField().

+
See also:
Form::addField()
+ +

Definition at line 40 of file Field.cpp.

+ +
+
+ +
+
+ + + + + + + +
Field::~Field ()
+
+
+ +

Destroys this field and removes it from its owning Form.

+
See also:
Form::removeField()
+ +

Definition at line 66 of file Field.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
int Field::dispatch (int event) [virtual]
+
+
+ +

Dispatches event via this field.

+

The event is usually obtained from LCD::getButton().

+

Returns zero if the event has been handled and no further action is required.

+

Returns FORM_CHANGED if the 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 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.

+
See also:
Form::dispatch(), LCD::getButton()
+ +

Reimplemented in BoolField, IntField, ListField, and TimeField.

+ +

Definition at line 96 of file Field.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void Field::enterField (bool reverse) [virtual]
+
+
+ +

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 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().

+
See also:
exitField()
+ +

Reimplemented in BoolField, IntField, ListField, TextField, and TimeField.

+ +

Definition at line 116 of file Field.cpp.

+ +
+
+ +
+
+ + + + + + + +
void Field::exitField () [virtual]
+
+
+ +

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.

+
See also:
enterField()
+ +

Reimplemented in TimeField.

+ +

Definition at line 129 of file Field.cpp.

+ +
+
+ +
+
+ + + + + + + +
bool Field::isCurrent () const
+
+
+ +

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.

+ +

Definition at line 169 of file Field.cpp.

+ +
+
+ +
+
+ + + + + + + +
const String & Field::label () const [inline]
+
+
+ +

Returns the label to display in the first line of this field.

+
See also:
setLabel()
+ +

Definition at line 41 of file Field.h.

+ +
+
+ +
+
+ + + + + + + + +
void Field::setLabel (const String & label)
+
+
+ +

Sets the label to display in the first line of this field.

+
See also:
label()
+ +

Definition at line 146 of file Field.cpp.

+ +
+
+ +
+
+ + + + + + + +
void Field::updateCursor () [protected, virtual]
+
+
+ +

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.

+
See also:
setLabel()
+ +

Definition at line 191 of file Field.cpp.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classField.png b/classField.png new file mode 100644 index 00000000..c4a747e5 Binary files /dev/null and b/classField.png differ diff --git a/classForm-members.html b/classForm-members.html new file mode 100644 index 00000000..7b4aa179 --- /dev/null +++ b/classForm-members.html @@ -0,0 +1,102 @@ + + + + +ArduinoLibs: Member List + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
Form Member List
+
+
+This is the complete list of members for Form, including all inherited members. + + + + + + + + + + + + + + + +
addField(Field *field)Form
currentField() const Form [inline]
defaultField()Form
dispatch(int event)Form
Field (defined in Form)Form [friend]
Form(LiquidCrystal &lcd)Form [explicit]
hide()Form
isCurrent(Field &field) const Form [inline]
isVisible() const Form [inline]
nextField()Form
prevField()Form
removeField(Field *field)Form
setCurrentField(Field *field)Form
show()Form
~Form()Form
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classForm.html b/classForm.html new file mode 100644 index 00000000..079aa743 --- /dev/null +++ b/classForm.html @@ -0,0 +1,447 @@ + + + + +ArduinoLibs: Form Class Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+ +
+
Form Class Reference
+
+
+ +

Manager for a form containing data input/output fields. + More...

+ +

#include <Form.h>

+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 Form (LiquidCrystal &lcd)
 Constructs a new form and associates it with lcd.
~Form ()
 Detaches all remaining fields and destroys this form.
int dispatch (int event)
 Dispatches event to the currently active field using Field::dispatch().
void nextField ()
 Changes to the next field in the "tab order".
void prevField ()
 Changes to the previous field in the "tab order".
void defaultField ()
 Changes to default field (i.e., the first field).
void addField (Field *field)
 Adds field to this form.
void removeField (Field *field)
 Removes field from this form.
FieldcurrentField () const
 Returns the current field that is displayed on-screen.
void setCurrentField (Field *field)
 Sets the current field that is displayed on-screen.
bool isCurrent (Field &field) const
 Returns true if field is currently displayed on-screen, false otherwise.
void show ()
 Shows the form, or does nothing if the form is already on-screen.
void hide ()
 Hides the form, or does nothing if the form is not on-screen.
bool isVisible () const
 Returns true if the form is shown; false if the form is hidden.

+Friends

+class Field
+

Detailed Description

+

Manager for a form containing data input/output fields.

+

See the Form example for more information on creating an application that uses forms and fields.

+ +

Definition at line 32 of file Form.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + +
Form::Form (LiquidCrystal & lcd) [explicit]
+
+
+ +

Constructs a new form and associates it with lcd.

+

This constructor is typically followed by calls to construct Field values for each of the fields on the form. For example:

+
 Form mainForm(lcd);
+ TextField welcomeField(mainForm, "Form example", "v1.0");
+
+FormText.png +
+ +

Definition at line 47 of file Form.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
void Form::addField (Fieldfield)
+
+
+ +

Adds field to this form.

+

Usually this function is not required because the field's constructor will add the field to the form automatically.

+
See also:
removeField()
+ +

Definition at line 165 of file Form.cpp.

+ +
+
+ +
+
+ + + + + + + +
Field * Form::currentField () const [inline]
+
+
+ +

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.

+
See also:
setCurrentField(), isCurrent()
+ +

Definition at line 46 of file Form.h.

+ +
+
+ +
+
+ + + + + + + +
void Form::defaultField ()
+
+
+ +

Changes to default field (i.e., the first field).

+
See also:
nextField(), prevField(), currentField()
+ +

Definition at line 152 of file Form.cpp.

+ +
+
+ +
+
+ + + + + + + + +
int Form::dispatch (int event)
+
+
+ +

Dispatches event to the currently active field using Field::dispatch().

+

The event is usually obtained from LCD::getButton().

+

Returns zero if the 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 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.

+
 int event = lcd.getButton();
+ if (mainForm.dispatch(event) == FORM_CHANGED) {
+     if (mainForm.isCurrent(volumeField)) {
+         // Adjust the volume to match the field.
+         setVolume(volumeField.value());
+     }
+ }
+

This function handles the Left and Right buttons to navigate between fields.

+
See also:
Field::dispatch(), LCD::getButton(), currentField(), isCurrent()
+ +

Definition at line 99 of file Form.cpp.

+ +
+
+ +
+
+ + + + + + + +
void Form::hide ()
+
+
+ +

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.

+
See also:
show(), isVisible()
+ +

Definition at line 293 of file Form.cpp.

+ +
+
+ +
+
+ + + + + + + + +
bool Form::isCurrent (Fieldfield) const [inline]
+
+
+ +

Returns true if field is currently displayed on-screen, false otherwise.

+

This function is typically called after dispatch() returns FORM_CHANGED to determine which field has changed.

+
See also:
currentField(), setCurrentField()
+ +

Definition at line 49 of file Form.h.

+ +
+
+ +
+
+ + + + + + + +
bool Form::isVisible () const [inline]
+
+
+ +

Returns true if the form is shown; false if the form is hidden.

+
See also:
show(), hide()
+ +

Definition at line 53 of file Form.h.

+ +
+
+ +
+
+ + + + + + + +
void Form::nextField ()
+
+
+ +

Changes to the next field in the "tab order".

+
See also:
prevField(), defaultField(), currentField()
+ +

Definition at line 118 of file Form.cpp.

+ +
+
+ +
+
+ + + + + + + +
void Form::prevField ()
+
+
+ +

Changes to the previous field in the "tab order".

+
See also:
nextField(), defaultField(), currentField()
+ +

Definition at line 135 of file Form.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void Form::removeField (Fieldfield)
+
+
+ +

Removes field from this form.

+

If field is the current field on-screen, then either the next or previous field will be made current.

+
See also:
addField()
+ +

Definition at line 187 of file Form.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void Form::setCurrentField (Fieldfield)
+
+
+ +

Sets the current field that is displayed on-screen.

+

Use this function to programmatically force the form to display a specific field on-screen.

+
See also:
currentField(), isCurrent()
+ +

Definition at line 230 of file Form.cpp.

+ +
+
+ +
+
+ + + + + + + +
void Form::show ()
+
+
+ +

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.

+
See also:
hide(), isVisible(), defaultField()
+ +

Definition at line 274 of file Form.cpp.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classI2CMaster-members.html b/classI2CMaster-members.html new file mode 100644 index 00000000..ca47f52c --- /dev/null +++ b/classI2CMaster-members.html @@ -0,0 +1,94 @@ + + + + +ArduinoLibs: Member List + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
I2CMaster Member List
+
+
+This is the complete list of members for I2CMaster, including all inherited members. + + + + + + + +
available()=0I2CMaster [pure virtual]
endWrite()=0I2CMaster [pure virtual]
maxTransferSize() const =0I2CMaster [pure virtual]
read()=0I2CMaster [pure virtual]
startRead(unsigned int address, unsigned int count)=0I2CMaster [pure virtual]
startWrite(unsigned int address)I2CMaster [virtual]
write(uint8_t value)=0I2CMaster [pure virtual]
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classI2CMaster.html b/classI2CMaster.html new file mode 100644 index 00000000..7d89ea79 --- /dev/null +++ b/classI2CMaster.html @@ -0,0 +1,276 @@ + + + + +ArduinoLibs: I2CMaster Class Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+ +
+
I2CMaster Class Reference
+
+
+ +

Abstract base class for I2C master implementations. + More...

+ +

#include <I2CMaster.h>

+
+Inheritance diagram for I2CMaster:
+
+
+ + +SoftI2C + +
+ +

List of all members.

+ + + + + + + + + + + + + + + + +

+Public Member Functions

+virtual unsigned int maxTransferSize () const =0
 Returns the maximum number of bytes that can be read or written in a single request by this bus master.
virtual void startWrite (unsigned int address)
 Starts a write operation by sending a start condition and the I2C control byte.
virtual void write (uint8_t value)=0
 Writes a single byte value on the I2C bus.
virtual bool endWrite ()=0
 Ends the current write operation.
virtual bool startRead (unsigned int address, unsigned int count)=0
 Starts a read operation for count bytes by sending the start condition and the I2C control byte.
virtual unsigned int available ()=0
 Returns the number of bytes that are still available for reading.
virtual uint8_t read ()=0
 Reads a single byte from the I2C bus.
+

Detailed Description

+

Abstract base class for I2C master implementations.

+
See also:
SoftI2C
+ +

Definition at line 28 of file I2CMaster.h.

+

Member Function Documentation

+ +
+
+ + + + + + + +
unsigned int I2CMaster::available () [pure virtual]
+
+
+ +

Returns the number of bytes that are still available for reading.

+
See also:
startRead(), read()
+ +

Implemented in SoftI2C.

+ +
+
+ +
+
+ + + + + + + +
bool I2CMaster::endWrite () [pure virtual]
+
+
+ +

Ends the current write operation.

+

Returns true if the write operation was acknowledged; false otherwise.

+
See also:
startWrite(), write()
+ +

Implemented in SoftI2C.

+ +
+
+ +
+
+ + + + + + + +
uint8_t I2CMaster::read () [pure virtual]
+
+
+ +

Reads a single byte from the I2C bus.

+
See also:
startRead(), available()
+ +

Implemented in SoftI2C.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
bool I2CMaster::startRead (unsigned int address,
unsigned int count 
) [pure virtual]
+
+
+ +

Starts a read operation for count bytes by sending the start condition and the I2C control byte.

+

The 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 count calls to read() to fetch the bytes.

+
See also:
available(), read(), startWrite()
+ +

Implemented in SoftI2C.

+ +
+
+ +
+
+ + + + + + + + +
void I2CMaster::startWrite (unsigned int address) [virtual]
+
+
+ +

Starts a write operation by sending a start condition and the I2C control byte.

+

The address must be the 7-bit or 10-bit address of the I2C slave on the bus.

+
See also:
write(), endWrite(), startRead()
+ +

Reimplemented in SoftI2C.

+ +
+
+ +
+
+ + + + + + + + +
void I2CMaster::write (uint8_t value) [pure virtual]
+
+
+ +

Writes a single byte value on the I2C bus.

+
See also:
startWrite(), endWrite()
+ +

Implemented in SoftI2C.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classI2CMaster.png b/classI2CMaster.png new file mode 100644 index 00000000..8d9b48bc Binary files /dev/null and b/classI2CMaster.png differ diff --git a/classIntField-members.html b/classIntField-members.html new file mode 100644 index 00000000..32a006de --- /dev/null +++ b/classIntField-members.html @@ -0,0 +1,112 @@ + + + + +ArduinoLibs: Member List + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
IntField Member List
+
+
+This is the complete list of members for IntField, including all inherited members. + + + + + + + + + + + + + + + + + + + + + + + + + +
dispatch(int event)IntField [virtual]
enterField(bool reverse)IntField [virtual]
exitField()Field [virtual]
Field(const String &label)Field [explicit]
Field(Form &form, const String &label)Field
form() const Field [inline]
IntField(const String &label)IntField [explicit]
IntField(Form &form, const String &label, int minValue, int maxValue, int stepValue, int value)IntField
IntField(Form &form, const String &label, int minValue, int maxValue, int stepValue, int value, const String &suffix)IntField
isCurrent() const Field
label() const Field [inline]
lcd() const Field [inline, protected]
maxValue() const IntField [inline]
minValue() const IntField [inline]
setLabel(const String &label)Field
setMaxValue(int value)IntField [inline]
setMinValue(int value)IntField [inline]
setStepValue(int value)IntField [inline]
setSuffix(const String &suffix)IntField
setValue(int value)IntField
stepValue() const IntField [inline]
suffix() const IntField [inline]
updateCursor()Field [protected, virtual]
value() const IntField [inline]
~Field()Field
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classIntField.html b/classIntField.html new file mode 100644 index 00000000..2b93461a --- /dev/null +++ b/classIntField.html @@ -0,0 +1,517 @@ + + + + +ArduinoLibs: IntField Class Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+ +
+
IntField Class Reference
+
+
+ +

Field that manages the input of an integer value. + More...

+ +

#include <IntField.h>

+
+Inheritance diagram for IntField:
+
+
+ + +Field + +
+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 IntField (const String &label)
 Constructs a new integer field with a specific label.
 IntField (Form &form, const String &label, int minValue, int maxValue, int stepValue, int value)
 Constructs a new integer field with a specific label, minValue, maxValue, stepValue, and value, and attaches it to a form.
IntField (Form &form, const String &label, int minValue, int maxValue, int stepValue, int value, const String &suffix)
 Constructs a new integer field with a specific label, minValue, maxValue, stepValue, value, and suffix and attaches it to a form.
int dispatch (int event)
 Dispatches event via this field.
void enterField (bool reverse)
 Enters the field due to form navigation.
int minValue () const
 Returns the minimum value for the input field.
void setMinValue (int value)
 Sets the minimum value for the input field.
int maxValue () const
 Returns the maximum value for the input field.
void setMaxValue (int value)
 Sets the maximum value for the input field.
int stepValue () const
 Returns the step value to use when increasing or decreasing the value() due to Up and Down button presses.
void setStepValue (int value)
 Sets the step value value to use when increasing or decreasing the value() due to Up and Down button presses.
int value () const
 Returns the current value of this field.
void setValue (int value)
 Sets the current value of this field.
const String & suffix () const
 Returns the suffix string to be displayed after the field's value.
void setSuffix (const String &suffix)
 Sets the suffix string to be displayed after the field's value.
+

Detailed Description

+

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:

+
 Form mainForm(lcd);
+ IntField iterField(mainForm, "Iterations", 1, 5, 1, 2);
+

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:

+
 IntField volumeField(mainForm, "Volume", 0, 100, 5, 85, "%");
+ IntField speedField(mainForm, "Speed", 0, 2000, 15, 450, " rpm");
+
+FormInt.png +
+

Use TextField for read-only fields that report integer values but which are not modifiable by the user.

+
See also:
Field, TextField
+ +

Definition at line 28 of file IntField.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + +
IntField::IntField (const String & label) [explicit]
+
+
+ +

Constructs a new integer field with a specific 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.

+
See also:
Form::addField()
+ +

Definition at line 71 of file IntField.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IntField::IntField (Formform,
const String & label,
int minValue,
int maxValue,
int stepValue,
int value 
)
+
+
+ +

Constructs a new integer field with a specific label, minValue, maxValue, stepValue, and value, and attaches it to a form.

+

The suffix() is initially set to an empty string.

+ +

Definition at line 88 of file IntField.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
int IntField::dispatch (int event) [virtual]
+
+
+ +

Dispatches event via this field.

+

The event is usually obtained from LCD::getButton().

+

Returns zero if the event has been handled and no further action is required.

+

Returns FORM_CHANGED if the 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 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.

+
See also:
Form::dispatch(), LCD::getButton()
+ +

Reimplemented from Field.

+ +

Definition at line 114 of file IntField.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void IntField::enterField (bool reverse) [virtual]
+
+
+ +

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 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().

+
See also:
exitField()
+ +

Reimplemented from Field.

+ +

Definition at line 126 of file IntField.cpp.

+ +
+
+ +
+
+ + + + + + + +
int IntField::maxValue () const [inline]
+
+
+ +

Returns the maximum value for the input field.

+
See also:
setMaxValue(), minValue(), stepValue(), value()
+ +

Definition at line 41 of file IntField.h.

+ +
+
+ +
+
+ + + + + + + +
int IntField::minValue () const [inline]
+
+
+ +

Returns the minimum value for the input field.

+
See also:
setMinValue(), maxValue(), stepValue(), value()
+ +

Definition at line 38 of file IntField.h.

+ +
+
+ +
+
+ + + + + + + + +
void IntField::setMaxValue (int value) [inline]
+
+
+ +

Sets the maximum value for the input field.

+

The new maximum value will be used to clamp the field's value the next time setValue() is called.

+
See also:
maxValue(), setMinValue(), setStepValue(), setValue()
+ +

Definition at line 42 of file IntField.h.

+ +
+
+ +
+
+ + + + + + + + +
void IntField::setMinValue (int value) [inline]
+
+
+ +

Sets the minimum value for the input field.

+

The new minimum value will be used to clamp the field's value the next time setValue() is called.

+
See also:
minValue(), setMaxValue(), setStepValue(), setValue()
+ +

Definition at line 39 of file IntField.h.

+ +
+
+ +
+
+ + + + + + + + +
void IntField::setStepValue (int value) [inline]
+
+
+ +

Sets the step value value to use when increasing or decreasing the value() due to Up and Down button presses.

+
See also:
stepValue(), setMinValue(), setMaxValue(), setValue()
+ +

Definition at line 45 of file IntField.h.

+ +
+
+ +
+
+ + + + + + + + +
void IntField::setSuffix (const String & suffix)
+
+
+ +

Sets the 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:

+
 field.setSuffix("%");
+ field.setSuffix(" rpm");
+
See also:
suffix()
+ +

Definition at line 231 of file IntField.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void IntField::setValue (int value)
+
+
+ +

Sets the current value of this field.

+

The value will be clamped to the range defined by minValue() and maxValue().

+
See also:
value(), setMinValue(), setMaxValue(), setStepValue()
+ +

Definition at line 198 of file IntField.cpp.

+ +
+
+ +
+
+ + + + + + + +
int IntField::stepValue () const [inline]
+
+
+ +

Returns the step value to use when increasing or decreasing the value() due to Up and Down button presses.

+
See also:
setStepValue(), minValue(), maxValue(), value()
+ +

Definition at line 44 of file IntField.h.

+ +
+
+ +
+
+ + + + + + + +
const String & IntField::suffix () const [inline]
+
+
+ +

Returns the suffix string to be displayed after the field's value.

+
See also:
setSuffix()
+ +

Definition at line 50 of file IntField.h.

+ +
+
+ +
+
+ + + + + + + +
int IntField::value () const [inline]
+
+
+ +

Returns the current value of this field.

+
See also:
setValue(), minValue(), maxValue(), stepValue()
+ +

Definition at line 47 of file IntField.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classIntField.png b/classIntField.png new file mode 100644 index 00000000..8661f176 Binary files /dev/null and b/classIntField.png differ diff --git a/classLCD-members.html b/classLCD-members.html new file mode 100644 index 00000000..ac62ae32 --- /dev/null +++ b/classLCD-members.html @@ -0,0 +1,101 @@ + + + + +ArduinoLibs: Member List + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
LCD Member List
+
+
+This is the complete list of members for LCD, including all inherited members. + + + + + + + + + + + + + + +
BacklightOff enum valueLCD
BacklightOnSelect enum valueLCD
disableScreenSaver()LCD
display()LCD
DisplayOff enum valueLCD
enableScreenSaver(int timeoutSecs=10)LCD
getButton()LCD
isScreenSaved() const LCD [inline]
LCD()LCD [inline]
LCD(uint8_t pin9)LCD [inline]
noDisplay()LCD
screenSaverMode() const LCD [inline]
ScreenSaverMode enum nameLCD
setScreenSaverMode(ScreenSaverMode mode)LCD
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classLCD.html b/classLCD.html new file mode 100644 index 00000000..29739ff0 --- /dev/null +++ b/classLCD.html @@ -0,0 +1,413 @@ + + + + +ArduinoLibs: LCD Class Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+ +
+
LCD Class Reference
+
+
+ +

Enhanced library for Freetronics 16x2 LCD shields. + More...

+ +

#include <LCD.h>

+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Types

enum  ScreenSaverMode { DisplayOff, +BacklightOff, +BacklightOnSelect + }
 Screen saver mode that controls the display and back light. More...

+Public Member Functions

 LCD ()
 Initialize the Freetronics LCD display with the default pin assignment.
 LCD (uint8_t pin9)
 Initialize the Freetronics LCD display for USBDroid.
void display ()
 Turns on the display of text on the LCD and the back light.
void noDisplay ()
 Turns off the display of text on the LCD and the back light.
ScreenSaverMode screenSaverMode () const
 Returns the current screen saver mode; default is DisplayOff.
void setScreenSaverMode (ScreenSaverMode mode)
 Sets the current screen saver mode.
void enableScreenSaver (int timeoutSecs=10)
 Enables the screen saver and causes it to activate after timeoutSecs of inactivity on the buttons.
void disableScreenSaver ()
 Disables the screen saver.
bool isScreenSaved () const
 Returns true if the screen has been saved; false otherwise.
int getButton ()
 Gets the next button press, release, or idle event.
+

Detailed Description

+

Enhanced library for Freetronics 16x2 LCD shields.

+

This class extends the standard Arduino LiquidCrystal library with extra functionality for the Freetronics 16x2 LCD shield:

+

http://www.freetronics.com/pages/16x2-lcd-shield-quickstart-guide

+

The Freetronics LCD has an additional back light, which is turned on and off with the display() and noDisplay() functions. The user can also call enableScreenSaver() to cause the display and back light to automatically turn off after a specific timeout. The setScreenSaverMode() function controls which of the display and back light are disabled when the screen saver activates.

+

The Freetronics LCD also has 5 push buttons for Left, Right, Up, Down, and Select, to assist with the creation of interactive sketches. The user can call getButton() to get the current button state. One of the following values may be returned:

+
    +
  • LCD_BUTTON_NONE - No button has been pressed, or a button has been pressed but not yet released.
  • +
  • LCD_BUTTON_LEFT - Left button was pressed.
  • +
  • LCD_BUTTON_RIGHT - Right button was pressed.
  • +
  • LCD_BUTTON_UP - Up button was pressed.
  • +
  • LCD_BUTTON_DOWN - Down button was pressed.
  • +
  • LCD_BUTTON_SELECT - Select button was pressed.
  • +
  • LCD_BUTTON_LEFT_RELEASED - Left button was released.
  • +
  • LCD_BUTTON_RIGHT_RELEASED - Right button was released.
  • +
  • LCD_BUTTON_UP_RELEASED - Up button was released.
  • +
  • LCD_BUTTON_DOWN_RELEASED - Down button was released.
  • +
  • LCD_BUTTON_SELECT_RELEASED - Select button was released.
  • +
+

For convenience, all RELEASED button codes are the negation of their pressed counterparts. That is, LCD_BUTTON_LEFT_RELEASED == -LCD_BUTTON_LEFT. LCD_BUTTON_NONE is defined to be zero. Thus, you can check if a generic button has been pressed with button > 0 and if a generic button has been released with button < 0.

+

See the Hello World example for more information on using the LCD class.

+
See also:
Form
+ +

Definition at line 48 of file LCD.h.

+

Member Enumeration Documentation

+ +
+
+ + + + +
enum LCD::ScreenSaverMode
+
+
+ +

Screen saver mode that controls the display and back light.

+
Enumerator:
+ + + +
DisplayOff  +

Turn off both the display and the backlight when the screen saver is activated.

+
BacklightOff  +

Turn off the back light but leave the display on when the screen saver is activated.

+
BacklightOnSelect  +

Same as BacklightOff but the screen saver is only deactivated when Select is pressed; other buttons have no effect.

+
+
+
+ +

Definition at line 56 of file LCD.h.

+ +
+
+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
LCD::LCD () [inline]
+
+
+ +

Initialize the Freetronics LCD display with the default pin assignment.

+

The following example shows how to initialize the Freetronics LCD shield:

+
 LCD lcd;
+
+

Definition at line 50 of file LCD.h.

+ +
+
+ +
+
+ + + + + + + + +
LCD::LCD (uint8_t pin9) [inline]
+
+
+ +

Initialize the Freetronics LCD display for USBDroid.

+

On the USBDroid, the D9 pin is used for USB Host functionality. Either the USB Host's use of D9 must be reassigned to another pin, or the Freetronics LCD shield must be modified. The following Web page describes the modifications that are necessary: http://www.freetronics.com/pages/combining-the-lcd-keypad-shield-and-the-usbdroid

+

If you choose to modify the LCD shield, then you must use this version of the constructor to initialize the shield, passing the alternative pin as the pin9 parameter. Using the recommended pin from the above Web page of A1, you would initialize the LCD as follows:

+
 LCD lcd(A1);
+
+

Definition at line 51 of file LCD.h.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + +
void LCD::disableScreenSaver ()
+
+
+ +

Disables the screen saver.

+
See also:
enableScreenSaver(), display(), isScreenSaved()
+ +

Definition at line 246 of file LCD.cpp.

+ +
+
+ +
+
+ + + + + + + +
void LCD::display ()
+
+
+ +

Turns on the display of text on the LCD and the back light.

+

If the screen saver is active, then calling this function will deactivate the screen saver and reset the timeout. Thus, this function can be called for force the screen to restore.

+
See also:
noDisplay(), enableScreenSaver(), setScreenSaverMode()
+ +

Definition at line 148 of file LCD.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void LCD::enableScreenSaver (int timeoutSecs = 10)
+
+
+ +

Enables the screen saver and causes it to activate after timeoutSecs of inactivity on the buttons.

+

If timeoutSecs is less than or equal to zero, then the call is equivalent to calling disableScreenSaver().

+

For the screen saver to work, the application must regularly call getButton() to fetch the LCD's button state even if no buttons are pressed.

+

If the timeoutSecs parameter is not supplied, the default is 10 seconds.

+
See also:
disableScreenSaver(), display(), getButton(), isScreenSaved()
+ +

Definition at line 232 of file LCD.cpp.

+ +
+
+ +
+
+ + + + + + + +
int LCD::getButton ()
+
+
+ +

Gets the next button press, release, or idle event.

+

If no buttons are pressed, this function will return LCD_BUTTON_NONE.

+

When a button is pressed, this function will return one of LCD_BUTTON_LEFT, LCD_BUTTON_RIGHT, LCD_BUTTON_UP, LCD_BUTTON_DOWN, or LCD_BUTTON_SELECT. While the button is pressed, this function will return LCD_BUTTON_NONE until the button is released. When the button is released, this function will return one of LCD_BUTTON_LEFT_RELEASED, LCD_BUTTON_RIGHT_RELEASED, LCD_BUTTON_UP_RELEAED, LCD_BUTTON_DOWN_RELEASED, or LCD_BUTTON_SELECT_RELEASED.

+

If the screen saver is currently active, then it will be deactivated by this function whenever a button is pressed. If screenSaverMode() is DisplayOff, the function will "eat" the button press and return LCD_BUTTON_NONE. The scrren saver can also be deactivated under program control by calling display().

+

This function debounces the button state automatically so there is no need for the caller to worry about spurious button events.

+
See also:
enableScreenSaver(), display(), Form::dispatch()
+ +

Definition at line 291 of file LCD.cpp.

+ +
+
+ +
+
+ + + + + + + +
bool LCD::isScreenSaved () const [inline]
+
+
+ +

Returns true if the screen has been saved; false otherwise.

+
See also:
enableScreenSaver()
+ +

Definition at line 68 of file LCD.h.

+ +
+
+ +
+
+ + + + + + + +
void LCD::noDisplay ()
+
+
+ +

Turns off the display of text on the LCD and the back light.

+

This function can be called to force the screen saver to activate.

+
See also:
display(), enableScreenSaver(), setScreenSaverMode()
+ +

Definition at line 163 of file LCD.cpp.

+ +
+
+ +
+
+ + + + + + + +
ScreenSaverMode LCD::screenSaverMode () const [inline]
+
+
+ +

Returns the current screen saver mode; default is DisplayOff.

+
See also:
setScreenSaverMode(), enableScreenSaver()
+ +

Definition at line 63 of file LCD.h.

+ +
+
+ +
+
+ + + + + + + + +
void LCD::setScreenSaverMode (ScreenSaverMode mode)
+
+
+ +

Sets the current screen saver mode.

+
See also:
screenSaverMode(), enableScreenSaver()
+ +

Definition at line 206 of file LCD.cpp.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classListField-members.html b/classListField-members.html new file mode 100644 index 00000000..2d3e1038 --- /dev/null +++ b/classListField-members.html @@ -0,0 +1,105 @@ + + + + +ArduinoLibs: Member List + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
ListField Member List
+
+
+This is the complete list of members for ListField, including all inherited members. + + + + + + + + + + + + + + + + + + +
dispatch(int event)ListField [virtual]
enterField(bool reverse)ListField [virtual]
exitField()Field [virtual]
Field(const String &label)Field [explicit]
Field(Form &form, const String &label)Field
form() const Field [inline]
isCurrent() const Field
items() const ListField [inline]
label() const Field [inline]
lcd() const Field [inline, protected]
ListField(const String &label)ListField [explicit]
ListField(Form &form, const String &label, ListItems items, int value=0)ListField
setItems(ListItems items)ListField
setLabel(const String &label)Field
setValue(int value)ListField
updateCursor()Field [protected, virtual]
value() const ListField [inline]
~Field()Field
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classListField.html b/classListField.html new file mode 100644 index 00000000..4d1e6bac --- /dev/null +++ b/classListField.html @@ -0,0 +1,329 @@ + + + + +ArduinoLibs: ListField Class Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+ +
+
ListField Class Reference
+
+
+ +

Field that manages selection from a static list of items. + More...

+ +

#include <ListField.h>

+
+Inheritance diagram for ListField:
+
+
+ + +Field + +
+ +

List of all members.

+ + + + + + + + + + + + + + + + + + +

+Public Member Functions

 ListField (const String &label)
 Constructs a new list field with a specific label.
ListField (Form &form, const String &label, ListItems items, int value=0)
 Constructs a new list field with a specific label, list of items, and value, and attaches it to a form.
int dispatch (int event)
 Dispatches event via this field.
void enterField (bool reverse)
 Enters the field due to form navigation.
ListItems items () const
 Returns the array of items in this list.
void setItems (ListItems items)
 Sets the array of items for this list.
int value () const
 Returns the value of this list; i.e. the index within items() of the selected item.
void setValue (int value)
 Sets the value of this list; i.e. the index within items() of the selected item.
+

Detailed Description

+

Field that manages selection from a static list of items.

+

ListField is intended for selecting an element from a list of items. Each items is represented by a string within program memory, with the list terminated by null. For example:

+
 const char item_Eggs[] PROGMEM = "Eggs";
+ const char item_Cheese[] PROGMEM = "Cheese";
+ const char item_Pumpkin[] PROGMEM = "Pumpkin";
+ ListItem const ingredients[] PROGMEM = {
+    item_Eggs,
+    item_Cheese,
+    item_Pumpkin,
+    0
+ };
+
+ Form mainForm(lcd);
+ ListField ingredient(mainForm, "Select ingredient", ingredients);
+

If there are only two items in the list, then BoolField can be used instead.

+
See also:
Field, BoolField
+ +

Definition at line 32 of file ListField.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + +
ListField::ListField (const String & label) [explicit]
+
+
+ +

Constructs a new list field with a specific label.

+

The field is initially not associated with a Form. The field can be added to a form later using Form::addField().

+

Initially, items() is null and value() is -1.

+
See also:
Form::addField()
+ +

Definition at line 64 of file ListField.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
int ListField::dispatch (int event) [virtual]
+
+
+ +

Dispatches event via this field.

+

The event is usually obtained from LCD::getButton().

+

Returns zero if the event has been handled and no further action is required.

+

Returns FORM_CHANGED if the 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 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.

+
See also:
Form::dispatch(), LCD::getButton()
+ +

Reimplemented from Field.

+ +

Definition at line 87 of file ListField.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void ListField::enterField (bool reverse) [virtual]
+
+
+ +

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 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().

+
See also:
exitField()
+ +

Reimplemented from Field.

+ +

Definition at line 105 of file ListField.cpp.

+ +
+
+ +
+
+ + + + + + + +
ListItems ListField::items () const [inline]
+
+
+ +

Returns the array of items in this list.

+
See also:
setItems()
+ +

Definition at line 41 of file ListField.h.

+ +
+
+ +
+
+ + + + + + + + +
void ListField::setItems (ListItems items)
+
+
+ +

Sets the array of items for this list.

+

The items must be stored within program memory and terminated by null; for example:

+
 const char item_Eggs[] PROGMEM = "Eggs";
+ const char item_Cheese[] PROGMEM = "Cheese";
+ const char item_Pumpkin[] PROGMEM = "Pumpkin";
+ ListItem const ingredients[] PROGMEM = {
+    item_Eggs,
+    item_Cheese,
+    item_Pumpkin,
+    0
+ };
+
+ list.setItems(ingredients);
+
See also:
items()
+ +

Definition at line 141 of file ListField.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void ListField::setValue (int value)
+
+
+ +

Sets the value of this list; i.e. the index within items() of the selected item.

+

The value will be clamped to the range of items().

+
See also:
value(), items()
+ +

Definition at line 178 of file ListField.cpp.

+ +
+
+ +
+
+ + + + + + + +
int ListField::value () const [inline]
+
+
+ +

Returns the value of this list; i.e. the index within items() of the selected item.

+

Returns -1 if the items() array is empty or null.

+
See also:
setValue(), items()
+ +

Definition at line 44 of file ListField.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classListField.png b/classListField.png new file mode 100644 index 00000000..78b21f13 Binary files /dev/null and b/classListField.png differ diff --git a/classMelody-members.html b/classMelody-members.html new file mode 100644 index 00000000..6b6d8b77 --- /dev/null +++ b/classMelody-members.html @@ -0,0 +1,97 @@ + + + + +ArduinoLibs: Member List + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
Melody Member List
+
+
+This is the complete list of members for Melody, including all inherited members. + + + + + + + + + + +
isPlaying() const Melody [inline]
loopCount() const Melody [inline]
Melody(uint8_t pin)Melody
play()Melody
playOnce()Melody
run()Melody
setLoopCount(int count)Melody [inline]
setLoopDuration(unsigned long ms)Melody
setMelody(const int *notes, const uint8_t *lengths, unsigned int size)Melody
stop()Melody
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classMelody.html b/classMelody.html new file mode 100644 index 00000000..92e6f230 --- /dev/null +++ b/classMelody.html @@ -0,0 +1,350 @@ + + + + +ArduinoLibs: Melody Class Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+ +
+
Melody Class Reference
+
+
+ +

Plays a melody on a digital output pin using tone(). + More...

+ +

#include <Melody.h>

+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

Melody (uint8_t pin)
 Constructs a new melody playing object for pin.
+bool isPlaying () const
 Returns true if the melody is currently playing; false if not.
int loopCount () const
 Returns the number of times the melody should loop before stopping.
void setLoopCount (int count)
 Sets the number of times the melody should loop to count.
void setLoopDuration (unsigned long ms)
 Sets the maximum number of loops to last no longer than ms milliseconds.
void play ()
 Starts playing the melody, or restarts it if already playing.
void playOnce ()
 Plays the melody once and then stops.
void stop ()
 Stops playing the melody.
void setMelody (const int *notes, const uint8_t *lengths, unsigned int size)
 Sets the melody to the size elements of notes and lengths.
void run ()
 Runs the melody control loop.
+

Detailed Description

+

Plays a melody on a digital output pin using tone().

+

The following example plays a simple tone three times on digital pin 8:

+
 #include <Melody.h>
+
+ int notes[] = {
+     NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3,
+     NOTE_REST, NOTE_B3, NOTE_C4, NOTE_REST
+ };
+ byte lengths[] = {4, 8, 8, 4, 4, 4, 4, 4, 2};
+
+ Melody melody(8);
+
+ void setup() {
+     melody.setMelody(notes, lengths, sizeof(lengths));
+     melody.setLoopCount(3);
+     melody.play();
+ }
+
+ void loop() {
+     melody.run();
+ }
+

The notes array contains the frequency of the notes to be played, with the special value NOTE_REST indicating a rest where no notes are playing. The lengths array contains the lengths of each of the notes; a value of 4 indicates a quarter note, a value of 8 indicates an eighth note, etc.

+

The run() method must be called from the application's main loop() method to ensure that the melody advances from one note to the next. It will not block the application while notes are playing.

+

The number of loops can also be specified with setLoopDuration() which sets a maximum amount of time that the melody will play before stopping. The following example plays the melody for no more than 60 seconds:

+
 void setup() {
+     melody.setMelody(notes, lengths, sizeof(lengths));
+     melody.setLoopDuration(60000UL);
+     melody.play();
+ }
+
+

Definition at line 122 of file Melody.h.

+

Member Function Documentation

+ +
+
+ + + + + + + +
int Melody::loopCount () const [inline]
+
+
+ +

Returns the number of times the melody should loop before stopping.

+

The default value is zero, indicating that the melody will loop indefinitely.

+
See also:
setLoopCount(), setLoopDuration(), play()
+ +

Definition at line 128 of file Melody.h.

+ +
+
+ +
+
+ + + + + + + +
void Melody::play ()
+
+
+ +

Starts playing the melody, or restarts it if already playing.

+
See also:
playOnce(), setMelody(), stop(), loopCount()
+ +

Definition at line 146 of file Melody.cpp.

+ +
+
+ +
+
+ + + + + + + +
void Melody::playOnce ()
+
+
+ +

Plays the melody once and then stops.

+
See also:
play(), stop()
+ +

Definition at line 162 of file Melody.cpp.

+ +
+
+ +
+
+ + + + + + + +
void Melody::run ()
+
+
+ +

Runs the melody control loop.

+

This function must be called by the application's main loop() function to cause the melody to advance from note to note. It will not block the application while notes are playing.

+ +

Definition at line 214 of file Melody.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void Melody::setLoopCount (int count) [inline]
+
+
+ +

Sets the number of times the melody should loop to count.

+

If count is zero, then the melody will loop indefinitely.

+
See also:
loopCount(), setLoopDuration()
+ +

Definition at line 129 of file Melody.h.

+ +
+
+ +
+
+ + + + + + + + +
void Melody::setLoopDuration (unsigned long ms)
+
+
+ +

Sets the maximum number of loops to last no longer than ms milliseconds.

+

This function must be called after the melody is specified with setMelody() as it uses the length of the melody and ms to determine the loopCount().

+
See also:
loopCount(), setLoopCount()
+ +

Definition at line 131 of file Melody.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void Melody::setMelody (const int * notes,
const uint8_t * lengths,
unsigned int size 
)
+
+
+ +

Sets the melody to the size elements of notes and lengths.

+

If a melody is currently playing, then this function will stop playback.

+

The notes array contains the frequency of the notes to be played, with the special value NOTE_REST indicating a rest where no notes are playing. The lengths array contains the lengths of each of the notes; a value of 4 indicates a quarter note, a value of 8 indicates an eighth note, etc.

+
See also:
play()
+ +

Definition at line 199 of file Melody.cpp.

+ +
+
+ +
+
+ + + + + + + +
void Melody::stop ()
+
+
+ +

Stops playing the melody.

+
See also:
play()
+ +

Definition at line 178 of file Melody.cpp.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classRTC-members.html b/classRTC-members.html new file mode 100644 index 00000000..5b186646 --- /dev/null +++ b/classRTC-members.html @@ -0,0 +1,106 @@ + + + + +ArduinoLibs: Member List + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
RTC Member List
+
+
+This is the complete list of members for RTC, including all inherited members. + + + + + + + + + + + + + + + + + + + +
adjustDays(RTCDate *date, uint8_t flags)RTC [static]
adjustMonths(RTCDate *date, uint8_t flags)RTC [static]
adjustYears(RTCDate *date, uint8_t flags)RTC [static]
ALARM_COUNTRTC [static]
byteCount() const RTC [virtual]
DECREMENTRTC [static]
hasUpdates()RTC [virtual]
INCREMENTRTC [static]
readAlarm(uint8_t alarmNum, RTCAlarm *value)RTC [virtual]
readByte(uint8_t offset)RTC [virtual]
readDate(RTCDate *value)RTC [virtual]
readTime(RTCTime *value)RTC [virtual]
RTC()RTC
WRAPRTC [static]
writeAlarm(uint8_t alarmNum, const RTCAlarm *value)RTC [virtual]
writeByte(uint8_t offset, uint8_t value)RTC [virtual]
writeDate(const RTCDate *value)RTC [virtual]
writeTime(const RTCTime *value)RTC [virtual]
~RTC() (defined in RTC)RTC
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classRTC.html b/classRTC.html new file mode 100644 index 00000000..1208080b --- /dev/null +++ b/classRTC.html @@ -0,0 +1,561 @@ + + + + +ArduinoLibs: RTC Class Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+ +
+
RTC Class Reference
+
+
+ +

Base class for realtime clock handlers. + More...

+ +

#include <RTC.h>

+
+Inheritance diagram for RTC:
+
+
+ + +DS1307RTC +DS3232RTC + +
+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 RTC ()
 Constructs a new realtime clock handler.
virtual bool hasUpdates ()
 Returns true if the realtime clock has updated since the last call to this function.
virtual void readTime (RTCTime *value)
 Reads the current time from the realtime clock into value.
virtual void readDate (RTCDate *value)
 Reads the current date from the realtime clock into value.
virtual void writeTime (const RTCTime *value)
 Updates the time in the realtime clock to match value.
virtual void writeDate (const RTCDate *value)
 Updates the date in the realtime clock to match value.
virtual void readAlarm (uint8_t alarmNum, RTCAlarm *value)
 Reads the details of the alarm with index alarmNum into value.
virtual void writeAlarm (uint8_t alarmNum, const RTCAlarm *value)
 Updates the details of the alarm with index alarmNum from value.
virtual int byteCount () const
 Returns the number of bytes of non-volatile memory that can be used for storage of arbitrary settings, excluding storage used by alarms.
virtual uint8_t readByte (uint8_t offset)
 Reads the byte at offset within the realtime clock's non-volatile memory.
virtual void writeByte (uint8_t offset, uint8_t value)
 Writes value to offset within the realtime clock's non-volatile memory.

+Static Public Member Functions

static void adjustDays (RTCDate *date, uint8_t flags)
 Adjusts date up or down one day according to flags.
static void adjustMonths (RTCDate *date, uint8_t flags)
 Adjusts date up or down one month according to flags.
static void adjustYears (RTCDate *date, uint8_t flags)
 Adjusts date up or down one year according to flags.

+Static Public Attributes

+static const uint8_t ALARM_COUNT = 4
 Number of alarms that are supported by RTC::readAlarm() and RTC::writeAlarm().
+static const uint8_t INCREMENT = 0x0000
 Increment the day, month, or year in a call to adjustDays(), adjustMonths(), or adjustYears().
+static const uint8_t DECREMENT = 0x0001
 Decrement the day, month, or year in a call to adjustDays(), adjustMonths(), or adjustYears().
+static const uint8_t WRAP = 0x0002
 Wrap around to the beginning of the current month/year rather than advance to the next one.
+

Detailed Description

+

Base class for realtime clock handlers.

+

This class simplifies the process of reading and writing the time and date information in a realtime clock chip. The class also provides support for reading and writing information about alarms and other clock settings.

+

It is intended that the application will instantiate a subclass of this class to handle the specific realtime clock chip in the system. The default implementation in RTC simulates a clock based on the value of millis(), with alarms and clock settings stored in main memory.

+

Because the common DS1307 and DS3232 realtime clock chips use a 2-digit year, this class is also limited to dates between 2000 and 2099 inclusive.

+
See also:
RTCTime, RTCDate, RTCAlarm, DS1307RTC, DS3232RTC
+ +

Definition at line 49 of file RTC.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + +
RTC::RTC ()
+
+
+ +

Constructs a new realtime clock handler.

+
See also:
hasUpdates()
+ +

Definition at line 90 of file RTC.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
void RTC::adjustDays (RTCDatedate,
uint8_t flags 
) [static]
+
+
+ +

Adjusts date up or down one day according to flags.

+
See also:
adjustMonths(), adjustYears()
+ +

Definition at line 280 of file RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void RTC::adjustMonths (RTCDatedate,
uint8_t flags 
) [static]
+
+
+ +

Adjusts date up or down one month according to flags.

+
See also:
adjustDays(), adjustYears()
+ +

Definition at line 310 of file RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void RTC::adjustYears (RTCDatedate,
uint8_t flags 
) [static]
+
+
+ +

Adjusts date up or down one year according to flags.

+
See also:
adjustDays(), adjustMonths()
+ +

Definition at line 337 of file RTC.cpp.

+ +
+
+ +
+
+ + + + + + + +
int RTC::byteCount () const [virtual]
+
+
+ +

Returns the number of bytes of non-volatile memory that can be used for storage of arbitrary settings, excluding storage used by alarms.

+
See also:
readByte(), writeByte()
+ +

Reimplemented in DS1307RTC, and DS3232RTC.

+ +

Definition at line 220 of file RTC.cpp.

+ +
+
+ +
+
+ + + + + + + +
bool RTC::hasUpdates () [virtual]
+
+
+ +

Returns true if the realtime clock has updated since the last call to this function.

+

The default implementation returns true, indicating that an update is always available to be read.

+ +

Reimplemented in DS1307RTC, and DS3232RTC.

+ +

Definition at line 119 of file RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void RTC::readAlarm (uint8_t alarmNum,
RTCAlarmvalue 
) [virtual]
+
+
+ +

Reads the details of the alarm with index alarmNum into value.

+

The alarmNum parameter must be between 0 and ALARM_COUNT - 1.

+

Alarm details are stored at the end of the realtime clock's non-volatile memory.

+
See also:
writeAlarm(), alarmCount()
+ +

Reimplemented in DS1307RTC, and DS3232RTC.

+ +

Definition at line 194 of file RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + +
uint8_t RTC::readByte (uint8_t offset) [virtual]
+
+
+ +

Reads the byte at offset within the realtime clock's non-volatile memory.

+

The offset parameter must be between 0 and byteCount() - 1.

+
See also:
writeByte(), byteCount()
+ +

Reimplemented in DS1307RTC, and DS3232RTC.

+ +

Definition at line 232 of file RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void RTC::readDate (RTCDatevalue) [virtual]
+
+
+ +

Reads the current date from the realtime clock into value.

+

The time should be read first with readTime() as the default implementation only advances the date when the time is read and it crosses midnight.

+
See also:
writeDate(), readTime()
+ +

Reimplemented in DS1307RTC, and DS3232RTC.

+ +

Definition at line 154 of file RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void RTC::readTime (RTCTimevalue) [virtual]
+
+
+ +

Reads the current time from the realtime clock into value.

+
See also:
writeTime(), readDate()
+ +

Reimplemented in DS1307RTC, and DS3232RTC.

+ +

Definition at line 129 of file RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void RTC::writeAlarm (uint8_t alarmNum,
const RTCAlarmvalue 
) [virtual]
+
+
+ +

Updates the details of the alarm with index alarmNum from value.

+

The alarmNum parameter must be between 0 and ALARM_COUNT - 1.

+

Alarm details are stored at the end of the realtime clock's non-volatile memory.

+
See also:
readAlarm(), alarmCount()
+ +

Reimplemented in DS1307RTC, and DS3232RTC.

+ +

Definition at line 209 of file RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void RTC::writeByte (uint8_t offset,
uint8_t value 
) [virtual]
+
+
+ +

Writes value to offset within the realtime clock's non-volatile memory.

+

The offset parameter must be between 0 and byteCount() - 1.

+
See also:
readByte(), byteCount()
+ +

Reimplemented in DS1307RTC, and DS3232RTC.

+ +

Definition at line 247 of file RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void RTC::writeDate (const RTCDatevalue) [virtual]
+
+
+ +

Updates the date in the realtime clock to match value.

+
See also:
readDate(), writeTime()
+ +

Reimplemented in DS1307RTC, and DS3232RTC.

+ +

Definition at line 179 of file RTC.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void RTC::writeTime (const RTCTimevalue) [virtual]
+
+
+ +

Updates the time in the realtime clock to match value.

+
See also:
readTime(), writeDate()
+ +

Reimplemented in DS1307RTC, and DS3232RTC.

+ +

Definition at line 164 of file RTC.cpp.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classRTC.png b/classRTC.png new file mode 100644 index 00000000..c7b873a9 Binary files /dev/null and b/classRTC.png differ diff --git a/classRTCAlarm-members.html b/classRTCAlarm-members.html new file mode 100644 index 00000000..7e8ff51d --- /dev/null +++ b/classRTCAlarm-members.html @@ -0,0 +1,90 @@ + + + + +ArduinoLibs: Member List + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
RTCAlarm Member List
+
+
+This is the complete list of members for RTCAlarm, including all inherited members. + + + +
flagsRTCAlarm
hourRTCAlarm
minuteRTCAlarm
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classRTCDate-members.html b/classRTCDate-members.html new file mode 100644 index 00000000..dcc86d9a --- /dev/null +++ b/classRTCDate-members.html @@ -0,0 +1,90 @@ + + + + +ArduinoLibs: Member List + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
RTCDate Member List
+
+
+This is the complete list of members for RTCDate, including all inherited members. + + + +
dayRTCDate
monthRTCDate
yearRTCDate
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classRTCTime-members.html b/classRTCTime-members.html new file mode 100644 index 00000000..63484630 --- /dev/null +++ b/classRTCTime-members.html @@ -0,0 +1,90 @@ + + + + +ArduinoLibs: Member List + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
RTCTime Member List
+
+
+This is the complete list of members for RTCTime, including all inherited members. + + + +
hourRTCTime
minuteRTCTime
secondRTCTime
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classSoftI2C-members.html b/classSoftI2C-members.html new file mode 100644 index 00000000..71a15c43 --- /dev/null +++ b/classSoftI2C-members.html @@ -0,0 +1,95 @@ + + + + +ArduinoLibs: Member List + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
SoftI2C Member List
+
+
+This is the complete list of members for SoftI2C, including all inherited members. + + + + + + + + +
available()SoftI2C [virtual]
endWrite()SoftI2C [virtual]
maxTransferSize() const SoftI2C [virtual]
read()SoftI2C [virtual]
SoftI2C(uint8_t dataPin, uint8_t clockPin)SoftI2C
startRead(unsigned int address, unsigned int count)SoftI2C [virtual]
startWrite(unsigned int address)SoftI2C [virtual]
write(uint8_t value)SoftI2C [virtual]
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classSoftI2C.html b/classSoftI2C.html new file mode 100644 index 00000000..f3d5d6f2 --- /dev/null +++ b/classSoftI2C.html @@ -0,0 +1,293 @@ + + + + +ArduinoLibs: SoftI2C Class Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+ +
+
SoftI2C Class Reference
+
+
+ +

Bit-banged implementation of an I2C master. + More...

+ +

#include <SoftI2C.h>

+
+Inheritance diagram for SoftI2C:
+
+
+ + +I2CMaster + +
+ +

List of all members.

+ + + + + + + + + + + + + + + + + + +

+Public Member Functions

SoftI2C (uint8_t dataPin, uint8_t clockPin)
 Constructs a new software I2C master on dataPin and clockPin.
+unsigned int maxTransferSize () const
 Returns the maximum number of bytes that can be read or written in a single request by this bus master.
void startWrite (unsigned int address)
 Starts a write operation by sending a start condition and the I2C control byte.
void write (uint8_t value)
 Writes a single byte value on the I2C bus.
bool endWrite ()
 Ends the current write operation.
bool startRead (unsigned int address, unsigned int count)
 Starts a read operation for count bytes by sending the start condition and the I2C control byte.
unsigned int available ()
 Returns the number of bytes that are still available for reading.
uint8_t read ()
 Reads a single byte from the I2C bus.
+

Detailed Description

+

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.

+
See also:
I2CMaster
+ +

Definition at line 28 of file SoftI2C.h.

+

Member Function Documentation

+ +
+
+ + + + + + + +
unsigned int SoftI2C::available () [virtual]
+
+
+ +

Returns the number of bytes that are still available for reading.

+
See also:
startRead(), read()
+ +

Implements I2CMaster.

+ +

Definition at line 155 of file SoftI2C.cpp.

+ +
+
+ +
+
+ + + + + + + +
bool SoftI2C::endWrite () [virtual]
+
+
+ +

Ends the current write operation.

+

Returns true if the write operation was acknowledged; false otherwise.

+
See also:
startWrite(), write()
+ +

Implements I2CMaster.

+ +

Definition at line 129 of file SoftI2C.cpp.

+ +
+
+ +
+
+ + + + + + + +
uint8_t SoftI2C::read () [virtual]
+
+
+ +

Reads a single byte from the I2C bus.

+
See also:
startRead(), available()
+ +

Implements I2CMaster.

+ +

Definition at line 160 of file SoftI2C.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
bool SoftI2C::startRead (unsigned int address,
unsigned int count 
) [virtual]
+
+
+ +

Starts a read operation for count bytes by sending the start condition and the I2C control byte.

+

The 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 count calls to read() to fetch the bytes.

+
See also:
available(), read(), startWrite()
+ +

Implements I2CMaster.

+ +

Definition at line 135 of file SoftI2C.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void SoftI2C::startWrite (unsigned int address) [virtual]
+
+
+ +

Starts a write operation by sending a start condition and the I2C control byte.

+

The address must be the 7-bit or 10-bit address of the I2C slave on the bus.

+
See also:
write(), endWrite(), startRead()
+ +

Reimplemented from I2CMaster.

+ +

Definition at line 104 of file SoftI2C.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void SoftI2C::write (uint8_t value) [virtual]
+
+
+ +

Writes a single byte value on the I2C bus.

+
See also:
startWrite(), endWrite()
+ +

Implements I2CMaster.

+ +

Definition at line 118 of file SoftI2C.cpp.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classSoftI2C.png b/classSoftI2C.png new file mode 100644 index 00000000..b07c8213 Binary files /dev/null and b/classSoftI2C.png differ diff --git a/classTextField-members.html b/classTextField-members.html new file mode 100644 index 00000000..089073ba --- /dev/null +++ b/classTextField-members.html @@ -0,0 +1,103 @@ + + + + +ArduinoLibs: Member List + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
TextField Member List
+
+
+This is the complete list of members for TextField, including all inherited members. + + + + + + + + + + + + + + + + +
dispatch(int event)Field [virtual]
enterField(bool reverse)TextField [virtual]
exitField()Field [virtual]
Field(const String &label)Field [explicit]
Field(Form &form, const String &label)Field
form() const Field [inline]
isCurrent() const Field
label() const Field [inline]
lcd() const Field [inline, protected]
setLabel(const String &label)Field
setValue(const String &value)TextField
TextField(const String &label)TextField [explicit]
TextField(Form &form, const String &label, const String &value)TextField
updateCursor()Field [protected, virtual]
value() const TextField [inline]
~Field()Field
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classTextField.html b/classTextField.html new file mode 100644 index 00000000..c2c8457e --- /dev/null +++ b/classTextField.html @@ -0,0 +1,275 @@ + + + + +ArduinoLibs: TextField Class Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+ +
+
TextField Class Reference
+
+
+ +

Field that displays a read-only text value. + More...

+ +

#include <TextField.h>

+
+Inheritance diagram for TextField:
+
+
+ + +Field + +
+ +

List of all members.

+ + + + + + + + + + + + +

+Public Member Functions

 TextField (const String &label)
 Constructs a new text field with a specific label.
 TextField (Form &form, const String &label, const String &value)
 Constructs a new text field with a specific label and value attaches it to a form.
void enterField (bool reverse)
 Enters the field due to form navigation.
const String & value () const
 Returns the text value that is currently displayed by this field.
void setValue (const String &value)
 Sets the text value that is displayed by this field.
+

Detailed Description

+

Field that displays a read-only text value.

+

This following example displays a text field with the label "Form example" and a value() of "v1.0".

+
 Form mainForm(lcd);
+ TextField welcomeField(mainForm, "Form example", "v1.0");
+
+FormText.png +
+

As well as static messages, TextField can be used to display read-only information that is computed at runtime:

+
 TextField timeField(mainForm, "Time since reset", "0");
+
+ void loop() {
+     timeField.setValue(millis() / 1000);
+     mainForm.dispatch(lcd.getButton());
+ }
+

For writable fields, use BoolField, IntField, or TimeField.

+
See also:
Field
+ +

Definition at line 28 of file TextField.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + +
TextField::TextField (const String & label) [explicit]
+
+
+ +

Constructs a new text field with a specific 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 the empty string.

+
See also:
Form::addField()
+ +

Definition at line 66 of file TextField.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
TextField::TextField (Formform,
const String & label,
const String & value 
)
+
+
+ +

Constructs a new text field with a specific label and value attaches it to a form.

+
See also:
value()
+ +

Definition at line 77 of file TextField.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
void TextField::enterField (bool reverse) [virtual]
+
+
+ +

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 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().

+
See also:
exitField()
+ +

Reimplemented from Field.

+ +

Definition at line 83 of file TextField.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void TextField::setValue (const String & value)
+
+
+ +

Sets the text value that is displayed by this field.

+
See also:
value()
+ +

Definition at line 102 of file TextField.cpp.

+ +
+
+ +
+
+ + + + + + + +
const String & TextField::value () const [inline]
+
+
+ +

Returns the text value that is currently displayed by this field.

+
See also:
setValue()
+ +

Definition at line 35 of file TextField.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classTextField.png b/classTextField.png new file mode 100644 index 00000000..afbf812d Binary files /dev/null and b/classTextField.png differ diff --git a/classTimeField-members.html b/classTimeField-members.html new file mode 100644 index 00000000..ed3616d7 --- /dev/null +++ b/classTimeField-members.html @@ -0,0 +1,107 @@ + + + + +ArduinoLibs: Member List + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
TimeField Member List
+
+
+This is the complete list of members for TimeField, including all inherited members. + + + + + + + + + + + + + + + + + + + + +
dispatch(int event)TimeField [virtual]
enterField(bool reverse)TimeField [virtual]
exitField()TimeField [virtual]
Field(const String &label)Field [explicit]
Field(Form &form, const String &label)Field
form() const Field [inline]
isCurrent() const Field
label() const Field [inline]
lcd() const Field [inline, protected]
maxHours() const TimeField [inline]
readOnly() const TimeField [inline]
setLabel(const String &label)Field
setMaxHours(int maxHours)TimeField [inline]
setReadOnly(bool value)TimeField
setValue(unsigned long value)TimeField
TimeField(const String &label)TimeField [explicit]
TimeField(Form &form, const String &label, int maxHours, bool readOnly)TimeField
updateCursor()Field [protected, virtual]
value() const TimeField [inline]
~Field()Field
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classTimeField.html b/classTimeField.html new file mode 100644 index 00000000..5c9fee8c --- /dev/null +++ b/classTimeField.html @@ -0,0 +1,439 @@ + + + + +ArduinoLibs: TimeField Class Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+ +
+
TimeField Class Reference
+
+
+ +

Field that manages the display and editing of a time value. + More...

+ +

#include <TimeField.h>

+
+Inheritance diagram for TimeField:
+
+
+ + +Field + +
+ +

List of all members.

+ + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 TimeField (const String &label)
 Constructs a new time field with a specific label.
 TimeField (Form &form, const String &label, int maxHours, bool readOnly)
 Constructs a new boolean field with a specific label and attaches it to a form.
int dispatch (int event)
 Dispatches event via this field.
void enterField (bool reverse)
 Enters the field due to form navigation.
void exitField ()
 Exits the field due to form navigation.
unsigned long value () const
 Returns the current value of this time field, in seconds.
void setValue (unsigned long value)
 Sets the value of this time field, in seconds.
int maxHours () const
 Returns the maximum number of hours before the field wraps around.
void setMaxHours (int maxHours)
 Sets the maximum number of hours before the field wraps around to maxHours.
bool readOnly () const
 Returns TIMEFIELD_READ_ONLY (true) or TIMEFIELD_READ_WRITE (false).
void setReadOnly (bool value)
 Sets the read-only state of this field to value.
+

Detailed Description

+

Field that manages the display and editing of a time value.

+

TimeField is suitable for displaying wall clock time in 24-hour format, or for displaying timeouts and durations in seconds. Times are specified in seconds as an unsigned long value. They are displayed as HH:MM:SS, for hours, minutes, and seconds.

+

The time field can be either read-only or read-write. When read-write, the Up, Down, Left, and Right buttons can be used to modify the hour, minute, and second components of the time value.

+

The following example displays the number of hours, minutes, and seconds since the device was reset, wrapping around after 24 hours:

+
 Form mainForm(lcd);
+ TimeField timeField(mainForm, "Time since reset", 24, TIMEFIELD_READ_ONLY);
+
+ void loop() {
+     timeField.setValue(millis() / 1000);
+     mainForm.dispatch(lcd.getButton());
+ }
+
+FormTimeRO.png +
+

A read-write field can be used to ask the user for the duration of an application count-down timer:

+
 TimeField durationField(mainForm, "Timer duration", 24, TIMEFIELD_READ_WRITE);
+
+FormTimeRW.png +
+
See also:
Field
+ +

Definition at line 31 of file TimeField.h.

+

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + +
TimeField::TimeField (const String & label) [explicit]
+
+
+ +

Constructs a new time field with a specific 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, maxHours() is 24, and isReadOnly() is TIMEFIELD_READ_WRITE.

+
See also:
Form::addField()
+ +

Definition at line 82 of file TimeField.cpp.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TimeField::TimeField (Formform,
const String & label,
int maxHours,
bool readOnly 
)
+
+
+ +

Constructs a new boolean field with a specific label and attaches it to a form.

+

The initial value() of the field will be 0. The value() will be limited to be less than maxHours * 60 * 60 seconds.

+

If readOnly is TIMEFIELD_READ_ONLY, then the field will display times but not allow them to be modified by the user. If readOnly is TIMEFIELD_READ_WRITE, then the field will modifiable by the user.

+
See also:
value()
+ +

Definition at line 105 of file TimeField.cpp.

+ +
+
+

Member Function Documentation

+ +
+
+ + + + + + + + +
int TimeField::dispatch (int event) [virtual]
+
+
+ +

Dispatches event via this field.

+

The event is usually obtained from LCD::getButton().

+

Returns zero if the event has been handled and no further action is required.

+

Returns FORM_CHANGED if the 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 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.

+
See also:
Form::dispatch(), LCD::getButton()
+ +

Reimplemented from Field.

+ +

Definition at line 115 of file TimeField.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void TimeField::enterField (bool reverse) [virtual]
+
+
+ +

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 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().

+
See also:
exitField()
+ +

Reimplemented from Field.

+ +

Definition at line 193 of file TimeField.cpp.

+ +
+
+ +
+
+ + + + + + + +
void TimeField::exitField () [virtual]
+
+
+ +

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.

+
See also:
enterField()
+ +

Reimplemented from Field.

+ +

Definition at line 205 of file TimeField.cpp.

+ +
+
+ +
+
+ + + + + + + +
int TimeField::maxHours () const [inline]
+
+
+ +

Returns the maximum number of hours before the field wraps around.

+
See also:
setMaxHours(), setValue()
+ +

Definition at line 44 of file TimeField.h.

+ +
+
+ +
+
+ + + + + + + +
bool TimeField::readOnly () const [inline]
+
+
+ +

Returns TIMEFIELD_READ_ONLY (true) or TIMEFIELD_READ_WRITE (false).

+
See also:
setReadOnly()
+ +

Definition at line 47 of file TimeField.h.

+ +
+
+ +
+
+ + + + + + + + +
void TimeField::setMaxHours (int maxHours) [inline]
+
+
+ +

Sets the maximum number of hours before the field wraps around to maxHours.

+
See also:
maxHours(), setValue()
+ +

Definition at line 45 of file TimeField.h.

+ +
+
+ +
+
+ + + + + + + + +
void TimeField::setReadOnly (bool value)
+
+
+ +

Sets the read-only state of this field to value.

+

The value should be one of TIMEFIELD_READ_ONLY (true) or TIMEFIELD_READ_WRITE (false). Use of the named constants is recommended.

+
See also:
readOnly()
+ +

Definition at line 268 of file TimeField.cpp.

+ +
+
+ +
+
+ + + + + + + + +
void TimeField::setValue (unsigned long value)
+
+
+ +

Sets the value of this time field, in seconds.

+

If value is greater than or equal to maxHours() * 60 * 60, then it will be wrapped around to fall within the valid range.

+
See also:
value(), maxHours()
+ +

Definition at line 227 of file TimeField.cpp.

+ +
+
+ +
+
+ + + + + + + +
unsigned long TimeField::value () const [inline]
+
+
+ +

Returns the current value of this time field, in seconds.

+
See also:
setValue()
+ +

Definition at line 41 of file TimeField.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/classTimeField.png b/classTimeField.png new file mode 100644 index 00000000..17eccb13 Binary files /dev/null and b/classTimeField.png differ diff --git a/classes.html b/classes.html new file mode 100644 index 00000000..196d94fc --- /dev/null +++ b/classes.html @@ -0,0 +1,99 @@ + + + + +ArduinoLibs: Class Index + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
Class Index
+
+
+
B | C | D | F | I | L | M | R | S | T
+ +
  B  
+
DS1307RTC   I2CMaster   Melody   
  S  
+
BlinkLED   DS3232RTC   IntField   
  R  
+
SoftI2C   
BoolField   
  F  
+
  L  
+
RTC   
  T  
+
  C  
+
Field   LCD   RTCAlarm   TextField   
ChaseLEDs   Form   ListField   RTCDate   TimeField   
  D  
+
  I  
+
  M  
+
RTCTime   
B | C | D | F | I | L | M | R | S | T
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/clock_shield.jpg b/clock_shield.jpg new file mode 100644 index 00000000..0d4673d4 Binary files /dev/null and b/clock_shield.jpg differ diff --git a/closed.png b/closed.png new file mode 100644 index 00000000..b7d4bd9f Binary files /dev/null and b/closed.png differ diff --git a/doxygen.css b/doxygen.css new file mode 100644 index 00000000..74445fe1 --- /dev/null +++ b/doxygen.css @@ -0,0 +1,835 @@ +/* The standard CSS for doxygen */ + +body, table, div, p, dl { + font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif; + font-size: 12px; +} + +/* @group Heading Levels */ + +h1 { + font-size: 150%; +} + +.title { + font-size: 150%; + font-weight: bold; + margin: 10px 2px; +} + +h2 { + font-size: 120%; +} + +h3 { + font-size: 100%; +} + +dt { + font-weight: bold; +} + +div.multicol { + -moz-column-gap: 1em; + -webkit-column-gap: 1em; + -moz-column-count: 3; + -webkit-column-count: 3; +} + +p.startli, p.startdd, p.starttd { + margin-top: 2px; +} + +p.endli { + margin-bottom: 0px; +} + +p.enddd { + margin-bottom: 4px; +} + +p.endtd { + margin-bottom: 2px; +} + +/* @end */ + +caption { + font-weight: bold; +} + +span.legend { + font-size: 70%; + text-align: center; +} + +h3.version { + font-size: 90%; + text-align: center; +} + +div.qindex, div.navtab{ + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; + margin: 2px; + padding: 2px; +} + +div.qindex, div.navpath { + width: 100%; + line-height: 140%; +} + +div.navtab { + margin-right: 15px; +} + +/* @group Link Styling */ + +a { + color: #3D578C; + font-weight: normal; + text-decoration: none; +} + +.contents a:visited { + color: #4665A2; +} + +a:hover { + text-decoration: underline; +} + +a.qindex { + font-weight: bold; +} + +a.qindexHL { + font-weight: bold; + background-color: #9CAFD4; + color: #ffffff; + border: 1px double #869DCA; +} + +.contents a.qindexHL:visited { + color: #ffffff; +} + +a.el { + font-weight: bold; +} + +a.elRef { +} + +a.code { + color: #4665A2; +} + +a.codeRef { + color: #4665A2; +} + +/* @end */ + +dl.el { + margin-left: -1cm; +} + +.fragment { + font-family: monospace, fixed; + font-size: 105%; +} + +pre.fragment { + border: 1px solid #C4CFE5; + background-color: #FBFCFD; + padding: 4px 6px; + margin: 4px 8px 4px 2px; + overflow: auto; + word-wrap: break-word; + font-size: 9pt; + line-height: 125%; +} + +div.ah { + background-color: black; + font-weight: bold; + color: #ffffff; + margin-bottom: 3px; + margin-top: 3px; + padding: 0.2em; + border: solid thin #333; + border-radius: 0.5em; + -webkit-border-radius: .5em; + -moz-border-radius: .5em; + box-shadow: 2px 2px 3px #999; + -webkit-box-shadow: 2px 2px 3px #999; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; + background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); + background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000); +} + +div.groupHeader { + margin-left: 16px; + margin-top: 12px; + font-weight: bold; +} + +div.groupText { + margin-left: 16px; + font-style: italic; +} + +body { + background: white; + color: black; + margin: 0; +} + +div.contents { + margin-top: 10px; + margin-left: 10px; + margin-right: 5px; +} + +td.indexkey { + background-color: #EBEFF6; + font-weight: bold; + border: 1px solid #C4CFE5; + margin: 2px 0px 2px 0; + padding: 2px 10px; +} + +td.indexvalue { + background-color: #EBEFF6; + border: 1px solid #C4CFE5; + padding: 2px 10px; + margin: 2px 0px; +} + +tr.memlist { + background-color: #EEF1F7; +} + +p.formulaDsp { + text-align: center; +} + +img.formulaDsp { + +} + +img.formulaInl { + vertical-align: middle; +} + +div.center { + text-align: center; + margin-top: 0px; + margin-bottom: 0px; + padding: 0px; +} + +div.center img { + border: 0px; +} + +address.footer { + text-align: right; + padding-right: 12px; +} + +img.footer { + border: 0px; + vertical-align: middle; +} + +/* @group Code Colorization */ + +span.keyword { + color: #008000 +} + +span.keywordtype { + color: #604020 +} + +span.keywordflow { + color: #e08000 +} + +span.comment { + color: #800000 +} + +span.preprocessor { + color: #806020 +} + +span.stringliteral { + color: #002080 +} + +span.charliteral { + color: #008080 +} + +span.vhdldigit { + color: #ff00ff +} + +span.vhdlchar { + color: #000000 +} + +span.vhdlkeyword { + color: #700070 +} + +span.vhdllogic { + color: #ff0000 +} + +/* @end */ + +/* +.search { + color: #003399; + font-weight: bold; +} + +form.search { + margin-bottom: 0px; + margin-top: 0px; +} + +input.search { + font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +*/ + +td.tiny { + font-size: 75%; +} + +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #A3B4D7; +} + +th.dirtab { + background: #EBEFF6; + font-weight: bold; +} + +hr { + height: 0px; + border: none; + border-top: 1px solid #4A6AAA; +} + +hr.footer { + height: 1px; +} + +/* @group Member Descriptions */ + +table.memberdecls { + border-spacing: 0px; + padding: 0px; +} + +.mdescLeft, .mdescRight, +.memItemLeft, .memItemRight, +.memTemplItemLeft, .memTemplItemRight, .memTemplParams { + background-color: #F9FAFC; + border: none; + margin: 4px; + padding: 1px 0 0 8px; +} + +.mdescLeft, .mdescRight { + padding: 0px 8px 4px 8px; + color: #555; +} + +.memItemLeft, .memItemRight, .memTemplParams { + border-top: 1px solid #C4CFE5; +} + +.memItemLeft, .memTemplItemLeft { + white-space: nowrap; +} + +.memItemRight { + width: 100%; +} + +.memTemplParams { + color: #4665A2; + white-space: nowrap; +} + +/* @end */ + +/* @group Member Details */ + +/* Styles for detailed member documentation */ + +.memtemplate { + font-size: 80%; + color: #4665A2; + font-weight: normal; + margin-left: 9px; +} + +.memnav { + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} + +.mempage { + width: 100%; +} + +.memitem { + padding: 0; + margin-bottom: 10px; + margin-right: 5px; +} + +.memname { + white-space: nowrap; + font-weight: bold; + margin-left: 6px; +} + +.memproto { + border-top: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 6px 0px 6px 0px; + color: #253555; + font-weight: bold; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + /* opera specific markup */ + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + border-top-right-radius: 8px; + border-top-left-radius: 8px; + /* firefox specific markup */ + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + -moz-border-radius-topright: 8px; + -moz-border-radius-topleft: 8px; + /* webkit specific markup */ + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + -webkit-border-top-right-radius: 8px; + -webkit-border-top-left-radius: 8px; + background-image:url('nav_f.png'); + background-repeat:repeat-x; + background-color: #E2E8F2; + +} + +.memdoc { + border-bottom: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 2px 5px; + background-color: #FBFCFD; + border-top-width: 0; + /* opera specific markup */ + border-bottom-left-radius: 8px; + border-bottom-right-radius: 8px; + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + /* firefox specific markup */ + -moz-border-radius-bottomleft: 8px; + -moz-border-radius-bottomright: 8px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 60%, #F7F8FB 95%, #EEF1F7); + /* webkit specific markup */ + -webkit-border-bottom-left-radius: 8px; + -webkit-border-bottom-right-radius: 8px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F7F8FB), to(#EEF1F7)); +} + +.paramkey { + text-align: right; +} + +.paramtype { + white-space: nowrap; +} + +.paramname { + color: #602020; + white-space: nowrap; +} +.paramname em { + font-style: normal; +} + +.params, .retval, .exception, .tparams { + border-spacing: 6px 2px; +} + +.params .paramname, .retval .paramname { + font-weight: bold; + vertical-align: top; +} + +.params .paramtype { + font-style: italic; + vertical-align: top; +} + +.params .paramdir { + font-family: "courier new",courier,monospace; + vertical-align: top; +} + + + + +/* @end */ + +/* @group Directory (tree) */ + +/* for the tree view */ + +.ftvtree { + font-family: sans-serif; + margin: 0px; +} + +/* these are for tree view when used as main index */ + +.directory { + font-size: 9pt; + font-weight: bold; + margin: 5px; +} + +.directory h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} + +/* +The following two styles can be used to replace the root node title +with an image of your choice. Simply uncomment the next two styles, +specify the name of your image and be sure to set 'height' to the +proper pixel height of your image. +*/ + +/* +.directory h3.swap { + height: 61px; + background-repeat: no-repeat; + background-image: url("yourimage.gif"); +} +.directory h3.swap span { + display: none; +} +*/ + +.directory > h3 { + margin-top: 0; +} + +.directory p { + margin: 0px; + white-space: nowrap; +} + +.directory div { + display: none; + margin: 0px; +} + +.directory img { + vertical-align: -30%; +} + +/* these are for tree view when not used as main index */ + +.directory-alt { + font-size: 100%; + font-weight: bold; +} + +.directory-alt h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} + +.directory-alt > h3 { + margin-top: 0; +} + +.directory-alt p { + margin: 0px; + white-space: nowrap; +} + +.directory-alt div { + display: none; + margin: 0px; +} + +.directory-alt img { + vertical-align: -30%; +} + +/* @end */ + +div.dynheader { + margin-top: 8px; +} + +address { + font-style: normal; + color: #2A3D61; +} + +table.doxtable { + border-collapse:collapse; +} + +table.doxtable td, table.doxtable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +table.doxtable th { + background-color: #374F7F; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; + text-align:left; +} + +.tabsearch { + top: 0px; + left: 10px; + height: 36px; + background-image: url('tab_b.png'); + z-index: 101; + overflow: hidden; + font-size: 13px; +} + +.navpath ul +{ + font-size: 11px; + background-image:url('tab_b.png'); + background-repeat:repeat-x; + height:30px; + line-height:30px; + color:#8AA0CC; + border:solid 1px #C2CDE4; + overflow:hidden; + margin:0px; + padding:0px; +} + +.navpath li +{ + list-style-type:none; + float:left; + padding-left:10px; + padding-right:15px; + background-image:url('bc_s.png'); + background-repeat:no-repeat; + background-position:right; + color:#364D7C; +} + +.navpath li.navelem a +{ + height:32px; + display:block; + text-decoration: none; + outline: none; +} + +.navpath li.navelem a:hover +{ + color:#6884BD; +} + +.navpath li.footer +{ + list-style-type:none; + float:right; + padding-left:10px; + padding-right:15px; + background-image:none; + background-repeat:no-repeat; + background-position:right; + color:#364D7C; + font-size: 8pt; +} + + +div.summary +{ + float: right; + font-size: 8pt; + padding-right: 5px; + width: 50%; + text-align: right; +} + +div.summary a +{ + white-space: nowrap; +} + +div.ingroups +{ + font-size: 8pt; + padding-left: 5px; + width: 50%; + text-align: left; +} + +div.ingroups a +{ + white-space: nowrap; +} + +div.header +{ + background-image:url('nav_h.png'); + background-repeat:repeat-x; + background-color: #F9FAFC; + margin: 0px; + border-bottom: 1px solid #C4CFE5; +} + +div.headertitle +{ + padding: 5px 5px 5px 10px; +} + +dl +{ + padding: 0 0 0 10px; +} + +dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug +{ + border-left:4px solid; + padding: 0 0 0 6px; +} + +dl.note +{ + border-color: #D0C000; +} + +dl.warning, dl.attention +{ + border-color: #FF0000; +} + +dl.pre, dl.post, dl.invariant +{ + border-color: #00D000; +} + +dl.deprecated +{ + border-color: #505050; +} + +dl.todo +{ + border-color: #00C0E0; +} + +dl.test +{ + border-color: #3030E0; +} + +dl.bug +{ + border-color: #C08050; +} + +#projectlogo +{ + text-align: center; + vertical-align: bottom; + border-collapse: separate; +} + +#projectlogo img +{ + border: 0px none; +} + +#projectname +{ + font: 300% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 2px 0px; +} + +#projectbrief +{ + font: 120% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#projectnumber +{ + font: 50% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#titlearea +{ + padding: 0px; + margin: 0px; + width: 100%; + border-bottom: 1px solid #5373B4; +} + +.image +{ + text-align: center; +} + +.dotgraph +{ + text-align: center; +} + +.mscgraph +{ + text-align: center; +} + +.caption +{ + font-weight: bold; +} + diff --git a/doxygen.png b/doxygen.png new file mode 100644 index 00000000..635ed52f Binary files /dev/null and b/doxygen.png differ diff --git a/files.html b/files.html new file mode 100644 index 00000000..9dd3f9e1 --- /dev/null +++ b/files.html @@ -0,0 +1,119 @@ + + + + +ArduinoLibs: File List + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
File List
+
+
+
Here is a list of all documented files with brief descriptions:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
BlinkLED.cpp [code]
BlinkLED.h [code]
BoolField.cpp [code]
BoolField.h [code]
ChaseLEDs.cpp [code]
ChaseLEDs.h [code]
DS1307RTC.cpp [code]
DS1307RTC.h [code]
DS3232RTC.cpp [code]
DS3232RTC.h [code]
Field.cpp [code]
Field.h [code]
Form.cpp [code]
Form.h [code]
I2CMaster.cpp [code]
I2CMaster.h [code]
IntField.cpp [code]
IntField.h [code]
LCD.cpp [code]
LCD.h [code]
ListField.cpp [code]
ListField.h [code]
Melody.cpp [code]
Melody.h [code]
PowerSave.cpp [code]
PowerSave.h [code]
RTC.cpp [code]
RTC.h [code]
SoftI2C.cpp [code]
SoftI2C.h [code]
TextField.cpp [code]
TextField.h [code]
TimeField.cpp [code]
TimeField.h [code]
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/functions.html b/functions.html new file mode 100644 index 00000000..9e00122e --- /dev/null +++ b/functions.html @@ -0,0 +1,637 @@ + + + + +ArduinoLibs: Class Members + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + + + +
+
+
Here is a list of all documented class members with links to the class documentation for each member:
+ +

- a -

+ + +

- b -

+ + +

- c -

+ + +

- d -

+ + +

- e -

+ + +

- f -

+ + +

- g -

+ + +

- h -

+ + +

- i -

+ + +

- l -

+ + +

- m -

+ + +

- n -

+ + +

- o -

+ + +

- p -

+ + +

- r -

+ + +

- s -

+ + +

- t -

+ + +

- u -

+ + +

- v -

+ + +

- w -

+ + +

- y -

+ + +

- ~ -

+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/functions_enum.html b/functions_enum.html new file mode 100644 index 00000000..3afabaab --- /dev/null +++ b/functions_enum.html @@ -0,0 +1,96 @@ + + + + +ArduinoLibs: Class Members - Enumerations + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + + +
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/functions_eval.html b/functions_eval.html new file mode 100644 index 00000000..01fede90 --- /dev/null +++ b/functions_eval.html @@ -0,0 +1,102 @@ + + + + +ArduinoLibs: Class Members - Enumerator + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + + +
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/functions_func.html b/functions_func.html new file mode 100644 index 00000000..010964bd --- /dev/null +++ b/functions_func.html @@ -0,0 +1,585 @@ + + + + +ArduinoLibs: Class Members - Functions + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + + + +
+
+  + +

- a -

+ + +

- b -

+ + +

- c -

+ + +

- d -

+ + +

- e -

+ + +

- f -

+ + +

- g -

+ + +

- h -

+ + +

- i -

+ + +

- l -

+ + +

- m -

+ + +

- n -

+ + +

- o -

+ + +

- p -

+ + +

- r -

+ + +

- s -

+ + +

- t -

+ + +

- u -

+ + +

- v -

+ + +

- w -

+ + +

- ~ -

+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/functions_vars.html b/functions_vars.html new file mode 100644 index 00000000..3a7173ac --- /dev/null +++ b/functions_vars.html @@ -0,0 +1,128 @@ + + + + +ArduinoLibs: Class Members - Variables + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + + +
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/group__power__save.html b/group__power__save.html new file mode 100644 index 00000000..a6a1eaaf --- /dev/null +++ b/group__power__save.html @@ -0,0 +1,197 @@ + + + + +ArduinoLibs: Power saving utility functions + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ +
+
+ +
+
Power saving utility functions
+
+
+ + + + + + + + + +

+Enumerations

enum  SleepDuration {
+  SLEEP_15_MS, +SLEEP_30_MS, +SLEEP_60_MS, +SLEEP_120_MS, +
+  SLEEP_250_MS, +SLEEP_500_MS, +SLEEP_1_SEC, +SLEEP_2_SEC, +
+  SLEEP_4_SEC, +SLEEP_8_SEC +
+ }
 Duration to put the CPU to sleep with sleepFor(). More...

+Functions

void sleepFor (SleepDuration duration, uint8_t mode)
 Puts the CPU to sleep for a specific duration.The analog to digital converter and the brown out detector will be disabled during sleep mode.
+void unusedPin (uint8_t pin)
 Marks an I/O pin as unused.This function sets pin to be an input with pullups enabled, which will reduce power consumption compared to pins that are left floating.
+

Detailed Description

+

The functions in this module assist with reducing power consumption on Arduino boards by disabling features that are not used or putting the device to sleep when it is inactive.

+

Enumeration Type Documentation

+ +
+
+ + + + +
enum SleepDuration
+
+
+ +

Duration to put the CPU to sleep with sleepFor().

+
See also:
sleepFor()
+
Enumerator:
+ + + + + + + + + + +
SLEEP_15_MS  +

Sleep for 15 milliseconds.

+
SLEEP_30_MS  +

Sleep for 30 milliseconds.

+
SLEEP_60_MS  +

Sleep for 60 milliseconds.

+
SLEEP_120_MS  +

Sleep for 120 milliseconds.

+
SLEEP_250_MS  +

Sleep for 250 milliseconds.

+
SLEEP_500_MS  +

Sleep for 500 milliseconds.

+
SLEEP_1_SEC  +

Sleep for 1 second.

+
SLEEP_2_SEC  +

Sleep for 2 seconds.

+
SLEEP_4_SEC  +

Sleep for 4 seconds.

+
SLEEP_8_SEC  +

Sleep for 8 seconds.

+
+
+
+ +

Definition at line 38 of file PowerSave.h.

+ +
+
+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
void sleepFor (SleepDuration duration,
uint8_t mode 
)
+
+
+ +

Puts the CPU to sleep for a specific duration.The analog to digital converter and the brown out detector will be disabled during sleep mode.

+

The mode parameter indicates the mode to use when the device is sleeping. The default is SLEEP_MODE_IDLE.

+ +

Definition at line 132 of file PowerSave.cpp.

+ +
+
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/hierarchy.html b/hierarchy.html new file mode 100644 index 00000000..6ed17227 --- /dev/null +++ b/hierarchy.html @@ -0,0 +1,113 @@ + + + + +ArduinoLibs: Class Hierarchy + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
Class Hierarchy
+
+
+
This inheritance list is sorted roughly, but not completely, alphabetically:
+
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/index.html b/index.html new file mode 100644 index 00000000..5dd998aa --- /dev/null +++ b/index.html @@ -0,0 +1,117 @@ + + + + +ArduinoLibs: Main Page + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ +
+
+
+
ArduinoLibs Documentation
+
+
+

This distribution contains a bunch of libraries and example applications that I have made for Arduino, covering a variety of tasks from blinking LED's to LCD's and RTC-based alarm clocks. They are distributed under the terms of the MIT license, with the source code available from github.

+

For more information on these libraries, to report bugs, or to suggest improvements, please contact the author Rhys Weatherley via email.

+

+Freetronics LCD Shield

+
    +
  • LCD class to manage the extended features of the Freetronics LCD shield.
  • +
  • Form and Field classes to build simple property sheet UI's on LCD displays.
  • +
  • Hello World example for the Freetronics LCD shield.
  • +
  • Form example for LCD displays.
  • +
+

+BlinkLED Utility Library

+
    +
  • BlinkLED class that simplifies the process of blinking a LED connected to a output pin.
  • +
  • ChaseLEDs class that simplifies the process of performing a LED chase over several output pins.
  • +
  • Blink example of using BlinkLED.
  • +
  • Cylon example of using ChaseLEDs to simulate the Cylon eye effect from Battlestar Galactica.
  • +
  • StarTrek example for lighting a starship Enterprise model kit.
  • +
+

+I2C Utility Library

+
    +
  • I2CMaster abstract class that provides an improved API for implementing an I2C master.
  • +
  • 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.
  • +
+

+Realtime Clock Library

+
    +
  • 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 millis().
  • +
  • DS1307RTC class that talks to the DS1307 realtime clock chip via I2C.
  • +
  • DS3232RTC class that talks to the DS3232 realtime clock chip via I2C.
  • +
  • Alarm Clock example that uses the DS1307 or DS3232 realtime clock and the LCD library to implement an alarm clock.
  • +
+

+Other

+ +
+ +
+ All Classes Files Functions Variables Enumerations Enumerator
+ + +
+ +
+ + + + diff --git a/installdox b/installdox new file mode 100755 index 00000000..edf5bbfe --- /dev/null +++ b/installdox @@ -0,0 +1,112 @@ +#!/usr/bin/perl + +%subst = ( ); +$quiet = 0; + +while ( @ARGV ) { + $_ = shift @ARGV; + if ( s/^-// ) { + if ( /^l(.*)/ ) { + $v = ($1 eq "") ? shift @ARGV : $1; + ($v =~ /\/$/) || ($v .= "/"); + $_ = $v; + if ( /(.+)\@(.+)/ ) { + if ( exists $subst{$1} ) { + $subst{$1} = $2; + } else { + print STDERR "Unknown tag file $1 given with option -l\n"; + &usage(); + } + } else { + print STDERR "Argument $_ is invalid for option -l\n"; + &usage(); + } + } + elsif ( /^q/ ) { + $quiet = 1; + } + elsif ( /^\?|^h/ ) { + &usage(); + } + else { + print STDERR "Illegal option -$_\n"; + &usage(); + } + } + else { + push (@files, $_ ); + } +} + +foreach $sub (keys %subst) +{ + if ( $subst{$sub} eq "" ) + { + print STDERR "No substitute given for tag file `$sub'\n"; + &usage(); + } + elsif ( ! $quiet && $sub ne "_doc" && $sub ne "_cgi" ) + { + print "Substituting $subst{$sub} for each occurrence of tag file $sub\n"; + } +} + +if ( ! @files ) { + if (opendir(D,".")) { + foreach $file ( readdir(D) ) { + $match = ".html"; + next if ( $file =~ /^\.\.?$/ ); + ($file =~ /$match/) && (push @files, $file); + ($file =~ /\.svg/) && (push @files, $file); + ($file =~ "navtree.js") && (push @files, $file); + } + closedir(D); + } +} + +if ( ! @files ) { + print STDERR "Warning: No input files given and none found!\n"; +} + +foreach $f (@files) +{ + if ( ! $quiet ) { + print "Editing: $f...\n"; + } + $oldf = $f; + $f .= ".bak"; + unless (rename $oldf,$f) { + print STDERR "Error: cannot rename file $oldf\n"; + exit 1; + } + if (open(F,"<$f")) { + unless (open(G,">$oldf")) { + print STDERR "Error: opening file $oldf for writing\n"; + exit 1; + } + if ($oldf ne "tree.js") { + while () { + s/doxygen\=\"([^ \"\:\t\>\<]*)\:([^ \"\t\>\<]*)\" (xlink:href|href|src)=\"\2/doxygen\=\"$1:$subst{$1}\" \3=\"$subst{$1}/g; + print G "$_"; + } + } + else { + while () { + s/\"([^ \"\:\t\>\<]*)\:([^ \"\t\>\<]*)\", \"\2/\"$1:$subst{$1}\" ,\"$subst{$1}/g; + print G "$_"; + } + } + } + else { + print STDERR "Warning file $f does not exist\n"; + } + unlink $f; +} + +sub usage { + print STDERR "Usage: installdox [options] [html-file [html-file ...]]\n"; + print STDERR "Options:\n"; + print STDERR " -l tagfile\@linkName tag file + URL or directory \n"; + print STDERR " -q Quiet mode\n\n"; + exit 1; +} diff --git a/jquery.js b/jquery.js new file mode 100644 index 00000000..c052173a --- /dev/null +++ b/jquery.js @@ -0,0 +1,54 @@ +/* + * jQuery JavaScript Library v1.3.2 + * http://jquery.com/ + * + * Copyright (c) 2009 John Resig + * Dual licensed under the MIT and GPL licenses. + * http://docs.jquery.com/License + * + * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) + * Revision: 6246 + */ +(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); +/* + * Sizzle CSS Selector Engine - v0.9.3 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0) +{I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function() +{G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); +/* + * jQuery UI 1.7.2 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI + */ +jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.2",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);;/* * jQuery UI Resizable 1.7.2 + * + * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * http://docs.jquery.com/UI/Resizables + * + * Depends: + * ui.core.js + */ +(function(c){c.widget("ui.resizable",c.extend({},c.ui.mouse,{_init:function(){var e=this,j=this.options;this.element.addClass("ui-resizable");c.extend(this,{_aspectRatio:!!(j.aspectRatio),aspectRatio:j.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:j.helper||j.ghost||j.animate?j.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css("position"))&&c.browser.opera){this.element.css({position:"relative",top:"auto",left:"auto"})}this.element.wrap(c('
').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=j.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var k=this.handles.split(",");this.handles={};for(var f=0;f
');if(/sw|se|ne|nw/.test(h)){g.css({zIndex:++j.zIndex})}if("se"==h){g.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[h]=".ui-resizable-"+h;this.element.append(g)}}this._renderAxis=function(p){p=p||this.element;for(var m in this.handles){if(this.handles[m].constructor==String){this.handles[m]=c(this.handles[m],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var n=c(this.handles[m],this.element),o=0;o=/sw|ne|nw|se|n|s/.test(m)?n.outerHeight():n.outerWidth();var l=["padding",/ne|nw|n/.test(m)?"Top":/se|sw|s/.test(m)?"Bottom":/^e$/.test(m)?"Right":"Left"].join("");p.css(l,o);this._proportionallyResize()}if(!c(this.handles[m]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!e.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}e.axis=i&&i[1]?i[1]:"se"}});if(j.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){c(this).removeClass("ui-resizable-autohide");e._handles.show()},function(){if(!e.resizing){c(this).addClass("ui-resizable-autohide");e._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var d=function(f){c(f).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){d(this.element);var e=this.element;e.parent().append(this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")})).end().remove()}this.originalElement.css("resize",this.originalResizeStyle);d(this.originalElement)},_mouseCapture:function(e){var f=false;for(var d in this.handles){if(c(this.handles[d])[0]==e.target){f=true}}return this.options.disabled||!!f},_mouseStart:function(f){var i=this.options,e=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(d.is(".ui-draggable")||(/absolute/).test(d.css("position"))){d.css({position:"absolute",top:e.top,left:e.left})}if(c.browser.opera&&(/relative/).test(d.css("position"))){d.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var j=b(this.helper.css("left")),g=b(this.helper.css("top"));if(i.containment){j+=c(i.containment).scrollLeft()||0;g+=c(i.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:j,top:g};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:j,top:g};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:f.pageX,top:f.pageY};this.aspectRatio=(typeof i.aspectRatio=="number")?i.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var h=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",h=="auto"?this.axis+"-resize":h);d.addClass("ui-resizable-resizing");this._propagate("start",f);return true},_mouseDrag:function(d){var g=this.helper,f=this.options,l={},p=this,i=this.originalMousePosition,m=this.axis;var q=(d.pageX-i.left)||0,n=(d.pageY-i.top)||0;var h=this._change[m];if(!h){return false}var k=h.apply(this,[d,q,n]),j=c.browser.msie&&c.browser.version<7,e=this.sizeDiff;if(this._aspectRatio||d.shiftKey){k=this._updateRatio(k,d)}k=this._respectSize(k,d);this._propagate("resize",d);g.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(k);this._trigger("resize",d,this.ui());return false},_mouseStop:function(g){this.resizing=false;var h=this.options,l=this;if(this._helper){var f=this._proportionallyResizeElements,d=f.length&&(/textarea/i).test(f[0].nodeName),e=d&&c.ui.hasScroll(f[0],"left")?0:l.sizeDiff.height,j=d?0:l.sizeDiff.width;var m={width:(l.size.width-j),height:(l.size.height-e)},i=(parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left))||null,k=(parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top))||null;if(!h.animate){this.element.css(c.extend(m,{top:k,left:i}))}l.helper.height(l.size.height);l.helper.width(l.size.width);if(this._helper&&!h.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",g);if(this._helper){this.helper.remove()}return false},_updateCache:function(d){var e=this.options;this.offset=this.helper.offset();if(a(d.left)){this.position.left=d.left}if(a(d.top)){this.position.top=d.top}if(a(d.height)){this.size.height=d.height}if(a(d.width)){this.size.width=d.width}},_updateRatio:function(g,f){var h=this.options,i=this.position,e=this.size,d=this.axis;if(g.height){g.width=(e.height*this.aspectRatio)}else{if(g.width){g.height=(e.width/this.aspectRatio)}}if(d=="sw"){g.left=i.left+(e.width-g.width);g.top=null}if(d=="nw"){g.top=i.top+(e.height-g.height);g.left=i.left+(e.width-g.width)}return g},_respectSize:function(k,f){var i=this.helper,h=this.options,q=this._aspectRatio||f.shiftKey,p=this.axis,s=a(k.width)&&h.maxWidth&&(h.maxWidthk.width),r=a(k.height)&&h.minHeight&&(h.minHeight>k.height);if(g){k.width=h.minWidth}if(r){k.height=h.minHeight}if(s){k.width=h.maxWidth}if(l){k.height=h.maxHeight}var e=this.originalPosition.left+this.originalSize.width,n=this.position.top+this.size.height;var j=/sw|nw|w/.test(p),d=/nw|ne|n/.test(p);if(g&&j){k.left=e-h.minWidth}if(s&&j){k.left=e-h.maxWidth}if(r&&d){k.top=n-h.minHeight}if(l&&d){k.top=n-h.maxHeight}var m=!k.width&&!k.height;if(m&&!k.left&&k.top){k.top=null}else{if(m&&!k.top&&k.left){k.left=null}}return k},_proportionallyResize:function(){var j=this.options;if(!this._proportionallyResizeElements.length){return}var f=this.helper||this.element;for(var e=0;e');var d=c.browser.msie&&c.browser.version<7,f=(d?1:0),g=(d?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+g,height:this.element.outerHeight()+g,position:"absolute",left:this.elementOffset.left-f+"px",top:this.elementOffset.top-f+"px",zIndex:++h.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(f,e,d){return{width:this.originalSize.width+e}},w:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{left:h.left+e,width:f.width-e}},n:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{top:h.top+d,height:f.height-d}},s:function(f,e,d){return{height:this.originalSize.height+d}},se:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},sw:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[f,e,d]))},ne:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},nw:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[f,e,d]))}},_propagate:function(e,d){c.ui.plugin.call(this,e,[d,this.ui()]);(e!="resize"&&this._trigger(e,d,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}));c.extend(c.ui.resizable,{version:"1.7.2",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});c.ui.plugin.add("resizable","alsoResize",{start:function(e,f){var d=c(this).data("resizable"),g=d.options;_store=function(h){c(h).each(function(){c(this).data("resizable-alsoresize",{width:parseInt(c(this).width(),10),height:parseInt(c(this).height(),10),left:parseInt(c(this).css("left"),10),top:parseInt(c(this).css("top"),10)})})};if(typeof(g.alsoResize)=="object"&&!g.alsoResize.parentNode){if(g.alsoResize.length){g.alsoResize=g.alsoResize[0];_store(g.alsoResize)}else{c.each(g.alsoResize,function(h,i){_store(h)})}}else{_store(g.alsoResize)}},resize:function(f,h){var e=c(this).data("resizable"),i=e.options,g=e.originalSize,k=e.originalPosition;var j={height:(e.size.height-g.height)||0,width:(e.size.width-g.width)||0,top:(e.position.top-k.top)||0,left:(e.position.left-k.left)||0},d=function(l,m){c(l).each(function(){var p=c(this),q=c(this).data("resizable-alsoresize"),o={},n=m&&m.length?m:["width","height","top","left"];c.each(n||["width","height","top","left"],function(r,t){var s=(q[t]||0)+(j[t]||0);if(s&&s>=0){o[t]=s||null}});if(/relative/.test(p.css("position"))&&c.browser.opera){e._revertToRelativePosition=true;p.css({position:"absolute",top:"auto",left:"auto"})}p.css(o)})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.nodeType){c.each(i.alsoResize,function(l,m){d(l,m)})}else{d(i.alsoResize)}},stop:function(e,f){var d=c(this).data("resizable");if(d._revertToRelativePosition&&c.browser.opera){d._revertToRelativePosition=false;el.css({position:"relative"})}c(this).removeData("resizable-alsoresize-start")}});c.ui.plugin.add("resizable","animate",{stop:function(h,m){var n=c(this).data("resizable"),i=n.options;var g=n._proportionallyResizeElements,d=g.length&&(/textarea/i).test(g[0].nodeName),e=d&&c.ui.hasScroll(g[0],"left")?0:n.sizeDiff.height,k=d?0:n.sizeDiff.width;var f={width:(n.size.width-k),height:(n.size.height-e)},j=(parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left))||null,l=(parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top))||null;n.element.animate(c.extend(f,l&&j?{top:l,left:j}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var o={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};if(g&&g.length){c(g[0]).css({width:o.width,height:o.height})}n._updateCache(o);n._propagate("resize",h)}})}});c.ui.plugin.add("resizable","containment",{start:function(e,q){var s=c(this).data("resizable"),i=s.options,k=s.element;var f=i.containment,j=(f instanceof c)?f.get(0):(/parent/.test(f))?k.parent().get(0):f;if(!j){return}s.containerElement=c(j);if(/document/.test(f)||f==document){s.containerOffset={left:0,top:0};s.containerPosition={left:0,top:0};s.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var m=c(j),h=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){h[p]=b(m.css("padding"+o))});s.containerOffset=m.offset();s.containerPosition=m.position();s.containerSize={height:(m.innerHeight()-h[3]),width:(m.innerWidth()-h[1])};var n=s.containerOffset,d=s.containerSize.height,l=s.containerSize.width,g=(c.ui.hasScroll(j,"left")?j.scrollWidth:l),r=(c.ui.hasScroll(j)?j.scrollHeight:d);s.parentData={element:j,left:n.left,top:n.top,width:g,height:r}}},resize:function(f,p){var s=c(this).data("resizable"),h=s.options,e=s.containerSize,n=s.containerOffset,l=s.size,m=s.position,q=s._aspectRatio||f.shiftKey,d={top:0,left:0},g=s.containerElement;if(g[0]!=document&&(/static/).test(g.css("position"))){d=n}if(m.left<(s._helper?n.left:0)){s.size.width=s.size.width+(s._helper?(s.position.left-n.left):(s.position.left-d.left));if(q){s.size.height=s.size.width/h.aspectRatio}s.position.left=h.helper?n.left:0}if(m.top<(s._helper?n.top:0)) +{s.size.height=s.size.height+(s._helper?(s.position.top-n.top):s.position.top);if(q){s.size.width=s.size.height*h.aspectRatio}s.position.top=s._helper?n.top:0}s.offset.left=s.parentData.left+s.position.left;s.offset.top=s.parentData.top+s.position.top;var k=Math.abs((s._helper?s.offset.left-d.left:(s.offset.left-d.left))+s.sizeDiff.width),r=Math.abs((s._helper?s.offset.top-d.top:(s.offset.top-n.top))+s.sizeDiff.height);var j=s.containerElement.get(0)==s.element.parent().get(0),i=/relative|absolute/.test(s.containerElement.css("position"));if(j&&i){k-=s.parentData.left}if(k+s.size.width>=s.parentData.width){s.size.width=s.parentData.width-k;if(q){s.size.height=s.size.width/s.aspectRatio}}if(r+s.size.height>=s.parentData.height){s.size.height=s.parentData.height-r;if(q){s.size.width=s.size.height*s.aspectRatio}}},stop:function(e,m){var p=c(this).data("resizable"),f=p.options,k=p.position,l=p.containerOffset,d=p.containerPosition,g=p.containerElement;var i=c(p.helper),q=i.offset(),n=i.outerWidth()-p.sizeDiff.width,j=i.outerHeight()-p.sizeDiff.height;if(p._helper&&!f.animate&&(/relative/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}if(p._helper&&!f.animate&&(/static/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}}});c.ui.plugin.add("resizable","ghost",{start:function(f,g){var d=c(this).data("resizable"),h=d.options,e=d.size;d.ghost=d.originalElement.clone();d.ghost.css({opacity:0.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof h.ghost=="string"?h.ghost:"");d.ghost.appendTo(d.helper)},resize:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost){d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})}},stop:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost&&d.helper){d.helper.get(0).removeChild(d.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(d,l){var n=c(this).data("resizable"),g=n.options,j=n.size,h=n.originalSize,i=n.originalPosition,m=n.axis,k=g._aspectRatio||d.shiftKey;g.grid=typeof g.grid=="number"?[g.grid,g.grid]:g.grid;var f=Math.round((j.width-h.width)/(g.grid[0]||1))*(g.grid[0]||1),e=Math.round((j.height-h.height)/(g.grid[1]||1))*(g.grid[1]||1);if(/^(se|s|e)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e}else{if(/^(ne)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e}else{if(/^(sw)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.left=i.left-f}else{n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e;n.position.left=i.left-f}}}}});var b=function(d){return parseInt(d,10)||0};var a=function(d){return !isNaN(parseInt(d,10))}})(jQuery);; +/** + * jQuery.ScrollTo - Easy element scrolling using jQuery. + * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com + * Licensed under GPL license (http://www.opensource.org/licenses/gpl-license.php). + * Date: 2/8/2008 + * @author Ariel Flesler + * @version 1.3.2 + */ +;(function($){var o=$.scrollTo=function(a,b,c){o.window().scrollTo(a,b,c)};o.defaults={axis:'y',duration:1};o.window=function(){return $($.browser.safari?'body':'html')};$.fn.scrollTo=function(l,m,n){if(typeof m=='object'){n=m;m=0}n=$.extend({},o.defaults,n);m=m||n.speed||n.duration;n.queue=n.queue&&n.axis.length>1;if(n.queue)m/=2;n.offset=j(n.offset);n.over=j(n.over);return this.each(function(){var a=this,b=$(a),t=l,c,d={},w=b.is('html,body');switch(typeof t){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(t)){t=j(t);break}t=$(t,this);case'object':if(t.is||t.style)c=(t=$(t)).offset()}$.each(n.axis.split(''),function(i,f){var P=f=='x'?'Left':'Top',p=P.toLowerCase(),k='scroll'+P,e=a[k],D=f=='x'?'Width':'Height';if(c){d[k]=c[p]+(w?0:e-b.offset()[p]);if(n.margin){d[k]-=parseInt(t.css('margin'+P))||0;d[k]-=parseInt(t.css('border'+P+'Width'))||0}d[k]+=n.offset[p]||0;if(n.over[p])d[k]+=t[D.toLowerCase()]()*n.over[p]}else d[k]=t[p];if(/^\d+$/.test(d[k]))d[k]=d[k]<=0?0:Math.min(d[k],h(D));if(!i&&n.queue){if(e!=d[k])g(n.onAfterFirst);delete d[k]}});g(n.onAfter);function g(a){b.animate(d,m,n.easing,a&&function(){a.call(this,l)})};function h(D){var b=w?$.browser.opera?document.body:document.documentElement:a;return b['scroll'+D]-b['client'+D]}})};function j(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery); + diff --git a/kitten_minimal.jpg b/kitten_minimal.jpg new file mode 100644 index 00000000..1c3fff74 Binary files /dev/null and b/kitten_minimal.jpg differ diff --git a/lcd-form_8dox.html b/lcd-form_8dox.html new file mode 100644 index 00000000..280fd6d5 --- /dev/null +++ b/lcd-form_8dox.html @@ -0,0 +1,88 @@ + + + + +ArduinoLibs: lcd-form.dox File Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
lcd-form.dox File Reference
+
+
+ +
+

Detailed Description

+
+

Definition in file lcd-form.dox.

+
+ + + + +
+ +
+ + + + diff --git a/lcd-helloworld_8dox.html b/lcd-helloworld_8dox.html new file mode 100644 index 00000000..32e91ba9 --- /dev/null +++ b/lcd-helloworld_8dox.html @@ -0,0 +1,88 @@ + + + + +ArduinoLibs: lcd-helloworld.dox File Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
lcd-helloworld.dox File Reference
+
+
+ +
+

Detailed Description

+
+

Definition in file lcd-helloworld.dox.

+
+ + + + +
+ +
+ + + + diff --git a/lcd_form.html b/lcd_form.html new file mode 100644 index 00000000..d2fc7ee3 --- /dev/null +++ b/lcd_form.html @@ -0,0 +1,212 @@ + + + + +ArduinoLibs: Form example for LCD displays + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ +
+
+
+
Form example for LCD displays
+
+
+

The Form and Field classes simplify the process of building user interfaces for Arduino projects that use a Freetronics LCD 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.

+
+FormText.png +
+

We start by including the classes from the library that we will need:

+
#include <LCD.h>
+#include <Form.h>
+#include <TextField.h>
+#include <TimeField.h>
+#include <IntField.h>
+#include <BoolField.h>
+

+

Next, we initialize the LCD display, create the main form, and populate it with fields:

+
LCD lcd;
+Form mainForm(lcd);
+TextField welcomeField(mainForm, "Form example", "v1.0");
+TimeField timeField(mainForm, "Time since reset", 24, TIMEFIELD_READ_ONLY);
+IntField volumeField(mainForm, "Volume", 0, 100, 5, 85, "%");
+BoolField ledField(mainForm, "Status LED", "On", "Off", true);
+TimeField durationField(mainForm, "Timer duration", 24, TIMEFIELD_READ_WRITE);
+

+

Each field has a specific type, which may be one of the following classes:

+
    +
  • BoolField displays a boolean on/off value with the Up, Down, or Select buttons used to toggle its state.
  • +
  • IntField displays an integer value within a specified range, with the Up and Down buttons used to modify the value.
  • +
  • TextField displays a read-only value, which is typically used for status messages and program results.
  • +
  • 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:

+
    +
  • welcomeField to display the program's name and version.
  • +
  • timeField to display the number of seconds since reset, wrapping around after 24 hours. This field is read-only.
  • +
  • volumeField which displays a volume between 0 and 100, with an Up/Down step of 5, and a suffix of "%".
  • +
  • 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.
  • +
  • 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 it for the first time:

+
#define STATUS_LED 13
+
+void setup() {
+  // Status LED initially on.
+  pinMode(STATUS_LED, OUTPUT);
+  digitalWrite(STATUS_LED, HIGH);
+  
+  // Enable the screen saver, which will automatically blank the screen after 10 seconds.
+  // The screen will wake up again when a button is pressed or lcd.display() is called.
+  lcd.enableScreenSaver();
+  
+  // Show the main form for the first time.
+  mainForm.show();
+}
+

+

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 loop function which retrieves button events from LCD::getButton() and dispatches them to the form:

+
void loop() {
+  // Update the number of seconds since reset:
+  timeField.setValue(millis() / 1000);
+
+  // Dispatch button events to the main form.
+  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);
+    }
+  }
+}
+

+

The full source code for the example follows:

+
/*
+This example demonstrates how to use the Form and Field classes from the
+LCD library to provide a simple UI on the 16x2 LCD display.
+
+This example is placed into the public domain.
+*/
+
+// include the library code:
+#include <LCD.h>
+#include <Form.h>
+#include <TextField.h>
+#include <TimeField.h>
+#include <IntField.h>
+#include <BoolField.h>
+
+// Initialize the LCD
+LCD lcd;
+
+// Note: if you are using the USBDroid and have reassigned pin D9 on the LCD shield to some
+// other pin (e.g. A1), then you will need to initialize the shield with something like:
+// LCD lcd(A1);
+// See also: http://www.freetronics.com/pages/combining-the-lcd-keypad-shield-and-the-usbdroid
+
+// Create the main form and its fields.
+Form mainForm(lcd);
+TextField welcomeField(mainForm, "Form example", "v1.0");
+TimeField timeField(mainForm, "Time since reset", 24, TIMEFIELD_READ_ONLY);
+IntField volumeField(mainForm, "Volume", 0, 100, 5, 85, "%");
+BoolField ledField(mainForm, "Status LED", "On", "Off", true);
+TimeField durationField(mainForm, "Timer duration", 24, TIMEFIELD_READ_WRITE);
+
+#define STATUS_LED 13
+
+void setup() {
+  // Status LED initially on.
+  pinMode(STATUS_LED, OUTPUT);
+  digitalWrite(STATUS_LED, HIGH);
+  
+  // Enable the screen saver, which will automatically blank the screen after 10 seconds.
+  // The screen will wake up again when a button is pressed or lcd.display() is called.
+  lcd.enableScreenSaver();
+  
+  // Show the main form for the first time.
+  mainForm.show();
+}
+
+void loop() {
+  // Update the number of seconds since reset:
+  timeField.setValue(millis() / 1000);
+
+  // Dispatch button events to the main form.
+  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);
+    }
+  }
+}
+
+
+ + + + +
+ +
+ + + + diff --git a/lcd_hello_world.html b/lcd_hello_world.html new file mode 100644 index 00000000..7bd2a791 --- /dev/null +++ b/lcd_hello_world.html @@ -0,0 +1,162 @@ + + + + +ArduinoLibs: Hello World for Freetronics LCD + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ +
+
+
+
Hello World for Freetronics LCD
+
+
+

The LCD class provides an enhanced version of the standard Arduino LiquidCrystal library that supports the additional features of the Freetronics LCD 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.

+
+HelloWorld.png +
+

We start by including the library and initializing it:

+
#include <LCD.h>
+LCD 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 this page. In that case, the initialization sequence would look something like this instead:

+
LCD lcd(A1);
+

The next step is to enable the screen saver and print some text in the setup function:

+
void setup() {
+  lcd.enableScreenSaver();
+  lcd.print("hello, world!");
+}
+

+

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 loop function we print the number of seconds since startup to the second line of the LCD display:

+
void loop() {
+  lcd.setCursor(0, 1);
+  lcd.print(millis() / 1000);
+

+

We then print the name of the button that is currently pressed:

+
  lcd.setCursor(8, 1);
+  int button = lcd.getButton();
+  if (button == LCD_BUTTON_LEFT)
+    lcd.print("LEFT");
+  else if (button == LCD_BUTTON_RIGHT)
+    lcd.print("RIGHT");
+  else if (button == LCD_BUTTON_UP)
+    lcd.print("UP");
+  else if (button == LCD_BUTTON_DOWN)
+    lcd.print("DOWN");
+  else if (button == LCD_BUTTON_SELECT)
+    lcd.print("SELECT");
+  else if (button < 0) // button release
+    lcd.print("      ");
+}
+

+

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:

+
/*
+This example demonstrates how to use the LCD library, which extends the
+standard LiquidCrystal library to provide support for the Freetronics back light
+and Up/Down/Left/Right/Select buttons.  More information on the shield here:
+
+http://www.freetronics.com/pages/16x2-lcd-shield-quickstart-guide
+
+This example is placed into the public domain.
+*/
+
+#include <LCD.h>
+LCD lcd;
+
+// Note: if you are using the USBDroid and have reassigned pin D9 on the LCD shield to some
+// other pin (e.g. A1), then you will need to initialize the shield with something like:
+// LCD lcd(A1);
+// See also: http://www.freetronics.com/pages/combining-the-lcd-keypad-shield-and-the-usbdroid
+
+void setup() {
+  lcd.enableScreenSaver();
+  lcd.print("hello, world!");
+}
+
+void loop() {
+  lcd.setCursor(0, 1);
+  lcd.print(millis() / 1000);
+
+  lcd.setCursor(8, 1);
+  int button = lcd.getButton();
+  if (button == LCD_BUTTON_LEFT)
+    lcd.print("LEFT");
+  else if (button == LCD_BUTTON_RIGHT)
+    lcd.print("RIGHT");
+  else if (button == LCD_BUTTON_UP)
+    lcd.print("UP");
+  else if (button == LCD_BUTTON_DOWN)
+    lcd.print("DOWN");
+  else if (button == LCD_BUTTON_SELECT)
+    lcd.print("SELECT");
+  else if (button < 0) // button release
+    lcd.print("      ");
+}
+
+
+ + + + +
+ +
+ + + + diff --git a/mainpage_8dox.html b/mainpage_8dox.html new file mode 100644 index 00000000..ff3dc34f --- /dev/null +++ b/mainpage_8dox.html @@ -0,0 +1,88 @@ + + + + +ArduinoLibs: mainpage.dox File Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+
+
mainpage.dox File Reference
+
+
+ +
+

Detailed Description

+
+

Definition in file mainpage.dox.

+
+ + + + +
+ +
+ + + + diff --git a/modules.html b/modules.html new file mode 100644 index 00000000..2335b2f2 --- /dev/null +++ b/modules.html @@ -0,0 +1,81 @@ + + + + +ArduinoLibs: Modules + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ +
+
+
+
Modules
+
+
+
Here is a list of all modules:
+
+ + + + +
+ +
+ + + + diff --git a/nav_f.png b/nav_f.png new file mode 100644 index 00000000..1b07a162 Binary files /dev/null and b/nav_f.png differ diff --git a/nav_h.png b/nav_h.png new file mode 100644 index 00000000..01f5fa6a Binary files /dev/null and b/nav_h.png differ diff --git a/open.png b/open.png new file mode 100644 index 00000000..7b35d2c2 Binary files /dev/null and b/open.png differ diff --git a/pages.html b/pages.html new file mode 100644 index 00000000..fbce95c0 --- /dev/null +++ b/pages.html @@ -0,0 +1,92 @@ + + + + +ArduinoLibs: Related Pages + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ +
+
+
+
Related Pages
+
+ + + + + +
+ +
+ + + + diff --git a/search/all_61.html b/search/all_61.html new file mode 100644 index 00000000..af5d78d1 --- /dev/null +++ b/search/all_61.html @@ -0,0 +1,76 @@ + + + + + + + +
+
Loading...
+
+
+ addField + Form +
+
+
+
+ adjustDays + RTC +
+
+
+
+ adjustMonths + RTC +
+
+
+
+ adjustYears + RTC +
+
+
+
+ advance + ChaseLEDs +
+
+
+
+ advanceTime + ChaseLEDs +
+
+ +
+
+ ALARM_COUNT + RTC +
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_62.html b/search/all_62.html new file mode 100644 index 00000000..252e45c7 --- /dev/null +++ b/search/all_62.html @@ -0,0 +1,76 @@ + + + + + + + +
+
Loading...
+
+
+ BacklightOff + LCD +
+
+
+
+ BacklightOnSelect + LCD +
+
+ + + + + + +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_63.html b/search/all_63.html new file mode 100644 index 00000000..d3cb8214 --- /dev/null +++ b/search/all_63.html @@ -0,0 +1,35 @@ + + + + + + + +
+
Loading...
+ +
+
+ currentField + Form +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_64.html b/search/all_64.html new file mode 100644 index 00000000..ceee7fb3 --- /dev/null +++ b/search/all_64.html @@ -0,0 +1,99 @@ + + + + + + + +
+
Loading...
+
+
+ day + RTCDate +
+
+
+
+ DECREMENT + RTC +
+
+
+
+ defaultField + Form +
+
+
+
+ disable32kHzOutput + DS3232RTC +
+
+
+
+ disableAlarmInterrupts + DS3232RTC +
+
+
+
+ disableScreenSaver + LCD +
+
+ +
+
+ display + LCD +
+
+
+
+ DisplayOff + LCD +
+
+ + +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_65.html b/search/all_65.html new file mode 100644 index 00000000..1e9db6b8 --- /dev/null +++ b/search/all_65.html @@ -0,0 +1,69 @@ + + + + + + + +
+
Loading...
+
+
+ enable32kHzOutput + DS3232RTC +
+
+
+
+ enableAlarmInterrupts + DS3232RTC +
+
+
+
+ enableScreenSaver + LCD +
+
+ + + +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_66.html b/search/all_66.html new file mode 100644 index 00000000..95fdc51e --- /dev/null +++ b/search/all_66.html @@ -0,0 +1,58 @@ + + + + + + + +
+
Loading...
+
+
+ falseLabel + BoolField +
+
+ +
+
+ firedAlarm + DS3232RTC +
+
+
+
+ flags + RTCAlarm +
+
+
+ +
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_67.html b/search/all_67.html new file mode 100644 index 00000000..634a6c51 --- /dev/null +++ b/search/all_67.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ getButton + LCD +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_68.html b/search/all_68.html new file mode 100644 index 00000000..ca1a9110 --- /dev/null +++ b/search/all_68.html @@ -0,0 +1,45 @@ + + + + + + + +
+
Loading...
+ +
+
+ hide + Form +
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_69.html b/search/all_69.html new file mode 100644 index 00000000..58685ee0 --- /dev/null +++ b/search/all_69.html @@ -0,0 +1,90 @@ + + + + + + + +
+
Loading...
+
+
+ I2CMaster +
+
+
+
+ INCREMENT + RTC +
+
+ + +
+
+ isPaused + BlinkLED +
+
+
+
+ isPlaying + Melody +
+
+ +
+
+ isScreenSaved + LCD +
+
+
+
+ isVisible + Form +
+
+
+
+ items + ListField +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_6c.html b/search/all_6c.html new file mode 100644 index 00000000..79e2648e --- /dev/null +++ b/search/all_6c.html @@ -0,0 +1,72 @@ + + + + + + + +
+
Loading...
+
+
+ label + Field +
+
+ +
+ +
+ + + +
+
+ loopCount + Melody +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_6d.html b/search/all_6d.html new file mode 100644 index 00000000..eaed31e9 --- /dev/null +++ b/search/all_6d.html @@ -0,0 +1,76 @@ + + + + + + + +
+
Loading...
+
+ +
+
+
+ maxHours + TimeField +
+
+ +
+
+ maxValue + IntField +
+
+
+ +
+ +
+
+ minValue + IntField +
+
+
+
+ month + RTCDate +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_6e.html b/search/all_6e.html new file mode 100644 index 00000000..ac69c24c --- /dev/null +++ b/search/all_6e.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ nextField + Form +
+
+
+
+ noDisplay + LCD +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_6f.html b/search/all_6f.html new file mode 100644 index 00000000..9ad5b823 --- /dev/null +++ b/search/all_6f.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ offTime + BlinkLED +
+
+
+
+ onTime + BlinkLED +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_70.html b/search/all_70.html new file mode 100644 index 00000000..1d584bd6 --- /dev/null +++ b/search/all_70.html @@ -0,0 +1,50 @@ + + + + + + + +
+
Loading...
+
+
+ pause + BlinkLED +
+
+
+
+ play + Melody +
+
+
+
+ playOnce + Melody +
+
+
+
+ prevField + Form +
+
+
+
+ previousPin + ChaseLEDs +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_72.html b/search/all_72.html new file mode 100644 index 00000000..20506b4f --- /dev/null +++ b/search/all_72.html @@ -0,0 +1,117 @@ + + + + + + + +
+
Loading...
+ + + + +
+
+ readOnly + TimeField +
+
+ +
+
+ removeField + Form +
+
+
+
+ resume + BlinkLED +
+
+
+
+ RTC +
+ RTC + RTC::RTC() +
+
+
+
+
+ RTCAlarm +
+
+
+
+ RTCDate +
+
+
+
+ RTCTime +
+
+
+
+ run + Melody +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_73.html b/search/all_73.html new file mode 100644 index 00000000..56d47eb2 --- /dev/null +++ b/search/all_73.html @@ -0,0 +1,212 @@ + + + + + + + +
+
Loading...
+ +
+
+ second + RTCTime +
+
+
+
+ setAdvanceTime + ChaseLEDs +
+
+
+
+ setBlinkRate + BlinkLED +
+
+
+
+ setCurrentField + Form +
+
+
+
+ setFalseLabel + BoolField +
+
+
+
+ setItems + ListField +
+
+
+
+ setLabel + Field +
+
+
+
+ setLoopCount + Melody +
+
+
+
+ setLoopDuration + Melody +
+
+
+
+ setMaxHours + TimeField +
+
+
+
+ setMaxValue + IntField +
+
+
+
+ setMelody + Melody +
+
+
+
+ setMinValue + IntField +
+
+
+
+ setReadOnly + TimeField +
+
+
+
+ setScreenSaverMode + LCD +
+
+
+
+ setState + BlinkLED +
+
+
+
+ setStepValue + IntField +
+
+
+
+ setSuffix + IntField +
+
+
+
+ setTrueLabel + BoolField +
+
+ +
+
+ show + Form +
+
+ + + +
+
+ state + BlinkLED +
+
+
+
+ stepValue + IntField +
+
+
+
+ stop + Melody +
+
+
+
+ suffix + IntField +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_74.html b/search/all_74.html new file mode 100644 index 00000000..3831836f --- /dev/null +++ b/search/all_74.html @@ -0,0 +1,46 @@ + + + + + + + +
+
Loading...
+ + +
+
+ trueLabel + BoolField +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_75.html b/search/all_75.html new file mode 100644 index 00000000..87317f92 --- /dev/null +++ b/search/all_75.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ updateCursor + Field +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_76.html b/search/all_76.html new file mode 100644 index 00000000..f4df1c43 --- /dev/null +++ b/search/all_76.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_77.html b/search/all_77.html new file mode 100644 index 00000000..d9767fc6 --- /dev/null +++ b/search/all_77.html @@ -0,0 +1,75 @@ + + + + + + + +
+
Loading...
+
+
+ WRAP + RTC +
+
+ + + + + +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_79.html b/search/all_79.html new file mode 100644 index 00000000..6bebefef --- /dev/null +++ b/search/all_79.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ year + RTCDate +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_7e.html b/search/all_7e.html new file mode 100644 index 00000000..376b845e --- /dev/null +++ b/search/all_7e.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ ~Field + Field +
+
+
+
+ ~Form + Form +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/classes_62.html b/search/classes_62.html new file mode 100644 index 00000000..e5e3dbb2 --- /dev/null +++ b/search/classes_62.html @@ -0,0 +1,30 @@ + + + + + + + +
+
Loading...
+
+
+ BlinkLED +
+
+
+
+ BoolField +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/classes_63.html b/search/classes_63.html new file mode 100644 index 00000000..d8c228b9 --- /dev/null +++ b/search/classes_63.html @@ -0,0 +1,25 @@ + + + + + + + +
+
Loading...
+
+
+ ChaseLEDs +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/classes_64.html b/search/classes_64.html new file mode 100644 index 00000000..25f17982 --- /dev/null +++ b/search/classes_64.html @@ -0,0 +1,30 @@ + + + + + + + +
+
Loading...
+
+
+ DS1307RTC +
+
+
+
+ DS3232RTC +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/classes_66.html b/search/classes_66.html new file mode 100644 index 00000000..09fd0110 --- /dev/null +++ b/search/classes_66.html @@ -0,0 +1,30 @@ + + + + + + + +
+
Loading...
+
+
+ Field +
+
+
+
+ Form +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/classes_69.html b/search/classes_69.html new file mode 100644 index 00000000..70109f38 --- /dev/null +++ b/search/classes_69.html @@ -0,0 +1,30 @@ + + + + + + + +
+
Loading...
+
+
+ I2CMaster +
+
+
+
+ IntField +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/classes_6c.html b/search/classes_6c.html new file mode 100644 index 00000000..fa1cf4af --- /dev/null +++ b/search/classes_6c.html @@ -0,0 +1,30 @@ + + + + + + + +
+
Loading...
+
+
+ LCD +
+
+
+
+ ListField +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/classes_6d.html b/search/classes_6d.html new file mode 100644 index 00000000..54129ffa --- /dev/null +++ b/search/classes_6d.html @@ -0,0 +1,25 @@ + + + + + + + +
+
Loading...
+
+
+ Melody +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/classes_72.html b/search/classes_72.html new file mode 100644 index 00000000..49296fad --- /dev/null +++ b/search/classes_72.html @@ -0,0 +1,40 @@ + + + + + + + +
+
Loading...
+
+
+ RTC +
+
+
+
+ RTCAlarm +
+
+
+
+ RTCDate +
+
+
+
+ RTCTime +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/classes_73.html b/search/classes_73.html new file mode 100644 index 00000000..df0dba74 --- /dev/null +++ b/search/classes_73.html @@ -0,0 +1,25 @@ + + + + + + + +
+
Loading...
+
+
+ SoftI2C +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/classes_74.html b/search/classes_74.html new file mode 100644 index 00000000..aa656541 --- /dev/null +++ b/search/classes_74.html @@ -0,0 +1,30 @@ + + + + + + + +
+
Loading...
+
+
+ TextField +
+
+
+
+ TimeField +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/close.png b/search/close.png new file mode 100644 index 00000000..9342d3df Binary files /dev/null and b/search/close.png differ diff --git a/search/enums_73.html b/search/enums_73.html new file mode 100644 index 00000000..434f96fd --- /dev/null +++ b/search/enums_73.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ ScreenSaverMode + LCD +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/enumvalues_62.html b/search/enumvalues_62.html new file mode 100644 index 00000000..a43a86f5 --- /dev/null +++ b/search/enumvalues_62.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ BacklightOff + LCD +
+
+
+
+ BacklightOnSelect + LCD +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/enumvalues_64.html b/search/enumvalues_64.html new file mode 100644 index 00000000..308c0d28 --- /dev/null +++ b/search/enumvalues_64.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ DisplayOff + LCD +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/files_61.html b/search/files_61.html new file mode 100644 index 00000000..763d3765 --- /dev/null +++ b/search/files_61.html @@ -0,0 +1,25 @@ + + + + + + + +
+
Loading...
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/files_62.html b/search/files_62.html new file mode 100644 index 00000000..fcd88bd1 --- /dev/null +++ b/search/files_62.html @@ -0,0 +1,35 @@ + + + + + + + +
+
Loading...
+ + + +
Searching...
+
No Matches
+ +
+ + diff --git a/search/files_6c.html b/search/files_6c.html new file mode 100644 index 00000000..aace750e --- /dev/null +++ b/search/files_6c.html @@ -0,0 +1,30 @@ + + + + + + + +
+
Loading...
+
+ +
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/files_6d.html b/search/files_6d.html new file mode 100644 index 00000000..fb533979 --- /dev/null +++ b/search/files_6d.html @@ -0,0 +1,25 @@ + + + + + + + +
+
Loading...
+
+ +
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_61.html b/search/functions_61.html new file mode 100644 index 00000000..1087e1ff --- /dev/null +++ b/search/functions_61.html @@ -0,0 +1,65 @@ + + + + + + + +
+
Loading...
+
+
+ addField + Form +
+
+
+
+ adjustDays + RTC +
+
+
+
+ adjustMonths + RTC +
+
+
+
+ adjustYears + RTC +
+
+
+
+ advance + ChaseLEDs +
+
+
+
+ advanceTime + ChaseLEDs +
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_62.html b/search/functions_62.html new file mode 100644 index 00000000..affd1991 --- /dev/null +++ b/search/functions_62.html @@ -0,0 +1,45 @@ + + + + + + + +
+
Loading...
+
+
+ BlinkLED + BlinkLED +
+
+ + +
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_63.html b/search/functions_63.html new file mode 100644 index 00000000..3408ed0d --- /dev/null +++ b/search/functions_63.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ ChaseLEDs + ChaseLEDs +
+
+
+
+ currentField + Form +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_64.html b/search/functions_64.html new file mode 100644 index 00000000..efe4c06c --- /dev/null +++ b/search/functions_64.html @@ -0,0 +1,75 @@ + + + + + + + +
+
Loading...
+
+
+ defaultField + Form +
+
+
+
+ disable32kHzOutput + DS3232RTC +
+
+
+
+ disableAlarmInterrupts + DS3232RTC +
+
+
+
+ disableScreenSaver + LCD +
+
+ +
+
+ display + LCD +
+
+
+
+ DS1307RTC + DS1307RTC +
+
+
+
+ DS3232RTC + DS3232RTC +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_65.html b/search/functions_65.html new file mode 100644 index 00000000..1e9db6b8 --- /dev/null +++ b/search/functions_65.html @@ -0,0 +1,69 @@ + + + + + + + +
+
Loading...
+
+
+ enable32kHzOutput + DS3232RTC +
+
+
+
+ enableAlarmInterrupts + DS3232RTC +
+
+
+
+ enableScreenSaver + LCD +
+
+ + + +
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_66.html b/search/functions_66.html new file mode 100644 index 00000000..7c4f1d8b --- /dev/null +++ b/search/functions_66.html @@ -0,0 +1,50 @@ + + + + + + + +
+
Loading...
+
+
+ falseLabel + BoolField +
+
+ +
+
+ firedAlarm + DS3232RTC +
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_67.html b/search/functions_67.html new file mode 100644 index 00000000..634a6c51 --- /dev/null +++ b/search/functions_67.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ getButton + LCD +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_68.html b/search/functions_68.html new file mode 100644 index 00000000..4b55318a --- /dev/null +++ b/search/functions_68.html @@ -0,0 +1,36 @@ + + + + + + + +
+
Loading...
+ +
+
+ hide + Form +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_69.html b/search/functions_69.html new file mode 100644 index 00000000..2a2d17ec --- /dev/null +++ b/search/functions_69.html @@ -0,0 +1,78 @@ + + + + + + + +
+
Loading...
+ + +
+
+ isPaused + BlinkLED +
+
+
+
+ isPlaying + Melody +
+
+ +
+
+ isScreenSaved + LCD +
+
+
+
+ isVisible + Form +
+
+
+
+ items + ListField +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_6c.html b/search/functions_6c.html new file mode 100644 index 00000000..8fd083cf --- /dev/null +++ b/search/functions_6c.html @@ -0,0 +1,60 @@ + + + + + + + +
+
Loading...
+
+
+ label + Field +
+
+ + + +
+
+ loopCount + Melody +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_6d.html b/search/functions_6d.html new file mode 100644 index 00000000..c2bea054 --- /dev/null +++ b/search/functions_6d.html @@ -0,0 +1,53 @@ + + + + + + + +
+
Loading...
+
+
+ maxHours + TimeField +
+
+ +
+
+ maxValue + IntField +
+
+
+
+ Melody + Melody +
+
+
+
+ minValue + IntField +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_6e.html b/search/functions_6e.html new file mode 100644 index 00000000..ac69c24c --- /dev/null +++ b/search/functions_6e.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ nextField + Form +
+
+
+
+ noDisplay + LCD +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_6f.html b/search/functions_6f.html new file mode 100644 index 00000000..9ad5b823 --- /dev/null +++ b/search/functions_6f.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ offTime + BlinkLED +
+
+
+
+ onTime + BlinkLED +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_70.html b/search/functions_70.html new file mode 100644 index 00000000..1d584bd6 --- /dev/null +++ b/search/functions_70.html @@ -0,0 +1,50 @@ + + + + + + + +
+
Loading...
+
+
+ pause + BlinkLED +
+
+
+
+ play + Melody +
+
+
+
+ playOnce + Melody +
+
+
+
+ prevField + Form +
+
+
+
+ previousPin + ChaseLEDs +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_72.html b/search/functions_72.html new file mode 100644 index 00000000..344a860f --- /dev/null +++ b/search/functions_72.html @@ -0,0 +1,99 @@ + + + + + + + +
+
Loading...
+ + + + +
+
+ readOnly + TimeField +
+
+ +
+
+ removeField + Form +
+
+
+
+ resume + BlinkLED +
+
+
+
+ RTC + RTC +
+
+
+
+ run + Melody +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_73.html b/search/functions_73.html new file mode 100644 index 00000000..dba5f2de --- /dev/null +++ b/search/functions_73.html @@ -0,0 +1,200 @@ + + + + + + + +
+
Loading...
+
+
+ screenSaverMode + LCD +
+
+
+
+ setAdvanceTime + ChaseLEDs +
+
+
+
+ setBlinkRate + BlinkLED +
+
+
+
+ setCurrentField + Form +
+
+
+
+ setFalseLabel + BoolField +
+
+
+
+ setItems + ListField +
+
+
+
+ setLabel + Field +
+
+
+
+ setLoopCount + Melody +
+
+
+
+ setLoopDuration + Melody +
+
+
+
+ setMaxHours + TimeField +
+
+
+
+ setMaxValue + IntField +
+
+
+
+ setMelody + Melody +
+
+
+
+ setMinValue + IntField +
+
+
+
+ setReadOnly + TimeField +
+
+
+
+ setScreenSaverMode + LCD +
+
+
+
+ setState + BlinkLED +
+
+
+
+ setStepValue + IntField +
+
+
+
+ setSuffix + IntField +
+
+
+
+ setTrueLabel + BoolField +
+
+ +
+
+ show + Form +
+
+
+
+ SoftI2C + SoftI2C +
+
+ + +
+
+ state + BlinkLED +
+
+
+
+ stepValue + IntField +
+
+
+
+ stop + Melody +
+
+
+
+ suffix + IntField +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_74.html b/search/functions_74.html new file mode 100644 index 00000000..cef4f0e4 --- /dev/null +++ b/search/functions_74.html @@ -0,0 +1,44 @@ + + + + + + + +
+
Loading...
+ + +
+
+ trueLabel + BoolField +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_75.html b/search/functions_75.html new file mode 100644 index 00000000..87317f92 --- /dev/null +++ b/search/functions_75.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ updateCursor + Field +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_76.html b/search/functions_76.html new file mode 100644 index 00000000..f4df1c43 --- /dev/null +++ b/search/functions_76.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_77.html b/search/functions_77.html new file mode 100644 index 00000000..138491c6 --- /dev/null +++ b/search/functions_77.html @@ -0,0 +1,69 @@ + + + + + + + +
+
Loading...
+ + + + + +
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_7e.html b/search/functions_7e.html new file mode 100644 index 00000000..376b845e --- /dev/null +++ b/search/functions_7e.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ ~Field + Field +
+
+
+
+ ~Form + Form +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/mag_sel.png b/search/mag_sel.png new file mode 100644 index 00000000..81f6040a Binary files /dev/null and b/search/mag_sel.png differ diff --git a/search/nomatches.html b/search/nomatches.html new file mode 100644 index 00000000..b1ded27e --- /dev/null +++ b/search/nomatches.html @@ -0,0 +1,12 @@ + + + + + + + +
+
No Matches
+
+ + diff --git a/search/search.css b/search/search.css new file mode 100644 index 00000000..50249e56 --- /dev/null +++ b/search/search.css @@ -0,0 +1,240 @@ +/*---------------- Search Box */ + +#FSearchBox { + float: left; +} + +#searchli { + float: right; + display: block; + width: 170px; + height: 36px; +} + +#MSearchBox { + white-space : nowrap; + position: absolute; + float: none; + display: inline; + margin-top: 8px; + right: 0px; + width: 170px; + z-index: 102; +} + +#MSearchBox .left +{ + display:block; + position:absolute; + left:10px; + width:20px; + height:19px; + background:url('search_l.png') no-repeat; + background-position:right; +} + +#MSearchSelect { + display:block; + position:absolute; + width:20px; + height:19px; +} + +.left #MSearchSelect { + left:4px; +} + +.right #MSearchSelect { + right:5px; +} + +#MSearchField { + display:block; + position:absolute; + height:19px; + background:url('search_m.png') repeat-x; + border:none; + width:116px; + margin-left:20px; + padding-left:4px; + color: #909090; + outline: none; + font: 9pt Arial, Verdana, sans-serif; +} + +#FSearchBox #MSearchField { + margin-left:15px; +} + +#MSearchBox .right { + display:block; + position:absolute; + right:10px; + top:0px; + width:20px; + height:19px; + background:url('search_r.png') no-repeat; + background-position:left; +} + +#MSearchClose { + display: none; + position: absolute; + top: 4px; + background : none; + border: none; + margin: 0px 4px 0px 0px; + padding: 0px 0px; + outline: none; +} + +.left #MSearchClose { + left: 6px; +} + +.right #MSearchClose { + right: 2px; +} + +.MSearchBoxActive #MSearchField { + color: #000000; +} + +/*---------------- Search filter selection */ + +#MSearchSelectWindow { + display: none; + position: absolute; + left: 0; top: 0; + border: 1px solid #90A5CE; + background-color: #F9FAFC; + z-index: 1; + padding-top: 4px; + padding-bottom: 4px; + -moz-border-radius: 4px; + -webkit-border-top-left-radius: 4px; + -webkit-border-top-right-radius: 4px; + -webkit-border-bottom-left-radius: 4px; + -webkit-border-bottom-right-radius: 4px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); +} + +.SelectItem { + font: 8pt Arial, Verdana, sans-serif; + padding-left: 2px; + padding-right: 12px; + border: 0px; +} + +span.SelectionMark { + margin-right: 4px; + font-family: monospace; + outline-style: none; + text-decoration: none; +} + +a.SelectItem { + display: block; + outline-style: none; + color: #000000; + text-decoration: none; + padding-left: 6px; + padding-right: 12px; +} + +a.SelectItem:focus, +a.SelectItem:active { + color: #000000; + outline-style: none; + text-decoration: none; +} + +a.SelectItem:hover { + color: #FFFFFF; + background-color: #3D578C; + outline-style: none; + text-decoration: none; + cursor: pointer; + display: block; +} + +/*---------------- Search results window */ + +iframe#MSearchResults { + width: 60ex; + height: 15em; +} + +#MSearchResultsWindow { + display: none; + position: absolute; + left: 0; top: 0; + border: 1px solid #000; + background-color: #EEF1F7; +} + +/* ----------------------------------- */ + + +#SRIndex { + clear:both; + padding-bottom: 15px; +} + +.SREntry { + font-size: 10pt; + padding-left: 1ex; +} + +.SRPage .SREntry { + font-size: 8pt; + padding: 1px 5px; +} + +body.SRPage { + margin: 5px 2px; +} + +.SRChildren { + padding-left: 3ex; padding-bottom: .5em +} + +.SRPage .SRChildren { + display: none; +} + +.SRSymbol { + font-weight: bold; + color: #425E97; + font-family: Arial, Verdana, sans-serif; + text-decoration: none; + outline: none; +} + +a.SRScope { + display: block; + color: #425E97; + font-family: Arial, Verdana, sans-serif; + text-decoration: none; + outline: none; +} + +a.SRSymbol:focus, a.SRSymbol:active, +a.SRScope:focus, a.SRScope:active { + text-decoration: underline; +} + +.SRPage .SRStatus { + padding: 2px 5px; + font-size: 8pt; + font-style: italic; +} + +.SRResult { + display: none; +} + +DIV.searchresults { + margin-left: 10px; + margin-right: 10px; +} diff --git a/search/search.js b/search/search.js new file mode 100644 index 00000000..dba7cd00 --- /dev/null +++ b/search/search.js @@ -0,0 +1,738 @@ +// Search script generated by doxygen +// Copyright (C) 2009 by Dimitri van Heesch. + +// The code in this file is loosly based on main.js, part of Natural Docs, +// which is Copyright (C) 2003-2008 Greg Valure +// Natural Docs is licensed under the GPL. + +var indexSectionsWithContent = +{ + 0: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111001111101111110100001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 1: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011101001001100001110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 2: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 3: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111001111101111110000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 4: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100101011000100000100010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 5: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 6: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" +}; + +var indexSectionNames = +{ + 0: "all", + 1: "classes", + 2: "files", + 3: "functions", + 4: "variables", + 5: "enums", + 6: "enumvalues" +}; + +function convertToId(search) +{ + var result = ''; + for (i=0;i do a search + { + this.Search(); + } + } + + this.OnSearchSelectKey = function(evt) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==40 && this.searchIndex0) // Up + { + this.searchIndex--; + this.OnSelectItem(this.searchIndex); + } + else if (e.keyCode==13 || e.keyCode==27) + { + this.OnSelectItem(this.searchIndex); + this.CloseSelectionWindow(); + this.DOMSearchField().focus(); + } + return false; + } + + // --------- Actions + + // Closes the results window. + this.CloseResultsWindow = function() + { + this.DOMPopupSearchResultsWindow().style.display = 'none'; + this.DOMSearchClose().style.display = 'none'; + this.Activate(false); + } + + this.CloseSelectionWindow = function() + { + this.DOMSearchSelectWindow().style.display = 'none'; + } + + // Performs a search. + this.Search = function() + { + this.keyTimeout = 0; + + // strip leading whitespace + var searchValue = this.DOMSearchField().value.replace(/^ +/, ""); + + var code = searchValue.toLowerCase().charCodeAt(0); + var hexCode; + if (code<16) + { + hexCode="0"+code.toString(16); + } + else + { + hexCode=code.toString(16); + } + + var resultsPage; + var resultsPageWithSearch; + var hasResultsPage; + + if (indexSectionsWithContent[this.searchIndex].charAt(code) == '1') + { + resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + '.html'; + resultsPageWithSearch = resultsPage+'?'+escape(searchValue); + hasResultsPage = true; + } + else // nothing available for this search term + { + resultsPage = this.resultsPath + '/nomatches.html'; + resultsPageWithSearch = resultsPage; + hasResultsPage = false; + } + + window.frames.MSearchResults.location.href = resultsPageWithSearch; + var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow(); + + if (domPopupSearchResultsWindow.style.display!='block') + { + var domSearchBox = this.DOMSearchBox(); + this.DOMSearchClose().style.display = 'inline'; + if (this.insideFrame) + { + var domPopupSearchResults = this.DOMPopupSearchResults(); + domPopupSearchResultsWindow.style.position = 'relative'; + domPopupSearchResultsWindow.style.display = 'block'; + var width = document.body.clientWidth - 8; // the -8 is for IE :-( + domPopupSearchResultsWindow.style.width = width + 'px'; + domPopupSearchResults.style.width = width + 'px'; + } + else + { + var domPopupSearchResults = this.DOMPopupSearchResults(); + var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth; + var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1; + domPopupSearchResultsWindow.style.display = 'block'; + left -= domPopupSearchResults.offsetWidth; + domPopupSearchResultsWindow.style.top = top + 'px'; + domPopupSearchResultsWindow.style.left = left + 'px'; + } + } + + this.lastSearchValue = searchValue; + this.lastResultsPage = resultsPage; + } + + // -------- Activation Functions + + // Activates or deactivates the search panel, resetting things to + // their default values if necessary. + this.Activate = function(isActive) + { + if (isActive || // open it + this.DOMPopupSearchResultsWindow().style.display == 'block' + ) + { + this.DOMSearchBox().className = 'MSearchBoxActive'; + + var searchField = this.DOMSearchField(); + + if (searchField.value == this.searchLabel) // clear "Search" term upon entry + { + searchField.value = ''; + this.searchActive = true; + } + } + else if (!isActive) // directly remove the panel + { + this.DOMSearchBox().className = 'MSearchBoxInactive'; + this.DOMSearchField().value = this.searchLabel; + this.searchActive = false; + this.lastSearchValue = '' + this.lastResultsPage = ''; + } + } +} + +// ----------------------------------------------------------------------- + +// The class that handles everything on the search results page. +function SearchResults(name) +{ + // The number of matches from the last run of . + this.lastMatchCount = 0; + this.lastKey = 0; + this.repeatOn = false; + + // Toggles the visibility of the passed element ID. + this.FindChildElement = function(id) + { + var parentElement = document.getElementById(id); + var element = parentElement.firstChild; + + while (element && element!=parentElement) + { + if (element.nodeName == 'DIV' && element.className == 'SRChildren') + { + return element; + } + + if (element.nodeName == 'DIV' && element.hasChildNodes()) + { + element = element.firstChild; + } + else if (element.nextSibling) + { + element = element.nextSibling; + } + else + { + do + { + element = element.parentNode; + } + while (element && element!=parentElement && !element.nextSibling); + + if (element && element!=parentElement) + { + element = element.nextSibling; + } + } + } + } + + this.Toggle = function(id) + { + var element = this.FindChildElement(id); + if (element) + { + if (element.style.display == 'block') + { + element.style.display = 'none'; + } + else + { + element.style.display = 'block'; + } + } + } + + // Searches for the passed string. If there is no parameter, + // it takes it from the URL query. + // + // Always returns true, since other documents may try to call it + // and that may or may not be possible. + this.Search = function(search) + { + if (!search) // get search word from URL + { + search = window.location.search; + search = search.substring(1); // Remove the leading '?' + search = unescape(search); + } + + search = search.replace(/^ +/, ""); // strip leading spaces + search = search.replace(/ +$/, ""); // strip trailing spaces + search = search.toLowerCase(); + search = convertToId(search); + + var resultRows = document.getElementsByTagName("div"); + var matches = 0; + + var i = 0; + while (i < resultRows.length) + { + var row = resultRows.item(i); + if (row.className == "SRResult") + { + var rowMatchName = row.id.toLowerCase(); + rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_' + + if (search.length<=rowMatchName.length && + rowMatchName.substr(0, search.length)==search) + { + row.style.display = 'block'; + matches++; + } + else + { + row.style.display = 'none'; + } + } + i++; + } + document.getElementById("Searching").style.display='none'; + if (matches == 0) // no results + { + document.getElementById("NoMatches").style.display='block'; + } + else // at least one result + { + document.getElementById("NoMatches").style.display='none'; + } + this.lastMatchCount = matches; + return true; + } + + // return the first item with index index or higher that is visible + this.NavNext = function(index) + { + var focusItem; + while (1) + { + var focusName = 'Item'+index; + focusItem = document.getElementById(focusName); + if (focusItem && focusItem.parentNode.parentNode.style.display=='block') + { + break; + } + else if (!focusItem) // last element + { + break; + } + focusItem=null; + index++; + } + return focusItem; + } + + this.NavPrev = function(index) + { + var focusItem; + while (1) + { + var focusName = 'Item'+index; + focusItem = document.getElementById(focusName); + if (focusItem && focusItem.parentNode.parentNode.style.display=='block') + { + break; + } + else if (!focusItem) // last element + { + break; + } + focusItem=null; + index--; + } + return focusItem; + } + + this.ProcessKeys = function(e) + { + if (e.type == "keydown") + { + this.repeatOn = false; + this.lastKey = e.keyCode; + } + else if (e.type == "keypress") + { + if (!this.repeatOn) + { + if (this.lastKey) this.repeatOn = true; + return false; // ignore first keypress after keydown + } + } + else if (e.type == "keyup") + { + this.lastKey = 0; + this.repeatOn = false; + } + return this.lastKey!=0; + } + + this.Nav = function(evt,itemIndex) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==13) return true; + if (!this.ProcessKeys(e)) return false; + + if (this.lastKey==38) // Up + { + var newIndex = itemIndex-1; + var focusItem = this.NavPrev(newIndex); + if (focusItem) + { + var child = this.FindChildElement(focusItem.parentNode.parentNode.id); + if (child && child.style.display == 'block') // children visible + { + var n=0; + var tmpElem; + while (1) // search for last child + { + tmpElem = document.getElementById('Item'+newIndex+'_c'+n); + if (tmpElem) + { + focusItem = tmpElem; + } + else // found it! + { + break; + } + n++; + } + } + } + if (focusItem) + { + focusItem.focus(); + } + else // return focus to search field + { + parent.document.getElementById("MSearchField").focus(); + } + } + else if (this.lastKey==40) // Down + { + var newIndex = itemIndex+1; + var focusItem; + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem && elem.style.display == 'block') // children visible + { + focusItem = document.getElementById('Item'+itemIndex+'_c0'); + } + if (!focusItem) focusItem = this.NavNext(newIndex); + if (focusItem) focusItem.focus(); + } + else if (this.lastKey==39) // Right + { + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem) elem.style.display = 'block'; + } + else if (this.lastKey==37) // Left + { + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem) elem.style.display = 'none'; + } + else if (this.lastKey==27) // Escape + { + parent.searchBox.CloseResultsWindow(); + parent.document.getElementById("MSearchField").focus(); + } + else if (this.lastKey==13) // Enter + { + return true; + } + return false; + } + + this.NavChild = function(evt,itemIndex,childIndex) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==13) return true; + if (!this.ProcessKeys(e)) return false; + + if (this.lastKey==38) // Up + { + if (childIndex>0) + { + var newIndex = childIndex-1; + document.getElementById('Item'+itemIndex+'_c'+newIndex).focus(); + } + else // already at first child, jump to parent + { + document.getElementById('Item'+itemIndex).focus(); + } + } + else if (this.lastKey==40) // Down + { + var newIndex = childIndex+1; + var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex); + if (!elem) // last child, jump to parent next parent + { + elem = this.NavNext(itemIndex+1); + } + if (elem) + { + elem.focus(); + } + } + else if (this.lastKey==27) // Escape + { + parent.searchBox.CloseResultsWindow(); + parent.document.getElementById("MSearchField").focus(); + } + else if (this.lastKey==13) // Enter + { + return true; + } + return false; + } +} diff --git a/search/search_l.png b/search/search_l.png new file mode 100644 index 00000000..c872f4da Binary files /dev/null and b/search/search_l.png differ diff --git a/search/search_m.png b/search/search_m.png new file mode 100644 index 00000000..b429a16b Binary files /dev/null and b/search/search_m.png differ diff --git a/search/search_r.png b/search/search_r.png new file mode 100644 index 00000000..97ee8b43 Binary files /dev/null and b/search/search_r.png differ diff --git a/search/variables_61.html b/search/variables_61.html new file mode 100644 index 00000000..9be07a0c --- /dev/null +++ b/search/variables_61.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ ALARM_COUNT + RTC +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/variables_64.html b/search/variables_64.html new file mode 100644 index 00000000..bed00759 --- /dev/null +++ b/search/variables_64.html @@ -0,0 +1,32 @@ + + + + + + + +
+
Loading...
+
+
+ day + RTCDate +
+
+
+
+ DECREMENT + RTC +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/variables_66.html b/search/variables_66.html new file mode 100644 index 00000000..f4ae659b --- /dev/null +++ b/search/variables_66.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ flags + RTCAlarm +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/variables_68.html b/search/variables_68.html new file mode 100644 index 00000000..89d950ca --- /dev/null +++ b/search/variables_68.html @@ -0,0 +1,29 @@ + + + + + + + +
+
Loading...
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/variables_69.html b/search/variables_69.html new file mode 100644 index 00000000..bce6b95f --- /dev/null +++ b/search/variables_69.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ INCREMENT + RTC +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/variables_6d.html b/search/variables_6d.html new file mode 100644 index 00000000..b7e7813c --- /dev/null +++ b/search/variables_6d.html @@ -0,0 +1,35 @@ + + + + + + + +
+
Loading...
+ +
+
+ month + RTCDate +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/variables_73.html b/search/variables_73.html new file mode 100644 index 00000000..e736e528 --- /dev/null +++ b/search/variables_73.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ second + RTCTime +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/variables_77.html b/search/variables_77.html new file mode 100644 index 00000000..ed0fafea --- /dev/null +++ b/search/variables_77.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ WRAP + RTC +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/search/variables_79.html b/search/variables_79.html new file mode 100644 index 00000000..6bebefef --- /dev/null +++ b/search/variables_79.html @@ -0,0 +1,26 @@ + + + + + + + +
+
Loading...
+
+
+ year + RTCDate +
+
+
Searching...
+
No Matches
+ +
+ + diff --git a/structRTCAlarm.html b/structRTCAlarm.html new file mode 100644 index 00000000..a1c8fdea --- /dev/null +++ b/structRTCAlarm.html @@ -0,0 +1,135 @@ + + + + +ArduinoLibs: RTCAlarm Class Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+ +
+
RTCAlarm Class Reference
+
+
+ +

Stores alarm information from a realtime clock chip. + More...

+ +

#include <RTC.h>

+ +

List of all members.

+ + + + + + + + +

+Public Attributes

+uint8_t hour
 Hour of the day for the alarm (0-23).
+uint8_t minute
 Minute of the hour for the alarm (0-59).
uint8_t flags
 Additional flags for the alarm.
+

Detailed Description

+

Stores alarm information from a realtime clock chip.

+
See also:
RTCTime, RTCDate, RTC
+ +

Definition at line 42 of file RTC.h.

+

Member Data Documentation

+ +
+
+ + + + +
RTCAlarm::flags
+
+
+ +

Additional flags for the alarm.

+

The least significant bit will be 0 if the alarm is disabled or 1 if the alarm is enabled. Other bits can be used by the application for any purpose.

+ +

Definition at line 46 of file RTC.h.

+ +
+
+
The documentation for this class was generated from the following files: +
+ + + + +
+ +
+ + + + diff --git a/structRTCDate.html b/structRTCDate.html new file mode 100644 index 00000000..df2cdab3 --- /dev/null +++ b/structRTCDate.html @@ -0,0 +1,117 @@ + + + + +ArduinoLibs: RTCDate Class Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+ +
+
RTCDate Class Reference
+
+
+ +

Stores date information from a realtime clock chip. + More...

+ +

#include <RTC.h>

+ +

List of all members.

+ + + + + + + + +

+Public Attributes

+unsigned int year
 Year (4-digit)
+uint8_t month
 Month of the year (1-12)
+uint8_t day
 Day of the month (1-31)
+

Detailed Description

+

Stores date information from a realtime clock chip.

+
See also:
RTCTime, RTCAlarm, RTC
+ +

Definition at line 35 of file RTC.h.

+

The documentation for this class was generated from the following files: +
+ + + + +
+ +
+ + + + diff --git a/structRTCTime.html b/structRTCTime.html new file mode 100644 index 00000000..97412ada --- /dev/null +++ b/structRTCTime.html @@ -0,0 +1,117 @@ + + + + +ArduinoLibs: RTCTime Class Reference + + + + + + + + +
+
+ + + + + + +
+
ArduinoLibs
+
+
+ + +
+
+ +
+
RTCTime Class Reference
+
+
+ +

Stores time information from a realtime clock chip. + More...

+ +

#include <RTC.h>

+ +

List of all members.

+ + + + + + + + +

+Public Attributes

+uint8_t hour
 Hour of the day (0-23)
+uint8_t minute
 Minute within the hour (0-59)
+uint8_t second
 Second within the minute (0-59)
+

Detailed Description

+

Stores time information from a realtime clock chip.

+
See also:
RTCDate, RTCAlarm, RTC
+ +

Definition at line 28 of file RTC.h.

+

The documentation for this class was generated from the following files: +
+ + + + +
+ +
+ + + + diff --git a/tab_a.png b/tab_a.png new file mode 100644 index 00000000..2d99ef23 Binary files /dev/null and b/tab_a.png differ diff --git a/tab_b.png b/tab_b.png new file mode 100644 index 00000000..b2c3d2be Binary files /dev/null and b/tab_b.png differ diff --git a/tab_h.png b/tab_h.png new file mode 100644 index 00000000..c11f48f1 Binary files /dev/null and b/tab_h.png differ diff --git a/tab_s.png b/tab_s.png new file mode 100644 index 00000000..978943ac Binary files /dev/null and b/tab_s.png differ diff --git a/tabs.css b/tabs.css new file mode 100644 index 00000000..21920562 --- /dev/null +++ b/tabs.css @@ -0,0 +1,59 @@ +.tabs, .tabs2, .tabs3 { + background-image: url('tab_b.png'); + width: 100%; + z-index: 101; + font-size: 13px; +} + +.tabs2 { + font-size: 10px; +} +.tabs3 { + font-size: 9px; +} + +.tablist { + margin: 0; + padding: 0; + display: table; +} + +.tablist li { + float: left; + display: table-cell; + background-image: url('tab_b.png'); + line-height: 36px; + list-style: none; +} + +.tablist a { + display: block; + padding: 0 20px; + font-weight: bold; + background-image:url('tab_s.png'); + background-repeat:no-repeat; + background-position:right; + color: #283A5D; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + text-decoration: none; + outline: none; +} + +.tabs3 .tablist a { + padding: 0 10px; +} + +.tablist a:hover { + background-image: url('tab_h.png'); + background-repeat:repeat-x; + color: #fff; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); + text-decoration: none; +} + +.tablist li.current a { + background-image: url('tab_a.png'); + background-repeat:repeat-x; + color: #fff; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); +}