diff --git a/examples/RgbStripButtons/AlaRgbStripDemo.ino b/examples/AlaRgbStripDemo/AlaRgbStripDemo.ino similarity index 100% rename from examples/RgbStripButtons/AlaRgbStripDemo.ino rename to examples/AlaRgbStripDemo/AlaRgbStripDemo.ino diff --git a/examples/SimpleTlc5940/SimpleTlc5940.ino b/examples/SimpleTlc5940/SimpleTlc5940.ino index a835f82..e86bb5e 100644 --- a/examples/SimpleTlc5940/SimpleTlc5940.ino +++ b/examples/SimpleTlc5940/SimpleTlc5940.ino @@ -8,7 +8,7 @@ // /////////////////////////////////////////////////////////////////////////////////////////// -#include +#include "AlaLed.h" AlaLed alaLed; diff --git a/examples/SimpleTlc5940/schematic/SimpleTlc5940.fzz b/examples/SimpleTlc5940/schematic/SimpleTlc5940.fzz new file mode 100644 index 0000000..cd3e7a4 Binary files /dev/null and b/examples/SimpleTlc5940/schematic/SimpleTlc5940.fzz differ diff --git a/examples/SimpleTlc5940/schematic/SimpleTlc5940_bb.png b/examples/SimpleTlc5940/schematic/SimpleTlc5940_bb.png new file mode 100644 index 0000000..3786c01 Binary files /dev/null and b/examples/SimpleTlc5940/schematic/SimpleTlc5940_bb.png differ diff --git a/examples/SimpleTlc5940/schematic/SimpleTlc5940_schem.png b/examples/SimpleTlc5940/schematic/SimpleTlc5940_schem.png new file mode 100644 index 0000000..6a3fcec Binary files /dev/null and b/examples/SimpleTlc5940/schematic/SimpleTlc5940_schem.png differ diff --git a/keywords.txt b/keywords.txt index 1d4c635..def4b6d 100644 --- a/keywords.txt +++ b/keywords.txt @@ -43,6 +43,7 @@ ALA_STROBO LITERAL1 ALA_FADECOLORSLOOP LITERAL1 ALA_FADECOLORS LITERAL1 ALA_CYCLECOLORS LITERAL1 +ALA_PIXELSFADECOLORS LITERAL1 ALA_PIXELSHIFTRIGHT LITERAL1 ALA_PIXELSHIFTLEFT LITERAL1 @@ -57,6 +58,7 @@ ALA_BARSHIFTLEFT LITERAL1 ALA_LARSONSCANNER LITERAL1 ALA_LARSONSCANNER2 LITERAL1 ALA_MOVINGBARS LITERAL1 +ALA_MOVINGGRADIENT LITERAL1 ALA_FADEIN LITERAL1 ALA_FADEOUT LITERAL1 diff --git a/library.properties b/library.properties new file mode 100644 index 0000000..8ebaaf0 --- /dev/null +++ b/library.properties @@ -0,0 +1,9 @@ +name=ALA +version=2.0 +author=bportaluri +maintainer=Bruno Portaluri +sentence=Arduino Light Animation (ALA) is a library +paragraph=Arduino Light Animation (ALA) is a library for Arduino boards to simplify the development of light animations using LEDs and LED strips. +category=Other +url=https://github.com/bportaluri/ALA +architectures=* \ No newline at end of file diff --git a/Ala.cpp b/src/Ala.cpp similarity index 100% rename from Ala.cpp rename to src/Ala.cpp diff --git a/Ala.h b/src/Ala.h similarity index 99% rename from Ala.h rename to src/Ala.h index 2ff8a2b..8daafd3 100644 --- a/Ala.h +++ b/src/Ala.h @@ -97,12 +97,12 @@ typedef struct AlaColor { return(this->r == c.r and this->g == c.g and this->b == c.b); } - +/* AlaColor getPixel(AlaColor maxOut) { return AlaColor(r*maxOut.r/255, g*maxOut.g/255, b*maxOut.b/255); } - +*/ AlaColor sum(AlaColor color) { int r0 = min(color.r + r, 255); @@ -194,9 +194,9 @@ typedef struct AlaPalette typedef struct AlaSeq { int animation; - int speed; + long speed; AlaPalette palette; - int duration; + long duration; }; diff --git a/AlaLed.cpp b/src/AlaLed.cpp similarity index 98% rename from AlaLed.cpp rename to src/AlaLed.cpp index 8d41f54..b5cf81b 100644 --- a/AlaLed.cpp +++ b/src/AlaLed.cpp @@ -62,7 +62,7 @@ void AlaLed::setRefreshRate(int refreshRate) } -void AlaLed::setAnimation(int animation, int speed) +void AlaLed::setAnimation(int animation, long speed) { if (this->animation == animation && this->speed == speed) return; @@ -88,6 +88,10 @@ void AlaLed::setAnimation(AlaSeq animSeq[]) } +void AlaLed::nextAnimation() +{ + currAnim = (currAnim+1)%animSeqLen; +} void AlaLed::runAnimation() { diff --git a/AlaLed.h b/src/AlaLed.h similarity index 95% rename from AlaLed.h rename to src/AlaLed.h index 09fe098..fdc300d 100644 --- a/AlaLed.h +++ b/src/AlaLed.h @@ -57,13 +57,14 @@ class AlaLed * May be useful to reduce flickering in some cases. */ void setRefreshRate(int refreshRate); + + int getRefreshRate(); - - void setAnimation(int animation, int speed); + void setAnimation(int animation, long speed); void setAnimation(AlaSeq animSeq[]); void runAnimation(); - + void nextAnimation(); private: @@ -104,8 +105,8 @@ class AlaLed int refreshMillis; int animation; + int currAnim; long speed; - AlaSeq *animSeq; int animSeqLen; long animSeqDuration; diff --git a/AlaLedRgb.cpp b/src/AlaLedRgb.cpp similarity index 98% rename from AlaLedRgb.cpp rename to src/AlaLedRgb.cpp index b296796..abbd445 100644 --- a/AlaLedRgb.cpp +++ b/src/AlaLedRgb.cpp @@ -105,7 +105,7 @@ int AlaLedRgb::getRefreshRate() } -void AlaLedRgb::setAnimation(int animation, int speed, AlaColor color) +void AlaLedRgb::setAnimation(int animation, long speed, AlaColor color) { if (this->animation == animation && this->speed == speed && this->palette.numColors == 1 && this->palette.colors[0] == color) return; @@ -127,7 +127,7 @@ void AlaLedRgb::setAnimation(int animation, int speed, AlaColor color) animStartTime = millis(); } -void AlaLedRgb::setAnimation(int animation, int speed, AlaPalette palette) +void AlaLedRgb::setAnimation(int animation, long speed, AlaPalette palette) { if (this->animation == animation && this->speed == speed && this->palette == palette) return; @@ -268,7 +268,6 @@ void AlaLedRgb::setAnimationFunc(int animation) case ALA_PIXELSFADECOLORS: animFunc = &AlaLedRgb::pixelsFadeColors; break; case ALA_FADECOLORS: animFunc = &AlaLedRgb::fadeColors; break; case ALA_FADECOLORSLOOP: animFunc = &AlaLedRgb::fadeColorsLoop; break; - case ALA_FIRE: animFunc = &AlaLedRgb::fire; break; case ALA_BOUNCINGBALLS: animFunc = &AlaLedRgb::bouncingBalls; break; @@ -721,7 +720,7 @@ void AlaLedRgb::bubbles() for (int i=0; i