|
@@ -3,12 +3,12 @@
|
|
|
#include "pca9685.h"
|
|
|
#include "animation.h"
|
|
|
|
|
|
-void Animate_Cycle_Basic(void) {
|
|
|
+void Animate_Cycle_Basic(int iterations) {
|
|
|
|
|
|
PCA9685_SetVoltage(1.0);
|
|
|
|
|
|
|
|
|
- for (int i = 0; i < 10; i++) {
|
|
|
+ for (int i = 0; i < iterations; i++) {
|
|
|
if (i % 2 == 0) {
|
|
|
PCA9685_SetDot(PCA9685_Min_Brightness);
|
|
|
} else {
|
|
@@ -27,9 +27,9 @@ void Animate_Cycle_Basic(void) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void Animate_Cycle_Analog(void) {
|
|
|
+void Animate_Cycle_Analog(int iterations) {
|
|
|
|
|
|
- for (int i = 0; i < 10; i++) {
|
|
|
+ for (int i = 0; i < iterations; i++) {
|
|
|
|
|
|
PCA9685_EnableOutput(false);
|
|
|
float minVoltage = 0.09;
|
|
@@ -73,13 +73,13 @@ void Animate_Cycle_Analog(void) {
|
|
|
PCA9685_EnableOutput(true);
|
|
|
}
|
|
|
|
|
|
-void Animate_Cycle_Low_Pwm(void) {
|
|
|
+void Animate_Cycle_Low_Pwm(int iterations) {
|
|
|
|
|
|
PCA9685_SetVoltage(1.0);
|
|
|
PCA9685_SetDot(PCA9685_Min_Brightness);
|
|
|
|
|
|
int pwmMaxBrightness = 200;
|
|
|
- for (int i = 0; i < 10; i++) {
|
|
|
+ for (int i = 0; i < iterations; i++) {
|
|
|
for (int k = PCA9685_Min_Brightness; k <= pwmMaxBrightness; k++) {
|
|
|
for (int j = 0; j < 4; j++) {
|
|
|
PCA9685_SetDigit(j, i, k);
|
|
@@ -98,12 +98,12 @@ void Animate_Cycle_Low_Pwm(void) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void Animate_Cycle_Pwm(void) {
|
|
|
+void Animate_Cycle_Pwm(int iterations) {
|
|
|
|
|
|
PCA9685_SetVoltage(1.0);
|
|
|
PCA9685_SetDot(PCA9685_Min_Brightness);
|
|
|
|
|
|
- for (int i = 0; i < 10; i++) {
|
|
|
+ for (int i = 0; i < iterations; i++) {
|
|
|
for (int k = PCA9685_Min_Brightness; k <= PCA9685_Max_Brightness; k += 4) {
|
|
|
for (int j = 0; j < 4; j++) {
|
|
|
PCA9685_SetDigit(j, i, k);
|
|
@@ -122,12 +122,12 @@ void Animate_Cycle_Pwm(void) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void Animate_Cycle_Fade(void) {
|
|
|
+void Animate_Cycle_Fade(int iterations) {
|
|
|
|
|
|
PCA9685_SetVoltage(1.0);
|
|
|
PCA9685_SetDot(PCA9685_Min_Brightness);
|
|
|
|
|
|
- for (int i = 0; i < 10; i++) {
|
|
|
+ for (int i = 0; i < iterations; i++) {
|
|
|
int i_next = (i == 9) ? 0 : i+1;
|
|
|
for (int k = PCA9685_Min_Brightness; k <= PCA9685_Max_Brightness; k += 4) {
|
|
|
for (int j = 0; j < 4; j++) {
|
|
@@ -151,7 +151,7 @@ void Animate_Cycle_Fade(void) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void Animate_Cycle_Fade_Random(void) {
|
|
|
+void Animate_Cycle_Fade_Random(int iterations) {
|
|
|
|
|
|
int i_curr[4];
|
|
|
int i_next[4];
|
|
@@ -170,7 +170,7 @@ void Animate_Cycle_Fade_Random(void) {
|
|
|
wait(0.00005);
|
|
|
}
|
|
|
|
|
|
- for (int iter = 0; iter < 10; iter++) {
|
|
|
+ for (int iter = 0; iter < iterations; iter++) {
|
|
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
do {
|
|
@@ -204,12 +204,12 @@ void Animate_Cycle_Fade_Random(void) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void Animate_Cycle_Fast(void) {
|
|
|
+void Animate_Cycle_Fast(int iterations) {
|
|
|
|
|
|
PCA9685_SetVoltage(1.0);
|
|
|
PCA9685_SetDot(PCA9685_Min_Brightness);
|
|
|
|
|
|
- for (int k = 0; k < 10; k++) {
|
|
|
+ for (int k = 0; k < iterations; k++) {
|
|
|
for (int i = 0; i < 10; i++) {
|
|
|
for (int j = 0; j < 4; j++) {
|
|
|
PCA9685_SetDigit(j, i, PCA9685_Max_Brightness);
|
|
@@ -227,7 +227,7 @@ void Animate_Cycle_Fast(void) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void Animate_Cycle_Fast_Random(void) {
|
|
|
+void Animate_Cycle_Fast_Random(int iterations) {
|
|
|
|
|
|
int i_curr[4];
|
|
|
int i_next[4];
|
|
@@ -239,7 +239,7 @@ void Animate_Cycle_Fast_Random(void) {
|
|
|
i_curr[i] = rand() % 10;
|
|
|
}
|
|
|
|
|
|
- for (int k = 0; k < 100; k++) {
|
|
|
+ for (int k = 0; k < iterations; k++) {
|
|
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
do {
|